text
stringlengths
8
4.13M
//! Simple library that can be used to represent a grow-able bit array. //! //! Functionality includes `FIFO`, concatenation and setting bits `ON` and `OFF`. //! //! # Usage //! //! This crate is not published on `crates.io` and can be used by adding `bit_array_list` under the //! `dependencies` section name in your project's `Cargo.toml` as follows: //! //! ```toml //! [dependencies] //! bit_array_list = { git = "https://github.com/konstantindt/bit-array-list" } //! ``` //! //! and the following to your crate root: //! //! ```rust //! extern crate bit_array_list; //! ``` //! //! # Examples //! //! The following example shows how we can implement boolean flags. //! //! ```{.rust} //! extern crate bit_array_list; //! //! use bit_array_list::BitArrayList; //! //! fn main() { //! // Light 16 LEDs in the pattern 0000101010100101. //! let leds = BitArrayList::from(vec![10, 165], 16); //! // Lit LEDs are: //! assert!(leds.is_set(4)); //! assert!(leds.is_set(6)); //! assert!(leds.is_set(8)); //! assert!(leds.is_set(10)); //! assert!(leds.is_set(13)); //! assert!(leds.is_set(15)); //! // Off LEDs are: //! assert!(!leds.is_set(0)); //! assert!(!leds.is_set(1)); //! assert!(!leds.is_set(2)); //! assert!(!leds.is_set(3)); //! assert!(!leds.is_set(5)); //! assert!(!leds.is_set(7)); //! assert!(!leds.is_set(9)); //! assert!(!leds.is_set(11)); //! assert!(!leds.is_set(12)); //! assert!(!leds.is_set(14)); //! } //! ``` use std::fmt; /// A contiguous grow-able array type consisting of a list of bits. /// /// Internally the array stores an array of bytes and so the bit array length depics wasted space /// up to 7 bits---no more than a byte. Most computer architectures perceive the byte as the /// smallest unit of data. /// /// # Examples /// /// Calculate wasted space: /// /// ``` /// use bit_array_list::BitArrayList; /// let bit_array = BitArrayList::from(vec![255, 32], 11); /// /// let wasted_space = bit_array.bytes().len() * 8 - bit_array.len(); /// assert_eq!(wasted_space, 5); /// ``` #[derive(Clone, Debug)] pub struct BitArrayList { bytes: Vec<u8>, length: usize, } impl BitArrayList { /// Returns the bit at a given index `i`. /// /// * Returns ```true``` if bit at `i` is `1`. /// * Returns ```false``` if bit at `i` is `0`. /// /// # Panics /// /// If `i` is not within bounds (`i >= bit_array.len()`). /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let bit_array = BitArrayList::from(vec![64, 32], 11); /// /// assert!(bit_array.is_set(1)); /// assert!(bit_array.is_set(10)); /// assert!(!bit_array.is_set(0)); /// ``` pub fn is_set(&self, bit_index: usize) -> bool { if bit_index < self.length { let (byte_index, bit_position) = split_index(bit_index); self.zero_testing(byte_index, bit_position) } else { panic!("BitArrayList index out of bounds: index is {} but array length is {}.", bit_index, self.length); } } /// Returns the number of elements in the bit array. /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let bit_array = BitArrayList::from(vec![12, 16], 12); /// /// assert_eq!(bit_array.len(), 12); /// ``` pub fn len(&self) -> usize { self.length } /// Helper method to perform `self.length < 1 i.e returns` `true` if bit array has no /// elements. /// /// # Examples /// /// ``` /// use bit_array_list::BitArrayList; /// let mut bit_array = BitArrayList::new(); /// /// assert!(bit_array.is_empty()); /// /// bit_array.push(0); /// assert!(!bit_array.is_empty()); /// ``` pub fn is_empty(&self) -> bool { self.length < 1 } /// Returns the raw underlying array data structure of bytes. /// /// Note that this array may contain wasted space and without knowing the length of the bit /// array at the time we cannot successfully recreate the bit array from this operation. /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let bit_array = BitArrayList::from(vec![12, 70], 15); /// /// assert_eq!(bit_array.bytes(), &vec![12, 70]); /// ``` pub fn bytes(&self) -> &Vec<u8> { &self.bytes } /// Helper method for turing [is_set()][1] output to /// string slice. /// /// [1]: struct.BitArrayList.html#method.is_set /// /// # Panics /// /// see [is_set()][2]. /// /// [2]: struct.BitArrayList.html#panics /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let bit_array = BitArrayList::from(vec![64, 32], 11); /// /// assert_eq!(bit_array.bit_to_str(1), "1"); /// assert_eq!(bit_array.bit_to_str(10), "1"); /// assert_eq!(bit_array.bit_to_str(0), "0"); /// ``` pub fn bit_to_str(&self, bit_index: usize) -> &str { match self.is_set(bit_index) { true => "1", false => "0", } } /// Set a pre-exising bit (at index `i`) to the specified value. /// /// # Panics /// /// If `i` is not within bounds (`i >= bit_array.len()`). /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let mut bit_array = BitArrayList::from(vec![64, 128], 9); /// /// bit_array.set_bit_to(1, 0); /// bit_array.set_bit_to(2, 1); /// assert_eq!(bit_array.bytes(), &vec![32, 128]); /// ``` pub fn set_bit_to(&mut self, bit_index: usize, bit: u8) { if bit_index < self.length { let (byte_index, bit_position) = split_index(bit_index); // Set bit to user's preferences. match bit { 1 => self.bytes[byte_index] |= bitmask(bit_position), 0 => self.bytes[byte_index] &= !bitmask(bit_position), _ => panic!("Mismatched types: expected a u8 equal to 1 or 0."), } } else { panic!("BitArrayList index out of bounds: index is {} but array length is {}.", bit_index, self.length); } } /// Appends a given bit to the back of the collection of bits. /// /// # Panics /// /// If the number of internal bytes representing the bits overflows a `usize`. /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let mut bit_array = BitArrayList::from(vec![200, 128], 15); /// /// bit_array.push(1); /// bit_array.push(1); /// bit_array.push(0); /// assert_eq!(bit_array.bytes(), &vec![200, 129, 128]); /// ``` pub fn push(&mut self, bit: u8) { let (byte_index, bit_position) = split_index(self.length); if byte_index > self.bytes.len() - 1 { // Add new empty byte. self.bytes.push(0); } // Add the user's bit. match bit { 1 => self.bytes[byte_index] |= bitmask(bit_position), 0 => { /* Position at bit index is already initialised as 0 */ } _ => panic!("Mismatched types: expected a u8 equal to 1 or 0."), } // Update data structure length. self.length += 1; } /// Removes and returns the last bit in the collection unless collection is empty where /// `None` is returned. /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let mut bit_array = BitArrayList::from(vec![128], 2); /// /// assert_eq!(bit_array.pop(), Some(false)); /// assert_eq!(bit_array.pop(), Some(true)); /// assert_eq!(bit_array.pop(), None); /// ``` pub fn pop(&mut self) -> Option<bool> { if self.is_empty() { // Also avoids subtract with overflow. return None; } // Initialise indexes. let last_bit_index = self.length - 1; let (byte_index, bit_position) = split_index(last_bit_index); let to_return = Some(self.zero_testing(byte_index, bit_position)); if bit_position == 0 && self.bytes.len() > 2 && byte_index == self.bytes.len() - 1 { // Remove last empty byte unless we only have one byte. self.bytes.pop(); } else { // Remove old data. self.bytes[byte_index] &= !bitmask(bit_position); } // Update data structure length. self.length -= 1; to_return } /// Appends two bit arrays together (self followed by other bits). /// /// Leaves other bits array unusable (dropped by Rust). /// /// Operation is fast if self has no wasted space in the last byte otherwise we push each bit /// from the other bits into self one by one. /// /// # Panics /// /// see [push()][3]. /// /// [3]: struct.BitArrayList.html#panics-3 /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let mut bit_array = BitArrayList::from(vec![213, 128], 9); /// /// bit_array.concatenate(BitArrayList::from(vec![48], 4)); /// assert_eq!(bit_array.bytes(), &vec![213, 152]); /// assert_eq!(bit_array.len(), 9 + 4); /// ``` pub fn concatenate(&mut self, other_bits: BitArrayList) { if self.length % 8 != 0 { // Push each bit in self from BitArrayList we are extending self with. for bit_index in 0..other_bits.length { match other_bits.is_set(bit_index) { true => self.push(1), false => self.push(0), } } } else { // No need to fill empty space at last byte. if self.is_empty() { self.bytes = other_bits.bytes; } else { self.bytes.extend(other_bits.bytes.into_iter()); } // Extend self's length. self.length += other_bits.length; } } /// Constructs a new empty `BitArrayList`. /// /// The new bit array will not allocate bits until bits are pushed into it. /// /// # Examples /// /// Basic usage: /// /// ``` /// use bit_array_list::BitArrayList; /// let bit_array = BitArrayList::new(); /// /// assert!(bit_array.is_empty()); /// ``` pub fn new() -> BitArrayList { BitArrayList { bytes: vec![0], length: 0, } } /// This helper method converts a `Vec` of bytes and a length to a `BitArrayList`. /// /// # Safety /// /// Specifying a shorter length will not drop the elements after the last index and they may be /// read with [bytes][4]. /// /// [4]: struct.BitArrayList.html#method.bytes /// /// # Examples /// /// Information left behind: /// /// ``` /// use bit_array_list::BitArrayList; /// let mut bit_array = BitArrayList::from(vec![128, 224], 10); /// /// assert_eq!(bit_array.pop(), Some(true)); /// // 11th bit is still set. /// assert_eq!(bit_array.bytes(), &vec![128, 128 + 32]); /// ``` pub fn from(b: Vec<u8>, l: usize) -> BitArrayList { BitArrayList { bytes: b, length: l, } } /// Use this method to determine if bit at index `i` is set or not. fn zero_testing(&self, byte_index: usize, bit_position: u8) -> bool { if self.bytes[byte_index] & bitmask(bit_position) != 0 { true } else { false } } } impl fmt::Display for BitArrayList { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.length { 0 => write!(f, "[]"), 1 => write!(f, "[{}]", self.bit_to_str(0)), n => { write!(f, "[").unwrap(); for i in 0..n - 1 { write!(f, "{}, ", self.bit_to_str(i)).unwrap(); } write!(f, "{}]", self.bit_to_str(n - 1)) } } } } /// Use this method to convert a bit index to a byte index and the relevant index of the bit within /// that byte. fn split_index(to_split: usize) -> (usize, u8) { (to_split / 8, (to_split % 8) as u8) } /// Use this method to get the byte which singles out the the bit with given index `i` within some /// byte. /// /// # Panics /// /// If `i >= 8`. fn bitmask(bit_position: u8) -> u8 { if bit_position < 8 { 128 >> bit_position } else { panic!("Bit index within some byte is out of bounds."); } } #[cfg(test)] mod tests { #[test] fn bitmask_generation() { use std::panic::catch_unwind; assert_eq!(super::bitmask(0), 128); assert_eq!(super::bitmask(5), 4); assert!(catch_unwind(|| super::bitmask(9)).is_err()); } #[test] fn index_splitting() { assert_eq!(super::split_index(5), (0, 5)); assert_eq!(super::split_index(8), (1, 0)); assert_eq!(super::split_index(19), (2, 3)); } }
pub mod week1; pub mod week2; pub mod week3; pub mod week4;
use crate::extensions::context::ClientContextExt; use crate::services::database::guild::Query; use anyhow::Result; use crate::extensions::ChannelExt; use crate::models::apod::Apod; use crate::services::database::apod::DBApod; use serenity::prelude::Context; use std::error::Error; use std::sync::Arc; pub async fn check_apod(ctx: Arc<Context>) -> Result<(), Box<dyn Error>> { let (db, config) = ctx.get_db_and_config().await; let apod = Apod::fetch(&config.nasa_key).await?; let mut dbapod = DBApod::from(&apod); db.get_apod_dispatched(&mut dbapod).await; if dbapod.dispatched { return Ok(()); } let guilds = db.get_guilds_queried(true, Query::Apod).await; for guild in guilds { if let Some(channel) = guild.channel_id.fetch(&ctx).await { if channel.send_apod(&ctx, &apod).await.is_err() { continue; } } } dbapod.dispatched = true; db.set_apod(&dbapod).await?; Ok(()) }
#![allow(dead_code)] use core::fmt::Display; use core::fmt::Formatter; use failure::Error; use futures::IntoFuture; use futures::{Future, Stream}; use futures_locks::Mutex as FuturesMutex; use std::sync::Arc; type AsyncWorkIO<T> = Box<dyn Future<Item = T, Error = Error> + Send>; struct InternalWorkIO(pub String); struct ExternalWorkIO(pub String); enum WorkIO { InternalWorkIO(InternalWorkIO), ExternalWorkIO(ExternalWorkIO), } impl WorkIO { fn get_string(self: &Self) -> String { match self { WorkIO::InternalWorkIO(io) => io.0.clone(), WorkIO::ExternalWorkIO(io) => io.0.clone(), } } } impl Display for InternalWorkIO { fn fmt(self: &Self, formatter: &mut Formatter) -> Result<(), std::fmt::Error> { write!(formatter, "{}", self.0) } } impl Display for ExternalWorkIO { fn fmt(self: &Self, formatter: &mut Formatter) -> Result<(), std::fmt::Error> { write!(formatter, "{}", self.0) } } impl Display for WorkIO { fn fmt(self: &Self, formatter: &mut Formatter) -> Result<(), std::fmt::Error> { write!(formatter, "{}", self.get_string()) } } trait AsyncWorker<T> where Self: Sync + Send, T: Sync + Send, { fn run(self: &mut Self, input: T) -> AsyncWorkIO<T>; } trait AsyncWorkerInternal { fn run_internal(self: &mut Self, input: InternalWorkIO) -> AsyncWorkIO<InternalWorkIO>; } trait AsyncWorkerExternal { fn run_external(self: &mut Self, input: ExternalWorkIO) -> AsyncWorkIO<ExternalWorkIO>; } type Work = Arc<FuturesMutex<Box<dyn AsyncWorker<WorkIO>>>>; type WorkCollection = Vec<Work>; struct InternalWorkWrapper<T>(T); struct ExternalWorkWrapper<T>(T); impl<T> AsyncWorker<WorkIO> for InternalWorkWrapper<T> where T: AsyncWorkerInternal, T: Sync + Send, { fn run(self: &mut Self, input: WorkIO) -> AsyncWorkIO<WorkIO> { Box::new( self.0 .run_internal(match input { WorkIO::InternalWorkIO(io) => io, WorkIO::ExternalWorkIO(io) => InternalWorkIO(io.0), }) .map(WorkIO::InternalWorkIO), ) } } impl<T> AsyncWorker<WorkIO> for ExternalWorkWrapper<T> where T: AsyncWorkerExternal, T: Sync + Send, { fn run(self: &mut Self, input: WorkIO) -> AsyncWorkIO<WorkIO> { Box::new( self.0 .run_external(match input { WorkIO::InternalWorkIO(io) => ExternalWorkIO(io.0), WorkIO::ExternalWorkIO(io) => io, }) .map(WorkIO::ExternalWorkIO), ) } } fn process<T>(work_collection: T, initial_io: WorkIO) -> AsyncWorkIO<String> where T: Iterator<Item = &'static Work>, T: Sync + Send, T: 'static, { let future_work = futures::stream::iter_ok::<_, Error>(work_collection) .fold( futures::future::Either::A(futures::future::ok(initial_io)), |future_input, next_item_mutex| { println!("[] getting work lock..."); next_item_mutex .lock() .map_err(|_| failure::err_msg("could not acquire the mutex lock")) .join(future_input) .map(|(mut next_item, input)| { println!("[] got work lock!"); println!("[] input: {}", input); futures::future::Either::B((*next_item).run(input)) }) }, ) .into_future() .flatten() .map(|io| io.get_string()); Box::new(future_work) } #[cfg(test)] mod tests { use super::*; use failure::Fallible; struct InternalCountingForwarder(pub usize); impl AsyncWorkerInternal for InternalCountingForwarder { fn run_internal(self: &mut Self, input: InternalWorkIO) -> AsyncWorkIO<InternalWorkIO> { println!("Processing {}th run. Input {}", self.0, input); self.0 += 1; Box::new(futures::future::ok(InternalWorkIO(format!( "{}{}", input, self.0 % 10 )))) } } struct ExternalCountingForwarder(pub usize); impl AsyncWorkerExternal for ExternalCountingForwarder { fn run_external(self: &mut Self, input: ExternalWorkIO) -> AsyncWorkIO<ExternalWorkIO> { println!("Processing {}th run. Input {}", self.0, input); self.0 += 1; Box::new(futures::future::ok(ExternalWorkIO(format!( "{}{}", input, self.0 % 10 )))) } } #[test] fn test_process() -> Fallible<()> { lazy_static! { static ref WORK_COLLECTION: WorkCollection = vec![ Arc::new(FuturesMutex::new(Box::new(InternalWorkWrapper( InternalCountingForwarder(0) )))), Arc::new(FuturesMutex::new(Box::new(ExternalWorkWrapper( ExternalCountingForwarder(0) )))), Arc::new(FuturesMutex::new(Box::new(InternalWorkWrapper( InternalCountingForwarder(0) )))), Arc::new(FuturesMutex::new(Box::new(ExternalWorkWrapper( ExternalCountingForwarder(0) )))), ]; } let mut runtime = tokio::runtime::Runtime::new().unwrap(); for _ in 0..10 { let async_result = process( WORK_COLLECTION.iter(), WorkIO::InternalWorkIO(InternalWorkIO("".to_string())), ); let result: String = runtime.block_on(async_result).expect("work failed"); assert_eq!(result.len(), WORK_COLLECTION.len()); } Ok(()) } }
use image::DynamicImage; use std::env; use std::fs::File; use std::io::Read; use std::path::Path; use std::vec::Vec; use vtf::Error; fn main() -> Result<(), Error> { let args: Vec<_> = env::args().collect(); if args.len() != 3 { panic!("Usage: png <path to vtf file> <destination of new png file>"); } let path = Path::new(&args[1]); let mut file = File::open(path)?; let mut buf = Vec::new(); file.read_to_end(&mut buf)?; let vtf = vtf::from_bytes(&mut buf)?; let image = vtf.highres_image.decode(0)?; // rgb and rgba images we can save directly, for other formats we convert to rgba match image { DynamicImage::ImageRgb8(_) => image.save(&args[2])?, DynamicImage::ImageRgba8(_) => image.save(&args[2])?, DynamicImage::ImageBgra8(_) => image.to_rgba().save(&args[2])?, _ => image.to_rgb().save(&args[2])?, }; Ok(()) }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qstring.h // dst-file: /src/core/qstring.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main block end // use block begin => use std::ops::Deref; use super::qchar::*; // 773 use super::qregularexpression::*; // 773 // use super::qstring::QStringRef; // 773 use super::qregexp::*; // 773 use super::qbytearray::*; // 773 // use super::qvector::*; // 775 // use super::qstring::QString; // 773 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QStringDataPtr_Class_Size() -> c_int; fn QString_Class_Size() -> c_int; // proto: qlonglong QString::toLongLong(bool * ok, int base); fn C_ZNK7QString10toLongLongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_longlong; // proto: bool QString::isNull(); fn C_ZNK7QString6isNullEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString & QString::append(const QChar * uc, int len); fn C_ZN7QString6appendEPK5QChari(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> *mut c_void; // proto: QString & QString::prepend(QChar c); fn C_ZN7QString7prependE5QChar(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QString & QString::insert(int i, QChar c); fn C_ZN7QString6insertEi5QChar(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void) -> *mut c_void; // proto: QString QString::left(int n); fn C_ZNK7QString4leftEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QString::QString(QChar c); fn C_ZN7QStringC2E5QChar(arg0: *mut c_void) -> u64; // proto: QString & QString::prepend(const char * s); fn C_ZN7QString7prependEPKc(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> *mut c_void; // proto: int QString::lastIndexOf(const QRegularExpression & re, int from); fn C_ZNK7QString11lastIndexOfERK18QRegularExpressioni(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> c_int; // proto: static QString QString::number(int , int base); fn C_ZN7QString6numberEii(arg0: c_int, arg1: c_int) -> *mut c_void; // proto: void QString::resize(int size); fn C_ZN7QString6resizeEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QString::push_front(QChar c); fn C_ZN7QString10push_frontE5QChar(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QString::QString(); fn C_ZN7QStringC2Ev() -> u64; // proto: double QString::toDouble(bool * ok); fn C_ZNK7QString8toDoubleEPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> c_double; // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8); fn C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void, arg4: *mut c_void, arg5: *mut c_void, arg6: *mut c_void, arg7: *mut c_void) -> *mut c_void; // proto: QStringRef QString::rightRef(int n); fn C_ZNK7QString8rightRefEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QString & QString::setNum(short , int base); fn C_ZN7QString6setNumEsi(qthis: u64 /* *mut c_void*/, arg0: c_short, arg1: c_int) -> *mut c_void; // proto: void QString::QString(const QChar * unicode, int size); fn C_ZN7QStringC2EPK5QChari(arg0: *mut c_void, arg1: c_int) -> u64; // proto: float QString::toFloat(bool * ok); fn C_ZNK7QString7toFloatEPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> c_float; // proto: int QString::count(const QRegularExpression & re); fn C_ZNK7QString5countERK18QRegularExpression(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QStringRef QString::midRef(int position, int n); fn C_ZNK7QString6midRefEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: void QString::detach(); fn C_ZN7QString6detachEv(qthis: u64 /* *mut c_void*/); // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4); fn C_ZNK7QString3argERKS_S1_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void) -> *mut c_void; // proto: QString QString::arg(long a, int fieldwidth, int base, QChar fillChar); fn C_ZNK7QString3argElii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_long, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: int QString::count(); fn C_ZNK7QString5countEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QString & QString::setNum(qulonglong , int base); fn C_ZN7QString6setNumEyi(qthis: u64 /* *mut c_void*/, arg0: c_ulonglong, arg1: c_int) -> *mut c_void; // proto: void QString::push_back(QChar c); fn C_ZN7QString9push_backE5QChar(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString & QString::setNum(float , char f, int prec); fn C_ZN7QString6setNumEfci(qthis: u64 /* *mut c_void*/, arg0: c_float, arg1: c_char, arg2: c_int) -> *mut c_void; // proto: int QString::count(const QRegExp & ); fn C_ZNK7QString5countERK7QRegExp(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: int QString::size(); fn C_ZNK7QString4sizeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QString & QString::insert(int i, const QChar * uc, int len); fn C_ZN7QString6insertEiPK5QChari(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void, arg2: c_int) -> *mut c_void; // proto: QString & QString::replace(int i, int len, const QChar * s, int slen); fn C_ZN7QString7replaceEiiPK5QChari(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void, arg3: c_int) -> *mut c_void; // proto: static QString QString::fromRawData(const QChar * , int size); fn C_ZN7QString11fromRawDataEPK5QChari(arg0: *mut c_void, arg1: c_int) -> *mut c_void; // proto: QString QString::trimmed(); fn C_ZNO7QString7trimmedEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::insert(int i, const QString & s); fn C_ZN7QString6insertEiRKS_(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void) -> *mut c_void; // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5); fn C_ZNK7QString3argERKS_S1_S1_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void, arg4: *mut c_void) -> *mut c_void; // proto: QString & QString::setRawData(const QChar * unicode, int size); fn C_ZN7QString10setRawDataEPK5QChari(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> *mut c_void; // proto: QString & QString::prepend(const QString & s); fn C_ZN7QString7prependERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QString & QString::sprintf(const char * format); fn C_ZN7QString7sprintfEPKcz(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> *mut c_void; // proto: ulong QString::toULong(bool * ok, int base); fn C_ZNK7QString7toULongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_ulong; // proto: void QString::chop(int n); fn C_ZN7QString4chopEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: static QString QString::fromUtf16(const ushort * , int size); fn C_ZN7QString9fromUtf16EPKti(arg0: *mut c_ushort, arg1: c_int) -> *mut c_void; // proto: bool QString::isDetached(); fn C_ZNK7QString10isDetachedEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString & QString::setNum(qlonglong , int base); fn C_ZN7QString6setNumExi(qthis: u64 /* *mut c_void*/, arg0: c_longlong, arg1: c_int) -> *mut c_void; // proto: QString QString::mid(int position, int n); fn C_ZNK7QString3midEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: static QString QString::fromLocal8Bit(const char * str, int size); fn C_ZN7QString13fromLocal8BitEPKci(arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: void QString::swap(QString & other); fn C_ZN7QString4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString & QString::vsprintf(const char * format, va_list ap); fn C_ZN7QString8vsprintfEPKci(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: static QString QString::fromUtf8(const QByteArray & str); fn C_ZN7QString8fromUtf8ERK10QByteArray(arg0: *mut c_void) -> *mut c_void; // proto: static QString QString::fromUcs4(const char32_t * str, int size); fn C_ZN7QString8fromUcs4EPKDii(arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: QString QString::leftJustified(int width, QChar fill, bool trunc); fn C_ZNK7QString13leftJustifiedEi5QCharb(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void, arg2: c_char) -> *mut c_void; // proto: int QString::indexOf(const QRegExp & , int from); fn C_ZNK7QString7indexOfERK7QRegExpi(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> c_int; // proto: void QString::push_back(const QString & s); fn C_ZN7QString9push_backERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QString::lastIndexOf(QRegExp & , int from); fn C_ZNK7QString11lastIndexOfER7QRegExpi(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> c_int; // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3); fn C_ZNK7QString3argERKS_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void) -> *mut c_void; // proto: const ushort * QString::utf16(); fn C_ZNK7QString5utf16Ev(qthis: u64 /* *mut c_void*/) -> *mut c_ushort; // proto: int QString::toInt(bool * ok, int base); fn C_ZNK7QString5toIntEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_int; // proto: QByteArray QString::toUtf8(); fn C_ZNO7QString6toUtf8Ev(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillChar); fn C_ZNK7QString3argEdici5QChar(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: c_int, arg2: c_char, arg3: c_int, arg4: *mut c_void) -> *mut c_void; // proto: QChar * QString::data(); fn C_ZN7QString4dataEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QString::toCaseFolded(); fn C_ZNO7QString12toCaseFoldedEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::setNum(uint , int base); fn C_ZN7QString6setNumEji(qthis: u64 /* *mut c_void*/, arg0: c_uint, arg1: c_int) -> *mut c_void; // proto: static int QString::localeAwareCompare(const QString & s1, const QString & s2); fn C_ZN7QString18localeAwareCompareERKS_S1_(arg0: *mut c_void, arg1: *mut c_void) -> c_int; // proto: void QString::QString(const char * ch); fn C_ZN7QStringC2EPKc(arg0: *mut c_char) -> u64; // proto: static QString QString::fromUtf16(const char16_t * str, int size); fn C_ZN7QString9fromUtf16EPKDsi(arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: QString & QString::replace(const QRegExp & rx, const QString & after); fn C_ZN7QString7replaceERK7QRegExpRKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QString QString::repeated(int times); fn C_ZNK7QString8repeatedEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QString QString::toLower(); fn C_ZNO7QString7toLowerEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::setUtf16(const ushort * utf16, int size); fn C_ZN7QString8setUtf16EPKti(qthis: u64 /* *mut c_void*/, arg0: *mut c_ushort, arg1: c_int) -> *mut c_void; // proto: void QString::clear(); fn C_ZN7QString5clearEv(qthis: u64 /* *mut c_void*/); // proto: bool QString::contains(const QRegExp & rx); fn C_ZNK7QString8containsERK7QRegExp(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: bool QString::isSharedWith(const QString & other); fn C_ZNK7QString12isSharedWithERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: static QString QString::fromLatin1(const QByteArray & str); fn C_ZN7QString10fromLatin1ERK10QByteArray(arg0: *mut c_void) -> *mut c_void; // proto: void QString::~QString(); fn C_ZN7QStringD2Ev(qthis: u64 /* *mut c_void*/); // proto: QString & QString::remove(const QRegularExpression & re); fn C_ZN7QString6removeERK18QRegularExpression(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QString & QString::setNum(int , int base); fn C_ZN7QString6setNumEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: const_iterator QString::cend(); fn C_ZNK7QString4cendEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QString::toHtmlEscaped(); fn C_ZNK7QString13toHtmlEscapedEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QString::lastIndexOf(const QRegularExpression & re, int from, QRegularExpressionMatch * rmatch); fn C_ZNK7QString11lastIndexOfERK18QRegularExpressioniP23QRegularExpressionMatch(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int, arg2: *mut c_void) -> c_int; // proto: QString & QString::append(const QByteArray & s); fn C_ZN7QString6appendERK10QByteArray(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: static QString QString::fromLatin1(const char * str, int size); fn C_ZN7QString10fromLatin1EPKci(arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: bool QString::contains(const QRegularExpression & re, QRegularExpressionMatch * match); fn C_ZNK7QString8containsERK18QRegularExpressionP23QRegularExpressionMatch(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> c_char; // proto: int QString::indexOf(const QRegularExpression & re, int from, QRegularExpressionMatch * rmatch); fn C_ZNK7QString7indexOfERK18QRegularExpressioniP23QRegularExpressionMatch(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int, arg2: *mut c_void) -> c_int; // proto: int QString::lastIndexOf(const QRegExp & , int from); fn C_ZNK7QString11lastIndexOfERK7QRegExpi(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> c_int; // proto: int QString::toWCharArray(wchar_t * array); fn C_ZNK7QString12toWCharArrayEPw(qthis: u64 /* *mut c_void*/, arg0: *mut wchar_t) -> c_int; // proto: const_iterator QString::cbegin(); fn C_ZNK7QString6cbeginEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::prepend(const QByteArray & s); fn C_ZN7QString7prependERK10QByteArray(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QString & QString::replace(int i, int len, const QString & after); fn C_ZN7QString7replaceEiiRKS_(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7); fn C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void, arg4: *mut c_void, arg5: *mut c_void, arg6: *mut c_void) -> *mut c_void; // proto: static QString QString::fromWCharArray(const wchar_t * string, int size); fn C_ZN7QString14fromWCharArrayEPKwi(arg0: *mut wchar_t, arg1: c_int) -> *mut c_void; // proto: QString & QString::fill(QChar c, int size); fn C_ZN7QString4fillE5QChari(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> *mut c_void; // proto: const QChar * QString::constData(); fn C_ZNK7QString9constDataEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: static QString QString::number(ulong , int base); fn C_ZN7QString6numberEmi(arg0: c_ulong, arg1: c_int) -> *mut c_void; // proto: long QString::toLong(bool * ok, int base); fn C_ZNK7QString6toLongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_long; // proto: QString QString::toUpper(); fn C_ZNO7QString7toUpperEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: const_iterator QString::constEnd(); fn C_ZNK7QString8constEndEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QString::length(); fn C_ZNK7QString6lengthEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: static QString QString::fromUtf8(const char * str, int size); fn C_ZN7QString8fromUtf8EPKci(arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: QString QString::simplified(); fn C_ZNO7QString10simplifiedEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: static QString QString::number(qlonglong , int base); fn C_ZN7QString6numberExi(arg0: c_longlong, arg1: c_int) -> *mut c_void; // proto: QStringRef QString::leftRef(int n); fn C_ZNK7QString7leftRefEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QString & QString::setNum(long , int base); fn C_ZN7QString6setNumEli(qthis: u64 /* *mut c_void*/, arg0: c_long, arg1: c_int) -> *mut c_void; // proto: QString QString::arg(const QString & a1, const QString & a2); fn C_ZNK7QString3argERKS_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: bool QString::isSimpleText(); fn C_ZNK7QString12isSimpleTextEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: static QString QString::fromUcs4(const uint * , int size); fn C_ZN7QString8fromUcs4EPKji(arg0: *mut c_uint, arg1: c_int) -> *mut c_void; // proto: QString & QString::setUnicode(const QChar * unicode, int size); fn C_ZN7QString10setUnicodeEPK5QChari(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> *mut c_void; // proto: bool QString::contains(QRegExp & rx); fn C_ZNK7QString8containsER7QRegExp(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: const_iterator QString::constBegin(); fn C_ZNK7QString10constBeginEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: const QChar * QString::unicode(); fn C_ZNK7QString7unicodeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8, const QString & a9); fn C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void, arg4: *mut c_void, arg5: *mut c_void, arg6: *mut c_void, arg7: *mut c_void, arg8: *mut c_void) -> *mut c_void; // proto: int QString::indexOf(const QRegularExpression & re, int from); fn C_ZNK7QString7indexOfERK18QRegularExpressioni(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> c_int; // proto: static QString QString::number(long , int base); fn C_ZN7QString6numberEli(arg0: c_long, arg1: c_int) -> *mut c_void; // proto: static QString QString::number(uint , int base); fn C_ZN7QString6numberEji(arg0: c_uint, arg1: c_int) -> *mut c_void; // proto: static QString QString::fromLocal8Bit(const QByteArray & str); fn C_ZN7QString13fromLocal8BitERK10QByteArray(arg0: *mut c_void) -> *mut c_void; // proto: const QChar QString::at(int i); fn C_ZNK7QString2atEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: static QString QString::asprintf(const char * format); fn C_ZN7QString8asprintfEPKcz(arg0: *mut c_char) -> *mut c_void; // proto: void QString::QString(int size, QChar c); fn C_ZN7QStringC2Ei5QChar(arg0: c_int, arg1: *mut c_void) -> u64; // proto: QByteArray QString::toLatin1(); fn C_ZNO7QString8toLatin1Ev(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::setNum(ulong , int base); fn C_ZN7QString6setNumEmi(qthis: u64 /* *mut c_void*/, arg0: c_ulong, arg1: c_int) -> *mut c_void; // proto: void QString::push_front(const QString & s); fn C_ZN7QString10push_frontERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6); fn C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void, arg4: *mut c_void, arg5: *mut c_void) -> *mut c_void; // proto: iterator QString::begin(); fn C_ZN7QString5beginEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: static QString QString::number(double , char f, int prec); fn C_ZN7QString6numberEdci(arg0: c_double, arg1: c_char, arg2: c_int) -> *mut c_void; // proto: iterator QString::end(); fn C_ZN7QString3endEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::append(QChar c); fn C_ZN7QString6appendE5QChar(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: uint QString::toUInt(bool * ok, int base); fn C_ZNK7QString6toUIntEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_uint; // proto: QString & QString::append(const QString & s); fn C_ZN7QString6appendERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QString QString::arg(qlonglong a, int fieldwidth, int base, QChar fillChar); fn C_ZNK7QString3argExii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_longlong, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: ushort QString::toUShort(bool * ok, int base); fn C_ZNK7QString8toUShortEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_ushort; // proto: QString QString::arg(uint a, int fieldWidth, int base, QChar fillChar); fn C_ZNK7QString3argEjii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_uint, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: QString & QString::setNum(ushort , int base); fn C_ZN7QString6setNumEti(qthis: u64 /* *mut c_void*/, arg0: c_ushort, arg1: c_int) -> *mut c_void; // proto: QByteArray QString::toLocal8Bit(); fn C_ZNO7QString11toLocal8BitEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::replace(const QRegularExpression & re, const QString & after); fn C_ZN7QString7replaceERK18QRegularExpressionRKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QString & QString::setNum(double , char f, int prec); fn C_ZN7QString6setNumEdci(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: c_char, arg2: c_int) -> *mut c_void; // proto: static QString QString::number(qulonglong , int base); fn C_ZN7QString6numberEyi(arg0: c_ulonglong, arg1: c_int) -> *mut c_void; // proto: QString QString::arg(ushort a, int fieldWidth, int base, QChar fillChar); fn C_ZNK7QString3argEtii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_ushort, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: void QString::QString(const QString & ); fn C_ZN7QStringC2ERKS_(arg0: *mut c_void) -> u64; // proto: QString QString::arg(short a, int fieldWidth, int base, QChar fillChar); fn C_ZNK7QString3argEsii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_short, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: void QString::QString(const QByteArray & a); fn C_ZN7QStringC2ERK10QByteArray(arg0: *mut c_void) -> u64; // proto: static QString QString::vasprintf(const char * format, va_list ap); fn C_ZN7QString9vasprintfEPKci(arg0: *mut c_char, arg1: c_int) -> *mut c_void; // proto: qulonglong QString::toULongLong(bool * ok, int base); fn C_ZNK7QString11toULongLongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_ulonglong; // proto: QString & QString::append(const char * s); fn C_ZN7QString6appendEPKc(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> *mut c_void; // proto: int QString::capacity(); fn C_ZNK7QString8capacityEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QString::squeeze(); fn C_ZN7QString7squeezeEv(qthis: u64 /* *mut c_void*/); // proto: void QString::truncate(int pos); fn C_ZN7QString8truncateEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: QString QString::arg(int a, int fieldWidth, int base, QChar fillChar); fn C_ZNK7QString3argEiii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: QString QString::arg(QChar a, int fieldWidth, QChar fillChar); fn C_ZNK7QString3argE5QChariS0_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: int QString::localeAwareCompare(const QString & s); fn C_ZNK7QString18localeAwareCompareERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QString & QString::remove(const QRegExp & rx); fn C_ZN7QString6removeERK7QRegExp(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: bool QString::contains(const QRegularExpression & re); fn C_ZNK7QString8containsERK18QRegularExpression(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: int QString::indexOf(QRegExp & , int from); fn C_ZNK7QString7indexOfER7QRegExpi(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> c_int; // proto: QString & QString::replace(int i, int len, QChar after); fn C_ZN7QString7replaceEii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: bool QString::isRightToLeft(); fn C_ZNK7QString13isRightToLeftEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString QString::arg(char a, int fieldWidth, QChar fillChar); fn C_ZNK7QString3argEci5QChar(qthis: u64 /* *mut c_void*/, arg0: c_char, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: QVector<uint> QString::toUcs4(); fn C_ZNK7QString6toUcs4Ev(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString & QString::remove(int i, int len); fn C_ZN7QString6removeEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: bool QString::isEmpty(); fn C_ZNK7QString7isEmptyEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString QString::right(int n); fn C_ZNK7QString5rightEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QString QString::rightJustified(int width, QChar fill, bool trunc); fn C_ZNK7QString14rightJustifiedEi5QCharb(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void, arg2: c_char) -> *mut c_void; // proto: QString QString::arg(const QString & a, int fieldWidth, QChar fillChar); fn C_ZNK7QString3argERKS_i5QChar(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: QString QString::arg(qulonglong a, int fieldwidth, int base, QChar fillChar); fn C_ZNK7QString3argEyii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_ulonglong, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; // proto: void QString::reserve(int size); fn C_ZN7QString7reserveEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: short QString::toShort(bool * ok, int base); fn C_ZNK7QString7toShortEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_short; // proto: QString QString::arg(ulong a, int fieldwidth, int base, QChar fillChar); fn C_ZNK7QString3argEmii5QChar(qthis: u64 /* *mut c_void*/, arg0: c_ulong, arg1: c_int, arg2: c_int, arg3: *mut c_void) -> *mut c_void; fn QLatin1String_Class_Size() -> c_int; // proto: const char * QLatin1String::data(); fn C_ZNK13QLatin1String4dataEv(qthis: u64 /* *mut c_void*/) -> *mut c_char; // proto: void QLatin1String::QLatin1String(const char * s); fn C_ZN13QLatin1StringC2EPKc(arg0: *mut c_char) -> u64; // proto: int QLatin1String::size(); fn C_ZNK13QLatin1String4sizeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QLatin1String::QLatin1String(const QByteArray & s); fn C_ZN13QLatin1StringC2ERK10QByteArray(arg0: *mut c_void) -> u64; // proto: const char * QLatin1String::latin1(); fn C_ZNK13QLatin1String6latin1Ev(qthis: u64 /* *mut c_void*/) -> *mut c_char; // proto: void QLatin1String::QLatin1String(const char * s, int sz); fn C_ZN13QLatin1StringC2EPKci(arg0: *mut c_char, arg1: c_int) -> u64; fn QCharRef_Class_Size() -> c_int; // proto: bool QCharRef::isLetterOrNumber(); fn C_ZN8QCharRef16isLetterOrNumberEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QCharRef::isDigit(); fn C_ZNK8QCharRef7isDigitEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: char QCharRef::toLatin1(); fn C_ZNK8QCharRef8toLatin1Ev(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QCharRef::setCell(uchar cell); fn C_ZN8QCharRef7setCellEh(qthis: u64 /* *mut c_void*/, arg0: c_uchar); // proto: bool QCharRef::isMark(); fn C_ZNK8QCharRef6isMarkEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QCharRef::digitValue(); fn C_ZNK8QCharRef10digitValueEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: bool QCharRef::isLetter(); fn C_ZNK8QCharRef8isLetterEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QCharRef::isNumber(); fn C_ZNK8QCharRef8isNumberEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QCharRef::isPrint(); fn C_ZNK8QCharRef7isPrintEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QChar QCharRef::toLower(); fn C_ZNK8QCharRef7toLowerEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QCharRef::setRow(uchar row); fn C_ZN8QCharRef6setRowEh(qthis: u64 /* *mut c_void*/, arg0: c_uchar); // proto: bool QCharRef::isNull(); fn C_ZNK8QCharRef6isNullEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QChar QCharRef::toTitleCase(); fn C_ZNK8QCharRef11toTitleCaseEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QCharRef::hasMirrored(); fn C_ZNK8QCharRef11hasMirroredEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: uchar QCharRef::row(); fn C_ZNK8QCharRef3rowEv(qthis: u64 /* *mut c_void*/) -> c_uchar; // proto: ushort & QCharRef::unicode(); fn C_ZN8QCharRef7unicodeEv(qthis: u64 /* *mut c_void*/) -> c_ushort; // proto: bool QCharRef::isTitleCase(); fn C_ZNK8QCharRef11isTitleCaseEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QCharRef::isUpper(); fn C_ZNK8QCharRef7isUpperEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: uchar QCharRef::cell(); fn C_ZNK8QCharRef4cellEv(qthis: u64 /* *mut c_void*/) -> c_uchar; // proto: QString QCharRef::decomposition(); fn C_ZNK8QCharRef13decompositionEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: uchar QCharRef::combiningClass(); fn C_ZNK8QCharRef14combiningClassEv(qthis: u64 /* *mut c_void*/) -> c_uchar; // proto: QChar QCharRef::mirroredChar(); fn C_ZNK8QCharRef12mirroredCharEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QCharRef::isSpace(); fn C_ZNK8QCharRef7isSpaceEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QCharRef::isPunct(); fn C_ZNK8QCharRef7isPunctEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QChar QCharRef::toUpper(); fn C_ZNK8QCharRef7toUpperEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QCharRef::isLower(); fn C_ZNK8QCharRef7isLowerEv(qthis: u64 /* *mut c_void*/) -> c_char; fn QStringRef_Class_Size() -> c_int; // proto: short QStringRef::toShort(bool * ok, int base); fn C_ZNK10QStringRef7toShortEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_short; // proto: void QStringRef::QStringRef(const QString * string); fn C_ZN10QStringRefC2EPK7QString(arg0: *mut c_void) -> u64; // proto: qulonglong QStringRef::toULongLong(bool * ok, int base); fn C_ZNK10QStringRef11toULongLongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_ulonglong; // proto: void QStringRef::clear(); fn C_ZN10QStringRef5clearEv(qthis: u64 /* *mut c_void*/); // proto: int QStringRef::position(); fn C_ZNK10QStringRef8positionEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: long QStringRef::toLong(bool * ok, int base); fn C_ZNK10QStringRef6toLongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_long; // proto: const QChar * QStringRef::cbegin(); fn C_ZNK10QStringRef6cbeginEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: ushort QStringRef::toUShort(bool * ok, int base); fn C_ZNK10QStringRef8toUShortEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_ushort; // proto: uint QStringRef::toUInt(bool * ok, int base); fn C_ZNK10QStringRef6toUIntEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_uint; // proto: bool QStringRef::isEmpty(); fn C_ZNK10QStringRef7isEmptyEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QStringRef::localeAwareCompare(const QString & s); fn C_ZNK10QStringRef18localeAwareCompareERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QByteArray QStringRef::toUtf8(); fn C_ZNK10QStringRef6toUtf8Ev(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QStringRef::size(); fn C_ZNK10QStringRef4sizeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: const QChar * QStringRef::constData(); fn C_ZNK10QStringRef9constDataEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QStringRef QStringRef::left(int n); fn C_ZNK10QStringRef4leftEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QVector<uint> QStringRef::toUcs4(); fn C_ZNK10QStringRef6toUcs4Ev(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QStringRef::count(); fn C_ZNK10QStringRef5countEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QStringRef::QStringRef(const QString * string, int position, int size); fn C_ZN10QStringRefC2EPK7QStringii(arg0: *mut c_void, arg1: c_int, arg2: c_int) -> u64; // proto: void QStringRef::QStringRef(); fn C_ZN10QStringRefC2Ev() -> u64; // proto: QStringRef QStringRef::right(int n); fn C_ZNK10QStringRef5rightEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: const QChar QStringRef::at(int i); fn C_ZNK10QStringRef2atEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: double QStringRef::toDouble(bool * ok); fn C_ZNK10QStringRef8toDoubleEPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> c_double; // proto: bool QStringRef::isNull(); fn C_ZNK10QStringRef6isNullEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: const QChar * QStringRef::data(); fn C_ZNK10QStringRef4dataEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: qlonglong QStringRef::toLongLong(bool * ok, int base); fn C_ZNK10QStringRef10toLongLongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_longlong; // proto: QByteArray QStringRef::toLatin1(); fn C_ZNK10QStringRef8toLatin1Ev(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: const QChar * QStringRef::begin(); fn C_ZNK10QStringRef5beginEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: const QChar * QStringRef::unicode(); fn C_ZNK10QStringRef7unicodeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QStringRef QStringRef::mid(int pos, int n); fn C_ZNK10QStringRef3midEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: float QStringRef::toFloat(bool * ok); fn C_ZNK10QStringRef7toFloatEPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_char) -> c_float; // proto: const QString * QStringRef::string(); fn C_ZNK10QStringRef6stringEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QStringRef::toString(); fn C_ZNK10QStringRef8toStringEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QStringRef QStringRef::trimmed(); fn C_ZNK10QStringRef7trimmedEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QStringRef::toInt(bool * ok, int base); fn C_ZNK10QStringRef5toIntEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_int; // proto: const QChar * QStringRef::cend(); fn C_ZNK10QStringRef4cendEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QStringRef QStringRef::appendTo(QString * string); fn C_ZNK10QStringRef8appendToEP7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: int QStringRef::length(); fn C_ZNK10QStringRef6lengthEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QStringRef::~QStringRef(); fn C_ZN10QStringRefD2Ev(qthis: u64 /* *mut c_void*/); // proto: QByteArray QStringRef::toLocal8Bit(); fn C_ZNK10QStringRef11toLocal8BitEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: ulong QStringRef::toULong(bool * ok, int base); fn C_ZNK10QStringRef7toULongEPbi(qthis: u64 /* *mut c_void*/, arg0: *mut c_char, arg1: c_int) -> c_ulong; // proto: const QChar * QStringRef::end(); fn C_ZNK10QStringRef3endEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; } // <= ext block end // body block begin => // class sizeof(QStringDataPtr)=8 #[derive(Default)] pub struct QStringDataPtr { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QString)=8 #[derive(Default)] pub struct QString { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QLatin1String)=16 #[derive(Default)] pub struct QLatin1String { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QCharRef)=16 #[derive(Default)] pub struct QCharRef { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QStringRef)=16 #[derive(Default)] pub struct QStringRef { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QStringDataPtr { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QStringDataPtr { return QStringDataPtr{qclsinst: qthis, ..Default::default()}; } } impl /*struct*/ QString { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QString { return QString{qclsinst: qthis, ..Default::default()}; } } // proto: qlonglong QString::toLongLong(bool * ok, int base); impl /*struct*/ QString { pub fn toLongLong<RetType, T: QString_toLongLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLongLong(self); // return 1; } } pub trait QString_toLongLong<RetType> { fn toLongLong(self , rsthis: & QString) -> RetType; } // proto: qlonglong QString::toLongLong(bool * ok, int base); impl<'a> /*trait*/ QString_toLongLong<i64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toLongLong(self , rsthis: & QString) -> i64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString10toLongLongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString10toLongLongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i64; // 1 // return 1; } } // proto: bool QString::isNull(); impl /*struct*/ QString { pub fn isNull<RetType, T: QString_isNull<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isNull(self); // return 1; } } pub trait QString_isNull<RetType> { fn isNull(self , rsthis: & QString) -> RetType; } // proto: bool QString::isNull(); impl<'a> /*trait*/ QString_isNull<i8> for () { fn isNull(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6isNullEv()}; let mut ret = unsafe {C_ZNK7QString6isNullEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString & QString::append(const QChar * uc, int len); impl /*struct*/ QString { pub fn append<RetType, T: QString_append<RetType>>(& self, overload_args: T) -> RetType { return overload_args.append(self); // return 1; } } pub trait QString_append<RetType> { fn append(self , rsthis: & QString) -> RetType; } // proto: QString & QString::append(const QChar * uc, int len); impl<'a> /*trait*/ QString_append<QString> for (&'a QChar, i32) { fn append(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6appendEPK5QChari()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString6appendEPK5QChari(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::prepend(QChar c); impl /*struct*/ QString { pub fn prepend<RetType, T: QString_prepend<RetType>>(& self, overload_args: T) -> RetType { return overload_args.prepend(self); // return 1; } } pub trait QString_prepend<RetType> { fn prepend(self , rsthis: & QString) -> RetType; } // proto: QString & QString::prepend(QChar c); impl<'a> /*trait*/ QString_prepend<QString> for (QChar) { fn prepend(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7prependE5QChar()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString7prependE5QChar(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::insert(int i, QChar c); impl /*struct*/ QString { pub fn insert<RetType, T: QString_insert<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insert(self); // return 1; } } pub trait QString_insert<RetType> { fn insert(self , rsthis: & QString) -> RetType; } // proto: QString & QString::insert(int i, QChar c); impl<'a> /*trait*/ QString_insert<QString> for (i32, QChar) { fn insert(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6insertEi5QChar()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6insertEi5QChar(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::left(int n); impl /*struct*/ QString { pub fn left<RetType, T: QString_left<RetType>>(& self, overload_args: T) -> RetType { return overload_args.left(self); // return 1; } } pub trait QString_left<RetType> { fn left(self , rsthis: & QString) -> RetType; } // proto: QString QString::left(int n); impl<'a> /*trait*/ QString_left<QString> for (i32) { fn left(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString4leftEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QString4leftEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::QString(QChar c); impl /*struct*/ QString { pub fn new<T: QString_new>(value: T) -> QString { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QString_new { fn new(self) -> QString; } // proto: void QString::QString(QChar c); impl<'a> /*trait*/ QString_new for (QChar) { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2E5QChar()}; let ctysz: c_int = unsafe{QString_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_ZN7QStringC2E5QChar(arg0)}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QString & QString::prepend(const char * s); impl<'a> /*trait*/ QString_prepend<QString> for (&'a String) { fn prepend(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7prependEPKc()}; let arg0 = self.as_ptr() as *mut c_char; let mut ret = unsafe {C_ZN7QString7prependEPKc(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::lastIndexOf(const QRegularExpression & re, int from); impl /*struct*/ QString { pub fn lastIndexOf<RetType, T: QString_lastIndexOf<RetType>>(& self, overload_args: T) -> RetType { return overload_args.lastIndexOf(self); // return 1; } } pub trait QString_lastIndexOf<RetType> { fn lastIndexOf(self , rsthis: & QString) -> RetType; } // proto: int QString::lastIndexOf(const QRegularExpression & re, int from); impl<'a> /*trait*/ QString_lastIndexOf<i32> for (&'a QRegularExpression, Option<i32>) { fn lastIndexOf(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString11lastIndexOfERK18QRegularExpressioni()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString11lastIndexOfERK18QRegularExpressioni(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: static QString QString::number(int , int base); impl /*struct*/ QString { pub fn number_s<RetType, T: QString_number_s<RetType>>( overload_args: T) -> RetType { return overload_args.number_s(); // return 1; } } pub trait QString_number_s<RetType> { fn number_s(self ) -> RetType; } // proto: static QString QString::number(int , int base); impl<'a> /*trait*/ QString_number_s<QString> for (i32, Option<i32>) { fn number_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6numberEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6numberEii(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::resize(int size); impl /*struct*/ QString { pub fn resize<RetType, T: QString_resize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.resize(self); // return 1; } } pub trait QString_resize<RetType> { fn resize(self , rsthis: & QString) -> RetType; } // proto: void QString::resize(int size); impl<'a> /*trait*/ QString_resize<()> for (i32) { fn resize(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6resizeEi()}; let arg0 = self as c_int; unsafe {C_ZN7QString6resizeEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QString::push_front(QChar c); impl /*struct*/ QString { pub fn push_front<RetType, T: QString_push_front<RetType>>(& self, overload_args: T) -> RetType { return overload_args.push_front(self); // return 1; } } pub trait QString_push_front<RetType> { fn push_front(self , rsthis: & QString) -> RetType; } // proto: void QString::push_front(QChar c); impl<'a> /*trait*/ QString_push_front<()> for (QChar) { fn push_front(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString10push_frontE5QChar()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QString10push_frontE5QChar(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QString::QString(); impl<'a> /*trait*/ QString_new for () { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2Ev()}; let ctysz: c_int = unsafe{QString_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN7QStringC2Ev()}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: double QString::toDouble(bool * ok); impl /*struct*/ QString { pub fn toDouble<RetType, T: QString_toDouble<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toDouble(self); // return 1; } } pub trait QString_toDouble<RetType> { fn toDouble(self , rsthis: & QString) -> RetType; } // proto: double QString::toDouble(bool * ok); impl<'a> /*trait*/ QString_toDouble<f64> for (Option<&'a mut Vec<i8>>) { fn toDouble(self , rsthis: & QString) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8toDoubleEPb()}; let arg0 = (if self.is_none() {0 as *const i8} else {self.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QString8toDoubleEPb(rsthis.qclsinst, arg0)}; return ret as f64; // 1 // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8); impl /*struct*/ QString { pub fn arg<RetType, T: QString_arg<RetType>>(& self, overload_args: T) -> RetType { return overload_args.arg(self); // return 1; } } pub trait QString_arg<RetType> { fn arg(self , rsthis: & QString) -> RetType; } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let arg4 = self.4.qclsinst as *mut c_void; let arg5 = self.5.qclsinst as *mut c_void; let arg6 = self.6.qclsinst as *mut c_void; let arg7 = self.7.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringRef QString::rightRef(int n); impl /*struct*/ QString { pub fn rightRef<RetType, T: QString_rightRef<RetType>>(& self, overload_args: T) -> RetType { return overload_args.rightRef(self); // return 1; } } pub trait QString_rightRef<RetType> { fn rightRef(self , rsthis: & QString) -> RetType; } // proto: QStringRef QString::rightRef(int n); impl<'a> /*trait*/ QString_rightRef<QStringRef> for (i32) { fn rightRef(self , rsthis: & QString) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8rightRefEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QString8rightRefEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setNum(short , int base); impl /*struct*/ QString { pub fn setNum<RetType, T: QString_setNum<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setNum(self); // return 1; } } pub trait QString_setNum<RetType> { fn setNum(self , rsthis: & QString) -> RetType; } // proto: QString & QString::setNum(short , int base); impl<'a> /*trait*/ QString_setNum<QString> for (i16, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEsi()}; let arg0 = self.0 as c_short; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEsi(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::QString(const QChar * unicode, int size); impl<'a> /*trait*/ QString_new for (&'a QChar, Option<i32>) { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2EPK5QChari()}; let ctysz: c_int = unsafe{QString_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let qthis: u64 = unsafe {C_ZN7QStringC2EPK5QChari(arg0, arg1)}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: float QString::toFloat(bool * ok); impl /*struct*/ QString { pub fn toFloat<RetType, T: QString_toFloat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toFloat(self); // return 1; } } pub trait QString_toFloat<RetType> { fn toFloat(self , rsthis: & QString) -> RetType; } // proto: float QString::toFloat(bool * ok); impl<'a> /*trait*/ QString_toFloat<f32> for (Option<&'a mut Vec<i8>>) { fn toFloat(self , rsthis: & QString) -> f32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7toFloatEPb()}; let arg0 = (if self.is_none() {0 as *const i8} else {self.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QString7toFloatEPb(rsthis.qclsinst, arg0)}; return ret as f32; // 1 // return 1; } } // proto: int QString::count(const QRegularExpression & re); impl /*struct*/ QString { pub fn count<RetType, T: QString_count<RetType>>(& self, overload_args: T) -> RetType { return overload_args.count(self); // return 1; } } pub trait QString_count<RetType> { fn count(self , rsthis: & QString) -> RetType; } // proto: int QString::count(const QRegularExpression & re); impl<'a> /*trait*/ QString_count<i32> for (&'a QRegularExpression) { fn count(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString5countERK18QRegularExpression()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString5countERK18QRegularExpression(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QStringRef QString::midRef(int position, int n); impl /*struct*/ QString { pub fn midRef<RetType, T: QString_midRef<RetType>>(& self, overload_args: T) -> RetType { return overload_args.midRef(self); // return 1; } } pub trait QString_midRef<RetType> { fn midRef(self , rsthis: & QString) -> RetType; } // proto: QStringRef QString::midRef(int position, int n); impl<'a> /*trait*/ QString_midRef<QStringRef> for (i32, Option<i32>) { fn midRef(self , rsthis: & QString) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6midRefEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString6midRefEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::detach(); impl /*struct*/ QString { pub fn detach<RetType, T: QString_detach<RetType>>(& self, overload_args: T) -> RetType { return overload_args.detach(self); // return 1; } } pub trait QString_detach<RetType> { fn detach(self , rsthis: & QString) -> RetType; } // proto: void QString::detach(); impl<'a> /*trait*/ QString_detach<()> for () { fn detach(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6detachEv()}; unsafe {C_ZN7QString6detachEv(rsthis.qclsinst)}; // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(long a, int fieldwidth, int base, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (i64, Option<i32>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argElii5QChar()}; let arg0 = self.0 as c_long; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {10} else {self.2.unwrap()}) as c_int; let arg3 = (if self.3.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.3.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argElii5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::count(); impl<'a> /*trait*/ QString_count<i32> for () { fn count(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString5countEv()}; let mut ret = unsafe {C_ZNK7QString5countEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QString & QString::setNum(qulonglong , int base); impl<'a> /*trait*/ QString_setNum<QString> for (u64, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEyi()}; let arg0 = self.0 as c_ulonglong; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEyi(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::push_back(QChar c); impl /*struct*/ QString { pub fn push_back<RetType, T: QString_push_back<RetType>>(& self, overload_args: T) -> RetType { return overload_args.push_back(self); // return 1; } } pub trait QString_push_back<RetType> { fn push_back(self , rsthis: & QString) -> RetType; } // proto: void QString::push_back(QChar c); impl<'a> /*trait*/ QString_push_back<()> for (QChar) { fn push_back(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString9push_backE5QChar()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QString9push_backE5QChar(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString & QString::setNum(float , char f, int prec); impl<'a> /*trait*/ QString_setNum<QString> for (f32, Option<i8>, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEfci()}; let arg0 = self.0 as c_float; let arg1 = (if self.1.is_none() {'g' as i8} else {self.1.unwrap()}) as c_char; let arg2 = (if self.2.is_none() {6} else {self.2.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEfci(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::count(const QRegExp & ); impl<'a> /*trait*/ QString_count<i32> for (&'a QRegExp) { fn count(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString5countERK7QRegExp()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString5countERK7QRegExp(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: int QString::size(); impl /*struct*/ QString { pub fn size<RetType, T: QString_size<RetType>>(& self, overload_args: T) -> RetType { return overload_args.size(self); // return 1; } } pub trait QString_size<RetType> { fn size(self , rsthis: & QString) -> RetType; } // proto: int QString::size(); impl<'a> /*trait*/ QString_size<i32> for () { fn size(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString4sizeEv()}; let mut ret = unsafe {C_ZNK7QString4sizeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QString & QString::insert(int i, const QChar * uc, int len); impl<'a> /*trait*/ QString_insert<QString> for (i32, &'a QChar, i32) { fn insert(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6insertEiPK5QChari()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2 as c_int; let mut ret = unsafe {C_ZN7QString6insertEiPK5QChari(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::replace(int i, int len, const QChar * s, int slen); impl /*struct*/ QString { pub fn replace<RetType, T: QString_replace<RetType>>(& self, overload_args: T) -> RetType { return overload_args.replace(self); // return 1; } } pub trait QString_replace<RetType> { fn replace(self , rsthis: & QString) -> RetType; } // proto: QString & QString::replace(int i, int len, const QChar * s, int slen); impl<'a> /*trait*/ QString_replace<QString> for (i32, i32, &'a QChar, i32) { fn replace(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7replaceEiiPK5QChari()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3 as c_int; let mut ret = unsafe {C_ZN7QString7replaceEiiPK5QChari(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromRawData(const QChar * , int size); impl /*struct*/ QString { pub fn fromRawData_s<RetType, T: QString_fromRawData_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromRawData_s(); // return 1; } } pub trait QString_fromRawData_s<RetType> { fn fromRawData_s(self ) -> RetType; } // proto: static QString QString::fromRawData(const QChar * , int size); impl<'a> /*trait*/ QString_fromRawData_s<QString> for (&'a QChar, i32) { fn fromRawData_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString11fromRawDataEPK5QChari()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString11fromRawDataEPK5QChari(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::trimmed(); impl /*struct*/ QString { pub fn trimmed<RetType, T: QString_trimmed<RetType>>(& self, overload_args: T) -> RetType { return overload_args.trimmed(self); // return 1; } } pub trait QString_trimmed<RetType> { fn trimmed(self , rsthis: & QString) -> RetType; } // proto: QString QString::trimmed(); impl<'a> /*trait*/ QString_trimmed<QString> for () { fn trimmed(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString7trimmedEv()}; let mut ret = unsafe {C_ZNO7QString7trimmedEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::insert(int i, const QString & s); impl<'a> /*trait*/ QString_insert<QString> for (i32, &'a QString) { fn insert(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6insertEiRKS_()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6insertEiRKS_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let arg4 = self.4.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setRawData(const QChar * unicode, int size); impl /*struct*/ QString { pub fn setRawData<RetType, T: QString_setRawData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setRawData(self); // return 1; } } pub trait QString_setRawData<RetType> { fn setRawData(self , rsthis: & QString) -> RetType; } // proto: QString & QString::setRawData(const QChar * unicode, int size); impl<'a> /*trait*/ QString_setRawData<QString> for (&'a QChar, i32) { fn setRawData(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString10setRawDataEPK5QChari()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString10setRawDataEPK5QChari(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::prepend(const QString & s); impl<'a> /*trait*/ QString_prepend<QString> for (&'a QString) { fn prepend(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7prependERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString7prependERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::sprintf(const char * format); impl /*struct*/ QString { pub fn sprintf<RetType, T: QString_sprintf<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sprintf(self); // return 1; } } pub trait QString_sprintf<RetType> { fn sprintf(self , rsthis: & QString) -> RetType; } // proto: QString & QString::sprintf(const char * format); impl<'a> /*trait*/ QString_sprintf<QString> for (&'a String) { fn sprintf(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7sprintfEPKcz()}; let arg0 = self.as_ptr() as *mut c_char; let mut ret = unsafe {C_ZN7QString7sprintfEPKcz(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: ulong QString::toULong(bool * ok, int base); impl /*struct*/ QString { pub fn toULong<RetType, T: QString_toULong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toULong(self); // return 1; } } pub trait QString_toULong<RetType> { fn toULong(self , rsthis: & QString) -> RetType; } // proto: ulong QString::toULong(bool * ok, int base); impl<'a> /*trait*/ QString_toULong<u64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toULong(self , rsthis: & QString) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7toULongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString7toULongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u64; // 1 // return 1; } } // proto: void QString::chop(int n); impl /*struct*/ QString { pub fn chop<RetType, T: QString_chop<RetType>>(& self, overload_args: T) -> RetType { return overload_args.chop(self); // return 1; } } pub trait QString_chop<RetType> { fn chop(self , rsthis: & QString) -> RetType; } // proto: void QString::chop(int n); impl<'a> /*trait*/ QString_chop<()> for (i32) { fn chop(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString4chopEi()}; let arg0 = self as c_int; unsafe {C_ZN7QString4chopEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: static QString QString::fromUtf16(const ushort * , int size); impl /*struct*/ QString { pub fn fromUtf16_s<RetType, T: QString_fromUtf16_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromUtf16_s(); // return 1; } } pub trait QString_fromUtf16_s<RetType> { fn fromUtf16_s(self ) -> RetType; } // proto: static QString QString::fromUtf16(const ushort * , int size); impl<'a> /*trait*/ QString_fromUtf16_s<QString> for (&'a Vec<u16>, Option<i32>) { fn fromUtf16_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString9fromUtf16EPKti()}; let arg0 = self.0.as_ptr() as *mut c_ushort; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString9fromUtf16EPKti(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QString::isDetached(); impl /*struct*/ QString { pub fn isDetached<RetType, T: QString_isDetached<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isDetached(self); // return 1; } } pub trait QString_isDetached<RetType> { fn isDetached(self , rsthis: & QString) -> RetType; } // proto: bool QString::isDetached(); impl<'a> /*trait*/ QString_isDetached<i8> for () { fn isDetached(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString10isDetachedEv()}; let mut ret = unsafe {C_ZNK7QString10isDetachedEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString & QString::setNum(qlonglong , int base); impl<'a> /*trait*/ QString_setNum<QString> for (i64, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumExi()}; let arg0 = self.0 as c_longlong; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumExi(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::mid(int position, int n); impl /*struct*/ QString { pub fn mid<RetType, T: QString_mid<RetType>>(& self, overload_args: T) -> RetType { return overload_args.mid(self); // return 1; } } pub trait QString_mid<RetType> { fn mid(self , rsthis: & QString) -> RetType; } // proto: QString QString::mid(int position, int n); impl<'a> /*trait*/ QString_mid<QString> for (i32, Option<i32>) { fn mid(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3midEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString3midEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromLocal8Bit(const char * str, int size); impl /*struct*/ QString { pub fn fromLocal8Bit_s<RetType, T: QString_fromLocal8Bit_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromLocal8Bit_s(); // return 1; } } pub trait QString_fromLocal8Bit_s<RetType> { fn fromLocal8Bit_s(self ) -> RetType; } // proto: static QString QString::fromLocal8Bit(const char * str, int size); impl<'a> /*trait*/ QString_fromLocal8Bit_s<QString> for (&'a String, Option<i32>) { fn fromLocal8Bit_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString13fromLocal8BitEPKci()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString13fromLocal8BitEPKci(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::swap(QString & other); impl /*struct*/ QString { pub fn swap<RetType, T: QString_swap<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swap(self); // return 1; } } pub trait QString_swap<RetType> { fn swap(self , rsthis: & QString) -> RetType; } // proto: void QString::swap(QString & other); impl<'a> /*trait*/ QString_swap<()> for (&'a QString) { fn swap(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString4swapERS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QString4swapERS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString & QString::vsprintf(const char * format, va_list ap); impl /*struct*/ QString { pub fn vsprintf<RetType, T: QString_vsprintf<RetType>>(& self, overload_args: T) -> RetType { return overload_args.vsprintf(self); // return 1; } } pub trait QString_vsprintf<RetType> { fn vsprintf(self , rsthis: & QString) -> RetType; } // proto: QString & QString::vsprintf(const char * format, va_list ap); impl<'a> /*trait*/ QString_vsprintf<QString> for (&'a String, i32) { fn vsprintf(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8vsprintfEPKci()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString8vsprintfEPKci(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromUtf8(const QByteArray & str); impl /*struct*/ QString { pub fn fromUtf8_s<RetType, T: QString_fromUtf8_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromUtf8_s(); // return 1; } } pub trait QString_fromUtf8_s<RetType> { fn fromUtf8_s(self ) -> RetType; } // proto: static QString QString::fromUtf8(const QByteArray & str); impl<'a> /*trait*/ QString_fromUtf8_s<QString> for (&'a QByteArray) { fn fromUtf8_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8fromUtf8ERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString8fromUtf8ERK10QByteArray(arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromUcs4(const char32_t * str, int size); impl /*struct*/ QString { pub fn fromUcs4_s<RetType, T: QString_fromUcs4_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromUcs4_s(); // return 1; } } pub trait QString_fromUcs4_s<RetType> { fn fromUcs4_s(self ) -> RetType; } // proto: static QString QString::fromUcs4(const char32_t * str, int size); impl<'a> /*trait*/ QString_fromUcs4_s<QString> for (&'a String, Option<i32>) { fn fromUcs4_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8fromUcs4EPKDii()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString8fromUcs4EPKDii(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::leftJustified(int width, QChar fill, bool trunc); impl /*struct*/ QString { pub fn leftJustified<RetType, T: QString_leftJustified<RetType>>(& self, overload_args: T) -> RetType { return overload_args.leftJustified(self); // return 1; } } pub trait QString_leftJustified<RetType> { fn leftJustified(self , rsthis: & QString) -> RetType; } // proto: QString QString::leftJustified(int width, QChar fill, bool trunc); impl<'a> /*trait*/ QString_leftJustified<QString> for (i32, Option<QChar>, Option<i8>) { fn leftJustified(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString13leftJustifiedEi5QCharb()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let arg2 = (if self.2.is_none() {false as i8} else {self.2.unwrap()}) as c_char; let mut ret = unsafe {C_ZNK7QString13leftJustifiedEi5QCharb(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::indexOf(const QRegExp & , int from); impl /*struct*/ QString { pub fn indexOf<RetType, T: QString_indexOf<RetType>>(& self, overload_args: T) -> RetType { return overload_args.indexOf(self); // return 1; } } pub trait QString_indexOf<RetType> { fn indexOf(self , rsthis: & QString) -> RetType; } // proto: int QString::indexOf(const QRegExp & , int from); impl<'a> /*trait*/ QString_indexOf<i32> for (&'a QRegExp, Option<i32>) { fn indexOf(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7indexOfERK7QRegExpi()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString7indexOfERK7QRegExpi(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: void QString::push_back(const QString & s); impl<'a> /*trait*/ QString_push_back<()> for (&'a QString) { fn push_back(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString9push_backERKS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QString9push_backERKS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QString::lastIndexOf(QRegExp & , int from); impl<'a> /*trait*/ QString_lastIndexOf<i32> for (&'a QRegExp, Option<i32>) { fn lastIndexOf(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString11lastIndexOfER7QRegExpi()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString11lastIndexOfER7QRegExpi(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const ushort * QString::utf16(); impl /*struct*/ QString { pub fn utf16<RetType, T: QString_utf16<RetType>>(& self, overload_args: T) -> RetType { return overload_args.utf16(self); // return 1; } } pub trait QString_utf16<RetType> { fn utf16(self , rsthis: & QString) -> RetType; } // proto: const ushort * QString::utf16(); impl<'a> /*trait*/ QString_utf16<*mut u16> for () { fn utf16(self , rsthis: & QString) -> *mut u16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString5utf16Ev()}; let mut ret = unsafe {C_ZNK7QString5utf16Ev(rsthis.qclsinst)}; return ret as *mut u16; // 1 // return 1; } } // proto: int QString::toInt(bool * ok, int base); impl /*struct*/ QString { pub fn toInt<RetType, T: QString_toInt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toInt(self); // return 1; } } pub trait QString_toInt<RetType> { fn toInt(self , rsthis: & QString) -> RetType; } // proto: int QString::toInt(bool * ok, int base); impl<'a> /*trait*/ QString_toInt<i32> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toInt(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString5toIntEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString5toIntEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: QByteArray QString::toUtf8(); impl /*struct*/ QString { pub fn toUtf8<RetType, T: QString_toUtf8<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUtf8(self); // return 1; } } pub trait QString_toUtf8<RetType> { fn toUtf8(self , rsthis: & QString) -> RetType; } // proto: QByteArray QString::toUtf8(); impl<'a> /*trait*/ QString_toUtf8<QByteArray> for () { fn toUtf8(self , rsthis: & QString) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString6toUtf8Ev()}; let mut ret = unsafe {C_ZNO7QString6toUtf8Ev(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (f64, Option<i32>, Option<i8>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEdici5QChar()}; let arg0 = self.0 as c_double; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {'g' as i8} else {self.2.unwrap()}) as c_char; let arg3 = (if self.3.is_none() {-1} else {self.3.unwrap()}) as c_int; let arg4 = (if self.4.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.4.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEdici5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QChar * QString::data(); impl /*struct*/ QString { pub fn data<RetType, T: QString_data<RetType>>(& self, overload_args: T) -> RetType { return overload_args.data(self); // return 1; } } pub trait QString_data<RetType> { fn data(self , rsthis: & QString) -> RetType; } // proto: QChar * QString::data(); impl<'a> /*trait*/ QString_data<QChar> for () { fn data(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString4dataEv()}; let mut ret = unsafe {C_ZN7QString4dataEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::toCaseFolded(); impl /*struct*/ QString { pub fn toCaseFolded<RetType, T: QString_toCaseFolded<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toCaseFolded(self); // return 1; } } pub trait QString_toCaseFolded<RetType> { fn toCaseFolded(self , rsthis: & QString) -> RetType; } // proto: QString QString::toCaseFolded(); impl<'a> /*trait*/ QString_toCaseFolded<QString> for () { fn toCaseFolded(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString12toCaseFoldedEv()}; let mut ret = unsafe {C_ZNO7QString12toCaseFoldedEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setNum(uint , int base); impl<'a> /*trait*/ QString_setNum<QString> for (u32, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEji()}; let arg0 = self.0 as c_uint; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEji(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static int QString::localeAwareCompare(const QString & s1, const QString & s2); impl /*struct*/ QString { pub fn localeAwareCompare_s<RetType, T: QString_localeAwareCompare_s<RetType>>( overload_args: T) -> RetType { return overload_args.localeAwareCompare_s(); // return 1; } } pub trait QString_localeAwareCompare_s<RetType> { fn localeAwareCompare_s(self ) -> RetType; } // proto: static int QString::localeAwareCompare(const QString & s1, const QString & s2); impl<'a> /*trait*/ QString_localeAwareCompare_s<i32> for (&'a QString, &'a QString) { fn localeAwareCompare_s(self ) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString18localeAwareCompareERKS_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString18localeAwareCompareERKS_S1_(arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: void QString::QString(const char * ch); impl<'a> /*trait*/ QString_new for (&'a String) { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2EPKc()}; let ctysz: c_int = unsafe{QString_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.as_ptr() as *mut c_char; let qthis: u64 = unsafe {C_ZN7QStringC2EPKc(arg0)}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: static QString QString::fromUtf16(const char16_t * str, int size); impl<'a> /*trait*/ QString_fromUtf16_s<QString> for (&'a String, Option<i32>) { fn fromUtf16_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString9fromUtf16EPKDsi()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString9fromUtf16EPKDsi(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::replace(const QRegExp & rx, const QString & after); impl<'a> /*trait*/ QString_replace<QString> for (&'a QRegExp, &'a QString) { fn replace(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7replaceERK7QRegExpRKS_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString7replaceERK7QRegExpRKS_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::repeated(int times); impl /*struct*/ QString { pub fn repeated<RetType, T: QString_repeated<RetType>>(& self, overload_args: T) -> RetType { return overload_args.repeated(self); // return 1; } } pub trait QString_repeated<RetType> { fn repeated(self , rsthis: & QString) -> RetType; } // proto: QString QString::repeated(int times); impl<'a> /*trait*/ QString_repeated<QString> for (i32) { fn repeated(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8repeatedEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QString8repeatedEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::toLower(); impl /*struct*/ QString { pub fn toLower<RetType, T: QString_toLower<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLower(self); // return 1; } } pub trait QString_toLower<RetType> { fn toLower(self , rsthis: & QString) -> RetType; } // proto: QString QString::toLower(); impl<'a> /*trait*/ QString_toLower<QString> for () { fn toLower(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString7toLowerEv()}; let mut ret = unsafe {C_ZNO7QString7toLowerEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setUtf16(const ushort * utf16, int size); impl /*struct*/ QString { pub fn setUtf16<RetType, T: QString_setUtf16<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setUtf16(self); // return 1; } } pub trait QString_setUtf16<RetType> { fn setUtf16(self , rsthis: & QString) -> RetType; } // proto: QString & QString::setUtf16(const ushort * utf16, int size); impl<'a> /*trait*/ QString_setUtf16<QString> for (&'a Vec<u16>, i32) { fn setUtf16(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8setUtf16EPKti()}; let arg0 = self.0.as_ptr() as *mut c_ushort; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString8setUtf16EPKti(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::clear(); impl /*struct*/ QString { pub fn clear<RetType, T: QString_clear<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clear(self); // return 1; } } pub trait QString_clear<RetType> { fn clear(self , rsthis: & QString) -> RetType; } // proto: void QString::clear(); impl<'a> /*trait*/ QString_clear<()> for () { fn clear(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString5clearEv()}; unsafe {C_ZN7QString5clearEv(rsthis.qclsinst)}; // return 1; } } // proto: bool QString::contains(const QRegExp & rx); impl /*struct*/ QString { pub fn contains<RetType, T: QString_contains<RetType>>(& self, overload_args: T) -> RetType { return overload_args.contains(self); // return 1; } } pub trait QString_contains<RetType> { fn contains(self , rsthis: & QString) -> RetType; } // proto: bool QString::contains(const QRegExp & rx); impl<'a> /*trait*/ QString_contains<i8> for (&'a QRegExp) { fn contains(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8containsERK7QRegExp()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString8containsERK7QRegExp(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: bool QString::isSharedWith(const QString & other); impl /*struct*/ QString { pub fn isSharedWith<RetType, T: QString_isSharedWith<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSharedWith(self); // return 1; } } pub trait QString_isSharedWith<RetType> { fn isSharedWith(self , rsthis: & QString) -> RetType; } // proto: bool QString::isSharedWith(const QString & other); impl<'a> /*trait*/ QString_isSharedWith<i8> for (&'a QString) { fn isSharedWith(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString12isSharedWithERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString12isSharedWithERKS_(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: static QString QString::fromLatin1(const QByteArray & str); impl /*struct*/ QString { pub fn fromLatin1_s<RetType, T: QString_fromLatin1_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromLatin1_s(); // return 1; } } pub trait QString_fromLatin1_s<RetType> { fn fromLatin1_s(self ) -> RetType; } // proto: static QString QString::fromLatin1(const QByteArray & str); impl<'a> /*trait*/ QString_fromLatin1_s<QString> for (&'a QByteArray) { fn fromLatin1_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString10fromLatin1ERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString10fromLatin1ERK10QByteArray(arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::~QString(); impl /*struct*/ QString { pub fn free<RetType, T: QString_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QString_free<RetType> { fn free(self , rsthis: & QString) -> RetType; } // proto: void QString::~QString(); impl<'a> /*trait*/ QString_free<()> for () { fn free(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringD2Ev()}; unsafe {C_ZN7QStringD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: QString & QString::remove(const QRegularExpression & re); impl /*struct*/ QString { pub fn remove<RetType, T: QString_remove<RetType>>(& self, overload_args: T) -> RetType { return overload_args.remove(self); // return 1; } } pub trait QString_remove<RetType> { fn remove(self , rsthis: & QString) -> RetType; } // proto: QString & QString::remove(const QRegularExpression & re); impl<'a> /*trait*/ QString_remove<QString> for (&'a QRegularExpression) { fn remove(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6removeERK18QRegularExpression()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6removeERK18QRegularExpression(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setNum(int , int base); impl<'a> /*trait*/ QString_setNum<QString> for (i32, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const_iterator QString::cend(); impl /*struct*/ QString { pub fn cend<RetType, T: QString_cend<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cend(self); // return 1; } } pub trait QString_cend<RetType> { fn cend(self , rsthis: & QString) -> RetType; } // proto: const_iterator QString::cend(); impl<'a> /*trait*/ QString_cend<QChar> for () { fn cend(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString4cendEv()}; let mut ret = unsafe {C_ZNK7QString4cendEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::toHtmlEscaped(); impl /*struct*/ QString { pub fn toHtmlEscaped<RetType, T: QString_toHtmlEscaped<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toHtmlEscaped(self); // return 1; } } pub trait QString_toHtmlEscaped<RetType> { fn toHtmlEscaped(self , rsthis: & QString) -> RetType; } // proto: QString QString::toHtmlEscaped(); impl<'a> /*trait*/ QString_toHtmlEscaped<QString> for () { fn toHtmlEscaped(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString13toHtmlEscapedEv()}; let mut ret = unsafe {C_ZNK7QString13toHtmlEscapedEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::lastIndexOf(const QRegularExpression & re, int from, QRegularExpressionMatch * rmatch); impl<'a> /*trait*/ QString_lastIndexOf<i32> for (&'a QRegularExpression, i32, &'a QRegularExpressionMatch) { fn lastIndexOf(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString11lastIndexOfERK18QRegularExpressioniP23QRegularExpressionMatch()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString11lastIndexOfERK18QRegularExpressioniP23QRegularExpressionMatch(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i32; // 1 // return 1; } } // proto: QString & QString::append(const QByteArray & s); impl<'a> /*trait*/ QString_append<QString> for (&'a QByteArray) { fn append(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6appendERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6appendERK10QByteArray(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromLatin1(const char * str, int size); impl<'a> /*trait*/ QString_fromLatin1_s<QString> for (&'a String, Option<i32>) { fn fromLatin1_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString10fromLatin1EPKci()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString10fromLatin1EPKci(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QString::contains(const QRegularExpression & re, QRegularExpressionMatch * match); impl<'a> /*trait*/ QString_contains<i8> for (&'a QRegularExpression, &'a QRegularExpressionMatch) { fn contains(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8containsERK18QRegularExpressionP23QRegularExpressionMatch()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString8containsERK18QRegularExpressionP23QRegularExpressionMatch(rsthis.qclsinst, arg0, arg1)}; return ret as i8; // 1 // return 1; } } // proto: int QString::indexOf(const QRegularExpression & re, int from, QRegularExpressionMatch * rmatch); impl<'a> /*trait*/ QString_indexOf<i32> for (&'a QRegularExpression, i32, &'a QRegularExpressionMatch) { fn indexOf(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7indexOfERK18QRegularExpressioniP23QRegularExpressionMatch()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString7indexOfERK18QRegularExpressioniP23QRegularExpressionMatch(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i32; // 1 // return 1; } } // proto: int QString::toWCharArray(wchar_t * array); impl /*struct*/ QString { pub fn toWCharArray<RetType, T: QString_toWCharArray<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toWCharArray(self); // return 1; } } pub trait QString_toWCharArray<RetType> { fn toWCharArray(self , rsthis: & QString) -> RetType; } // proto: int QString::toWCharArray(wchar_t * array); impl<'a> /*trait*/ QString_toWCharArray<i32> for (&'a String) { fn toWCharArray(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString12toWCharArrayEPw()}; let arg0 = self.as_ptr() as *mut wchar_t; let mut ret = unsafe {C_ZNK7QString12toWCharArrayEPw(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: const_iterator QString::cbegin(); impl /*struct*/ QString { pub fn cbegin<RetType, T: QString_cbegin<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cbegin(self); // return 1; } } pub trait QString_cbegin<RetType> { fn cbegin(self , rsthis: & QString) -> RetType; } // proto: const_iterator QString::cbegin(); impl<'a> /*trait*/ QString_cbegin<QChar> for () { fn cbegin(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6cbeginEv()}; let mut ret = unsafe {C_ZNK7QString6cbeginEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::prepend(const QByteArray & s); impl<'a> /*trait*/ QString_prepend<QString> for (&'a QByteArray) { fn prepend(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7prependERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString7prependERK10QByteArray(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::replace(int i, int len, const QString & after); impl<'a> /*trait*/ QString_replace<QString> for (i32, i32, &'a QString) { fn replace(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7replaceEiiRKS_()}; 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_ZN7QString7replaceEiiRKS_(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let arg4 = self.4.qclsinst as *mut c_void; let arg5 = self.5.qclsinst as *mut c_void; let arg6 = self.6.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4, arg5, arg6)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromWCharArray(const wchar_t * string, int size); impl /*struct*/ QString { pub fn fromWCharArray_s<RetType, T: QString_fromWCharArray_s<RetType>>( overload_args: T) -> RetType { return overload_args.fromWCharArray_s(); // return 1; } } pub trait QString_fromWCharArray_s<RetType> { fn fromWCharArray_s(self ) -> RetType; } // proto: static QString QString::fromWCharArray(const wchar_t * string, int size); impl<'a> /*trait*/ QString_fromWCharArray_s<QString> for (&'a String, Option<i32>) { fn fromWCharArray_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString14fromWCharArrayEPKwi()}; let arg0 = self.0.as_ptr() as *mut wchar_t; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString14fromWCharArrayEPKwi(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::fill(QChar c, int size); impl /*struct*/ QString { pub fn fill<RetType, T: QString_fill<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fill(self); // return 1; } } pub trait QString_fill<RetType> { fn fill(self , rsthis: & QString) -> RetType; } // proto: QString & QString::fill(QChar c, int size); impl<'a> /*trait*/ QString_fill<QString> for (QChar, Option<i32>) { fn fill(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString4fillE5QChari()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString4fillE5QChari(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QChar * QString::constData(); impl /*struct*/ QString { pub fn constData<RetType, T: QString_constData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.constData(self); // return 1; } } pub trait QString_constData<RetType> { fn constData(self , rsthis: & QString) -> RetType; } // proto: const QChar * QString::constData(); impl<'a> /*trait*/ QString_constData<QChar> for () { fn constData(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString9constDataEv()}; let mut ret = unsafe {C_ZNK7QString9constDataEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::number(ulong , int base); impl<'a> /*trait*/ QString_number_s<QString> for (u64, Option<i32>) { fn number_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6numberEmi()}; let arg0 = self.0 as c_ulong; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6numberEmi(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: long QString::toLong(bool * ok, int base); impl /*struct*/ QString { pub fn toLong<RetType, T: QString_toLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLong(self); // return 1; } } pub trait QString_toLong<RetType> { fn toLong(self , rsthis: & QString) -> RetType; } // proto: long QString::toLong(bool * ok, int base); impl<'a> /*trait*/ QString_toLong<i64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toLong(self , rsthis: & QString) -> i64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6toLongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString6toLongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i64; // 1 // return 1; } } // proto: QString QString::toUpper(); impl /*struct*/ QString { pub fn toUpper<RetType, T: QString_toUpper<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUpper(self); // return 1; } } pub trait QString_toUpper<RetType> { fn toUpper(self , rsthis: & QString) -> RetType; } // proto: QString QString::toUpper(); impl<'a> /*trait*/ QString_toUpper<QString> for () { fn toUpper(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString7toUpperEv()}; let mut ret = unsafe {C_ZNO7QString7toUpperEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const_iterator QString::constEnd(); impl /*struct*/ QString { pub fn constEnd<RetType, T: QString_constEnd<RetType>>(& self, overload_args: T) -> RetType { return overload_args.constEnd(self); // return 1; } } pub trait QString_constEnd<RetType> { fn constEnd(self , rsthis: & QString) -> RetType; } // proto: const_iterator QString::constEnd(); impl<'a> /*trait*/ QString_constEnd<QChar> for () { fn constEnd(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8constEndEv()}; let mut ret = unsafe {C_ZNK7QString8constEndEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::length(); impl /*struct*/ QString { pub fn length<RetType, T: QString_length<RetType>>(& self, overload_args: T) -> RetType { return overload_args.length(self); // return 1; } } pub trait QString_length<RetType> { fn length(self , rsthis: & QString) -> RetType; } // proto: int QString::length(); impl<'a> /*trait*/ QString_length<i32> for () { fn length(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6lengthEv()}; let mut ret = unsafe {C_ZNK7QString6lengthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: static QString QString::fromUtf8(const char * str, int size); impl<'a> /*trait*/ QString_fromUtf8_s<QString> for (&'a String, Option<i32>) { fn fromUtf8_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8fromUtf8EPKci()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString8fromUtf8EPKci(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::simplified(); impl /*struct*/ QString { pub fn simplified<RetType, T: QString_simplified<RetType>>(& self, overload_args: T) -> RetType { return overload_args.simplified(self); // return 1; } } pub trait QString_simplified<RetType> { fn simplified(self , rsthis: & QString) -> RetType; } // proto: QString QString::simplified(); impl<'a> /*trait*/ QString_simplified<QString> for () { fn simplified(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString10simplifiedEv()}; let mut ret = unsafe {C_ZNO7QString10simplifiedEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::number(qlonglong , int base); impl<'a> /*trait*/ QString_number_s<QString> for (i64, Option<i32>) { fn number_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6numberExi()}; let arg0 = self.0 as c_longlong; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6numberExi(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringRef QString::leftRef(int n); impl /*struct*/ QString { pub fn leftRef<RetType, T: QString_leftRef<RetType>>(& self, overload_args: T) -> RetType { return overload_args.leftRef(self); // return 1; } } pub trait QString_leftRef<RetType> { fn leftRef(self , rsthis: & QString) -> RetType; } // proto: QStringRef QString::leftRef(int n); impl<'a> /*trait*/ QString_leftRef<QStringRef> for (i32) { fn leftRef(self , rsthis: & QString) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7leftRefEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QString7leftRefEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QString::isSimpleText(); impl /*struct*/ QString { pub fn isSimpleText<RetType, T: QString_isSimpleText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSimpleText(self); // return 1; } } pub trait QString_isSimpleText<RetType> { fn isSimpleText(self , rsthis: & QString) -> RetType; } // proto: bool QString::isSimpleText(); impl<'a> /*trait*/ QString_isSimpleText<i8> for () { fn isSimpleText(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString12isSimpleTextEv()}; let mut ret = unsafe {C_ZNK7QString12isSimpleTextEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: static QString QString::fromUcs4(const uint * , int size); impl<'a> /*trait*/ QString_fromUcs4_s<QString> for (&'a Vec<u32>, Option<i32>) { fn fromUcs4_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8fromUcs4EPKji()}; let arg0 = self.0.as_ptr() as *mut c_uint; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString8fromUcs4EPKji(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setUnicode(const QChar * unicode, int size); impl /*struct*/ QString { pub fn setUnicode<RetType, T: QString_setUnicode<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setUnicode(self); // return 1; } } pub trait QString_setUnicode<RetType> { fn setUnicode(self , rsthis: & QString) -> RetType; } // proto: QString & QString::setUnicode(const QChar * unicode, int size); impl<'a> /*trait*/ QString_setUnicode<QString> for (&'a QChar, i32) { fn setUnicode(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString10setUnicodeEPK5QChari()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString10setUnicodeEPK5QChari(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const_iterator QString::constBegin(); impl /*struct*/ QString { pub fn constBegin<RetType, T: QString_constBegin<RetType>>(& self, overload_args: T) -> RetType { return overload_args.constBegin(self); // return 1; } } pub trait QString_constBegin<RetType> { fn constBegin(self , rsthis: & QString) -> RetType; } // proto: const_iterator QString::constBegin(); impl<'a> /*trait*/ QString_constBegin<QChar> for () { fn constBegin(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString10constBeginEv()}; let mut ret = unsafe {C_ZNK7QString10constBeginEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QChar * QString::unicode(); impl /*struct*/ QString { pub fn unicode<RetType, T: QString_unicode<RetType>>(& self, overload_args: T) -> RetType { return overload_args.unicode(self); // return 1; } } pub trait QString_unicode<RetType> { fn unicode(self , rsthis: & QString) -> RetType; } // proto: const QChar * QString::unicode(); impl<'a> /*trait*/ QString_unicode<QChar> for () { fn unicode(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7unicodeEv()}; let mut ret = unsafe {C_ZNK7QString7unicodeEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8, const QString & a9); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let arg4 = self.4.qclsinst as *mut c_void; let arg5 = self.5.qclsinst as *mut c_void; let arg6 = self.6.qclsinst as *mut c_void; let arg7 = self.7.qclsinst as *mut c_void; let arg8 = self.8.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_S1_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::indexOf(const QRegularExpression & re, int from); impl<'a> /*trait*/ QString_indexOf<i32> for (&'a QRegularExpression, Option<i32>) { fn indexOf(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7indexOfERK18QRegularExpressioni()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString7indexOfERK18QRegularExpressioni(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: static QString QString::number(uint , int base); impl<'a> /*trait*/ QString_number_s<QString> for (u32, Option<i32>) { fn number_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6numberEji()}; let arg0 = self.0 as c_uint; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6numberEji(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::fromLocal8Bit(const QByteArray & str); impl<'a> /*trait*/ QString_fromLocal8Bit_s<QString> for (&'a QByteArray) { fn fromLocal8Bit_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString13fromLocal8BitERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString13fromLocal8BitERK10QByteArray(arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QChar QString::at(int i); impl /*struct*/ QString { pub fn at<RetType, T: QString_at<RetType>>(& self, overload_args: T) -> RetType { return overload_args.at(self); // return 1; } } pub trait QString_at<RetType> { fn at(self , rsthis: & QString) -> RetType; } // proto: const QChar QString::at(int i); impl<'a> /*trait*/ QString_at<QChar> for (i32) { fn at(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString2atEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QString2atEi(rsthis.qclsinst, arg0)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::asprintf(const char * format); impl /*struct*/ QString { pub fn asprintf_s<RetType, T: QString_asprintf_s<RetType>>( overload_args: T) -> RetType { return overload_args.asprintf_s(); // return 1; } } pub trait QString_asprintf_s<RetType> { fn asprintf_s(self ) -> RetType; } // proto: static QString QString::asprintf(const char * format); impl<'a> /*trait*/ QString_asprintf_s<QString> for (&'a String) { fn asprintf_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8asprintfEPKcz()}; let arg0 = self.as_ptr() as *mut c_char; let mut ret = unsafe {C_ZN7QString8asprintfEPKcz(arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::QString(int size, QChar c); impl<'a> /*trait*/ QString_new for (i32, QChar) { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2Ei5QChar()}; let ctysz: c_int = unsafe{QString_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.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN7QStringC2Ei5QChar(arg0, arg1)}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QByteArray QString::toLatin1(); impl /*struct*/ QString { pub fn toLatin1<RetType, T: QString_toLatin1<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLatin1(self); // return 1; } } pub trait QString_toLatin1<RetType> { fn toLatin1(self , rsthis: & QString) -> RetType; } // proto: QByteArray QString::toLatin1(); impl<'a> /*trait*/ QString_toLatin1<QByteArray> for () { fn toLatin1(self , rsthis: & QString) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString8toLatin1Ev()}; let mut ret = unsafe {C_ZNO7QString8toLatin1Ev(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::push_front(const QString & s); impl<'a> /*trait*/ QString_push_front<()> for (&'a QString) { fn push_front(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString10push_frontERKS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QString10push_frontERKS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QString::arg(const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, &'a QString, &'a QString, &'a QString, &'a QString, &'a QString) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_S1_S1_S1_S1_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let arg4 = self.4.qclsinst as *mut c_void; let arg5 = self.5.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_S1_S1_S1_S1_S1_(rsthis.qclsinst, arg0, arg1, arg2, arg3, arg4, arg5)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: iterator QString::begin(); impl /*struct*/ QString { pub fn begin<RetType, T: QString_begin<RetType>>(& self, overload_args: T) -> RetType { return overload_args.begin(self); // return 1; } } pub trait QString_begin<RetType> { fn begin(self , rsthis: & QString) -> RetType; } // proto: iterator QString::begin(); impl<'a> /*trait*/ QString_begin<QChar> for () { fn begin(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString5beginEv()}; let mut ret = unsafe {C_ZN7QString5beginEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static QString QString::number(double , char f, int prec); impl<'a> /*trait*/ QString_number_s<QString> for (f64, Option<i8>, Option<i32>) { fn number_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6numberEdci()}; let arg0 = self.0 as c_double; let arg1 = (if self.1.is_none() {'g' as i8} else {self.1.unwrap()}) as c_char; let arg2 = (if self.2.is_none() {6} else {self.2.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6numberEdci(arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: iterator QString::end(); impl /*struct*/ QString { pub fn end<RetType, T: QString_end<RetType>>(& self, overload_args: T) -> RetType { return overload_args.end(self); // return 1; } } pub trait QString_end<RetType> { fn end(self , rsthis: & QString) -> RetType; } // proto: iterator QString::end(); impl<'a> /*trait*/ QString_end<QChar> for () { fn end(self , rsthis: & QString) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString3endEv()}; let mut ret = unsafe {C_ZN7QString3endEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::append(QChar c); impl<'a> /*trait*/ QString_append<QString> for (QChar) { fn append(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6appendE5QChar()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6appendE5QChar(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: uint QString::toUInt(bool * ok, int base); impl /*struct*/ QString { pub fn toUInt<RetType, T: QString_toUInt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUInt(self); // return 1; } } pub trait QString_toUInt<RetType> { fn toUInt(self , rsthis: & QString) -> RetType; } // proto: uint QString::toUInt(bool * ok, int base); impl<'a> /*trait*/ QString_toUInt<u32> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toUInt(self , rsthis: & QString) -> u32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6toUIntEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString6toUIntEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u32; // 1 // return 1; } } // proto: QString & QString::append(const QString & s); impl<'a> /*trait*/ QString_append<QString> for (&'a QString) { fn append(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6appendERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6appendERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: ushort QString::toUShort(bool * ok, int base); impl /*struct*/ QString { pub fn toUShort<RetType, T: QString_toUShort<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUShort(self); // return 1; } } pub trait QString_toUShort<RetType> { fn toUShort(self , rsthis: & QString) -> RetType; } // proto: ushort QString::toUShort(bool * ok, int base); impl<'a> /*trait*/ QString_toUShort<u16> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toUShort(self , rsthis: & QString) -> u16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8toUShortEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString8toUShortEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u16; // 1 // return 1; } } // proto: QString QString::arg(uint a, int fieldWidth, int base, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (u32, Option<i32>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEjii5QChar()}; let arg0 = self.0 as c_uint; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {10} else {self.2.unwrap()}) as c_int; let arg3 = (if self.3.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.3.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEjii5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setNum(ushort , int base); impl<'a> /*trait*/ QString_setNum<QString> for (u16, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEti()}; let arg0 = self.0 as c_ushort; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEti(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QByteArray QString::toLocal8Bit(); impl /*struct*/ QString { pub fn toLocal8Bit<RetType, T: QString_toLocal8Bit<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLocal8Bit(self); // return 1; } } pub trait QString_toLocal8Bit<RetType> { fn toLocal8Bit(self , rsthis: & QString) -> RetType; } // proto: QByteArray QString::toLocal8Bit(); impl<'a> /*trait*/ QString_toLocal8Bit<QByteArray> for () { fn toLocal8Bit(self , rsthis: & QString) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNO7QString11toLocal8BitEv()}; let mut ret = unsafe {C_ZNO7QString11toLocal8BitEv(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::replace(const QRegularExpression & re, const QString & after); impl<'a> /*trait*/ QString_replace<QString> for (&'a QRegularExpression, &'a QString) { fn replace(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7replaceERK18QRegularExpressionRKS_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString7replaceERK18QRegularExpressionRKS_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString & QString::setNum(double , char f, int prec); impl<'a> /*trait*/ QString_setNum<QString> for (f64, Option<i8>, Option<i32>) { fn setNum(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6setNumEdci()}; let arg0 = self.0 as c_double; let arg1 = (if self.1.is_none() {'g' as i8} else {self.1.unwrap()}) as c_char; let arg2 = (if self.2.is_none() {6} else {self.2.unwrap()}) as c_int; let mut ret = unsafe {C_ZN7QString6setNumEdci(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(ushort a, int fieldWidth, int base, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (u16, Option<i32>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEtii5QChar()}; let arg0 = self.0 as c_ushort; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {10} else {self.2.unwrap()}) as c_int; let arg3 = (if self.3.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.3.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEtii5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::QString(const QString & ); impl<'a> /*trait*/ QString_new for (&'a QString) { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2ERKS_()}; let ctysz: c_int = unsafe{QString_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_ZN7QStringC2ERKS_(arg0)}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QString QString::arg(short a, int fieldWidth, int base, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (i16, Option<i32>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEsii5QChar()}; let arg0 = self.0 as c_short; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {10} else {self.2.unwrap()}) as c_int; let arg3 = (if self.3.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.3.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEsii5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::QString(const QByteArray & a); impl<'a> /*trait*/ QString_new for (&'a QByteArray) { fn new(self) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QStringC2ERK10QByteArray()}; let ctysz: c_int = unsafe{QString_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_ZN7QStringC2ERK10QByteArray(arg0)}; let rsthis = QString{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: static QString QString::vasprintf(const char * format, va_list ap); impl /*struct*/ QString { pub fn vasprintf_s<RetType, T: QString_vasprintf_s<RetType>>( overload_args: T) -> RetType { return overload_args.vasprintf_s(); // return 1; } } pub trait QString_vasprintf_s<RetType> { fn vasprintf_s(self ) -> RetType; } // proto: static QString QString::vasprintf(const char * format, va_list ap); impl<'a> /*trait*/ QString_vasprintf_s<QString> for (&'a String, i32) { fn vasprintf_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString9vasprintfEPKci()}; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString9vasprintfEPKci(arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: qulonglong QString::toULongLong(bool * ok, int base); impl /*struct*/ QString { pub fn toULongLong<RetType, T: QString_toULongLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toULongLong(self); // return 1; } } pub trait QString_toULongLong<RetType> { fn toULongLong(self , rsthis: & QString) -> RetType; } // proto: qulonglong QString::toULongLong(bool * ok, int base); impl<'a> /*trait*/ QString_toULongLong<u64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toULongLong(self , rsthis: & QString) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString11toULongLongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString11toULongLongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u64; // 1 // return 1; } } // proto: QString & QString::append(const char * s); impl<'a> /*trait*/ QString_append<QString> for (&'a String) { fn append(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6appendEPKc()}; let arg0 = self.as_ptr() as *mut c_char; let mut ret = unsafe {C_ZN7QString6appendEPKc(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::capacity(); impl /*struct*/ QString { pub fn capacity<RetType, T: QString_capacity<RetType>>(& self, overload_args: T) -> RetType { return overload_args.capacity(self); // return 1; } } pub trait QString_capacity<RetType> { fn capacity(self , rsthis: & QString) -> RetType; } // proto: int QString::capacity(); impl<'a> /*trait*/ QString_capacity<i32> for () { fn capacity(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8capacityEv()}; let mut ret = unsafe {C_ZNK7QString8capacityEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QString::squeeze(); impl /*struct*/ QString { pub fn squeeze<RetType, T: QString_squeeze<RetType>>(& self, overload_args: T) -> RetType { return overload_args.squeeze(self); // return 1; } } pub trait QString_squeeze<RetType> { fn squeeze(self , rsthis: & QString) -> RetType; } // proto: void QString::squeeze(); impl<'a> /*trait*/ QString_squeeze<()> for () { fn squeeze(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7squeezeEv()}; unsafe {C_ZN7QString7squeezeEv(rsthis.qclsinst)}; // return 1; } } // proto: void QString::truncate(int pos); impl /*struct*/ QString { pub fn truncate<RetType, T: QString_truncate<RetType>>(& self, overload_args: T) -> RetType { return overload_args.truncate(self); // return 1; } } pub trait QString_truncate<RetType> { fn truncate(self , rsthis: & QString) -> RetType; } // proto: void QString::truncate(int pos); impl<'a> /*trait*/ QString_truncate<()> for (i32) { fn truncate(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString8truncateEi()}; let arg0 = self as c_int; unsafe {C_ZN7QString8truncateEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QString::arg(int a, int fieldWidth, int base, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (i32, Option<i32>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEiii5QChar()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {10} else {self.2.unwrap()}) as c_int; let arg3 = (if self.3.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.3.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEiii5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(QChar a, int fieldWidth, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (QChar, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argE5QChariS0_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argE5QChariS0_(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QString::localeAwareCompare(const QString & s); impl /*struct*/ QString { pub fn localeAwareCompare<RetType, T: QString_localeAwareCompare<RetType>>(& self, overload_args: T) -> RetType { return overload_args.localeAwareCompare(self); // return 1; } } pub trait QString_localeAwareCompare<RetType> { fn localeAwareCompare(self , rsthis: & QString) -> RetType; } // proto: int QString::localeAwareCompare(const QString & s); impl<'a> /*trait*/ QString_localeAwareCompare<i32> for (&'a QString) { fn localeAwareCompare(self , rsthis: & QString) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString18localeAwareCompareERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString18localeAwareCompareERKS_(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QString & QString::remove(const QRegExp & rx); impl<'a> /*trait*/ QString_remove<QString> for (&'a QRegExp) { fn remove(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6removeERK7QRegExp()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QString6removeERK7QRegExp(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QString::contains(const QRegularExpression & re); impl<'a> /*trait*/ QString_contains<i8> for (&'a QRegularExpression) { fn contains(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString8containsERK18QRegularExpression()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QString8containsERK18QRegularExpression(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: QString & QString::replace(int i, int len, QChar after); impl<'a> /*trait*/ QString_replace<QString> for (i32, i32, QChar) { fn replace(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7replaceEii5QChar()}; 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_ZN7QString7replaceEii5QChar(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QString::isRightToLeft(); impl /*struct*/ QString { pub fn isRightToLeft<RetType, T: QString_isRightToLeft<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isRightToLeft(self); // return 1; } } pub trait QString_isRightToLeft<RetType> { fn isRightToLeft(self , rsthis: & QString) -> RetType; } // proto: bool QString::isRightToLeft(); impl<'a> /*trait*/ QString_isRightToLeft<i8> for () { fn isRightToLeft(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString13isRightToLeftEv()}; let mut ret = unsafe {C_ZNK7QString13isRightToLeftEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString QString::arg(char a, int fieldWidth, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (i8, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEci5QChar()}; let arg0 = self.0 as c_char; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEci5QChar(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QVector<uint> QString::toUcs4(); impl /*struct*/ QString { pub fn toUcs4<RetType, T: QString_toUcs4<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUcs4(self); // return 1; } } pub trait QString_toUcs4<RetType> { fn toUcs4(self , rsthis: & QString) -> RetType; } // proto: QVector<uint> QString::toUcs4(); impl<'a> /*trait*/ QString_toUcs4<u64> for () { fn toUcs4(self , rsthis: & QString) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString6toUcs4Ev()}; let mut ret = unsafe {C_ZNK7QString6toUcs4Ev(rsthis.qclsinst)}; return ret as u64; // 5 // return 1; } } // proto: QString & QString::remove(int i, int len); impl<'a> /*trait*/ QString_remove<QString> for (i32, i32) { fn remove(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString6removeEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZN7QString6removeEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QString::isEmpty(); impl /*struct*/ QString { pub fn isEmpty<RetType, T: QString_isEmpty<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isEmpty(self); // return 1; } } pub trait QString_isEmpty<RetType> { fn isEmpty(self , rsthis: & QString) -> RetType; } // proto: bool QString::isEmpty(); impl<'a> /*trait*/ QString_isEmpty<i8> for () { fn isEmpty(self , rsthis: & QString) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7isEmptyEv()}; let mut ret = unsafe {C_ZNK7QString7isEmptyEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString QString::right(int n); impl /*struct*/ QString { pub fn right<RetType, T: QString_right<RetType>>(& self, overload_args: T) -> RetType { return overload_args.right(self); // return 1; } } pub trait QString_right<RetType> { fn right(self , rsthis: & QString) -> RetType; } // proto: QString QString::right(int n); impl<'a> /*trait*/ QString_right<QString> for (i32) { fn right(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString5rightEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QString5rightEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::rightJustified(int width, QChar fill, bool trunc); impl /*struct*/ QString { pub fn rightJustified<RetType, T: QString_rightJustified<RetType>>(& self, overload_args: T) -> RetType { return overload_args.rightJustified(self); // return 1; } } pub trait QString_rightJustified<RetType> { fn rightJustified(self , rsthis: & QString) -> RetType; } // proto: QString QString::rightJustified(int width, QChar fill, bool trunc); impl<'a> /*trait*/ QString_rightJustified<QString> for (i32, Option<QChar>, Option<i8>) { fn rightJustified(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString14rightJustifiedEi5QCharb()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let arg2 = (if self.2.is_none() {false as i8} else {self.2.unwrap()}) as c_char; let mut ret = unsafe {C_ZNK7QString14rightJustifiedEi5QCharb(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(const QString & a, int fieldWidth, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (&'a QString, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argERKS_i5QChar()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argERKS_i5QChar(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QString::arg(qulonglong a, int fieldwidth, int base, QChar fillChar); impl<'a> /*trait*/ QString_arg<QString> for (u64, Option<i32>, Option<i32>, Option<QChar>) { fn arg(self , rsthis: & QString) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString3argEyii5QChar()}; let arg0 = self.0 as c_ulonglong; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let arg2 = (if self.2.is_none() {10} else {self.2.unwrap()}) as c_int; let arg3 = (if self.3.is_none() {QLatin1Char::new((0 as i8)).qclsinst} else {self.3.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QString3argEyii5QChar(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QString::reserve(int size); impl /*struct*/ QString { pub fn reserve<RetType, T: QString_reserve<RetType>>(& self, overload_args: T) -> RetType { return overload_args.reserve(self); // return 1; } } pub trait QString_reserve<RetType> { fn reserve(self , rsthis: & QString) -> RetType; } // proto: void QString::reserve(int size); impl<'a> /*trait*/ QString_reserve<()> for (i32) { fn reserve(self , rsthis: & QString) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QString7reserveEi()}; let arg0 = self as c_int; unsafe {C_ZN7QString7reserveEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: short QString::toShort(bool * ok, int base); impl /*struct*/ QString { pub fn toShort<RetType, T: QString_toShort<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toShort(self); // return 1; } } pub trait QString_toShort<RetType> { fn toShort(self , rsthis: & QString) -> RetType; } // proto: short QString::toShort(bool * ok, int base); impl<'a> /*trait*/ QString_toShort<i16> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toShort(self , rsthis: & QString) -> i16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QString7toShortEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QString7toShortEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i16; // 1 // return 1; } } impl /*struct*/ QLatin1String { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QLatin1String { return QLatin1String{qclsinst: qthis, ..Default::default()}; } } // proto: const char * QLatin1String::data(); impl /*struct*/ QLatin1String { pub fn data<RetType, T: QLatin1String_data<RetType>>(& self, overload_args: T) -> RetType { return overload_args.data(self); // return 1; } } pub trait QLatin1String_data<RetType> { fn data(self , rsthis: & QLatin1String) -> RetType; } // proto: const char * QLatin1String::data(); impl<'a> /*trait*/ QLatin1String_data<String> for () { fn data(self , rsthis: & QLatin1String) -> String { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QLatin1String4dataEv()}; let mut ret = unsafe {C_ZNK13QLatin1String4dataEv(rsthis.qclsinst)}; let slen = unsafe {strlen(ret as *const i8)} as usize; return unsafe{String::from_raw_parts(ret as *mut u8, slen, slen+1)}; // return 1; } } // proto: void QLatin1String::QLatin1String(const char * s); impl /*struct*/ QLatin1String { pub fn new<T: QLatin1String_new>(value: T) -> QLatin1String { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QLatin1String_new { fn new(self) -> QLatin1String; } // proto: void QLatin1String::QLatin1String(const char * s); impl<'a> /*trait*/ QLatin1String_new for (&'a String) { fn new(self) -> QLatin1String { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QLatin1StringC2EPKc()}; let ctysz: c_int = unsafe{QLatin1String_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.as_ptr() as *mut c_char; let qthis: u64 = unsafe {C_ZN13QLatin1StringC2EPKc(arg0)}; let rsthis = QLatin1String{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: int QLatin1String::size(); impl /*struct*/ QLatin1String { pub fn size<RetType, T: QLatin1String_size<RetType>>(& self, overload_args: T) -> RetType { return overload_args.size(self); // return 1; } } pub trait QLatin1String_size<RetType> { fn size(self , rsthis: & QLatin1String) -> RetType; } // proto: int QLatin1String::size(); impl<'a> /*trait*/ QLatin1String_size<i32> for () { fn size(self , rsthis: & QLatin1String) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QLatin1String4sizeEv()}; let mut ret = unsafe {C_ZNK13QLatin1String4sizeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QLatin1String::QLatin1String(const QByteArray & s); impl<'a> /*trait*/ QLatin1String_new for (&'a QByteArray) { fn new(self) -> QLatin1String { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QLatin1StringC2ERK10QByteArray()}; let ctysz: c_int = unsafe{QLatin1String_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_ZN13QLatin1StringC2ERK10QByteArray(arg0)}; let rsthis = QLatin1String{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: const char * QLatin1String::latin1(); impl /*struct*/ QLatin1String { pub fn latin1<RetType, T: QLatin1String_latin1<RetType>>(& self, overload_args: T) -> RetType { return overload_args.latin1(self); // return 1; } } pub trait QLatin1String_latin1<RetType> { fn latin1(self , rsthis: & QLatin1String) -> RetType; } // proto: const char * QLatin1String::latin1(); impl<'a> /*trait*/ QLatin1String_latin1<String> for () { fn latin1(self , rsthis: & QLatin1String) -> String { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QLatin1String6latin1Ev()}; let mut ret = unsafe {C_ZNK13QLatin1String6latin1Ev(rsthis.qclsinst)}; let slen = unsafe {strlen(ret as *const i8)} as usize; return unsafe{String::from_raw_parts(ret as *mut u8, slen, slen+1)}; // return 1; } } // proto: void QLatin1String::QLatin1String(const char * s, int sz); impl<'a> /*trait*/ QLatin1String_new for (&'a String, i32) { fn new(self) -> QLatin1String { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QLatin1StringC2EPKci()}; let ctysz: c_int = unsafe{QLatin1String_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.as_ptr() as *mut c_char; let arg1 = self.1 as c_int; let qthis: u64 = unsafe {C_ZN13QLatin1StringC2EPKci(arg0, arg1)}; let rsthis = QLatin1String{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } impl /*struct*/ QCharRef { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QCharRef { return QCharRef{qclsinst: qthis, ..Default::default()}; } } // proto: bool QCharRef::isLetterOrNumber(); impl /*struct*/ QCharRef { pub fn isLetterOrNumber<RetType, T: QCharRef_isLetterOrNumber<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isLetterOrNumber(self); // return 1; } } pub trait QCharRef_isLetterOrNumber<RetType> { fn isLetterOrNumber(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isLetterOrNumber(); impl<'a> /*trait*/ QCharRef_isLetterOrNumber<i8> for () { fn isLetterOrNumber(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QCharRef16isLetterOrNumberEv()}; let mut ret = unsafe {C_ZN8QCharRef16isLetterOrNumberEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QCharRef::isDigit(); impl /*struct*/ QCharRef { pub fn isDigit<RetType, T: QCharRef_isDigit<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isDigit(self); // return 1; } } pub trait QCharRef_isDigit<RetType> { fn isDigit(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isDigit(); impl<'a> /*trait*/ QCharRef_isDigit<i8> for () { fn isDigit(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7isDigitEv()}; let mut ret = unsafe {C_ZNK8QCharRef7isDigitEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: char QCharRef::toLatin1(); impl /*struct*/ QCharRef { pub fn toLatin1<RetType, T: QCharRef_toLatin1<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLatin1(self); // return 1; } } pub trait QCharRef_toLatin1<RetType> { fn toLatin1(self , rsthis: & QCharRef) -> RetType; } // proto: char QCharRef::toLatin1(); impl<'a> /*trait*/ QCharRef_toLatin1<i8> for () { fn toLatin1(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef8toLatin1Ev()}; let mut ret = unsafe {C_ZNK8QCharRef8toLatin1Ev(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QCharRef::setCell(uchar cell); impl /*struct*/ QCharRef { pub fn setCell<RetType, T: QCharRef_setCell<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCell(self); // return 1; } } pub trait QCharRef_setCell<RetType> { fn setCell(self , rsthis: & QCharRef) -> RetType; } // proto: void QCharRef::setCell(uchar cell); impl<'a> /*trait*/ QCharRef_setCell<()> for (u8) { fn setCell(self , rsthis: & QCharRef) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QCharRef7setCellEh()}; let arg0 = self as c_uchar; unsafe {C_ZN8QCharRef7setCellEh(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QCharRef::isMark(); impl /*struct*/ QCharRef { pub fn isMark<RetType, T: QCharRef_isMark<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isMark(self); // return 1; } } pub trait QCharRef_isMark<RetType> { fn isMark(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isMark(); impl<'a> /*trait*/ QCharRef_isMark<i8> for () { fn isMark(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef6isMarkEv()}; let mut ret = unsafe {C_ZNK8QCharRef6isMarkEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QCharRef::digitValue(); impl /*struct*/ QCharRef { pub fn digitValue<RetType, T: QCharRef_digitValue<RetType>>(& self, overload_args: T) -> RetType { return overload_args.digitValue(self); // return 1; } } pub trait QCharRef_digitValue<RetType> { fn digitValue(self , rsthis: & QCharRef) -> RetType; } // proto: int QCharRef::digitValue(); impl<'a> /*trait*/ QCharRef_digitValue<i32> for () { fn digitValue(self , rsthis: & QCharRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef10digitValueEv()}; let mut ret = unsafe {C_ZNK8QCharRef10digitValueEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: bool QCharRef::isLetter(); impl /*struct*/ QCharRef { pub fn isLetter<RetType, T: QCharRef_isLetter<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isLetter(self); // return 1; } } pub trait QCharRef_isLetter<RetType> { fn isLetter(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isLetter(); impl<'a> /*trait*/ QCharRef_isLetter<i8> for () { fn isLetter(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef8isLetterEv()}; let mut ret = unsafe {C_ZNK8QCharRef8isLetterEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QCharRef::isNumber(); impl /*struct*/ QCharRef { pub fn isNumber<RetType, T: QCharRef_isNumber<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isNumber(self); // return 1; } } pub trait QCharRef_isNumber<RetType> { fn isNumber(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isNumber(); impl<'a> /*trait*/ QCharRef_isNumber<i8> for () { fn isNumber(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef8isNumberEv()}; let mut ret = unsafe {C_ZNK8QCharRef8isNumberEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QCharRef::isPrint(); impl /*struct*/ QCharRef { pub fn isPrint<RetType, T: QCharRef_isPrint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isPrint(self); // return 1; } } pub trait QCharRef_isPrint<RetType> { fn isPrint(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isPrint(); impl<'a> /*trait*/ QCharRef_isPrint<i8> for () { fn isPrint(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7isPrintEv()}; let mut ret = unsafe {C_ZNK8QCharRef7isPrintEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QChar QCharRef::toLower(); impl /*struct*/ QCharRef { pub fn toLower<RetType, T: QCharRef_toLower<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLower(self); // return 1; } } pub trait QCharRef_toLower<RetType> { fn toLower(self , rsthis: & QCharRef) -> RetType; } // proto: QChar QCharRef::toLower(); impl<'a> /*trait*/ QCharRef_toLower<QChar> for () { fn toLower(self , rsthis: & QCharRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7toLowerEv()}; let mut ret = unsafe {C_ZNK8QCharRef7toLowerEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QCharRef::setRow(uchar row); impl /*struct*/ QCharRef { pub fn setRow<RetType, T: QCharRef_setRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setRow(self); // return 1; } } pub trait QCharRef_setRow<RetType> { fn setRow(self , rsthis: & QCharRef) -> RetType; } // proto: void QCharRef::setRow(uchar row); impl<'a> /*trait*/ QCharRef_setRow<()> for (u8) { fn setRow(self , rsthis: & QCharRef) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QCharRef6setRowEh()}; let arg0 = self as c_uchar; unsafe {C_ZN8QCharRef6setRowEh(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QCharRef::isNull(); impl /*struct*/ QCharRef { pub fn isNull<RetType, T: QCharRef_isNull<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isNull(self); // return 1; } } pub trait QCharRef_isNull<RetType> { fn isNull(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isNull(); impl<'a> /*trait*/ QCharRef_isNull<i8> for () { fn isNull(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef6isNullEv()}; let mut ret = unsafe {C_ZNK8QCharRef6isNullEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QChar QCharRef::toTitleCase(); impl /*struct*/ QCharRef { pub fn toTitleCase<RetType, T: QCharRef_toTitleCase<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toTitleCase(self); // return 1; } } pub trait QCharRef_toTitleCase<RetType> { fn toTitleCase(self , rsthis: & QCharRef) -> RetType; } // proto: QChar QCharRef::toTitleCase(); impl<'a> /*trait*/ QCharRef_toTitleCase<QChar> for () { fn toTitleCase(self , rsthis: & QCharRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef11toTitleCaseEv()}; let mut ret = unsafe {C_ZNK8QCharRef11toTitleCaseEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QCharRef::hasMirrored(); impl /*struct*/ QCharRef { pub fn hasMirrored<RetType, T: QCharRef_hasMirrored<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hasMirrored(self); // return 1; } } pub trait QCharRef_hasMirrored<RetType> { fn hasMirrored(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::hasMirrored(); impl<'a> /*trait*/ QCharRef_hasMirrored<i8> for () { fn hasMirrored(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef11hasMirroredEv()}; let mut ret = unsafe {C_ZNK8QCharRef11hasMirroredEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: uchar QCharRef::row(); impl /*struct*/ QCharRef { pub fn row<RetType, T: QCharRef_row<RetType>>(& self, overload_args: T) -> RetType { return overload_args.row(self); // return 1; } } pub trait QCharRef_row<RetType> { fn row(self , rsthis: & QCharRef) -> RetType; } // proto: uchar QCharRef::row(); impl<'a> /*trait*/ QCharRef_row<u8> for () { fn row(self , rsthis: & QCharRef) -> u8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef3rowEv()}; let mut ret = unsafe {C_ZNK8QCharRef3rowEv(rsthis.qclsinst)}; return ret as u8; // 1 // return 1; } } // proto: ushort & QCharRef::unicode(); impl /*struct*/ QCharRef { pub fn unicode<RetType, T: QCharRef_unicode<RetType>>(& self, overload_args: T) -> RetType { return overload_args.unicode(self); // return 1; } } pub trait QCharRef_unicode<RetType> { fn unicode(self , rsthis: & QCharRef) -> RetType; } // proto: ushort & QCharRef::unicode(); impl<'a> /*trait*/ QCharRef_unicode<u16> for () { fn unicode(self , rsthis: & QCharRef) -> u16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QCharRef7unicodeEv()}; let mut ret = unsafe {C_ZN8QCharRef7unicodeEv(rsthis.qclsinst)}; return ret as u16; // 1 // return 1; } } // proto: bool QCharRef::isTitleCase(); impl /*struct*/ QCharRef { pub fn isTitleCase<RetType, T: QCharRef_isTitleCase<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isTitleCase(self); // return 1; } } pub trait QCharRef_isTitleCase<RetType> { fn isTitleCase(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isTitleCase(); impl<'a> /*trait*/ QCharRef_isTitleCase<i8> for () { fn isTitleCase(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef11isTitleCaseEv()}; let mut ret = unsafe {C_ZNK8QCharRef11isTitleCaseEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QCharRef::isUpper(); impl /*struct*/ QCharRef { pub fn isUpper<RetType, T: QCharRef_isUpper<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isUpper(self); // return 1; } } pub trait QCharRef_isUpper<RetType> { fn isUpper(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isUpper(); impl<'a> /*trait*/ QCharRef_isUpper<i8> for () { fn isUpper(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7isUpperEv()}; let mut ret = unsafe {C_ZNK8QCharRef7isUpperEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: uchar QCharRef::cell(); impl /*struct*/ QCharRef { pub fn cell<RetType, T: QCharRef_cell<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cell(self); // return 1; } } pub trait QCharRef_cell<RetType> { fn cell(self , rsthis: & QCharRef) -> RetType; } // proto: uchar QCharRef::cell(); impl<'a> /*trait*/ QCharRef_cell<u8> for () { fn cell(self , rsthis: & QCharRef) -> u8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef4cellEv()}; let mut ret = unsafe {C_ZNK8QCharRef4cellEv(rsthis.qclsinst)}; return ret as u8; // 1 // return 1; } } // proto: QString QCharRef::decomposition(); impl /*struct*/ QCharRef { pub fn decomposition<RetType, T: QCharRef_decomposition<RetType>>(& self, overload_args: T) -> RetType { return overload_args.decomposition(self); // return 1; } } pub trait QCharRef_decomposition<RetType> { fn decomposition(self , rsthis: & QCharRef) -> RetType; } // proto: QString QCharRef::decomposition(); impl<'a> /*trait*/ QCharRef_decomposition<QString> for () { fn decomposition(self , rsthis: & QCharRef) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef13decompositionEv()}; let mut ret = unsafe {C_ZNK8QCharRef13decompositionEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: uchar QCharRef::combiningClass(); impl /*struct*/ QCharRef { pub fn combiningClass<RetType, T: QCharRef_combiningClass<RetType>>(& self, overload_args: T) -> RetType { return overload_args.combiningClass(self); // return 1; } } pub trait QCharRef_combiningClass<RetType> { fn combiningClass(self , rsthis: & QCharRef) -> RetType; } // proto: uchar QCharRef::combiningClass(); impl<'a> /*trait*/ QCharRef_combiningClass<u8> for () { fn combiningClass(self , rsthis: & QCharRef) -> u8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef14combiningClassEv()}; let mut ret = unsafe {C_ZNK8QCharRef14combiningClassEv(rsthis.qclsinst)}; return ret as u8; // 1 // return 1; } } // proto: QChar QCharRef::mirroredChar(); impl /*struct*/ QCharRef { pub fn mirroredChar<RetType, T: QCharRef_mirroredChar<RetType>>(& self, overload_args: T) -> RetType { return overload_args.mirroredChar(self); // return 1; } } pub trait QCharRef_mirroredChar<RetType> { fn mirroredChar(self , rsthis: & QCharRef) -> RetType; } // proto: QChar QCharRef::mirroredChar(); impl<'a> /*trait*/ QCharRef_mirroredChar<QChar> for () { fn mirroredChar(self , rsthis: & QCharRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef12mirroredCharEv()}; let mut ret = unsafe {C_ZNK8QCharRef12mirroredCharEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QCharRef::isSpace(); impl /*struct*/ QCharRef { pub fn isSpace<RetType, T: QCharRef_isSpace<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSpace(self); // return 1; } } pub trait QCharRef_isSpace<RetType> { fn isSpace(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isSpace(); impl<'a> /*trait*/ QCharRef_isSpace<i8> for () { fn isSpace(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7isSpaceEv()}; let mut ret = unsafe {C_ZNK8QCharRef7isSpaceEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QCharRef::isPunct(); impl /*struct*/ QCharRef { pub fn isPunct<RetType, T: QCharRef_isPunct<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isPunct(self); // return 1; } } pub trait QCharRef_isPunct<RetType> { fn isPunct(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isPunct(); impl<'a> /*trait*/ QCharRef_isPunct<i8> for () { fn isPunct(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7isPunctEv()}; let mut ret = unsafe {C_ZNK8QCharRef7isPunctEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QChar QCharRef::toUpper(); impl /*struct*/ QCharRef { pub fn toUpper<RetType, T: QCharRef_toUpper<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUpper(self); // return 1; } } pub trait QCharRef_toUpper<RetType> { fn toUpper(self , rsthis: & QCharRef) -> RetType; } // proto: QChar QCharRef::toUpper(); impl<'a> /*trait*/ QCharRef_toUpper<QChar> for () { fn toUpper(self , rsthis: & QCharRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7toUpperEv()}; let mut ret = unsafe {C_ZNK8QCharRef7toUpperEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QCharRef::isLower(); impl /*struct*/ QCharRef { pub fn isLower<RetType, T: QCharRef_isLower<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isLower(self); // return 1; } } pub trait QCharRef_isLower<RetType> { fn isLower(self , rsthis: & QCharRef) -> RetType; } // proto: bool QCharRef::isLower(); impl<'a> /*trait*/ QCharRef_isLower<i8> for () { fn isLower(self , rsthis: & QCharRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QCharRef7isLowerEv()}; let mut ret = unsafe {C_ZNK8QCharRef7isLowerEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } impl /*struct*/ QStringRef { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QStringRef { return QStringRef{qclsinst: qthis, ..Default::default()}; } } // proto: short QStringRef::toShort(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toShort<RetType, T: QStringRef_toShort<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toShort(self); // return 1; } } pub trait QStringRef_toShort<RetType> { fn toShort(self , rsthis: & QStringRef) -> RetType; } // proto: short QStringRef::toShort(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toShort<i16> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toShort(self , rsthis: & QStringRef) -> i16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef7toShortEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef7toShortEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i16; // 1 // return 1; } } // proto: void QStringRef::QStringRef(const QString * string); impl /*struct*/ QStringRef { pub fn new<T: QStringRef_new>(value: T) -> QStringRef { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QStringRef_new { fn new(self) -> QStringRef; } // proto: void QStringRef::QStringRef(const QString * string); impl<'a> /*trait*/ QStringRef_new for (&'a QString) { fn new(self) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN10QStringRefC2EPK7QString()}; let ctysz: c_int = unsafe{QStringRef_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_ZN10QStringRefC2EPK7QString(arg0)}; let rsthis = QStringRef{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: qulonglong QStringRef::toULongLong(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toULongLong<RetType, T: QStringRef_toULongLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toULongLong(self); // return 1; } } pub trait QStringRef_toULongLong<RetType> { fn toULongLong(self , rsthis: & QStringRef) -> RetType; } // proto: qulonglong QStringRef::toULongLong(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toULongLong<u64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toULongLong(self , rsthis: & QStringRef) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef11toULongLongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef11toULongLongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u64; // 1 // return 1; } } // proto: void QStringRef::clear(); impl /*struct*/ QStringRef { pub fn clear<RetType, T: QStringRef_clear<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clear(self); // return 1; } } pub trait QStringRef_clear<RetType> { fn clear(self , rsthis: & QStringRef) -> RetType; } // proto: void QStringRef::clear(); impl<'a> /*trait*/ QStringRef_clear<()> for () { fn clear(self , rsthis: & QStringRef) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN10QStringRef5clearEv()}; unsafe {C_ZN10QStringRef5clearEv(rsthis.qclsinst)}; // return 1; } } // proto: int QStringRef::position(); impl /*struct*/ QStringRef { pub fn position<RetType, T: QStringRef_position<RetType>>(& self, overload_args: T) -> RetType { return overload_args.position(self); // return 1; } } pub trait QStringRef_position<RetType> { fn position(self , rsthis: & QStringRef) -> RetType; } // proto: int QStringRef::position(); impl<'a> /*trait*/ QStringRef_position<i32> for () { fn position(self , rsthis: & QStringRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef8positionEv()}; let mut ret = unsafe {C_ZNK10QStringRef8positionEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: long QStringRef::toLong(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toLong<RetType, T: QStringRef_toLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLong(self); // return 1; } } pub trait QStringRef_toLong<RetType> { fn toLong(self , rsthis: & QStringRef) -> RetType; } // proto: long QStringRef::toLong(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toLong<i64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toLong(self , rsthis: & QStringRef) -> i64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6toLongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef6toLongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i64; // 1 // return 1; } } // proto: const QChar * QStringRef::cbegin(); impl /*struct*/ QStringRef { pub fn cbegin<RetType, T: QStringRef_cbegin<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cbegin(self); // return 1; } } pub trait QStringRef_cbegin<RetType> { fn cbegin(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::cbegin(); impl<'a> /*trait*/ QStringRef_cbegin<QChar> for () { fn cbegin(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6cbeginEv()}; let mut ret = unsafe {C_ZNK10QStringRef6cbeginEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: ushort QStringRef::toUShort(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toUShort<RetType, T: QStringRef_toUShort<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUShort(self); // return 1; } } pub trait QStringRef_toUShort<RetType> { fn toUShort(self , rsthis: & QStringRef) -> RetType; } // proto: ushort QStringRef::toUShort(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toUShort<u16> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toUShort(self , rsthis: & QStringRef) -> u16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef8toUShortEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef8toUShortEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u16; // 1 // return 1; } } // proto: uint QStringRef::toUInt(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toUInt<RetType, T: QStringRef_toUInt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUInt(self); // return 1; } } pub trait QStringRef_toUInt<RetType> { fn toUInt(self , rsthis: & QStringRef) -> RetType; } // proto: uint QStringRef::toUInt(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toUInt<u32> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toUInt(self , rsthis: & QStringRef) -> u32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6toUIntEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef6toUIntEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u32; // 1 // return 1; } } // proto: bool QStringRef::isEmpty(); impl /*struct*/ QStringRef { pub fn isEmpty<RetType, T: QStringRef_isEmpty<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isEmpty(self); // return 1; } } pub trait QStringRef_isEmpty<RetType> { fn isEmpty(self , rsthis: & QStringRef) -> RetType; } // proto: bool QStringRef::isEmpty(); impl<'a> /*trait*/ QStringRef_isEmpty<i8> for () { fn isEmpty(self , rsthis: & QStringRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef7isEmptyEv()}; let mut ret = unsafe {C_ZNK10QStringRef7isEmptyEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QStringRef::localeAwareCompare(const QString & s); impl /*struct*/ QStringRef { pub fn localeAwareCompare<RetType, T: QStringRef_localeAwareCompare<RetType>>(& self, overload_args: T) -> RetType { return overload_args.localeAwareCompare(self); // return 1; } } pub trait QStringRef_localeAwareCompare<RetType> { fn localeAwareCompare(self , rsthis: & QStringRef) -> RetType; } // proto: int QStringRef::localeAwareCompare(const QString & s); impl<'a> /*trait*/ QStringRef_localeAwareCompare<i32> for (&'a QString) { fn localeAwareCompare(self , rsthis: & QStringRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef18localeAwareCompareERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK10QStringRef18localeAwareCompareERK7QString(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QByteArray QStringRef::toUtf8(); impl /*struct*/ QStringRef { pub fn toUtf8<RetType, T: QStringRef_toUtf8<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUtf8(self); // return 1; } } pub trait QStringRef_toUtf8<RetType> { fn toUtf8(self , rsthis: & QStringRef) -> RetType; } // proto: QByteArray QStringRef::toUtf8(); impl<'a> /*trait*/ QStringRef_toUtf8<QByteArray> for () { fn toUtf8(self , rsthis: & QStringRef) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6toUtf8Ev()}; let mut ret = unsafe {C_ZNK10QStringRef6toUtf8Ev(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QStringRef::size(); impl /*struct*/ QStringRef { pub fn size<RetType, T: QStringRef_size<RetType>>(& self, overload_args: T) -> RetType { return overload_args.size(self); // return 1; } } pub trait QStringRef_size<RetType> { fn size(self , rsthis: & QStringRef) -> RetType; } // proto: int QStringRef::size(); impl<'a> /*trait*/ QStringRef_size<i32> for () { fn size(self , rsthis: & QStringRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef4sizeEv()}; let mut ret = unsafe {C_ZNK10QStringRef4sizeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: const QChar * QStringRef::constData(); impl /*struct*/ QStringRef { pub fn constData<RetType, T: QStringRef_constData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.constData(self); // return 1; } } pub trait QStringRef_constData<RetType> { fn constData(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::constData(); impl<'a> /*trait*/ QStringRef_constData<QChar> for () { fn constData(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef9constDataEv()}; let mut ret = unsafe {C_ZNK10QStringRef9constDataEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringRef QStringRef::left(int n); impl /*struct*/ QStringRef { pub fn left<RetType, T: QStringRef_left<RetType>>(& self, overload_args: T) -> RetType { return overload_args.left(self); // return 1; } } pub trait QStringRef_left<RetType> { fn left(self , rsthis: & QStringRef) -> RetType; } // proto: QStringRef QStringRef::left(int n); impl<'a> /*trait*/ QStringRef_left<QStringRef> for (i32) { fn left(self , rsthis: & QStringRef) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef4leftEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK10QStringRef4leftEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QVector<uint> QStringRef::toUcs4(); impl /*struct*/ QStringRef { pub fn toUcs4<RetType, T: QStringRef_toUcs4<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUcs4(self); // return 1; } } pub trait QStringRef_toUcs4<RetType> { fn toUcs4(self , rsthis: & QStringRef) -> RetType; } // proto: QVector<uint> QStringRef::toUcs4(); impl<'a> /*trait*/ QStringRef_toUcs4<u64> for () { fn toUcs4(self , rsthis: & QStringRef) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6toUcs4Ev()}; let mut ret = unsafe {C_ZNK10QStringRef6toUcs4Ev(rsthis.qclsinst)}; return ret as u64; // 5 // return 1; } } // proto: int QStringRef::count(); impl /*struct*/ QStringRef { pub fn count<RetType, T: QStringRef_count<RetType>>(& self, overload_args: T) -> RetType { return overload_args.count(self); // return 1; } } pub trait QStringRef_count<RetType> { fn count(self , rsthis: & QStringRef) -> RetType; } // proto: int QStringRef::count(); impl<'a> /*trait*/ QStringRef_count<i32> for () { fn count(self , rsthis: & QStringRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef5countEv()}; let mut ret = unsafe {C_ZNK10QStringRef5countEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QStringRef::QStringRef(const QString * string, int position, int size); impl<'a> /*trait*/ QStringRef_new for (&'a QString, i32, i32) { fn new(self) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN10QStringRefC2EPK7QStringii()}; let ctysz: c_int = unsafe{QStringRef_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 as c_int; let arg2 = self.2 as c_int; let qthis: u64 = unsafe {C_ZN10QStringRefC2EPK7QStringii(arg0, arg1, arg2)}; let rsthis = QStringRef{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QStringRef::QStringRef(); impl<'a> /*trait*/ QStringRef_new for () { fn new(self) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN10QStringRefC2Ev()}; let ctysz: c_int = unsafe{QStringRef_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN10QStringRefC2Ev()}; let rsthis = QStringRef{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QStringRef QStringRef::right(int n); impl /*struct*/ QStringRef { pub fn right<RetType, T: QStringRef_right<RetType>>(& self, overload_args: T) -> RetType { return overload_args.right(self); // return 1; } } pub trait QStringRef_right<RetType> { fn right(self , rsthis: & QStringRef) -> RetType; } // proto: QStringRef QStringRef::right(int n); impl<'a> /*trait*/ QStringRef_right<QStringRef> for (i32) { fn right(self , rsthis: & QStringRef) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef5rightEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK10QStringRef5rightEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QChar QStringRef::at(int i); impl /*struct*/ QStringRef { pub fn at<RetType, T: QStringRef_at<RetType>>(& self, overload_args: T) -> RetType { return overload_args.at(self); // return 1; } } pub trait QStringRef_at<RetType> { fn at(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar QStringRef::at(int i); impl<'a> /*trait*/ QStringRef_at<QChar> for (i32) { fn at(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef2atEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK10QStringRef2atEi(rsthis.qclsinst, arg0)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: double QStringRef::toDouble(bool * ok); impl /*struct*/ QStringRef { pub fn toDouble<RetType, T: QStringRef_toDouble<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toDouble(self); // return 1; } } pub trait QStringRef_toDouble<RetType> { fn toDouble(self , rsthis: & QStringRef) -> RetType; } // proto: double QStringRef::toDouble(bool * ok); impl<'a> /*trait*/ QStringRef_toDouble<f64> for (Option<&'a mut Vec<i8>>) { fn toDouble(self , rsthis: & QStringRef) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef8toDoubleEPb()}; let arg0 = (if self.is_none() {0 as *const i8} else {self.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK10QStringRef8toDoubleEPb(rsthis.qclsinst, arg0)}; return ret as f64; // 1 // return 1; } } // proto: bool QStringRef::isNull(); impl /*struct*/ QStringRef { pub fn isNull<RetType, T: QStringRef_isNull<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isNull(self); // return 1; } } pub trait QStringRef_isNull<RetType> { fn isNull(self , rsthis: & QStringRef) -> RetType; } // proto: bool QStringRef::isNull(); impl<'a> /*trait*/ QStringRef_isNull<i8> for () { fn isNull(self , rsthis: & QStringRef) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6isNullEv()}; let mut ret = unsafe {C_ZNK10QStringRef6isNullEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: const QChar * QStringRef::data(); impl /*struct*/ QStringRef { pub fn data<RetType, T: QStringRef_data<RetType>>(& self, overload_args: T) -> RetType { return overload_args.data(self); // return 1; } } pub trait QStringRef_data<RetType> { fn data(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::data(); impl<'a> /*trait*/ QStringRef_data<QChar> for () { fn data(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef4dataEv()}; let mut ret = unsafe {C_ZNK10QStringRef4dataEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: qlonglong QStringRef::toLongLong(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toLongLong<RetType, T: QStringRef_toLongLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLongLong(self); // return 1; } } pub trait QStringRef_toLongLong<RetType> { fn toLongLong(self , rsthis: & QStringRef) -> RetType; } // proto: qlonglong QStringRef::toLongLong(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toLongLong<i64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toLongLong(self , rsthis: & QStringRef) -> i64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef10toLongLongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef10toLongLongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i64; // 1 // return 1; } } // proto: QByteArray QStringRef::toLatin1(); impl /*struct*/ QStringRef { pub fn toLatin1<RetType, T: QStringRef_toLatin1<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLatin1(self); // return 1; } } pub trait QStringRef_toLatin1<RetType> { fn toLatin1(self , rsthis: & QStringRef) -> RetType; } // proto: QByteArray QStringRef::toLatin1(); impl<'a> /*trait*/ QStringRef_toLatin1<QByteArray> for () { fn toLatin1(self , rsthis: & QStringRef) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef8toLatin1Ev()}; let mut ret = unsafe {C_ZNK10QStringRef8toLatin1Ev(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QChar * QStringRef::begin(); impl /*struct*/ QStringRef { pub fn begin<RetType, T: QStringRef_begin<RetType>>(& self, overload_args: T) -> RetType { return overload_args.begin(self); // return 1; } } pub trait QStringRef_begin<RetType> { fn begin(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::begin(); impl<'a> /*trait*/ QStringRef_begin<QChar> for () { fn begin(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef5beginEv()}; let mut ret = unsafe {C_ZNK10QStringRef5beginEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QChar * QStringRef::unicode(); impl /*struct*/ QStringRef { pub fn unicode<RetType, T: QStringRef_unicode<RetType>>(& self, overload_args: T) -> RetType { return overload_args.unicode(self); // return 1; } } pub trait QStringRef_unicode<RetType> { fn unicode(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::unicode(); impl<'a> /*trait*/ QStringRef_unicode<QChar> for () { fn unicode(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef7unicodeEv()}; let mut ret = unsafe {C_ZNK10QStringRef7unicodeEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringRef QStringRef::mid(int pos, int n); impl /*struct*/ QStringRef { pub fn mid<RetType, T: QStringRef_mid<RetType>>(& self, overload_args: T) -> RetType { return overload_args.mid(self); // return 1; } } pub trait QStringRef_mid<RetType> { fn mid(self , rsthis: & QStringRef) -> RetType; } // proto: QStringRef QStringRef::mid(int pos, int n); impl<'a> /*trait*/ QStringRef_mid<QStringRef> for (i32, Option<i32>) { fn mid(self , rsthis: & QStringRef) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef3midEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {-1} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef3midEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: float QStringRef::toFloat(bool * ok); impl /*struct*/ QStringRef { pub fn toFloat<RetType, T: QStringRef_toFloat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toFloat(self); // return 1; } } pub trait QStringRef_toFloat<RetType> { fn toFloat(self , rsthis: & QStringRef) -> RetType; } // proto: float QStringRef::toFloat(bool * ok); impl<'a> /*trait*/ QStringRef_toFloat<f32> for (Option<&'a mut Vec<i8>>) { fn toFloat(self , rsthis: & QStringRef) -> f32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef7toFloatEPb()}; let arg0 = (if self.is_none() {0 as *const i8} else {self.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK10QStringRef7toFloatEPb(rsthis.qclsinst, arg0)}; return ret as f32; // 1 // return 1; } } // proto: const QString * QStringRef::string(); impl /*struct*/ QStringRef { pub fn string<RetType, T: QStringRef_string<RetType>>(& self, overload_args: T) -> RetType { return overload_args.string(self); // return 1; } } pub trait QStringRef_string<RetType> { fn string(self , rsthis: & QStringRef) -> RetType; } // proto: const QString * QStringRef::string(); impl<'a> /*trait*/ QStringRef_string<QString> for () { fn string(self , rsthis: & QStringRef) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6stringEv()}; let mut ret = unsafe {C_ZNK10QStringRef6stringEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QStringRef::toString(); impl /*struct*/ QStringRef { pub fn toString<RetType, T: QStringRef_toString<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toString(self); // return 1; } } pub trait QStringRef_toString<RetType> { fn toString(self , rsthis: & QStringRef) -> RetType; } // proto: QString QStringRef::toString(); impl<'a> /*trait*/ QStringRef_toString<QString> for () { fn toString(self , rsthis: & QStringRef) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef8toStringEv()}; let mut ret = unsafe {C_ZNK10QStringRef8toStringEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringRef QStringRef::trimmed(); impl /*struct*/ QStringRef { pub fn trimmed<RetType, T: QStringRef_trimmed<RetType>>(& self, overload_args: T) -> RetType { return overload_args.trimmed(self); // return 1; } } pub trait QStringRef_trimmed<RetType> { fn trimmed(self , rsthis: & QStringRef) -> RetType; } // proto: QStringRef QStringRef::trimmed(); impl<'a> /*trait*/ QStringRef_trimmed<QStringRef> for () { fn trimmed(self , rsthis: & QStringRef) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef7trimmedEv()}; let mut ret = unsafe {C_ZNK10QStringRef7trimmedEv(rsthis.qclsinst)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QStringRef::toInt(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toInt<RetType, T: QStringRef_toInt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toInt(self); // return 1; } } pub trait QStringRef_toInt<RetType> { fn toInt(self , rsthis: & QStringRef) -> RetType; } // proto: int QStringRef::toInt(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toInt<i32> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toInt(self , rsthis: & QStringRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef5toIntEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef5toIntEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: const QChar * QStringRef::cend(); impl /*struct*/ QStringRef { pub fn cend<RetType, T: QStringRef_cend<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cend(self); // return 1; } } pub trait QStringRef_cend<RetType> { fn cend(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::cend(); impl<'a> /*trait*/ QStringRef_cend<QChar> for () { fn cend(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef4cendEv()}; let mut ret = unsafe {C_ZNK10QStringRef4cendEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringRef QStringRef::appendTo(QString * string); impl /*struct*/ QStringRef { pub fn appendTo<RetType, T: QStringRef_appendTo<RetType>>(& self, overload_args: T) -> RetType { return overload_args.appendTo(self); // return 1; } } pub trait QStringRef_appendTo<RetType> { fn appendTo(self , rsthis: & QStringRef) -> RetType; } // proto: QStringRef QStringRef::appendTo(QString * string); impl<'a> /*trait*/ QStringRef_appendTo<QStringRef> for (&'a QString) { fn appendTo(self , rsthis: & QStringRef) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef8appendToEP7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK10QStringRef8appendToEP7QString(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QStringRef::length(); impl /*struct*/ QStringRef { pub fn length<RetType, T: QStringRef_length<RetType>>(& self, overload_args: T) -> RetType { return overload_args.length(self); // return 1; } } pub trait QStringRef_length<RetType> { fn length(self , rsthis: & QStringRef) -> RetType; } // proto: int QStringRef::length(); impl<'a> /*trait*/ QStringRef_length<i32> for () { fn length(self , rsthis: & QStringRef) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef6lengthEv()}; let mut ret = unsafe {C_ZNK10QStringRef6lengthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QStringRef::~QStringRef(); impl /*struct*/ QStringRef { pub fn free<RetType, T: QStringRef_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QStringRef_free<RetType> { fn free(self , rsthis: & QStringRef) -> RetType; } // proto: void QStringRef::~QStringRef(); impl<'a> /*trait*/ QStringRef_free<()> for () { fn free(self , rsthis: & QStringRef) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN10QStringRefD2Ev()}; unsafe {C_ZN10QStringRefD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: QByteArray QStringRef::toLocal8Bit(); impl /*struct*/ QStringRef { pub fn toLocal8Bit<RetType, T: QStringRef_toLocal8Bit<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLocal8Bit(self); // return 1; } } pub trait QStringRef_toLocal8Bit<RetType> { fn toLocal8Bit(self , rsthis: & QStringRef) -> RetType; } // proto: QByteArray QStringRef::toLocal8Bit(); impl<'a> /*trait*/ QStringRef_toLocal8Bit<QByteArray> for () { fn toLocal8Bit(self , rsthis: & QStringRef) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef11toLocal8BitEv()}; let mut ret = unsafe {C_ZNK10QStringRef11toLocal8BitEv(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: ulong QStringRef::toULong(bool * ok, int base); impl /*struct*/ QStringRef { pub fn toULong<RetType, T: QStringRef_toULong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toULong(self); // return 1; } } pub trait QStringRef_toULong<RetType> { fn toULong(self , rsthis: & QStringRef) -> RetType; } // proto: ulong QStringRef::toULong(bool * ok, int base); impl<'a> /*trait*/ QStringRef_toULong<u64> for (Option<&'a mut Vec<i8>>, Option<i32>) { fn toULong(self , rsthis: & QStringRef) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef7toULongEPbi()}; let arg0 = (if self.0.is_none() {0 as *const i8} else {self.0.unwrap().as_ptr()}) as *mut c_char; let arg1 = (if self.1.is_none() {10} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK10QStringRef7toULongEPbi(rsthis.qclsinst, arg0, arg1)}; return ret as u64; // 1 // return 1; } } // proto: const QChar * QStringRef::end(); impl /*struct*/ QStringRef { pub fn end<RetType, T: QStringRef_end<RetType>>(& self, overload_args: T) -> RetType { return overload_args.end(self); // return 1; } } pub trait QStringRef_end<RetType> { fn end(self , rsthis: & QStringRef) -> RetType; } // proto: const QChar * QStringRef::end(); impl<'a> /*trait*/ QStringRef_end<QChar> for () { fn end(self , rsthis: & QStringRef) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QStringRef3endEv()}; let mut ret = unsafe {C_ZNK10QStringRef3endEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // <= body block end
pub fn demo() { let v: Vec<i32> = Vec::new(); println!(v); }
windows::core::include_bindings!(); use crate::Windows::Win32::Globalization::{SetThreadPreferredUILanguages, MUI_LANGUAGE_NAME}; pub fn set_thread_ui_language(language_tag: &str) -> bool { unsafe { let mut _languages_set = 0; SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, format!("{}\0\0", language_tag), _languages_set as *mut _).as_bool() } }
#[doc = "Reader of register OTG_FS_GADPCTL"] pub type R = crate::R<u32, super::OTG_FS_GADPCTL>; #[doc = "Writer for register OTG_FS_GADPCTL"] pub type W = crate::W<u32, super::OTG_FS_GADPCTL>; #[doc = "Register OTG_FS_GADPCTL `reset()`'s with value 0x0200_0400"] impl crate::ResetValue for super::OTG_FS_GADPCTL { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0x0200_0400 } } #[doc = "Reader of field `PRBDSCHG`"] pub type PRBDSCHG_R = crate::R<u8, u8>; #[doc = "Write proxy for field `PRBDSCHG`"] pub struct PRBDSCHG_W<'a> { w: &'a mut W, } impl<'a> PRBDSCHG_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 & !0x03) | ((value as u32) & 0x03); self.w } } #[doc = "Reader of field `PRBDELTA`"] pub type PRBDELTA_R = crate::R<u8, u8>; #[doc = "Write proxy for field `PRBDELTA`"] pub struct PRBDELTA_W<'a> { w: &'a mut W, } impl<'a> PRBDELTA_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 & !(0x03 << 2)) | (((value as u32) & 0x03) << 2); self.w } } #[doc = "Reader of field `PRBPER`"] pub type PRBPER_R = crate::R<u8, u8>; #[doc = "Write proxy for field `PRBPER`"] pub struct PRBPER_W<'a> { w: &'a mut W, } impl<'a> PRBPER_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 & !(0x03 << 4)) | (((value as u32) & 0x03) << 4); self.w } } #[doc = "Reader of field `RTIM`"] pub type RTIM_R = crate::R<u16, u16>; #[doc = "Reader of field `ENAPRB`"] pub type ENAPRB_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ENAPRB`"] pub struct ENAPRB_W<'a> { w: &'a mut W, } impl<'a> ENAPRB_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17); self.w } } #[doc = "Reader of field `ENASNS`"] pub type ENASNS_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ENASNS`"] pub struct ENASNS_W<'a> { w: &'a mut W, } impl<'a> ENASNS_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18); self.w } } #[doc = "Reader of field `ADPRST`"] pub type ADPRST_R = crate::R<bool, bool>; #[doc = "Reader of field `ADPEN`"] pub type ADPEN_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPEN`"] pub struct ADPEN_W<'a> { w: &'a mut W, } impl<'a> ADPEN_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20); self.w } } #[doc = "Reader of field `ADPPRBIF`"] pub type ADPPRBIF_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPPRBIF`"] pub struct ADPPRBIF_W<'a> { w: &'a mut W, } impl<'a> ADPPRBIF_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 << 21)) | (((value as u32) & 0x01) << 21); self.w } } #[doc = "Reader of field `ADPSNSIF`"] pub type ADPSNSIF_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPSNSIF`"] pub struct ADPSNSIF_W<'a> { w: &'a mut W, } impl<'a> ADPSNSIF_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22); self.w } } #[doc = "Reader of field `ADPTOIF`"] pub type ADPTOIF_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPTOIF`"] pub struct ADPTOIF_W<'a> { w: &'a mut W, } impl<'a> ADPTOIF_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23); self.w } } #[doc = "Reader of field `ADPPRBIM`"] pub type ADPPRBIM_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPPRBIM`"] pub struct ADPPRBIM_W<'a> { w: &'a mut W, } impl<'a> ADPPRBIM_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24); self.w } } #[doc = "Reader of field `ADPSNSIM`"] pub type ADPSNSIM_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPSNSIM`"] pub struct ADPSNSIM_W<'a> { w: &'a mut W, } impl<'a> ADPSNSIM_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25); self.w } } #[doc = "Reader of field `ADPTOIM`"] pub type ADPTOIM_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADPTOIM`"] pub struct ADPTOIM_W<'a> { w: &'a mut W, } impl<'a> ADPTOIM_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26); self.w } } #[doc = "Reader of field `AR`"] pub type AR_R = crate::R<u8, u8>; #[doc = "Write proxy for field `AR`"] pub struct AR_W<'a> { w: &'a mut W, } impl<'a> AR_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 & !(0x03 << 27)) | (((value as u32) & 0x03) << 27); self.w } } impl R { #[doc = "Bits 0:1 - Probe discharge"] #[inline(always)] pub fn prbdschg(&self) -> PRBDSCHG_R { PRBDSCHG_R::new((self.bits & 0x03) as u8) } #[doc = "Bits 2:3 - Probe delta"] #[inline(always)] pub fn prbdelta(&self) -> PRBDELTA_R { PRBDELTA_R::new(((self.bits >> 2) & 0x03) as u8) } #[doc = "Bits 4:5 - Probe period"] #[inline(always)] pub fn prbper(&self) -> PRBPER_R { PRBPER_R::new(((self.bits >> 4) & 0x03) as u8) } #[doc = "Bits 6:16 - Ramp time"] #[inline(always)] pub fn rtim(&self) -> RTIM_R { RTIM_R::new(((self.bits >> 6) & 0x07ff) as u16) } #[doc = "Bit 17 - Enable probe"] #[inline(always)] pub fn enaprb(&self) -> ENAPRB_R { ENAPRB_R::new(((self.bits >> 17) & 0x01) != 0) } #[doc = "Bit 18 - Enable sense"] #[inline(always)] pub fn enasns(&self) -> ENASNS_R { ENASNS_R::new(((self.bits >> 18) & 0x01) != 0) } #[doc = "Bit 19 - ADP reset"] #[inline(always)] pub fn adprst(&self) -> ADPRST_R { ADPRST_R::new(((self.bits >> 19) & 0x01) != 0) } #[doc = "Bit 20 - ADP enable"] #[inline(always)] pub fn adpen(&self) -> ADPEN_R { ADPEN_R::new(((self.bits >> 20) & 0x01) != 0) } #[doc = "Bit 21 - ADP probe interrupt flag"] #[inline(always)] pub fn adpprbif(&self) -> ADPPRBIF_R { ADPPRBIF_R::new(((self.bits >> 21) & 0x01) != 0) } #[doc = "Bit 22 - ADP sense interrupt flag"] #[inline(always)] pub fn adpsnsif(&self) -> ADPSNSIF_R { ADPSNSIF_R::new(((self.bits >> 22) & 0x01) != 0) } #[doc = "Bit 23 - ADP timeout interrupt flag"] #[inline(always)] pub fn adptoif(&self) -> ADPTOIF_R { ADPTOIF_R::new(((self.bits >> 23) & 0x01) != 0) } #[doc = "Bit 24 - ADP probe interrupt mask"] #[inline(always)] pub fn adpprbim(&self) -> ADPPRBIM_R { ADPPRBIM_R::new(((self.bits >> 24) & 0x01) != 0) } #[doc = "Bit 25 - ADP sense interrupt mask"] #[inline(always)] pub fn adpsnsim(&self) -> ADPSNSIM_R { ADPSNSIM_R::new(((self.bits >> 25) & 0x01) != 0) } #[doc = "Bit 26 - ADP timeout interrupt mask"] #[inline(always)] pub fn adptoim(&self) -> ADPTOIM_R { ADPTOIM_R::new(((self.bits >> 26) & 0x01) != 0) } #[doc = "Bits 27:28 - Access request"] #[inline(always)] pub fn ar(&self) -> AR_R { AR_R::new(((self.bits >> 27) & 0x03) as u8) } } impl W { #[doc = "Bits 0:1 - Probe discharge"] #[inline(always)] pub fn prbdschg(&mut self) -> PRBDSCHG_W { PRBDSCHG_W { w: self } } #[doc = "Bits 2:3 - Probe delta"] #[inline(always)] pub fn prbdelta(&mut self) -> PRBDELTA_W { PRBDELTA_W { w: self } } #[doc = "Bits 4:5 - Probe period"] #[inline(always)] pub fn prbper(&mut self) -> PRBPER_W { PRBPER_W { w: self } } #[doc = "Bit 17 - Enable probe"] #[inline(always)] pub fn enaprb(&mut self) -> ENAPRB_W { ENAPRB_W { w: self } } #[doc = "Bit 18 - Enable sense"] #[inline(always)] pub fn enasns(&mut self) -> ENASNS_W { ENASNS_W { w: self } } #[doc = "Bit 20 - ADP enable"] #[inline(always)] pub fn adpen(&mut self) -> ADPEN_W { ADPEN_W { w: self } } #[doc = "Bit 21 - ADP probe interrupt flag"] #[inline(always)] pub fn adpprbif(&mut self) -> ADPPRBIF_W { ADPPRBIF_W { w: self } } #[doc = "Bit 22 - ADP sense interrupt flag"] #[inline(always)] pub fn adpsnsif(&mut self) -> ADPSNSIF_W { ADPSNSIF_W { w: self } } #[doc = "Bit 23 - ADP timeout interrupt flag"] #[inline(always)] pub fn adptoif(&mut self) -> ADPTOIF_W { ADPTOIF_W { w: self } } #[doc = "Bit 24 - ADP probe interrupt mask"] #[inline(always)] pub fn adpprbim(&mut self) -> ADPPRBIM_W { ADPPRBIM_W { w: self } } #[doc = "Bit 25 - ADP sense interrupt mask"] #[inline(always)] pub fn adpsnsim(&mut self) -> ADPSNSIM_W { ADPSNSIM_W { w: self } } #[doc = "Bit 26 - ADP timeout interrupt mask"] #[inline(always)] pub fn adptoim(&mut self) -> ADPTOIM_W { ADPTOIM_W { w: self } } #[doc = "Bits 27:28 - Access request"] #[inline(always)] pub fn ar(&mut self) -> AR_W { AR_W { w: self } } }
#[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::MIS { #[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 TIMER_MIS_TATOMISR { bits: bool, } impl TIMER_MIS_TATOMISR { #[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 _TIMER_MIS_TATOMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_TATOMISW<'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 TIMER_MIS_CAMMISR { bits: bool, } impl TIMER_MIS_CAMMISR { #[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 _TIMER_MIS_CAMMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_CAMMISW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 1); self.w.bits |= ((value as u32) & 1) << 1; self.w } } #[doc = r"Value of the field"] pub struct TIMER_MIS_CAEMISR { bits: bool, } impl TIMER_MIS_CAEMISR { #[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 _TIMER_MIS_CAEMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_CAEMISW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 2); self.w.bits |= ((value as u32) & 1) << 2; self.w } } #[doc = r"Value of the field"] pub struct TIMER_MIS_RTCMISR { bits: bool, } impl TIMER_MIS_RTCMISR { #[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 _TIMER_MIS_RTCMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_RTCMISW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 3); self.w.bits |= ((value as u32) & 1) << 3; self.w } } #[doc = r"Value of the field"] pub struct TIMER_MIS_TAMMISR { bits: bool, } impl TIMER_MIS_TAMMISR { #[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 _TIMER_MIS_TAMMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_TAMMISW<'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 TIMER_MIS_DMAAMISR { bits: bool, } impl TIMER_MIS_DMAAMISR { #[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 _TIMER_MIS_DMAAMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_DMAAMISW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 5); self.w.bits |= ((value as u32) & 1) << 5; self.w } } #[doc = r"Value of the field"] pub struct TIMER_MIS_TBTOMISR { bits: bool, } impl TIMER_MIS_TBTOMISR { #[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 _TIMER_MIS_TBTOMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_TBTOMISW<'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 TIMER_MIS_CBMMISR { bits: bool, } impl TIMER_MIS_CBMMISR { #[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 _TIMER_MIS_CBMMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_CBMMISW<'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 TIMER_MIS_CBEMISR { bits: bool, } impl TIMER_MIS_CBEMISR { #[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 _TIMER_MIS_CBEMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_CBEMISW<'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 TIMER_MIS_TBMMISR { bits: bool, } impl TIMER_MIS_TBMMISR { #[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 _TIMER_MIS_TBMMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_TBMMISW<'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 TIMER_MIS_DMABMISR { bits: bool, } impl TIMER_MIS_DMABMISR { #[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 _TIMER_MIS_DMABMISW<'a> { w: &'a mut W, } impl<'a> _TIMER_MIS_DMABMISW<'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 } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bit 0 - GPTM Timer A Time-Out Masked Interrupt"] #[inline(always)] pub fn timer_mis_tatomis(&self) -> TIMER_MIS_TATOMISR { let bits = ((self.bits >> 0) & 1) != 0; TIMER_MIS_TATOMISR { bits } } #[doc = "Bit 1 - GPTM Timer A Capture Mode Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_cammis(&self) -> TIMER_MIS_CAMMISR { let bits = ((self.bits >> 1) & 1) != 0; TIMER_MIS_CAMMISR { bits } } #[doc = "Bit 2 - GPTM Timer A Capture Mode Event Masked Interrupt"] #[inline(always)] pub fn timer_mis_caemis(&self) -> TIMER_MIS_CAEMISR { let bits = ((self.bits >> 2) & 1) != 0; TIMER_MIS_CAEMISR { bits } } #[doc = "Bit 3 - GPTM RTC Masked Interrupt"] #[inline(always)] pub fn timer_mis_rtcmis(&self) -> TIMER_MIS_RTCMISR { let bits = ((self.bits >> 3) & 1) != 0; TIMER_MIS_RTCMISR { bits } } #[doc = "Bit 4 - GPTM Timer A Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_tammis(&self) -> TIMER_MIS_TAMMISR { let bits = ((self.bits >> 4) & 1) != 0; TIMER_MIS_TAMMISR { bits } } #[doc = "Bit 5 - GPTM Timer A DMA Done Masked Interrupt"] #[inline(always)] pub fn timer_mis_dmaamis(&self) -> TIMER_MIS_DMAAMISR { let bits = ((self.bits >> 5) & 1) != 0; TIMER_MIS_DMAAMISR { bits } } #[doc = "Bit 8 - GPTM Timer B Time-Out Masked Interrupt"] #[inline(always)] pub fn timer_mis_tbtomis(&self) -> TIMER_MIS_TBTOMISR { let bits = ((self.bits >> 8) & 1) != 0; TIMER_MIS_TBTOMISR { bits } } #[doc = "Bit 9 - GPTM Timer B Capture Mode Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_cbmmis(&self) -> TIMER_MIS_CBMMISR { let bits = ((self.bits >> 9) & 1) != 0; TIMER_MIS_CBMMISR { bits } } #[doc = "Bit 10 - GPTM Timer B Capture Mode Event Masked Interrupt"] #[inline(always)] pub fn timer_mis_cbemis(&self) -> TIMER_MIS_CBEMISR { let bits = ((self.bits >> 10) & 1) != 0; TIMER_MIS_CBEMISR { bits } } #[doc = "Bit 11 - GPTM Timer B Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_tbmmis(&self) -> TIMER_MIS_TBMMISR { let bits = ((self.bits >> 11) & 1) != 0; TIMER_MIS_TBMMISR { bits } } #[doc = "Bit 13 - GPTM Timer B DMA Done Masked Interrupt"] #[inline(always)] pub fn timer_mis_dmabmis(&self) -> TIMER_MIS_DMABMISR { let bits = ((self.bits >> 13) & 1) != 0; TIMER_MIS_DMABMISR { 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 - GPTM Timer A Time-Out Masked Interrupt"] #[inline(always)] pub fn timer_mis_tatomis(&mut self) -> _TIMER_MIS_TATOMISW { _TIMER_MIS_TATOMISW { w: self } } #[doc = "Bit 1 - GPTM Timer A Capture Mode Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_cammis(&mut self) -> _TIMER_MIS_CAMMISW { _TIMER_MIS_CAMMISW { w: self } } #[doc = "Bit 2 - GPTM Timer A Capture Mode Event Masked Interrupt"] #[inline(always)] pub fn timer_mis_caemis(&mut self) -> _TIMER_MIS_CAEMISW { _TIMER_MIS_CAEMISW { w: self } } #[doc = "Bit 3 - GPTM RTC Masked Interrupt"] #[inline(always)] pub fn timer_mis_rtcmis(&mut self) -> _TIMER_MIS_RTCMISW { _TIMER_MIS_RTCMISW { w: self } } #[doc = "Bit 4 - GPTM Timer A Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_tammis(&mut self) -> _TIMER_MIS_TAMMISW { _TIMER_MIS_TAMMISW { w: self } } #[doc = "Bit 5 - GPTM Timer A DMA Done Masked Interrupt"] #[inline(always)] pub fn timer_mis_dmaamis(&mut self) -> _TIMER_MIS_DMAAMISW { _TIMER_MIS_DMAAMISW { w: self } } #[doc = "Bit 8 - GPTM Timer B Time-Out Masked Interrupt"] #[inline(always)] pub fn timer_mis_tbtomis(&mut self) -> _TIMER_MIS_TBTOMISW { _TIMER_MIS_TBTOMISW { w: self } } #[doc = "Bit 9 - GPTM Timer B Capture Mode Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_cbmmis(&mut self) -> _TIMER_MIS_CBMMISW { _TIMER_MIS_CBMMISW { w: self } } #[doc = "Bit 10 - GPTM Timer B Capture Mode Event Masked Interrupt"] #[inline(always)] pub fn timer_mis_cbemis(&mut self) -> _TIMER_MIS_CBEMISW { _TIMER_MIS_CBEMISW { w: self } } #[doc = "Bit 11 - GPTM Timer B Match Masked Interrupt"] #[inline(always)] pub fn timer_mis_tbmmis(&mut self) -> _TIMER_MIS_TBMMISW { _TIMER_MIS_TBMMISW { w: self } } #[doc = "Bit 13 - GPTM Timer B DMA Done Masked Interrupt"] #[inline(always)] pub fn timer_mis_dmabmis(&mut self) -> _TIMER_MIS_DMABMISW { _TIMER_MIS_DMABMISW { w: self } } }
use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::cell::RefCell; use std::rc::{Rc, Weak}; use std::fmt; struct Node { v: i32, p: Option<Weak<RefCell<Node>>>, } fn main() { let mut arr: Vec<Rc<RefCell<Node>>> = Vec::new(); arr.push(Rc::new(RefCell::new(Node {v: 0, p: None}))); for i in (1..5) { arr.push(Rc::new(RefCell::new(Node {v: i, p: Some(Rc::downgrade(&arr[(i - 1) as usize]))}))); } for i in arr.iter() { println!("addr:{:p}, strong_count:{}, weak_count:{}, v:{}", &(*i.borrow()), Rc::strong_count(&i), Rc::weak_count(&i), i.borrow().v); } loop_rc(arr.last().unwrap().clone()); loop_raw(&arr.last().unwrap().borrow()); } fn loop_rc(node: Rc<RefCell<Node>>) { println!("addr:{:p}, strong_count:{}, weak_count:{}, v:{}", &(*node.borrow()), Rc::strong_count(&node), Rc::weak_count(&node), node.borrow().v); if let Some(p) = &node.borrow().p { let rc = p.upgrade().unwrap(); { let mut m = rc.borrow_mut(); m.v *= 10; } loop_rc(rc.clone()); } } fn loop_raw(node: &Node) { println!("addr:{:p}, v:{}", &(*node), node.v); if let Some(p) = &node.p { let rc = p.upgrade().unwrap(); { let mut m = rc.borrow_mut(); m.v *= 10; } loop_raw(&rc.borrow()); } }
use petgraph::{Graph, Directed}; use petgraph::graph::NodeIndex; use super::super::graph::{Node, Edge}; fn segment( graph: &Graph<Node, Edge, Directed>, h1: &Vec<NodeIndex>, ) -> (Vec<(NodeIndex, NodeIndex)>, Vec<(NodeIndex, NodeIndex)>) { let mut inner = vec![]; let mut outer = vec![]; for u in h1 { for v in graph.neighbors(*u) { if graph[*u].dummy && graph[v].dummy { inner.push((*u, v)); } else { outer.push((*u, v)); } } } (inner, outer) } pub fn mark_conflicts(graph: &mut Graph<Node, Edge, Directed>, layers: &Vec<Vec<NodeIndex>>) { for i in 1..(layers.len() - 1) { let h1 = layers.get(i).unwrap(); let (inner, outer) = segment(graph, &h1); for (u1, v1) in inner { for &(u2, v2) in &outer { let ou1 = graph[u1].order; let ou2 = graph[u2].order; let ov1 = graph[v1].order; let ov2 = graph[v2].order; if (ou1 < ou2 && ov1 > ov2) || (ou1 > ou2 && ov1 < ov2) { let index = graph.find_edge(u2, v2).unwrap(); graph[index].conflict = true; } } } } } #[cfg(test)] mod tests { use petgraph::Graph; use super::*; use super::super::super::graph::{Node, Edge}; #[test] fn test_mark_conflicts() { let mut graph = Graph::new(); let a1 = graph.add_node(Node { width: 10, order: 0, dummy: false, ..Node::new() }); let a2 = graph.add_node(Node { width: 10, order: 1, dummy: false, ..Node::new() }); let b1 = graph.add_node(Node { width: 10, order: 0, dummy: false, ..Node::new() }); let b2 = graph.add_node(Node { width: 10, order: 1, dummy: false, ..Node::new() }); let b3 = graph.add_node(Node { width: 10, order: 2, dummy: true, ..Node::new() }); let b4 = graph.add_node(Node { width: 10, order: 3, dummy: false, ..Node::new() }); let b5 = graph.add_node(Node { width: 10, order: 4, dummy: true, ..Node::new() }); let b6 = graph.add_node(Node { width: 10, order: 5, dummy: true, ..Node::new() }); let b7 = graph.add_node(Node { width: 10, order: 6, dummy: false, ..Node::new() }); let b8 = graph.add_node(Node { width: 10, order: 7, dummy: false, ..Node::new() }); let c1 = graph.add_node(Node { width: 10, order: 0, dummy: false, ..Node::new() }); let c2 = graph.add_node(Node { width: 10, order: 1, dummy: false, ..Node::new() }); let c3 = graph.add_node(Node { width: 10, order: 2, dummy: true, ..Node::new() }); let c4 = graph.add_node(Node { width: 10, order: 3, dummy: true, ..Node::new() }); let c5 = graph.add_node(Node { width: 10, order: 4, dummy: true, ..Node::new() }); let c6 = graph.add_node(Node { width: 10, order: 5, dummy: false, ..Node::new() }); let d1 = graph.add_node(Node { width: 10, order: 0, dummy: false, ..Node::new() }); let d2 = graph.add_node(Node { width: 10, order: 1, dummy: false, ..Node::new() }); let d3 = graph.add_node(Node { width: 10, order: 2, dummy: true, ..Node::new() }); let d4 = graph.add_node(Node { width: 10, order: 3, dummy: true, ..Node::new() }); let d5 = graph.add_node(Node { width: 10, order: 4, dummy: true, ..Node::new() }); let d6 = graph.add_node(Node { width: 10, order: 5, dummy: false, ..Node::new() }); let d7 = graph.add_node(Node { width: 10, order: 6, dummy: true, ..Node::new() }); let e1 = graph.add_node(Node { width: 10, order: 0, dummy: false, ..Node::new() }); let e2 = graph.add_node(Node { width: 10, order: 1, dummy: false, ..Node::new() }); let e3 = graph.add_node(Node { width: 10, order: 2, dummy: false, ..Node::new() }); let a1b1 = graph.add_edge(a1, b1, Edge::new()); let a1b6 = graph.add_edge(a1, b6, Edge::new()); let a1b8 = graph.add_edge(a1, b8, Edge::new()); let a2b3 = graph.add_edge(a2, b3, Edge::new()); let a2b5 = graph.add_edge(a2, b5, Edge::new()); let b2c2 = graph.add_edge(b2, c2, Edge::new()); let b3c2 = graph.add_edge(b3, c2, Edge::new()); let b4c2 = graph.add_edge(b4, c2, Edge::new()); let b5c3 = graph.add_edge(b5, c3, Edge::new()); let b6c4 = graph.add_edge(b6, c4, Edge::new()); let b7c2 = graph.add_edge(b7, c2, Edge::new()); let b7c6 = graph.add_edge(b7, c6, Edge::new()); let b8c2 = graph.add_edge(b8, c2, Edge::new()); let b8c5 = graph.add_edge(b8, c5, Edge::new()); let c1d1 = graph.add_edge(c1, d1, Edge::new()); let c1d2 = graph.add_edge(c1, d2, Edge::new()); let c1d6 = graph.add_edge(c1, d6, Edge::new()); let c3d4 = graph.add_edge(c3, d4, Edge::new()); let c4d5 = graph.add_edge(c4, d5, Edge::new()); let c5d6 = graph.add_edge(c5, d6, Edge::new()); let c6d3 = graph.add_edge(c6, d3, Edge::new()); let c6d7 = graph.add_edge(c6, d7, Edge::new()); let d1e1 = graph.add_edge(d1, e1, Edge::new()); let d1e2 = graph.add_edge(d1, e2, Edge::new()); let d2e2 = graph.add_edge(d2, e2, Edge::new()); let d3e1 = graph.add_edge(d3, e1, Edge::new()); let d4e3 = graph.add_edge(d4, e3, Edge::new()); let d5e3 = graph.add_edge(d5, e3, Edge::new()); let d6e3 = graph.add_edge(d6, e3, Edge::new()); let d7e3 = graph.add_edge(d7, e3, Edge::new()); let layers = vec![ vec![a1, a2], vec![b1, b2, b3, b4, b5, b6, b7, b8], vec![c1, c2, c3, c4, c5, c6], vec![d1, d2, d3, d4, d5, d6, d7], vec![e1, e2, e3], ]; mark_conflicts(&mut graph, &layers); assert!(!graph[a1b1].conflict); assert!(!graph[a1b6].conflict); assert!(!graph[a1b8].conflict); assert!(!graph[a2b3].conflict); assert!(!graph[a2b5].conflict); assert!(!graph[b2c2].conflict); assert!(!graph[b3c2].conflict); assert!(!graph[b4c2].conflict); assert!(!graph[b5c3].conflict); assert!(!graph[b6c4].conflict); assert!(graph[b7c2].conflict); assert!(!graph[b7c6].conflict); assert!(graph[b8c2].conflict); assert!(!graph[b8c5].conflict); assert!(!graph[c1d1].conflict); assert!(!graph[c1d2].conflict); assert!(graph[c1d6].conflict); assert!(!graph[c3d4].conflict); assert!(!graph[c4d5].conflict); assert!(!graph[c5d6].conflict); assert!(graph[c6d3].conflict); assert!(!graph[c6d7].conflict); assert!(!graph[d1e1].conflict); assert!(!graph[d1e2].conflict); assert!(!graph[d2e2].conflict); assert!(!graph[d3e1].conflict); assert!(!graph[d4e3].conflict); assert!(!graph[d5e3].conflict); assert!(!graph[d6e3].conflict); assert!(!graph[d7e3].conflict); } }
use gl::types::*; use super::{Primitive, Buffer, BufferData, BufferAcces, BufferType, Format}; use crate::get_value; use anyhow::{Result, bail}; use std::collections::HashMap; type AttributePoint = (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint); pub struct Vao { id: GLuint, format: Format, bindings: HashMap<GLuint, Vec<AttributePoint>>, location_count: GLuint } impl Vao { pub fn new(format: Format, locations: GLuint) -> Vao { let id = get_value(0, |id| unsafe { gl::GenVertexArrays(1, id); }); let vao = Vao { id, format: format, bindings: HashMap::new(), location_count: locations }; vao.bind(); for i in 0..locations { unsafe { gl::EnableVertexAttribArray(i as GLuint); } } vao } pub fn bind(&self) { unsafe { gl::BindVertexArray(self.id); } } pub fn bind_vbo<T, Kind, Acces>( &mut self, location: GLuint, vbo: &mut Buffer<T, Kind, Acces> ) -> Result<Option<GLuint>> where T: Sized + BufferData, Kind: BufferType, Acces: BufferAcces { let mut bound = false; // Check if the buffer is already bound if let Some(bindings) = self.bindings.get(&vbo.id()) { bound = bindings.len() == 0 || bindings[0].0 != location; if bound { // If it is apply the binding self.rebind_vbo(vbo, bindings); } } // If it is not create a new binding and apply it if !bound { // Generate binding let prototype = T::prototype(); let bindings = self.generate_binding( std::mem::size_of::<T>() as GLuint, location, prototype )?; // Apply binding self.rebind_vbo(vbo, &bindings); let bindings_len = bindings.len(); self.bindings.insert(vbo.id(), bindings); // Return the index of the next location Ok(Some(location + bindings_len as GLuint)) }else { Ok(None) } } fn rebind_vbo<T, Kind, Acces>( &self, vbo: &mut Buffer<T, Kind, Acces>, bindings: &Vec<AttributePoint> ) where T: Sized + BufferData, Kind: BufferType, Acces: BufferAcces { // set vao and vbo as active self.bind(); vbo.bind(); for (location, size, ty, norm, stride, offset) in bindings { unsafe { gl::VertexAttribPointer( *location, *size, *ty, *norm, *stride, *offset as *const GLvoid, ); } } } pub fn generate_binding( &mut self, object_size: GLuint, location: GLuint, prototype: Vec<(Primitive, GLuint)> ) -> Result<Vec<AttributePoint>> { // Check prototype size let prototype_len = prototype.iter().fold(0, |acc, (ty, count)| acc + ty.size() * count); if object_size != prototype_len { bail!("Invalid prototype size of {} on object of size {}", prototype_len, object_size); } // Keep track of offset between parameters let mut offset: GLuint = 0; let mut bindings = Vec::new(); for (id, (ty, count)) in prototype.iter().enumerate() { if (id as GLuint) + location > self.location_count { bail!("Ran out of shader variable location had {} but was making {}", self.location_count, (id as GLuint) + location); } match ty { Primitive::Nothing => (), _ => { bindings.push(( (id as GLuint) + location, *count as GLint, ty.value(), gl::FALSE, prototype_len as gl::types::GLint, offset )); } }; offset += ty.size() * count; } Ok(bindings) } pub fn draw_arrays(&mut self, i0: GLuint, len: GLuint) { unsafe { gl::DrawArrays( self.format.value(), i0 as GLint, len as GLint, ); } } pub fn draw_elements(&mut self, len: GLuint, ty: Primitive, i0: GLuint) { unsafe { gl::DrawElements( self.format.value(), len as GLint, ty.value(), i0 as *const GLvoid, ); } } } impl Drop for Vao { fn drop(&mut self) { unsafe { gl::DeleteVertexArrays(1, &self.id); } } }
// 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 argh::FromArgs; use failure::{Error, ResultExt}; use fidl_fidl_examples_echo::EchoServiceMarker; use fuchsia_async as fasync; use fuchsia_component::client::{launch, launcher}; // [START main] #[fasync::run_singlethreaded] async fn main() -> Result<(), Error> { #[allow(dead_code)] // FIXME(cramertj) this shouldn't be required #[derive(FromArgs, Debug)] /// Rust echo client struct Opt { /// URL of the echo server to run. #[argh( option, long = "server", default = "\"fuchsia-pkg://fuchsia.com/echo_server_rust#meta/echo_server_rust.cmx\"\ .to_string()" )] server_url: String, } // Launch the server and connect to the echo service. let Opt { server_url } = argh::from_env(); let launcher = launcher().context("Failed to open launcher service")?; let app = launch(&launcher, server_url, None).context("Failed to launch echo service")?; let echo = app .connect_to_unified_service::<EchoServiceMarker>() .context("Failed to connect to echo service")?; let foo = echo.foo().context("failed to connect to foo member")?; let res = foo.echo_string(Some("hello world!")).await?; println!("response: {:?}", res); Ok(()) } // [END main]
fn main() { let array: [u8; config::DIMENSION] = [config::NUMBER; config::DIMENSION]; println!("{:#?}", array); }
use clap::ArgMatches; use solana_clap_utils::{input_parsers::pubkey_of_signer, keypair::pubkey_from_path}; use solana_cli_output::OutputFormat; use solana_client::rpc_client::RpcClient; use solana_remote_wallet::remote_wallet::RemoteWalletManager; use solana_sdk::pubkey::Pubkey; use std::{process::exit, sync::Arc}; pub struct Config { pub rpc_client: RpcClient, pub(crate) output_format: OutputFormat, pub fee_payer: Pubkey, pub default_keypair_path: String, pub dry_run: bool, } impl Config { // Checks if an explicit address was provided, otherwise return the default address. pub(crate) fn pubkey_or_default( &self, arg_matches: &ArgMatches, address_name: &str, wallet_manager: &mut Option<Arc<RemoteWalletManager>>, ) -> Pubkey { if address_name != "owner" { if let Some(address) = pubkey_of_signer(arg_matches, address_name, wallet_manager).unwrap() { return address; } } return self .default_address(arg_matches, wallet_manager) .unwrap_or_else(|e| { eprintln!("error: {}", e); exit(1); }); } fn default_address( &self, matches: &ArgMatches, wallet_manager: &mut Option<Arc<RemoteWalletManager>>, ) -> Result<Pubkey, Box<dyn std::error::Error>> { // for backwards compatibility, check owner before cli config default if let Some(address) = pubkey_of_signer(matches, "owner", wallet_manager).unwrap() { return Ok(address); } let path = &self.default_keypair_path; pubkey_from_path(matches, path, "default", wallet_manager) } }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qtoolbox.h // dst-file: /src/widgets/qtoolbox.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::qframe::*; // 773 use std::ops::Deref; use super::qwidget::*; // 773 use super::super::core::qstring::*; // 771 use super::super::gui::qicon::*; // 771 use super::super::core::qobjectdefs::*; // 771 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QToolBox_Class_Size() -> c_int; // proto: void QToolBox::removeItem(int index); fn C_ZN8QToolBox10removeItemEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QToolBox::insertItem(int index, QWidget * widget, const QString & text); fn C_ZN8QToolBox10insertItemEiP7QWidgetRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void, arg2: *mut c_void) -> c_int; // proto: QString QToolBox::itemText(int index); fn C_ZNK8QToolBox8itemTextEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: int QToolBox::indexOf(QWidget * widget); fn C_ZNK8QToolBox7indexOfEP7QWidget(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QString QToolBox::itemToolTip(int index); fn C_ZNK8QToolBox11itemToolTipEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QToolBox::setCurrentWidget(QWidget * widget); fn C_ZN8QToolBox16setCurrentWidgetEP7QWidget(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QToolBox::setCurrentIndex(int index); fn C_ZN8QToolBox15setCurrentIndexEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QToolBox::setItemIcon(int index, const QIcon & icon); fn C_ZN8QToolBox11setItemIconEiRK5QIcon(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: void QToolBox::setItemText(int index, const QString & text); fn C_ZN8QToolBox11setItemTextEiRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: int QToolBox::count(); fn C_ZNK8QToolBox5countEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: const QMetaObject * QToolBox::metaObject(); fn C_ZNK8QToolBox10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QWidget * QToolBox::widget(int index); fn C_ZNK8QToolBox6widgetEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QToolBox::setItemToolTip(int index, const QString & toolTip); fn C_ZN8QToolBox14setItemToolTipEiRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: int QToolBox::currentIndex(); fn C_ZNK8QToolBox12currentIndexEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QWidget * QToolBox::currentWidget(); fn C_ZNK8QToolBox13currentWidgetEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QToolBox::addItem(QWidget * widget, const QString & text); fn C_ZN8QToolBox7addItemEP7QWidgetRK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> c_int; // proto: bool QToolBox::isItemEnabled(int index); fn C_ZNK8QToolBox13isItemEnabledEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_char; // proto: void QToolBox::setItemEnabled(int index, bool enabled); fn C_ZN8QToolBox14setItemEnabledEib(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_char); // proto: QIcon QToolBox::itemIcon(int index); fn C_ZNK8QToolBox8itemIconEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QToolBox::~QToolBox(); fn C_ZN8QToolBoxD2Ev(qthis: u64 /* *mut c_void*/); // proto: int QToolBox::addItem(QWidget * widget, const QIcon & icon, const QString & text); fn C_ZN8QToolBox7addItemEP7QWidgetRK5QIconRK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void) -> c_int; // proto: int QToolBox::insertItem(int index, QWidget * widget, const QIcon & icon, const QString & text); fn C_ZN8QToolBox10insertItemEiP7QWidgetRK5QIconRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void, arg2: *mut c_void, arg3: *mut c_void) -> c_int; fn QToolBox_SlotProxy_connect__ZN8QToolBox14currentChangedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); } // <= ext block end // body block begin => // class sizeof(QToolBox)=1 #[derive(Default)] pub struct QToolBox { qbase: QFrame, pub qclsinst: u64 /* *mut c_void*/, pub _currentChanged: QToolBox_currentChanged_signal, } impl /*struct*/ QToolBox { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QToolBox { return QToolBox{qbase: QFrame::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; } } impl Deref for QToolBox { type Target = QFrame; fn deref(&self) -> &QFrame { return & self.qbase; } } impl AsRef<QFrame> for QToolBox { fn as_ref(& self) -> & QFrame { return & self.qbase; } } // proto: void QToolBox::removeItem(int index); impl /*struct*/ QToolBox { pub fn removeItem<RetType, T: QToolBox_removeItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeItem(self); // return 1; } } pub trait QToolBox_removeItem<RetType> { fn removeItem(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::removeItem(int index); impl<'a> /*trait*/ QToolBox_removeItem<()> for (i32) { fn removeItem(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox10removeItemEi()}; let arg0 = self as c_int; unsafe {C_ZN8QToolBox10removeItemEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QToolBox::insertItem(int index, QWidget * widget, const QString & text); impl /*struct*/ QToolBox { pub fn insertItem<RetType, T: QToolBox_insertItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertItem(self); // return 1; } } pub trait QToolBox_insertItem<RetType> { fn insertItem(self , rsthis: & QToolBox) -> RetType; } // proto: int QToolBox::insertItem(int index, QWidget * widget, const QString & text); impl<'a> /*trait*/ QToolBox_insertItem<i32> for (i32, &'a QWidget, &'a QString) { fn insertItem(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox10insertItemEiP7QWidgetRK7QString()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN8QToolBox10insertItemEiP7QWidgetRK7QString(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i32; // 1 // return 1; } } // proto: QString QToolBox::itemText(int index); impl /*struct*/ QToolBox { pub fn itemText<RetType, T: QToolBox_itemText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemText(self); // return 1; } } pub trait QToolBox_itemText<RetType> { fn itemText(self , rsthis: & QToolBox) -> RetType; } // proto: QString QToolBox::itemText(int index); impl<'a> /*trait*/ QToolBox_itemText<QString> for (i32) { fn itemText(self , rsthis: & QToolBox) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox8itemTextEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK8QToolBox8itemTextEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QToolBox::indexOf(QWidget * widget); impl /*struct*/ QToolBox { pub fn indexOf<RetType, T: QToolBox_indexOf<RetType>>(& self, overload_args: T) -> RetType { return overload_args.indexOf(self); // return 1; } } pub trait QToolBox_indexOf<RetType> { fn indexOf(self , rsthis: & QToolBox) -> RetType; } // proto: int QToolBox::indexOf(QWidget * widget); impl<'a> /*trait*/ QToolBox_indexOf<i32> for (&'a QWidget) { fn indexOf(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox7indexOfEP7QWidget()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK8QToolBox7indexOfEP7QWidget(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QString QToolBox::itemToolTip(int index); impl /*struct*/ QToolBox { pub fn itemToolTip<RetType, T: QToolBox_itemToolTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemToolTip(self); // return 1; } } pub trait QToolBox_itemToolTip<RetType> { fn itemToolTip(self , rsthis: & QToolBox) -> RetType; } // proto: QString QToolBox::itemToolTip(int index); impl<'a> /*trait*/ QToolBox_itemToolTip<QString> for (i32) { fn itemToolTip(self , rsthis: & QToolBox) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox11itemToolTipEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK8QToolBox11itemToolTipEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QToolBox::setCurrentWidget(QWidget * widget); impl /*struct*/ QToolBox { pub fn setCurrentWidget<RetType, T: QToolBox_setCurrentWidget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCurrentWidget(self); // return 1; } } pub trait QToolBox_setCurrentWidget<RetType> { fn setCurrentWidget(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::setCurrentWidget(QWidget * widget); impl<'a> /*trait*/ QToolBox_setCurrentWidget<()> for (&'a QWidget) { fn setCurrentWidget(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox16setCurrentWidgetEP7QWidget()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN8QToolBox16setCurrentWidgetEP7QWidget(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QToolBox::setCurrentIndex(int index); impl /*struct*/ QToolBox { pub fn setCurrentIndex<RetType, T: QToolBox_setCurrentIndex<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCurrentIndex(self); // return 1; } } pub trait QToolBox_setCurrentIndex<RetType> { fn setCurrentIndex(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::setCurrentIndex(int index); impl<'a> /*trait*/ QToolBox_setCurrentIndex<()> for (i32) { fn setCurrentIndex(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox15setCurrentIndexEi()}; let arg0 = self as c_int; unsafe {C_ZN8QToolBox15setCurrentIndexEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QToolBox::setItemIcon(int index, const QIcon & icon); impl /*struct*/ QToolBox { pub fn setItemIcon<RetType, T: QToolBox_setItemIcon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemIcon(self); // return 1; } } pub trait QToolBox_setItemIcon<RetType> { fn setItemIcon(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::setItemIcon(int index, const QIcon & icon); impl<'a> /*trait*/ QToolBox_setItemIcon<()> for (i32, &'a QIcon) { fn setItemIcon(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox11setItemIconEiRK5QIcon()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN8QToolBox11setItemIconEiRK5QIcon(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QToolBox::setItemText(int index, const QString & text); impl /*struct*/ QToolBox { pub fn setItemText<RetType, T: QToolBox_setItemText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemText(self); // return 1; } } pub trait QToolBox_setItemText<RetType> { fn setItemText(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::setItemText(int index, const QString & text); impl<'a> /*trait*/ QToolBox_setItemText<()> for (i32, &'a QString) { fn setItemText(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox11setItemTextEiRK7QString()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN8QToolBox11setItemTextEiRK7QString(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: int QToolBox::count(); impl /*struct*/ QToolBox { pub fn count<RetType, T: QToolBox_count<RetType>>(& self, overload_args: T) -> RetType { return overload_args.count(self); // return 1; } } pub trait QToolBox_count<RetType> { fn count(self , rsthis: & QToolBox) -> RetType; } // proto: int QToolBox::count(); impl<'a> /*trait*/ QToolBox_count<i32> for () { fn count(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox5countEv()}; let mut ret = unsafe {C_ZNK8QToolBox5countEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: const QMetaObject * QToolBox::metaObject(); impl /*struct*/ QToolBox { pub fn metaObject<RetType, T: QToolBox_metaObject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.metaObject(self); // return 1; } } pub trait QToolBox_metaObject<RetType> { fn metaObject(self , rsthis: & QToolBox) -> RetType; } // proto: const QMetaObject * QToolBox::metaObject(); impl<'a> /*trait*/ QToolBox_metaObject<QMetaObject> for () { fn metaObject(self , rsthis: & QToolBox) -> QMetaObject { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox10metaObjectEv()}; let mut ret = unsafe {C_ZNK8QToolBox10metaObjectEv(rsthis.qclsinst)}; let mut ret1 = QMetaObject::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QWidget * QToolBox::widget(int index); impl /*struct*/ QToolBox { pub fn widget<RetType, T: QToolBox_widget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.widget(self); // return 1; } } pub trait QToolBox_widget<RetType> { fn widget(self , rsthis: & QToolBox) -> RetType; } // proto: QWidget * QToolBox::widget(int index); impl<'a> /*trait*/ QToolBox_widget<QWidget> for (i32) { fn widget(self , rsthis: & QToolBox) -> QWidget { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox6widgetEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK8QToolBox6widgetEi(rsthis.qclsinst, arg0)}; let mut ret1 = QWidget::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QToolBox::setItemToolTip(int index, const QString & toolTip); impl /*struct*/ QToolBox { pub fn setItemToolTip<RetType, T: QToolBox_setItemToolTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemToolTip(self); // return 1; } } pub trait QToolBox_setItemToolTip<RetType> { fn setItemToolTip(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::setItemToolTip(int index, const QString & toolTip); impl<'a> /*trait*/ QToolBox_setItemToolTip<()> for (i32, &'a QString) { fn setItemToolTip(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox14setItemToolTipEiRK7QString()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN8QToolBox14setItemToolTipEiRK7QString(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: int QToolBox::currentIndex(); impl /*struct*/ QToolBox { pub fn currentIndex<RetType, T: QToolBox_currentIndex<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentIndex(self); // return 1; } } pub trait QToolBox_currentIndex<RetType> { fn currentIndex(self , rsthis: & QToolBox) -> RetType; } // proto: int QToolBox::currentIndex(); impl<'a> /*trait*/ QToolBox_currentIndex<i32> for () { fn currentIndex(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox12currentIndexEv()}; let mut ret = unsafe {C_ZNK8QToolBox12currentIndexEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QWidget * QToolBox::currentWidget(); impl /*struct*/ QToolBox { pub fn currentWidget<RetType, T: QToolBox_currentWidget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentWidget(self); // return 1; } } pub trait QToolBox_currentWidget<RetType> { fn currentWidget(self , rsthis: & QToolBox) -> RetType; } // proto: QWidget * QToolBox::currentWidget(); impl<'a> /*trait*/ QToolBox_currentWidget<QWidget> for () { fn currentWidget(self , rsthis: & QToolBox) -> QWidget { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox13currentWidgetEv()}; let mut ret = unsafe {C_ZNK8QToolBox13currentWidgetEv(rsthis.qclsinst)}; let mut ret1 = QWidget::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QToolBox::addItem(QWidget * widget, const QString & text); impl /*struct*/ QToolBox { pub fn addItem<RetType, T: QToolBox_addItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.addItem(self); // return 1; } } pub trait QToolBox_addItem<RetType> { fn addItem(self , rsthis: & QToolBox) -> RetType; } // proto: int QToolBox::addItem(QWidget * widget, const QString & text); impl<'a> /*trait*/ QToolBox_addItem<i32> for (&'a QWidget, &'a QString) { fn addItem(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox7addItemEP7QWidgetRK7QString()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN8QToolBox7addItemEP7QWidgetRK7QString(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: bool QToolBox::isItemEnabled(int index); impl /*struct*/ QToolBox { pub fn isItemEnabled<RetType, T: QToolBox_isItemEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isItemEnabled(self); // return 1; } } pub trait QToolBox_isItemEnabled<RetType> { fn isItemEnabled(self , rsthis: & QToolBox) -> RetType; } // proto: bool QToolBox::isItemEnabled(int index); impl<'a> /*trait*/ QToolBox_isItemEnabled<i8> for (i32) { fn isItemEnabled(self , rsthis: & QToolBox) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox13isItemEnabledEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK8QToolBox13isItemEnabledEi(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: void QToolBox::setItemEnabled(int index, bool enabled); impl /*struct*/ QToolBox { pub fn setItemEnabled<RetType, T: QToolBox_setItemEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemEnabled(self); // return 1; } } pub trait QToolBox_setItemEnabled<RetType> { fn setItemEnabled(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::setItemEnabled(int index, bool enabled); impl<'a> /*trait*/ QToolBox_setItemEnabled<()> for (i32, i8) { fn setItemEnabled(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox14setItemEnabledEib()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_char; unsafe {C_ZN8QToolBox14setItemEnabledEib(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QIcon QToolBox::itemIcon(int index); impl /*struct*/ QToolBox { pub fn itemIcon<RetType, T: QToolBox_itemIcon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemIcon(self); // return 1; } } pub trait QToolBox_itemIcon<RetType> { fn itemIcon(self , rsthis: & QToolBox) -> RetType; } // proto: QIcon QToolBox::itemIcon(int index); impl<'a> /*trait*/ QToolBox_itemIcon<QIcon> for (i32) { fn itemIcon(self , rsthis: & QToolBox) -> QIcon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QToolBox8itemIconEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK8QToolBox8itemIconEi(rsthis.qclsinst, arg0)}; let mut ret1 = QIcon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QToolBox::~QToolBox(); impl /*struct*/ QToolBox { pub fn free<RetType, T: QToolBox_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QToolBox_free<RetType> { fn free(self , rsthis: & QToolBox) -> RetType; } // proto: void QToolBox::~QToolBox(); impl<'a> /*trait*/ QToolBox_free<()> for () { fn free(self , rsthis: & QToolBox) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBoxD2Ev()}; unsafe {C_ZN8QToolBoxD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: int QToolBox::addItem(QWidget * widget, const QIcon & icon, const QString & text); impl<'a> /*trait*/ QToolBox_addItem<i32> for (&'a QWidget, &'a QIcon, &'a QString) { fn addItem(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox7addItemEP7QWidgetRK5QIconRK7QString()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN8QToolBox7addItemEP7QWidgetRK5QIconRK7QString(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i32; // 1 // return 1; } } // proto: int QToolBox::insertItem(int index, QWidget * widget, const QIcon & icon, const QString & text); impl<'a> /*trait*/ QToolBox_insertItem<i32> for (i32, &'a QWidget, &'a QIcon, &'a QString) { fn insertItem(self , rsthis: & QToolBox) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QToolBox10insertItemEiP7QWidgetRK5QIconRK7QString()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = self.3.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN8QToolBox10insertItemEiP7QWidgetRK5QIconRK7QString(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; return ret as i32; // 1 // return 1; } } #[derive(Default)] // for QToolBox_currentChanged pub struct QToolBox_currentChanged_signal{poi:u64} impl /* struct */ QToolBox { pub fn currentChanged(&self) -> QToolBox_currentChanged_signal { return QToolBox_currentChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QToolBox_currentChanged_signal { pub fn connect<T: QToolBox_currentChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QToolBox_currentChanged_signal_connect { fn connect(self, sigthis: QToolBox_currentChanged_signal); } // currentChanged(int) extern fn QToolBox_currentChanged_signal_connect_cb_0(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QToolBox_currentChanged_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QToolBox_currentChanged_signal_connect for fn(i32) { fn connect(self, sigthis: QToolBox_currentChanged_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 = QToolBox_currentChanged_signal_connect_cb_0 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QToolBox_SlotProxy_connect__ZN8QToolBox14currentChangedEi(arg0, arg1, arg2)}; } } impl /* trait */ QToolBox_currentChanged_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QToolBox_currentChanged_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 = QToolBox_currentChanged_signal_connect_cb_box_0 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QToolBox_SlotProxy_connect__ZN8QToolBox14currentChangedEi(arg0, arg1, arg2)}; } } // <= body block end
use openidconnect::{core, EndUserName, EndUserUsername, LocalizedClaim}; use rocket::{ http::{Cookie, Status}, request::{self, FromRequest, Outcome, Request}, State, }; use crate::{ application::{OidcApplication, OidcSessionCookie}, errors::IdTokenError, }; /// Rocket request guard for OpenID Connect authentication. /// /// Provides basic information about the authenticated user. This guard can be used as a building /// block for more complex request guards requiring authorization information provided by OpenID /// Connect. pub struct OidcUser { pub preferred_username: Option<EndUserUsername>, pub name: Option<LocalizedClaim<EndUserName>>, } impl OidcUser { fn load_from_session( oidc: &OidcApplication, oidc_session: &OidcSessionCookie, ) -> Result<OidcUser, IdTokenError> { let id_token_verifier: core::CoreIdTokenVerifier = oidc.client.id_token_verifier(); match &oidc_session.id_token { Some(id_token) => { let id_token_claims = id_token .claims(&id_token_verifier, &oidc.nonce) .map_err(|_| IdTokenError::InvalidIdTokenClaim)?; let preferred_username = id_token_claims.preferred_username().cloned(); let name = id_token_claims.name().cloned(); Ok(OidcUser { preferred_username, name, }) } None => Err(IdTokenError::MissingIdToken), } } /// Retrieve the default-language name for this user. /// /// OpenID Connect provides a mapping of language to full name for users; while comprehensive, /// this approach can be overly complicated for many applications. This function provides /// simpler access to the `None`-language name. pub fn name(&self) -> Option<String> { match &self.name { Some(name_map) => name_map.get(None).map(|name| name.as_str().to_owned()), None => None, } } } #[rocket::async_trait] impl<'r> FromRequest<'r> for OidcUser { type Error = (); async fn from_request(request: &'r Request<'_>) -> request::Outcome<Self, Self::Error> { let cookies = request.cookies(); match cookies.get_private("oidc_user_session") { Some(serialized_session) => { match serde_json::from_str::<OidcSessionCookie>(serialized_session.value()) { Ok(oidc_session) => { let oidc = request .guard::<&State<OidcApplication>>() .await .unwrap() .inner(); match OidcUser::load_from_session(oidc, &oidc_session) { Ok(user) => Outcome::Success(user), Err(_) => { cookies.remove_private(serialized_session); Outcome::Failure((Status::UnprocessableEntity, ())) } } } Err(_) => { cookies.remove_private(serialized_session); cookies.add_private(Cookie::new( "oidc_redirect_destination", request.uri().to_string(), )); Outcome::Forward(()) } } } None => { cookies.add_private(Cookie::new( "oidc_redirect_destination", request.uri().to_string(), )); Outcome::Forward(()) } } } }
// 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 } } fn from_vec(v: Vec<i32>) -> Option<Box<Self>> { let mut n = None; for x in v.iter().rev() { n = Some(Box::new(ListNode { val: *x, next: n } )); } n } } trait ToVec { fn to_vec(&self) -> Vec<i32>; } impl ToVec for Option<Box<ListNode>> { fn to_vec(&self) -> Vec<i32> { let mut res = Vec::new(); let mut n = self; while let Some(v) = n { res.push(v.val); n = &v.next; } res } } struct Solution; impl Solution { pub fn add_two_numbers( l1: Option<Box<ListNode>>, l2: Option<Box<ListNode>> ) -> Option<Box<ListNode>> { Self::merge_two(l1, l2, 0) } fn merge_two( l1: Option<Box<ListNode>>, l2: Option<Box<ListNode>>, carry: i32 ) -> Option<Box<ListNode>> { Some(Box::new(match (l1, l2) { (Some(a), Some(b)) => { let sum = a.val + b.val + carry; ListNode { val: sum % 10, next: Self::merge_two(a.next, b.next, sum / 10) } }, (Some(v), None) | (None, Some(v)) => { let sum = v.val + carry; ListNode { val: sum % 10, next: Self::merge_two(v.next, None, sum / 10) } }, _ if carry > 0 => ListNode::new(carry), _ => return None, })) } } #[cfg(test)] mod tests { use super::*; fn helper(v1: Vec<i32>, v2: Vec<i32>, want: Vec<i32>) { let l1 = ListNode::from_vec(v1.clone()); let l2 = ListNode::from_vec(v2.clone()); let got = Solution::add_two_numbers(l1, l2).to_vec(); eprintln!("got add_two_numbers({:?}, {:?}) = {:?}, want {:?}", v1, v2, got, want); assert_eq!(got, want); } #[test] fn test_add_two_numbers_example_1() { helper(vec![2, 4, 3], vec![5, 6, 4], vec![7, 0, 8]); } #[test] fn test_add_two_numbers_example_2() { helper(vec![0], vec![0], vec![0]); } #[test] fn test_add_two_numbers_example_3() { helper(vec![9, 9, 9, 9, 9, 9, 9], vec![9, 9, 9, 9], vec![8, 9, 9, 9, 0, 0, 0, 1]); } }
use std::clone::Clone; use super::wrapping_number::{sequence_greater_than, sequence_less_than}; /// Used to index packets that have been sent & received pub type SequenceNumber = u16; /// Collection to store data of any kind. #[derive(Debug)] pub struct SequenceBuffer<T: Clone> { sequence_num: SequenceNumber, entry_sequences: Box<[Option<SequenceNumber>]>, entries: Box<[Option<T>]>, } impl<T: Clone> SequenceBuffer<T> { /// Creates a SequenceBuffer with a desired capacity. pub fn with_capacity(size: u16) -> Self { Self { sequence_num: 0, entry_sequences: vec![None; size as usize].into_boxed_slice(), entries: vec![None; size as usize].into_boxed_slice(), } } /// Returns the most recently stored sequence number. pub fn sequence_num(&self) -> SequenceNumber { self.sequence_num } /// Returns a mutable reference to the entry with the given sequence number. pub fn get_mut(&mut self, sequence_num: SequenceNumber) -> Option<&mut T> { if self.exists(sequence_num) { let index = self.index(sequence_num); return self.entries[index].as_mut(); } None } /// Returns a reference to the entry with the given sequence number. pub fn get(&self, sequence_num: SequenceNumber) -> Option<&T> { if self.exists(sequence_num) { let index = self.index(sequence_num); return self.entries[index].as_ref(); } None } /// Inserts the entry data into the sequence buffer. If the requested /// sequence number is "too old", the entry will not be inserted and will /// return false pub fn insert(&mut self, sequence_num: SequenceNumber, entry: T) -> bool { // sequence number is too old to insert into the buffer if sequence_less_than( sequence_num, self.sequence_num .wrapping_sub(self.entry_sequences.len() as u16), ) { return false; } self.advance_sequence(sequence_num); let index = self.index(sequence_num); self.entry_sequences[index] = Some(sequence_num); self.entries[index] = Some(entry); return true; } /// Returns whether or not we have previously inserted an entry for the /// given sequence number. pub fn exists(&self, sequence_num: SequenceNumber) -> bool { let index = self.index(sequence_num); if let Some(s) = self.entry_sequences[index] { return s == sequence_num; } false } /// Removes an entry from the sequence buffer pub fn remove(&mut self, sequence_num: SequenceNumber) -> Option<T> { if self.exists(sequence_num) { let index = self.index(sequence_num); let value = std::mem::replace(&mut self.entries[index], None); self.entry_sequences[index] = None; return value; } None } // Advances the sequence number while removing older entries. fn advance_sequence(&mut self, sequence_num: SequenceNumber) { if sequence_greater_than(sequence_num.wrapping_add(1), self.sequence_num) { self.remove_entries(u32::from(sequence_num)); self.sequence_num = sequence_num.wrapping_add(1); } } fn remove_entries(&mut self, mut finish_sequence: u32) { let start_sequence = u32::from(self.sequence_num); if finish_sequence < start_sequence { finish_sequence += 65536; } if finish_sequence - start_sequence < self.entry_sequences.len() as u32 { for sequence in start_sequence..=finish_sequence { self.remove(sequence as u16); } } else { for index in 0..self.entry_sequences.len() { self.entries[index] = None; self.entry_sequences[index] = None; } } } // Generates an index for use in `entry_sequences` and `entries`. fn index(&self, sequence: SequenceNumber) -> usize { sequence as usize % self.entry_sequences.len() } /// Gets the oldest stored sequence number pub fn oldest(&self) -> u16 { return self .sequence_num .wrapping_sub(self.entry_sequences.len() as u16); } /// Clear sequence buffer completely pub fn clear(&mut self) { let size = self.entry_sequences.len(); self.sequence_num = 0; self.entry_sequences = vec![None; size].into_boxed_slice(); self.entries = vec![None; size].into_boxed_slice(); } /// Remove entries up until a specific sequence number pub fn remove_until(&mut self, finish_sequence: u16) { let oldest = self.oldest(); for seq in oldest..finish_sequence { self.remove(seq); } } /// Get a count of entries in the buffer pub fn get_entries_count(&self) -> u8 { let mut count = 0; let mut seq = self.oldest(); loop { if self.exists(seq) { count += 1; } seq = seq.wrapping_add(1); if seq == self.sequence_num { break; } } return count; } /// Get an iterator into the sequence pub fn iter(&self, reverse: bool) -> SequenceIterator<T> { let index = { if reverse { self.sequence_num } else { self.oldest() } }; return SequenceIterator::new(self, index, self.entry_sequences.len(), reverse); } } /// Iterator for a Sequence pub struct SequenceIterator<'s, T> where T: 's + Clone, { buffer: &'s SequenceBuffer<T>, index: u16, count: usize, reverse: bool, } impl<'s, T: Clone> SequenceIterator<'s, T> { /// Create a new iterator for a sequence pub fn new( seq_buf: &'s SequenceBuffer<T>, start: u16, count: usize, reverse: bool, ) -> SequenceIterator<'s, T> { SequenceIterator::<T> { buffer: seq_buf, index: start, count, reverse, } } /// Get next value in the sequence pub fn next(&mut self) -> Option<(SequenceNumber, &'s T)> { loop { if self.count == 0 { return None; } let current_item = self.buffer.get(self.index); let current_index = self.index; if self.reverse { self.index = self.index.wrapping_sub(1); } else { self.index = self.index.wrapping_add(1); } self.count -= 1; if let Some(item) = current_item { return Some((current_index, item)); } } } }
use crate::prelude::*; pub type LineSegment = [Point2; 2]; pub trait LineSegmentExtension { fn length2(&self) -> f32; fn interpolate(&self, progress: NormalizedF32) -> Point2; } impl LineSegmentExtension for LineSegment { fn length2(&self) -> f32 { self[0].distance2(self[1]) } fn interpolate(&self, progress: NormalizedF32) -> Point2 { let inverse_progress = 1.0 - progress; self[0] * inverse_progress + self[1] * progress } }
pub mod ast; pub mod error; pub mod lexer; pub mod parser; pub mod precedence; pub mod token; pub mod token_type;
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!! very unstable, use at your own risk !!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! use super::prelude::*; use std::ops::Fn; #[allow(non_upper_case_globals)] pub const void: () = (); pub struct Callback { function: FunctionType, } impl Callback { pub fn new<F, Args>(function: F) -> Callback where F: Fn(Args) -> (), F: 'static, FunctionType: FunctionTypeCreator<F, Args>, { Callback { function: FunctionType::new(function), } } pub fn execute<Args>(&self, arguments: Args) where FunctionType: FunctionTypeExecutorOneArg<Args>, { display_error!(self.function.execute(arguments)); } } pub trait FunctionTypeCreator<F: Fn(Args) -> () + 'static, Args> { fn new(function: F) -> FunctionType; } pub trait FunctionTypeExecutorOneArg<Args> { fn execute(&self, execute: Args) -> VerboseResult<()>; } macro_rules! build_function_type { ($struct_name: ident, $($ty: ty, $name: ident), *) => { pub enum $struct_name { $($name(Box<dyn Fn($ty)>)),* } $( impl<F: Fn($ty) -> () + 'static> FunctionTypeCreator<F, $ty> for $struct_name { fn new(function: F) -> FunctionType { $struct_name::$name(Box::new(function)) } } impl FunctionTypeExecutorOneArg<$ty> for $struct_name { fn execute(&self, args: $ty) -> VerboseResult<()> { match self { FunctionType::$name(ref function) => { (function)(args); Ok(()) } _ => { create_error!("wrong argument type for this callback"); }, } } } ) * } } #[rustfmt::skip] build_function_type!( FunctionType, String, String, i32, I32, u32, U32, f32, F32, (), Void );
use om_sd::na; use na::{Vector2, Vector3}; use std::fs::File; use std::io::Write; fn steepest_descent_with_both() { let f = |x: Vector2<f64>| x[0].powi(2) + x.norm_squared().exp() + 4.0 * x[0] + 3.0 * x[1]; let grad = |x: Vector2<f64>| Vector2::new( 2.0 * x[0] * (1.0 + x.norm_squared().exp()) + 4.0, 2.0 * x[1] * x.norm_squared().exp() + 3.0, ); let init = Vector2::new(0.0, 0.0); let eps = 1e-4; let search_lam = |f_nextx: &dyn Fn(f64) -> f64| om_gs::search(0.0..1.0, eps, f_nextx); let x = om_sd::search_2d(init, eps, f, grad, search_lam); println!("Steepest descent search"); println!("x : {{{}, {}}}", x[0], x[1]); println!("J1: {}", f(x)); println!(""); let f = |x: Vector3<f64>| x[0].powi(4) + x[1].powi(4) + (x[0] * x[1]).powi(2) + (5.0 + x[1].powi(2) + 2.0 * x[2].powi(2)).sqrt() + x[0] + x[2]; let grad = |x: Vector3<f64>| Vector3::new( 4.0 * x[0].powi(3) + 2.0 * x[0] * x[1].powi(2) + 1.0, 4.0 * x[1].powi(3) + 2.0 * x[0].powi(2) * x[1] + x[1] / (5.0 + x[1].powi(2) + 2.0 * x[2].powi(2)).sqrt(), 2.0 * x[2] / (5.0 + x[1].powi(2) + 2.0 * x[2].powi(2)).sqrt() + 1.0, ); let init = Vector3::new(0.0, 0.0, 0.0); let eps = 1e-4; let search_lam = |f_nextx: &dyn Fn(f64) -> f64| om_gs::search(0.0..1.0, eps, f_nextx); let x = om_sd::search_3d(init, eps, f, grad, search_lam); println!("Steepest descent search"); println!("x : {{{}, {}, {}}}", x[0], x[1], x[2]); println!("J2: {}", f(x)); println!(""); } fn hooke_jeeves_with_both() { let f = |x: Vector2<f64>| x[0].powi(2) + x.norm_squared().exp() + 4.0 * x[0] + 3.0 * x[1]; let init_x = Vector2::new(0.0, 0.0); let init_per = 1.0; let eps = 1e-4; let x = om_hj::search_2d(init_x, init_per, eps, f); println!("Hooke-Jeeves search"); println!("x : {{{}, {}}}", x[0], x[1]); println!("J1: {}", f(x)); println!(""); let f = |x: Vector3<f64>| x[0].powi(4) + x[1].powi(4) + (x[0] * x[1]).powi(2) + (5.0 + x[1].powi(2) + 2.0 * x[2].powi(2)).sqrt() + x[0] + x[2]; let init_x = Vector3::new(0.0, 0.0, 0.0); let init_per = 1.0; let eps = 1e-4; let x = om_hj::search_3d(init_x, init_per, eps, f); println!("Hooke-Jeeves search"); println!("x : {{{}, {}, {}}}", x[0], x[1], x[2]); println!("J2: {}", f(x)); println!(""); } fn main() { steepest_descent_with_both(); hooke_jeeves_with_both(); let f = |x: Vector2<f64>| x[0].powi(2) + x.norm_squared().exp() + 4.0 * x[0] + 3.0 * x[1]; let grad = |x: Vector2<f64>| Vector2::new( 2.0 * x[0] * (1.0 + x.norm_squared().exp()) + 4.0, 2.0 * x[1] * x.norm_squared().exp() + 3.0, ); let init = Vector2::new(0.0, 0.0); let init_per = 1.0; let eps = 1e-4; let search_lam = |f_nextx: &dyn Fn(f64) -> f64| om_gs::search(0.0..1.0, eps, f_nextx); let etalon_x_norm = Vector2::new(-0.6132254270554607f64, -0.6632931929985874).norm(); let mut sd_file = File::create("sd.txt").unwrap(); let mut hj_file = File::create("hj.txt").unwrap(); for n in 1..=300 { let x = om_sd::search_with_n_2d(init, n, f, grad, search_lam); writeln!(&mut sd_file, "{}\t{}", n, (x.norm() - etalon_x_norm).abs()).unwrap(); let x = om_hj::search_with_n_2d(init, init_per, n, f); writeln!(&mut hj_file, "{}", (x.norm() - etalon_x_norm).abs()).unwrap(); } }
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::sync::Arc; use common_exception::Result; use common_expression::Column; use common_expression::DataBlock; use common_expression::DataSchema; use common_expression::DataSchemaRef; use common_formats::field_encoder::FieldEncoderRowBased; use common_formats::field_encoder::FieldEncoderValues; use common_io::prelude::FormatSettings; use serde_json::Value as JsonValue; #[derive(Debug, Clone)] pub struct JsonBlock { pub(crate) data: Vec<Vec<JsonValue>>, pub(crate) schema: DataSchemaRef, } pub type JsonBlockRef = Arc<JsonBlock>; pub fn block_to_json_value( block: &DataBlock, format: &FormatSettings, ) -> Result<Vec<Vec<JsonValue>>> { if block.is_empty() { return Ok(vec![]); } let rows_size = block.num_rows(); let columns: Vec<Column> = block .convert_to_full() .columns() .iter() .map(|column| column.value.clone().into_column().unwrap()) .collect(); let mut res = Vec::new(); let encoder = FieldEncoderValues::create_for_http_handler(format.timezone); let mut buf = vec![]; for row_index in 0..rows_size { let mut row: Vec<JsonValue> = Vec::with_capacity(block.num_columns()); for column in &columns { buf.clear(); encoder.write_field(column, row_index, &mut buf, true); row.push(serde_json::to_value(String::from_utf8_lossy(&buf))?); } res.push(row) } Ok(res) } impl JsonBlock { pub fn empty() -> Self { Self { data: vec![], schema: Arc::new(DataSchema::empty()), } } pub fn new(schema: DataSchemaRef, block: &DataBlock, format: &FormatSettings) -> Result<Self> { Ok(JsonBlock { data: block_to_json_value(block, format)?, schema, }) } pub fn concat(blocks: Vec<JsonBlock>) -> Self { if blocks.is_empty() { return Self::empty(); } let schema = blocks[0].schema.clone(); let results = blocks.into_iter().map(|b| b.data).collect::<Vec<_>>(); let data = results.concat(); Self { data, schema } } pub fn num_rows(&self) -> usize { self.data.len() } pub fn is_empty(&self) -> bool { self.data.is_empty() } pub fn data(&self) -> &Vec<Vec<JsonValue>> { &self.data } pub fn schema(&self) -> &DataSchemaRef { &self.schema } } impl From<JsonBlock> for Vec<Vec<JsonValue>> { fn from(block: JsonBlock) -> Self { block.data } }
/* Project Euler Problem 18: By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: 75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23 Note: As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o) */ use std::cmp; fn main() { let input = "75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23"; let rows = 15; let mut input_bytes = input.chars(); let mut triangle = vec![vec![0; rows]; rows]; for i in 0..rows { for j in 0..i+1 { let x = ((input_bytes.next().unwrap() as i32) - 48)*10 + (input_bytes.next().unwrap() as i32) - 48; triangle[i][j] = x; input_bytes.next(); } } for row in (0..triangle.len()-1).rev() { for j in 0..row+1 { triangle[row][j] += cmp::max(triangle[row+1][j], triangle[row+1][j+1]) } } println!("{:}", triangle[0][0]); }
use timely::dataflow::operators::UnorderedInput; use timely::progress::frontier::AntichainRef; use differential_dataflow::trace::TraceReader; use declarative_dataflow::domain::{AsSingletonDomain, Domain}; use declarative_dataflow::{Aid, Value}; #[test] fn test_advance_epoch() { let mut domain = Domain::<Aid, u64>::new(0); assert_eq!(domain.epoch(), &0); assert!(domain.advance_epoch(1).is_ok()); assert_eq!(domain.epoch(), &1); assert!(domain.advance_epoch(1).is_ok()); assert_eq!(domain.epoch(), &1); assert!(domain.advance_epoch(0).is_err()); assert_eq!(domain.epoch(), &1); } #[test] fn test_advance_only_epoch() { timely::execute_directly(move |worker| { let (domain, _handle, _cap) = worker.dataflow::<u64, _, _>(|scope| { let tx_test: Domain<Aid, u64> = scope .new_unordered_input::<((Value, Value), u64, isize)>() .as_singleton_domain("tx_test") .into(); let ((handle, cap), source) = scope.new_unordered_input::<((Value, Value), u64, isize)>(); let source_test: Domain<Aid, u64> = source.as_singleton_domain("source_test").into(); (tx_test + source_test, handle, cap) }); assert_eq!(domain.probed_source_count(), 1); assert_eq!(domain.epoch(), &0); assert!(!domain.dominates(AntichainRef::new(&[0]))); // tick tx => stalls! // domain.advance_epoch(1).unwrap(); // worker.step_while(|| !domain.dominates(AntichainRef::new(&[0]))); // domain.advance().unwrap(); }); } #[test] fn test_advance_only_source() { timely::execute_directly(move |worker| { let (mut domain, _handle, mut cap): (Domain<Aid, u64>, _, _) = worker .dataflow::<u64, _, _>(|scope| { let ((handle, cap), source) = scope.new_unordered_input::<((Value, Value), u64, isize)>(); let source_test: Domain<Aid, u64> = source .as_singleton_domain("source_test") .with_slack(1) .into(); let tx_test: Domain<Aid, u64> = scope .new_unordered_input::<((Value, Value), u64, isize)>() .as_singleton_domain("tx_test") .with_slack(1) .into(); (source_test + tx_test, handle, cap) }); assert_eq!(domain.attributes.len(), 2); assert_eq!(domain.probed_source_count(), 1); assert_eq!(domain.epoch(), &0); assert!(!domain.dominates(AntichainRef::new(&[]))); assert!(!domain.dominates(AntichainRef::new(&[0]))); assert_eq!( domain .forward_propose .get_mut("tx_test") .unwrap() .advance_frontier(), &[0] ); assert_eq!( domain .forward_propose .get_mut("tx_test") .unwrap() .distinguish_frontier(), &[0] ); assert_eq!( domain .forward_propose .get_mut("source_test") .unwrap() .advance_frontier(), &[0] ); assert_eq!( domain .forward_propose .get_mut("source_test") .unwrap() .distinguish_frontier(), &[0] ); // tick cap.downgrade(&1); worker.step_while(|| !domain.dominates(AntichainRef::new(&[0]))); domain.advance().unwrap(); assert_eq!(domain.epoch(), &1); assert!(domain.dominates(AntichainRef::new(&[0]))); assert!(!domain.dominates(AntichainRef::new(&[1]))); assert_eq!( domain .forward_propose .get_mut("tx_test") .unwrap() .advance_frontier(), &[0] ); assert_eq!( domain .forward_propose .get_mut("tx_test") .unwrap() .distinguish_frontier(), &[0] ); assert_eq!( domain .forward_propose .get_mut("source_test") .unwrap() .advance_frontier(), &[0] ); assert_eq!( domain .forward_propose .get_mut("source_test") .unwrap() .distinguish_frontier(), &[0] ); // tick cap.downgrade(&2); worker.step_while(|| !domain.dominates(AntichainRef::new(&[1]))); domain.advance().unwrap(); assert_eq!(domain.epoch(), &2); assert!(domain.dominates(AntichainRef::new(&[1]))); assert!(!domain.dominates(AntichainRef::new(&[2]))); assert_eq!( domain .forward_propose .get_mut("tx_test") .unwrap() .advance_frontier(), &[1] ); assert_eq!( domain .forward_propose .get_mut("tx_test") .unwrap() .distinguish_frontier(), &[1] ); assert_eq!( domain .forward_propose .get_mut("source_test") .unwrap() .advance_frontier(), &[1] ); assert_eq!( domain .forward_propose .get_mut("source_test") .unwrap() .distinguish_frontier(), &[1] ); }); }
pub struct CncError { message: String, } impl std::fmt::Display for CncError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{}", self.message) } } impl std::fmt::Debug for CncError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{}", self.message) } } impl From<serialport::Error> for CncError { fn from(err: serialport::Error) -> Self { Self { message: err.description, } } } impl From<&str> for CncError { fn from(s: &str) -> Self { Self { message: s.to_owned(), } } } impl From<String> for CncError { fn from(s: String) -> Self { Self { message: s } } }
#![no_std] #![feature(test)] extern crate aesni; extern crate test; #[bench] pub fn aes128_encrypt(bh: &mut test::Bencher) { let cipher = aesni::Aes128::init(&Default::default()); let mut input = Default::default(); bh.iter(|| { cipher.encrypt(&mut input); test::black_box(&input); }); bh.bytes = input.len() as u64; } #[bench] pub fn aes128_decrypt(bh: &mut test::Bencher) { let cipher = aesni::Aes128::init(&Default::default()); let mut input = Default::default(); bh.iter(|| { cipher.decrypt(&mut input); test::black_box(&input); }); bh.bytes = input.len() as u64; } #[bench] pub fn aes128_encrypt8(bh: &mut test::Bencher) { let cipher = aesni::Aes128::init(&Default::default()); let mut input = [0u8; 16*8]; bh.iter(|| { cipher.encrypt8(&mut input); test::black_box(&input); }); bh.bytes = input.len() as u64; } #[bench] pub fn aes128_decrypt8(bh: &mut test::Bencher) { let cipher = aesni::Aes128::init(&Default::default()); let mut input = [0u8; 16*8]; bh.iter(|| { cipher.decrypt8(&mut input); test::black_box(&input); }); bh.bytes = input.len() as u64; } #[bench] pub fn ctr_aes128(bh: &mut test::Bencher) { let mut cipher = aesni::CtrAes128::new(&[0; 16], &[0; 16]); let mut input = [0u8; 10000]; bh.iter(|| { cipher.xor(&mut input); test::black_box(&input); }); bh.bytes = input.len() as u64; }
// Copyright © 2017-2023 Trust Wallet. // // This file is part of Trust. The full Trust copyright notice, including // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. use std::collections::HashMap; const ALPHABET_RFC4648: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; pub fn encode(input: &[u8], alphabet: Option<&[u8]>, padding: bool) -> Result<String, String> { let alphabet = alphabet.unwrap_or(ALPHABET_RFC4648); if alphabet.len() != 32 { return Err("Invalid alphabet: must contain 32 characters".to_string()); } let mut result = String::new(); let mut buffer: u32 = 0; let mut buffer_size = 0; for &byte in input { buffer = (buffer << 8) | u32::from(byte); buffer_size += 8; while buffer_size >= 5 { let value = alphabet[(buffer >> (buffer_size - 5)) as usize & 31]; result.push(char::from(value)); buffer_size -= 5; } } if buffer_size > 0 { let value = alphabet[(buffer << (5 - buffer_size)) as usize & 31]; result.push(char::from(value)); } if padding { let padding = 8 - (result.len() % 8); result.extend(std::iter::repeat('=').take(padding)); } Ok(result) } /// TODO `base64::decode` requires for padding bytes to be present if `padding = true`. /// This leads to an inconsistent behaviour. pub fn decode(input: &str, alphabet: Option<&[u8]>, padding: bool) -> Result<Vec<u8>, String> { let alphabet = alphabet.unwrap_or(ALPHABET_RFC4648); let mut output = Vec::new(); let mut buffer: u32 = 0; let mut bits_left = 0; let alphabet_map: HashMap<u8, u32> = alphabet .iter() .enumerate() .map(|(i, &c)| (c, i as u32)) .collect(); let input = if padding { input.trim_end_matches('=') } else { input }; for c in input.bytes() { let val = match alphabet_map.get(&c) { Some(val) => *val, None => return Err("Invalid character in input".to_string()), }; buffer = (buffer << 5) | val; bits_left += 5; if bits_left >= 8 { output.push((buffer >> (bits_left - 8)) as u8); bits_left -= 8; } } if padding && bits_left >= 5 { return Err("Invalid padding in input".to_string()); } if output == vec![0] { return Ok(vec![]); } Ok(output) } #[cfg(test)] mod tests { use super::*; #[test] fn test_base32_encode() { let data = b"Hello, world!"; let expected = "JBSWY3DPFQQHO33SNRSCC"; let result = encode(data, None, false).unwrap(); assert_eq!(result, expected); } #[test] fn test_base32_encode_padding() { let data = b"Hello, world!"; let expected = "JBSWY3DPFQQHO33SNRSCC==="; let result = encode(data, None, true).unwrap(); assert_eq!(result, expected); } #[test] fn test_base32_encode_filecoin() { let alphabet = "abcdefghijklmnopqrstuvwxyz234567"; let data = b"7uoq6tp427uzv7fztkbsnn64iwotfrristwpryy"; let expected = "g52w64jworydimrxov5hmn3gpj2gwyttnzxdmndjo5xxiztsojuxg5dxobzhs6i"; let result = encode(data, Some(alphabet.as_bytes()), false).unwrap(); assert_eq!(result, expected); let invalid_alphabet = "invalidalphabet"; let result = encode(data, Some(invalid_alphabet.as_bytes()), false); assert_eq!(result.is_err(), true); } #[test] fn test_base32_decode() { let data = "JBSWY3DPFQQHO33SNRSCC"; let expected = b"Hello, world!"; let result = decode(data, None, false).unwrap(); assert_eq!(result.as_slice(), expected); } #[test] fn test_base32_decode_abc() { let data = "ABC"; let expected = b""; let result = decode(data, None, false).unwrap(); assert_eq!(result.as_slice(), expected); } #[test] fn test_base32_decode_padding() { let data = "JBSWY3DPFQQHO33SNRSCC==="; let expected = b"Hello, world!"; let result = decode(data, None, true).unwrap(); assert_eq!(result.as_slice(), expected); } #[test] fn test_base32_decode_filecoin() { let alphabet = "abcdefghijklmnopqrstuvwxyz234567"; let data = "g52w64jworydimrxov5hmn3gpj2gwyttnzxdmndjo5xxiztsojuxg5dxobzhs6i"; let expected = b"7uoq6tp427uzv7fztkbsnn64iwotfrristwpryy"; let result = decode(data, Some(alphabet.as_bytes()), false).unwrap(); assert_eq!(result.as_slice(), expected); } }
use test_winrt_composable::*; use windows::core::*; use Component::Composable::*; #[test] fn base() -> Result<()> { let base = Base::new()?; assert!(base.Value()? == 0); base.SetValue(123)?; assert!(base.Value()? == 123); let base = Base::CreateWithValue(456)?; assert!(base.Value()? == 456); base.SetValue(123)?; assert!(base.Value()? == 123); assert!(base.BaseRequired()? == "BaseRequired"); Ok(()) } #[test] fn derived() -> Result<()> { let base = Derived::new()?; assert!(base.Value()? == 0); base.SetValue(123)?; assert!(base.Value()? == 123); let base = Derived::CreateWithValue(456)?; assert!(base.Value()? == 456); base.SetValue(123)?; assert!(base.Value()? == 123); assert!(base.BaseRequired()? == "BaseRequired"); assert!(base.DerivedRequired()? == "DerivedRequired"); Ok(()) }
/* Copyright 2020 Timo Saarinen Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ use super::*; // ------------------------------------------------------------------------------------------------- /// Type 15: Interrogation #[derive(Clone, Debug, PartialEq)] pub struct Interrogation { /// True if the data is about own vessel, false if about other. pub own_vessel: bool, /// AIS station type. pub station: Station, /// Interrogation case based on data length pub case: InterrogationCase, /// Source MMSI (30 bits) pub mmsi: u32, /// Interrogated MMSI (30 bits) pub mmsi1: u32, /// First message type (6 bits) pub type1_1: u8, /// First slot offset (12 bits) pub offset1_1: u16, /// Second message type (6 bits) pub type1_2: Option<u8>, /// Second slot offset (12 bits) pub offset1_2: Option<u16>, /// Interrogated MMSI (30 bits) pub mmsi2: Option<u32>, /// First message type (6 bits) pub type2_1: Option<u8>, /// First slot offset (12 bits) pub offset2_1: Option<u16>, } /// The four cases of interrogation, depending on data length mostly. #[derive(Clone, Copy, Debug, PartialEq)] pub enum InterrogationCase { /// One station is interrogated for one message type. Case1, /// One station is interrogated for two message types. Case2, /// Two stations are interrogated for one message type each. Case3, /// One station is interrogated for two message types, and a second for one message type. Case4, } impl InterrogationCase { pub fn new(bv: &BitVec) -> InterrogationCase { let len = bv.len(); if len >= 160 { if pick_u64(&bv, 90, 18) == 0 { // Case 3 (160 bits but without second type and second slot) InterrogationCase::Case3 } else { // Case 4 (160 bits) InterrogationCase::Case4 } } else if len >= 110 { // Case 2 (110 bits) InterrogationCase::Case2 } else { // Case 1 (88 bits) InterrogationCase::Case1 } } } // ------------------------------------------------------------------------------------------------- /// AIS VDM/VDO type 15: Interrogation pub(crate) fn handle( bv: &BitVec, station: Station, own_vessel: bool, ) -> Result<ParsedMessage, ParseError> { let case = InterrogationCase::new(bv); Ok(ParsedMessage::Interrogation(Interrogation { own_vessel, station, case, mmsi: { pick_u64(&bv, 8, 30) as u32 }, mmsi1: { pick_u64(&bv, 40, 30) as u32 }, type1_1: { pick_u64(&bv, 70, 6) as u8 }, offset1_1: { pick_u64(&bv, 76, 12) as u16 }, type1_2: match case { InterrogationCase::Case2 | InterrogationCase::Case4 => Some(pick_u64(&bv, 90, 6) as u8), _ => None, }, offset1_2: match case { InterrogationCase::Case2 | InterrogationCase::Case4 => { Some(pick_u64(&bv, 96, 12) as u16) } _ => None, }, mmsi2: match case { InterrogationCase::Case3 | InterrogationCase::Case4 => { Some(pick_u64(&bv, 110, 30) as u32) } _ => None, }, type2_1: match case { InterrogationCase::Case4 => Some(pick_u64(&bv, 140, 6) as u8), _ => None, }, offset2_1: match case { InterrogationCase::Case4 => Some(pick_u64(&bv, 146, 12) as u16), _ => None, }, })) } // ------------------------------------------------------------------------------------------------- #[cfg(test)] mod test { use super::*; #[test] fn test_parse_vdm_type15() { let mut p = NmeaParser::new(); match p.parse_sentence("!AIVDM,1,1,,B,?h3Ovn1GP<K0<P@59a0,2*04") { Ok(ps) => { match ps { // The expected result ParsedMessage::Interrogation(i) => { assert_eq!(i.mmsi, 3669720); assert_eq!(i.mmsi1, 367014320); assert_eq!(i.type1_1, 3); assert_eq!(i.offset1_1, 516); assert_eq!(i.type1_2, Some(5)); assert_eq!(i.offset1_2, Some(617)); assert_eq!(i.mmsi2, None); assert_eq!(i.type2_1, None); assert_eq!(i.offset2_1, None); } ParsedMessage::Incomplete => { assert!(false); } _ => { assert!(false); } } } Err(e) => { assert_eq!(e.to_string(), "OK"); } } } }
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Tests that binary operators allow subtyping on both the LHS and RHS, // and as such do not introduce unnecessarily strict lifetime constraints. use std::ops::Add; struct Foo; impl<'a> Add<&'a Foo> for &'a Foo { type Output = (); fn add(self, rhs: &'a Foo) {} } fn try_to_add(input: &Foo) { let local = Foo; // Manual reborrow worked even with invariant trait search. &*input + &local; // Direct use of the reference on the LHS requires additional // subtyping before searching (invariantly) for `LHS: Add<RHS>`. input + &local; } fn main() { }
mod accounting { use regex::Regex; use std::fs::File; use std::io::BufRead; use std::path::Path; #[derive(Debug)] pub struct Puzzle<T, U> where U: Fn(String) -> Option<T>, { xform: U, day: u32, } impl<T, U> Puzzle<T, U> where U: Fn(String) -> Option<T>, { pub fn new(day: u32, xform: U) -> Puzzle<T, U> { Puzzle { xform, day } } pub fn get_puzzle_data(&self) -> Option<Vec<T>> { let filename = format!("day{}-resource.txt", self.day); let mut ret = None; if let Ok(lines) = read_lines(filename) { let mut v: Vec<T> = vec![]; for line in lines { if let Ok(l) = line { if !l.is_empty() { if let Ok(item) = l.parse() { if let Some(t) = (self.xform)(item) { v.push(t) } } } } } ret = Some(v); } ret } } #[derive(Debug)] pub struct Password { min: u32, max: u32, req: String, passwd: String, } impl Password { pub fn new(line: &str) -> Option<Password> { Password::make_password(&line) } fn make_password(line: &str) -> Option<Password> { let mut p: Option<Password> = None; if let Ok(reg) = Regex::new(r"([0-9]+)-([0-9]+) ([a-z]+): ([a-z]+)") { if let Some(caps) = reg.captures(&line) { let text1 = caps.get(1).map_or("0", |m| m.as_str()); let text2 = caps.get(2).map_or("0", |m| m.as_str()); let text3 = caps.get(3).map_or("", |m| m.as_str()); let text4 = caps.get(4).map_or("", |m| m.as_str()); if let Ok(min) = text1.parse() { if let Ok(max) = text2.parse() { p = Some(Password { min, max, req: String::from(text3), passwd: String::from(text4), }); } } } } p } pub fn is_valid_new(&self) -> bool { let req = &self.req; let assigned_indices: String = self .passwd .chars() .enumerate() .filter(|char_enum| { let (sze, _) = char_enum; *sze == (self.min - 1) as usize || *sze == (self.max - 1) as usize }) .map(|char_enum| { let (_, chr) = char_enum; chr }) .collect(); let count = assigned_indices.matches(req).count() as u32; count == 1 } pub fn is_valid(&self) -> bool { let req = &self.req; let cnt = self.passwd.matches(req).count() as u32; cnt >= self.min && cnt <= self.max } } // The output is wrapped in a Result to allow matching on errors // Returns an Iterator to the Reader of the lines of the file. fn read_lines<P>(filename: P) -> std::io::Result<std::io::Lines<std::io::BufReader<File>>> where P: AsRef<Path>, { let file = File::open(filename)?; Ok(std::io::BufReader::new(file).lines()) } #[cfg(test)] mod tests { use super::*; #[test] #[should_panic(expected = "fail, got None!")] fn test_bad_password_line_parse() { let mystr = "1-9 xxwjgxtmrzxzmkx"; match Password::make_password(&mystr) { None => panic!("fail, got None!"), _ => panic!("uh oh."), } } #[test] fn test_password_line_parse() { let mystr = "1-9 x: xwjgxtmrzxzmkx"; match Password::make_password(&mystr) { None => panic!("fail"), Some(p) => { assert_eq!(1, p.min); assert_eq!(9, p.max); assert_eq!("x", p.req); assert_eq!("xwjgxtmrzxzmkx", p.passwd); println!("p {:?}, is valid new: {}.", p, p.is_valid_new()) } } } #[test] fn pass_closure() {} } } pub mod advent1 { use self::accounting::Puzzle; use advent_of_code::accounting; pub fn solve_puzzle_1(num_to_sum_to: u32) -> Vec<(u32, u32)> { let puzzle = Puzzle::new(1, |line: String| -> Option<u32> { match line.parse() { Ok(num) => Some(num), _ => None, } }); let mut solution = vec![]; if let Some(v) = puzzle.get_puzzle_data() { for i in v.iter() { for j in v.iter() { if num_to_sum_to == i + j { let tup: (u32, u32) = (*i, *j); solution.push(tup); } } } } solution } pub fn solve_puzzle_2(num_to_sum_to: u32) -> Vec<(u32, u32, u32)> { let puzzle = Puzzle::new(1, |line: String| -> Option<u32> { match line.parse() { Ok(num) => Some(num), _ => None, } }); let mut solution = vec![]; if let Some(v) = puzzle.get_puzzle_data() { for i in v.iter() { for j in v.iter() { for k in v.iter() { if num_to_sum_to == i + j + k { let tup: (u32, u32, u32) = (*i, *j, *k); solution.push(tup); } } } } } solution } } pub mod advent2 { use super::accounting::{Password, Puzzle}; pub fn solve_puzzle_1() -> usize { let puzzle = Puzzle::new(2, |line: String| -> Option<Password> { Password::new(&line) }); let mut num_passwds = 0; let passwds = puzzle.get_puzzle_data(); if let Some(passwds) = passwds { num_passwds = passwds.iter().filter(|p| p.is_valid()).count(); } num_passwds } pub fn solve_puzzle_2() -> usize { let puzzle = Puzzle::new(2, |line: String| -> Option<Password> { Password::new(&line) }); let passwds = puzzle.get_puzzle_data(); let mut num_passwds = 0; if let Some(passwds) = passwds { num_passwds = passwds.iter().filter(|p| p.is_valid_new()).count(); } num_passwds } } pub mod advent3 { use self::accounting::Puzzle; use advent_of_code::accounting; #[derive(Debug)] pub struct CircArr { arr: Vec<u8>, idx: usize, len: usize, } impl CircArr { pub fn new(arr: Vec<u8>) -> CircArr { let idx = 0; let len = arr.len(); CircArr { arr, idx, len } } pub fn get(&self, idx: usize) -> u8 { let i: usize; if idx >= self.len { i = idx % self.len; } else { i = idx; } self.arr[i] } } impl Iterator for CircArr { type Item = u8; fn next(&mut self) -> Option<u8> { let i: usize; if self.idx >= self.len { i = &self.idx % &self.len; } else { i = self.idx; } self.idx = &self.idx + 1; let item: Option<&u8> = self.arr.get(i); match item { Some(val) => Some(*val), None => None, } } } pub fn solve_puzzle_1() -> u32 { let puzzle = Puzzle::new(3, |line: String| -> Option<CircArr> { let bit_map: Vec<u8> = line.chars().map(|c| if c == '.' { 0 } else { 1 }).collect(); println!("bit map {:?}.", bit_map); Some(CircArr::new(bit_map)) }); let mut tree_hit = 0; let mut start: usize = 0; if let Some(puzzle) = puzzle.get_puzzle_data() { for i in puzzle.iter() { let land_at: u8 = i.get(start); start += 3; if let 1 = land_at { tree_hit = tree_hit + 1; } } println!("num trees hit: {}.", tree_hit); } tree_hit } pub fn solve_puzzle_2() {} } #[cfg(test)] mod tests { use super::*; use advent_of_code::advent3::CircArr; #[test] fn solve_aoc1() { let num_to_sum_to = 2020; let sol1: Vec<(u32, u32)> = advent1::solve_puzzle_1(num_to_sum_to); assert!(sol1.len() > 0); for s in sol1.iter() { assert_eq!(877971, s.0 * s.1); } let sol2 = advent1::solve_puzzle_2(num_to_sum_to); assert!(sol2.len() > 0); for s in sol2.iter() { assert_eq!(203481432, s.0 * s.1 * s.2); } } #[test] fn solve_aoc2() { let sol1 = advent2::solve_puzzle_1(); assert_eq!(sol1, 640); let sol2 = advent2::solve_puzzle_2(); assert_eq!(sol2, 472); } #[test] fn solve_aoc3() { let tree_hit = advent3::solve_puzzle_1(); assert_eq!(244, tree_hit); advent3::solve_puzzle_2(); } #[test] fn test_usze() { let one: usize = 1; println!("lksadf: {}.", one == one) } #[test] fn test_matching() { println!("count: {}.", "alkjalslkja".matches("a").count()); println!( "meow: {:?}.", "alkjalslkja" .chars() .enumerate() .filter(|enumer| { let (s, _) = enumer; *s == 1 || *s == 3 }) .map(|enumer| { let (_, c) = enumer; c }) .collect::<String>() ); } #[test] fn test_sqrt() { let takeme: f64 = 27.0; println!("takene: {}.", takeme.log(3.0)); } #[test] fn test_infini_arr() { let my_vec: Vec<u8> = vec![0, 0, 0, 0, 1]; let my_arr = CircArr::new(my_vec); println!("Oh my: {:?}.", my_arr.get(18)); println!("Oh my: {:?}.", my_arr.get(4)); } }
use super::Castable; use super::{super::ray::Ray, CastInfo}; use crate::shapes::Shape; use crate::{ material::{Material, MaterialType}, shapes::Movable, }; use na::{Isometry3, Point3, Unit, Vector3}; #[derive(Debug, Copy, Clone)] pub struct Plane { normal: Unit<Vector3<f32>>, center: Point3<f32>, size: (Option<f32>, Option<f32>), material: Material, world_to_object: Isometry3<f32>, object_to_world: Isometry3<f32>, } impl Plane { pub fn new( normal: Unit<Vector3<f32>>, center: Point3<f32>, size: (Option<f32>, Option<f32>), rotation: Vector3<f32>, material: Material, ) -> Plane { let model_matrix = Isometry3::new(center.coords, rotation); Plane { center: Point3::new(0., 0., 0.), object_to_world: model_matrix, world_to_object: model_matrix.inverse(), normal: normal, size: size, material: material, } } } impl Castable for Plane { fn is_shadow_casting(&self) -> bool { match self.material.material_type { MaterialType::Refraction { .. } => false, _ => true, } } // https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-plane-and-ray-disk-intersection fn cast_ray(&self, world_ray: &Ray) -> Option<CastInfo> { let ray = world_ray.apply_isometry(self.world_to_object); let denominator = self.normal.into_inner().dot(&ray.direction); if denominator > 0. { return None; } let t = (self.center - ray.origin).dot(&self.normal.into_inner()) / denominator; if t < 0. { return None; } let point_hit = ray.origin + (t * ray.direction.into_inner()); let distance_to_center = point_hit.to_homogeneous() - self.center.to_homogeneous(); match self.size.0 { Some(x_) => { let x = distance_to_center.x; if x.abs() > x_ { return None; } } None => {} } match self.size.1 { Some(z_) => { let z = distance_to_center.z; if z.abs() > z_ { return None; } } None => {} } Some( CastInfo { distance: t, normal: self.normal, pointing_to_viewer: Unit::new_normalize(ray.origin - point_hit), point_hit, casted: self, material: self.material, } .apply_isometry(self.object_to_world), ) } } impl Movable for Plane { fn move_to(&mut self, _direction: Vector3<f32>) { todo!() } } impl Shape for Plane {}
use crate::errors::AndroidError; use std::process::Command; use log::debug; const ANDROID_TARGETS: &'static [&str] = &[ "aarch64-linux-android", "armv7-linux-androideabi", "i686-linux-android", ]; /// Checks to see if rustup is installed pub fn check_rustup() -> Result<(), AndroidError> { debug!("Checking if rustup is installed..."); let output = Command::new("sh").arg("-c").arg("which rustup").output()?; if output.status.success() { debug!("Rustup is installed"); return Ok(()); } Err(AndroidError::RustupNotInstalled) } /// Attempts to install all rustup targets for Android pub fn rustup_add_targets() -> Result<(), AndroidError> { debug!("Adding Android targets via Rustup..."); for target in ANDROID_TARGETS { let output = Command::new("sh") .arg("-c") .arg(format!("rustup target add {}", target)) .output()?; if output.status.success() { debug!("Installed {}", target); } else { return Err(AndroidError::CannotAddRustupTarget { target: target.to_string(), }); } } Ok(()) }
#[path = "with_reference/with_flush_and_info_options.rs"] mod with_flush_and_info_options; #[path = "with_reference/with_flush_option.rs"] mod with_flush_option; #[path = "with_reference/with_info_option.rs"] mod with_info_option; #[path = "with_reference/without_options.rs"] mod without_options; test_stdout!(without_proper_list_for_options_errors_badarg, "{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n"); test_stdout!( with_unknown_option_errors_badarg, "{caught, error, badarg}\n" );
use std::{fmt, str}; use crate::*; /// Contains Lux Ai API commands definitions pub struct Commands {} impl Commands { /// Input city pub const CITY: &'static str = "c"; /// Input city tile pub const CITY_TILES: &'static str = "ct"; /// Input done pub const DONE: &'static str = "D_DONE"; /// Output actions finished pub const FINISH: &'static str = "D_FINISH"; /// Input researched points pub const RESEARCH_POINTS: &'static str = "rp"; /// Input resource on tile pub const RESOURCES: &'static str = "r"; /// Input road on tile pub const ROADS: &'static str = "ccd"; /// Input unit on tile pub const UNITS: &'static str = "u"; } impl Commands { /// Annotate circle on point pub const ANNOTATE_CIRCLE: &'static str = "dc"; /// Annotate cross on point pub const ANNOTATE_CROSS: &'static str = "dx"; /// Annotate line between two pooints pub const ANNOTATE_LINE: &'static str = "dl"; /// Annotate text on point pub const ANNOTATE_SIDE_TEXT: &'static str = "dst"; /// Annotate side text pub const ANNOTATE_TEXT: &'static str = "dt"; } impl Commands { /// Action to build cart pub const BUILD_CART: &'static str = "bc"; /// Action to build city pub const BUILD_CITY: &'static str = "bcity"; /// Action to build worker pub const BUILD_WORKER: &'static str = "bw"; /// Action to move unit pub const MOVE: &'static str = "m"; /// Action to pillage road pub const PILLAGE: &'static str = "p"; /// Action to research for city tile pub const RESEARCH: &'static str = "r"; /// Action to transfer from unit to adjacent unit pub const TRANSFER: &'static str = "t"; } /// Command argument or token pub type CommandArgument = String; /// Represents input command from Lux AI API environment #[derive(fmt::Debug, PartialEq, Eq)] pub struct Command { /// Command arguments pub arguments: Vec<CommandArgument>, } impl Command { /// Create command representation from line, parse into tokens /// /// # Parameters /// /// - `plain` - line containing `Command` /// /// # Returns /// /// Command with parsed `CommandArgument` arguments pub fn new(plain: String) -> Self { let tokens = plain.split_whitespace().map(|s| s.to_string()).collect(); Self { arguments: tokens } } /// Returns argument converting into type `T` at position `argument_idx` /// /// # Parameters /// /// - `self` - Self reference /// - `argument_idx` - index of argument to return (0 - for command type, 1 /// .. inf - for other) /// /// # Type parameters /// /// - `T` - type to convert argument to /// /// # Returns /// /// Argument converted to `T` type at position `argument_idx` or error pub fn argument<T: str::FromStr>(&self, argument_idx: usize) -> LuxAiResult<T> { let argument = self.arguments[argument_idx] .parse::<T>() .map_err(|_| LuxAiError::CommandFormat(self.arguments.clone()))?; Ok(argument) } /// Validates command to have exaclty `arguments_count` arguments (including /// command type) /// /// # Parameters /// /// - `self` - Self reference /// - `arguments_count` - count of arguments /// /// # Returns /// /// Nothing or error if argument count is not equal to `arguments_count` pub fn expect_arguments(&self, arguments_count: usize) -> LuxAiResult { if self.arguments.len() != arguments_count { Err(LuxAiError::CommandFormat(self.arguments.clone())) } else { Ok(()) } } }
use std::fmt; use std::convert::From; use std::io; #[derive(Debug)] pub struct StatsError (String); impl fmt::Display for StatsError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.0) } } impl From<io::Error> for StatsError { fn from(io_err: io::Error) -> Self { StatsError(io_err.to_string()) } }
/* * CS 538, Spring 2019: HW4 * Problem 1 : COMPLETE * * Write implementations of the following simple functions. You can use basic Vector operations * like `push`, `pop`, and `contains`, but do not use the built-in `dedup` or `filter` functions, * for instance. * * Take a look at the Vector documentation for a good intro to Rust Vectors: * * https://doc.rust-lang.org/std/vec/struct.Vec.html */ /// Compute the sum of a vector of integers pub fn sum(vs: &Vec<i32>) -> i32 { let mut sum = 0; for x in vs { sum += x; // println!("{}", sum); } sum } /// Return a copy of the input vector, keeping only the first copy of each element. pub fn dedup(vs: &Vec<i32>) -> Vec<i32> { // let bs = vec![1, 2, 3, 4, 5];; // let mut iter = vs[0]; let mut vec = Vec::new(); // println!("a = {}", a); vec.push(vs[0]); let a = vs.len(); let mut b = vec.len(); // slow method comparison method let mut i = 0; let mut j = 0; let mut flag = 0; while i < a { while j < b { if vs[i] == vec[j]{ flag += 1; println!("{} : vs[{}] != {} : vec[{}]",i,vs[i],j,vec[j]); } else { println!("{} : vs[{}] != {} : vec[{}]",i,vs[i],j,vec[j]); } j += 1; } if flag == 0 { vec.push(vs[i]); b += 1; } flag = 0; j = 0; i += 1; } // while i < b{ // if vec[i] != vs[j]{ // print!("vec[{}] = {} :: vs[{}] = {}",i,j,vec[i],vs[j]); // let m = j; // while j < a { // if vec[i] == vs[j]{ // flag += 1; // } // } // if flag == 0 { // vec.push(vs[m]); // } // } // j = i; // i += 1; // flag = 0; // } // while i < a { // while j < a { // if vec[i] != vs[j] { // // print!("pushing value = {} ",vs[j]); // vec.push(vs[j]); // } // j += 1; // } // i += 1; // } // for x in &vec { // println!("{}", x); // } // println!("len {}", vec.len()); vec } /// Return a copy of the input vector keeping only elements where the predicate is true. The order /// of elements should not be changed. pub fn filter(vs: &Vec<i32>, pred: &Fn(i32) -> bool) -> Vec<i32> { let mut eval = false; let mut i = 0; let mut vec = Vec::new(); let myl = vs.len(); while i < myl { eval = pred(vs[i]); // println!("Eval = {} ", eval); if eval == true { vec.push(vs[i]); } i += 1; } // for x in &vec { // println!("{}", x); // } vec } /// You can put more tests here. #[cfg(test)] mod tests { use super::*; #[test] fn test_sum() { let vs = vec![1, 2, 3, 4, 5]; assert_eq!(sum(&vs), 15); } #[test] fn test_sum_1() { let vs = vec![1, 2, 3, 4, 5, 5, 5, 5]; assert_eq!(sum(&vs), 30); } #[test] fn test_dedup() { let vs = vec![5, 4, 3, 2, 1, 2, 3, 4, 5]; assert_eq!(dedup(&vs), [5, 4, 3, 2, 1]); } #[test] fn test_dedup_1() { let vs = vec![5, 5, 5, 5, 5, 5, 5, 1, 5]; assert_eq!(dedup(&vs), [5 , 1]); } #[test] fn test_dedup_2() { let vs = vec![1, 2, 3, 1]; assert_eq!(dedup(&vs), [1, 2, 3]); } #[test] fn test_dedup_3() { let vs = vec![1, 2, 3, 1, 2, 3, 3, 2, 1]; assert_eq!(dedup(&vs), [1, 2, 3]); } #[test] fn test_filter() { let vs = vec![5, 4, 3, 2, 1, 2, 3, 4, 5]; assert_eq!(filter(&vs, &|i:i32| { i % 2 == 1 }), [5, 3, 1, 3, 5]); } }
use super::*; pub fn gen_sys_file(root: &'static str, tree: &TypeTree, ignore_windows_features: bool) -> TokenStream { let gen = Gen { relative: tree.namespace, root, ignore_windows_features, docs: false, build: false }; let types = gen_sys(tree, &gen); let namespaces = tree.namespaces.iter().filter_map(move |(name, tree)| { if !tree.include { return None; } let name = to_ident(name); let namespace = tree.namespace[tree.namespace.find('.').unwrap() + 1..].replace('.', "_"); Some(quote! { #[cfg(feature = #namespace)] pub mod #name; }) }); quote! { #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #(#namespaces)* #types } } pub fn gen_source_file(root: &'static str, tree: &TypeTree, ignore_windows_features: bool) -> TokenStream { let gen = Gen { relative: tree.namespace, root, ignore_windows_features, docs: false, build: false }; let types = tree.types.values().map(move |t| gen_type_entry(t, &gen)); let namespaces = tree.namespaces.iter().filter_map(move |(name, tree)| { if !tree.include { return None; } let name = to_ident(name); let namespace = tree.namespace[tree.namespace.find('.').unwrap() + 1..].replace('.', "_"); Some(quote! { #[cfg(feature = #namespace)] pub mod #name; }) }); quote! { #![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #(#namespaces)* #(#types)* } } pub fn gen_source_tree() -> TokenStream { let reader = TypeReader::get(); namespace_iter(&reader.types).fold(TokenStream::with_capacity(), |mut accum, n| { accum.combine(&n); accum }) } pub fn namespace_iter(tree: &TypeTree) -> impl Iterator<Item = TokenStream> + '_ { let gen = Gen::relative(tree.namespace); tree.types.iter().map(move |t| gen_type_entry(t.1, &gen)).chain(gen_namespaces(&tree.namespaces)) } fn gen_namespaces<'a>(namespaces: &'a BTreeMap<&'static str, TypeTree>) -> impl Iterator<Item = TokenStream> + 'a { namespaces.iter().map(move |(name, tree)| { if tree.include { // TODO: https://github.com/microsoft/windows-rs/issues/212 // TODO: https://github.com/microsoft/win32metadata/issues/380 let allow = if name == &tree.namespace { quote! { #[allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] } } else { quote! {} }; let name = to_ident(name); let tokens = namespace_iter(tree); quote! { #allow pub mod #name { #(#tokens)* } } } else { TokenStream::new() } }) } pub fn gen_type_entry(entry: &TypeEntry, gen: &Gen) -> TokenStream { if entry.include == TypeInclude::None { return TokenStream::new(); } let mut tokens = TokenStream::new(); for def in &entry.def { tokens.combine(&match def { ElementType::TypeDef(def) => gen_type(&def.clone().with_generics(), gen, entry.include), ElementType::MethodDef(def) => gen_function(def, gen), ElementType::Field(def) => gen_constant(def, gen), _ => unimplemented!(), }); } tokens } fn gen_type(def: &TypeDef, gen: &Gen, include: TypeInclude) -> TokenStream { match def.kind() { TypeKind::Interface => { if def.is_winrt() { gen_interface(&def.clone().with_generics(), gen, include) } else { gen_com_interface(def, gen, include) } } TypeKind::Class => Class(def.clone().with_generics()).gen(gen, include), TypeKind::Enum => gen_enum(def, gen, include), TypeKind::Struct => gen_struct(def, gen), TypeKind::Delegate => { if def.is_winrt() { gen_delegate(def, gen) } else { gen_callback(def, gen) } } } }
use estrelas_math::vector2::Vector2; #[derive(Default, PartialEq, Clone, Copy)] pub struct Transform2D { pub position: Vector2, pub rotation: Vector2, pub scale: Vector2 } impl Transform2D { pub fn new(position: Vector2, rotation: Vector2, scale: Vector2) -> Self { Transform2D { position: position, rotation: rotation, scale: scale } } }
use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, }; use actix::prelude::*; use tokio::sync::oneshot; #[derive(Debug)] struct Ping(usize); impl Message for Ping { type Result = (); } struct MyActor(Arc<AtomicUsize>); impl Actor for MyActor { type Context = Context<Self>; } impl Handler<Ping> for MyActor { type Result = (); fn handle(&mut self, _: Ping, _: &mut actix::Context<MyActor>) { self.0 .store(self.0.load(Ordering::Relaxed) + 1, Ordering::Relaxed); System::current().stop(); } } #[test] fn test_start_actor_message() { let count = Arc::new(AtomicUsize::new(0)); let act_count = Arc::clone(&count); let sys = System::new(); sys.block_on(async move { let arbiter = Arbiter::new(); actix_rt::spawn(async move { let (tx, rx) = oneshot::channel(); arbiter.spawn_fn(move || { let addr = MyActor(act_count).start(); tx.send(addr).ok().unwrap(); }); // TODO: investigate under CPU stress and/or with a drop impl // original test used this line, but was buggy: // rx.await.unwrap().do_send(Ping(1)); rx.await.unwrap().send(Ping(1)).await.unwrap(); }); }); sys.run().unwrap(); assert_eq!(count.load(Ordering::Relaxed), 1); }
use crate::actions::MatchAction; use crate::contact::Contact; use anyhow::{bail, Result}; pub struct Mutt {} impl Mutt { pub fn new() -> Self { Mutt {} } } impl MatchAction for Mutt { fn process(&self, contacts: Vec<&mut Contact>) -> Result<bool> { if contacts.is_empty() { bail!("No contact has been matched."); } println!("{} contacts found.", contacts.len()); for contact in contacts { for (email_name, email_address) in contact.emails.iter() { println!( "{}\t{}\t({})", email_address, contact.full_name().or(contact.entity_name()).unwrap(), email_name ); } } Ok(false) } }
use std::fs; use std::fs::File; use std::io::prelude::*; use std::path::Path; use serde::{Deserialize, Serialize}; use serde_json::json; use glob::Pattern; #[derive(Serialize, Deserialize)] #[derive(Debug)] pub struct Settings { pub(crate) api_url: String, pub(crate) directory: String, pub(crate) follow_links: bool, pub(crate) ignore_hidden: bool, pub(crate) ignore_files: Vec<String>, } impl Settings { pub fn get_ignore_patterns(&self) -> Vec<Pattern> { let mut ignore_patterns = Vec::new(); for pattern in &self.ignore_files { let ignore_pattern = Pattern::new(pattern.as_str()).unwrap(); ignore_patterns.push(ignore_pattern); } ignore_patterns } } const CONFIG_FILE: &'static str = "config.json"; pub fn save_settings(settings: &Settings) { let json = json!(settings); let mut file = match File::create(CONFIG_FILE) { Ok(file) => file, Err(error) => { panic!("Problem creating the config file: {:?}", error) } }; let json_string = match serde_json::to_string_pretty(&json) { Ok(json_string) => json_string, Err(error) => { panic!("Problem serializing settings: {:?}", error) } }; file.write_all(json_string.as_bytes()).expect("Something went wrong while writing the config file"); } pub fn load_settings() -> Settings { let settings: Settings; let path = Path::new(CONFIG_FILE); if path.exists() { let contents = match fs::read_to_string(CONFIG_FILE) { Ok(contents) => contents, Err(error) => { panic!("Problem reading the config file: {:?}", error) } }; settings = match serde_json::from_str(&contents) { Ok(file) => file, Err(error) => { panic!("Problem parsing the config file: {:?}", error) } }; } else { settings = Settings { api_url: String::from("https://server.kellerkompanie.com:5000/"), directory: String::from("/home/arma3server/serverfiles/mods"), follow_links: false, ignore_hidden: false, ignore_files: Vec::new(), }; save_settings(&settings); } settings }
use irc::proto::Command; pub fn hl_sx(s: &str, at: usize) -> String { if s.is_empty() { return String::new(); } if s.len() == 1 { return format!("{{mod=invert {}}}", s); } let (l, r) = s.split_at(at); let mut n = String::with_capacity(s.len() + "{mod=invert X}".len()); n.push_str(l); n.push_str(&format!("{{mod=invert {}}}", &r[..1])); n.push_str(&r[1..]); n } pub fn prepare_message(chn: &str, msg: &str) -> Command { let ch = if !chn.starts_with("#") { format!("#{}", chn) } else { String::from(chn) }; Command::PRIVMSG(ch, String::from(msg)) } pub fn prepare_join(chn: &str) -> Command { let ch = if !chn.starts_with("#") { format!("#{}", chn) } else { String::from(chn) }; Command::JOIN(ch, None, None) } pub fn prepare_part(chn: &str) -> Command { let ch = if !chn.starts_with("#") { format!("#{}", chn) } else { String::from(chn) }; Command::PART(ch, None) }
use std::fmt; use std::error::Error; #[derive(Debug, Clone)] pub enum AssemblerError { NoSegmentDeclarationFound{ instruction: u32 }, StringConstantDeclaredWithoutLabel{ instruction: u32 }, SymbolAlreadyDeclared, UnknownDirectiveFound{ directive: String }, NonOpcodeInOpcodeField, InsufficientSections, ParseError{ error: String } } impl fmt::Display for AssemblerError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match &*self { AssemblerError::NoSegmentDeclarationFound{ instruction } => { f.write_str(&format!("No segment declaration (e.g., .code, .data) prior to finding an opcode. Instruction # was {}", instruction)) } AssemblerError::StringConstantDeclaredWithoutLabel{ instruction } => { f.write_str(&format!("Found a string constant without a corresponding label. Instruction # was {}", instruction)) }, AssemblerError::SymbolAlreadyDeclared => { f.write_str(&format!("This symbol was previously declared")) }, AssemblerError::UnknownDirectiveFound{ directive } => { f.write_str(&format!("Invalid or unknown directive. Directive name was: {}", directive)) }, AssemblerError::NonOpcodeInOpcodeField => { f.write_str(&format!("A non-opcode was found in an opcode field")) }, AssemblerError::InsufficientSections => { f.write_str(&format!("Less than two sections/segments were found in the code")) }, AssemblerError::ParseError{ error } => { f.write_str(&format!("There was an error parsing the code: {}", error)) } } } } impl Error for AssemblerError { fn description(&self) -> &str { match self { AssemblerError::NoSegmentDeclarationFound{ instruction: u32 } => { "No segment declaration (e.g., .code, .data) prior to finding an opcode. Instruction # was {}" }, AssemblerError::StringConstantDeclaredWithoutLabel{ instruction: u32 } => { "Found a string constant without a corresponding label. Instruction # was {}" }, AssemblerError::SymbolAlreadyDeclared => { "This symbol was previously declared" }, AssemblerError::UnknownDirectiveFound{ directive: u32 } => { "Invalid or unknown directive. Directive name was: {}" }, AssemblerError::NonOpcodeInOpcodeField => { "A non-opcode was found in an opcode field" }, AssemblerError::InsufficientSections => { "Less than two sections/segments were found in the code" }, AssemblerError::ParseError{ error: String } => { "There was an error parsing the code: {}" } } } }
// 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::any::Any; use std::sync::Arc; use common_exception::Result; use common_expression::DataBlock; use common_pipeline_core::pipe::PipeItem; use common_pipeline_core::processors::port::InputPort; use common_pipeline_core::processors::port::OutputPort; use common_pipeline_core::processors::processor::Event; use common_pipeline_core::processors::processor::ProcessorPtr; use common_pipeline_core::processors::Processor; // TODO Shuffle? pub struct BroadcastProcessor { input_port: Arc<InputPort>, output_ports: Vec<Arc<OutputPort>>, input_data: Option<Result<DataBlock>>, output_index: usize, } impl BroadcastProcessor { pub fn new(num_outputs: usize) -> Self { let mut output_ports = Vec::with_capacity(num_outputs); for _ in 0..num_outputs { output_ports.push(OutputPort::create()) } let input_port = InputPort::create(); Self { input_port, output_ports, input_data: None, output_index: 0, } } pub fn into_pipe_item(self) -> PipeItem { let input = self.input_port.clone(); let outputs = self.output_ports.clone(); let processor_ptr = ProcessorPtr::create(Box::new(self)); PipeItem::create(processor_ptr, vec![input], outputs) } } impl Processor for BroadcastProcessor { fn name(&self) -> String { "BroadcastProcessor".to_owned() } fn as_any(&mut self) -> &mut dyn Any { self } fn event(&mut self) -> Result<Event> { let finished = self.input_port.is_finished() && self.input_data.is_none(); if finished { for o in &self.output_ports { o.finish() } return Ok(Event::Finished); } if self.input_port.has_data() && self.input_data.is_none() { self.input_data = Some(self.input_port.pull_data().unwrap()); } if let Some(data) = &self.input_data { while self.output_index < self.output_ports.len() { let output = &self.output_ports[self.output_index]; if output.can_push() { self.output_index += 1; output.push_data(data.clone()); } else { self.input_port.set_not_need_data(); return Ok(Event::NeedConsume); } } if self.output_index == self.output_ports.len() { self.input_data = None; }; } self.input_port.set_need_data(); Ok(Event::NeedData) } }
use concept_learning::algo::*; use concept_learning::parser; use std::error::Error; fn main() -> Result<(), Box<dyn Error>> { let input = "/home/deep/work/rust/concept_learning/data/input.csv"; let data = parser::parse(input)?; let hypothesis = find_s(data); println!("FIND-S algorithm says: {}", hypothesis); Ok(()) }
use std::io::{Read, Result as IOResult}; use crate::PrimitiveRead; pub struct ModelLODHeader { pub meshes_count: i32, pub mesh_offset: i32, pub switch_point: f32 } impl ModelLODHeader { pub fn read(read: &mut dyn Read) -> IOResult<Self> { let meshes_count = read.read_i32()?; let meshes_offset = read.read_i32()?; let switch_point = read.read_f32()?; Ok(Self { meshes_count, mesh_offset: meshes_offset, switch_point }) } }
use super::day::{Day}; pub struct Day08 {} impl Day08 { fn parse_input(input: &str) -> Vec<Vec<String>> { input.lines() .map(|line| line .split(" | ") .nth(1) .unwrap() .split(' ') .map(String::from) .collect::<Vec<String>>() ).collect::<Vec<Vec<String>>>() } } impl Day for Day08 { fn day_number(&self) -> &str { "08" } fn part_1(&self) -> String { let input = Day08::parse_input(&self.load_input()); let ret: u64 = input.into_iter() .map(|v| v) .fold(0, |prev, curr| prev + if curr.len() == 2 || curr.len() == 3 || curr.len() == 4 || curr.len() == 7 {1} else {0} as u64 ); println!("RES:{}", ret); String::new() //res.to_string() } fn part_2(&self) -> String { String::new() } }
//! Contains integration tests for Telamon. use telamon::device::{fake, Context}; use telamon::explorer; use telamon::helper; use telamon::ir::{self, Size, Type}; use telamon::search_space::*; /// Find the best candidate for a function and outputs it. pub fn gen_best(context: &dyn Context, space: SearchSpace) { let mut config = explorer::Config::from_settings_toml(); config.num_workers = 1; let best = explorer::find_best(&config, context, vec![space], None).unwrap(); context.device().gen_code(&best, &mut std::io::sink()); } /// Obtains the best implementation for an empty function. #[test] fn empty() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); gen_best( &context, helper::Builder::new(signature.into(), context.device()).get(), ); } /// Obtains the best implementation for two add instructions. #[test] fn two_add() { let _ = env_logger::try_init(); let mut context = fake::Context::<fake::Device>::default(); let signature = { let mut builder = helper::SignatureBuilder::new("two_add", &mut context); builder.scalar("a", 42); builder.get() }; gen_best(&context, { let mut builder = helper::Builder::new(signature.into(), context.device()); builder.add(&"a", &2); builder.add(&std::f32::consts::PI, &1.0f32); builder.get() }); } /// Ensures the default order between instructions and dimensions is good. #[test] fn inst_dim_order() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let dim0 = builder.open_dim(Size::new_const(64)); let inst0 = builder.mov(&0i32); let pattern = ir::AccessPattern::Unknown(None); let addr = builder.cast(&0i64, pattern.pointer_type(&*context.device())); let inst1 = builder.st(&addr, &0i32, pattern); builder.close_dim(&dim0); let dim1 = builder.open_dim(Size::new_const(64)); let _ = builder.mov(&0i32); let space = builder.get(); assert_eq!(space.domain().get_dim_kind(dim0[0]), !DimKind::VECTOR); assert_eq!(space.domain().get_dim_kind(dim1[0]), !DimKind::VECTOR); assert_eq!( space.domain().get_is_iteration_dim(inst0, dim0[0]), Bool::TRUE ); assert_eq!( space.domain().get_is_iteration_dim(inst0, dim0[0]), Bool::TRUE ); assert_eq!( space.domain().get_order(inst0.into(), dim1[0].into()), Order::INNER | Order::ORDERED ); assert_eq!( space.domain().get_is_iteration_dim(inst1, dim1[0]), Bool::FALSE ); assert_eq!( space.domain().get_order(inst1.into(), dim1[0].into()), Order::INNER | Order::ORDERED ); gen_best(&context, space); } #[test] /// Ensures oredering contraints for `ir::VarDef::Inst` are respected. fn inst_variable_order() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let src = builder.mov(&1f32); let var = builder.get_inst_variable(src); let dst = builder.mov(&var); let space = builder.get(); assert_eq!( space.domain().get_order(src.into(), dst.into()), Order::BEFORE ); gen_best(&context, space); } /// Ensures oredering contraints for `ir::VarDef::DimMap` are respected. #[test] fn dim_map_variable_order() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let src_dim = builder.open_dim(ir::Size::new_const(16)); let src = builder.mov(&1f32); let src_var = builder.get_inst_variable(src); let dst_dim = builder.open_mapped_dim(&src_dim); let dst_var = builder.create_dim_map_variable(src_var, &[(&src_dim, &dst_dim)]); let dst = builder.mov(&dst_var); // Ensure ordering constraints are respected. let space = builder.get_clone(); assert_eq!( space.domain().get_order(src.into(), dst.into()), Order::BEFORE ); assert_eq!( space .domain() .get_order(src_dim[0].into(), dst_dim[0].into()), Order::BEFORE | Order::MERGED ); // Ensure point-to-point communication is enforced by merging dimensions if it cannot // use different register names along the dimensions. builder.action(Action::DimKind(src_dim[0], DimKind::LOOP)); let space = builder.get(); assert_eq!( space .domain() .get_order(src_dim[0].into(), dst_dim[0].into()), Order::MERGED ); gen_best(&context, space); } /// Ensures oredering contraints for `ir::VarDef::Last` are respected. #[test] fn last_variable_order() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let dim = builder.open_dim(ir::Size::new_const(16)); let src = builder.mov(&1f32); let src_var = builder.get_inst_variable(src); builder.close_dim(&dim); let last_var = builder.create_last_variable(src_var, &[&dim]); let dst = builder.mov(&last_var); let space = builder.get(); assert_eq!( space.domain().get_order(src.into(), dst.into()), Order::BEFORE ); assert_eq!( space.domain().get_order(dim[0].into(), dst.into()), Order::BEFORE ); } /// Ensures nested thread dimensions are packed and that their number is limited. #[test] fn nested_thread_dims() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let size4 = builder.cst_size(4); let d0 = builder.open_dim_ex(size4.clone(), DimKind::THREAD); let d1 = builder.open_dim_ex(size4.clone(), DimKind::THREAD); let d2 = builder.open_dim_ex(size4, DimKind::THREAD); let size512 = builder.cst_size(512); let d3 = builder.open_dim(size512); builder.mov(&0i32); builder.order(&d0, &d3, Order::INNER); let space = builder.get(); assert!(!space .domain() .get_dim_kind(d3[0]) .intersects(DimKind::THREAD)); assert_eq!( space.domain().get_order(d0[0].into(), d3[0].into()), Order::INNER ); assert_eq!( space.domain().get_order(d1[0].into(), d3[0].into()), Order::INNER ); assert_eq!( space.domain().get_order(d2[0].into(), d3[0].into()), Order::INNER ); gen_best(&context, space); } /// Ensures the maximal number of threads is respected when adding an instruction. #[test] fn max_thread_on_addinst() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); builder.open_dim_ex(Size::new_const(1024), DimKind::THREAD); let d1 = builder.open_dim(Size::new_const(2)); builder.mov(&0i32); let space = builder.get(); assert!(!space .domain() .get_dim_kind(d1[0]) .intersects(DimKind::THREAD)); gen_best(&context, space); } /// Ensures the maximal number of thread is respected when setting a kind. #[test] fn max_thread_on_setkind() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim(Size::new_const(1024)); let d1 = builder.open_dim(Size::new_const(2)); builder.mov(&0i32); builder.action(Action::DimKind(d0[0], DimKind::THREAD)); let space = builder.get(); assert!(!space .domain() .get_dim_kind(d1[0]) .intersects(DimKind::THREAD)); gen_best(&context, space); } /// Ensures block dimensions are nested under every other dimension. #[test] fn block_dims() { let _ = env_logger::try_init(); let mut context = fake::Context::<fake::Device>::default(); let n; let signature = { let mut builder = helper::SignatureBuilder::new("block_dims", &mut context); n = builder.max_size("n", 64); builder.get() }; let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim(Size::new_const(4)); let inst = builder.mov(&0i32); let s1 = n.to_ir_size(&builder); let d1 = builder.open_dim_ex(s1, DimKind::BLOCK); let d2 = builder.open_dim_ex(Size::new_const(2), DimKind::BLOCK); let d3 = builder.open_dim_ex(Size::new_const(3), DimKind::BLOCK); let space = builder.get(); assert_eq!(space.domain().get_is_iteration_dim(inst, d0[0]), Bool::TRUE); assert_eq!(space.domain().get_is_iteration_dim(inst, d1[0]), Bool::TRUE); assert_eq!(space.domain().get_is_iteration_dim(inst, d2[0]), Bool::TRUE); assert_eq!(space.domain().get_is_iteration_dim(inst, d3[0]), Bool::TRUE); assert_eq!( space.domain().get_dim_kind(d0[0]), DimKind::LOOP | DimKind::THREAD | DimKind::UNROLL ); assert_eq!( space.domain().get_order(d1[0].into(), d2[0].into()), Order::NESTED ); assert_eq!( space.domain().get_order(d1[0].into(), d3[0].into()), Order::NESTED ); assert_eq!( space.domain().get_order(d2[0].into(), d3[0].into()), Order::NESTED ); gen_best(&context, space); } /// Ensures vector dimensions have the correct restrictions. #[test] fn vector_dims() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let base_addr = builder.cast(&0i64, context.device().pointer_type(MemSpace::GLOBAL)); let d0 = builder.open_dim(Size::new_const(4)); // Test with one vectorizable instruction let (addr, pattern) = builder.tensor_access(&base_addr, None, Type::I(8), &[&d0]); builder.ld(Type::I(8), &addr, pattern.clone()); assert!(builder .get_clone() .domain() .get_dim_kind(d0[0]) .intersects(DimKind::VECTOR)); // Test with two insts and a non-vectorizable inst. builder.ld(Type::I(8), &addr, pattern); builder.close_dim(&d0); let d1 = builder.open_dim(Size::new_const(4)); builder.mul(&0i32, &0i32); builder.close_dim(&d1); let space = builder.get(); assert!(!space .domain() .get_dim_kind(d0[0]) .intersects(DimKind::VECTOR)); assert!(!space .domain() .get_dim_kind(d1[0]) .intersects(DimKind::VECTOR)); gen_best(&context, space); } /// Ensure restrictions are applied to unrolled dimensions. #[test] fn unroll_dims() { let _ = env_logger::try_init(); let mut context = fake::Context::<fake::Device>::default(); let n; let signature = { let mut builder = helper::SignatureBuilder::new("unroll_dims", &mut context); n = builder.max_size("n", 64); builder.get() }; let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim(Size::new_const(64)); let d1 = builder.open_dim(Size::new_const(4096)); let s2 = n.to_ir_size(&builder); let d2 = builder.open_dim(s2); builder.mov(&0i32); let space = builder.get(); assert!(space.domain().get_dim_kind(d0[0]).contains(DimKind::UNROLL)); assert!(!space.domain().get_dim_kind(d1[0]).contains(DimKind::UNROLL)); assert!(!space.domain().get_dim_kind(d2[0]).contains(DimKind::UNROLL)); gen_best(&context, space); } /// Ensures the invariants on dimensions that carry reductions are respected. #[test] fn reduce_dim_invariants() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let init = builder.cast(&0i64, context.device().pointer_type(MemSpace::GLOBAL)); let d0 = builder.open_dim(Size::new_const(4)); let pattern = ir::AccessPattern::Unknown(None); let reduce = builder.ld(Type::I(64), &helper::Reduce(init), pattern); builder.close_dim(&d0); let d1 = builder.open_dim(Size::new_const(4)); builder.action(Action::IsIterationDim(reduce, d1[0], Bool::TRUE)); builder.close_dim(&d1); let d2 = builder.open_dim(Size::new_const(4)); builder.mov(&0i32); builder.order(&d2, &init, !Order::OUTER); let space = builder.get(); assert_eq!( space.domain().get_dim_kind(d0[0]), DimKind::LOOP | DimKind::UNROLL ); assert_eq!( space.domain().get_order(d0[0].into(), init.into()), Order::AFTER ); assert!(Order::OUTER.contains(space.domain().get_order(d1[0].into(), init.into()))); assert_eq!( space.domain().get_is_iteration_dim(reduce, d2[0]), Bool::FALSE ); gen_best(&context, space); } /// Ensures the renaming triggered by a thread creation work properly. #[test] fn rename_thread() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d_n_1 = &builder.open_dim_ex(Size::new_const(8), DimKind::THREAD); builder.mov(&0i32); builder.mov(d_n_1); gen_best(&context, builder.get()); } /// Ensures dimension merging occurs corectly. #[test] fn dim_merge() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim_ex(Size::new_const(4), DimKind::LOOP); builder.mov(&0i32); let d1 = builder.open_dim_ex(Size::new_const(4), DimKind::LOOP); builder.order(&d0, &d1, Order::MERGED); gen_best(&context, builder.get()); } /// Ensure loop fusion, with dependent instructions, occurs correctly. #[test] fn loop_fusion() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim_ex(Size::new_const(4), DimKind::LOOP); let inst0 = builder.mov(&0i32); let d1 = builder.open_mapped_dim(&d0); builder.mov(&inst0); builder.order(&d0, &d1, Order::MERGED); // Ensure no temporary memory has been generated. let instance = builder.get(); assert_eq!(instance.ir_instance().insts().count(), 2); gen_best(&context, instance); } /// Ensure un-fused unrolled loops are correctly handled. #[test] fn unrolled_loop_unfused_simple() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim_ex(Size::new_const(4), DimKind::UNROLL); let inst0 = builder.mov(&0i32); let d1 = builder.open_mapped_dim(&d0); builder.mov(&inst0); builder.order(&d0, &d1, !Order::MERGED); // Ensure no temporary memory has been generated. let instance = builder.get(); assert_eq!(instance.ir_instance().insts().count(), 2); gen_best(&context, instance); } /// Ensure temporary memory is generated when needed. #[test] fn temporary_memory_gen_simple() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim_ex(Size::new_const(4), DimKind::LOOP); let inst0 = builder.mov(&0i32); let d1 = builder.open_mapped_dim(&d0); builder.mov(&helper::TmpArray(inst0)); builder.order(&d0, &d1, !Order::MERGED); // Ensure load and store instruction have been generated. let instance = builder.get(); assert!(instance.ir_instance().insts().count() >= 4); gen_best(&context, instance); } /// Ensures un-fused loops are correctly handle in persence of reduction. #[test] fn unrolled_loop_unfused_reduction() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let d0 = builder.open_dim_ex(ir::Size::new_const(4), DimKind::UNROLL); let inst0 = builder.mov(&0i32); builder.open_mapped_dim(&d0); let d1 = builder.open_dim_ex(ir::Size::new_const(1024), DimKind::LOOP); builder.mov(&helper::Reduce(inst0)); builder.order(&d0, &d1, Order::BEFORE); // Ensure not temporary memory has been generated. let instance = builder.get(); assert_eq!(instance.ir_instance().insts().count(), 2); gen_best(&context, instance); } #[test] fn two_thread_dim_map() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); // Generate a variable in each thread. let dim0_0 = builder.open_dim_ex(ir::Size::new_const(32), DimKind::THREAD); let dim0_1 = builder.open_dim_ex(ir::Size::new_const(32), DimKind::THREAD); let x = builder.mov(&0i32); // Transpose twice the variable using temporary memory. let dim1_0 = builder.open_mapped_dim(&dim0_1); let dim1_1 = builder.open_mapped_dim(&dim0_0); builder.mov(&helper::TmpArray(x)); // Set the nesting order. builder.order(&dim0_0, &dim0_1, Order::OUTER); builder.order(&dim1_0, &dim1_1, Order::OUTER); gen_best(&context, builder.get()); } #[test] fn double_dim_map() { // FIXME: investigate Failed lowering that should be cut earlier let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); // Load from a and b. let dim0_0 = builder.open_dim_ex(ir::Size::new_const(32), DimKind::THREAD); let dim0_1 = builder.open_dim_ex(ir::Size::new_const(32), DimKind::THREAD); let dim0_2 = builder.open_dim_ex(ir::Size::new_const(4), DimKind::UNROLL); let x = builder.mov(&0i32); // Transpose and add a and b. Store the result in a. let dim1_0 = builder.open_mapped_dim(&dim0_1); let dim1_1 = builder.open_mapped_dim(&dim0_0); let dim1_2 = builder.open_mapped_dim(&dim0_2); builder.mov(&x); builder.mov(&x); // Fix the nesting order. builder.order(&dim0_0, &dim0_1, Order::OUTER); builder.order(&dim0_1, &dim0_2, Order::OUTER); builder.order(&dim1_0, &dim1_1, Order::OUTER); builder.order(&dim1_1, &dim1_2, Order::OUTER); //gen_best(&context, builder.get()); } /// Ensures mapping multiple dimensions to the same vectorization level works. #[test] fn multi_dim_to_same_vector_level() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); builder.open_dim_ex(ir::Size::new_const(2), DimKind::INNER_VECTOR); builder.open_dim_ex(ir::Size::new_const(4), DimKind::INNER_VECTOR); let inner = builder.open_dim_ex(ir::Size::new_const(4), DimKind::VECTOR); builder.add(&0i32, &0i32); // Ensure the search space is valid. let space = builder.get(); // Ensure the total vector size constraint is respected. assert_eq!(space.domain().get_dim_kind(inner[0]), DimKind::OUTER_VECTOR); // Try to generate a specfied candidate. gen_best(&context, space); } /// Ensures the two levels of vectorization work correctly. #[test] fn two_level_vectorization() { let _ = env_logger::try_init(); let context = fake::Context::<fake::Device>::default(); let signature = ir::Signature::new("empty"); let mut builder = helper::Builder::new(signature.into(), context.device()); let inner_vec = builder.open_dim_ex(ir::Size::new_const(2), DimKind::INNER_VECTOR); let outer_vec = builder.open_dim_ex(ir::Size::new_const(2), DimKind::OUTER_VECTOR); let not_a_vec = builder.open_dim_ex(ir::Size::new_const(2), DimKind::LOOP); builder.add(&0i32, &0i32); // Ensure the search space is valid. let space = builder.get(); // Ensure nesting constraints are enforced. let not_a_vec_id = not_a_vec[0].into(); let outer_vec_id = outer_vec[0].into(); let inner_vec_id = inner_vec[0].into(); assert_eq!( space.domain().get_order(not_a_vec_id, outer_vec_id), Order::OUTER ); assert_eq!( space.domain().get_order(outer_vec_id, inner_vec_id), Order::OUTER ); // Try to generate a fully specified candidate. gen_best(&context, space); }
use fuzzcheck::DefaultMutator; #[derive(Clone, DefaultMutator)] pub struct X; #[derive(Clone, DefaultMutator)] pub struct Y {} #[derive(Clone, DefaultMutator)] pub struct Z();
use itertools::Itertools; use multimap::MultiMap; use regex::{Captures, Regex}; use std::fmt; use lazy_static::lazy_static; // 1.3.0 type BagSpec<'a> = (&'a str, &'a str); type Rules<'a> = MultiMap<BagSpec<'a>, (usize, BagSpec<'a>)>; lazy_static! { static ref shiny_gold: Regex = Regex::new(r"(?m)(\w+\s\w+)\sbags\s*contain\s*(\d\s*\w+\s\w+\sbags?,?\s*)*(\d\s*(shiny gold)\sbags?,?\s*)+(\d\s*\w+\s\w+\sbags?,?\s*)").unwrap(); static ref RULE: Regex = Regex::new(r"(?m)(\w+)\s(\w+)\sbags\s*contain\s*((\d)\s*(\w+\s\w+)\sbags?,?\s*\.?)+").unwrap(); } fn parse_rules(input: &str) -> Rules<'_> { let mut rules: Rules = Default::default(); peg::parser! { pub(crate) grammar parser() for str { pub(crate) rule root(r: &mut Rules<'input>) = (line(r) "." whitespace()*)* ![_] rule line(r: &mut Rules<'input>) = spec:bag_spec() " contain " rules:rules() { if let Some(rules) = rules { for rule in rules { r.insert(spec, rule) } } } rule bag_spec() -> BagSpec<'input> = adjective:name() " " color:name() " bag" "s"? { (adjective, color) } rule rules() -> Option<Vec<(usize, BagSpec<'input>)>> = rules:rule1()+ { Some(rules) } / "no other bags" { None } /// Rule followed by an optional comma and space rule rule1() -> (usize, BagSpec<'input>) = r:rule0() ", "? { r } /// A single rule rule rule0() -> (usize, BagSpec<'input>) = quantity:number() " " spec:bag_spec() { (quantity, spec) } rule number() -> usize = e:$(['0'..='9']+) { e.parse().unwrap() } /// A sequence of non-whitespace characters rule name() -> &'input str = $((!whitespace()[_])*) /// Spaces, tabs, CR and LF rule whitespace() = [' ' | '\t' | '\r' | '\n'] } } parser::root(input, &mut rules).unwrap(); rules } fn extract_color(text: &str) -> Result<String, &'static str> { match shiny_gold.captures_iter(text).next() { Some(cap) => { // println!(" cap[2] {}", cap[1].to_owned()); Ok(cap[1].to_owned()) } _ => Err("color not found"), } } fn parse_rules2(input: &str) -> Rules<'_> { let mut rules: Rules = Default::default(); input .split("\n") .map(|row| { println!(" -------------------- row {}", row); RULE.captures_iter(row).for_each(|cap| { println!(" cap {:?}", cap); println!( " colors {} {} --> {} {} ", &cap[1], &cap[2], &cap[4], &cap[5], ); }); rules.insert(("light", "red"), (1, ("bright", "white"))); }) .for_each(|c| {}); rules } struct FormattedRules<'a>(Rules<'a>); impl fmt::Display for FormattedRules<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for (k, vv) in &self.0 { write!(f, "{} {} bags can contain ", k.0, k.1)?; if vv.is_empty() { write!(f, "no other bags")?; } else { for (i, v) in vv.iter().enumerate() { if i > 0 { write!(f, ", ")?; } write!( f, "{} {} {} {}", v.0, v.1 .0, v.1 .1, if v.0 == 1 { "bag" } else { "bags" } )?; } } writeln!(f, ".")?; } Ok(()) } } fn subgraph_contains(graph: &Rules<'_>, root: &(&str, &str), needle: &(&str, &str)) -> bool { graph .get_vec(root) .unwrap_or(&Default::default()) .iter() .any(|(_, neighbor)| neighbor == needle || subgraph_contains(graph, neighbor, needle)) } pub fn day_seven() { let rules = parse_rules(include_str!("../day7.txt")); let needle = &("shiny", "gold"); let colors_that_contain_shiny_gold: Vec<_> = rules .keys() // shiny gold bags are already shiny god, we're not interested // in what they can contain (as per the example) .filter(|&k| k != needle) .filter(|&k| subgraph_contains(&rules, k, needle)) .collect(); println!( "{:?} {}", colors_that_contain_shiny_gold, colors_that_contain_shiny_gold.len() ); // parse_rules(include_str!("../day7.txt")); // let count: Vec<String> = include_str!("../day7.txt") // .split("\n") // .map(|row| extract_color(row)) // .filter(Result::is_ok) // .map(|r| r.unwrap()) // .inspect(|c| { // println!(" {}", c); // }) // .sorted() // .dedup() // .collect(); //println!(" colors {:?}", count); }
use std::fs; use std::path::PathBuf; use anyhow::anyhow; use anyhow::Context as _; use anyhow::Result; use async_std::task; use clap::Clap; fn main() -> Result<()> { pretty_env_logger::init(); task::block_on(run()) } #[derive(Clap)] enum EncDec { Encrypt, Decryp, } #[derive(Clap)] #[clap(author, about, version, group = clap::ArgGroup::new("mode").required(true))] struct Opts { /// forward data over an encrypted connection #[clap(short, long, group = "mode", conflicts_with = "decrypt")] encrypt: bool, /// decrypt data from a encrypt, and forward it #[clap(short, long, group = "mode")] #[allow(dead_code)] decrypt: bool, /// key for encryption and authentication #[clap(short, long, value_name = "FILE")] key_file: PathBuf, /// listen for connections #[clap(short, long, value_name = "IP:PORT")] source: String, /// make connections to #[clap(short, long, value_name = "HOST:PORT")] target: String, /// drop privileges after binding #[clap(short, long, value_name = "USER:GROUP")] uid: Option<String>, } async fn run() -> Result<()> { let matches: Opts = Opts::parse(); assert!(matches.uid.is_none(), "-u unsupported"); let key = { let file = fs::File::open(&matches.key_file) .with_context(|| anyhow!("opening key {:?}", matches.key_file))?; septid::MasterKey::from_reader(file)? }; let command = septid::server::start_server(&septid::server::StartServer { bind_address: vec![matches.source], encrypt: matches.encrypt, key, target_address: vec![matches.target], }) .await?; // let command = Cell::new(Some(command)); // // ctrlc::set_handler(move || { // if let Some(mut command) = command.take() { // unimplemented!(); //// command.request_shutdown() //// .expect("we're the only sender; maybe the server is already gone?"); // } // })?; command.run_to_completion().await?; Ok(()) }
//! gRPC service implementations for `ingester`. mod persist; mod query; mod rpc_write; use std::{fmt::Debug, sync::Arc}; use iox_catalog::interface::Catalog; use service_grpc_catalog::CatalogService; use crate::{ dml_sink::DmlSink, ingest_state::IngestState, ingester_id::IngesterId, init::IngesterRpcInterface, partition_iter::PartitionIter, persist::queue::PersistQueue, query::{response::QueryResponse, QueryExec}, timestamp_oracle::TimestampOracle, }; use self::{persist::PersistHandler, rpc_write::RpcWrite}; /// This type is responsible for injecting internal dependencies that SHOULD NOT /// leak outside of the ingester crate into public gRPC handlers. /// /// Configuration and external dependencies SHOULD be injected through the /// respective gRPC handler constructor method. #[derive(Debug)] pub(crate) struct GrpcDelegate<D, Q, T, P> { dml_sink: Arc<D>, query_exec: Arc<Q>, timestamp: Arc<TimestampOracle>, ingest_state: Arc<IngestState>, ingester_id: IngesterId, catalog: Arc<dyn Catalog>, metrics: Arc<metric::Registry>, buffer: Arc<T>, persist_handle: Arc<P>, } impl<D, Q, T, P> GrpcDelegate<D, Q, T, P> where D: DmlSink + 'static, Q: QueryExec<Response = QueryResponse> + 'static, T: PartitionIter + Sync + 'static, P: PersistQueue + Sync + 'static, { /// Initialise a new [`GrpcDelegate`]. #[allow(clippy::too_many_arguments)] pub(crate) fn new( dml_sink: Arc<D>, query_exec: Arc<Q>, timestamp: Arc<TimestampOracle>, ingest_state: Arc<IngestState>, ingester_id: IngesterId, catalog: Arc<dyn Catalog>, metrics: Arc<metric::Registry>, buffer: Arc<T>, persist_handle: Arc<P>, ) -> Self { Self { dml_sink, query_exec, timestamp, ingest_state, ingester_id, catalog, metrics, buffer, persist_handle, } } } /// Implement the type-erasure trait to hide internal types from crate-external /// callers. impl<D, Q, T, P> IngesterRpcInterface for GrpcDelegate<D, Q, T, P> where D: DmlSink + 'static, Q: QueryExec<Response = QueryResponse> + 'static, T: PartitionIter + Sync + 'static, P: PersistQueue + Sync + 'static, { type CatalogHandler = CatalogService; type WriteHandler = RpcWrite<Arc<D>>; type PersistHandler = PersistHandler<Arc<T>, Arc<P>>; type FlightHandler = query::FlightService<Arc<Q>>; /// Acquire a [`CatalogService`] gRPC service implementation. /// /// [`CatalogService`]: generated_types::influxdata::iox::catalog::v1::catalog_service_server::CatalogService. fn catalog_service(&self) -> Self::CatalogHandler { CatalogService::new(Arc::clone(&self.catalog)) } /// Return a [`WriteService`] gRPC implementation. /// /// [`WriteService`]: generated_types::influxdata::iox::ingester::v1::write_service_server::WriteService. fn write_service(&self) -> Self::WriteHandler { RpcWrite::new( Arc::clone(&self.dml_sink), Arc::clone(&self.timestamp), Arc::clone(&self.ingest_state), ) } /// Return a [`PersistService`] gRPC implementation. /// /// [`PersistService`]: generated_types::influxdata::iox::ingester::v1::persist_service_server::PersistService. fn persist_service(&self) -> Self::PersistHandler { PersistHandler::new( Arc::clone(&self.buffer), Arc::clone(&self.persist_handle), Arc::clone(&self.catalog), ) } /// Return an Arrow [`FlightService`] gRPC implementation. /// /// [`FlightService`]: arrow_flight::flight_service_server::FlightService fn query_service(&self, max_simultaneous_requests: usize) -> Self::FlightHandler { query::FlightService::new( Arc::clone(&self.query_exec), self.ingester_id, max_simultaneous_requests, &self.metrics, ) } }
use actix_web::{FromRequest, HttpResponse, HttpRequest, dev}; use crate::utils::jwt::decode_token; use crate::models::user::SlimUser; use actix_web_httpauth::extractors::bearer::BearerAuth; pub type LoggedUser = SlimUser; impl FromRequest for LoggedUser { type Error = HttpResponse; type Future = Result<Self, HttpResponse>; type Config = (); fn from_request(req: &HttpRequest, _payload: &mut dev::Payload) -> Self::Future { let token = match BearerAuth::extract(req) { Ok(t) => Some(t.token().to_string()), Err(_) => None }; // TODO: Send a Result<LoggedUser, ServiceError> to Context match token { None => return Ok(LoggedUser { email: None }), Some(token) => { match decode_token(&token) { Ok(decoded) => Ok(decoded as LoggedUser), Err(_) => return Ok(LoggedUser { email: None }), } } } } }
use rskafka_wire_format::{error::ParseError, prelude::*}; use std::borrow::Cow; #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub enum ErrorCode { UnknownServerError, None, OffsetOutOfRange, CorruptMessage, UnknownTopicOrPartition, InvalidFetchSize, LeaderNotAvailable, NotLeaderForPartition, RequestTimedOut, BrokerNotAvailable, ReplicaNotAvailable, MessageTooLarge, StaleControllerEpoch, OffsetMetadataTooLarge, NetworkException, CoordinatorLoadInProgress, CoordinatorNotAvailable, NotCoordinator, InvalidTopicException, RecordListTooLarge, NotEnoughReplicas, NotEnoughReplicasAfterAppend, InvalidRequiredAcks, IllegalGeneration, InconsistentGroupProtocol, InvalidGroupId, UnknownMemberId, InvalidSessionTimeout, RebalanceInProgress, InvalidCommitOffsetSize, TopicAuthorizationFailed, GroupAuthorizationFailed, ClusterAuthorizationFailed, InvalidTimestamp, UnsupportedSaslMechanism, IllegalSaslState, UnsupportedVersion, TopicAlreadyExists, InvalidPartitions, InvalidReplicationFactor, InvalidReplicaAssignment, InvalidConfig, NotController, InvalidRequest, UnsupportedForMessageFormat, PolicyViolation, OutOfOrderSequenceNumber, DuplicateSequenceNumber, InvalidProducerEpoch, InvalidTxnState, InvalidProducerIdMapping, InvalidTransactionTimeout, ConcurrentTransactions, TransactionCoordinatorFenced, TransactionalIdAuthorizationFailed, SecurityDisabled, OperationNotAttempted, KafkaStorageError, LogDirNotFound, SaslAuthenticationFailed, UnknownProducerId, ReassignmentInProgress, DelegationTokenAuthDisabled, DelegationTokenNotFound, DelegationTokenOwnerMismatch, DelegationTokenRequestNotAllowed, DelegationTokenAuthorizationFailed, DelegationTokenExpired, InvalidPrincipalType, NonEmptyGroup, GroupIdNotFound, FetchSessionIdNotFound, InvalidFetchSessionEpoch, ListenerNotFound, TopicDeletionDisabled, FencedLeaderEpoch, UnknownLeaderEpoch, UnsupportedCompressionType, StaleBrokerEpoch, OffsetNotAvailable, MemberIdRequired, PreferredLeaderNotAvailable, GroupMaxSizeReached, FencedInstanceId, EligibleLeadersNotAvailable, ElectionNotNeeded, NoReassignmentInProgress, GroupSubscribedToTopic, InvalidRecord, UnstableOffsetCommit, Unknown(i16), } impl ErrorCode { pub fn to_i16(&self) -> i16 { match self { ErrorCode::UnknownServerError => -1, ErrorCode::None => 0, ErrorCode::OffsetOutOfRange => 1, ErrorCode::CorruptMessage => 2, ErrorCode::UnknownTopicOrPartition => 3, ErrorCode::InvalidFetchSize => 4, ErrorCode::LeaderNotAvailable => 5, ErrorCode::NotLeaderForPartition => 6, ErrorCode::RequestTimedOut => 7, ErrorCode::BrokerNotAvailable => 8, ErrorCode::ReplicaNotAvailable => 9, ErrorCode::MessageTooLarge => 10, ErrorCode::StaleControllerEpoch => 11, ErrorCode::OffsetMetadataTooLarge => 12, ErrorCode::NetworkException => 13, ErrorCode::CoordinatorLoadInProgress => 14, ErrorCode::CoordinatorNotAvailable => 15, ErrorCode::NotCoordinator => 16, ErrorCode::InvalidTopicException => 17, ErrorCode::RecordListTooLarge => 18, ErrorCode::NotEnoughReplicas => 19, ErrorCode::NotEnoughReplicasAfterAppend => 20, ErrorCode::InvalidRequiredAcks => 21, ErrorCode::IllegalGeneration => 22, ErrorCode::InconsistentGroupProtocol => 23, ErrorCode::InvalidGroupId => 24, ErrorCode::UnknownMemberId => 25, ErrorCode::InvalidSessionTimeout => 26, ErrorCode::RebalanceInProgress => 27, ErrorCode::InvalidCommitOffsetSize => 28, ErrorCode::TopicAuthorizationFailed => 29, ErrorCode::GroupAuthorizationFailed => 30, ErrorCode::ClusterAuthorizationFailed => 31, ErrorCode::InvalidTimestamp => 32, ErrorCode::UnsupportedSaslMechanism => 33, ErrorCode::IllegalSaslState => 34, ErrorCode::UnsupportedVersion => 35, ErrorCode::TopicAlreadyExists => 36, ErrorCode::InvalidPartitions => 37, ErrorCode::InvalidReplicationFactor => 38, ErrorCode::InvalidReplicaAssignment => 39, ErrorCode::InvalidConfig => 40, ErrorCode::NotController => 41, ErrorCode::InvalidRequest => 42, ErrorCode::UnsupportedForMessageFormat => 43, ErrorCode::PolicyViolation => 44, ErrorCode::OutOfOrderSequenceNumber => 45, ErrorCode::DuplicateSequenceNumber => 46, ErrorCode::InvalidProducerEpoch => 47, ErrorCode::InvalidTxnState => 48, ErrorCode::InvalidProducerIdMapping => 49, ErrorCode::InvalidTransactionTimeout => 50, ErrorCode::ConcurrentTransactions => 51, ErrorCode::TransactionCoordinatorFenced => 52, ErrorCode::TransactionalIdAuthorizationFailed => 53, ErrorCode::SecurityDisabled => 54, ErrorCode::OperationNotAttempted => 55, ErrorCode::KafkaStorageError => 56, ErrorCode::LogDirNotFound => 57, ErrorCode::SaslAuthenticationFailed => 58, ErrorCode::UnknownProducerId => 59, ErrorCode::ReassignmentInProgress => 60, ErrorCode::DelegationTokenAuthDisabled => 61, ErrorCode::DelegationTokenNotFound => 62, ErrorCode::DelegationTokenOwnerMismatch => 63, ErrorCode::DelegationTokenRequestNotAllowed => 64, ErrorCode::DelegationTokenAuthorizationFailed => 65, ErrorCode::DelegationTokenExpired => 66, ErrorCode::InvalidPrincipalType => 67, ErrorCode::NonEmptyGroup => 68, ErrorCode::GroupIdNotFound => 69, ErrorCode::FetchSessionIdNotFound => 70, ErrorCode::InvalidFetchSessionEpoch => 71, ErrorCode::ListenerNotFound => 72, ErrorCode::TopicDeletionDisabled => 73, ErrorCode::FencedLeaderEpoch => 74, ErrorCode::UnknownLeaderEpoch => 75, ErrorCode::UnsupportedCompressionType => 76, ErrorCode::StaleBrokerEpoch => 77, ErrorCode::OffsetNotAvailable => 78, ErrorCode::MemberIdRequired => 79, ErrorCode::PreferredLeaderNotAvailable => 80, ErrorCode::GroupMaxSizeReached => 81, ErrorCode::FencedInstanceId => 82, ErrorCode::EligibleLeadersNotAvailable => 83, ErrorCode::ElectionNotNeeded => 84, ErrorCode::NoReassignmentInProgress => 85, ErrorCode::GroupSubscribedToTopic => 86, ErrorCode::InvalidRecord => 87, ErrorCode::UnstableOffsetCommit => 88, ErrorCode::Unknown(code) => *code, } } pub fn from_i16(v: i16) -> Self { match v { -1 => ErrorCode::UnknownServerError, 0 => ErrorCode::None, 1 => ErrorCode::OffsetOutOfRange, 2 => ErrorCode::CorruptMessage, 3 => ErrorCode::UnknownTopicOrPartition, 4 => ErrorCode::InvalidFetchSize, 5 => ErrorCode::LeaderNotAvailable, 6 => ErrorCode::NotLeaderForPartition, 7 => ErrorCode::RequestTimedOut, 8 => ErrorCode::BrokerNotAvailable, 9 => ErrorCode::ReplicaNotAvailable, 10 => ErrorCode::MessageTooLarge, 11 => ErrorCode::StaleControllerEpoch, 12 => ErrorCode::OffsetMetadataTooLarge, 13 => ErrorCode::NetworkException, 14 => ErrorCode::CoordinatorLoadInProgress, 15 => ErrorCode::CoordinatorNotAvailable, 16 => ErrorCode::NotCoordinator, 17 => ErrorCode::InvalidTopicException, 18 => ErrorCode::RecordListTooLarge, 19 => ErrorCode::NotEnoughReplicas, 20 => ErrorCode::NotEnoughReplicasAfterAppend, 21 => ErrorCode::InvalidRequiredAcks, 22 => ErrorCode::IllegalGeneration, 23 => ErrorCode::InconsistentGroupProtocol, 24 => ErrorCode::InvalidGroupId, 25 => ErrorCode::UnknownMemberId, 26 => ErrorCode::InvalidSessionTimeout, 27 => ErrorCode::RebalanceInProgress, 28 => ErrorCode::InvalidCommitOffsetSize, 29 => ErrorCode::TopicAuthorizationFailed, 30 => ErrorCode::GroupAuthorizationFailed, 31 => ErrorCode::ClusterAuthorizationFailed, 32 => ErrorCode::InvalidTimestamp, 33 => ErrorCode::UnsupportedSaslMechanism, 34 => ErrorCode::IllegalSaslState, 35 => ErrorCode::UnsupportedVersion, 36 => ErrorCode::TopicAlreadyExists, 37 => ErrorCode::InvalidPartitions, 38 => ErrorCode::InvalidReplicationFactor, 39 => ErrorCode::InvalidReplicaAssignment, 40 => ErrorCode::InvalidConfig, 41 => ErrorCode::NotController, 42 => ErrorCode::InvalidRequest, 43 => ErrorCode::UnsupportedForMessageFormat, 44 => ErrorCode::PolicyViolation, 45 => ErrorCode::OutOfOrderSequenceNumber, 46 => ErrorCode::DuplicateSequenceNumber, 47 => ErrorCode::InvalidProducerEpoch, 48 => ErrorCode::InvalidTxnState, 49 => ErrorCode::InvalidProducerIdMapping, 50 => ErrorCode::InvalidTransactionTimeout, 51 => ErrorCode::ConcurrentTransactions, 52 => ErrorCode::TransactionCoordinatorFenced, 53 => ErrorCode::TransactionalIdAuthorizationFailed, 54 => ErrorCode::SecurityDisabled, 55 => ErrorCode::OperationNotAttempted, 56 => ErrorCode::KafkaStorageError, 57 => ErrorCode::LogDirNotFound, 58 => ErrorCode::SaslAuthenticationFailed, 59 => ErrorCode::UnknownProducerId, 60 => ErrorCode::ReassignmentInProgress, 61 => ErrorCode::DelegationTokenAuthDisabled, 62 => ErrorCode::DelegationTokenNotFound, 63 => ErrorCode::DelegationTokenOwnerMismatch, 64 => ErrorCode::DelegationTokenRequestNotAllowed, 65 => ErrorCode::DelegationTokenAuthorizationFailed, 66 => ErrorCode::DelegationTokenExpired, 67 => ErrorCode::InvalidPrincipalType, 68 => ErrorCode::NonEmptyGroup, 69 => ErrorCode::GroupIdNotFound, 70 => ErrorCode::FetchSessionIdNotFound, 71 => ErrorCode::InvalidFetchSessionEpoch, 72 => ErrorCode::ListenerNotFound, 73 => ErrorCode::TopicDeletionDisabled, 74 => ErrorCode::FencedLeaderEpoch, 75 => ErrorCode::UnknownLeaderEpoch, 76 => ErrorCode::UnsupportedCompressionType, 77 => ErrorCode::StaleBrokerEpoch, 78 => ErrorCode::OffsetNotAvailable, 79 => ErrorCode::MemberIdRequired, 80 => ErrorCode::PreferredLeaderNotAvailable, 81 => ErrorCode::GroupMaxSizeReached, 82 => ErrorCode::FencedInstanceId, 83 => ErrorCode::EligibleLeadersNotAvailable, 84 => ErrorCode::ElectionNotNeeded, 85 => ErrorCode::NoReassignmentInProgress, 86 => ErrorCode::GroupSubscribedToTopic, 87 => ErrorCode::InvalidRecord, 88 => ErrorCode::UnstableOffsetCommit, other => ErrorCode::Unknown(other), } } } impl std::fmt::Display for ErrorCode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let text = match self { ErrorCode::UnknownServerError => Cow::Borrowed("UNKNOWN_SERVER_ERROR"), ErrorCode::None => Cow::Borrowed("NONE"), ErrorCode::OffsetOutOfRange => Cow::Borrowed("OFFSET_OUT_OF_RANGE"), ErrorCode::CorruptMessage => Cow::Borrowed("CORRUPT_MESSAGE"), ErrorCode::UnknownTopicOrPartition => Cow::Borrowed("UNKNOWN_TOPIC_OR_PARTITION"), ErrorCode::InvalidFetchSize => Cow::Borrowed("INVALID_FETCH_SIZE"), ErrorCode::LeaderNotAvailable => Cow::Borrowed("LEADER_NOT_AVAILABLE"), ErrorCode::NotLeaderForPartition => Cow::Borrowed("NOT_LEADER_FOR_PARTITION"), ErrorCode::RequestTimedOut => Cow::Borrowed("REQUEST_TIMED_OUT"), ErrorCode::BrokerNotAvailable => Cow::Borrowed("BROKER_NOT_AVAILABLE"), ErrorCode::ReplicaNotAvailable => Cow::Borrowed("REPLICA_NOT_AVAILABLE"), ErrorCode::MessageTooLarge => Cow::Borrowed("MESSAGE_TOO_LARGE"), ErrorCode::StaleControllerEpoch => Cow::Borrowed("STALE_CONTROLLER_EPOCH"), ErrorCode::OffsetMetadataTooLarge => Cow::Borrowed("OFFSET_METADATA_TOO_LARGE"), ErrorCode::NetworkException => Cow::Borrowed("NETWORK_EXCEPTION"), ErrorCode::CoordinatorLoadInProgress => Cow::Borrowed("COORDINATOR_LOAD_IN_PROGRESS"), ErrorCode::CoordinatorNotAvailable => Cow::Borrowed("COORDINATOR_NOT_AVAILABLE"), ErrorCode::NotCoordinator => Cow::Borrowed("NOT_COORDINATOR"), ErrorCode::InvalidTopicException => Cow::Borrowed("INVALID_TOPIC_EXCEPTION"), ErrorCode::RecordListTooLarge => Cow::Borrowed("RECORD_LIST_TOO_LARGE"), ErrorCode::NotEnoughReplicas => Cow::Borrowed("NOT_ENOUGH_REPLICAS"), ErrorCode::NotEnoughReplicasAfterAppend => { Cow::Borrowed("NOT_ENOUGH_REPLICAS_AFTER_APPEND") } ErrorCode::InvalidRequiredAcks => Cow::Borrowed("INVALID_REQUIRED_ACKS"), ErrorCode::IllegalGeneration => Cow::Borrowed("ILLEGAL_GENERATION"), ErrorCode::InconsistentGroupProtocol => Cow::Borrowed("INCONSISTENT_GROUP_PROTOCOL"), ErrorCode::InvalidGroupId => Cow::Borrowed("INVALID_GROUP_ID"), ErrorCode::UnknownMemberId => Cow::Borrowed("UNKNOWN_MEMBER_ID"), ErrorCode::InvalidSessionTimeout => Cow::Borrowed("INVALID_SESSION_TIMEOUT"), ErrorCode::RebalanceInProgress => Cow::Borrowed("REBALANCE_IN_PROGRESS"), ErrorCode::InvalidCommitOffsetSize => Cow::Borrowed("INVALID_COMMIT_OFFSET_SIZE"), ErrorCode::TopicAuthorizationFailed => Cow::Borrowed("TOPIC_AUTHORIZATION_FAILED"), ErrorCode::GroupAuthorizationFailed => Cow::Borrowed("GROUP_AUTHORIZATION_FAILED"), ErrorCode::ClusterAuthorizationFailed => Cow::Borrowed("CLUSTER_AUTHORIZATION_FAILED"), ErrorCode::InvalidTimestamp => Cow::Borrowed("INVALID_TIMESTAMP"), ErrorCode::UnsupportedSaslMechanism => Cow::Borrowed("UNSUPPORTED_SASL_MECHANISM"), ErrorCode::IllegalSaslState => Cow::Borrowed("ILLEGAL_SASL_STATE"), ErrorCode::UnsupportedVersion => Cow::Borrowed("UNSUPPORTED_VERSION"), ErrorCode::TopicAlreadyExists => Cow::Borrowed("TOPIC_ALREADY_EXISTS"), ErrorCode::InvalidPartitions => Cow::Borrowed("INVALID_PARTITIONS"), ErrorCode::InvalidReplicationFactor => Cow::Borrowed("INVALID_REPLICATION_FACTOR"), ErrorCode::InvalidReplicaAssignment => Cow::Borrowed("INVALID_REPLICA_ASSIGNMENT"), ErrorCode::InvalidConfig => Cow::Borrowed("INVALID_CONFIG"), ErrorCode::NotController => Cow::Borrowed("NOT_CONTROLLER"), ErrorCode::InvalidRequest => Cow::Borrowed("INVALID_REQUEST"), ErrorCode::UnsupportedForMessageFormat => { Cow::Borrowed("UNSUPPORTED_FOR_MESSAGE_FORMAT") } ErrorCode::PolicyViolation => Cow::Borrowed("POLICY_VIOLATION"), ErrorCode::OutOfOrderSequenceNumber => Cow::Borrowed("OUT_OF_ORDER_SEQUENCE_NUMBER"), ErrorCode::DuplicateSequenceNumber => Cow::Borrowed("DUPLICATE_SEQUENCE_NUMBER"), ErrorCode::InvalidProducerEpoch => Cow::Borrowed("INVALID_PRODUCER_EPOCH"), ErrorCode::InvalidTxnState => Cow::Borrowed("INVALID_TXN_STATE"), ErrorCode::InvalidProducerIdMapping => Cow::Borrowed("INVALID_PRODUCER_ID_MAPPING"), ErrorCode::InvalidTransactionTimeout => Cow::Borrowed("INVALID_TRANSACTION_TIMEOUT"), ErrorCode::ConcurrentTransactions => Cow::Borrowed("CONCURRENT_TRANSACTIONS"), ErrorCode::TransactionCoordinatorFenced => { Cow::Borrowed("TRANSACTION_COORDINATOR_FENCED") } ErrorCode::TransactionalIdAuthorizationFailed => { Cow::Borrowed("TRANSACTIONAL_ID_AUTHORIZATION_FAILED") } ErrorCode::SecurityDisabled => Cow::Borrowed("SECURITY_DISABLED"), ErrorCode::OperationNotAttempted => Cow::Borrowed("OPERATION_NOT_ATTEMPTED"), ErrorCode::KafkaStorageError => Cow::Borrowed("KAFKA_STORAGE_ERROR"), ErrorCode::LogDirNotFound => Cow::Borrowed("LOG_DIR_NOT_FOUND"), ErrorCode::SaslAuthenticationFailed => Cow::Borrowed("SASL_AUTHENTICATION_FAILED"), ErrorCode::UnknownProducerId => Cow::Borrowed("UNKNOWN_PRODUCER_ID"), ErrorCode::ReassignmentInProgress => Cow::Borrowed("REASSIGNMENT_IN_PROGRESS"), ErrorCode::DelegationTokenAuthDisabled => { Cow::Borrowed("DELEGATION_TOKEN_AUTH_DISABLED") } ErrorCode::DelegationTokenNotFound => Cow::Borrowed("DELEGATION_TOKEN_NOT_FOUND"), ErrorCode::DelegationTokenOwnerMismatch => { Cow::Borrowed("DELEGATION_TOKEN_OWNER_MISMATCH") } ErrorCode::DelegationTokenRequestNotAllowed => { Cow::Borrowed("DELEGATION_TOKEN_REQUEST_NOT_ALLOWED") } ErrorCode::DelegationTokenAuthorizationFailed => { Cow::Borrowed("DELEGATION_TOKEN_AUTHORIZATION_FAILED") } ErrorCode::DelegationTokenExpired => Cow::Borrowed("DELEGATION_TOKEN_EXPIRED"), ErrorCode::InvalidPrincipalType => Cow::Borrowed("INVALID_PRINCIPAL_TYPE"), ErrorCode::NonEmptyGroup => Cow::Borrowed("NON_EMPTY_GROUP"), ErrorCode::GroupIdNotFound => Cow::Borrowed("GROUP_ID_NOT_FOUND"), ErrorCode::FetchSessionIdNotFound => Cow::Borrowed("FETCH_SESSION_ID_NOT_FOUND"), ErrorCode::InvalidFetchSessionEpoch => Cow::Borrowed("INVALID_FETCH_SESSION_EPOCH"), ErrorCode::ListenerNotFound => Cow::Borrowed("LISTENER_NOT_FOUND"), ErrorCode::TopicDeletionDisabled => Cow::Borrowed("TOPIC_DELETION_DISABLED"), ErrorCode::FencedLeaderEpoch => Cow::Borrowed("FENCED_LEADER_EPOCH"), ErrorCode::UnknownLeaderEpoch => Cow::Borrowed("UNKNOWN_LEADER_EPOCH"), ErrorCode::UnsupportedCompressionType => Cow::Borrowed("UNSUPPORTED_COMPRESSION_TYPE"), ErrorCode::StaleBrokerEpoch => Cow::Borrowed("STALE_BROKER_EPOCH"), ErrorCode::OffsetNotAvailable => Cow::Borrowed("OFFSET_NOT_AVAILABLE"), ErrorCode::MemberIdRequired => Cow::Borrowed("MEMBER_ID_REQUIRED"), ErrorCode::PreferredLeaderNotAvailable => { Cow::Borrowed("PREFERRED_LEADER_NOT_AVAILABLE") } ErrorCode::GroupMaxSizeReached => Cow::Borrowed("GROUP_MAX_SIZE_REACHED"), ErrorCode::FencedInstanceId => Cow::Borrowed("FENCED_INSTANCE_ID"), ErrorCode::EligibleLeadersNotAvailable => { Cow::Borrowed("ELIGIBLE_LEADERS_NOT_AVAILABLE") } ErrorCode::ElectionNotNeeded => Cow::Borrowed("ELECTION_NOT_NEEDED"), ErrorCode::NoReassignmentInProgress => Cow::Borrowed("NO_REASSIGNMENT_IN_PROGRESS"), ErrorCode::GroupSubscribedToTopic => Cow::Borrowed("GROUP_SUBSCRIBED_TO_TOPIC"), ErrorCode::InvalidRecord => Cow::Borrowed("INVALID_RECORD"), ErrorCode::UnstableOffsetCommit => Cow::Borrowed("UNSTABLE_OFFSET_COMMIT"), ErrorCode::Unknown(code) => Cow::Owned(format!("{}", code)), }; f.write_str(text.as_ref()) } } impl<'a> WireFormatParse for ErrorCode { fn parse(input: &[u8]) -> IResult<&[u8], Self, ParseError> { let (input, v) = i16::parse(input)?; Ok((input, ErrorCode::from_i16(v))) } }
extern crate libloading as dlib; use std::env; use std::io::prelude::*; fn get_puzzle_string(input_string: &str) -> String { // Try reading as a file. If it fails then assume argument is the input string as is. match std::fs::File::open(input_string) { Ok(mut f) => { let mut puzzle_string = String::new(); f.read_to_string(&mut puzzle_string).expect("something went wrong reading the file"); puzzle_string.trim().to_owned() } Err(_) => { input_string.trim().to_string() } } } fn call_solution(day_number: i32, star_number:i32, input: &str) -> dlib::Result<String> { let lib_path = format!("target/debug/deps/libaoc2018_day{:02}.so",day_number); let dlib = dlib::Library::new(lib_path)?; unsafe { let func: dlib::Symbol<unsafe extern fn(i32,&str) -> String> = dlib.get(b"aoc_solution")?; Ok(func(star_number,input)) } } fn main() { let args: Vec<_> = env::args().collect(); if args.len() != 3 { panic!("Please provide the day# followed by the input or a file name"); } for star in 1..=2 { match call_solution(args[1].parse().unwrap(),star,&get_puzzle_string(&args[2])) { Ok(solution) => { println!("Star {}: {}",star,solution) }, Err(err) => { panic!(err.to_string()) } } } }
#[allow(unused_imports)] use proconio::{marker::*, *}; #[allow(unused_imports)] use std::{cmp::Ordering, convert::TryInto}; const W: usize = 1500; const H: usize = 1500; #[fastout] fn main() { input! { n: i32, range: [((usize, usize), (usize, usize)); n], } // x[y][x] = (y, x) の右/上との差分 let mut x = vec![vec![0; W + 2]; H + 2]; for ((top, left), (bottom, right)) in range { x[top][left] += 1; x[top][right] -= 1; x[bottom][left] -= 1; x[bottom][right] += 1; } // x[y][x] = (y + 0.5, x + 0.5) の紙の枚数 let x = x.cumlative_sum_in_place(); // eprintln!("{:?}", x); let ret = x .iter().take(H) .map(|row| row.iter().take(W).map(|&v| if v > 0 { 1 } else { 0 }).sum::<i32>()) .sum::<i32>(); println!("{}", ret); } pub trait CumlativeSum { /// 累積和を取る /// 返り値の先頭要素は番兵の 0 である。 fn cumlative_sum(&self) -> Self; /// in-place に累積和を取る fn cumlative_sum_in_place(&mut self) -> &Self; } impl CumlativeSum for Vec<i32> { fn cumlative_sum(&self) -> Self { let mut s = vec![0; self.len() + 1]; for (i, v) in self.iter().enumerate() { s[i + 1] = s[i] + v; } s } fn cumlative_sum_in_place(&mut self) -> &Self { let mut prev = *self.get(0).unwrap(); for v in self.iter_mut().skip(1) { *v += prev; prev = *v; } self } } impl CumlativeSum for Vec<Vec<i32>> { fn cumlative_sum(&self) -> Self { let h = self.len() as usize; let w = self.get(0).unwrap().len() as usize; let mut s = Vec::with_capacity(h + 1); s.push(vec![0; w + 1]); // 横方向合計 for xs in self.iter() { s.push(xs.cumlative_sum()); } // 縦方向合計 for c in 1..=w { for r in 1..=h { s[r][c] += s[r - 1][c]; } } s } fn cumlative_sum_in_place(&mut self) -> &Self { let h = self.len() as usize; let w = self.get(0).unwrap().len() as usize; // 横方向合計 for xs in self.iter_mut() { xs.cumlative_sum_in_place(); } // 縦方向合計 for c in 0..w { for r in 1..h { self[r][c] += self[r - 1][c]; } } self } }
use super::{log, log1p, sqrt}; const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa39ef*/ /// Inverse hyperbolic cosine (f64) /// /// Calculates the inverse hyperbolic cosine of `x`. /// Is defined as `log(x + sqrt(x*x-1))`. /// `x` must be a number greater than or equal to 1. #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn acosh(x: f64) -> f64 { let u = x.to_bits(); let e = ((u >> 52) as usize) & 0x7ff; /* x < 1 domain error is handled in the called functions */ if e < 0x3ff + 1 { /* |x| < 2, up to 2ulp error in [1,1.125] */ return log1p(x - 1.0 + sqrt((x - 1.0) * (x - 1.0) + 2.0 * (x - 1.0))); } if e < 0x3ff + 26 { /* |x| < 0x1p26 */ return log(2.0 * x - 1.0 / (x + sqrt(x * x - 1.0))); } /* |x| >= 0x1p26 or nan */ return log(x) + LN2; }
#![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces, unused_qualifications)] // `error_chain!` can recurse deeply #![recursion_limit = "1024"] //! Tools for interacting with LabVIEW and associated file formats extern crate chrono; #[macro_use] extern crate derive_more; extern crate env_logger; #[macro_use] extern crate error_chain; extern crate itertools; #[cfg(test)] #[macro_use] extern crate log; extern crate num; extern crate semver; extern crate serde; #[macro_use] extern crate serde_derive; #[macro_use] extern crate shrinkwraprs; extern crate strum; #[macro_use] extern crate strum_macros; /// Utilities for working with LVM data structures mod lvm; /// Internal lowlevel utilities for parsing and writing LVM files mod lvm_format; pub use lvm::*; #[allow(missing_docs)] mod errors { use itertools::Itertools; use super::*; error_chain! { errors { /// A deserialization error occurred Deserialize(s: String) { description("A deserialization error occurred") display("deserialization error: \"{}\"", s) } /// An invalid separator InvalidSeparator(c: char) { description("An invalid separator was used by the file") display("An invalid separator \"{}\" was used by the file", c) } /// An error occurred while parsing a floating-point number ParseFloatError(e: std::num::ParseFloatError) { description("An error occurred while parsing a floating-point number") display("parse floating-point error: \"{:?}\"", e) } /// An error occurred parsing a line ParseLine(l: usize) { description("An error occurred parsing a line") display("Error parsing line {}", l) } /// An unexpected character was found when attempting to parse a separator ParseSeparatorExpected(c: String, s: Separator) { description("An unexpected character was found when attempting to parse a separator") display("Unexpected character \"{}\" was found when attempting to parse a {} separator", c, s.as_ref()) } /// Trailing characters were found instead of the end of a line ParseEolExpected(s: String) { description("Trailing characters were found instead of the end of a line") display("Trailing characters \"{}\" were found instead of the end of a line", s) } /// The end of the file was encountered before parsing was finished ParseEofUnexpected { description("The end of the file was encountered before parsing was finished") display("The end of the file was encountered before parsing was finished") } /// the end of the line was encountered before parsing was finished ParseEolUnexpected { description("The end of the line was encountered before parsing was finished") display("The end of the line was encountered before parsing was finished") } /// The specified token was found when attempting to parse a specific token ParseTokenUnexpected(u: String, e: &'static [&'static str]) { description("The specified token was found when attempting to parse a specific token") display("\"{}\" was found instead of {}", u, e.iter().map(|s|format!("\"{}\"", s)).join(" or ")) } } foreign_links { Io(std::io::Error); ParseIntError(std::num::ParseIntError); } } } pub use errors::*; impl serde::de::Error for Error { fn custom<T: std::fmt::Display>(i_message: T) -> Self { ErrorKind::Deserialize(i_message.to_string()).into() } } pub use lvm_format::from_reader; #[cfg(test)] mod tests { #[test] fn lvm_parsing() { ::env_logger::init(); for de in ::std::fs::read_dir("data").unwrap() { let filepath = de.unwrap().path(); if filepath .file_name() .unwrap() .to_str() .unwrap() .starts_with(".") { continue; } info!("TESTING {:?}", filepath); for _ in 0..1 { match super::from_reader(::std::fs::File::open(filepath.clone()).unwrap()) { Ok(lvm_file) => { info!("{:#?}", lvm_file.header); for measurement in lvm_file.measurements { info!("{:#?}", measurement.header); } } Err(e) => { info!("{}", e); for e in e.iter().skip(1) { info!("caused by: {}", e); } if let Some(backtrace) = e.backtrace() { info!("{:?}", backtrace); } panic!("FAILURE"); } } } } } }
use crate::feature; use crate::runtime::{MachineTrap, Runtime, SupervisorContext}; use core::{ ops::{Generator, GeneratorState}, pin::Pin, }; use riscv::register::{mie, mip}; pub fn execute_supervisor(supervisor_mepc: usize, a0: usize, a1: usize) -> ! { let mut rt = Runtime::new_sbi_supervisor(supervisor_mepc, a0, a1); loop { match Pin::new(&mut rt).resume(()) { GeneratorState::Yielded(MachineTrap::SbiCall()) => { let ctx = rt.context_mut(); let param = [ctx.a0, ctx.a1, ctx.a2, ctx.a3, ctx.a4]; let ans = rustsbi::ecall(ctx.a7, ctx.a6, param); ctx.a0 = ans.error; ctx.a1 = ans.value; ctx.mepc = ctx.mepc.wrapping_add(4); } GeneratorState::Yielded(MachineTrap::IllegalInstruction()) => { let ctx = rt.context_mut(); // FIXME: get_vaddr_u32这个过程可能出错。 let ins = unsafe { get_vaddr_u32(ctx.mepc) } as usize; if !emulate_illegal_instruction(ctx, ins) { unsafe { if should_transfer_illegal_instruction(ctx) { do_transfer_illegal_instruction(ctx) } else { fail_illegal_instruction(ctx, ins) } } } } GeneratorState::Yielded(MachineTrap::MachineTimer()) => unsafe { mip::set_stimer(); mie::clear_mtimer(); }, GeneratorState::Complete(()) => { use rustsbi::Reset; crate::test_device::Reset.system_reset( rustsbi::reset::RESET_TYPE_SHUTDOWN, rustsbi::reset::RESET_REASON_NO_REASON, ); } } } } #[inline] unsafe fn get_vaddr_u32(vaddr: usize) -> u32 { let mut ans: u32; asm!(" li {tmp}, (1 << 17) csrrs {tmp}, mstatus, {tmp} lwu {ans}, 0({vaddr}) csrw mstatus, {tmp} ", tmp = out(reg) _, vaddr = in(reg) vaddr, ans = lateout(reg) ans ); ans } fn emulate_illegal_instruction(ctx: &mut SupervisorContext, ins: usize) -> bool { if feature::emulate_rdtime(ctx, ins) { return true; } false } unsafe fn should_transfer_illegal_instruction(ctx: &mut SupervisorContext) -> bool { use riscv::register::mstatus::MPP; ctx.mstatus.mpp() != MPP::Machine } unsafe fn do_transfer_illegal_instruction(ctx: &mut SupervisorContext) { use riscv::register::{ mstatus::{self, MPP, SPP}, mtval, scause, sepc, stval, stvec, }; // 设置S层异常原因为:非法指令 scause::set(scause::Trap::Exception( scause::Exception::IllegalInstruction, )); // 填写异常指令的指令内容 stval::write(mtval::read()); // 填写S层需要返回到的地址,这里的mepc会被随后的代码覆盖掉 sepc::write(ctx.mepc); // 设置中断位 mstatus::set_mpp(MPP::Supervisor); mstatus::set_spp(SPP::Supervisor); if mstatus::read().sie() { mstatus::set_spie() } mstatus::clear_sie(); ctx.mstatus = mstatus::read(); // 设置返回地址,返回到S层 // 注意,无论是Direct还是Vectored模式,所有异常的向量偏移都是0,不需要处理中断向量,跳转到入口地址即可 ctx.mepc = stvec::read().address(); } // 真·非法指令异常,是M层出现的 fn fail_illegal_instruction(ctx: &mut SupervisorContext, ins: usize) -> ! { #[cfg(target_pointer_width = "64")] panic!("invalid instruction from machine level, mepc: {:016x?}, instruction: {:016x?}, context: {:016x?}", ctx.mepc, ins, ctx); #[cfg(target_pointer_width = "32")] panic!("invalid instruction from machine level, mepc: {:08x?}, instruction: {:08x?}, context: {:08x?}", ctx.mepc, ins, ctx); }
pub struct Scalar { value: f64, speed: f64, state: ScalarState, } #[derive(Clone, Copy, Eq, PartialEq)] pub enum ScalarState { Constant, Increasing, Decreasing, } impl Scalar { pub fn new(value: f64, speed: f64) -> Scalar { Scalar { value, speed, state: ScalarState::Constant, } } pub fn value(&self) -> f64 { self.value } pub fn set_state(&mut self, state: ScalarState) { self.state = state; } pub fn unset_state(&mut self, state: ScalarState) { if self.state == state { self.state = ScalarState::Constant; } } pub fn update(&mut self) { self.value += match self.state { ScalarState::Constant => 0.0, ScalarState::Increasing => self.speed, ScalarState::Decreasing => -self.speed, }; } }
/* */ use crate::core::depsgraph::{ slot::Slot, trait_node::{Node, SlotTypes}, }; use crate::core::{ context::{ptype::PType, Context}, utils::typedefs::Key, }; use std::{ collections::{BTreeMap, BTreeSet}, sync::Arc, }; use super::interface::Interface; /* Please keep in mind, this graph is a directed graph. While data might flow from one node output to another node input, the graphs connections are managed the opposite direction. The root of the graph is the output node. Only nodes which do have a path to the output node are used in evaluation. */ pub struct Graph { key_counter: Key, nodes: BTreeMap<Key, Arc<dyn Node>>, ref_node_input: Key, ref_node_output: Key, } impl Graph { pub fn new() -> Self { let input = Interface::new(); // TODO let output = Interface::new(); // TODO let nodes = BTreeMap::new(); // Node 0 is input node // Node 1 is output node nodes.insert(0,input); nodes.insert(1,output); Graph { key_counter: 2, nodes: nodes, ref_node_input: 0, ref_node_output: 0 } } } impl Node for Graph { fn eval( &self, context: Context, input: Vec<Slot>, ) -> Vec<Slot> { todo!() } fn get_input_slot_types(&self) -> &SlotTypes { let out_node = self.nodes[&self.ref_node_input].as_ref(); out_node.get_output_slot_types() } fn get_output_slot_types(&self) -> &SlotTypes { let out_node = self.nodes[&self.ref_node_output].as_ref(); out_node.get_input_slot_types() } }
use crate::auth; use crate::handlers::types::*; use crate::Pool; use actix_web::{web, Error, HttpResponse}; use actix_web_httpauth::extractors::bearer::BearerAuth; use crate::controllers::chat_thread_controller::*; use crate::diesel::QueryDsl; use crate::diesel::RunQueryDsl; use crate::helpers::socket::push_thread_message; use crate::model::{ChannelChat, ChatThread, NewChatThread, User}; use crate::schema::channel_chats::dsl::*; use crate::schema::chat_thread::dsl::chat as thread_chat; use crate::schema::chat_thread::dsl::*; use crate::schema::users::dsl::*; use diesel::dsl::insert_into; use diesel::prelude::*; pub async fn send_message( db: web::Data<Pool>, token: BearerAuth, chat_id: web::Path<IdPathInfo>, item: web::Json<ChatMessage>, ) -> Result<HttpResponse, Error> { match auth::validate_token(&token.token().to_string()) { Ok(res) => { if res == true { let conn = db.get().unwrap(); let decoded_token = auth::decode_token(&token.token().to_string()); let user = users .find(decoded_token.parse::<i32>().unwrap()) .first::<User>(&conn); let channel_chat: ChannelChat = channel_chats .find(chat_id.id) .first::<ChannelChat>(&conn) .unwrap(); match user { Ok(user) => { let new_chat = NewChatThread { user_id: &user.id, space_channel_id: &channel_chat.space_channel_id, channel_chat_id: &channel_chat.id, chat: &item.chat, created_at: chrono::Local::now().naive_local(), }; //use chat id and channel_chat id as channel let socket_channel = format!( "thread-chat-{}-{}", &channel_chat.id, channel_chat.space_channel_id ); let response: Result<ChatThread, diesel::result::Error> = insert_into(chat_thread).values(&new_chat).get_result(&conn); match response { Ok(response) => { let socket_message = ThreadMessage { message: response, user: user, }; push_thread_message( &socket_channel, &"thread_chat_created".to_string(), &socket_message, ) .await; Ok(HttpResponse::Ok().json(Response::new( true, "message sent successfully".to_string(), ))) } _ => Ok(HttpResponse::Ok() .json(ResponseError::new(false, "error adding chat".to_string()))), } } _ => Ok(HttpResponse::Ok().json(ResponseError::new( false, "error getting user details".to_string(), ))), } } else { Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))) } } Err(_) => Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))), } } pub async fn update_message( db: web::Data<Pool>, token: BearerAuth, chat_id: web::Path<MultiId>, item: web::Json<ChatMessage>, ) -> Result<HttpResponse, Error> { match auth::validate_token(&token.token().to_string()) { Ok(res) => { if res == true { let conn = db.get().unwrap(); let decoded_token = auth::decode_token(&token.token().to_string()); let user = users .find(decoded_token.parse::<i32>().unwrap()) .first::<User>(&conn); let channel_chat: ChannelChat = channel_chats .find(chat_id.id2) .first::<ChannelChat>(&conn) .unwrap(); match user { Ok(user) => { let updated_chat = diesel::update(chat_thread.find(chat_id.id)) .set(thread_chat.eq(&item.chat)) .execute(&conn); match updated_chat { Ok(_updated_chat) => { let message: ChatThread = chat_thread .find(chat_id.id) .first::<ChatThread>(&conn) .unwrap(); let socket_channel = format!( "thread-chat-{}-{}", &channel_chat.id, channel_chat.space_channel_id ); let socket_message = ThreadMessage { message: message, user: user, }; push_thread_message( &socket_channel, &"thread_chat_update".to_string(), &socket_message, ) .await; Ok(HttpResponse::Ok().json(Response::new( true, "message updated successfully".to_string(), ))) } _ => Ok(HttpResponse::Ok() .json(Response::new(false, "error updating chat".to_string()))), } } _ => Ok(HttpResponse::Ok().json(ResponseError::new( false, "error getting user details".to_string(), ))), } } else { Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))) } } Err(_) => Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))), } } pub async fn get_chat_thread( db: web::Data<Pool>, auth: BearerAuth, chat_id: web::Path<IdPathInfo>, ) -> Result<HttpResponse, Error> { match auth::validate_token(&auth.token().to_string()) { Ok(res) => { if res == true { Ok( web::block(move || get_chat_thread_db(db, auth.token().to_string(), chat_id)) .await .map(|response| HttpResponse::Ok().json(response)) .map_err(|_| { HttpResponse::Ok() .json(Response::new(false, "Error getting chat".to_string())) })?, ) } else { Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))) } } Err(_) => Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))), } } pub async fn delete_message( db: web::Data<Pool>, auth: BearerAuth, chat_id: web::Path<IdPathInfo>, ) -> Result<HttpResponse, Error> { match auth::validate_token(&auth.token().to_string()) { Ok(res) => { if res == true { Ok( web::block(move || delete_message_db(db, auth.token().to_string(), chat_id)) .await .map(|response| HttpResponse::Ok().json(response)) .map_err(|_| { HttpResponse::Ok() .json(Response::new(false, "Error deleting chat".to_string())) })?, ) } else { Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))) } } Err(_) => Ok(HttpResponse::Ok().json(ResponseError::new(false, "jwt error".to_string()))), } }
use super::*; use std::ops::Range; fn batch_command(texture: Option<&Texture>, vertex_range: Range<usize>) -> BatchCommand { BatchCommand { texture: texture.cloned(), vertex_range, } } #[derive(Debug, Clone)] pub struct BatchCommand { pub texture: Option<Texture>, pub vertex_range: Range<usize>, } #[derive(Debug, Copy, Clone)] enum BatchUsage { Dynamic, Static, } #[derive(Debug, Clone)] pub struct DrawBatch { vbuf: Option<VertexBuffer>, buf: Vec<Vertex>, cmds: Vec<BatchCommand>, split_start: usize, usage: BatchUsage, updated: bool, } #[derive(Debug)] pub struct DrawSlice<'a> { pub batch: &'a mut DrawBatch, pub cmd_range: Range<usize>, } impl<'a> DrawSlice<'a> { pub fn buffer(&self) -> VertexBuffer { self.batch.buffer() } pub fn commands(&self) -> &[BatchCommand] { self.batch.commands(self.cmd_range.clone()) } } impl ::std::default::Default for DrawBatch { fn default() -> Self { Self::new() } } impl DrawBatch { pub fn new() -> DrawBatch { Self::with_usage(BatchUsage::Dynamic) } pub fn new_static() -> DrawBatch { Self::with_usage(BatchUsage::Static) } fn with_usage(usage: BatchUsage) -> DrawBatch { DrawBatch { vbuf: None, buf: Vec::new(), cmds: Vec::new(), split_start: 0, usage, updated: false, } } pub fn clear(&mut self) { self.updated = false; self.split_start = 0; self.buf.clear(); self.cmds.clear(); } pub fn add(&mut self, texture: Option<&Texture>, vertices: &[Vertex; 3]) { let i = self.buf.len(); let n = vertices.len(); let m = self.cmds.len(); self.updated = false; self.buf.extend_from_slice(vertices); if m == 0 || m == self.split_start || (m > 0 && (texture.is_none() != self.last_texture().is_none() || texture.is_some() && texture.unwrap().gl_internal_id() == self.last_texture().unwrap().gl_internal_id())) { self.cmds.push(batch_command(texture, i..i + n)); } else { self.cmds.last_mut().unwrap().vertex_range.end += n; } } fn last_texture(&self) -> Option<&Texture> { match self.cmds.last() { None => None, Some(cmd) => cmd.texture.as_ref(), } } pub fn add_quad(&mut self, texture: Option<&Texture>, vertices: &[Vertex; 4]) { self.add(texture, &[vertices[0], vertices[1], vertices[2]]); self.add(texture, &[vertices[2], vertices[3], vertices[0]]); } pub fn add_sprite(&mut self, sprite: &Sprite, color: Color, transform: Transform) { let (w, h) = (sprite.width, sprite.height); let (tx0, tx1) = sprite.texcoords_x; let (ty0, ty1) = sprite.texcoords_y; let (p0, p1, p2, p3) = (vec2(0.0, 0.0), vec2(w, 0.0), vec2(w, h), vec2(0.0, h)); let (p0, p1, p2, p3) = match transform { Transform::Pos(p) => (p + p0, p + p1, p + p2, p + p3), _ => { let m = transform.matrix(); (m * p0, m * p1, m * p2, m * p3) } }; self.add_quad( sprite.texture.as_ref(), &[ vertex(p0, vec2(tx0, ty0), color), vertex(p1, vec2(tx1, ty0), color), vertex(p2, vec2(tx1, ty1), color), vertex(p3, vec2(tx0, ty1), color), ], ); } pub fn split(&mut self) -> Range<usize> { let range = self.split_start..self.cmds.len(); self.split_start = range.end; range } pub fn all(&mut self) -> DrawSlice { let len = self.cmds.len(); DrawSlice { batch: self, cmd_range: 0..len, } } pub fn slice(&mut self, cmd_range: Range<usize>) -> DrawSlice { DrawSlice { batch: self, cmd_range, } } pub fn update(&mut self, ctx: &mut Context) { if !self.updated { match self.usage { BatchUsage::Dynamic => { let n = self.buf.len().next_power_of_two(); let size = n * std::mem::size_of::<Vertex>(); if self.vbuf.is_none() || self.vbuf.as_ref().unwrap().size() < size { let vbuf = mq::Buffer::stream(ctx, mq::BufferType::VertexBuffer, size); if let Some(old_vbuf) = self.vbuf.replace(vbuf) { old_vbuf.delete(); }; } let vbuf = self.vbuf.as_ref().unwrap(); vbuf.update(ctx, &self.buf); self.updated = true; } BatchUsage::Static => { self.vbuf = Some(mq::Buffer::immutable( ctx, mq::BufferType::VertexBuffer, &self.buf, )); self.updated = true; } }; } } pub fn buffer(&self) -> VertexBuffer { self.vbuf.unwrap() } pub fn commands(&self, range: Range<usize>) -> &[BatchCommand] { &self.cmds[range] } }
//! File system with inode support + read and write operations on inodes //! //! Create a filesystem that has a notion of inodes and blocks, by implementing the [`FileSysSupport`], the [`BlockSupport`] and the [`InodeSupport`] traits together (again, all earlier traits are supertraits of the later ones). //! Additionally, implement the [`InodeRWSupport`] trait to provide operations to read from and write to inodes //! //! [`FileSysSupport`]: ../../cplfs_api/fs/trait.FileSysSupport.html //! [`BlockSupport`]: ../../cplfs_api/fs/trait.BlockSupport.html //! [`InodeSupport`]: ../../cplfs_api/fs/trait.InodeSupport.html //! [`InodeRWSupport`]: ../../cplfs_api/fs/trait.InodeRWSupport.html //! Make sure this file does not contain any unaddressed //! //! # Status //! //! //! indicate the status of this assignment. If you want to tell something //! about this assignment to the grader, e.g., you have a bug you can't fix, //! or you want to explain your approach, write it down after the comments //! section. If you had no major issues and everything works, there is no need to write any comments. //! //! COMPLETED: Yes //! //! COMMENTS: I could have tested a little bit more //! //! ... //! use crate::c_dirs_support::FileSystemC; use crate::filesystem_errors::FileSystemError; use cplfs_api::fs::{BlockSupport, InodeRWSupport, InodeSupport}; use cplfs_api::types::{Buffer, InodeLike}; use std::convert::TryFrom; /// You are free to choose the name for your file system. As we will use /// automated tests when grading your assignment, indicate here the name of /// your file system data type so we can just use `FSName` instead of /// having to manually figure out the name. /// pub type FSName = FileSystemC; impl InodeRWSupport for FileSystemC { fn i_read(&self,inode: &Self::Inode,buf: &mut Buffer,off: u64,n: u64 ) -> Result<u64, Self::Error> { let mut ofsset = off; let mut length = n; let mut list = Vec::new(); let mut bytes_read = 0; if ofsset > u64::try_from(inode.get_size()).unwrap(){ return Err(FileSystemError::ReadError());// WRITE EERROR } if ofsset == inode.get_size() { return Ok(0) } for i in inode.disk_node.direct_blocks.iter() { if *i != 0 && length > 0 { if ofsset >= self.fs.superblock.block_size { ofsset -= self.fs.superblock.block_size; } else { let block = self.fs.b_get(*i)?; let contents_ref; contents_ref = block.contents_as_ref(); if length + ofsset > self.fs.superblock.block_size { let start = usize::try_from(ofsset).unwrap(); let end = usize::try_from(self.fs.superblock.block_size).unwrap(); list.extend_from_slice(&contents_ref[start..end]); bytes_read = bytes_read + self.fs.superblock.block_size - ofsset; length = length - (self.fs.superblock.block_size - ofsset); } else { let start = usize::try_from(ofsset).unwrap(); let end = usize::try_from(ofsset + length).unwrap(); list.extend_from_slice(&contents_ref[start..end]); //bytes_read = bytes_read + length - ofsset; bytes_read = bytes_read + u64::try_from(end-start).unwrap(); length = 0; } ofsset = 0; } } } let limit = usize::try_from(buf.len()).unwrap(); if limit < list.len() { buf.write_data(&list.as_slice()[0..limit], 0)?; } else { buf.write_data(&list.as_slice(), 0)?; } return Ok(bytes_read); } fn i_write(&mut self,inode: &mut Self::Inode,buf: &Buffer,off: u64,n: u64,) -> Result<(), Self::Error> { let mut ofsset = off; let mut towrite_length:usize = usize::try_from(n).unwrap(); let mut vector = buf.contents_as_ref().to_vec(); if ofsset > u64::try_from(inode.get_size()).unwrap(){ return Err(FileSystemError::ReadError());// WRITE EERROR } if n > buf.len(){ return Err(FileSystemError::ReadError());// WRITE EERROR } if n == 0 { return Ok(()) } let mut potential_size = 0; for i in 0..inode.disk_node.direct_blocks.len() { if inode.disk_node.direct_blocks[i] != 0{ potential_size += self.fs.superblock.block_size; } } if potential_size < ofsset+n { // need a new block for i in 0..inode.disk_node.direct_blocks.len() { if inode.disk_node.direct_blocks[i] == 0 && potential_size < ofsset+n{ // found a new block let mut new_block_data_index = self.b_alloc()?; let block_index = new_block_data_index + self.fs.superblock.datastart; inode.disk_node.direct_blocks[i] = block_index; if potential_size + self.fs.superblock.block_size < ofsset+n { inode.disk_node.size += self.fs.superblock.block_size; potential_size += self.fs.superblock.block_size; } else{ inode.disk_node.size += (ofsset+n) - inode.get_size(); potential_size += self.fs.superblock.block_size; } } } } else{ inode.disk_node.size += (ofsset+n) - inode.get_size(); } if inode.get_size() < ofsset+n { return Err(FileSystemError::AllocationError());// no room; inode is full } for i in inode.disk_node.direct_blocks.iter() { if *i != 0 && towrite_length > 0 { if ofsset >= self.fs.superblock.block_size { ofsset -= self.fs.superblock.block_size;// GET TO THE RIGHT BLOCK } else { let mut block = self.fs.b_get(*i)?; let mut block_space = usize::try_from(block.len() - ofsset).unwrap(); if block_space > towrite_length{ let mut temp = vector.get(0..towrite_length).unwrap(); block.write_data(temp,ofsset)?; self.b_put(&block); self.i_put(inode); return Ok(()) } else{ let mut temp = vector.get(0..block_space).unwrap(); block.write_data(temp,ofsset)?; vector = vector.split_off(block_space).to_vec(); towrite_length = towrite_length - block_space; self.b_put(&block); self.i_put(inode); ofsset = 0; } } } } return Err(FileSystemError::AllocationError());// no room; inode is full } } // // WARNING: DO NOT TOUCH THE BELOW CODE -- IT IS REQUIRED FOR TESTING -- YOU WILL LOSE POINTS IF I MANUALLY HAVE TO FIX YOUR TESTS #[cfg(all(test, any(feature = "e", feature = "all")))] #[path = "../../api/fs-tests/e_test.rs"] mod tests;
mod input_stream; mod state_stream; mod input_stream_source; mod input_stream_core; pub use self::state_stream::*; pub use self::input_stream::*; pub use self::input_stream_source::*;
use super::*; mod with_arity_2; #[test] fn without_arity_2_errors_badarg() { with_process(|process| { let destination = process.tuple_from_slice(&[]); let message = Atom::str_to_term("message"); assert_badarg!( result(process, destination, message), format!("destination ({}) is a tuple, but not 2-arity", destination) ) }) }
use std::collections::HashMap; use std::char; use track::*; use token::{Token, TokenData, Exp, CharCase, Sign, NumberLiteral, Radix}; use std::cell::Cell; use std::rc::Rc; use context::SharedContext; use token::{Reserved, Atom, Name}; use eschar::ESCharExt; use reader::Reader; use tokbuf::TokenBuffer; pub type Lex<T> = Result<T, LexError>; #[derive(Debug, PartialEq)] pub enum LexError { UnexpectedEOF, // FIXME: split this up into specific situational errors UnexpectedChar(char), InvalidDigit(char), IllegalUnicode(u32) } macro_rules! wordmap { ($ns:ident, [ $( ( $key:expr, $val:ident ) ),* ]) => { { let mut temp_map = HashMap::new(); $( temp_map.insert($key, $ns::$val); )* temp_map } }; } fn add_digits(digits: Vec<u32>, radix: u32) -> u32 { let mut place = 1; let mut sum = 0; for digit in digits.iter().rev() { sum += digit * place; place *= radix; } sum } struct SpanTracker { start: Posn } impl SpanTracker { fn end<I>(&self, lexer: &Lexer<I>, value: TokenData) -> Token where I: Iterator<Item=char> { let end = lexer.posn(); Token::new(self.start, end, value) } } pub struct Lexer<I> { reader: Reader<I>, cx: Rc<Cell<SharedContext>>, lookahead: TokenBuffer, reserved: HashMap<&'static str, Reserved>, contextual: HashMap<&'static str, Atom> } impl<I> Lexer<I> where I: Iterator<Item=char> { // constructor pub fn new(chars: I, cx: Rc<Cell<SharedContext>>) -> Lexer<I> { Lexer { reader: Reader::new(chars), cx: cx, lookahead: TokenBuffer::new(), reserved: wordmap!(Reserved, [ // ReservedWord ("null", Null), ("true", True), ("false", False), // Keyword ("break", Break), ("case", Case), ("catch", Catch), ("class", Class), ("const", Const), ("continue", Continue), ("debugger", Debugger), ("default", Default), ("delete", Delete), ("do", Do), ("else", Else), ("export", Export), ("extends", Extends), ("finally", Finally), ("for", For), ("function", Function), ("if", If), ("import", Import), ("in", In), ("instanceof", Instanceof), ("new", New), ("return", Return), ("super", Super), ("switch", Switch), ("this", This), ("throw", Throw), ("try", Try), ("typeof", Typeof), ("var", Var), ("void", Void), ("while", While), ("with", With), // FutureReservedWord ("enum", Enum) ]), contextual: wordmap!(Atom, [ // Restricted words in strict code ("arguments", Arguments), ("eval", Eval), // Reserved in some contexts ("yield", Yield), // Reserved words in module code ("await", Await), // Reserved words in strict code ("implements", Implements), ("interface", Interface), ("let", Let), ("package", Package), ("private", Private), ("protected", Protected), ("public", Public), ("static", Static), // Purely contextual identifier names ("async", Async), ("from", From), ("of", Of) ]) } } // public methods pub fn peek_token(&mut self) -> Lex<&Token> { if self.lookahead.is_empty() { let token = try!(self.read_next_token()); self.lookahead.push_token(token); } Ok(self.lookahead.peek_token()) } pub fn repeek_token(&mut self) -> &Token { debug_assert!(!self.lookahead.is_empty()); self.lookahead.peek_token() } pub fn skip_token(&mut self) -> Lex<()> { try!(self.read_token()); Ok(()) } pub fn reread_token(&mut self) -> Token { debug_assert!(!self.lookahead.is_empty()); self.lookahead.read_token() } pub fn read_token(&mut self) -> Lex<Token> { if self.lookahead.is_empty() { self.read_next_token() } else { Ok(self.lookahead.read_token()) } } pub fn unread_token(&mut self, token: Token) { self.lookahead.unread_token(token); } // source location pub fn posn(&self) -> Posn { self.reader.curr_posn() } fn start(&self) -> SpanTracker { SpanTracker { start: self.posn() } } // generic lexing utilities fn read(&mut self) -> char { let ch = self.reader.curr_char().unwrap(); self.skip(); ch } fn reread(&mut self, ch: char) -> char { debug_assert!(self.peek() == Some(ch)); self.skip(); ch } fn peek(&mut self) -> Option<char> { self.reader.curr_char() } fn peek2(&mut self) -> (Option<char>, Option<char>) { (self.reader.curr_char(), self.reader.next_char()) } fn skip(&mut self) { self.reader.skip(); } fn skip2(&mut self) { self.skip(); self.skip(); } fn matches(&mut self, ch: char) -> bool { (self.peek() == Some(ch)) && { self.skip(); true } } fn skip_while<F>(&mut self, pred: &F) where F: Fn(char) -> bool { self.skip_until(&|ch| !pred(ch)) } fn skip_until<F>(&mut self, pred: &F) where F: Fn(char) -> bool { loop { match self.peek() { Some(ch) if pred(ch) => return, None => return, _ => () } self.skip(); } } fn read_into_until<F>(&mut self, s: &mut String, pred: &F) where F: Fn(char) -> bool { loop { match self.peek() { Some(ch) if pred(ch) => return, Some(ch) => { s.push(self.reread(ch)); } None => return, } } } fn read_until_with<F, G>(&mut self, pred: &F, read: &mut G) -> Lex<()> where F: Fn(char) -> bool, G: FnMut(&mut Self) -> Lex<()> { loop { match self.peek() { Some(ch) if pred(ch) => return Ok(()), Some(_) => { try!(read(self)); } None => return Ok(()) } } } fn fail_if<F>(&mut self, pred: &F) -> Lex<()> where F: Fn(char) -> bool { match self.peek() { Some(ch) if pred(ch) => Err(LexError::UnexpectedChar(ch)), _ => Ok(()) } } fn expect(&mut self, expected: char) -> Lex<()> { match self.peek() { Some(ch) if ch == expected => (), Some(ch) => return Err(LexError::UnexpectedChar(ch)), None => return Err(LexError::UnexpectedEOF) } self.skip(); Ok(()) } // lexical grammar fn skip_newlines(&mut self) { debug_assert!(self.peek().map_or(false, |ch| ch.is_es_newline())); loop { match self.peek2() { (Some('\r'), Some('\n')) => { self.skip2(); } (Some(ch), _) if ch.is_es_newline() => { self.skip(); } _ => { break; } } } } fn read_newline_into(&mut self, s: &mut String) { debug_assert!(self.peek().map_or(false, |ch| ch.is_es_newline())); if self.peek2() == (Some('\r'), Some('\n')) { s.push_str("\r\n"); self.skip2(); return; } s.push(self.read()); } fn skip_whitespace(&mut self) { self.skip_while(&|ch| ch.is_es_whitespace()); } fn skip_line_comment(&mut self) { self.skip2(); self.skip_until(&|ch| ch.is_es_newline()); } fn skip_block_comment(&mut self) -> Lex<bool> { let mut found_newline = false; loop { match self.peek2() { (None, _) | (_, None) => { return Err(LexError::UnexpectedEOF); } (Some('*'), Some('/')) => { self.skip2(); break; } (Some(ch), _) => { if ch.is_es_newline() { found_newline = true; } self.skip(); } } } Ok(found_newline) } fn read_regexp(&mut self) -> Lex<Token> { let span = self.start(); let mut s = String::new(); self.reread('/'); try!(self.read_until_with(&|ch| ch == '/', &mut |this| { this.read_regexp_char(&mut s) })); self.reread('/'); let flags = try!(self.read_word_parts()); Ok(span.end(self, TokenData::RegExp(s, flags.chars().collect()))) } fn read_regexp_char(&mut self, s: &mut String) -> Lex<()> { match self.peek() { Some('\\') => self.read_regexp_backslash(s), Some('[') => self.read_regexp_class(s), Some(ch) if ch.is_es_newline() => Err(LexError::UnexpectedChar(ch)), Some(ch) => { s.push(self.reread(ch)); Ok(()) } None => Err(LexError::UnexpectedEOF) } } fn read_regexp_backslash(&mut self, s: &mut String) -> Lex<()> { s.push(self.reread('\\')); match self.peek() { Some(ch) if ch.is_es_newline() => Err(LexError::UnexpectedChar(ch)), Some(ch) => { s.push(self.reread(ch)); Ok(()) } None => Err(LexError::UnexpectedEOF) } } fn read_regexp_class(&mut self, s: &mut String) -> Lex<()> { s.push(self.reread('[')); try!(self.read_until_with(&|ch| ch == ']', &mut |this| { this.read_regexp_class_char(s) })); s.push(self.reread(']')); Ok(()) } fn read_regexp_class_char(&mut self, s: &mut String) -> Lex<()> { match self.peek() { Some('\\') => self.read_regexp_backslash(s), Some(ch) => { s.push(self.reread(ch)); Ok(()) } None => Err(LexError::UnexpectedEOF) } } fn read_decimal_digits_into(&mut self, s: &mut String) -> Lex<()> { match self.peek() { Some(ch) if !ch.is_digit(10) => return Err(LexError::UnexpectedChar(ch)), None => return Err(LexError::UnexpectedEOF), _ => () } self.read_into_until(s, &|ch| !ch.is_digit(10)); Ok(()) } fn read_decimal_digits(&mut self) -> Lex<String> { let mut s = String::new(); try!(self.read_decimal_digits_into(&mut s)); Ok(s) } fn read_exp_part(&mut self) -> Lex<Option<Exp>> { let e = match self.peek() { Some('e') => CharCase::LowerCase, Some('E') => CharCase::UpperCase, _ => { return Ok(None); } }; self.skip(); let sign = match self.peek() { Some('+') => { self.skip(); Some(Sign::Plus) } Some('-') => { self.skip(); Some(Sign::Minus) } _ => None }; let mut value = String::new(); try!(self.read_decimal_digits_into(&mut value)); Ok(Some(Exp { e: e, sign: sign, value: value })) } fn read_decimal_int(&mut self) -> Lex<String> { let mut s = String::new(); match self.peek() { Some('0') => { s.push(self.reread('0')); return Ok(s); } Some(ch) if ch.is_digit(10) => { s.push(self.reread(ch)); } Some(ch) => return Err(LexError::UnexpectedChar(ch)), None => return Err(LexError::UnexpectedEOF) } self.read_into_until(&mut s, &|ch| !ch.is_digit(10)); Ok(s) } fn read_radix_int<F, G>(&mut self, radix: u32, pred: &F, cons: &G) -> Lex<Token> where F: Fn(char) -> bool, G: Fn(CharCase, String) -> TokenData { debug_assert!(self.reader.curr_char() == Some('0')); debug_assert!(self.reader.next_char().map_or(false, |ch| ch.is_alphabetic())); let span = self.start(); let mut s = String::new(); self.skip(); let flag = if self.read().is_lowercase() { CharCase::LowerCase } else { CharCase::UpperCase }; try!(self.read_digit_into(&mut s, radix, pred)); self.read_into_until(&mut s, &|ch| !pred(ch)); Ok(span.end(self, cons(flag, s))) } fn read_hex_int(&mut self) -> Lex<Token> { self.read_radix_int(16, &|ch| ch.is_es_hex_digit(), &|cc, s| { TokenData::Number(NumberLiteral::RadixInt(Radix::Hex(cc), s)) }) } fn read_oct_int(&mut self) -> Lex<Token> { self.read_radix_int(8, &|ch| ch.is_es_oct_digit(), &|cc, s| { TokenData::Number(NumberLiteral::RadixInt(Radix::Oct(Some(cc)), s)) }) } fn read_bin_int(&mut self) -> Lex<Token> { self.read_radix_int(2, &|ch| ch.is_es_bin_digit(), &|cc, s| { TokenData::Number(NumberLiteral::RadixInt(Radix::Bin(cc), s)) }) } fn read_deprecated_oct_int(&mut self) -> Token { let span = self.start(); self.skip(); let mut s = String::new(); self.read_into_until(&mut s, &|ch| !ch.is_digit(10)); span.end(self, TokenData::Number(if s.chars().all(|ch| ch.is_es_oct_digit()) { NumberLiteral::RadixInt(Radix::Oct(None), s) } else { NumberLiteral::DecimalInt(format!("0{}", s), None) })) } fn read_number(&mut self) -> Lex<Token> { let result = try!(match self.peek2() { (Some('0'), Some('x')) | (Some('0'), Some('X')) => self.read_hex_int(), (Some('0'), Some('o')) | (Some('0'), Some('O')) => self.read_oct_int(), (Some('0'), Some('b')) | (Some('0'), Some('B')) => self.read_bin_int(), (Some('0'), Some(ch)) if ch.is_digit(10) => Ok(self.read_deprecated_oct_int()), (Some('.'), _) => { let span = self.start(); self.skip(); let frac = try!(self.read_decimal_digits()); let exp = try!(self.read_exp_part()); Ok(span.end(self, TokenData::Number(NumberLiteral::Float(None, Some(frac), exp)))) } (Some(ch), _) if ch.is_digit(10) => { let span = self.start(); let pos = try!(self.read_decimal_int()); let (dot, frac) = if self.matches('.') { (true, match self.peek() { Some(ch) if ch.is_digit(10) => Some(try!(self.read_decimal_digits())), _ => None }) } else { (false, None) }; let exp = try!(self.read_exp_part()); Ok(span.end(self, TokenData::Number(if dot { NumberLiteral::Float(Some(pos), frac, exp) } else { NumberLiteral::DecimalInt(pos, exp) }))) } (Some(ch), _) => Err(LexError::UnexpectedChar(ch)), (None, _) => Err(LexError::UnexpectedEOF) }); try!(self.fail_if(&|ch| ch.is_es_identifier_start() || ch.is_digit(10))); Ok(result) } fn read_string(&mut self) -> Lex<Token> { debug_assert!(self.peek().is_some()); let span = self.start(); let mut s = String::new(); let quote = self.read(); loop { self.read_into_until(&mut s, &|ch| { ch == quote || ch == '\\' || ch.is_es_newline() }); match self.peek() { Some('\\') => { try!(self.read_string_escape(&mut s)); } Some(ch) if ch.is_es_newline() => { return Err(LexError::UnexpectedChar(ch)); } Some(_) => { self.skip(); break; } None => return Err(LexError::UnexpectedEOF) } } Ok(span.end(self, TokenData::String(s))) } fn read_unicode_escape_seq(&mut self, s: &mut String) -> Lex<u32> { if self.matches('{') { s.push('{'); let mut digits = Vec::with_capacity(8); digits.push(try!(self.read_hex_digit_into(s))); try!(self.read_until_with(&|ch| ch == '}', &mut |this| { digits.push(try!(this.read_hex_digit_into(s))); Ok(()) })); s.push(self.reread('}')); Ok(add_digits(digits, 16)) } else { let mut place = 0x1000; let mut code_point = 0; for _ in 0..4 { code_point += try!(self.read_hex_digit_into(s)) * place; place >>= 4; } Ok(code_point) } } fn read_string_escape(&mut self, s: &mut String) -> Lex<()> { s.push(self.read()); match self.peek() { Some('0') => { self.skip(); for _ in 0..3 { match self.peek() { Some(ch) if ch.is_digit(8) => { s.push(ch); }, _ => { break; } } } } Some(ch) if ch.is_es_single_escape_char() => { s.push(self.read()); } Some('x') => { s.push(self.reread('x')); try!(self.read_hex_digit_into(s)); try!(self.read_hex_digit_into(s)); } Some('u') => { s.push(self.reread('u')); try!(self.read_unicode_escape_seq(s)); } Some(ch) if ch.is_es_newline() => { self.read_newline_into(s); } Some(ch) => { s.push(self.reread(ch)); } None => () // error will be reported from caller } Ok(()) } fn read_digit_into<F>(&mut self, s: &mut String, radix: u32, pred: &F) -> Lex<u32> where F: Fn(char) -> bool { match self.peek() { Some(ch) if pred(ch) => { s.push(self.reread(ch)); debug_assert!(ch.is_digit(radix)); Ok(ch.to_digit(radix).unwrap()) }, Some(ch) => Err(LexError::InvalidDigit(ch)), None => Err(LexError::UnexpectedEOF) } } fn read_hex_digit_into(&mut self, s: &mut String) -> Lex<u32> { self.read_digit_into(s, 16, &|ch| ch.is_es_hex_digit()) } fn read_word_parts(&mut self) -> Lex<String> { let mut s = String::new(); try!(self.read_until_with(&|ch| ch != '\\' && !ch.is_es_identifier_continue(), &mut |this| { match this.read() { '\\' => this.read_word_escape(&mut s), ch => { s.push(ch); Ok(()) } } })); Ok(s) } fn read_word(&mut self) -> Lex<Token> { debug_assert!(self.peek().map_or(false, |ch| ch == '\\' || ch.is_es_identifier_start())); let span = self.start(); let s = try!(self.read_word_parts()); if s.len() == 0 { match self.peek() { Some(ch) => { return Err(LexError::UnexpectedChar(ch)); } None => { return Err(LexError::UnexpectedEOF); } } } Ok(span.end(self, match self.reserved.get(&s[..]) { Some(&word) => TokenData::Reserved(word), None => match self.contextual.get(&s[..]) { Some(&atom) => TokenData::Identifier(Name::Atom(atom)), None => TokenData::Identifier(Name::String(s)) } })) } fn read_word_escape(&mut self, s: &mut String) -> Lex<()> { try!(self.expect('u')); let mut dummy = String::new(); let code_point = try!(self.read_unicode_escape_seq(&mut dummy)); match char::from_u32(code_point) { Some(ch) => { s.push(ch); Ok(()) } None => Err(LexError::IllegalUnicode(code_point)) } } fn read_punc(&mut self, value: TokenData) -> Token { let span = self.start(); self.skip(); span.end(self, value) } fn read_punc2(&mut self, value: TokenData) -> Token { let span = self.start(); self.skip2(); span.end(self, value) } fn read_punc2_3(&mut self, ch: char, value2: TokenData, value3: TokenData) -> Token { let span = self.start(); self.skip2(); let value = if self.matches(ch) { value3 } else { value2 }; span.end(self, value) } fn read_next_token(&mut self) -> Lex<Token> { let mut pair; let mut found_newline = false; // Skip whitespace and comments. loop { pair = self.peek2(); match pair { (Some(ch), _) if ch.is_es_whitespace() => { self.skip_whitespace(); } (Some(ch), _) if ch.is_es_newline() => { self.skip_newlines(); found_newline = true; } (Some('/'), Some('/')) => { self.skip_line_comment(); } (Some('/'), Some('*')) => { found_newline = found_newline || try!(self.skip_block_comment()); } _ => { break; } } } let mut result = try!(match pair { (Some('/'), _) if !self.cx.get().operator => self.read_regexp(), (Some('/'), Some('=')) => { Ok(self.read_punc2(TokenData::SlashAssign)) } (Some('/'), _) => Ok(self.read_punc(TokenData::Slash)), (Some('.'), Some(ch)) if ch.is_digit(10) => self.read_number(), (Some('.'), _) => Ok(self.read_punc(TokenData::Dot)), (Some('{'), _) => Ok(self.read_punc(TokenData::LBrace)), (Some('}'), _) => Ok(self.read_punc(TokenData::RBrace)), (Some('['), _) => Ok(self.read_punc(TokenData::LBrack)), (Some(']'), _) => Ok(self.read_punc(TokenData::RBrack)), (Some('('), _) => Ok(self.read_punc(TokenData::LParen)), (Some(')'), _) => Ok(self.read_punc(TokenData::RParen)), (Some(';'), _) => Ok(self.read_punc(TokenData::Semi)), (Some(':'), _) => Ok(self.read_punc(TokenData::Colon)), (Some(','), _) => Ok(self.read_punc(TokenData::Comma)), (Some('<'), Some('<')) => { Ok(self.read_punc2_3('=', TokenData::LShift, TokenData::LShiftAssign)) } (Some('<'), Some('=')) => Ok(self.read_punc2(TokenData::LEq)), (Some('<'), _) => Ok(self.read_punc(TokenData::LAngle)), (Some('>'), Some('>')) => Ok({ let span = self.start(); self.skip2(); let value = match self.peek2() { (Some('>'), Some('=')) => { self.skip2(); TokenData::URShiftAssign } (Some('>'), _) => { self.skip(); TokenData::URShift } (Some('='), _) => { self.skip(); TokenData::RShiftAssign } _ => TokenData::RShift }; span.end(self, value) }), (Some('>'), Some('=')) => Ok(self.read_punc2(TokenData::GEq)), (Some('>'), _) => Ok(self.read_punc(TokenData::RAngle)), (Some('='), Some('=')) => { Ok(self.read_punc2_3('=', TokenData::Eq, TokenData::StrictEq)) } (Some('='), _) => Ok(self.read_punc(TokenData::Assign)), (Some('+'), Some('+')) => Ok(self.read_punc2(TokenData::Inc)), (Some('+'), Some('=')) => { Ok(self.read_punc2(TokenData::PlusAssign)) } (Some('+'), _) => Ok(self.read_punc(TokenData::Plus)), (Some('-'), Some('-')) => Ok(self.read_punc2(TokenData::Dec)), (Some('-'), Some('=')) => { Ok(self.read_punc2(TokenData::MinusAssign)) } (Some('-'), _) => Ok(self.read_punc(TokenData::Minus)), (Some('*'), Some('=')) => { Ok(self.read_punc2(TokenData::StarAssign)) } (Some('*'), _) => Ok(self.read_punc(TokenData::Star)), (Some('%'), Some('=')) => { Ok(self.read_punc2(TokenData::ModAssign)) } (Some('%'), _) => Ok(self.read_punc(TokenData::Mod)), (Some('^'), Some('=')) => { Ok(self.read_punc2(TokenData::BitXorAssign)) } (Some('^'), _) => Ok(self.read_punc(TokenData::BitXor)), (Some('&'), Some('&')) => { Ok(self.read_punc2(TokenData::LogicalAnd)) } (Some('&'), Some('=')) => { Ok(self.read_punc2(TokenData::BitAndAssign)) } (Some('&'), _) => Ok(self.read_punc(TokenData::BitAnd)), (Some('|'), Some('|')) => { Ok(self.read_punc2(TokenData::LogicalOr)) } (Some('|'), Some('=')) => { Ok(self.read_punc2(TokenData::BitOrAssign)) } (Some('|'), _) => Ok(self.read_punc(TokenData::BitOr)), (Some('~'), _) => Ok(self.read_punc(TokenData::Tilde)), (Some('!'), Some('=')) => { Ok(self.read_punc2_3('=', TokenData::NEq, TokenData::StrictNEq)) } (Some('!'), _) => Ok(self.read_punc(TokenData::Bang)), (Some('?'), _) => Ok(self.read_punc(TokenData::Question)), (Some('"'), _) | (Some('\''), _) => self.read_string(), (Some(ch), _) if ch.is_digit(10) => self.read_number(), (Some(ch), _) if ch.is_es_identifier_start() => self.read_word(), (Some('\\'), _) => self.read_word(), (Some(ch), _) => Err(LexError::UnexpectedChar(ch)), (None, _) => { let here = self.posn(); Ok(Token::new(here, here, TokenData::EOF)) } }); result.newline = found_newline; Ok(result) } } impl<I> Iterator for Lexer<I> where I: Iterator<Item=char> { type Item = Token; fn next(&mut self) -> Option<Token> { match self.read_token() { Ok(Token { value: TokenData::EOF, .. }) => None, Ok(t) => Some(t), Err(_) => None } } } #[cfg(test)] mod tests { use test::{deserialize_lexer_tests, LexerTest}; use lexer::{Lexer, Lex}; use context::SharedContext; use token::{Token, TokenData}; use std::cell::Cell; use std::rc::Rc; fn lex2(source: &String, context: SharedContext) -> Lex<(Token, Token)> { let chars = source.chars(); let cx = Rc::new(Cell::new(context)); let mut lexer = Lexer::new(chars, cx.clone()); Ok((try!(lexer.read_token()), try!(lexer.read_token()))) } fn assert_test2(expected: &Result<TokenData, String>, expected_next: TokenData, actual: Lex<(Token, Token)>) { match (expected, &actual) { (&Ok(ref expected), &Ok((Token { value: ref actual, .. }, Token { value: ref actual_next, .. }))) => { assert_eq!(expected, actual); assert_eq!(&expected_next, actual_next); } (&Ok(_), &Err(ref err)) => { panic!("unexpected lexer error: {:?}", err); } (&Err(_), &Ok(_)) => { panic!("unexpected token, expected error"); } (&Err(_), &Err(_)) => { } } } #[test] pub fn go() { let tests = deserialize_lexer_tests(include_str!("../tests/lexer/tests.json")); for LexerTest { source, context, expected } in tests { assert_test2(&expected, TokenData::EOF, lex2(&source, context)); assert_test2(&expected, TokenData::EOF, lex2(&format!("{} ", source), context)); assert_test2(&expected, TokenData::EOF, lex2(&format!(" {}", source), context)); assert_test2(&expected, TokenData::EOF, lex2(&format!(" {} ", source), context)); assert_test2(&expected, TokenData::Semi, lex2(&format!("{};", source), context)); } } }
use snap; use std::io; fn main() { let stdin = io::stdin(); let stdout = io::stdout(); let mut rdr = stdin.lock(); // Wrap the stdout writer in a Snappy writer. let mut wtr = snap::write::FrameEncoder::new(stdout.lock()); io::copy(&mut rdr, &mut wtr).expect("I/O operation failed"); }
#[doc = "Description cluster[n]: Write access to peripheral region n detected"] pub struct WA { register: ::vcell::VolatileCell<u32>, } #[doc = "Description cluster[n]: Write access to peripheral region n detected"] pub mod wa; #[doc = "Description cluster[n]: Read access to peripheral region n detected"] pub struct RA { register: ::vcell::VolatileCell<u32>, } #[doc = "Description cluster[n]: Read access to peripheral region n detected"] pub mod ra;
use crate::{ component::{NavAgent, NavAgentTarget, SimpleNavDriverTag}, resource::{NavMesh, NavMeshesRes, NavVec3}, }; use core::{ app::AppLifeCycle, ecs::{Entities, Entity, Join, Read, ReadExpect, ReadStorage, System, WriteStorage}, Scalar, }; use std::collections::HashMap; /// nav agents maintainment system. It's used to find path on nav mesh for agents. #[derive(Default)] pub struct NavAgentMaintainSystem(HashMap<Entity, Vec<NavVec3>>); impl NavAgentMaintainSystem { pub fn with_cache_capacity(capacity: usize) -> Self { Self(HashMap::with_capacity(capacity)) } } impl<'s> System<'s> for NavAgentMaintainSystem { type SystemData = ( Entities<'s>, Read<'s, NavMeshesRes>, WriteStorage<'s, NavAgent>, ); fn run(&mut self, (entities, meshes_res, mut agents): Self::SystemData) { self.0.clear(); for (entity, agent) in (&entities, &agents).join() { if agent.dirty_path { if let Some(destination) = &agent.destination { if let Some(mesh) = meshes_res.0.get(&destination.mesh) { match destination.target { NavAgentTarget::Point(point) => { if let Some(path) = mesh.find_path( agent.position, point, destination.query, destination.mode, ) { self.0.insert(entity, path); } } NavAgentTarget::Entity(entity) => { if let Some(other) = agents.get(entity) { if let Some(path) = mesh.find_path( agent.position, other.position, destination.query, destination.mode, ) { self.0.insert(entity, path); } } } } } } } } for (entity, path) in self.0.drain() { if let Some(agent) = agents.get_mut(entity) { agent.set_path(path); } } } } /// Simple nav driver system. It's used to apply simple movement of agents with `SimpleNavDriverTag` /// component tag on their paths. pub struct SimpleNavDriverSystem; impl SimpleNavDriverSystem { /// Internal system run function. pub fn run_impl<'s>( delta_time: Scalar, (mut agents, drivers): ( WriteStorage<'s, NavAgent>, ReadStorage<'s, SimpleNavDriverTag>, ), ) { if delta_time <= 0.0 { return; } for (agent, _) in (&mut agents, &drivers).join() { if let Some(path) = agent.path() { if let Some((target, _)) = NavMesh::path_target_point( path, agent.position, agent.speed.max(agent.min_target_distance.max(0.0)) * delta_time, ) { let diff = target - agent.position; let dir = diff.normalize(); agent.position = agent.position + dir * (agent.speed.max(0.0) * delta_time).min(diff.magnitude()); agent.direction = diff.normalize(); } } } } } impl<'s> System<'s> for SimpleNavDriverSystem { type SystemData = ( ReadExpect<'s, AppLifeCycle>, WriteStorage<'s, NavAgent>, ReadStorage<'s, SimpleNavDriverTag>, ); fn run(&mut self, (lifecycle, agents, drivers): Self::SystemData) { let delta_time = lifecycle.delta_time_seconds(); Self::run_impl(delta_time, (agents, drivers)); } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type IXamlDirectObject = *mut ::core::ffi::c_void; pub type XamlDirect = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct XamlEventIndex(pub i32); impl XamlEventIndex { pub const FrameworkElement_DataContextChanged: Self = Self(16i32); pub const FrameworkElement_SizeChanged: Self = Self(17i32); pub const FrameworkElement_LayoutUpdated: Self = Self(18i32); pub const UIElement_KeyUp: Self = Self(22i32); pub const UIElement_KeyDown: Self = Self(23i32); pub const UIElement_GotFocus: Self = Self(24i32); pub const UIElement_LostFocus: Self = Self(25i32); pub const UIElement_DragStarting: Self = Self(26i32); pub const UIElement_DropCompleted: Self = Self(27i32); pub const UIElement_CharacterReceived: Self = Self(28i32); pub const UIElement_DragEnter: Self = Self(29i32); pub const UIElement_DragLeave: Self = Self(30i32); pub const UIElement_DragOver: Self = Self(31i32); pub const UIElement_Drop: Self = Self(32i32); pub const UIElement_PointerPressed: Self = Self(38i32); pub const UIElement_PointerMoved: Self = Self(39i32); pub const UIElement_PointerReleased: Self = Self(40i32); pub const UIElement_PointerEntered: Self = Self(41i32); pub const UIElement_PointerExited: Self = Self(42i32); pub const UIElement_PointerCaptureLost: Self = Self(43i32); pub const UIElement_PointerCanceled: Self = Self(44i32); pub const UIElement_PointerWheelChanged: Self = Self(45i32); pub const UIElement_Tapped: Self = Self(46i32); pub const UIElement_DoubleTapped: Self = Self(47i32); pub const UIElement_Holding: Self = Self(48i32); pub const UIElement_ContextRequested: Self = Self(49i32); pub const UIElement_ContextCanceled: Self = Self(50i32); pub const UIElement_RightTapped: Self = Self(51i32); pub const UIElement_ManipulationStarting: Self = Self(52i32); pub const UIElement_ManipulationInertiaStarting: Self = Self(53i32); pub const UIElement_ManipulationStarted: Self = Self(54i32); pub const UIElement_ManipulationDelta: Self = Self(55i32); pub const UIElement_ManipulationCompleted: Self = Self(56i32); pub const UIElement_ProcessKeyboardAccelerators: Self = Self(60i32); pub const UIElement_GettingFocus: Self = Self(61i32); pub const UIElement_LosingFocus: Self = Self(62i32); pub const UIElement_NoFocusCandidateFound: Self = Self(63i32); pub const UIElement_PreviewKeyDown: Self = Self(64i32); pub const UIElement_PreviewKeyUp: Self = Self(65i32); pub const UIElement_BringIntoViewRequested: Self = Self(66i32); pub const AppBar_Opening: Self = Self(109i32); pub const AppBar_Opened: Self = Self(110i32); pub const AppBar_Closing: Self = Self(111i32); pub const AppBar_Closed: Self = Self(112i32); pub const AutoSuggestBox_SuggestionChosen: Self = Self(113i32); pub const AutoSuggestBox_TextChanged: Self = Self(114i32); pub const AutoSuggestBox_QuerySubmitted: Self = Self(115i32); pub const CalendarDatePicker_CalendarViewDayItemChanging: Self = Self(116i32); pub const CalendarDatePicker_DateChanged: Self = Self(117i32); pub const CalendarDatePicker_Opened: Self = Self(118i32); pub const CalendarDatePicker_Closed: Self = Self(119i32); pub const CalendarView_CalendarViewDayItemChanging: Self = Self(120i32); pub const CalendarView_SelectedDatesChanged: Self = Self(121i32); pub const ComboBox_DropDownClosed: Self = Self(122i32); pub const ComboBox_DropDownOpened: Self = Self(123i32); pub const CommandBar_DynamicOverflowItemsChanging: Self = Self(124i32); pub const ContentDialog_Closing: Self = Self(126i32); pub const ContentDialog_Closed: Self = Self(127i32); pub const ContentDialog_Opened: Self = Self(128i32); pub const ContentDialog_PrimaryButtonClick: Self = Self(129i32); pub const ContentDialog_SecondaryButtonClick: Self = Self(130i32); pub const ContentDialog_CloseButtonClick: Self = Self(131i32); pub const Control_FocusEngaged: Self = Self(132i32); pub const Control_FocusDisengaged: Self = Self(133i32); pub const DatePicker_DateChanged: Self = Self(135i32); pub const Frame_Navigated: Self = Self(136i32); pub const Frame_Navigating: Self = Self(137i32); pub const Frame_NavigationFailed: Self = Self(138i32); pub const Frame_NavigationStopped: Self = Self(139i32); pub const Hub_SectionHeaderClick: Self = Self(143i32); pub const Hub_SectionsInViewChanged: Self = Self(144i32); pub const ItemsPresenter_HorizontalSnapPointsChanged: Self = Self(148i32); pub const ItemsPresenter_VerticalSnapPointsChanged: Self = Self(149i32); pub const ListViewBase_ItemClick: Self = Self(150i32); pub const ListViewBase_DragItemsStarting: Self = Self(151i32); pub const ListViewBase_DragItemsCompleted: Self = Self(152i32); pub const ListViewBase_ContainerContentChanging: Self = Self(153i32); pub const ListViewBase_ChoosingItemContainer: Self = Self(154i32); pub const ListViewBase_ChoosingGroupHeaderContainer: Self = Self(155i32); pub const MediaTransportControls_ThumbnailRequested: Self = Self(167i32); pub const MenuFlyoutItem_Click: Self = Self(168i32); pub const RichEditBox_TextChanging: Self = Self(177i32); pub const ScrollViewer_ViewChanging: Self = Self(192i32); pub const ScrollViewer_ViewChanged: Self = Self(193i32); pub const ScrollViewer_DirectManipulationStarted: Self = Self(194i32); pub const ScrollViewer_DirectManipulationCompleted: Self = Self(195i32); pub const SearchBox_QueryChanged: Self = Self(196i32); pub const SearchBox_SuggestionsRequested: Self = Self(197i32); pub const SearchBox_QuerySubmitted: Self = Self(198i32); pub const SearchBox_ResultSuggestionChosen: Self = Self(199i32); pub const SearchBox_PrepareForFocusOnKeyboardInput: Self = Self(200i32); pub const SemanticZoom_ViewChangeStarted: Self = Self(201i32); pub const SemanticZoom_ViewChangeCompleted: Self = Self(202i32); pub const SettingsFlyout_BackClick: Self = Self(203i32); pub const StackPanel_HorizontalSnapPointsChanged: Self = Self(208i32); pub const StackPanel_VerticalSnapPointsChanged: Self = Self(209i32); pub const TimePicker_TimeChanged: Self = Self(227i32); pub const ToggleSwitch_Toggled: Self = Self(228i32); pub const ToolTip_Closed: Self = Self(229i32); pub const ToolTip_Opened: Self = Self(230i32); pub const VirtualizingStackPanel_CleanUpVirtualizedItemEvent: Self = Self(231i32); pub const WebView_SeparateProcessLost: Self = Self(232i32); pub const WebView_LoadCompleted: Self = Self(233i32); pub const WebView_ScriptNotify: Self = Self(234i32); pub const WebView_NavigationFailed: Self = Self(235i32); pub const WebView_NavigationStarting: Self = Self(236i32); pub const WebView_ContentLoading: Self = Self(237i32); pub const WebView_DOMContentLoaded: Self = Self(238i32); pub const WebView_NavigationCompleted: Self = Self(239i32); pub const WebView_FrameNavigationStarting: Self = Self(240i32); pub const WebView_FrameContentLoading: Self = Self(241i32); pub const WebView_FrameDOMContentLoaded: Self = Self(242i32); pub const WebView_FrameNavigationCompleted: Self = Self(243i32); pub const WebView_LongRunningScriptDetected: Self = Self(244i32); pub const WebView_UnsafeContentWarningDisplaying: Self = Self(245i32); pub const WebView_UnviewableContentIdentified: Self = Self(246i32); pub const WebView_ContainsFullScreenElementChanged: Self = Self(247i32); pub const WebView_UnsupportedUriSchemeIdentified: Self = Self(248i32); pub const WebView_NewWindowRequested: Self = Self(249i32); pub const WebView_PermissionRequested: Self = Self(250i32); pub const ButtonBase_Click: Self = Self(256i32); pub const CarouselPanel_HorizontalSnapPointsChanged: Self = Self(257i32); pub const CarouselPanel_VerticalSnapPointsChanged: Self = Self(258i32); pub const OrientedVirtualizingPanel_HorizontalSnapPointsChanged: Self = Self(263i32); pub const OrientedVirtualizingPanel_VerticalSnapPointsChanged: Self = Self(264i32); pub const RangeBase_ValueChanged: Self = Self(267i32); pub const ScrollBar_Scroll: Self = Self(268i32); pub const Selector_SelectionChanged: Self = Self(269i32); pub const Thumb_DragStarted: Self = Self(270i32); pub const Thumb_DragDelta: Self = Self(271i32); pub const Thumb_DragCompleted: Self = Self(272i32); pub const ToggleButton_Checked: Self = Self(273i32); pub const ToggleButton_Unchecked: Self = Self(274i32); pub const ToggleButton_Indeterminate: Self = Self(275i32); pub const WebView_WebResourceRequested: Self = Self(283i32); pub const ScrollViewer_AnchorRequested: Self = Self(291i32); pub const DatePicker_SelectedDateChanged: Self = Self(322i32); pub const TimePicker_SelectedTimeChanged: Self = Self(323i32); } impl ::core::marker::Copy for XamlEventIndex {} impl ::core::clone::Clone for XamlEventIndex { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct XamlPropertyIndex(pub i32); impl XamlPropertyIndex { pub const AutomationProperties_AcceleratorKey: Self = Self(5i32); pub const AutomationProperties_AccessibilityView: Self = Self(6i32); pub const AutomationProperties_AccessKey: Self = Self(7i32); pub const AutomationProperties_AutomationId: Self = Self(8i32); pub const AutomationProperties_ControlledPeers: Self = Self(9i32); pub const AutomationProperties_HelpText: Self = Self(10i32); pub const AutomationProperties_IsRequiredForForm: Self = Self(11i32); pub const AutomationProperties_ItemStatus: Self = Self(12i32); pub const AutomationProperties_ItemType: Self = Self(13i32); pub const AutomationProperties_LabeledBy: Self = Self(14i32); pub const AutomationProperties_LiveSetting: Self = Self(15i32); pub const AutomationProperties_Name: Self = Self(16i32); pub const ToolTipService_Placement: Self = Self(24i32); pub const ToolTipService_PlacementTarget: Self = Self(25i32); pub const ToolTipService_ToolTip: Self = Self(26i32); pub const Typography_AnnotationAlternates: Self = Self(28i32); pub const Typography_Capitals: Self = Self(29i32); pub const Typography_CapitalSpacing: Self = Self(30i32); pub const Typography_CaseSensitiveForms: Self = Self(31i32); pub const Typography_ContextualAlternates: Self = Self(32i32); pub const Typography_ContextualLigatures: Self = Self(33i32); pub const Typography_ContextualSwashes: Self = Self(34i32); pub const Typography_DiscretionaryLigatures: Self = Self(35i32); pub const Typography_EastAsianExpertForms: Self = Self(36i32); pub const Typography_EastAsianLanguage: Self = Self(37i32); pub const Typography_EastAsianWidths: Self = Self(38i32); pub const Typography_Fraction: Self = Self(39i32); pub const Typography_HistoricalForms: Self = Self(40i32); pub const Typography_HistoricalLigatures: Self = Self(41i32); pub const Typography_Kerning: Self = Self(42i32); pub const Typography_MathematicalGreek: Self = Self(43i32); pub const Typography_NumeralAlignment: Self = Self(44i32); pub const Typography_NumeralStyle: Self = Self(45i32); pub const Typography_SlashedZero: Self = Self(46i32); pub const Typography_StandardLigatures: Self = Self(47i32); pub const Typography_StandardSwashes: Self = Self(48i32); pub const Typography_StylisticAlternates: Self = Self(49i32); pub const Typography_StylisticSet1: Self = Self(50i32); pub const Typography_StylisticSet10: Self = Self(51i32); pub const Typography_StylisticSet11: Self = Self(52i32); pub const Typography_StylisticSet12: Self = Self(53i32); pub const Typography_StylisticSet13: Self = Self(54i32); pub const Typography_StylisticSet14: Self = Self(55i32); pub const Typography_StylisticSet15: Self = Self(56i32); pub const Typography_StylisticSet16: Self = Self(57i32); pub const Typography_StylisticSet17: Self = Self(58i32); pub const Typography_StylisticSet18: Self = Self(59i32); pub const Typography_StylisticSet19: Self = Self(60i32); pub const Typography_StylisticSet2: Self = Self(61i32); pub const Typography_StylisticSet20: Self = Self(62i32); pub const Typography_StylisticSet3: Self = Self(63i32); pub const Typography_StylisticSet4: Self = Self(64i32); pub const Typography_StylisticSet5: Self = Self(65i32); pub const Typography_StylisticSet6: Self = Self(66i32); pub const Typography_StylisticSet7: Self = Self(67i32); pub const Typography_StylisticSet8: Self = Self(68i32); pub const Typography_StylisticSet9: Self = Self(69i32); pub const Typography_Variants: Self = Self(70i32); pub const AutomationPeer_EventsSource: Self = Self(75i32); pub const AutoSuggestBoxSuggestionChosenEventArgs_SelectedItem: Self = Self(76i32); pub const AutoSuggestBoxTextChangedEventArgs_Reason: Self = Self(77i32); pub const Brush_Opacity: Self = Self(78i32); pub const Brush_RelativeTransform: Self = Self(79i32); pub const Brush_Transform: Self = Self(80i32); pub const CollectionViewSource_IsSourceGrouped: Self = Self(81i32); pub const CollectionViewSource_ItemsPath: Self = Self(82i32); pub const CollectionViewSource_Source: Self = Self(83i32); pub const CollectionViewSource_View: Self = Self(84i32); pub const ColorKeyFrame_KeyTime: Self = Self(90i32); pub const ColorKeyFrame_Value: Self = Self(91i32); pub const ColumnDefinition_ActualWidth: Self = Self(92i32); pub const ColumnDefinition_MaxWidth: Self = Self(93i32); pub const ColumnDefinition_MinWidth: Self = Self(94i32); pub const ColumnDefinition_Width: Self = Self(95i32); pub const ComboBoxTemplateSettings_DropDownClosedHeight: Self = Self(96i32); pub const ComboBoxTemplateSettings_DropDownOffset: Self = Self(97i32); pub const ComboBoxTemplateSettings_DropDownOpenedHeight: Self = Self(98i32); pub const ComboBoxTemplateSettings_SelectedItemDirection: Self = Self(99i32); pub const DoubleKeyFrame_KeyTime: Self = Self(107i32); pub const DoubleKeyFrame_Value: Self = Self(108i32); pub const EasingFunctionBase_EasingMode: Self = Self(111i32); pub const FlyoutBase_AttachedFlyout: Self = Self(114i32); pub const FlyoutBase_Placement: Self = Self(115i32); pub const Geometry_Bounds: Self = Self(118i32); pub const Geometry_Transform: Self = Self(119i32); pub const GradientStop_Color: Self = Self(120i32); pub const GradientStop_Offset: Self = Self(121i32); pub const GroupStyle_ContainerStyle: Self = Self(124i32); pub const GroupStyle_ContainerStyleSelector: Self = Self(125i32); pub const GroupStyle_HeaderContainerStyle: Self = Self(126i32); pub const GroupStyle_HeaderTemplate: Self = Self(127i32); pub const GroupStyle_HeaderTemplateSelector: Self = Self(128i32); pub const GroupStyle_HidesIfEmpty: Self = Self(129i32); pub const GroupStyle_Panel: Self = Self(130i32); pub const InertiaExpansionBehavior_DesiredDeceleration: Self = Self(144i32); pub const InertiaExpansionBehavior_DesiredExpansion: Self = Self(145i32); pub const InertiaRotationBehavior_DesiredDeceleration: Self = Self(146i32); pub const InertiaRotationBehavior_DesiredRotation: Self = Self(147i32); pub const InertiaTranslationBehavior_DesiredDeceleration: Self = Self(148i32); pub const InertiaTranslationBehavior_DesiredDisplacement: Self = Self(149i32); pub const InputScope_Names: Self = Self(150i32); pub const InputScopeName_NameValue: Self = Self(151i32); pub const KeySpline_ControlPoint1: Self = Self(153i32); pub const KeySpline_ControlPoint2: Self = Self(154i32); pub const ManipulationPivot_Center: Self = Self(159i32); pub const ManipulationPivot_Radius: Self = Self(160i32); pub const ObjectKeyFrame_KeyTime: Self = Self(183i32); pub const ObjectKeyFrame_Value: Self = Self(184i32); pub const PageStackEntry_SourcePageType: Self = Self(185i32); pub const PathFigure_IsClosed: Self = Self(192i32); pub const PathFigure_IsFilled: Self = Self(193i32); pub const PathFigure_Segments: Self = Self(194i32); pub const PathFigure_StartPoint: Self = Self(195i32); pub const Pointer_IsInContact: Self = Self(199i32); pub const Pointer_IsInRange: Self = Self(200i32); pub const Pointer_PointerDeviceType: Self = Self(201i32); pub const Pointer_PointerId: Self = Self(202i32); pub const PointKeyFrame_KeyTime: Self = Self(205i32); pub const PointKeyFrame_Value: Self = Self(206i32); pub const PrintDocument_DocumentSource: Self = Self(209i32); pub const ProgressBarTemplateSettings_ContainerAnimationEndPosition: Self = Self(211i32); pub const ProgressBarTemplateSettings_ContainerAnimationStartPosition: Self = Self(212i32); pub const ProgressBarTemplateSettings_EllipseAnimationEndPosition: Self = Self(213i32); pub const ProgressBarTemplateSettings_EllipseAnimationWellPosition: Self = Self(214i32); pub const ProgressBarTemplateSettings_EllipseDiameter: Self = Self(215i32); pub const ProgressBarTemplateSettings_EllipseOffset: Self = Self(216i32); pub const ProgressBarTemplateSettings_IndicatorLengthDelta: Self = Self(217i32); pub const ProgressRingTemplateSettings_EllipseDiameter: Self = Self(218i32); pub const ProgressRingTemplateSettings_EllipseOffset: Self = Self(219i32); pub const ProgressRingTemplateSettings_MaxSideLength: Self = Self(220i32); pub const PropertyPath_Path: Self = Self(221i32); pub const RowDefinition_ActualHeight: Self = Self(226i32); pub const RowDefinition_Height: Self = Self(227i32); pub const RowDefinition_MaxHeight: Self = Self(228i32); pub const RowDefinition_MinHeight: Self = Self(229i32); pub const SetterBase_IsSealed: Self = Self(233i32); pub const SettingsFlyoutTemplateSettings_BorderBrush: Self = Self(234i32); pub const SettingsFlyoutTemplateSettings_BorderThickness: Self = Self(235i32); pub const SettingsFlyoutTemplateSettings_ContentTransitions: Self = Self(236i32); pub const SettingsFlyoutTemplateSettings_HeaderBackground: Self = Self(237i32); pub const SettingsFlyoutTemplateSettings_HeaderForeground: Self = Self(238i32); pub const SettingsFlyoutTemplateSettings_IconSource: Self = Self(239i32); pub const Style_BasedOn: Self = Self(244i32); pub const Style_IsSealed: Self = Self(245i32); pub const Style_Setters: Self = Self(246i32); pub const Style_TargetType: Self = Self(247i32); pub const TextElement_CharacterSpacing: Self = Self(249i32); pub const TextElement_FontFamily: Self = Self(250i32); pub const TextElement_FontSize: Self = Self(251i32); pub const TextElement_FontStretch: Self = Self(252i32); pub const TextElement_FontStyle: Self = Self(253i32); pub const TextElement_FontWeight: Self = Self(254i32); pub const TextElement_Foreground: Self = Self(255i32); pub const TextElement_IsTextScaleFactorEnabled: Self = Self(256i32); pub const TextElement_Language: Self = Self(257i32); pub const Timeline_AutoReverse: Self = Self(263i32); pub const Timeline_BeginTime: Self = Self(264i32); pub const Timeline_Duration: Self = Self(265i32); pub const Timeline_FillBehavior: Self = Self(266i32); pub const Timeline_RepeatBehavior: Self = Self(267i32); pub const Timeline_SpeedRatio: Self = Self(268i32); pub const TimelineMarker_Text: Self = Self(269i32); pub const TimelineMarker_Time: Self = Self(270i32); pub const TimelineMarker_Type: Self = Self(271i32); pub const ToggleSwitchTemplateSettings_CurtainCurrentToOffOffset: Self = Self(273i32); pub const ToggleSwitchTemplateSettings_CurtainCurrentToOnOffset: Self = Self(274i32); pub const ToggleSwitchTemplateSettings_CurtainOffToOnOffset: Self = Self(275i32); pub const ToggleSwitchTemplateSettings_CurtainOnToOffOffset: Self = Self(276i32); pub const ToggleSwitchTemplateSettings_KnobCurrentToOffOffset: Self = Self(277i32); pub const ToggleSwitchTemplateSettings_KnobCurrentToOnOffset: Self = Self(278i32); pub const ToggleSwitchTemplateSettings_KnobOffToOnOffset: Self = Self(279i32); pub const ToggleSwitchTemplateSettings_KnobOnToOffOffset: Self = Self(280i32); pub const ToolTipTemplateSettings_FromHorizontalOffset: Self = Self(281i32); pub const ToolTipTemplateSettings_FromVerticalOffset: Self = Self(282i32); pub const UIElement_AllowDrop: Self = Self(292i32); pub const UIElement_CacheMode: Self = Self(293i32); pub const UIElement_Clip: Self = Self(295i32); pub const UIElement_CompositeMode: Self = Self(296i32); pub const UIElement_IsDoubleTapEnabled: Self = Self(297i32); pub const UIElement_IsHitTestVisible: Self = Self(298i32); pub const UIElement_IsHoldingEnabled: Self = Self(299i32); pub const UIElement_IsRightTapEnabled: Self = Self(300i32); pub const UIElement_IsTapEnabled: Self = Self(301i32); pub const UIElement_ManipulationMode: Self = Self(302i32); pub const UIElement_Opacity: Self = Self(303i32); pub const UIElement_PointerCaptures: Self = Self(304i32); pub const UIElement_Projection: Self = Self(305i32); pub const UIElement_RenderSize: Self = Self(306i32); pub const UIElement_RenderTransform: Self = Self(307i32); pub const UIElement_RenderTransformOrigin: Self = Self(308i32); pub const UIElement_Transitions: Self = Self(309i32); pub const UIElement_UseLayoutRounding: Self = Self(311i32); pub const UIElement_Visibility: Self = Self(312i32); pub const VisualState_Storyboard: Self = Self(322i32); pub const VisualStateGroup_States: Self = Self(323i32); pub const VisualStateGroup_Transitions: Self = Self(324i32); pub const VisualStateManager_CustomVisualStateManager: Self = Self(325i32); pub const VisualStateManager_VisualStateGroups: Self = Self(326i32); pub const VisualTransition_From: Self = Self(327i32); pub const VisualTransition_GeneratedDuration: Self = Self(328i32); pub const VisualTransition_GeneratedEasingFunction: Self = Self(329i32); pub const VisualTransition_Storyboard: Self = Self(330i32); pub const VisualTransition_To: Self = Self(331i32); pub const ArcSegment_IsLargeArc: Self = Self(332i32); pub const ArcSegment_Point: Self = Self(333i32); pub const ArcSegment_RotationAngle: Self = Self(334i32); pub const ArcSegment_Size: Self = Self(335i32); pub const ArcSegment_SweepDirection: Self = Self(336i32); pub const BackEase_Amplitude: Self = Self(337i32); pub const BeginStoryboard_Storyboard: Self = Self(338i32); pub const BezierSegment_Point1: Self = Self(339i32); pub const BezierSegment_Point2: Self = Self(340i32); pub const BezierSegment_Point3: Self = Self(341i32); pub const BitmapSource_PixelHeight: Self = Self(342i32); pub const BitmapSource_PixelWidth: Self = Self(343i32); pub const Block_LineHeight: Self = Self(344i32); pub const Block_LineStackingStrategy: Self = Self(345i32); pub const Block_Margin: Self = Self(346i32); pub const Block_TextAlignment: Self = Self(347i32); pub const BounceEase_Bounces: Self = Self(348i32); pub const BounceEase_Bounciness: Self = Self(349i32); pub const ColorAnimation_By: Self = Self(350i32); pub const ColorAnimation_EasingFunction: Self = Self(351i32); pub const ColorAnimation_EnableDependentAnimation: Self = Self(352i32); pub const ColorAnimation_From: Self = Self(353i32); pub const ColorAnimation_To: Self = Self(354i32); pub const ColorAnimationUsingKeyFrames_EnableDependentAnimation: Self = Self(355i32); pub const ColorAnimationUsingKeyFrames_KeyFrames: Self = Self(356i32); pub const ContentThemeTransition_HorizontalOffset: Self = Self(357i32); pub const ContentThemeTransition_VerticalOffset: Self = Self(358i32); pub const ControlTemplate_TargetType: Self = Self(359i32); pub const DispatcherTimer_Interval: Self = Self(362i32); pub const DoubleAnimation_By: Self = Self(363i32); pub const DoubleAnimation_EasingFunction: Self = Self(364i32); pub const DoubleAnimation_EnableDependentAnimation: Self = Self(365i32); pub const DoubleAnimation_From: Self = Self(366i32); pub const DoubleAnimation_To: Self = Self(367i32); pub const DoubleAnimationUsingKeyFrames_EnableDependentAnimation: Self = Self(368i32); pub const DoubleAnimationUsingKeyFrames_KeyFrames: Self = Self(369i32); pub const EasingColorKeyFrame_EasingFunction: Self = Self(372i32); pub const EasingDoubleKeyFrame_EasingFunction: Self = Self(373i32); pub const EasingPointKeyFrame_EasingFunction: Self = Self(374i32); pub const EdgeUIThemeTransition_Edge: Self = Self(375i32); pub const ElasticEase_Oscillations: Self = Self(376i32); pub const ElasticEase_Springiness: Self = Self(377i32); pub const EllipseGeometry_Center: Self = Self(378i32); pub const EllipseGeometry_RadiusX: Self = Self(379i32); pub const EllipseGeometry_RadiusY: Self = Self(380i32); pub const EntranceThemeTransition_FromHorizontalOffset: Self = Self(381i32); pub const EntranceThemeTransition_FromVerticalOffset: Self = Self(382i32); pub const EntranceThemeTransition_IsStaggeringEnabled: Self = Self(383i32); pub const EventTrigger_Actions: Self = Self(384i32); pub const EventTrigger_RoutedEvent: Self = Self(385i32); pub const ExponentialEase_Exponent: Self = Self(386i32); pub const Flyout_Content: Self = Self(387i32); pub const Flyout_FlyoutPresenterStyle: Self = Self(388i32); pub const FrameworkElement_ActualHeight: Self = Self(389i32); pub const FrameworkElement_ActualWidth: Self = Self(390i32); pub const FrameworkElement_DataContext: Self = Self(391i32); pub const FrameworkElement_FlowDirection: Self = Self(392i32); pub const FrameworkElement_Height: Self = Self(393i32); pub const FrameworkElement_HorizontalAlignment: Self = Self(394i32); pub const FrameworkElement_Language: Self = Self(396i32); pub const FrameworkElement_Margin: Self = Self(397i32); pub const FrameworkElement_MaxHeight: Self = Self(398i32); pub const FrameworkElement_MaxWidth: Self = Self(399i32); pub const FrameworkElement_MinHeight: Self = Self(400i32); pub const FrameworkElement_MinWidth: Self = Self(401i32); pub const FrameworkElement_Parent: Self = Self(402i32); pub const FrameworkElement_RequestedTheme: Self = Self(403i32); pub const FrameworkElement_Resources: Self = Self(404i32); pub const FrameworkElement_Style: Self = Self(405i32); pub const FrameworkElement_Tag: Self = Self(406i32); pub const FrameworkElement_Triggers: Self = Self(407i32); pub const FrameworkElement_VerticalAlignment: Self = Self(408i32); pub const FrameworkElement_Width: Self = Self(409i32); pub const FrameworkElementAutomationPeer_Owner: Self = Self(410i32); pub const GeometryGroup_Children: Self = Self(411i32); pub const GeometryGroup_FillRule: Self = Self(412i32); pub const GradientBrush_ColorInterpolationMode: Self = Self(413i32); pub const GradientBrush_GradientStops: Self = Self(414i32); pub const GradientBrush_MappingMode: Self = Self(415i32); pub const GradientBrush_SpreadMethod: Self = Self(416i32); pub const GridViewItemTemplateSettings_DragItemsCount: Self = Self(417i32); pub const ItemAutomationPeer_Item: Self = Self(419i32); pub const ItemAutomationPeer_ItemsControlAutomationPeer: Self = Self(420i32); pub const LineGeometry_EndPoint: Self = Self(422i32); pub const LineGeometry_StartPoint: Self = Self(423i32); pub const LineSegment_Point: Self = Self(424i32); pub const ListViewItemTemplateSettings_DragItemsCount: Self = Self(425i32); pub const Matrix3DProjection_ProjectionMatrix: Self = Self(426i32); pub const MenuFlyout_Items: Self = Self(427i32); pub const MenuFlyout_MenuFlyoutPresenterStyle: Self = Self(428i32); pub const ObjectAnimationUsingKeyFrames_EnableDependentAnimation: Self = Self(429i32); pub const ObjectAnimationUsingKeyFrames_KeyFrames: Self = Self(430i32); pub const PaneThemeTransition_Edge: Self = Self(431i32); pub const PathGeometry_Figures: Self = Self(432i32); pub const PathGeometry_FillRule: Self = Self(433i32); pub const PlaneProjection_CenterOfRotationX: Self = Self(434i32); pub const PlaneProjection_CenterOfRotationY: Self = Self(435i32); pub const PlaneProjection_CenterOfRotationZ: Self = Self(436i32); pub const PlaneProjection_GlobalOffsetX: Self = Self(437i32); pub const PlaneProjection_GlobalOffsetY: Self = Self(438i32); pub const PlaneProjection_GlobalOffsetZ: Self = Self(439i32); pub const PlaneProjection_LocalOffsetX: Self = Self(440i32); pub const PlaneProjection_LocalOffsetY: Self = Self(441i32); pub const PlaneProjection_LocalOffsetZ: Self = Self(442i32); pub const PlaneProjection_ProjectionMatrix: Self = Self(443i32); pub const PlaneProjection_RotationX: Self = Self(444i32); pub const PlaneProjection_RotationY: Self = Self(445i32); pub const PlaneProjection_RotationZ: Self = Self(446i32); pub const PointAnimation_By: Self = Self(447i32); pub const PointAnimation_EasingFunction: Self = Self(448i32); pub const PointAnimation_EnableDependentAnimation: Self = Self(449i32); pub const PointAnimation_From: Self = Self(450i32); pub const PointAnimation_To: Self = Self(451i32); pub const PointAnimationUsingKeyFrames_EnableDependentAnimation: Self = Self(452i32); pub const PointAnimationUsingKeyFrames_KeyFrames: Self = Self(453i32); pub const PolyBezierSegment_Points: Self = Self(456i32); pub const PolyLineSegment_Points: Self = Self(457i32); pub const PolyQuadraticBezierSegment_Points: Self = Self(458i32); pub const PopupThemeTransition_FromHorizontalOffset: Self = Self(459i32); pub const PopupThemeTransition_FromVerticalOffset: Self = Self(460i32); pub const PowerEase_Power: Self = Self(461i32); pub const QuadraticBezierSegment_Point1: Self = Self(466i32); pub const QuadraticBezierSegment_Point2: Self = Self(467i32); pub const RectangleGeometry_Rect: Self = Self(470i32); pub const RelativeSource_Mode: Self = Self(471i32); pub const RenderTargetBitmap_PixelHeight: Self = Self(472i32); pub const RenderTargetBitmap_PixelWidth: Self = Self(473i32); pub const Setter_Property: Self = Self(474i32); pub const Setter_Value: Self = Self(475i32); pub const SolidColorBrush_Color: Self = Self(476i32); pub const SplineColorKeyFrame_KeySpline: Self = Self(477i32); pub const SplineDoubleKeyFrame_KeySpline: Self = Self(478i32); pub const SplinePointKeyFrame_KeySpline: Self = Self(479i32); pub const TileBrush_AlignmentX: Self = Self(483i32); pub const TileBrush_AlignmentY: Self = Self(484i32); pub const TileBrush_Stretch: Self = Self(485i32); pub const Binding_Converter: Self = Self(487i32); pub const Binding_ConverterLanguage: Self = Self(488i32); pub const Binding_ConverterParameter: Self = Self(489i32); pub const Binding_ElementName: Self = Self(490i32); pub const Binding_FallbackValue: Self = Self(491i32); pub const Binding_Mode: Self = Self(492i32); pub const Binding_Path: Self = Self(493i32); pub const Binding_RelativeSource: Self = Self(494i32); pub const Binding_Source: Self = Self(495i32); pub const Binding_TargetNullValue: Self = Self(496i32); pub const Binding_UpdateSourceTrigger: Self = Self(497i32); pub const BitmapImage_CreateOptions: Self = Self(498i32); pub const BitmapImage_DecodePixelHeight: Self = Self(499i32); pub const BitmapImage_DecodePixelType: Self = Self(500i32); pub const BitmapImage_DecodePixelWidth: Self = Self(501i32); pub const BitmapImage_UriSource: Self = Self(502i32); pub const Border_Background: Self = Self(503i32); pub const Border_BorderBrush: Self = Self(504i32); pub const Border_BorderThickness: Self = Self(505i32); pub const Border_Child: Self = Self(506i32); pub const Border_ChildTransitions: Self = Self(507i32); pub const Border_CornerRadius: Self = Self(508i32); pub const Border_Padding: Self = Self(509i32); pub const CaptureElement_Source: Self = Self(510i32); pub const CaptureElement_Stretch: Self = Self(511i32); pub const CompositeTransform_CenterX: Self = Self(514i32); pub const CompositeTransform_CenterY: Self = Self(515i32); pub const CompositeTransform_Rotation: Self = Self(516i32); pub const CompositeTransform_ScaleX: Self = Self(517i32); pub const CompositeTransform_ScaleY: Self = Self(518i32); pub const CompositeTransform_SkewX: Self = Self(519i32); pub const CompositeTransform_SkewY: Self = Self(520i32); pub const CompositeTransform_TranslateX: Self = Self(521i32); pub const CompositeTransform_TranslateY: Self = Self(522i32); pub const ContentPresenter_CharacterSpacing: Self = Self(523i32); pub const ContentPresenter_Content: Self = Self(524i32); pub const ContentPresenter_ContentTemplate: Self = Self(525i32); pub const ContentPresenter_ContentTemplateSelector: Self = Self(526i32); pub const ContentPresenter_ContentTransitions: Self = Self(527i32); pub const ContentPresenter_FontFamily: Self = Self(528i32); pub const ContentPresenter_FontSize: Self = Self(529i32); pub const ContentPresenter_FontStretch: Self = Self(530i32); pub const ContentPresenter_FontStyle: Self = Self(531i32); pub const ContentPresenter_FontWeight: Self = Self(532i32); pub const ContentPresenter_Foreground: Self = Self(533i32); pub const ContentPresenter_IsTextScaleFactorEnabled: Self = Self(534i32); pub const ContentPresenter_LineStackingStrategy: Self = Self(535i32); pub const ContentPresenter_MaxLines: Self = Self(536i32); pub const ContentPresenter_OpticalMarginAlignment: Self = Self(537i32); pub const ContentPresenter_TextLineBounds: Self = Self(539i32); pub const ContentPresenter_TextWrapping: Self = Self(540i32); pub const Control_Background: Self = Self(541i32); pub const Control_BorderBrush: Self = Self(542i32); pub const Control_BorderThickness: Self = Self(543i32); pub const Control_CharacterSpacing: Self = Self(544i32); pub const Control_FocusState: Self = Self(546i32); pub const Control_FontFamily: Self = Self(547i32); pub const Control_FontSize: Self = Self(548i32); pub const Control_FontStretch: Self = Self(549i32); pub const Control_FontStyle: Self = Self(550i32); pub const Control_FontWeight: Self = Self(551i32); pub const Control_Foreground: Self = Self(552i32); pub const Control_HorizontalContentAlignment: Self = Self(553i32); pub const Control_IsEnabled: Self = Self(554i32); pub const Control_IsTabStop: Self = Self(555i32); pub const Control_IsTextScaleFactorEnabled: Self = Self(556i32); pub const Control_Padding: Self = Self(557i32); pub const Control_TabIndex: Self = Self(558i32); pub const Control_TabNavigation: Self = Self(559i32); pub const Control_Template: Self = Self(560i32); pub const Control_VerticalContentAlignment: Self = Self(561i32); pub const DragItemThemeAnimation_TargetName: Self = Self(565i32); pub const DragOverThemeAnimation_Direction: Self = Self(566i32); pub const DragOverThemeAnimation_TargetName: Self = Self(567i32); pub const DragOverThemeAnimation_ToOffset: Self = Self(568i32); pub const DropTargetItemThemeAnimation_TargetName: Self = Self(569i32); pub const FadeInThemeAnimation_TargetName: Self = Self(570i32); pub const FadeOutThemeAnimation_TargetName: Self = Self(571i32); pub const Glyphs_Fill: Self = Self(574i32); pub const Glyphs_FontRenderingEmSize: Self = Self(575i32); pub const Glyphs_FontUri: Self = Self(576i32); pub const Glyphs_Indices: Self = Self(577i32); pub const Glyphs_OriginX: Self = Self(578i32); pub const Glyphs_OriginY: Self = Self(579i32); pub const Glyphs_StyleSimulations: Self = Self(580i32); pub const Glyphs_UnicodeString: Self = Self(581i32); pub const IconElement_Foreground: Self = Self(584i32); pub const Image_NineGrid: Self = Self(586i32); pub const Image_PlayToSource: Self = Self(587i32); pub const Image_Source: Self = Self(588i32); pub const Image_Stretch: Self = Self(589i32); pub const ImageBrush_ImageSource: Self = Self(591i32); pub const InlineUIContainer_Child: Self = Self(592i32); pub const ItemsPresenter_Footer: Self = Self(594i32); pub const ItemsPresenter_FooterTemplate: Self = Self(595i32); pub const ItemsPresenter_FooterTransitions: Self = Self(596i32); pub const ItemsPresenter_Header: Self = Self(597i32); pub const ItemsPresenter_HeaderTemplate: Self = Self(598i32); pub const ItemsPresenter_HeaderTransitions: Self = Self(599i32); pub const ItemsPresenter_Padding: Self = Self(601i32); pub const LinearGradientBrush_EndPoint: Self = Self(602i32); pub const LinearGradientBrush_StartPoint: Self = Self(603i32); pub const MatrixTransform_Matrix: Self = Self(604i32); pub const MediaElement_ActualStereo3DVideoPackingMode: Self = Self(605i32); pub const MediaElement_AreTransportControlsEnabled: Self = Self(606i32); pub const MediaElement_AspectRatioHeight: Self = Self(607i32); pub const MediaElement_AspectRatioWidth: Self = Self(608i32); pub const MediaElement_AudioCategory: Self = Self(609i32); pub const MediaElement_AudioDeviceType: Self = Self(610i32); pub const MediaElement_AudioStreamCount: Self = Self(611i32); pub const MediaElement_AudioStreamIndex: Self = Self(612i32); pub const MediaElement_AutoPlay: Self = Self(613i32); pub const MediaElement_Balance: Self = Self(614i32); pub const MediaElement_BufferingProgress: Self = Self(615i32); pub const MediaElement_CanPause: Self = Self(616i32); pub const MediaElement_CanSeek: Self = Self(617i32); pub const MediaElement_CurrentState: Self = Self(618i32); pub const MediaElement_DefaultPlaybackRate: Self = Self(619i32); pub const MediaElement_DownloadProgress: Self = Self(620i32); pub const MediaElement_DownloadProgressOffset: Self = Self(621i32); pub const MediaElement_IsAudioOnly: Self = Self(623i32); pub const MediaElement_IsFullWindow: Self = Self(624i32); pub const MediaElement_IsLooping: Self = Self(625i32); pub const MediaElement_IsMuted: Self = Self(626i32); pub const MediaElement_IsStereo3DVideo: Self = Self(627i32); pub const MediaElement_Markers: Self = Self(628i32); pub const MediaElement_NaturalDuration: Self = Self(629i32); pub const MediaElement_NaturalVideoHeight: Self = Self(630i32); pub const MediaElement_NaturalVideoWidth: Self = Self(631i32); pub const MediaElement_PlaybackRate: Self = Self(632i32); pub const MediaElement_PlayToPreferredSourceUri: Self = Self(633i32); pub const MediaElement_PlayToSource: Self = Self(634i32); pub const MediaElement_Position: Self = Self(635i32); pub const MediaElement_PosterSource: Self = Self(636i32); pub const MediaElement_ProtectionManager: Self = Self(637i32); pub const MediaElement_RealTimePlayback: Self = Self(638i32); pub const MediaElement_Source: Self = Self(639i32); pub const MediaElement_Stereo3DVideoPackingMode: Self = Self(640i32); pub const MediaElement_Stereo3DVideoRenderMode: Self = Self(641i32); pub const MediaElement_Stretch: Self = Self(642i32); pub const MediaElement_TransportControls: Self = Self(643i32); pub const MediaElement_Volume: Self = Self(644i32); pub const Panel_Background: Self = Self(647i32); pub const Panel_Children: Self = Self(648i32); pub const Panel_ChildrenTransitions: Self = Self(649i32); pub const Panel_IsItemsHost: Self = Self(651i32); pub const Paragraph_Inlines: Self = Self(652i32); pub const Paragraph_TextIndent: Self = Self(653i32); pub const PointerDownThemeAnimation_TargetName: Self = Self(660i32); pub const PointerUpThemeAnimation_TargetName: Self = Self(662i32); pub const PopInThemeAnimation_FromHorizontalOffset: Self = Self(664i32); pub const PopInThemeAnimation_FromVerticalOffset: Self = Self(665i32); pub const PopInThemeAnimation_TargetName: Self = Self(666i32); pub const PopOutThemeAnimation_TargetName: Self = Self(667i32); pub const Popup_Child: Self = Self(668i32); pub const Popup_ChildTransitions: Self = Self(669i32); pub const Popup_HorizontalOffset: Self = Self(670i32); pub const Popup_IsLightDismissEnabled: Self = Self(673i32); pub const Popup_IsOpen: Self = Self(674i32); pub const Popup_VerticalOffset: Self = Self(676i32); pub const RepositionThemeAnimation_FromHorizontalOffset: Self = Self(683i32); pub const RepositionThemeAnimation_FromVerticalOffset: Self = Self(684i32); pub const RepositionThemeAnimation_TargetName: Self = Self(685i32); pub const ResourceDictionary_MergedDictionaries: Self = Self(687i32); pub const ResourceDictionary_Source: Self = Self(688i32); pub const ResourceDictionary_ThemeDictionaries: Self = Self(689i32); pub const RichTextBlock_Blocks: Self = Self(691i32); pub const RichTextBlock_CharacterSpacing: Self = Self(692i32); pub const RichTextBlock_FontFamily: Self = Self(693i32); pub const RichTextBlock_FontSize: Self = Self(694i32); pub const RichTextBlock_FontStretch: Self = Self(695i32); pub const RichTextBlock_FontStyle: Self = Self(696i32); pub const RichTextBlock_FontWeight: Self = Self(697i32); pub const RichTextBlock_Foreground: Self = Self(698i32); pub const RichTextBlock_HasOverflowContent: Self = Self(699i32); pub const RichTextBlock_IsColorFontEnabled: Self = Self(700i32); pub const RichTextBlock_IsTextScaleFactorEnabled: Self = Self(701i32); pub const RichTextBlock_IsTextSelectionEnabled: Self = Self(702i32); pub const RichTextBlock_LineHeight: Self = Self(703i32); pub const RichTextBlock_LineStackingStrategy: Self = Self(704i32); pub const RichTextBlock_MaxLines: Self = Self(705i32); pub const RichTextBlock_OpticalMarginAlignment: Self = Self(706i32); pub const RichTextBlock_OverflowContentTarget: Self = Self(707i32); pub const RichTextBlock_Padding: Self = Self(708i32); pub const RichTextBlock_SelectedText: Self = Self(709i32); pub const RichTextBlock_SelectionHighlightColor: Self = Self(710i32); pub const RichTextBlock_TextAlignment: Self = Self(711i32); pub const RichTextBlock_TextIndent: Self = Self(712i32); pub const RichTextBlock_TextLineBounds: Self = Self(713i32); pub const RichTextBlock_TextReadingOrder: Self = Self(714i32); pub const RichTextBlock_TextTrimming: Self = Self(715i32); pub const RichTextBlock_TextWrapping: Self = Self(716i32); pub const RichTextBlockOverflow_HasOverflowContent: Self = Self(717i32); pub const RichTextBlockOverflow_MaxLines: Self = Self(718i32); pub const RichTextBlockOverflow_OverflowContentTarget: Self = Self(719i32); pub const RichTextBlockOverflow_Padding: Self = Self(720i32); pub const RotateTransform_Angle: Self = Self(721i32); pub const RotateTransform_CenterX: Self = Self(722i32); pub const RotateTransform_CenterY: Self = Self(723i32); pub const Run_FlowDirection: Self = Self(725i32); pub const Run_Text: Self = Self(726i32); pub const ScaleTransform_CenterX: Self = Self(727i32); pub const ScaleTransform_CenterY: Self = Self(728i32); pub const ScaleTransform_ScaleX: Self = Self(729i32); pub const ScaleTransform_ScaleY: Self = Self(730i32); pub const SetterBaseCollection_IsSealed: Self = Self(732i32); pub const Shape_Fill: Self = Self(733i32); pub const Shape_GeometryTransform: Self = Self(734i32); pub const Shape_Stretch: Self = Self(735i32); pub const Shape_Stroke: Self = Self(736i32); pub const Shape_StrokeDashArray: Self = Self(737i32); pub const Shape_StrokeDashCap: Self = Self(738i32); pub const Shape_StrokeDashOffset: Self = Self(739i32); pub const Shape_StrokeEndLineCap: Self = Self(740i32); pub const Shape_StrokeLineJoin: Self = Self(741i32); pub const Shape_StrokeMiterLimit: Self = Self(742i32); pub const Shape_StrokeStartLineCap: Self = Self(743i32); pub const Shape_StrokeThickness: Self = Self(744i32); pub const SkewTransform_AngleX: Self = Self(745i32); pub const SkewTransform_AngleY: Self = Self(746i32); pub const SkewTransform_CenterX: Self = Self(747i32); pub const SkewTransform_CenterY: Self = Self(748i32); pub const Span_Inlines: Self = Self(749i32); pub const SplitCloseThemeAnimation_ClosedLength: Self = Self(750i32); pub const SplitCloseThemeAnimation_ClosedTarget: Self = Self(751i32); pub const SplitCloseThemeAnimation_ClosedTargetName: Self = Self(752i32); pub const SplitCloseThemeAnimation_ContentTarget: Self = Self(753i32); pub const SplitCloseThemeAnimation_ContentTargetName: Self = Self(754i32); pub const SplitCloseThemeAnimation_ContentTranslationDirection: Self = Self(755i32); pub const SplitCloseThemeAnimation_ContentTranslationOffset: Self = Self(756i32); pub const SplitCloseThemeAnimation_OffsetFromCenter: Self = Self(757i32); pub const SplitCloseThemeAnimation_OpenedLength: Self = Self(758i32); pub const SplitCloseThemeAnimation_OpenedTarget: Self = Self(759i32); pub const SplitCloseThemeAnimation_OpenedTargetName: Self = Self(760i32); pub const SplitOpenThemeAnimation_ClosedLength: Self = Self(761i32); pub const SplitOpenThemeAnimation_ClosedTarget: Self = Self(762i32); pub const SplitOpenThemeAnimation_ClosedTargetName: Self = Self(763i32); pub const SplitOpenThemeAnimation_ContentTarget: Self = Self(764i32); pub const SplitOpenThemeAnimation_ContentTargetName: Self = Self(765i32); pub const SplitOpenThemeAnimation_ContentTranslationDirection: Self = Self(766i32); pub const SplitOpenThemeAnimation_ContentTranslationOffset: Self = Self(767i32); pub const SplitOpenThemeAnimation_OffsetFromCenter: Self = Self(768i32); pub const SplitOpenThemeAnimation_OpenedLength: Self = Self(769i32); pub const SplitOpenThemeAnimation_OpenedTarget: Self = Self(770i32); pub const SplitOpenThemeAnimation_OpenedTargetName: Self = Self(771i32); pub const Storyboard_Children: Self = Self(772i32); pub const Storyboard_TargetName: Self = Self(774i32); pub const Storyboard_TargetProperty: Self = Self(775i32); pub const SwipeBackThemeAnimation_FromHorizontalOffset: Self = Self(776i32); pub const SwipeBackThemeAnimation_FromVerticalOffset: Self = Self(777i32); pub const SwipeBackThemeAnimation_TargetName: Self = Self(778i32); pub const SwipeHintThemeAnimation_TargetName: Self = Self(779i32); pub const SwipeHintThemeAnimation_ToHorizontalOffset: Self = Self(780i32); pub const SwipeHintThemeAnimation_ToVerticalOffset: Self = Self(781i32); pub const TextBlock_CharacterSpacing: Self = Self(782i32); pub const TextBlock_FontFamily: Self = Self(783i32); pub const TextBlock_FontSize: Self = Self(784i32); pub const TextBlock_FontStretch: Self = Self(785i32); pub const TextBlock_FontStyle: Self = Self(786i32); pub const TextBlock_FontWeight: Self = Self(787i32); pub const TextBlock_Foreground: Self = Self(788i32); pub const TextBlock_Inlines: Self = Self(789i32); pub const TextBlock_IsColorFontEnabled: Self = Self(790i32); pub const TextBlock_IsTextScaleFactorEnabled: Self = Self(791i32); pub const TextBlock_IsTextSelectionEnabled: Self = Self(792i32); pub const TextBlock_LineHeight: Self = Self(793i32); pub const TextBlock_LineStackingStrategy: Self = Self(794i32); pub const TextBlock_MaxLines: Self = Self(795i32); pub const TextBlock_OpticalMarginAlignment: Self = Self(796i32); pub const TextBlock_Padding: Self = Self(797i32); pub const TextBlock_SelectedText: Self = Self(798i32); pub const TextBlock_SelectionHighlightColor: Self = Self(799i32); pub const TextBlock_Text: Self = Self(800i32); pub const TextBlock_TextAlignment: Self = Self(801i32); pub const TextBlock_TextDecorations: Self = Self(802i32); pub const TextBlock_TextLineBounds: Self = Self(803i32); pub const TextBlock_TextReadingOrder: Self = Self(804i32); pub const TextBlock_TextTrimming: Self = Self(805i32); pub const TextBlock_TextWrapping: Self = Self(806i32); pub const TransformGroup_Children: Self = Self(811i32); pub const TransformGroup_Value: Self = Self(812i32); pub const TranslateTransform_X: Self = Self(814i32); pub const TranslateTransform_Y: Self = Self(815i32); pub const Viewbox_Child: Self = Self(819i32); pub const Viewbox_Stretch: Self = Self(820i32); pub const Viewbox_StretchDirection: Self = Self(821i32); pub const WebViewBrush_SourceName: Self = Self(825i32); pub const AppBarSeparator_IsCompact: Self = Self(826i32); pub const BitmapIcon_UriSource: Self = Self(827i32); pub const Canvas_Left: Self = Self(828i32); pub const Canvas_Top: Self = Self(829i32); pub const Canvas_ZIndex: Self = Self(830i32); pub const ContentControl_Content: Self = Self(832i32); pub const ContentControl_ContentTemplate: Self = Self(833i32); pub const ContentControl_ContentTemplateSelector: Self = Self(834i32); pub const ContentControl_ContentTransitions: Self = Self(835i32); pub const DatePicker_CalendarIdentifier: Self = Self(837i32); pub const DatePicker_Date: Self = Self(838i32); pub const DatePicker_DayFormat: Self = Self(839i32); pub const DatePicker_DayVisible: Self = Self(840i32); pub const DatePicker_Header: Self = Self(841i32); pub const DatePicker_HeaderTemplate: Self = Self(842i32); pub const DatePicker_MaxYear: Self = Self(843i32); pub const DatePicker_MinYear: Self = Self(844i32); pub const DatePicker_MonthFormat: Self = Self(845i32); pub const DatePicker_MonthVisible: Self = Self(846i32); pub const DatePicker_Orientation: Self = Self(847i32); pub const DatePicker_YearFormat: Self = Self(848i32); pub const DatePicker_YearVisible: Self = Self(849i32); pub const FontIcon_FontFamily: Self = Self(851i32); pub const FontIcon_FontSize: Self = Self(852i32); pub const FontIcon_FontStyle: Self = Self(853i32); pub const FontIcon_FontWeight: Self = Self(854i32); pub const FontIcon_Glyph: Self = Self(855i32); pub const FontIcon_IsTextScaleFactorEnabled: Self = Self(856i32); pub const Grid_Column: Self = Self(857i32); pub const Grid_ColumnDefinitions: Self = Self(858i32); pub const Grid_ColumnSpan: Self = Self(859i32); pub const Grid_Row: Self = Self(860i32); pub const Grid_RowDefinitions: Self = Self(861i32); pub const Grid_RowSpan: Self = Self(862i32); pub const Hub_DefaultSectionIndex: Self = Self(863i32); pub const Hub_Header: Self = Self(864i32); pub const Hub_HeaderTemplate: Self = Self(865i32); pub const Hub_IsActiveView: Self = Self(866i32); pub const Hub_IsZoomedInView: Self = Self(867i32); pub const Hub_Orientation: Self = Self(868i32); pub const Hub_SectionHeaders: Self = Self(869i32); pub const Hub_Sections: Self = Self(870i32); pub const Hub_SectionsInView: Self = Self(871i32); pub const Hub_SemanticZoomOwner: Self = Self(872i32); pub const HubSection_ContentTemplate: Self = Self(873i32); pub const HubSection_Header: Self = Self(874i32); pub const HubSection_HeaderTemplate: Self = Self(875i32); pub const HubSection_IsHeaderInteractive: Self = Self(876i32); pub const Hyperlink_NavigateUri: Self = Self(877i32); pub const ItemsControl_DisplayMemberPath: Self = Self(879i32); pub const ItemsControl_GroupStyle: Self = Self(880i32); pub const ItemsControl_GroupStyleSelector: Self = Self(881i32); pub const ItemsControl_IsGrouping: Self = Self(882i32); pub const ItemsControl_ItemContainerStyle: Self = Self(884i32); pub const ItemsControl_ItemContainerStyleSelector: Self = Self(885i32); pub const ItemsControl_ItemContainerTransitions: Self = Self(886i32); pub const ItemsControl_Items: Self = Self(887i32); pub const ItemsControl_ItemsPanel: Self = Self(889i32); pub const ItemsControl_ItemsSource: Self = Self(890i32); pub const ItemsControl_ItemTemplate: Self = Self(891i32); pub const ItemsControl_ItemTemplateSelector: Self = Self(892i32); pub const Line_X1: Self = Self(893i32); pub const Line_X2: Self = Self(894i32); pub const Line_Y1: Self = Self(895i32); pub const Line_Y2: Self = Self(896i32); pub const MediaTransportControls_IsFastForwardButtonVisible: Self = Self(898i32); pub const MediaTransportControls_IsFastRewindButtonVisible: Self = Self(900i32); pub const MediaTransportControls_IsFullWindowButtonVisible: Self = Self(902i32); pub const MediaTransportControls_IsPlaybackRateButtonVisible: Self = Self(904i32); pub const MediaTransportControls_IsSeekBarVisible: Self = Self(905i32); pub const MediaTransportControls_IsStopButtonVisible: Self = Self(908i32); pub const MediaTransportControls_IsVolumeButtonVisible: Self = Self(910i32); pub const MediaTransportControls_IsZoomButtonVisible: Self = Self(912i32); pub const PasswordBox_Header: Self = Self(913i32); pub const PasswordBox_HeaderTemplate: Self = Self(914i32); pub const PasswordBox_IsPasswordRevealButtonEnabled: Self = Self(915i32); pub const PasswordBox_MaxLength: Self = Self(916i32); pub const PasswordBox_Password: Self = Self(917i32); pub const PasswordBox_PasswordChar: Self = Self(918i32); pub const PasswordBox_PlaceholderText: Self = Self(919i32); pub const PasswordBox_PreventKeyboardDisplayOnProgrammaticFocus: Self = Self(920i32); pub const PasswordBox_SelectionHighlightColor: Self = Self(921i32); pub const Path_Data: Self = Self(922i32); pub const PathIcon_Data: Self = Self(923i32); pub const Polygon_FillRule: Self = Self(924i32); pub const Polygon_Points: Self = Self(925i32); pub const Polyline_FillRule: Self = Self(926i32); pub const Polyline_Points: Self = Self(927i32); pub const ProgressRing_IsActive: Self = Self(928i32); pub const ProgressRing_TemplateSettings: Self = Self(929i32); pub const RangeBase_LargeChange: Self = Self(930i32); pub const RangeBase_Maximum: Self = Self(931i32); pub const RangeBase_Minimum: Self = Self(932i32); pub const RangeBase_SmallChange: Self = Self(933i32); pub const RangeBase_Value: Self = Self(934i32); pub const Rectangle_RadiusX: Self = Self(935i32); pub const Rectangle_RadiusY: Self = Self(936i32); pub const RichEditBox_AcceptsReturn: Self = Self(937i32); pub const RichEditBox_Header: Self = Self(938i32); pub const RichEditBox_HeaderTemplate: Self = Self(939i32); pub const RichEditBox_InputScope: Self = Self(940i32); pub const RichEditBox_IsColorFontEnabled: Self = Self(941i32); pub const RichEditBox_IsReadOnly: Self = Self(942i32); pub const RichEditBox_IsSpellCheckEnabled: Self = Self(943i32); pub const RichEditBox_IsTextPredictionEnabled: Self = Self(944i32); pub const RichEditBox_PlaceholderText: Self = Self(945i32); pub const RichEditBox_PreventKeyboardDisplayOnProgrammaticFocus: Self = Self(946i32); pub const RichEditBox_SelectionHighlightColor: Self = Self(947i32); pub const RichEditBox_TextAlignment: Self = Self(948i32); pub const RichEditBox_TextWrapping: Self = Self(949i32); pub const SearchBox_ChooseSuggestionOnEnter: Self = Self(950i32); pub const SearchBox_FocusOnKeyboardInput: Self = Self(951i32); pub const SearchBox_PlaceholderText: Self = Self(952i32); pub const SearchBox_QueryText: Self = Self(953i32); pub const SearchBox_SearchHistoryContext: Self = Self(954i32); pub const SearchBox_SearchHistoryEnabled: Self = Self(955i32); pub const SemanticZoom_CanChangeViews: Self = Self(956i32); pub const SemanticZoom_IsZoomedInViewActive: Self = Self(957i32); pub const SemanticZoom_IsZoomOutButtonEnabled: Self = Self(958i32); pub const SemanticZoom_ZoomedInView: Self = Self(959i32); pub const SemanticZoom_ZoomedOutView: Self = Self(960i32); pub const StackPanel_AreScrollSnapPointsRegular: Self = Self(961i32); pub const StackPanel_Orientation: Self = Self(962i32); pub const SymbolIcon_Symbol: Self = Self(963i32); pub const TextBox_AcceptsReturn: Self = Self(964i32); pub const TextBox_Header: Self = Self(965i32); pub const TextBox_HeaderTemplate: Self = Self(966i32); pub const TextBox_InputScope: Self = Self(967i32); pub const TextBox_IsColorFontEnabled: Self = Self(968i32); pub const TextBox_IsReadOnly: Self = Self(971i32); pub const TextBox_IsSpellCheckEnabled: Self = Self(972i32); pub const TextBox_IsTextPredictionEnabled: Self = Self(973i32); pub const TextBox_MaxLength: Self = Self(974i32); pub const TextBox_PlaceholderText: Self = Self(975i32); pub const TextBox_PreventKeyboardDisplayOnProgrammaticFocus: Self = Self(976i32); pub const TextBox_SelectedText: Self = Self(977i32); pub const TextBox_SelectionHighlightColor: Self = Self(978i32); pub const TextBox_SelectionLength: Self = Self(979i32); pub const TextBox_SelectionStart: Self = Self(980i32); pub const TextBox_Text: Self = Self(981i32); pub const TextBox_TextAlignment: Self = Self(982i32); pub const TextBox_TextWrapping: Self = Self(983i32); pub const Thumb_IsDragging: Self = Self(984i32); pub const TickBar_Fill: Self = Self(985i32); pub const TimePicker_ClockIdentifier: Self = Self(986i32); pub const TimePicker_Header: Self = Self(987i32); pub const TimePicker_HeaderTemplate: Self = Self(988i32); pub const TimePicker_MinuteIncrement: Self = Self(989i32); pub const TimePicker_Time: Self = Self(990i32); pub const ToggleSwitch_Header: Self = Self(991i32); pub const ToggleSwitch_HeaderTemplate: Self = Self(992i32); pub const ToggleSwitch_IsOn: Self = Self(993i32); pub const ToggleSwitch_OffContent: Self = Self(994i32); pub const ToggleSwitch_OffContentTemplate: Self = Self(995i32); pub const ToggleSwitch_OnContent: Self = Self(996i32); pub const ToggleSwitch_OnContentTemplate: Self = Self(997i32); pub const ToggleSwitch_TemplateSettings: Self = Self(998i32); pub const UserControl_Content: Self = Self(999i32); pub const VariableSizedWrapGrid_ColumnSpan: Self = Self(1000i32); pub const VariableSizedWrapGrid_HorizontalChildrenAlignment: Self = Self(1001i32); pub const VariableSizedWrapGrid_ItemHeight: Self = Self(1002i32); pub const VariableSizedWrapGrid_ItemWidth: Self = Self(1003i32); pub const VariableSizedWrapGrid_MaximumRowsOrColumns: Self = Self(1004i32); pub const VariableSizedWrapGrid_Orientation: Self = Self(1005i32); pub const VariableSizedWrapGrid_RowSpan: Self = Self(1006i32); pub const VariableSizedWrapGrid_VerticalChildrenAlignment: Self = Self(1007i32); pub const WebView_AllowedScriptNotifyUris: Self = Self(1008i32); pub const WebView_CanGoBack: Self = Self(1009i32); pub const WebView_CanGoForward: Self = Self(1010i32); pub const WebView_ContainsFullScreenElement: Self = Self(1011i32); pub const WebView_DataTransferPackage: Self = Self(1012i32); pub const WebView_DefaultBackgroundColor: Self = Self(1013i32); pub const WebView_DocumentTitle: Self = Self(1014i32); pub const WebView_Source: Self = Self(1015i32); pub const AppBar_ClosedDisplayMode: Self = Self(1016i32); pub const AppBar_IsOpen: Self = Self(1017i32); pub const AppBar_IsSticky: Self = Self(1018i32); pub const AutoSuggestBox_AutoMaximizeSuggestionArea: Self = Self(1019i32); pub const AutoSuggestBox_Header: Self = Self(1020i32); pub const AutoSuggestBox_IsSuggestionListOpen: Self = Self(1021i32); pub const AutoSuggestBox_MaxSuggestionListHeight: Self = Self(1022i32); pub const AutoSuggestBox_PlaceholderText: Self = Self(1023i32); pub const AutoSuggestBox_Text: Self = Self(1024i32); pub const AutoSuggestBox_TextBoxStyle: Self = Self(1025i32); pub const AutoSuggestBox_TextMemberPath: Self = Self(1026i32); pub const AutoSuggestBox_UpdateTextOnSelect: Self = Self(1027i32); pub const ButtonBase_ClickMode: Self = Self(1029i32); pub const ButtonBase_Command: Self = Self(1030i32); pub const ButtonBase_CommandParameter: Self = Self(1031i32); pub const ButtonBase_IsPointerOver: Self = Self(1032i32); pub const ButtonBase_IsPressed: Self = Self(1033i32); pub const ContentDialog_FullSizeDesired: Self = Self(1034i32); pub const ContentDialog_IsPrimaryButtonEnabled: Self = Self(1035i32); pub const ContentDialog_IsSecondaryButtonEnabled: Self = Self(1036i32); pub const ContentDialog_PrimaryButtonCommand: Self = Self(1037i32); pub const ContentDialog_PrimaryButtonCommandParameter: Self = Self(1038i32); pub const ContentDialog_PrimaryButtonText: Self = Self(1039i32); pub const ContentDialog_SecondaryButtonCommand: Self = Self(1040i32); pub const ContentDialog_SecondaryButtonCommandParameter: Self = Self(1041i32); pub const ContentDialog_SecondaryButtonText: Self = Self(1042i32); pub const ContentDialog_Title: Self = Self(1043i32); pub const ContentDialog_TitleTemplate: Self = Self(1044i32); pub const Frame_BackStack: Self = Self(1045i32); pub const Frame_BackStackDepth: Self = Self(1046i32); pub const Frame_CacheSize: Self = Self(1047i32); pub const Frame_CanGoBack: Self = Self(1048i32); pub const Frame_CanGoForward: Self = Self(1049i32); pub const Frame_CurrentSourcePageType: Self = Self(1050i32); pub const Frame_ForwardStack: Self = Self(1051i32); pub const Frame_SourcePageType: Self = Self(1052i32); pub const GridViewItemPresenter_CheckBrush: Self = Self(1053i32); pub const GridViewItemPresenter_CheckHintBrush: Self = Self(1054i32); pub const GridViewItemPresenter_CheckSelectingBrush: Self = Self(1055i32); pub const GridViewItemPresenter_ContentMargin: Self = Self(1056i32); pub const GridViewItemPresenter_DisabledOpacity: Self = Self(1057i32); pub const GridViewItemPresenter_DragBackground: Self = Self(1058i32); pub const GridViewItemPresenter_DragForeground: Self = Self(1059i32); pub const GridViewItemPresenter_DragOpacity: Self = Self(1060i32); pub const GridViewItemPresenter_FocusBorderBrush: Self = Self(1061i32); pub const GridViewItemPresenter_GridViewItemPresenterHorizontalContentAlignment: Self = Self(1062i32); pub const GridViewItemPresenter_GridViewItemPresenterPadding: Self = Self(1063i32); pub const GridViewItemPresenter_PlaceholderBackground: Self = Self(1064i32); pub const GridViewItemPresenter_PointerOverBackground: Self = Self(1065i32); pub const GridViewItemPresenter_PointerOverBackgroundMargin: Self = Self(1066i32); pub const GridViewItemPresenter_ReorderHintOffset: Self = Self(1067i32); pub const GridViewItemPresenter_SelectedBackground: Self = Self(1068i32); pub const GridViewItemPresenter_SelectedBorderThickness: Self = Self(1069i32); pub const GridViewItemPresenter_SelectedForeground: Self = Self(1070i32); pub const GridViewItemPresenter_SelectedPointerOverBackground: Self = Self(1071i32); pub const GridViewItemPresenter_SelectedPointerOverBorderBrush: Self = Self(1072i32); pub const GridViewItemPresenter_SelectionCheckMarkVisualEnabled: Self = Self(1073i32); pub const GridViewItemPresenter_GridViewItemPresenterVerticalContentAlignment: Self = Self(1074i32); pub const ItemsStackPanel_CacheLength: Self = Self(1076i32); pub const ItemsStackPanel_GroupHeaderPlacement: Self = Self(1077i32); pub const ItemsStackPanel_GroupPadding: Self = Self(1078i32); pub const ItemsStackPanel_ItemsUpdatingScrollMode: Self = Self(1079i32); pub const ItemsStackPanel_Orientation: Self = Self(1080i32); pub const ItemsWrapGrid_CacheLength: Self = Self(1081i32); pub const ItemsWrapGrid_GroupHeaderPlacement: Self = Self(1082i32); pub const ItemsWrapGrid_GroupPadding: Self = Self(1083i32); pub const ItemsWrapGrid_ItemHeight: Self = Self(1084i32); pub const ItemsWrapGrid_ItemWidth: Self = Self(1085i32); pub const ItemsWrapGrid_MaximumRowsOrColumns: Self = Self(1086i32); pub const ItemsWrapGrid_Orientation: Self = Self(1087i32); pub const ListViewItemPresenter_CheckBrush: Self = Self(1088i32); pub const ListViewItemPresenter_CheckHintBrush: Self = Self(1089i32); pub const ListViewItemPresenter_CheckSelectingBrush: Self = Self(1090i32); pub const ListViewItemPresenter_ContentMargin: Self = Self(1091i32); pub const ListViewItemPresenter_DisabledOpacity: Self = Self(1092i32); pub const ListViewItemPresenter_DragBackground: Self = Self(1093i32); pub const ListViewItemPresenter_DragForeground: Self = Self(1094i32); pub const ListViewItemPresenter_DragOpacity: Self = Self(1095i32); pub const ListViewItemPresenter_FocusBorderBrush: Self = Self(1096i32); pub const ListViewItemPresenter_ListViewItemPresenterHorizontalContentAlignment: Self = Self(1097i32); pub const ListViewItemPresenter_ListViewItemPresenterPadding: Self = Self(1098i32); pub const ListViewItemPresenter_PlaceholderBackground: Self = Self(1099i32); pub const ListViewItemPresenter_PointerOverBackground: Self = Self(1100i32); pub const ListViewItemPresenter_PointerOverBackgroundMargin: Self = Self(1101i32); pub const ListViewItemPresenter_ReorderHintOffset: Self = Self(1102i32); pub const ListViewItemPresenter_SelectedBackground: Self = Self(1103i32); pub const ListViewItemPresenter_SelectedBorderThickness: Self = Self(1104i32); pub const ListViewItemPresenter_SelectedForeground: Self = Self(1105i32); pub const ListViewItemPresenter_SelectedPointerOverBackground: Self = Self(1106i32); pub const ListViewItemPresenter_SelectedPointerOverBorderBrush: Self = Self(1107i32); pub const ListViewItemPresenter_SelectionCheckMarkVisualEnabled: Self = Self(1108i32); pub const ListViewItemPresenter_ListViewItemPresenterVerticalContentAlignment: Self = Self(1109i32); pub const MenuFlyoutItem_Command: Self = Self(1110i32); pub const MenuFlyoutItem_CommandParameter: Self = Self(1111i32); pub const MenuFlyoutItem_Text: Self = Self(1112i32); pub const Page_BottomAppBar: Self = Self(1114i32); pub const Page_Frame: Self = Self(1115i32); pub const Page_NavigationCacheMode: Self = Self(1116i32); pub const Page_TopAppBar: Self = Self(1117i32); pub const ProgressBar_IsIndeterminate: Self = Self(1118i32); pub const ProgressBar_ShowError: Self = Self(1119i32); pub const ProgressBar_ShowPaused: Self = Self(1120i32); pub const ProgressBar_TemplateSettings: Self = Self(1121i32); pub const ScrollBar_IndicatorMode: Self = Self(1122i32); pub const ScrollBar_Orientation: Self = Self(1123i32); pub const ScrollBar_ViewportSize: Self = Self(1124i32); pub const Selector_IsSynchronizedWithCurrentItem: Self = Self(1126i32); pub const Selector_SelectedIndex: Self = Self(1127i32); pub const Selector_SelectedItem: Self = Self(1128i32); pub const Selector_SelectedValue: Self = Self(1129i32); pub const Selector_SelectedValuePath: Self = Self(1130i32); pub const SelectorItem_IsSelected: Self = Self(1131i32); pub const SettingsFlyout_HeaderBackground: Self = Self(1132i32); pub const SettingsFlyout_HeaderForeground: Self = Self(1133i32); pub const SettingsFlyout_IconSource: Self = Self(1134i32); pub const SettingsFlyout_TemplateSettings: Self = Self(1135i32); pub const SettingsFlyout_Title: Self = Self(1136i32); pub const Slider_Header: Self = Self(1137i32); pub const Slider_HeaderTemplate: Self = Self(1138i32); pub const Slider_IntermediateValue: Self = Self(1139i32); pub const Slider_IsDirectionReversed: Self = Self(1140i32); pub const Slider_IsThumbToolTipEnabled: Self = Self(1141i32); pub const Slider_Orientation: Self = Self(1142i32); pub const Slider_SnapsTo: Self = Self(1143i32); pub const Slider_StepFrequency: Self = Self(1144i32); pub const Slider_ThumbToolTipValueConverter: Self = Self(1145i32); pub const Slider_TickFrequency: Self = Self(1146i32); pub const Slider_TickPlacement: Self = Self(1147i32); pub const SwapChainPanel_CompositionScaleX: Self = Self(1148i32); pub const SwapChainPanel_CompositionScaleY: Self = Self(1149i32); pub const ToolTip_HorizontalOffset: Self = Self(1150i32); pub const ToolTip_IsOpen: Self = Self(1151i32); pub const ToolTip_Placement: Self = Self(1152i32); pub const ToolTip_PlacementTarget: Self = Self(1153i32); pub const ToolTip_TemplateSettings: Self = Self(1154i32); pub const ToolTip_VerticalOffset: Self = Self(1155i32); pub const Button_Flyout: Self = Self(1156i32); pub const ComboBox_Header: Self = Self(1157i32); pub const ComboBox_HeaderTemplate: Self = Self(1158i32); pub const ComboBox_IsDropDownOpen: Self = Self(1159i32); pub const ComboBox_IsEditable: Self = Self(1160i32); pub const ComboBox_IsSelectionBoxHighlighted: Self = Self(1161i32); pub const ComboBox_MaxDropDownHeight: Self = Self(1162i32); pub const ComboBox_PlaceholderText: Self = Self(1163i32); pub const ComboBox_SelectionBoxItem: Self = Self(1164i32); pub const ComboBox_SelectionBoxItemTemplate: Self = Self(1165i32); pub const ComboBox_TemplateSettings: Self = Self(1166i32); pub const CommandBar_PrimaryCommands: Self = Self(1167i32); pub const CommandBar_SecondaryCommands: Self = Self(1168i32); pub const FlipView_UseTouchAnimationsForAllNavigation: Self = Self(1169i32); pub const HyperlinkButton_NavigateUri: Self = Self(1170i32); pub const ListBox_SelectedItems: Self = Self(1171i32); pub const ListBox_SelectionMode: Self = Self(1172i32); pub const ListViewBase_CanDragItems: Self = Self(1173i32); pub const ListViewBase_CanReorderItems: Self = Self(1174i32); pub const ListViewBase_DataFetchSize: Self = Self(1175i32); pub const ListViewBase_Footer: Self = Self(1176i32); pub const ListViewBase_FooterTemplate: Self = Self(1177i32); pub const ListViewBase_FooterTransitions: Self = Self(1178i32); pub const ListViewBase_Header: Self = Self(1179i32); pub const ListViewBase_HeaderTemplate: Self = Self(1180i32); pub const ListViewBase_HeaderTransitions: Self = Self(1181i32); pub const ListViewBase_IncrementalLoadingThreshold: Self = Self(1182i32); pub const ListViewBase_IncrementalLoadingTrigger: Self = Self(1183i32); pub const ListViewBase_IsActiveView: Self = Self(1184i32); pub const ListViewBase_IsItemClickEnabled: Self = Self(1185i32); pub const ListViewBase_IsSwipeEnabled: Self = Self(1186i32); pub const ListViewBase_IsZoomedInView: Self = Self(1187i32); pub const ListViewBase_ReorderMode: Self = Self(1188i32); pub const ListViewBase_SelectedItems: Self = Self(1189i32); pub const ListViewBase_SelectionMode: Self = Self(1190i32); pub const ListViewBase_SemanticZoomOwner: Self = Self(1191i32); pub const ListViewBase_ShowsScrollingPlaceholders: Self = Self(1192i32); pub const RepeatButton_Delay: Self = Self(1193i32); pub const RepeatButton_Interval: Self = Self(1194i32); pub const ScrollViewer_BringIntoViewOnFocusChange: Self = Self(1195i32); pub const ScrollViewer_ComputedHorizontalScrollBarVisibility: Self = Self(1196i32); pub const ScrollViewer_ComputedVerticalScrollBarVisibility: Self = Self(1197i32); pub const ScrollViewer_ExtentHeight: Self = Self(1198i32); pub const ScrollViewer_ExtentWidth: Self = Self(1199i32); pub const ScrollViewer_HorizontalOffset: Self = Self(1200i32); pub const ScrollViewer_HorizontalScrollBarVisibility: Self = Self(1201i32); pub const ScrollViewer_HorizontalScrollMode: Self = Self(1202i32); pub const ScrollViewer_HorizontalSnapPointsAlignment: Self = Self(1203i32); pub const ScrollViewer_HorizontalSnapPointsType: Self = Self(1204i32); pub const ScrollViewer_IsDeferredScrollingEnabled: Self = Self(1205i32); pub const ScrollViewer_IsHorizontalRailEnabled: Self = Self(1206i32); pub const ScrollViewer_IsHorizontalScrollChainingEnabled: Self = Self(1207i32); pub const ScrollViewer_IsScrollInertiaEnabled: Self = Self(1208i32); pub const ScrollViewer_IsVerticalRailEnabled: Self = Self(1209i32); pub const ScrollViewer_IsVerticalScrollChainingEnabled: Self = Self(1210i32); pub const ScrollViewer_IsZoomChainingEnabled: Self = Self(1211i32); pub const ScrollViewer_IsZoomInertiaEnabled: Self = Self(1212i32); pub const ScrollViewer_LeftHeader: Self = Self(1213i32); pub const ScrollViewer_MaxZoomFactor: Self = Self(1214i32); pub const ScrollViewer_MinZoomFactor: Self = Self(1215i32); pub const ScrollViewer_ScrollableHeight: Self = Self(1216i32); pub const ScrollViewer_ScrollableWidth: Self = Self(1217i32); pub const ScrollViewer_TopHeader: Self = Self(1218i32); pub const ScrollViewer_TopLeftHeader: Self = Self(1219i32); pub const ScrollViewer_VerticalOffset: Self = Self(1220i32); pub const ScrollViewer_VerticalScrollBarVisibility: Self = Self(1221i32); pub const ScrollViewer_VerticalScrollMode: Self = Self(1222i32); pub const ScrollViewer_VerticalSnapPointsAlignment: Self = Self(1223i32); pub const ScrollViewer_VerticalSnapPointsType: Self = Self(1224i32); pub const ScrollViewer_ViewportHeight: Self = Self(1225i32); pub const ScrollViewer_ViewportWidth: Self = Self(1226i32); pub const ScrollViewer_ZoomFactor: Self = Self(1227i32); pub const ScrollViewer_ZoomMode: Self = Self(1228i32); pub const ScrollViewer_ZoomSnapPoints: Self = Self(1229i32); pub const ScrollViewer_ZoomSnapPointsType: Self = Self(1230i32); pub const ToggleButton_IsChecked: Self = Self(1231i32); pub const ToggleButton_IsThreeState: Self = Self(1232i32); pub const ToggleMenuFlyoutItem_IsChecked: Self = Self(1233i32); pub const VirtualizingStackPanel_AreScrollSnapPointsRegular: Self = Self(1234i32); pub const VirtualizingStackPanel_IsVirtualizing: Self = Self(1236i32); pub const VirtualizingStackPanel_Orientation: Self = Self(1237i32); pub const VirtualizingStackPanel_VirtualizationMode: Self = Self(1238i32); pub const WrapGrid_HorizontalChildrenAlignment: Self = Self(1239i32); pub const WrapGrid_ItemHeight: Self = Self(1240i32); pub const WrapGrid_ItemWidth: Self = Self(1241i32); pub const WrapGrid_MaximumRowsOrColumns: Self = Self(1242i32); pub const WrapGrid_Orientation: Self = Self(1243i32); pub const WrapGrid_VerticalChildrenAlignment: Self = Self(1244i32); pub const AppBarButton_Icon: Self = Self(1245i32); pub const AppBarButton_IsCompact: Self = Self(1246i32); pub const AppBarButton_Label: Self = Self(1247i32); pub const AppBarToggleButton_Icon: Self = Self(1248i32); pub const AppBarToggleButton_IsCompact: Self = Self(1249i32); pub const AppBarToggleButton_Label: Self = Self(1250i32); pub const GridViewItem_TemplateSettings: Self = Self(1251i32); pub const ListViewItem_TemplateSettings: Self = Self(1252i32); pub const RadioButton_GroupName: Self = Self(1253i32); pub const Glyphs_ColorFontPaletteIndex: Self = Self(1267i32); pub const Glyphs_IsColorFontEnabled: Self = Self(1268i32); pub const CalendarViewTemplateSettings_HasMoreContentAfter: Self = Self(1274i32); pub const CalendarViewTemplateSettings_HasMoreContentBefore: Self = Self(1275i32); pub const CalendarViewTemplateSettings_HasMoreViews: Self = Self(1276i32); pub const CalendarViewTemplateSettings_HeaderText: Self = Self(1277i32); pub const CalendarViewTemplateSettings_WeekDay1: Self = Self(1280i32); pub const CalendarViewTemplateSettings_WeekDay2: Self = Self(1281i32); pub const CalendarViewTemplateSettings_WeekDay3: Self = Self(1282i32); pub const CalendarViewTemplateSettings_WeekDay4: Self = Self(1283i32); pub const CalendarViewTemplateSettings_WeekDay5: Self = Self(1284i32); pub const CalendarViewTemplateSettings_WeekDay6: Self = Self(1285i32); pub const CalendarViewTemplateSettings_WeekDay7: Self = Self(1286i32); pub const CalendarView_CalendarIdentifier: Self = Self(1291i32); pub const CalendarView_DayOfWeekFormat: Self = Self(1299i32); pub const CalendarView_DisplayMode: Self = Self(1302i32); pub const CalendarView_FirstDayOfWeek: Self = Self(1303i32); pub const CalendarView_IsOutOfScopeEnabled: Self = Self(1317i32); pub const CalendarView_IsTodayHighlighted: Self = Self(1318i32); pub const CalendarView_MaxDate: Self = Self(1320i32); pub const CalendarView_MinDate: Self = Self(1321i32); pub const CalendarView_NumberOfWeeksInView: Self = Self(1327i32); pub const CalendarView_SelectedDates: Self = Self(1333i32); pub const CalendarView_SelectionMode: Self = Self(1335i32); pub const CalendarView_TemplateSettings: Self = Self(1336i32); pub const CalendarViewDayItem_Date: Self = Self(1339i32); pub const CalendarViewDayItem_IsBlackout: Self = Self(1340i32); pub const MediaTransportControls_IsFastForwardEnabled: Self = Self(1382i32); pub const MediaTransportControls_IsFastRewindEnabled: Self = Self(1383i32); pub const MediaTransportControls_IsFullWindowEnabled: Self = Self(1384i32); pub const MediaTransportControls_IsPlaybackRateEnabled: Self = Self(1385i32); pub const MediaTransportControls_IsSeekEnabled: Self = Self(1386i32); pub const MediaTransportControls_IsStopEnabled: Self = Self(1387i32); pub const MediaTransportControls_IsVolumeEnabled: Self = Self(1388i32); pub const MediaTransportControls_IsZoomEnabled: Self = Self(1389i32); pub const ContentPresenter_LineHeight: Self = Self(1425i32); pub const CalendarViewTemplateSettings_MinViewWidth: Self = Self(1435i32); pub const ListViewBase_SelectedRanges: Self = Self(1459i32); pub const SplitViewTemplateSettings_CompactPaneGridLength: Self = Self(1462i32); pub const SplitViewTemplateSettings_NegativeOpenPaneLength: Self = Self(1463i32); pub const SplitViewTemplateSettings_NegativeOpenPaneLengthMinusCompactLength: Self = Self(1464i32); pub const SplitViewTemplateSettings_OpenPaneGridLength: Self = Self(1465i32); pub const SplitViewTemplateSettings_OpenPaneLengthMinusCompactLength: Self = Self(1466i32); pub const SplitView_CompactPaneLength: Self = Self(1467i32); pub const SplitView_Content: Self = Self(1468i32); pub const SplitView_DisplayMode: Self = Self(1469i32); pub const SplitView_IsPaneOpen: Self = Self(1470i32); pub const SplitView_OpenPaneLength: Self = Self(1471i32); pub const SplitView_Pane: Self = Self(1472i32); pub const SplitView_PanePlacement: Self = Self(1473i32); pub const SplitView_TemplateSettings: Self = Self(1474i32); pub const UIElement_Transform3D: Self = Self(1475i32); pub const CompositeTransform3D_CenterX: Self = Self(1476i32); pub const CompositeTransform3D_CenterY: Self = Self(1478i32); pub const CompositeTransform3D_CenterZ: Self = Self(1480i32); pub const CompositeTransform3D_RotationX: Self = Self(1482i32); pub const CompositeTransform3D_RotationY: Self = Self(1484i32); pub const CompositeTransform3D_RotationZ: Self = Self(1486i32); pub const CompositeTransform3D_ScaleX: Self = Self(1488i32); pub const CompositeTransform3D_ScaleY: Self = Self(1490i32); pub const CompositeTransform3D_ScaleZ: Self = Self(1492i32); pub const CompositeTransform3D_TranslateX: Self = Self(1494i32); pub const CompositeTransform3D_TranslateY: Self = Self(1496i32); pub const CompositeTransform3D_TranslateZ: Self = Self(1498i32); pub const PerspectiveTransform3D_Depth: Self = Self(1500i32); pub const PerspectiveTransform3D_OffsetX: Self = Self(1501i32); pub const PerspectiveTransform3D_OffsetY: Self = Self(1502i32); pub const RelativePanel_Above: Self = Self(1508i32); pub const RelativePanel_AlignBottomWith: Self = Self(1509i32); pub const RelativePanel_AlignLeftWith: Self = Self(1510i32); pub const RelativePanel_AlignRightWith: Self = Self(1515i32); pub const RelativePanel_AlignTopWith: Self = Self(1516i32); pub const RelativePanel_Below: Self = Self(1517i32); pub const RelativePanel_LeftOf: Self = Self(1520i32); pub const RelativePanel_RightOf: Self = Self(1521i32); pub const SplitViewTemplateSettings_OpenPaneLength: Self = Self(1524i32); pub const PasswordBox_PasswordRevealMode: Self = Self(1527i32); pub const SplitView_PaneBackground: Self = Self(1528i32); pub const ItemsStackPanel_AreStickyGroupHeadersEnabled: Self = Self(1529i32); pub const ItemsWrapGrid_AreStickyGroupHeadersEnabled: Self = Self(1530i32); pub const MenuFlyoutSubItem_Items: Self = Self(1531i32); pub const MenuFlyoutSubItem_Text: Self = Self(1532i32); pub const UIElement_CanDrag: Self = Self(1534i32); pub const DataTemplate_ExtensionInstance: Self = Self(1535i32); pub const RelativePanel_AlignHorizontalCenterWith: Self = Self(1552i32); pub const RelativePanel_AlignVerticalCenterWith: Self = Self(1553i32); pub const TargetPropertyPath_Path: Self = Self(1555i32); pub const TargetPropertyPath_Target: Self = Self(1556i32); pub const VisualState_Setters: Self = Self(1558i32); pub const VisualState_StateTriggers: Self = Self(1559i32); pub const AdaptiveTrigger_MinWindowHeight: Self = Self(1560i32); pub const AdaptiveTrigger_MinWindowWidth: Self = Self(1561i32); pub const Setter_Target: Self = Self(1562i32); pub const CalendarView_BlackoutForeground: Self = Self(1565i32); pub const CalendarView_CalendarItemBackground: Self = Self(1566i32); pub const CalendarView_CalendarItemBorderBrush: Self = Self(1567i32); pub const CalendarView_CalendarItemBorderThickness: Self = Self(1568i32); pub const CalendarView_CalendarItemForeground: Self = Self(1569i32); pub const CalendarView_CalendarViewDayItemStyle: Self = Self(1570i32); pub const CalendarView_DayItemFontFamily: Self = Self(1571i32); pub const CalendarView_DayItemFontSize: Self = Self(1572i32); pub const CalendarView_DayItemFontStyle: Self = Self(1573i32); pub const CalendarView_DayItemFontWeight: Self = Self(1574i32); pub const CalendarView_FirstOfMonthLabelFontFamily: Self = Self(1575i32); pub const CalendarView_FirstOfMonthLabelFontSize: Self = Self(1576i32); pub const CalendarView_FirstOfMonthLabelFontStyle: Self = Self(1577i32); pub const CalendarView_FirstOfMonthLabelFontWeight: Self = Self(1578i32); pub const CalendarView_FirstOfYearDecadeLabelFontFamily: Self = Self(1579i32); pub const CalendarView_FirstOfYearDecadeLabelFontSize: Self = Self(1580i32); pub const CalendarView_FirstOfYearDecadeLabelFontStyle: Self = Self(1581i32); pub const CalendarView_FirstOfYearDecadeLabelFontWeight: Self = Self(1582i32); pub const CalendarView_FocusBorderBrush: Self = Self(1583i32); pub const CalendarView_HorizontalDayItemAlignment: Self = Self(1584i32); pub const CalendarView_HorizontalFirstOfMonthLabelAlignment: Self = Self(1585i32); pub const CalendarView_HoverBorderBrush: Self = Self(1586i32); pub const CalendarView_MonthYearItemFontFamily: Self = Self(1588i32); pub const CalendarView_MonthYearItemFontSize: Self = Self(1589i32); pub const CalendarView_MonthYearItemFontStyle: Self = Self(1590i32); pub const CalendarView_MonthYearItemFontWeight: Self = Self(1591i32); pub const CalendarView_OutOfScopeBackground: Self = Self(1592i32); pub const CalendarView_OutOfScopeForeground: Self = Self(1593i32); pub const CalendarView_PressedBorderBrush: Self = Self(1594i32); pub const CalendarView_PressedForeground: Self = Self(1595i32); pub const CalendarView_SelectedBorderBrush: Self = Self(1596i32); pub const CalendarView_SelectedForeground: Self = Self(1597i32); pub const CalendarView_SelectedHoverBorderBrush: Self = Self(1598i32); pub const CalendarView_SelectedPressedBorderBrush: Self = Self(1599i32); pub const CalendarView_TodayFontWeight: Self = Self(1600i32); pub const CalendarView_TodayForeground: Self = Self(1601i32); pub const CalendarView_VerticalDayItemAlignment: Self = Self(1602i32); pub const CalendarView_VerticalFirstOfMonthLabelAlignment: Self = Self(1603i32); pub const MediaTransportControls_IsCompact: Self = Self(1605i32); pub const RelativePanel_AlignBottomWithPanel: Self = Self(1606i32); pub const RelativePanel_AlignHorizontalCenterWithPanel: Self = Self(1607i32); pub const RelativePanel_AlignLeftWithPanel: Self = Self(1608i32); pub const RelativePanel_AlignRightWithPanel: Self = Self(1609i32); pub const RelativePanel_AlignTopWithPanel: Self = Self(1610i32); pub const RelativePanel_AlignVerticalCenterWithPanel: Self = Self(1611i32); pub const ListViewBase_IsMultiSelectCheckBoxEnabled: Self = Self(1612i32); pub const AutomationProperties_Level: Self = Self(1614i32); pub const AutomationProperties_PositionInSet: Self = Self(1615i32); pub const AutomationProperties_SizeOfSet: Self = Self(1616i32); pub const ListViewItemPresenter_CheckBoxBrush: Self = Self(1617i32); pub const ListViewItemPresenter_CheckMode: Self = Self(1618i32); pub const ListViewItemPresenter_PressedBackground: Self = Self(1620i32); pub const ListViewItemPresenter_SelectedPressedBackground: Self = Self(1621i32); pub const Control_IsTemplateFocusTarget: Self = Self(1623i32); pub const Control_UseSystemFocusVisuals: Self = Self(1624i32); pub const ListViewItemPresenter_FocusSecondaryBorderBrush: Self = Self(1628i32); pub const ListViewItemPresenter_PointerOverForeground: Self = Self(1630i32); pub const FontIcon_MirroredWhenRightToLeft: Self = Self(1631i32); pub const CalendarViewTemplateSettings_CenterX: Self = Self(1632i32); pub const CalendarViewTemplateSettings_CenterY: Self = Self(1633i32); pub const CalendarViewTemplateSettings_ClipRect: Self = Self(1634i32); pub const PasswordBox_TextReadingOrder: Self = Self(1650i32); pub const RichEditBox_TextReadingOrder: Self = Self(1651i32); pub const TextBox_TextReadingOrder: Self = Self(1652i32); pub const WebView_ExecutionMode: Self = Self(1653i32); pub const WebView_DeferredPermissionRequests: Self = Self(1655i32); pub const WebView_Settings: Self = Self(1656i32); pub const RichEditBox_DesiredCandidateWindowAlignment: Self = Self(1660i32); pub const TextBox_DesiredCandidateWindowAlignment: Self = Self(1662i32); pub const CalendarDatePicker_CalendarIdentifier: Self = Self(1663i32); pub const CalendarDatePicker_CalendarViewStyle: Self = Self(1664i32); pub const CalendarDatePicker_Date: Self = Self(1665i32); pub const CalendarDatePicker_DateFormat: Self = Self(1666i32); pub const CalendarDatePicker_DayOfWeekFormat: Self = Self(1667i32); pub const CalendarDatePicker_DisplayMode: Self = Self(1668i32); pub const CalendarDatePicker_FirstDayOfWeek: Self = Self(1669i32); pub const CalendarDatePicker_Header: Self = Self(1670i32); pub const CalendarDatePicker_HeaderTemplate: Self = Self(1671i32); pub const CalendarDatePicker_IsCalendarOpen: Self = Self(1672i32); pub const CalendarDatePicker_IsGroupLabelVisible: Self = Self(1673i32); pub const CalendarDatePicker_IsOutOfScopeEnabled: Self = Self(1674i32); pub const CalendarDatePicker_IsTodayHighlighted: Self = Self(1675i32); pub const CalendarDatePicker_MaxDate: Self = Self(1676i32); pub const CalendarDatePicker_MinDate: Self = Self(1677i32); pub const CalendarDatePicker_PlaceholderText: Self = Self(1678i32); pub const CalendarView_IsGroupLabelVisible: Self = Self(1679i32); pub const ContentPresenter_Background: Self = Self(1680i32); pub const ContentPresenter_BorderBrush: Self = Self(1681i32); pub const ContentPresenter_BorderThickness: Self = Self(1682i32); pub const ContentPresenter_CornerRadius: Self = Self(1683i32); pub const ContentPresenter_Padding: Self = Self(1684i32); pub const Grid_BorderBrush: Self = Self(1685i32); pub const Grid_BorderThickness: Self = Self(1686i32); pub const Grid_CornerRadius: Self = Self(1687i32); pub const Grid_Padding: Self = Self(1688i32); pub const RelativePanel_BorderBrush: Self = Self(1689i32); pub const RelativePanel_BorderThickness: Self = Self(1690i32); pub const RelativePanel_CornerRadius: Self = Self(1691i32); pub const RelativePanel_Padding: Self = Self(1692i32); pub const StackPanel_BorderBrush: Self = Self(1693i32); pub const StackPanel_BorderThickness: Self = Self(1694i32); pub const StackPanel_CornerRadius: Self = Self(1695i32); pub const StackPanel_Padding: Self = Self(1696i32); pub const PasswordBox_InputScope: Self = Self(1697i32); pub const MediaTransportControlsHelper_DropoutOrder: Self = Self(1698i32); pub const AutoSuggestBoxQuerySubmittedEventArgs_ChosenSuggestion: Self = Self(1699i32); pub const AutoSuggestBoxQuerySubmittedEventArgs_QueryText: Self = Self(1700i32); pub const AutoSuggestBox_QueryIcon: Self = Self(1701i32); pub const StateTrigger_IsActive: Self = Self(1702i32); pub const ContentPresenter_HorizontalContentAlignment: Self = Self(1703i32); pub const ContentPresenter_VerticalContentAlignment: Self = Self(1704i32); pub const AppBarTemplateSettings_ClipRect: Self = Self(1705i32); pub const AppBarTemplateSettings_CompactRootMargin: Self = Self(1706i32); pub const AppBarTemplateSettings_CompactVerticalDelta: Self = Self(1707i32); pub const AppBarTemplateSettings_HiddenRootMargin: Self = Self(1708i32); pub const AppBarTemplateSettings_HiddenVerticalDelta: Self = Self(1709i32); pub const AppBarTemplateSettings_MinimalRootMargin: Self = Self(1710i32); pub const AppBarTemplateSettings_MinimalVerticalDelta: Self = Self(1711i32); pub const CommandBarTemplateSettings_ContentHeight: Self = Self(1712i32); pub const CommandBarTemplateSettings_NegativeOverflowContentHeight: Self = Self(1713i32); pub const CommandBarTemplateSettings_OverflowContentClipRect: Self = Self(1714i32); pub const CommandBarTemplateSettings_OverflowContentHeight: Self = Self(1715i32); pub const CommandBarTemplateSettings_OverflowContentHorizontalOffset: Self = Self(1716i32); pub const CommandBarTemplateSettings_OverflowContentMaxHeight: Self = Self(1717i32); pub const CommandBarTemplateSettings_OverflowContentMinWidth: Self = Self(1718i32); pub const AppBar_TemplateSettings: Self = Self(1719i32); pub const CommandBar_CommandBarOverflowPresenterStyle: Self = Self(1720i32); pub const CommandBar_CommandBarTemplateSettings: Self = Self(1721i32); pub const DrillInThemeAnimation_EntranceTarget: Self = Self(1722i32); pub const DrillInThemeAnimation_EntranceTargetName: Self = Self(1723i32); pub const DrillInThemeAnimation_ExitTarget: Self = Self(1724i32); pub const DrillInThemeAnimation_ExitTargetName: Self = Self(1725i32); pub const DrillOutThemeAnimation_EntranceTarget: Self = Self(1726i32); pub const DrillOutThemeAnimation_EntranceTargetName: Self = Self(1727i32); pub const DrillOutThemeAnimation_ExitTarget: Self = Self(1728i32); pub const DrillOutThemeAnimation_ExitTargetName: Self = Self(1729i32); pub const XamlBindingHelper_DataTemplateComponent: Self = Self(1730i32); pub const AutomationProperties_Annotations: Self = Self(1732i32); pub const AutomationAnnotation_Element: Self = Self(1733i32); pub const AutomationAnnotation_Type: Self = Self(1734i32); pub const AutomationPeerAnnotation_Peer: Self = Self(1735i32); pub const AutomationPeerAnnotation_Type: Self = Self(1736i32); pub const Hyperlink_UnderlineStyle: Self = Self(1741i32); pub const CalendarView_DisabledForeground: Self = Self(1742i32); pub const CalendarView_TodayBackground: Self = Self(1743i32); pub const CalendarView_TodayBlackoutBackground: Self = Self(1744i32); pub const CalendarView_TodaySelectedInnerBorderBrush: Self = Self(1747i32); pub const Control_IsFocusEngaged: Self = Self(1749i32); pub const Control_IsFocusEngagementEnabled: Self = Self(1752i32); pub const RichEditBox_ClipboardCopyFormat: Self = Self(1754i32); pub const CommandBarTemplateSettings_OverflowContentMaxWidth: Self = Self(1757i32); pub const ComboBoxTemplateSettings_DropDownContentMinWidth: Self = Self(1758i32); pub const MenuFlyoutPresenterTemplateSettings_FlyoutContentMinWidth: Self = Self(1762i32); pub const MenuFlyoutPresenter_TemplateSettings: Self = Self(1763i32); pub const AutomationProperties_LandmarkType: Self = Self(1766i32); pub const AutomationProperties_LocalizedLandmarkType: Self = Self(1767i32); pub const RepositionThemeTransition_IsStaggeringEnabled: Self = Self(1769i32); pub const ListBox_SingleSelectionFollowsFocus: Self = Self(1770i32); pub const ListViewBase_SingleSelectionFollowsFocus: Self = Self(1771i32); pub const BitmapImage_AutoPlay: Self = Self(1773i32); pub const BitmapImage_IsAnimatedBitmap: Self = Self(1774i32); pub const BitmapImage_IsPlaying: Self = Self(1775i32); pub const AutomationProperties_FullDescription: Self = Self(1776i32); pub const AutomationProperties_IsDataValidForForm: Self = Self(1777i32); pub const AutomationProperties_IsPeripheral: Self = Self(1778i32); pub const AutomationProperties_LocalizedControlType: Self = Self(1779i32); pub const FlyoutBase_AllowFocusOnInteraction: Self = Self(1780i32); pub const TextElement_AllowFocusOnInteraction: Self = Self(1781i32); pub const FrameworkElement_AllowFocusOnInteraction: Self = Self(1782i32); pub const Control_RequiresPointer: Self = Self(1783i32); pub const UIElement_ContextFlyout: Self = Self(1785i32); pub const TextElement_AccessKey: Self = Self(1786i32); pub const UIElement_AccessKeyScopeOwner: Self = Self(1787i32); pub const UIElement_IsAccessKeyScope: Self = Self(1788i32); pub const AutomationProperties_DescribedBy: Self = Self(1790i32); pub const UIElement_AccessKey: Self = Self(1803i32); pub const Control_XYFocusDown: Self = Self(1804i32); pub const Control_XYFocusLeft: Self = Self(1805i32); pub const Control_XYFocusRight: Self = Self(1806i32); pub const Control_XYFocusUp: Self = Self(1807i32); pub const Hyperlink_XYFocusDown: Self = Self(1808i32); pub const Hyperlink_XYFocusLeft: Self = Self(1809i32); pub const Hyperlink_XYFocusRight: Self = Self(1810i32); pub const Hyperlink_XYFocusUp: Self = Self(1811i32); pub const WebView_XYFocusDown: Self = Self(1812i32); pub const WebView_XYFocusLeft: Self = Self(1813i32); pub const WebView_XYFocusRight: Self = Self(1814i32); pub const WebView_XYFocusUp: Self = Self(1815i32); pub const CommandBarTemplateSettings_EffectiveOverflowButtonVisibility: Self = Self(1816i32); pub const AppBarSeparator_IsInOverflow: Self = Self(1817i32); pub const CommandBar_DefaultLabelPosition: Self = Self(1818i32); pub const CommandBar_IsDynamicOverflowEnabled: Self = Self(1819i32); pub const CommandBar_OverflowButtonVisibility: Self = Self(1820i32); pub const AppBarButton_IsInOverflow: Self = Self(1821i32); pub const AppBarButton_LabelPosition: Self = Self(1822i32); pub const AppBarToggleButton_IsInOverflow: Self = Self(1823i32); pub const AppBarToggleButton_LabelPosition: Self = Self(1824i32); pub const FlyoutBase_LightDismissOverlayMode: Self = Self(1825i32); pub const Popup_LightDismissOverlayMode: Self = Self(1827i32); pub const CalendarDatePicker_LightDismissOverlayMode: Self = Self(1829i32); pub const DatePicker_LightDismissOverlayMode: Self = Self(1830i32); pub const SplitView_LightDismissOverlayMode: Self = Self(1831i32); pub const TimePicker_LightDismissOverlayMode: Self = Self(1832i32); pub const AppBar_LightDismissOverlayMode: Self = Self(1833i32); pub const AutoSuggestBox_LightDismissOverlayMode: Self = Self(1834i32); pub const ComboBox_LightDismissOverlayMode: Self = Self(1835i32); pub const AppBarSeparator_DynamicOverflowOrder: Self = Self(1836i32); pub const AppBarButton_DynamicOverflowOrder: Self = Self(1837i32); pub const AppBarToggleButton_DynamicOverflowOrder: Self = Self(1838i32); pub const FrameworkElement_FocusVisualMargin: Self = Self(1839i32); pub const FrameworkElement_FocusVisualPrimaryBrush: Self = Self(1840i32); pub const FrameworkElement_FocusVisualPrimaryThickness: Self = Self(1841i32); pub const FrameworkElement_FocusVisualSecondaryBrush: Self = Self(1842i32); pub const FrameworkElement_FocusVisualSecondaryThickness: Self = Self(1843i32); pub const FlyoutBase_AllowFocusWhenDisabled: Self = Self(1846i32); pub const FrameworkElement_AllowFocusWhenDisabled: Self = Self(1847i32); pub const ComboBox_IsTextSearchEnabled: Self = Self(1848i32); pub const TextElement_ExitDisplayModeOnAccessKeyInvoked: Self = Self(1849i32); pub const UIElement_ExitDisplayModeOnAccessKeyInvoked: Self = Self(1850i32); pub const MediaPlayerPresenter_IsFullWindow: Self = Self(1851i32); pub const MediaPlayerPresenter_MediaPlayer: Self = Self(1852i32); pub const MediaPlayerPresenter_Stretch: Self = Self(1853i32); pub const MediaPlayerElement_AreTransportControlsEnabled: Self = Self(1854i32); pub const MediaPlayerElement_AutoPlay: Self = Self(1855i32); pub const MediaPlayerElement_IsFullWindow: Self = Self(1856i32); pub const MediaPlayerElement_MediaPlayer: Self = Self(1857i32); pub const MediaPlayerElement_PosterSource: Self = Self(1858i32); pub const MediaPlayerElement_Source: Self = Self(1859i32); pub const MediaPlayerElement_Stretch: Self = Self(1860i32); pub const MediaPlayerElement_TransportControls: Self = Self(1861i32); pub const MediaTransportControls_FastPlayFallbackBehaviour: Self = Self(1862i32); pub const MediaTransportControls_IsNextTrackButtonVisible: Self = Self(1863i32); pub const MediaTransportControls_IsPreviousTrackButtonVisible: Self = Self(1864i32); pub const MediaTransportControls_IsSkipBackwardButtonVisible: Self = Self(1865i32); pub const MediaTransportControls_IsSkipBackwardEnabled: Self = Self(1866i32); pub const MediaTransportControls_IsSkipForwardButtonVisible: Self = Self(1867i32); pub const MediaTransportControls_IsSkipForwardEnabled: Self = Self(1868i32); pub const FlyoutBase_ElementSoundMode: Self = Self(1869i32); pub const Control_ElementSoundMode: Self = Self(1870i32); pub const Hyperlink_ElementSoundMode: Self = Self(1871i32); pub const AutomationProperties_FlowsFrom: Self = Self(1876i32); pub const AutomationProperties_FlowsTo: Self = Self(1877i32); pub const TextElement_TextDecorations: Self = Self(1879i32); pub const RichTextBlock_TextDecorations: Self = Self(1881i32); pub const Control_DefaultStyleResourceUri: Self = Self(1882i32); pub const ContentDialog_PrimaryButtonStyle: Self = Self(1884i32); pub const ContentDialog_SecondaryButtonStyle: Self = Self(1885i32); pub const TextElement_KeyTipHorizontalOffset: Self = Self(1890i32); pub const TextElement_KeyTipPlacementMode: Self = Self(1891i32); pub const TextElement_KeyTipVerticalOffset: Self = Self(1892i32); pub const UIElement_KeyTipHorizontalOffset: Self = Self(1893i32); pub const UIElement_KeyTipPlacementMode: Self = Self(1894i32); pub const UIElement_KeyTipVerticalOffset: Self = Self(1895i32); pub const FlyoutBase_OverlayInputPassThroughElement: Self = Self(1896i32); pub const UIElement_XYFocusKeyboardNavigation: Self = Self(1897i32); pub const AutomationProperties_Culture: Self = Self(1898i32); pub const UIElement_XYFocusDownNavigationStrategy: Self = Self(1918i32); pub const UIElement_XYFocusLeftNavigationStrategy: Self = Self(1919i32); pub const UIElement_XYFocusRightNavigationStrategy: Self = Self(1920i32); pub const UIElement_XYFocusUpNavigationStrategy: Self = Self(1921i32); pub const Hyperlink_XYFocusDownNavigationStrategy: Self = Self(1922i32); pub const Hyperlink_XYFocusLeftNavigationStrategy: Self = Self(1923i32); pub const Hyperlink_XYFocusRightNavigationStrategy: Self = Self(1924i32); pub const Hyperlink_XYFocusUpNavigationStrategy: Self = Self(1925i32); pub const TextElement_AccessKeyScopeOwner: Self = Self(1926i32); pub const TextElement_IsAccessKeyScope: Self = Self(1927i32); pub const Hyperlink_FocusState: Self = Self(1934i32); pub const ContentDialog_CloseButtonCommand: Self = Self(1936i32); pub const ContentDialog_CloseButtonCommandParameter: Self = Self(1937i32); pub const ContentDialog_CloseButtonStyle: Self = Self(1938i32); pub const ContentDialog_CloseButtonText: Self = Self(1939i32); pub const ContentDialog_DefaultButton: Self = Self(1940i32); pub const RichEditBox_SelectionHighlightColorWhenNotFocused: Self = Self(1941i32); pub const TextBox_SelectionHighlightColorWhenNotFocused: Self = Self(1942i32); pub const SvgImageSource_RasterizePixelHeight: Self = Self(1948i32); pub const SvgImageSource_RasterizePixelWidth: Self = Self(1949i32); pub const SvgImageSource_UriSource: Self = Self(1950i32); pub const LoadedImageSurface_DecodedPhysicalSize: Self = Self(1955i32); pub const LoadedImageSurface_DecodedSize: Self = Self(1956i32); pub const LoadedImageSurface_NaturalSize: Self = Self(1957i32); pub const ComboBox_SelectionChangedTrigger: Self = Self(1958i32); pub const XamlCompositionBrushBase_FallbackColor: Self = Self(1960i32); pub const UIElement_Lights: Self = Self(1962i32); pub const MenuFlyoutItem_Icon: Self = Self(1963i32); pub const MenuFlyoutSubItem_Icon: Self = Self(1964i32); pub const BitmapIcon_ShowAsMonochrome: Self = Self(1965i32); pub const UIElement_HighContrastAdjustment: Self = Self(1967i32); pub const RichEditBox_MaxLength: Self = Self(1968i32); pub const UIElement_TabFocusNavigation: Self = Self(1969i32); pub const Control_IsTemplateKeyTipTarget: Self = Self(1970i32); pub const Hyperlink_IsTabStop: Self = Self(1972i32); pub const Hyperlink_TabIndex: Self = Self(1973i32); pub const MediaTransportControls_IsRepeatButtonVisible: Self = Self(1974i32); pub const MediaTransportControls_IsRepeatEnabled: Self = Self(1975i32); pub const MediaTransportControls_ShowAndHideAutomatically: Self = Self(1976i32); pub const RichEditBox_DisabledFormattingAccelerators: Self = Self(1977i32); pub const RichEditBox_CharacterCasing: Self = Self(1978i32); pub const TextBox_CharacterCasing: Self = Self(1979i32); pub const RichTextBlock_IsTextTrimmed: Self = Self(1980i32); pub const RichTextBlockOverflow_IsTextTrimmed: Self = Self(1981i32); pub const TextBlock_IsTextTrimmed: Self = Self(1982i32); pub const TextHighlighter_Background: Self = Self(1985i32); pub const TextHighlighter_Foreground: Self = Self(1986i32); pub const TextHighlighter_Ranges: Self = Self(1987i32); pub const RichTextBlock_TextHighlighters: Self = Self(1988i32); pub const TextBlock_TextHighlighters: Self = Self(1989i32); pub const FrameworkElement_ActualTheme: Self = Self(1992i32); pub const Grid_ColumnSpacing: Self = Self(1993i32); pub const Grid_RowSpacing: Self = Self(1994i32); pub const StackPanel_Spacing: Self = Self(1995i32); pub const Block_HorizontalTextAlignment: Self = Self(1996i32); pub const RichTextBlock_HorizontalTextAlignment: Self = Self(1997i32); pub const TextBlock_HorizontalTextAlignment: Self = Self(1998i32); pub const RichEditBox_HorizontalTextAlignment: Self = Self(1999i32); pub const TextBox_HorizontalTextAlignment: Self = Self(2000i32); pub const TextBox_PlaceholderForeground: Self = Self(2001i32); pub const ComboBox_PlaceholderForeground: Self = Self(2002i32); pub const KeyboardAccelerator_IsEnabled: Self = Self(2003i32); pub const KeyboardAccelerator_Key: Self = Self(2004i32); pub const KeyboardAccelerator_Modifiers: Self = Self(2005i32); pub const KeyboardAccelerator_ScopeOwner: Self = Self(2006i32); pub const UIElement_KeyboardAccelerators: Self = Self(2007i32); pub const ListViewItemPresenter_RevealBackground: Self = Self(2009i32); pub const ListViewItemPresenter_RevealBackgroundShowsAboveContent: Self = Self(2010i32); pub const ListViewItemPresenter_RevealBorderBrush: Self = Self(2011i32); pub const ListViewItemPresenter_RevealBorderThickness: Self = Self(2012i32); pub const UIElement_KeyTipTarget: Self = Self(2014i32); pub const AppBarButtonTemplateSettings_KeyboardAcceleratorTextMinWidth: Self = Self(2015i32); pub const AppBarToggleButtonTemplateSettings_KeyboardAcceleratorTextMinWidth: Self = Self(2016i32); pub const MenuFlyoutItemTemplateSettings_KeyboardAcceleratorTextMinWidth: Self = Self(2017i32); pub const MenuFlyoutItem_TemplateSettings: Self = Self(2019i32); pub const AppBarButton_TemplateSettings: Self = Self(2021i32); pub const AppBarToggleButton_TemplateSettings: Self = Self(2023i32); pub const UIElement_KeyboardAcceleratorPlacementMode: Self = Self(2028i32); pub const MediaTransportControls_IsCompactOverlayButtonVisible: Self = Self(2032i32); pub const MediaTransportControls_IsCompactOverlayEnabled: Self = Self(2033i32); pub const UIElement_KeyboardAcceleratorPlacementTarget: Self = Self(2061i32); pub const UIElement_CenterPoint: Self = Self(2062i32); pub const UIElement_Rotation: Self = Self(2063i32); pub const UIElement_RotationAxis: Self = Self(2064i32); pub const UIElement_Scale: Self = Self(2065i32); pub const UIElement_TransformMatrix: Self = Self(2066i32); pub const UIElement_Translation: Self = Self(2067i32); pub const TextBox_HandwritingView: Self = Self(2068i32); pub const AutomationProperties_HeadingLevel: Self = Self(2069i32); pub const TextBox_IsHandwritingViewEnabled: Self = Self(2076i32); pub const RichEditBox_ContentLinkProviders: Self = Self(2078i32); pub const RichEditBox_ContentLinkBackgroundColor: Self = Self(2079i32); pub const RichEditBox_ContentLinkForegroundColor: Self = Self(2080i32); pub const HandwritingView_AreCandidatesEnabled: Self = Self(2081i32); pub const HandwritingView_IsOpen: Self = Self(2082i32); pub const HandwritingView_PlacementTarget: Self = Self(2084i32); pub const HandwritingView_PlacementAlignment: Self = Self(2085i32); pub const RichEditBox_HandwritingView: Self = Self(2086i32); pub const RichEditBox_IsHandwritingViewEnabled: Self = Self(2087i32); pub const MenuFlyoutItem_KeyboardAcceleratorTextOverride: Self = Self(2090i32); pub const AppBarButton_KeyboardAcceleratorTextOverride: Self = Self(2091i32); pub const AppBarToggleButton_KeyboardAcceleratorTextOverride: Self = Self(2092i32); pub const ContentLink_Background: Self = Self(2093i32); pub const ContentLink_Cursor: Self = Self(2094i32); pub const ContentLink_ElementSoundMode: Self = Self(2095i32); pub const ContentLink_FocusState: Self = Self(2096i32); pub const ContentLink_IsTabStop: Self = Self(2097i32); pub const ContentLink_TabIndex: Self = Self(2098i32); pub const ContentLink_XYFocusDown: Self = Self(2099i32); pub const ContentLink_XYFocusDownNavigationStrategy: Self = Self(2100i32); pub const ContentLink_XYFocusLeft: Self = Self(2101i32); pub const ContentLink_XYFocusLeftNavigationStrategy: Self = Self(2102i32); pub const ContentLink_XYFocusRight: Self = Self(2103i32); pub const ContentLink_XYFocusRightNavigationStrategy: Self = Self(2104i32); pub const ContentLink_XYFocusUp: Self = Self(2105i32); pub const ContentLink_XYFocusUpNavigationStrategy: Self = Self(2106i32); pub const IconSource_Foreground: Self = Self(2112i32); pub const BitmapIconSource_ShowAsMonochrome: Self = Self(2113i32); pub const BitmapIconSource_UriSource: Self = Self(2114i32); pub const FontIconSource_FontFamily: Self = Self(2115i32); pub const FontIconSource_FontSize: Self = Self(2116i32); pub const FontIconSource_FontStyle: Self = Self(2117i32); pub const FontIconSource_FontWeight: Self = Self(2118i32); pub const FontIconSource_Glyph: Self = Self(2119i32); pub const FontIconSource_IsTextScaleFactorEnabled: Self = Self(2120i32); pub const FontIconSource_MirroredWhenRightToLeft: Self = Self(2121i32); pub const PathIconSource_Data: Self = Self(2122i32); pub const SymbolIconSource_Symbol: Self = Self(2123i32); pub const UIElement_Shadow: Self = Self(2130i32); pub const IconSourceElement_IconSource: Self = Self(2131i32); pub const PasswordBox_CanPasteClipboardContent: Self = Self(2137i32); pub const TextBox_CanPasteClipboardContent: Self = Self(2138i32); pub const TextBox_CanRedo: Self = Self(2139i32); pub const TextBox_CanUndo: Self = Self(2140i32); pub const FlyoutBase_ShowMode: Self = Self(2141i32); pub const FlyoutBase_Target: Self = Self(2142i32); pub const Control_CornerRadius: Self = Self(2143i32); pub const AutomationProperties_IsDialog: Self = Self(2149i32); pub const AppBarElementContainer_DynamicOverflowOrder: Self = Self(2150i32); pub const AppBarElementContainer_IsCompact: Self = Self(2151i32); pub const AppBarElementContainer_IsInOverflow: Self = Self(2152i32); pub const ScrollContentPresenter_CanContentRenderOutsideBounds: Self = Self(2157i32); pub const ScrollViewer_CanContentRenderOutsideBounds: Self = Self(2158i32); pub const RichEditBox_SelectionFlyout: Self = Self(2159i32); pub const TextBox_SelectionFlyout: Self = Self(2160i32); pub const Border_BackgroundSizing: Self = Self(2161i32); pub const ContentPresenter_BackgroundSizing: Self = Self(2162i32); pub const Control_BackgroundSizing: Self = Self(2163i32); pub const Grid_BackgroundSizing: Self = Self(2164i32); pub const RelativePanel_BackgroundSizing: Self = Self(2165i32); pub const StackPanel_BackgroundSizing: Self = Self(2166i32); pub const ScrollViewer_HorizontalAnchorRatio: Self = Self(2170i32); pub const ScrollViewer_VerticalAnchorRatio: Self = Self(2171i32); pub const ComboBox_Text: Self = Self(2208i32); pub const TextBox_Description: Self = Self(2217i32); pub const ToolTip_PlacementRect: Self = Self(2218i32); pub const RichTextBlock_SelectionFlyout: Self = Self(2219i32); pub const TextBlock_SelectionFlyout: Self = Self(2220i32); pub const PasswordBox_SelectionFlyout: Self = Self(2221i32); pub const Border_BackgroundTransition: Self = Self(2222i32); pub const ContentPresenter_BackgroundTransition: Self = Self(2223i32); pub const Panel_BackgroundTransition: Self = Self(2224i32); pub const ColorPaletteResources_Accent: Self = Self(2227i32); pub const ColorPaletteResources_AltHigh: Self = Self(2228i32); pub const ColorPaletteResources_AltLow: Self = Self(2229i32); pub const ColorPaletteResources_AltMedium: Self = Self(2230i32); pub const ColorPaletteResources_AltMediumHigh: Self = Self(2231i32); pub const ColorPaletteResources_AltMediumLow: Self = Self(2232i32); pub const ColorPaletteResources_BaseHigh: Self = Self(2233i32); pub const ColorPaletteResources_BaseLow: Self = Self(2234i32); pub const ColorPaletteResources_BaseMedium: Self = Self(2235i32); pub const ColorPaletteResources_BaseMediumHigh: Self = Self(2236i32); pub const ColorPaletteResources_BaseMediumLow: Self = Self(2237i32); pub const ColorPaletteResources_ChromeAltLow: Self = Self(2238i32); pub const ColorPaletteResources_ChromeBlackHigh: Self = Self(2239i32); pub const ColorPaletteResources_ChromeBlackLow: Self = Self(2240i32); pub const ColorPaletteResources_ChromeBlackMedium: Self = Self(2241i32); pub const ColorPaletteResources_ChromeBlackMediumLow: Self = Self(2242i32); pub const ColorPaletteResources_ChromeDisabledHigh: Self = Self(2243i32); pub const ColorPaletteResources_ChromeDisabledLow: Self = Self(2244i32); pub const ColorPaletteResources_ChromeGray: Self = Self(2245i32); pub const ColorPaletteResources_ChromeHigh: Self = Self(2246i32); pub const ColorPaletteResources_ChromeLow: Self = Self(2247i32); pub const ColorPaletteResources_ChromeMedium: Self = Self(2248i32); pub const ColorPaletteResources_ChromeMediumLow: Self = Self(2249i32); pub const ColorPaletteResources_ChromeWhite: Self = Self(2250i32); pub const ColorPaletteResources_ErrorText: Self = Self(2252i32); pub const ColorPaletteResources_ListLow: Self = Self(2253i32); pub const ColorPaletteResources_ListMedium: Self = Self(2254i32); pub const UIElement_TranslationTransition: Self = Self(2255i32); pub const UIElement_OpacityTransition: Self = Self(2256i32); pub const UIElement_RotationTransition: Self = Self(2257i32); pub const UIElement_ScaleTransition: Self = Self(2258i32); pub const BrushTransition_Duration: Self = Self(2261i32); pub const ScalarTransition_Duration: Self = Self(2262i32); pub const Vector3Transition_Duration: Self = Self(2263i32); pub const Vector3Transition_Components: Self = Self(2266i32); pub const FlyoutBase_IsOpen: Self = Self(2267i32); pub const StandardUICommand_Kind: Self = Self(2275i32); pub const UIElement_CanBeScrollAnchor: Self = Self(2276i32); pub const ThemeShadow_Receivers: Self = Self(2279i32); pub const ScrollContentPresenter_SizesContentToTemplatedParent: Self = Self(2280i32); pub const ComboBox_TextBoxStyle: Self = Self(2281i32); pub const Frame_IsNavigationStackEnabled: Self = Self(2282i32); pub const RichEditBox_ProofingMenuFlyout: Self = Self(2283i32); pub const TextBox_ProofingMenuFlyout: Self = Self(2284i32); pub const ScrollViewer_ReduceViewportForCoreInputViewOcclusions: Self = Self(2295i32); pub const FlyoutBase_AreOpenCloseAnimationsEnabled: Self = Self(2296i32); pub const FlyoutBase_InputDevicePrefersPrimaryCommands: Self = Self(2297i32); pub const CalendarDatePicker_Description: Self = Self(2300i32); pub const PasswordBox_Description: Self = Self(2308i32); pub const RichEditBox_Description: Self = Self(2316i32); pub const AutoSuggestBox_Description: Self = Self(2331i32); pub const ComboBox_Description: Self = Self(2339i32); pub const XamlUICommand_AccessKey: Self = Self(2347i32); pub const XamlUICommand_Command: Self = Self(2348i32); pub const XamlUICommand_Description: Self = Self(2349i32); pub const XamlUICommand_IconSource: Self = Self(2350i32); pub const XamlUICommand_KeyboardAccelerators: Self = Self(2351i32); pub const XamlUICommand_Label: Self = Self(2352i32); pub const DatePicker_SelectedDate: Self = Self(2355i32); pub const TimePicker_SelectedTime: Self = Self(2356i32); pub const AppBarTemplateSettings_NegativeCompactVerticalDelta: Self = Self(2367i32); pub const AppBarTemplateSettings_NegativeHiddenVerticalDelta: Self = Self(2368i32); pub const AppBarTemplateSettings_NegativeMinimalVerticalDelta: Self = Self(2369i32); pub const FlyoutBase_ShouldConstrainToRootBounds: Self = Self(2378i32); pub const Popup_ShouldConstrainToRootBounds: Self = Self(2379i32); pub const FlyoutPresenter_IsDefaultShadowEnabled: Self = Self(2380i32); pub const MenuFlyoutPresenter_IsDefaultShadowEnabled: Self = Self(2381i32); pub const UIElement_ActualOffset: Self = Self(2382i32); pub const UIElement_ActualSize: Self = Self(2383i32); pub const CommandBarTemplateSettings_OverflowContentCompactYTranslation: Self = Self(2384i32); pub const CommandBarTemplateSettings_OverflowContentHiddenYTranslation: Self = Self(2385i32); pub const CommandBarTemplateSettings_OverflowContentMinimalYTranslation: Self = Self(2386i32); pub const HandwritingView_IsCommandBarOpen: Self = Self(2395i32); pub const HandwritingView_IsSwitchToKeyboardEnabled: Self = Self(2396i32); pub const ListViewItemPresenter_SelectionIndicatorVisualEnabled: Self = Self(2399i32); pub const ListViewItemPresenter_SelectionIndicatorBrush: Self = Self(2400i32); pub const ListViewItemPresenter_SelectionIndicatorMode: Self = Self(2401i32); pub const ListViewItemPresenter_SelectionIndicatorPointerOverBrush: Self = Self(2402i32); pub const ListViewItemPresenter_SelectionIndicatorPressedBrush: Self = Self(2403i32); pub const ListViewItemPresenter_SelectedBorderBrush: Self = Self(2410i32); pub const ListViewItemPresenter_SelectedInnerBorderBrush: Self = Self(2411i32); pub const ListViewItemPresenter_CheckBoxCornerRadius: Self = Self(2412i32); pub const ListViewItemPresenter_SelectionIndicatorCornerRadius: Self = Self(2413i32); pub const ListViewItemPresenter_SelectedDisabledBorderBrush: Self = Self(2414i32); pub const ListViewItemPresenter_SelectedPressedBorderBrush: Self = Self(2415i32); pub const ListViewItemPresenter_SelectedDisabledBackground: Self = Self(2416i32); pub const ListViewItemPresenter_PointerOverBorderBrush: Self = Self(2417i32); pub const ListViewItemPresenter_CheckBoxPointerOverBrush: Self = Self(2418i32); pub const ListViewItemPresenter_CheckBoxPressedBrush: Self = Self(2419i32); pub const ListViewItemPresenter_CheckDisabledBrush: Self = Self(2420i32); pub const ListViewItemPresenter_CheckPressedBrush: Self = Self(2421i32); pub const ListViewItemPresenter_CheckBoxBorderBrush: Self = Self(2422i32); pub const ListViewItemPresenter_CheckBoxDisabledBorderBrush: Self = Self(2423i32); pub const ListViewItemPresenter_CheckBoxPressedBorderBrush: Self = Self(2424i32); pub const ListViewItemPresenter_CheckBoxDisabledBrush: Self = Self(2425i32); pub const ListViewItemPresenter_CheckBoxSelectedBrush: Self = Self(2426i32); pub const ListViewItemPresenter_CheckBoxSelectedDisabledBrush: Self = Self(2427i32); pub const ListViewItemPresenter_CheckBoxSelectedPointerOverBrush: Self = Self(2428i32); pub const ListViewItemPresenter_CheckBoxSelectedPressedBrush: Self = Self(2429i32); pub const ListViewItemPresenter_CheckBoxPointerOverBorderBrush: Self = Self(2430i32); pub const ListViewItemPresenter_SelectionIndicatorDisabledBrush: Self = Self(2431i32); pub const CalendarView_BlackoutBackground: Self = Self(2432i32); pub const CalendarView_BlackoutStrikethroughBrush: Self = Self(2433i32); pub const CalendarView_CalendarItemCornerRadius: Self = Self(2434i32); pub const CalendarView_CalendarItemDisabledBackground: Self = Self(2435i32); pub const CalendarView_CalendarItemHoverBackground: Self = Self(2436i32); pub const CalendarView_CalendarItemPressedBackground: Self = Self(2437i32); pub const CalendarView_DayItemMargin: Self = Self(2438i32); pub const CalendarView_FirstOfMonthLabelMargin: Self = Self(2439i32); pub const CalendarView_FirstOfYearDecadeLabelMargin: Self = Self(2440i32); pub const CalendarView_MonthYearItemMargin: Self = Self(2441i32); pub const CalendarView_OutOfScopeHoverForeground: Self = Self(2442i32); pub const CalendarView_OutOfScopePressedForeground: Self = Self(2443i32); pub const CalendarView_SelectedDisabledBorderBrush: Self = Self(2444i32); pub const CalendarView_SelectedDisabledForeground: Self = Self(2445i32); pub const CalendarView_SelectedHoverForeground: Self = Self(2446i32); pub const CalendarView_SelectedPressedForeground: Self = Self(2447i32); pub const CalendarView_TodayBlackoutForeground: Self = Self(2448i32); pub const CalendarView_TodayDisabledBackground: Self = Self(2449i32); pub const CalendarView_TodayHoverBackground: Self = Self(2450i32); pub const CalendarView_TodayPressedBackground: Self = Self(2451i32); pub const Popup_ActualPlacement: Self = Self(2452i32); pub const Popup_DesiredPlacement: Self = Self(2453i32); pub const Popup_PlacementTarget: Self = Self(2454i32); pub const AutomationProperties_AutomationControlType: Self = Self(2455i32); } impl ::core::marker::Copy for XamlPropertyIndex {} impl ::core::clone::Clone for XamlPropertyIndex { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct XamlTypeIndex(pub i32); impl XamlTypeIndex { pub const AutoSuggestBoxSuggestionChosenEventArgs: Self = Self(34i32); pub const AutoSuggestBoxTextChangedEventArgs: Self = Self(35i32); pub const CollectionViewSource: Self = Self(41i32); pub const ColumnDefinition: Self = Self(44i32); pub const GradientStop: Self = Self(64i32); pub const InputScope: Self = Self(74i32); pub const InputScopeName: Self = Self(75i32); pub const KeySpline: Self = Self(78i32); pub const PathFigure: Self = Self(93i32); pub const PrintDocument: Self = Self(100i32); pub const RowDefinition: Self = Self(106i32); pub const Style: Self = Self(114i32); pub const TimelineMarker: Self = Self(126i32); pub const VisualState: Self = Self(137i32); pub const VisualStateGroup: Self = Self(138i32); pub const VisualStateManager: Self = Self(139i32); pub const VisualTransition: Self = Self(140i32); pub const AddDeleteThemeTransition: Self = Self(177i32); pub const ArcSegment: Self = Self(178i32); pub const BackEase: Self = Self(179i32); pub const BeginStoryboard: Self = Self(180i32); pub const BezierSegment: Self = Self(181i32); pub const BindingBase: Self = Self(182i32); pub const BitmapCache: Self = Self(183i32); pub const BounceEase: Self = Self(186i32); pub const CircleEase: Self = Self(187i32); pub const ColorAnimation: Self = Self(188i32); pub const ColorAnimationUsingKeyFrames: Self = Self(189i32); pub const ContentThemeTransition: Self = Self(190i32); pub const ControlTemplate: Self = Self(191i32); pub const CubicEase: Self = Self(192i32); pub const DataTemplate: Self = Self(194i32); pub const DiscreteColorKeyFrame: Self = Self(195i32); pub const DiscreteDoubleKeyFrame: Self = Self(196i32); pub const DiscreteObjectKeyFrame: Self = Self(197i32); pub const DiscretePointKeyFrame: Self = Self(198i32); pub const DoubleAnimation: Self = Self(200i32); pub const DoubleAnimationUsingKeyFrames: Self = Self(201i32); pub const EasingColorKeyFrame: Self = Self(204i32); pub const EasingDoubleKeyFrame: Self = Self(205i32); pub const EasingPointKeyFrame: Self = Self(206i32); pub const EdgeUIThemeTransition: Self = Self(207i32); pub const ElasticEase: Self = Self(208i32); pub const EllipseGeometry: Self = Self(209i32); pub const EntranceThemeTransition: Self = Self(210i32); pub const EventTrigger: Self = Self(211i32); pub const ExponentialEase: Self = Self(212i32); pub const Flyout: Self = Self(213i32); pub const GeometryGroup: Self = Self(216i32); pub const ItemsPanelTemplate: Self = Self(227i32); pub const LinearColorKeyFrame: Self = Self(230i32); pub const LinearDoubleKeyFrame: Self = Self(231i32); pub const LinearPointKeyFrame: Self = Self(232i32); pub const LineGeometry: Self = Self(233i32); pub const LineSegment: Self = Self(234i32); pub const Matrix3DProjection: Self = Self(236i32); pub const MenuFlyout: Self = Self(238i32); pub const ObjectAnimationUsingKeyFrames: Self = Self(240i32); pub const PaneThemeTransition: Self = Self(241i32); pub const PathGeometry: Self = Self(243i32); pub const PlaneProjection: Self = Self(244i32); pub const PointAnimation: Self = Self(245i32); pub const PointAnimationUsingKeyFrames: Self = Self(246i32); pub const PolyBezierSegment: Self = Self(248i32); pub const PolyLineSegment: Self = Self(249i32); pub const PolyQuadraticBezierSegment: Self = Self(250i32); pub const PopupThemeTransition: Self = Self(251i32); pub const PowerEase: Self = Self(252i32); pub const QuadraticBezierSegment: Self = Self(254i32); pub const QuadraticEase: Self = Self(255i32); pub const QuarticEase: Self = Self(256i32); pub const QuinticEase: Self = Self(257i32); pub const RectangleGeometry: Self = Self(258i32); pub const RelativeSource: Self = Self(259i32); pub const RenderTargetBitmap: Self = Self(260i32); pub const ReorderThemeTransition: Self = Self(261i32); pub const RepositionThemeTransition: Self = Self(262i32); pub const Setter: Self = Self(263i32); pub const SineEase: Self = Self(264i32); pub const SolidColorBrush: Self = Self(265i32); pub const SplineColorKeyFrame: Self = Self(266i32); pub const SplineDoubleKeyFrame: Self = Self(267i32); pub const SplinePointKeyFrame: Self = Self(268i32); pub const BitmapImage: Self = Self(285i32); pub const Border: Self = Self(286i32); pub const CaptureElement: Self = Self(288i32); pub const CompositeTransform: Self = Self(295i32); pub const ContentPresenter: Self = Self(296i32); pub const DragItemThemeAnimation: Self = Self(302i32); pub const DragOverThemeAnimation: Self = Self(303i32); pub const DropTargetItemThemeAnimation: Self = Self(304i32); pub const FadeInThemeAnimation: Self = Self(306i32); pub const FadeOutThemeAnimation: Self = Self(307i32); pub const Glyphs: Self = Self(312i32); pub const Image: Self = Self(326i32); pub const ImageBrush: Self = Self(328i32); pub const InlineUIContainer: Self = Self(329i32); pub const ItemsPresenter: Self = Self(332i32); pub const LinearGradientBrush: Self = Self(334i32); pub const LineBreak: Self = Self(335i32); pub const MatrixTransform: Self = Self(340i32); pub const MediaElement: Self = Self(342i32); pub const Paragraph: Self = Self(349i32); pub const PointerDownThemeAnimation: Self = Self(357i32); pub const PointerUpThemeAnimation: Self = Self(359i32); pub const PopInThemeAnimation: Self = Self(361i32); pub const PopOutThemeAnimation: Self = Self(362i32); pub const Popup: Self = Self(363i32); pub const RepositionThemeAnimation: Self = Self(370i32); pub const ResourceDictionary: Self = Self(371i32); pub const RichTextBlock: Self = Self(374i32); pub const RichTextBlockOverflow: Self = Self(376i32); pub const RotateTransform: Self = Self(378i32); pub const Run: Self = Self(380i32); pub const ScaleTransform: Self = Self(381i32); pub const SkewTransform: Self = Self(389i32); pub const Span: Self = Self(390i32); pub const SplitCloseThemeAnimation: Self = Self(391i32); pub const SplitOpenThemeAnimation: Self = Self(392i32); pub const Storyboard: Self = Self(393i32); pub const SwipeBackThemeAnimation: Self = Self(394i32); pub const SwipeHintThemeAnimation: Self = Self(395i32); pub const TextBlock: Self = Self(396i32); pub const TransformGroup: Self = Self(411i32); pub const TranslateTransform: Self = Self(413i32); pub const Viewbox: Self = Self(417i32); pub const WebViewBrush: Self = Self(423i32); pub const AppBarSeparator: Self = Self(427i32); pub const BitmapIcon: Self = Self(429i32); pub const Bold: Self = Self(430i32); pub const Canvas: Self = Self(432i32); pub const ContentControl: Self = Self(435i32); pub const DatePicker: Self = Self(436i32); pub const DependencyObjectCollection: Self = Self(437i32); pub const Ellipse: Self = Self(438i32); pub const FontIcon: Self = Self(440i32); pub const Grid: Self = Self(442i32); pub const Hub: Self = Self(445i32); pub const HubSection: Self = Self(446i32); pub const Hyperlink: Self = Self(447i32); pub const Italic: Self = Self(449i32); pub const ItemsControl: Self = Self(451i32); pub const Line: Self = Self(452i32); pub const MediaTransportControls: Self = Self(458i32); pub const PasswordBox: Self = Self(462i32); pub const Path: Self = Self(463i32); pub const PathIcon: Self = Self(464i32); pub const Polygon: Self = Self(465i32); pub const Polyline: Self = Self(466i32); pub const ProgressRing: Self = Self(468i32); pub const Rectangle: Self = Self(470i32); pub const RichEditBox: Self = Self(473i32); pub const ScrollContentPresenter: Self = Self(476i32); pub const SearchBox: Self = Self(477i32); pub const SemanticZoom: Self = Self(479i32); pub const StackPanel: Self = Self(481i32); pub const SymbolIcon: Self = Self(482i32); pub const TextBox: Self = Self(483i32); pub const Thumb: Self = Self(485i32); pub const TickBar: Self = Self(486i32); pub const TimePicker: Self = Self(487i32); pub const ToggleSwitch: Self = Self(489i32); pub const Underline: Self = Self(490i32); pub const UserControl: Self = Self(491i32); pub const VariableSizedWrapGrid: Self = Self(492i32); pub const WebView: Self = Self(494i32); pub const AppBar: Self = Self(495i32); pub const AutoSuggestBox: Self = Self(499i32); pub const CarouselPanel: Self = Self(502i32); pub const ContentDialog: Self = Self(506i32); pub const FlyoutPresenter: Self = Self(508i32); pub const Frame: Self = Self(509i32); pub const GridViewItemPresenter: Self = Self(511i32); pub const GroupItem: Self = Self(512i32); pub const ItemsStackPanel: Self = Self(514i32); pub const ItemsWrapGrid: Self = Self(515i32); pub const ListViewItemPresenter: Self = Self(520i32); pub const MenuFlyoutItem: Self = Self(521i32); pub const MenuFlyoutPresenter: Self = Self(522i32); pub const MenuFlyoutSeparator: Self = Self(523i32); pub const Page: Self = Self(525i32); pub const ProgressBar: Self = Self(528i32); pub const ScrollBar: Self = Self(530i32); pub const SettingsFlyout: Self = Self(533i32); pub const Slider: Self = Self(534i32); pub const SwapChainBackgroundPanel: Self = Self(535i32); pub const SwapChainPanel: Self = Self(536i32); pub const ToolTip: Self = Self(538i32); pub const Button: Self = Self(540i32); pub const ComboBoxItem: Self = Self(541i32); pub const CommandBar: Self = Self(542i32); pub const FlipViewItem: Self = Self(543i32); pub const GridViewHeaderItem: Self = Self(545i32); pub const HyperlinkButton: Self = Self(546i32); pub const ListBoxItem: Self = Self(547i32); pub const ListViewHeaderItem: Self = Self(550i32); pub const RepeatButton: Self = Self(551i32); pub const ScrollViewer: Self = Self(552i32); pub const ToggleButton: Self = Self(553i32); pub const ToggleMenuFlyoutItem: Self = Self(554i32); pub const VirtualizingStackPanel: Self = Self(555i32); pub const WrapGrid: Self = Self(556i32); pub const AppBarButton: Self = Self(557i32); pub const AppBarToggleButton: Self = Self(558i32); pub const CheckBox: Self = Self(559i32); pub const GridViewItem: Self = Self(560i32); pub const ListViewItem: Self = Self(561i32); pub const RadioButton: Self = Self(562i32); pub const Binding: Self = Self(564i32); pub const ComboBox: Self = Self(566i32); pub const FlipView: Self = Self(567i32); pub const ListBox: Self = Self(568i32); pub const GridView: Self = Self(570i32); pub const ListView: Self = Self(571i32); pub const CalendarView: Self = Self(707i32); pub const CalendarViewDayItem: Self = Self(709i32); pub const CalendarPanel: Self = Self(723i32); pub const SplitView: Self = Self(728i32); pub const CompositeTransform3D: Self = Self(732i32); pub const PerspectiveTransform3D: Self = Self(733i32); pub const RelativePanel: Self = Self(744i32); pub const InkCanvas: Self = Self(748i32); pub const MenuFlyoutSubItem: Self = Self(749i32); pub const AdaptiveTrigger: Self = Self(757i32); pub const SoftwareBitmapSource: Self = Self(761i32); pub const StateTrigger: Self = Self(767i32); pub const CalendarDatePicker: Self = Self(774i32); pub const AutoSuggestBoxQuerySubmittedEventArgs: Self = Self(778i32); pub const CommandBarOverflowPresenter: Self = Self(781i32); pub const DrillInThemeAnimation: Self = Self(782i32); pub const DrillOutThemeAnimation: Self = Self(783i32); pub const AutomationAnnotation: Self = Self(789i32); pub const AutomationPeerAnnotation: Self = Self(790i32); pub const MediaPlayerPresenter: Self = Self(828i32); pub const MediaPlayerElement: Self = Self(829i32); pub const XamlLight: Self = Self(855i32); pub const SvgImageSource: Self = Self(860i32); pub const KeyboardAccelerator: Self = Self(897i32); pub const HandwritingView: Self = Self(920i32); pub const ContentLink: Self = Self(925i32); pub const BitmapIconSource: Self = Self(929i32); pub const FontIconSource: Self = Self(930i32); pub const PathIconSource: Self = Self(931i32); pub const SymbolIconSource: Self = Self(933i32); pub const IconSourceElement: Self = Self(939i32); pub const AppBarElementContainer: Self = Self(945i32); pub const ColorPaletteResources: Self = Self(952i32); pub const StandardUICommand: Self = Self(961i32); pub const ThemeShadow: Self = Self(964i32); pub const XamlUICommand: Self = Self(969i32); } impl ::core::marker::Copy for XamlTypeIndex {} impl ::core::clone::Clone for XamlTypeIndex { fn clone(&self) -> Self { *self } }
pub mod landscape;
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::models::ActionDisplayInfo, failure::{err_msg, Error, ResultExt}, fidl::endpoints::Proxy, fidl_fuchsia_io::DirectoryProxy, fidl_fuchsia_sys as fsys, fuchsia_async as fasync, fuchsia_component::client::connect_to_service, fuchsia_url::pkg_url::PkgUrl, io_util, serde::de::{Deserialize, Deserializer}, serde_derive::Deserialize, std::collections::HashMap, std::path::PathBuf, }; /// An `Action` describes a particular action to handle (e.g. com.fuchsia.navigate). pub type Action = String; /// An `ComponentUrl` is a Component URL to a module. pub type ComponentUrl = String; /// A `ParameterName` describes the name of an Action's parameter. pub type ParameterName = String; /// A `ParameterType` describes the type of an Action's parameter. pub type ParameterType = String; /// A `ModuleActionIndex` is a map from every supported `Action` to the set of modules which can /// handle it. #[allow(dead_code)] pub type ModuleActionIndex = HashMap<Action, Vec<ModuleFacet>>; /// A module facet contains the intent filters supported by a particular module. #[derive(Clone, Debug, Deserialize)] pub struct ModuleFacet { // The Component URL of module. pub component_url: Option<ComponentUrl>, // The intent filters for all the actions supported by the module. #[serde(default)] pub intent_filters: Vec<IntentFilter>, } // An intent filter describes an action, its parameters, and the parameter types. #[derive(Clone, Debug, Deserialize, PartialEq)] pub struct IntentFilter { // The action this intent filter describes. pub action: Action, // The parameters associated with `action`)] #[serde(default, deserialize_with = "deserialize_intent_parameters")] pub parameters: HashMap<ParameterName, ParameterType>, pub action_display: Option<ActionDisplayInfo>, } // A wrapper struct which is used for deserializing a `ModuleFacet` from a component manifest. #[derive(Clone, Debug, Deserialize)] struct ComponentManifest { // The facets which are part of the component manifest. facets: Option<Facets>, } // A wrapper struct which is used for deserializing a `ModuleFacet` from a component manifest. #[derive(Clone, Debug, Deserialize)] struct Facets { // The module facet is stored in the facets under the `fuchsia.module` key. #[serde(rename(deserialize = "fuchsia.modular"))] module: Option<ModuleFacet>, } /// Deserializes a vector of intent parameters into a `HashMap`. /// /// Intent parameters are serialized as a vector of objects: [ /// { /// name: ... /// type: ... /// } /// ] /// /// This helper converts the serialized vector into a `HashMap` of the form: /// /// { /// name => type /// } fn deserialize_intent_parameters<'de, D>( deserializer: D, ) -> Result<HashMap<ParameterName, ParameterType>, D::Error> where D: Deserializer<'de>, { #[derive(Deserialize, Hash, Eq, PartialEq)] struct IntentParameterEntry { name: ParameterName, r#type: ParameterType, } let entries: Vec<IntentParameterEntry> = Vec::<IntentParameterEntry>::deserialize(deserializer)?; let result = entries.into_iter().map(|entry| (entry.name, entry.r#type)).collect(); Ok(result) } /// Creates a `ModuleActionIndex` from the provided `ModuleFacet`s. /// /// Parameters: /// - `facets`: The facets which will be used to create the index. /// /// Returns: /// An index for all the actions supported by `facets`. #[allow(dead_code)] pub fn index_facets(facets: &[ModuleFacet]) -> ModuleActionIndex { let mut index = ModuleActionIndex::new(); for facet in facets { for intent_filter in &facet.intent_filters { index.entry(intent_filter.action.clone()).or_insert(Vec::new()).push(facet.clone()); } } index } /// Loads the module facet from the component manifest for the specified component. /// /// Parameters: /// - `component_url`: The url for the component to load. /// /// Returns: /// A `ModuleFacet` parsed from the component manifest, or an `Error` on failure. #[allow(dead_code)] pub async fn load_module_facet(component_url: &str) -> Result<ModuleFacet, Error> { let loader = connect_to_service::<fsys::LoaderMarker>().context("Error connecting to loader.")?; let loader_result = loader .load_url(&component_url) .await .context(format!("Could not load package: {:?}", component_url))?; let package: fsys::Package = *loader_result.ok_or_else(|| { err_msg(format!("Loader result did not contain package: {:?}", component_url)) })?; let cmx_file_contents: String = read_cmx_file(package).await?; let component_manifest: ComponentManifest = serde_json::from_str(&cmx_file_contents)?; let facets = component_manifest.facets.unwrap_or_else(|| Facets { module: None }); let mut module = facets .module .unwrap_or_else(|| ModuleFacet { component_url: None, intent_filters: vec![] }); module.component_url = Some(component_url.to_string()); Ok(module) } /// Reads the cmx file contents from the provided `package`. /// /// Parameters: /// - `package`: The package to read the cmx file from. /// /// Returns: /// A `String` containing the contents of the cmx file, or an `Error` if reading the contents /// failed. #[allow(dead_code)] async fn read_cmx_file(package: fsys::Package) -> Result<String, Error> { let package_uri = PkgUrl::parse(&package.resolved_url) .context("Could not parse the uri from the resolved url.")?; let name = package_uri.name().unwrap_or_else(|| ""); let default_cmx_path; let cmx_path = if package_uri.resource().is_some() { package_uri.resource().unwrap() } else { default_cmx_path = format!("meta/{}.cmx", name); &default_cmx_path }; let package_directory = package.directory.ok_or_else(|| err_msg("Package does not contain directory."))?; let channel = fasync::Channel::from_channel(package_directory) .context("Could not create channel from package directory")?; let directory_proxy = DirectoryProxy::from_channel(channel); let cmx_file = io_util::open_file( &directory_proxy, &PathBuf::from(cmx_path), io_util::OPEN_RIGHT_READABLE, ) .context("Could not open cmx file for package.")?; io_util::read_file(&cmx_file).await }
use clippy_utils::diagnostics::{span_lint, span_lint_and_help}; use clippy_utils::{get_trait_def_id, paths}; use if_chain::if_chain; use rustc_hir::def_id::DefId; use rustc_hir::{Expr, ExprKind, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty; use rustc_middle::ty::{GenericPredicates, PredicateKind, ProjectionPredicate, TraitPredicate}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::{BytePos, Span}; declare_clippy_lint! { /// ### What it does /// Checks for functions that expect closures of type /// Fn(...) -> Ord where the implemented closure returns the unit type. /// The lint also suggests to remove the semi-colon at the end of the statement if present. /// /// ### Why is this bad? /// Likely, returning the unit type is unintentional, and /// could simply be caused by an extra semi-colon. Since () implements Ord /// it doesn't cause a compilation error. /// This is the same reasoning behind the unit_cmp lint. /// /// ### Known problems /// If returning unit is intentional, then there is no /// way of specifying this without triggering needless_return lint /// /// ### Example /// ```rust /// let mut twins = vec!((1, 1), (2, 2)); /// twins.sort_by_key(|x| { x.1; }); /// ``` #[clippy::version = "1.47.0"] pub UNIT_RETURN_EXPECTING_ORD, correctness, "fn arguments of type Fn(...) -> Ord returning the unit type ()." } declare_lint_pass!(UnitReturnExpectingOrd => [UNIT_RETURN_EXPECTING_ORD]); fn get_trait_predicates_for_trait_id<'tcx>( cx: &LateContext<'tcx>, generics: GenericPredicates<'tcx>, trait_id: Option<DefId>, ) -> Vec<TraitPredicate<'tcx>> { let mut preds = Vec::new(); for (pred, _) in generics.predicates { if_chain! { if let PredicateKind::Trait(poly_trait_pred) = pred.kind().skip_binder(); let trait_pred = cx.tcx.erase_late_bound_regions(pred.kind().rebind(poly_trait_pred)); if let Some(trait_def_id) = trait_id; if trait_def_id == trait_pred.trait_ref.def_id; then { preds.push(trait_pred); } } } preds } fn get_projection_pred<'tcx>( cx: &LateContext<'tcx>, generics: GenericPredicates<'tcx>, trait_pred: TraitPredicate<'tcx>, ) -> Option<ProjectionPredicate<'tcx>> { generics.predicates.iter().find_map(|(proj_pred, _)| { if let ty::PredicateKind::Projection(pred) = proj_pred.kind().skip_binder() { let projection_pred = cx.tcx.erase_late_bound_regions(proj_pred.kind().rebind(pred)); if projection_pred.projection_ty.substs == trait_pred.trait_ref.substs { return Some(projection_pred); } } None }) } fn get_args_to_check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Vec<(usize, String)> { let mut args_to_check = Vec::new(); if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) { let fn_sig = cx.tcx.fn_sig(def_id); let generics = cx.tcx.predicates_of(def_id); let fn_mut_preds = get_trait_predicates_for_trait_id(cx, generics, cx.tcx.lang_items().fn_mut_trait()); let ord_preds = get_trait_predicates_for_trait_id(cx, generics, get_trait_def_id(cx, &paths::ORD)); let partial_ord_preds = get_trait_predicates_for_trait_id(cx, generics, cx.tcx.lang_items().partial_ord_trait()); // Trying to call erase_late_bound_regions on fn_sig.inputs() gives the following error // The trait `rustc::ty::TypeFoldable<'_>` is not implemented for `&[&rustc::ty::TyS<'_>]` let inputs_output = cx.tcx.erase_late_bound_regions(fn_sig.inputs_and_output()); inputs_output .iter() .rev() .skip(1) .rev() .enumerate() .for_each(|(i, inp)| { for trait_pred in &fn_mut_preds { if_chain! { if trait_pred.self_ty() == inp; if let Some(return_ty_pred) = get_projection_pred(cx, generics, *trait_pred); then { if ord_preds.iter().any(|ord| ord.self_ty() == return_ty_pred.ty) { args_to_check.push((i, "Ord".to_string())); } else if partial_ord_preds.iter().any(|pord| pord.self_ty() == return_ty_pred.ty) { args_to_check.push((i, "PartialOrd".to_string())); } } } } }); } args_to_check } fn check_arg<'tcx>(cx: &LateContext<'tcx>, arg: &'tcx Expr<'tcx>) -> Option<(Span, Option<Span>)> { if_chain! { if let ExprKind::Closure(_, _fn_decl, body_id, span, _) = arg.kind; if let ty::Closure(_def_id, substs) = &cx.typeck_results().node_type(arg.hir_id).kind(); let ret_ty = substs.as_closure().sig().output(); let ty = cx.tcx.erase_late_bound_regions(ret_ty); if ty.is_unit(); then { let body = cx.tcx.hir().body(body_id); if_chain! { if let ExprKind::Block(block, _) = body.value.kind; if block.expr.is_none(); if let Some(stmt) = block.stmts.last(); if let StmtKind::Semi(_) = stmt.kind; then { let data = stmt.span.data(); // Make a span out of the semicolon for the help message Some((span, Some(data.with_lo(data.hi-BytePos(1))))) } else { Some((span, None)) } } } else { None } } } impl<'tcx> LateLintPass<'tcx> for UnitReturnExpectingOrd { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { if let ExprKind::MethodCall(_, _, args, _) = expr.kind { let arg_indices = get_args_to_check(cx, expr); for (i, trait_name) in arg_indices { if i < args.len() { match check_arg(cx, &args[i]) { Some((span, None)) => { span_lint( cx, UNIT_RETURN_EXPECTING_ORD, span, &format!( "this closure returns \ the unit type which also implements {}", trait_name ), ); }, Some((span, Some(last_semi))) => { span_lint_and_help( cx, UNIT_RETURN_EXPECTING_ORD, span, &format!( "this closure returns \ the unit type which also implements {}", trait_name ), Some(last_semi), &"probably caused by this trailing semicolon".to_string(), ); }, None => {}, } } } } } }
use proconio::input; use segment_tree::SegmentTree; fn main() { input! { w: u32, _h: u32, n: usize, mut pq: [(u32, u32); n], n_a: usize, mut a: [u32; n_a], n_b: usize, b: [u32; n_b], }; a.push(w); pq.sort(); let mut xy = Vec::new(); let mut i = 0; let mut seg_min = SegmentTree::new(n_b + 1, std::usize::MAX / 2, |a, b| *a.min(b)); for i in 0..=n_b { seg_min.update(i, 0); } let mut seg_max = SegmentTree::new(n_b + 1, 0_usize, |a, b| *a.max(b)); let mut ans_min = std::usize::MAX / 2; let mut ans_max = 0; for a in a { while i < n && pq[i].0 < a { xy.push(pq[i]); i += 1; } assert!(i == n || pq[i].0 > a); for &(_, y) in &xy { let k = b.binary_search(&y).unwrap_err(); seg_min.update(k, seg_min.get(k) + 1); seg_max.update(k, seg_max.get(k) + 1); } ans_min = ans_min.min(seg_min.fold(0..(n_b + 1))); ans_max = ans_max.max(seg_max.fold(0..(n_b + 1))); for (_, y) in xy.drain(..) { let k = b.binary_search(&y).unwrap_err(); seg_min.update(k, seg_min.get(k) - 1); seg_max.update(k, seg_max.get(k) - 1); } } println!("{} {}", ans_min, ans_max); }
use std::env; use clap::Clap; #[macro_use] extern crate log; mod tcp_client; mod tcp_server; mod udp_client; mod udp_server; #[derive(Clap)] struct Opts { protocol: String, role: String, address: String } fn main() { let opts: Opts = Opts::parse(); env::set_var("RUST_LOG", "debug"); env_logger::init(); let protocol = opts.protocol.as_str(); let role = opts.role.as_str(); let address = opts.address.as_str(); match protocol { "tcp" => match role { "server" => { tcp_server::serve(address).unwrap_or_else(|e| error!("{}", e)); } "client" => { tcp_client::connect(address).unwrap_or_else(|e| error!("{}", e)); } _ => { missing_role(); } }, "udp" => match role { "server" => { udp_server::serve(address).unwrap_or_else(|e| error!("{}", e)); } "client" => { udp_client::communicate(address).unwrap_or_else(|e| error!("{}", e)); } _ => { missing_role(); } }, _ => { error!("Please specify tcp or udp on the 1st argument."); std::process::exit(1); } } } fn missing_role() { error!("Please specify server or client on the 2nd argument."); std::process::exit(1); }
use crate::error::Result; use crate::mapper::{Kind, Mapper}; use crate::sstable::{Key, Merged, SSTable, Value}; use std::collections::btree_map::Entry; use std::collections::BTreeMap; use std::mem; /// Wrapper over a BTreeMap<`Key`, `Value`> that does basic accounting of memory usage /// (Doesn't include BTreeMap internal stuff, can't reliably account for that without /// using special data-structures or depending on unstable implementation details of `std`) #[derive(Debug)] pub struct MemTable { pub mem_size: usize, pub values: BTreeMap<Key, Value>, } impl MemTable { /// Memory over-head per record. Size of the key + size of commit ID. pub const OVERHEAD_PER_RECORD: usize = mem::size_of::<Key>() + mem::size_of::<i64>(); pub fn new(values: BTreeMap<Key, Value>) -> MemTable { let mem_size = values.values().fold(0, |acc, elem| { acc + Self::OVERHEAD_PER_RECORD + opt_bytes_memory(&elem.val) }); MemTable { mem_size, values } } pub fn put(&mut self, key: &Key, commit: i64, data: &[u8]) { let value = Value { ts: commit, val: Some(data.to_vec()), }; self.mem_size += data.len(); match self.values.entry(*key) { Entry::Vacant(entry) => { entry.insert(value); self.mem_size += Self::OVERHEAD_PER_RECORD; } Entry::Occupied(mut entry) => { let old = entry.insert(value); self.mem_size -= opt_bytes_memory(&old.val); } } } pub fn delete(&mut self, key: &Key, commit: i64) { let value = Value { ts: commit, val: None, }; match self.values.entry(*key) { Entry::Vacant(entry) => { entry.insert(value); self.mem_size += Self::OVERHEAD_PER_RECORD; } Entry::Occupied(mut entry) => { let old = entry.insert(value); self.mem_size -= opt_bytes_memory(&old.val); } } } } pub fn flush_table( mem: &BTreeMap<Key, Value>, mapper: &dyn Mapper, pages: &mut Vec<BTreeMap<Key, SSTable>>, ) -> Result<()> { if mem.is_empty() { return Ok(()); }; if pages.is_empty() { pages.push(BTreeMap::new()); } let mut iter = mem.iter(); let sst = mapper.make_table(Kind::Active, &mut |mut data_wtr, mut index_wtr| { SSTable::create(&mut iter, 0, &mut data_wtr, &mut index_wtr); })?; let first = sst.meta().start; pages[0].insert(first, sst); Ok(()) } pub fn get( mem: &BTreeMap<Key, Value>, pages: &[BTreeMap<Key, SSTable>], key: &Key, ) -> Result<Option<Vec<u8>>> { if let Some(idx) = mem.get(key) { return Ok(idx.val.clone()); } let mut candidates = Vec::new(); for level in pages.iter() { for (_, sst) in level.iter().rev() { if sst.could_contain(key) { if let Some(val) = sst.get(&key)? { candidates.push((*key, val)); } } } } let merged = Merged::new(vec![candidates.into_iter()]) .next() .map(|(_, v)| v.val.unwrap()); Ok(merged) } pub fn range( mem: &BTreeMap<Key, Value>, tables: &[BTreeMap<Key, SSTable>], range: std::ops::RangeInclusive<Key>, ) -> Result<impl Iterator<Item = (Key, Vec<u8>)>> { let mut sources: Vec<Box<dyn Iterator<Item = (Key, Value)>>> = Vec::new(); let mem = mem .range(range.clone()) .map(|(k, v)| (*k, v.clone())) .collect::<Vec<_>>(); sources.push(Box::new(mem.into_iter())); for level in tables.iter() { for sst in level.values() { let iter = sst.range(&range)?; let iter = Box::new(iter) as Box<dyn Iterator<Item = (Key, Value)>>; sources.push(iter); } } let rows = Merged::new(sources).map(|(k, v)| (k, v.val.unwrap())); Ok(rows) } impl Default for MemTable { fn default() -> MemTable { MemTable { values: BTreeMap::new(), mem_size: 0, } } } #[inline] fn opt_bytes_memory(bytes: &Option<Vec<u8>>) -> usize { bytes.as_ref().map(Vec::len).unwrap_or(0) } #[cfg(test)] mod test { use super::*; use crate::test::gen; const COMMIT: i64 = -1; #[test] fn test_put_calc() { const DATA_SIZE: usize = 16; let mut table = MemTable::default(); for (key, data) in gen::pairs(DATA_SIZE).take(1024) { table.put(&key, COMMIT, &data); } let expected_size = 1024 * (DATA_SIZE + MemTable::OVERHEAD_PER_RECORD); assert_eq!(table.mem_size, expected_size); } #[test] fn test_delete_calc() { const DATA_SIZE: usize = 32; let mut table = MemTable::default(); let input = gen::pairs(DATA_SIZE).take(1024).collect::<Vec<_>>(); for (key, data) in &input { table.put(key, COMMIT, data); } for (key, _) in input.iter().rev().take(512) { table.delete(key, COMMIT); } let expected_size = 512 * (DATA_SIZE + MemTable::OVERHEAD_PER_RECORD) + 512 * MemTable::OVERHEAD_PER_RECORD; assert_eq!(table.mem_size, expected_size); // Deletes of things not in the memory table must be recorded for key in gen::keys().take(512) { table.delete(&key, COMMIT); } let expected_size = expected_size + 512 * MemTable::OVERHEAD_PER_RECORD; assert_eq!(table.mem_size, expected_size); } #[test] fn test_put_order_irrelevant() { let (mut table_1, mut table_2) = (MemTable::default(), MemTable::default()); let big_input: Vec<_> = gen::pairs(1024).take(128).collect(); let small_input: Vec<_> = gen::pairs(16).take(128).collect(); for (key, data) in big_input.iter().chain(small_input.iter()) { table_1.put(key, COMMIT, data); } let iter = big_input .iter() .rev() .zip(small_input.iter().rev()) .enumerate(); for (i, ((big_key, big_data), (small_key, small_data))) in iter { if i % 2 == 0 { table_2.put(big_key, COMMIT, big_data); table_2.put(small_key, COMMIT, small_data); } else { table_2.put(small_key, COMMIT, small_data); table_2.put(big_key, COMMIT, big_data); } } assert_eq!(table_1.mem_size, table_2.mem_size); assert_eq!(table_1.values, table_2.values); } #[test] fn test_delete_order_irrelevant() { let (mut table_1, mut table_2) = (MemTable::default(), MemTable::default()); let big_input: Vec<_> = gen::pairs(1024).take(128).collect(); let small_input: Vec<_> = gen::pairs(16).take(128).collect(); for (key, data) in big_input.iter().chain(small_input.iter()) { table_1.put(key, COMMIT, data); table_2.put(key, COMMIT, data); } let iter = big_input .iter() .rev() .take(64) .chain(small_input.iter().rev().take(64)) .map(|(key, _)| key); for key in iter { table_1.delete(key, COMMIT); } let iter = big_input .iter() .rev() .take(64) .zip(small_input.iter().rev().take(64)) .map(|((key, _), (key2, _))| (key, key2)) .enumerate(); for (i, (big_key, small_key)) in iter { if i % 2 == 0 { table_2.delete(big_key, COMMIT); table_2.delete(small_key, COMMIT); } else { table_2.delete(small_key, COMMIT); table_2.delete(big_key, COMMIT); } } assert_eq!(table_1.mem_size, table_2.mem_size); assert_eq!(table_1.values, table_2.values); } }
extern crate clap; use clap::{App, Arg}; use std::fs; fn capitalize(path: &str) -> Result<(), String> { match fs::read_to_string(path) { Ok(contents) => { match fs::write(path, contents.to_uppercase()) { Ok(_) => Ok(()), Err(err) => Err(format!("Error writing `{}`: {}", path, err)), } }, Err(err) => Err(format!("Error reading `{}`: {}", path, err)), } } fn main() { let matches = App::new("capitalize") .version(env!("CARGO_PKG_VERSION")) .about("capitalize files in-place") .arg(Arg::with_name("path") .help("path(s) to files to capitalize") .multiple(true) ) .get_matches(); std::process::exit( matches.values_of("path").unwrap().map(|path| { match capitalize(path) { Ok(_) => 0, Err(err) => { eprintln!("{}", err); 1 } } }).max().unwrap(), ); }
///! This module defines a Low-Level IR use std::borrow::Cow; use std::convert::{TryFrom, TryInto}; use std::num::NonZeroU32; use std::{error, fmt, iter}; use itertools::Itertools; use num::bigint::BigInt; use num::rational::Ratio; use crate::ir; use crate::search_space::{InstFlag, MemSpace}; /// Checks that all the types in `types` are identical, and returns that type. /// /// # Errors /// /// Fails if `types` contains several different types. /// /// # Panics /// /// Panics if `types` is empty. fn unify_type(types: impl IntoIterator<Item = ir::Type>) -> Result<ir::Type, TypeError> { let mut types = types.into_iter(); let first = types.next().unwrap_or_else(|| panic!("no types provided")); if let Some(other) = types.find(|&other| other != first) { Err(TypeError::mismatch(first, other)) } else { Ok(first) } } /// Checks that all the types in `types` are the same integer type, and returns it. /// /// # Errors /// /// Fails if `types` contains different types, or non-integer types /// /// # Panics /// /// Panics if `types` is empty. fn unify_itype(types: impl IntoIterator<Item = ir::Type>) -> Result<ir::Type, TypeError> { unify_type(types).and_then(|t| { if t.is_integer() { Ok(t) } else { Err(TypeError::not_integer(t)) } }) } /// Checks that all the types inf `types` are the same floating-point type, and returns it. /// /// # Errors /// /// Fails if `types` contains different types, or non floating-point types. /// /// # Panics /// /// Panics if `types` is empty. fn unify_ftype(types: impl IntoIterator<Item = ir::Type>) -> Result<ir::Type, TypeError> { unify_type(types).and_then(|t| { if t.is_float() { Ok(t) } else { Err(TypeError::not_float(t)) } }) } /// A named register. /// /// Registers are typed, and should only be used in instructions expecting the appropriate type. #[derive(Debug, Copy, Clone)] pub struct Register<'a> { name: &'a str, t: ir::Type, } impl fmt::Display for Register<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(self.name) } } impl<'a> Register<'a> { /// Create a new named register with given type. pub fn new(name: &'a str, t: ir::Type) -> Self { Register { name, t } } /// Name of the register pub fn name(self) -> &'a str { self.name } /// The type of values stored in the register. pub fn t(self) -> ir::Type { self.t } /// Converts the register to an operand for use as a value pub fn into_operand(self) -> Operand<'a> { Operand::Register(self) } } /// An operand which can be used as input argument of an instruction. #[derive(Debug, Clone)] pub enum Operand<'a> { Register(Register<'a>), IntLiteral(Cow<'a, BigInt>, u16), FloatLiteral(Cow<'a, Ratio<BigInt>>, u16), } impl fmt::Display for Operand<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Operand::Register(register) => fmt::Display::fmt(register, fmt), &Operand::IntLiteral(ref value, bits) => write!(fmt, "{}i{}", value, bits), &Operand::FloatLiteral(ref value, bits) => { write!(fmt, "({}) as f{}", value, bits) } } } } impl<'a> From<Register<'a>> for Operand<'a> { fn from(register: Register<'a>) -> Operand<'a> { Operand::Register(register) } } impl<'a> Operand<'a> { /// The register represented by this operand, if there is one. pub fn to_register(&self) -> Option<Register<'a>> { match *self { Operand::Register(register) => Some(register), _ => None, } } /// The type of this operand. pub fn t(&self) -> ir::Type { match *self { Operand::Register(register) => register.t(), Operand::IntLiteral(_, bits) => ir::Type::I(bits), Operand::FloatLiteral(_, bits) => ir::Type::F(bits), } } } /// Trait to convert integer literals to operands pub trait IntLiteral<'a>: ir::IntLiteral<'a> + Sized { /// Converts this value into an integer literal operand with the same number of bits fn int_literal(self) -> Operand<'a> { let (value, bits) = self.decompose(); Operand::IntLiteral(value, bits) } /// Converts this value into an integer literal operand that is possibly wider. /// /// # Errors /// /// Fails if `t` is not an integral type, or `t` does not have a large enough bitwidth to /// represent the value. fn typed_int_literal( self, t: ir::Type, ) -> Result<Operand<'a>, InvalidTypeForIntLiteral> { let (value, bits) = self.decompose(); match t { ir::Type::I(tbits) if bits <= tbits => Ok(Operand::IntLiteral(value, tbits)), _ => Err(InvalidTypeForIntLiteral(value.to_string(), bits, t)), } } } #[derive(Debug, Clone)] pub struct InvalidTypeForIntLiteral(String, u16, ir::Type); impl fmt::Display for InvalidTypeForIntLiteral { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!( fmt, "unable to use `{}i{}` as literal of type `{}`", self.0, self.1, self.2 ) } } impl error::Error for InvalidTypeForIntLiteral {} impl<'a, T: ir::IntLiteral<'a>> IntLiteral<'a> for T {} /// Trait to convert floating-point literals to operands pub trait FloatLiteral<'a>: ir::FloatLiteral<'a> + Sized { /// Converts this value into a floating-point literal operand with the same width fn float_literal(self) -> Operand<'a> { let (value, bits) = self.decompose(); Operand::FloatLiteral(value, bits) } } impl<'a, T: ir::FloatLiteral<'a>> FloatLiteral<'a> for T {} /// An address operand. /// /// Addresses are separated from other operands because they have a slightly more complex /// representation, notably due to being able to add immediate offsets. /// /// Unlike regular operands, they are also only allowed as arguments of memory instructions. #[derive(Debug, Copy, Clone)] pub enum Address<'a> { /// A register with an immediate offset Register(Register<'a>, i32), } impl fmt::Display for Address<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Address::Register(reg, offset) if offset == 0 => write!(fmt, "[{}]", reg), Address::Register(reg, offset) => write!(fmt, "[{}+0x{:x}]", reg, offset), } } } impl<'a> TryFrom<Operand<'a>> for Address<'a> { type Error = InvalidOperandAsAddressError; fn try_from(operand: Operand<'a>) -> Result<Self, Self::Error> { match operand { Operand::Register(reg) if reg.t().is_integer() => { Ok(Address::Register(reg, 0)) } _ => Err(InvalidOperandAsAddressError(operand.to_string())), } } } /// The error type used when an operand cannot be used as an address. #[derive(Debug, Clone)] pub struct InvalidOperandAsAddressError(String); impl fmt::Display for InvalidOperandAsAddressError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "invalid operand used as address: `{}`", self.0) } } impl error::Error for InvalidOperandAsAddressError {} /// Wrapper type for representing either scalar or vector operands or registers. /// /// This should usually not be used directly but rather through the `RegVec` and `OpVec` type /// aliases. #[derive(Debug, Clone)] pub enum ScalarOrVector<T> { Scalar(T), Vector(Vec<T>), } impl<T: fmt::Display> fmt::Display for ScalarOrVector<T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ScalarOrVector::Scalar(scalar) => fmt::Display::fmt(scalar, fmt), ScalarOrVector::Vector(vec) => write!(fmt, "{{{}}}", vec.iter().format(", ")), } } } impl<T> From<T> for ScalarOrVector<T> { fn from(scalar: T) -> Self { ScalarOrVector::Scalar(scalar) } } /// Either a single register or a vector of registers /// /// Empty vectors are invalid, and so are vectors with registers of different types. pub type RegVec<'a> = ScalarOrVector<Register<'a>>; impl<'a> RegVec<'a> { /// The type of the register. /// /// In case of a vector register, it is assumed that all elements have the same type, and only /// the first one is returned. /// /// # Panics /// /// Panics if `self` is an empty vector. pub fn t(&self) -> ir::Type { match self { ScalarOrVector::Scalar(reg) => reg.t(), ScalarOrVector::Vector(regs) => regs[0].t(), } } } /// Either a single operand or a vector of operands /// /// Empty vectors are invalid, and so are vectors with operands of different types. pub type OpVec<'a> = ScalarOrVector<Operand<'a>>; impl<'a> OpVec<'a> { /// The type of the operand. /// /// In case of a vector operand, it is assumed that all elements have the same type, and only /// the first one is returned. /// /// # Panics /// /// Panics if `self` is an empty vector. pub fn t(&self) -> ir::Type { match self { ScalarOrVector::Scalar(oper) => oper.t(), ScalarOrVector::Vector(opers) => opers[0].t(), } } } /// A typed unary operator. #[derive(Debug, Copy, Clone)] pub enum UnOp { Move { t: ir::Type }, Cast { src_t: ir::Type, dst_t: ir::Type }, // Natural exponential Exp { t: ir::Type }, } impl fmt::Display for UnOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self { UnOp::Move { t } => write!(fmt, "move.{}", t), UnOp::Cast { src_t, dst_t } => write!(fmt, "cast.{}.{}", dst_t, src_t), UnOp::Exp { t } => write!(fmt, "exp.{}", t), } } } impl UnOp { /// Converts an `ir::UnaryOp` with a given operand type to an unary operator. /// /// # Errors /// /// Fails if the `ir::UnaryOp` is not compatible with the requested `arg_t`. pub fn from_ir(op: ir::UnaryOp, arg_t: ir::Type) -> Result<Self, InstructionError> { Ok(match op { ir::UnaryOp::Mov => UnOp::Move { t: arg_t }, ir::UnaryOp::Cast(dst_t) => UnOp::Cast { src_t: arg_t, dst_t, }, ir::UnaryOp::Exp(t) => UnOp::Exp { t: Self::unify_type(Some(t), [arg_t])?, }, }) } /// The expected argument type for this operator. pub fn arg_t(self) -> [ir::Type; 1] { match self { UnOp::Move { t } | UnOp::Cast { src_t: t, .. } | UnOp::Exp { t } => [t], } } /// The resulting type when this operator is applied. pub fn ret_t(self) -> ir::Type { match self { UnOp::Move { t } | UnOp::Cast { dst_t: t, .. } | UnOp::Exp { t } => t, } } fn unify_type(d: Option<ir::Type>, a: [ir::Type; 1]) -> Result<ir::Type, TypeError> { unify_type(d.into_iter().chain(a.iter().copied())) } /// Create a `move` operator based on its destination and argument types. /// /// # Errors /// /// Fails if `d` and `a` are different types. pub fn infer_move( d: Option<ir::Type>, a: [ir::Type; 1], ) -> Result<Self, InstructionError> { Ok(Self::unify_type(d, a).map(|t| UnOp::Move { t })?) } /// Create a `cast` operator based on its destination and argument types. /// /// # Errors /// /// Fails if `dst_t` and `d` are different types. pub fn infer_cast( dst_t: ir::Type, d: Option<ir::Type>, [a]: [ir::Type; 1], ) -> Result<Self, InstructionError> { Ok(Self::unify_type(d, [dst_t]).map(|dst_t| UnOp::Cast { dst_t, src_t: a })?) } /// Create an `exp` operator based on its destination and argument types. /// /// # Errors /// /// Fails if `d` and `a` are different types. pub fn infer_exp( d: Option<ir::Type>, a: [ir::Type; 1], ) -> Result<Self, InstructionError> { Ok(Self::unify_type(d, a).map(|t| UnOp::Exp { t })?) } } /// Comparison operators #[derive(Debug, Copy, Clone)] pub enum CmpOp { Eq, Ne, Lt, Le, Gt, Ge, } impl fmt::Display for CmpOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { CmpOp::Eq => "eq", CmpOp::Ne => "ne", CmpOp::Lt => "lt", CmpOp::Le => "le", CmpOp::Gt => "gt", CmpOp::Ge => "ge", }) } } /// A typed binary operator #[derive(Debug, Copy, Clone)] pub enum BinOp { // Integer Arithmetic Instructions IAdd { arg_t: ir::Type }, ISub { arg_t: ir::Type }, IDiv { arg_t: ir::Type }, IMul { arg_t: ir::Type, spec: MulSpec }, IMax { arg_t: ir::Type }, // Floating-Point Instructions FAdd { t: ir::Type, rounding: FpRounding }, FSub { t: ir::Type, rounding: FpRounding }, FMul { t: ir::Type, rounding: FpRounding }, FDiv { t: ir::Type, rounding: FpRounding }, FMax { t: ir::Type }, FMin { t: ir::Type }, // Comparison and Selection Instructions Set { op: CmpOp, arg_t: ir::Type }, // Logic and Shift Instructions And { t: ir::Type }, Or { t: ir::Type }, Xor { t: ir::Type }, } impl fmt::Display for BinOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use BinOp::*; match self { // Integer Arithmetic Instructions IAdd { arg_t } => write!(fmt, "add.{}", arg_t), ISub { arg_t } => write!(fmt, "sub.{}", arg_t), IDiv { arg_t } => write!(fmt, "div.{}", arg_t), IMul { arg_t, spec } => write!(fmt, "mul.{}.{}", spec, arg_t), IMax { arg_t } => write!(fmt, "max.{}", arg_t), // Floating-Point Instructions FAdd { t, rounding } => write!(fmt, "add.{}.{}", rounding, t), FSub { t, rounding } => write!(fmt, "sub.{}.{}", rounding, t), FMul { t, rounding } => write!(fmt, "mul.{}.{}", rounding, t), FDiv { t, rounding } => write!(fmt, "div.{}.{}", rounding, t), FMax { t } => write!(fmt, "max.{}", t), FMin { t } => write!(fmt, "min.{}", t), // Comparison and Selection Instructions Set { op, arg_t } => write!(fmt, "set.{}.{}", op, arg_t), // Logic and Shift Instructions And { t } => write!(fmt, "and.{}", t), Or { t } => write!(fmt, "or.{}", t), Xor { t } => write!(fmt, "xor.{}", t), } } } // Helper macro to reduce the boilerplate of writing `infer_[op]` functions macro_rules! infer_binops { ($($infer:ident, $con:ident { $t:ident $(, $arg:ident: $argTy:ty)* }, $unify:ident;)*) => { $(pub fn $infer($($arg: $argTy ,)* d: Option<ir::Type>, ab: [ir::Type; 2]) -> Result<Self, InstructionError> { Ok(Self::$unify(d, ab).map(|$t| BinOp::$con { $t $(, $arg)* })?) })* }; } impl BinOp { /// Converts an `ir::BinOp` with given rounding mode and operand types to a binary operator. /// /// # Errors /// /// Fails if the `ir::BinOp` is not compatible with the requested rounding mode and operand /// types. pub fn from_ir( op: ir::BinOp, rounding: ir::op::Rounding, lhs_t: ir::Type, rhs_t: ir::Type, ) -> Result<Self, InstructionError> { use ir::{BinOp as iop, Type as ity}; let arg_t = Self::unify_type(None, [lhs_t, rhs_t])?; match arg_t { ity::I(_) if rounding != ir::op::Rounding::Exact => { return Err(InstructionError::invalid_rounding_for_type(rounding, arg_t)) } ity::I(_) => (), ity::F(_) => match op { iop::Add | iop::Sub | iop::Div => (), iop::Max => { if rounding != ir::op::Rounding::Exact { return Err(InstructionError::invalid_rounding_for_op( op, rounding, )); } } _ => return Err(InstructionError::invalid_binop_for_type(op, arg_t)), }, // Type is not lowered _ => return Err(InstructionError::invalid_type(arg_t)), } Ok(match (op, arg_t) { (iop::Add, ity::I(_)) => BinOp::IAdd { arg_t }, (iop::Sub, ity::I(_)) => BinOp::ISub { arg_t }, (iop::Div, ity::I(_)) => BinOp::IDiv { arg_t }, (iop::And, ity::I(_)) => BinOp::And { t: arg_t }, (iop::Or, ity::I(_)) => BinOp::Or { t: arg_t }, (iop::Add, ity::F(_)) => BinOp::FAdd { t: arg_t, rounding: rounding.into(), }, (iop::Sub, ity::F(_)) => BinOp::FSub { t: arg_t, rounding: rounding.into(), }, (iop::Div, ity::F(_)) => BinOp::FDiv { t: arg_t, rounding: rounding.into(), }, (iop::Lt, _) => BinOp::Set { op: CmpOp::Lt, arg_t, }, (iop::Leq, _) => BinOp::Set { op: CmpOp::Le, arg_t, }, (iop::Equals, _) => BinOp::Set { op: CmpOp::Eq, arg_t, }, (iop::Max, ity::F(_)) => BinOp::FMax { t: arg_t }, (iop::Max, ity::I(_)) => BinOp::IMax { arg_t }, _ => return Err(InstructionError::invalid_binop_for_type(op, arg_t)), }) } /// Create a new multiplication operator based on its rounding mode, argument types, and return /// type. /// /// # Errors /// /// Fails if a rounding mode is provided for integer multiplication, or if the argument and /// result types are not compatibles. pub fn from_ir_mul( rounding: ir::op::Rounding, lhs_t: ir::Type, rhs_t: ir::Type, ret_t: ir::Type, ) -> Result<Self, InstructionError> { match lhs_t { ir::Type::I(_) => { if rounding != ir::op::Rounding::Exact { Err(InstructionError::invalid_rounding_for_type(rounding, lhs_t)) } else { Ok(BinOp::IMul { arg_t: lhs_t, spec: MulSpec::from_ir(lhs_t, rhs_t, ret_t)?, }) } } ir::Type::F(_) => Ok(BinOp::FMul { t: Self::unify_ftype(Some(ret_t), [lhs_t, rhs_t])?, rounding: rounding.into(), }), // Type is not lowered _ => Err(InstructionError::invalid_type(lhs_t)), } } /// The expected argument types for this operator. pub fn arg_t(self) -> [ir::Type; 2] { use BinOp::*; match self { IAdd { arg_t } | ISub { arg_t } | IDiv { arg_t } | IMul { arg_t, .. } | IMax { arg_t } | Set { arg_t, .. } => [arg_t, arg_t], FAdd { t, .. } | FSub { t, .. } | FMul { t, .. } | FDiv { t, .. } | FMax { t } | FMin { t } | And { t } | Or { t } | Xor { t } => [t, t], } } /// The resulting type when this operator is applied. pub fn ret_t(self) -> ir::Type { use BinOp::*; match self { IAdd { arg_t } | ISub { arg_t } | IDiv { arg_t } | IMax { arg_t } => arg_t, IMul { arg_t, spec } => spec.ret_t(arg_t), Set { .. } => ir::Type::I(1), FAdd { t, .. } | FSub { t, .. } | FMul { t, .. } | FDiv { t, .. } | FMax { t } | FMin { t } | And { t } | Or { t } | Xor { t } => t, } } fn unify_itype( d: Option<ir::Type>, ab: [ir::Type; 2], ) -> Result<ir::Type, TypeError> { unify_itype(d.into_iter().chain(ab.iter().copied())) } fn unify_ftype( d: Option<ir::Type>, ab: [ir::Type; 2], ) -> Result<ir::Type, TypeError> { unify_ftype(d.into_iter().chain(ab.iter().copied())) } fn unify_type(d: Option<ir::Type>, ab: [ir::Type; 2]) -> Result<ir::Type, TypeError> { unify_type(d.into_iter().chain(ab.iter().copied())) } infer_binops! { infer_iadd, IAdd { arg_t }, unify_itype; infer_isub, ISub { arg_t }, unify_itype; infer_idiv, IDiv { arg_t }, unify_itype; infer_imax, IMax { arg_t }, unify_itype; infer_fadd, FAdd { t, rounding: FpRounding }, unify_ftype; infer_fsub, FSub { t, rounding: FpRounding }, unify_ftype; infer_fdiv, FDiv { t, rounding: FpRounding }, unify_ftype; infer_fmul, FMul { t, rounding: FpRounding }, unify_ftype; infer_fmax, FMax { t }, unify_ftype; infer_fmin, FMin { t }, unify_ftype; infer_and, And { t }, unify_itype; infer_xor, Xor { t }, unify_itype; infer_or, Or { t }, unify_itype; } pub fn infer_imul( spec: MulSpec, d: Option<ir::Type>, ab: [ir::Type; 2], ) -> Result<Self, InstructionError> { let arg_t = Self::unify_itype(None, ab)?; unify_itype(d.into_iter().chain(iter::once(spec.ret_t(arg_t))))?; Ok(BinOp::IMul { arg_t, spec }) } pub fn infer_set( op: CmpOp, d: Option<ir::Type>, ab: [ir::Type; 2], ) -> Result<Self, InstructionError> { let arg_t = Self::unify_type(None, ab)?; unify_itype(d.into_iter().chain(iter::once(ir::Type::I(1))))?; Ok(BinOp::Set { op, arg_t }) } } /// A typed ternary operator (e.g. fma) #[derive(Debug, Copy, Clone)] pub enum TernOp { IMad { arg_t: ir::Type, spec: MulSpec }, FFma { t: ir::Type, rounding: FpRounding }, } impl fmt::Display for TernOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self { TernOp::IMad { arg_t, spec } => write!(fmt, "mad.{}.{}", spec, arg_t), TernOp::FFma { t, rounding } => write!(fmt, "fma.{}.{}", rounding, t), } } } impl TernOp { /// Create a new fma operator based on its rounding mode and argument types. /// /// # Errors /// /// Fails if a rounding mode is provided for an integer mad, or if the argument types are not /// compatible. pub fn from_ir_mad( rounding: ir::op::Rounding, mlhs_t: ir::Type, mrhs_t: ir::Type, arhs_t: ir::Type, ) -> Result<Self, InstructionError> { match mlhs_t { ir::Type::I(_) => { if rounding != ir::op::Rounding::Exact { Err(InstructionError::invalid_rounding_for_type( rounding, mlhs_t, )) } else { Ok(TernOp::IMad { arg_t: mlhs_t, spec: MulSpec::from_ir(mlhs_t, mrhs_t, arhs_t)?, }) } } ir::Type::F(_) => Ok(TernOp::FFma { t: Self::unify_ftype(None, [mlhs_t, mrhs_t, arhs_t])?, rounding: rounding.into(), }), // Type is not lowered _ => Err(InstructionError::invalid_type(mlhs_t)), } } /// Create a `imad` operator based on its destination and argument types. /// /// # Errors /// /// Fails if `d` and `c` are different types, or `a`, `b` and `c` are not compatible with /// `spec`. pub fn infer_imad( spec: MulSpec, d: Option<ir::Type>, [a, b, c]: [ir::Type; 3], ) -> Result<Self, InstructionError> { let arg_t = unify_itype(iter::once(a).chain(iter::once(b)))?; unify_itype( d.into_iter() .chain(iter::once(c)) .chain(iter::once(spec.ret_t(arg_t))), )?; Ok(TernOp::IMad { arg_t, spec }) } fn unify_ftype( d: Option<ir::Type>, abc: [ir::Type; 3], ) -> Result<ir::Type, TypeError> { unify_ftype(d.into_iter().chain(abc.iter().copied())) } /// Create a `ffma` operator based on its destination and argument types. /// /// # Errors /// /// Fails if `d`, `a`, `b` and `c` are not the same type. pub fn infer_ffma( rounding: FpRounding, d: Option<ir::Type>, abc: [ir::Type; 3], ) -> Result<Self, InstructionError> { Ok(Self::unify_ftype(d, abc).map(|t| TernOp::FFma { t, rounding })?) } /// The expected argument types for this operator. pub fn arg_t(self) -> [ir::Type; 3] { match self { TernOp::IMad { arg_t, spec } => [arg_t, arg_t, spec.ret_t(arg_t)], TernOp::FFma { t, .. } => [t, t, t], } } /// The resulting type when this operator is applied. pub fn ret_t(self) -> ir::Type { match self { TernOp::IMad { arg_t, spec } => spec.ret_t(arg_t), TernOp::FFma { t, .. } => t, } } } /// A (possibly vectorized) instruction to execute. #[derive(Debug, Clone)] #[allow(clippy::large_enum_variant)] pub enum Instruction<'a> { Unary(UnOp, RegVec<'a>, [OpVec<'a>; 1]), Binary(BinOp, RegVec<'a>, [OpVec<'a>; 2]), Ternary(TernOp, RegVec<'a>, [OpVec<'a>; 3]), Load(LoadSpec, RegVec<'a>, Address<'a>), Store(StoreSpec, Address<'a>, [OpVec<'a>; 1]), Jump(Label<'a>), Sync, } impl fmt::Display for Instruction<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use Instruction::*; match self { Unary(op, d, [a]) => write!(fmt, "{} = {}({})", d, op, a), Binary(op, d, [a, b]) => write!(fmt, "{} = {}({}, {})", d, op, a, b), Ternary(op, d, [a, b, c]) => { write!(fmt, "{} = {}({}, {}, {})", d, op, a, b, c) } Load(spec, d, a) => write!(fmt, "{} = {}({})", d, spec, a), Store(spec, a, [b]) => write!(fmt, "{}({}, {})", spec, a, b), Jump(label) => write!(fmt, "jump {}", label), Sync => write!(fmt, "sync"), } } } /// Helper macro to define instruction constructors. See examples of use in the `impl Instruction` /// block below. macro_rules! new_instruction { () => {}; ( $inst:ident$([$($pre:ident: $preTy:ty),*])?( $d:ident $(, $a:ident)* ), $infer:path, $arity:ident; $($rest:tt)* ) => { #[allow(non_camel_case_types)] pub fn $inst< $d $(, $a)* >( $($($pre: $preTy, )*)? $d: $d $(, $a: $a)* ) -> Result<Self, InstructionError> where $d: Into<RegVec<'a>>, $($a: Into<OpVec<'a>>,)* { let $d = $d.into(); $(let $a = $a.into();)* Self::$arity( $infer($($($pre ,)*)? Some($d.t()), [$($a.t()),*])?, $d $(, $a)* ) } new_instruction!($($rest)*); }; ( $inst:ident$([$($pre:ident: $preTy:ty),*])?( $d:ident $(, $a:ident)* ) = $alias:ident$([$($aPre:expr),*])?; $($rest:tt)* ) => { #[allow(non_camel_case_types)] pub fn $inst< $d $(, $a)* >( $($($pre: $preTy, )*)? $d: $d $(, $a: $a)* ) -> Result<Self, InstructionError> where $d: Into<RegVec<'a>>, $($a: Into<OpVec<'a>>,)* { Self::$alias($($($aPre ,)*)? $d $(, $a)*) } new_instruction!($($rest)*); }; } impl<'a> Instruction<'a> { /// Create a new unary instruction. /// /// # Errors /// /// Fails if the destination and argument types are not compatible with the provided operator. pub fn unary( op: UnOp, dest: RegVec<'a>, arg: OpVec<'a>, ) -> Result<Self, InstructionError> { if op.arg_t() != [arg.t()] || dest.t() != op.ret_t() { return Err(InstructionError::incompatible_types()); } Ok(Instruction::Unary(op, dest, [arg])) } new_instruction! { mov(d, a), UnOp::infer_move, unary; cast[dst_t: ir::Type](d, a), UnOp::infer_cast, unary; exp(d, a), UnOp::infer_exp, unary; } /// Create a new binary instruction. /// /// # Errors /// /// Fails if the destination and argument types are not compatible with the provided operator. pub fn binary( op: BinOp, d: RegVec<'a>, a: OpVec<'a>, b: OpVec<'a>, ) -> Result<Self, InstructionError> { if op.arg_t() != [a.t(), b.t()] || op.ret_t() != d.t() { return Err(InstructionError::incompatible_types()); } Ok(Instruction::Binary(op, d, [a, b])) } new_instruction! { iadd(d, a, b), BinOp::infer_iadd, binary; isub(d, a, b), BinOp::infer_isub, binary; imul_ex[spec: MulSpec](d, a, b), BinOp::infer_imul, binary; imul_low(d, a, b) = imul_ex[MulSpec::Low]; imul_high(d, a, b) = imul_ex[MulSpec::High]; imul_wide(d, a, b) = imul_ex[MulSpec::Wide]; idiv(d, a, b), BinOp::infer_idiv, binary; imax(d, a, b), BinOp::infer_imax, binary; fadd_ex[rounding: FpRounding](d, a, b), BinOp::infer_fadd, binary; fadd(d, a, b) = fadd_ex[FpRounding::NearestEven]; fsub_ex[rounding: FpRounding](d, a, b), BinOp::infer_fsub, binary; fsub(d, a, b) = fsub_ex[FpRounding::NearestEven]; fmul_ex[rounding: FpRounding](d, a, b), BinOp::infer_fmul, binary; fmul(d, a, b) = fmul_ex[FpRounding::NearestEven]; fdiv_ex[rounding: FpRounding](d, a, b), BinOp::infer_fdiv, binary; fdiv(d, a, b) = fdiv_ex[FpRounding::NearestEven]; fmax(d, a, b), BinOp::infer_fmax, binary; fmin(d, a, b), BinOp::infer_fmin, binary; set[op: CmpOp](d, a, b), BinOp::infer_set, binary; set_eq(d, a, b) = set[CmpOp::Eq]; set_ne(d, a, b) = set[CmpOp::Ne]; set_lt(d, a, b) = set[CmpOp::Lt]; set_le(d, a, b) = set[CmpOp::Le]; set_gt(d, a, b) = set[CmpOp::Gt]; set_ge(d, a, b) = set[CmpOp::Ge]; and(d, a, b), BinOp::infer_and, binary; xor(d, a, b), BinOp::infer_xor, binary; or(d, a, b), BinOp::infer_or, binary; } pub fn imul<D, A, B>(d: D, a: A, b: B) -> Result<Self, InstructionError> where D: Into<RegVec<'a>>, A: Into<OpVec<'a>>, B: Into<OpVec<'a>>, { let (d, a, b) = (d.into(), a.into(), b.into()); Self::imul_ex(MulSpec::from_ir(a.t(), b.t(), d.t())?, d, a, b) } /// Create a new ternary instruction. /// /// # Errors /// /// Fails if the destination and argument types are not compatible with the provided operator. pub fn ternary( op: TernOp, d: RegVec<'a>, a: OpVec<'a>, b: OpVec<'a>, c: OpVec<'a>, ) -> Result<Self, InstructionError> { if op.arg_t() != [a.t(), b.t(), c.t()] || op.ret_t() != d.t() { return Err(InstructionError::incompatible_types()); } Ok(Instruction::Ternary(op, d, [a, b, c])) } new_instruction! { imad_ex[spec: MulSpec](d, a, b, c), TernOp::infer_imad, ternary; imad_low(d, a, b, c) = imad_ex[MulSpec::Low]; imad_high(d, a, b, c) = imad_ex[MulSpec::High]; imad_wide(d, a, b, c) = imad_ex[MulSpec::Wide]; ffma_ex[rounding: FpRounding](d, a, b, c), TernOp::infer_ffma, ternary; ffma(d, a, b, c) = ffma_ex[FpRounding::NearestEven]; } pub fn imad<D, A, B, C>(d: D, a: A, b: B, c: C) -> Result<Self, InstructionError> where D: Into<RegVec<'a>>, A: Into<OpVec<'a>>, B: Into<OpVec<'a>>, C: Into<OpVec<'a>>, { let (a, b, c) = (a.into(), b.into(), c.into()); Self::imad_ex(MulSpec::from_ir(a.t(), b.t(), c.t())?, d, a, b, c) } /// Create a new load instruction. pub fn load( spec: LoadSpec, d: RegVec<'a>, a: Address<'a>, ) -> Result<Self, InstructionError> { if spec.t() != d.t() { return Err(InstructionError::incompatible_types()); } Ok(Instruction::Load(spec, d, a)) } /// Create a new store instruction. pub fn store( spec: StoreSpec, a: Address<'a>, b: OpVec<'a>, ) -> Result<Self, InstructionError> { if spec.t() != b.t() { return Err(InstructionError::incompatible_types()); } Ok(Instruction::Store(spec, a, [b])) } /// Create a new `jump` instruction. pub fn jump(label: Label<'a>) -> Self { Instruction::Jump(label) } /// Create a new `sync` instruction. pub fn sync() -> Self { Instruction::Sync } /// Create a new predicated instruction. /// /// This function takes a `Into<Option<Register<'a>>>` so that both /// `instruction.predicated(reg)` and `instruction.predicated(Some(reg))` (where `reg` is a /// register) are valid, as well as `instruction.predicated(None)`. pub fn predicated( self, predicate: impl Into<Option<Register<'a>>>, ) -> PredicatedInstruction<'a> { PredicatedInstruction { predicate: predicate.into(), instruction: self, } } } /// A predicated instruction, wrapping both an instruction and optional predicate. /// /// The predicate must be a register to ensure that it can be efficiently printed in all backends. pub struct PredicatedInstruction<'a> { pub predicate: Option<Register<'a>>, pub instruction: Instruction<'a>, } impl<'a> From<Instruction<'a>> for PredicatedInstruction<'a> { fn from(instruction: Instruction<'a>) -> Self { PredicatedInstruction { predicate: None, instruction, } } } impl fmt::Display for PredicatedInstruction<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!( fmt, "{}{}", self.predicate .into_iter() .format_with("", |predicate, f| f(&format_args!("@{} ", predicate,))), self.instruction, ) } } /// A (named) loop label #[derive(Debug, Copy, Clone)] pub struct Label<'a> { name: &'a str, } impl fmt::Display for Label<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "{}:", self.name) } } impl<'a> Label<'a> { /// Create a new loop label pub fn new(name: &'a str) -> Self { Label { name } } /// The name of the label pub fn name(self) -> &'a str { self.name } } /// Rounding mode for floating-point instructions #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum FpRounding { /// Mantissa LSB rounds to nearest even NearestEven, /// Mantissa LSB rounds towards zero Zero, /// Mantissa LSB rounds towards negative infinity NegativeInfinite, /// Mantissa LSB rounds towards positive infinity PositiveInfinite, } impl fmt::Display for FpRounding { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { FpRounding::NearestEven => "rn", FpRounding::Zero => "rz", FpRounding::NegativeInfinite => "rm", FpRounding::PositiveInfinite => "rp", }) } } impl From<ir::op::Rounding> for FpRounding { fn from(ir: ir::op::Rounding) -> Self { match ir { ir::op::Rounding::Exact | ir::op::Rounding::Nearest => { FpRounding::NearestEven } ir::op::Rounding::Zero => FpRounding::Zero, ir::op::Rounding::Positive => FpRounding::PositiveInfinite, ir::op::Rounding::Negative => FpRounding::NegativeInfinite, } } } /// Integer multiplication width specification #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum MulSpec { /// Keep the low bits of the result Low, /// Keep the high bits of the result High, /// Keep all the bits of the result. Result type is twice as wide as the arguments. Wide, } impl fmt::Display for MulSpec { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { MulSpec::Low => "lo", MulSpec::High => "hi", MulSpec::Wide => "wide", }) } } impl MulSpec { /// Infer the appropriate specification based on the arguments and return types. /// /// # Errors /// /// Fails if the argument types are not identical, are not integer types, or the result type is /// not an integer type twice as wide as the argument types. pub fn from_ir( lhs_t: ir::Type, rhs_t: ir::Type, ret_t: ir::Type, ) -> Result<Self, MulSpecError> { if lhs_t != rhs_t { return Err(MulSpecError { inner: MulSpecErrorInner::IncompatibleArgumentTypes(lhs_t, rhs_t), }); } Ok(match (lhs_t, ret_t) { (ir::Type::I(a), ir::Type::I(b)) if b == 2 * a => MulSpec::Wide, (ir::Type::I(a), ir::Type::I(b)) if a == b => MulSpec::Low, (ir::Type::I(_), _) => { return Err(MulSpecError { inner: MulSpecErrorInner::InvalidReturnType(lhs_t, ret_t), }) } _ => { return Err(MulSpecError { inner: MulSpecErrorInner::ArgumentIsNotInteger(lhs_t), }) } }) } fn ret_t(self, arg_t: ir::Type) -> ir::Type { let bits = match arg_t { ir::Type::I(bits) => bits, _ => panic!("MulSpec: argument type is not integer"), }; ir::Type::I(match self { MulSpec::Low | MulSpec::High => bits, MulSpec::Wide => bits * 2, }) } } /// The error type returned when inference of a multiplication width specification fails. #[derive(Debug, Clone)] pub struct MulSpecError { inner: MulSpecErrorInner, } #[derive(Debug, Clone)] enum MulSpecErrorInner { IncompatibleArgumentTypes(ir::Type, ir::Type), InvalidReturnType(ir::Type, ir::Type), ArgumentIsNotInteger(ir::Type), } impl fmt::Display for MulSpecError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use MulSpecErrorInner::*; match self.inner { IncompatibleArgumentTypes(lhs, rhs) => write!( fmt, "integer multiplication: arguments have different types (`{}` and `{}`)", lhs, rhs ), InvalidReturnType(arg, ret) => write!( fmt, "integer multiplication: invalid return type `{}` for argument type `{}`", ret, arg, ), ArgumentIsNotInteger(t) => write!( fmt, "integer multiplication: argument type `{}` is not an integer type", t ), } } } impl error::Error for MulSpecError {} /// Load instruction specification /// /// This contains information about the type of values loaded, the state space from which the value /// is loaded, the cache behavior to use, and a potential vectorization factor. #[derive(Debug, Copy, Clone)] pub struct LoadSpec { t: ir::Type, vec: NonZeroU32, ss: StateSpace, cop: LoadCacheOperator, } impl fmt::Display for LoadSpec { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "load.{}.{}", self.ss, self.cop)?; if self.vec.get() > 1 { write!(fmt, ".v{}", self.vec)?; } write!(fmt, ".{}", self.t) } } impl LoadSpec { /// The state space from which the load is performed. pub fn state_space(self) -> StateSpace { self.ss } /// The cache behavior to use pub fn cache_operator(self) -> LoadCacheOperator { self.cop } /// The vectorization factor pub fn vector_factor(self) -> NonZeroU32 { self.vec } /// The type of values loaded pub fn t(self) -> ir::Type { self.t } /// Create the appropriate load specification based on the IR information. /// /// # Errors /// /// Fails if an outer vectorization factor is provided (this is currently not supported), and /// if the memory space or instruction flags are invalid or not fully specified. pub fn from_ir( vector_factors: [u32; 2], t: ir::Type, mem_space: MemSpace, inst_flag: InstFlag, ) -> Result<Self, InstructionError> { if vector_factors[0] != 1 { return Err(InstructionError::invalid_vector_factors(vector_factors)); } if let Some(vec) = NonZeroU32::new(vector_factors[1]) { Ok(LoadSpec { t, vec, ss: mem_space.try_into()?, cop: inst_flag.try_into()?, }) } else { Err(InstructionError::invalid_vector_factors(vector_factors)) } } } /// Store instruction specification /// /// This contains information about the type of values to store, the state space to store the value /// into, the cache behavior to use, and a potential vectorization factor. #[derive(Debug, Copy, Clone)] pub struct StoreSpec { t: ir::Type, vec: NonZeroU32, ss: StateSpace, cop: StoreCacheOperator, } impl fmt::Display for StoreSpec { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "store.{}.{}", self.ss, self.cop)?; if self.vec.get() > 1 { write!(fmt, ".v{}", self.vec)?; } write!(fmt, ".{}", self.t) } } impl StoreSpec { /// The type of values stored pub fn t(self) -> ir::Type { self.t } /// The state space into which the store is performed pub fn state_space(self) -> StateSpace { self.ss } /// The cache behavior to use pub fn cache_operator(self) -> StoreCacheOperator { self.cop } /// The vectorization factor pub fn vector_factor(self) -> NonZeroU32 { self.vec } /// Create the appropriate store specification based on the IR information. /// /// # Errors /// /// Fails if an outer vectorization factor is provided (this is currently not supported), and /// if the memory space or instruction flags are invalid or not fully specified. pub fn from_ir( vector_factors: [u32; 2], t: ir::Type, mem_space: MemSpace, inst_flag: InstFlag, ) -> Result<Self, InstructionError> { if vector_factors[0] != 1 { return Err(InstructionError::invalid_vector_factors(vector_factors)); } if let Some(vec) = NonZeroU32::new(vector_factors[1]) { Ok(StoreSpec { t, vec, ss: mem_space.try_into()?, cop: inst_flag.try_into()?, }) } else { Err(InstructionError::invalid_vector_factors(vector_factors)) } } } /// Represent a state space, i.e. a storage area with particular characteristics. /// /// The only guaranteed state space across all architectures is the `Global` space. #[derive(Debug, Copy, Clone)] pub enum StateSpace { /// Global memory, shared by all threads Global, /// Addressable memory shared between threads in the same block Shared, } impl fmt::Display for StateSpace { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { StateSpace::Global => "global", StateSpace::Shared => "shared", }) } } impl TryFrom<MemSpace> for StateSpace { type Error = UnconstrainedCandidateError; fn try_from(mem_space: MemSpace) -> Result<Self, Self::Error> { Ok(match mem_space { MemSpace::GLOBAL => StateSpace::Global, MemSpace::SHARED => StateSpace::Shared, _ => return Err(UnconstrainedCandidateError::new(&"MemSpace", &mem_space)), }) } } /// The error type returned when an unconstrained value is encountered. #[derive(Debug, Clone)] pub struct UnconstrainedCandidateError(String, String); impl UnconstrainedCandidateError { fn new(what: &dyn fmt::Display, values: &dyn fmt::Display) -> Self { UnconstrainedCandidateError(what.to_string(), values.to_string()) } } impl fmt::Display for UnconstrainedCandidateError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!( fmt, "unconstrained value of type {} was encountered: {}", self.0, self.1, ) } } impl error::Error for UnconstrainedCandidateError {} /// Cache operators for memory load instructions #[derive(Debug, Copy, Clone)] pub enum LoadCacheOperator { /// Cache at all levels. CacheAll, /// Cache at the global level CacheGlobal, /// Cache streaming, likely to be accessed once CacheStreaming, /// Cache at all levels, and also at the texture cache level. /// This looks somewhat weird, but it matches the behavior of the `ld.global.nc`.PTX /// instructions we generate. CacheAllAndTexture, } impl Default for LoadCacheOperator { fn default() -> Self { LoadCacheOperator::CacheAll } } impl fmt::Display for LoadCacheOperator { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use LoadCacheOperator::*; fmt.write_str(match self { CacheAll => "ca", CacheGlobal => "cg", CacheStreaming => "cs", CacheAllAndTexture => "nc", }) } } impl TryFrom<InstFlag> for LoadCacheOperator { type Error = UnconstrainedCandidateError; fn try_from(inst_flag: InstFlag) -> Result<Self, Self::Error> { use LoadCacheOperator::*; Ok(match inst_flag { InstFlag::NO_CACHE => CacheStreaming, InstFlag::CACHE_GLOBAL => CacheGlobal, InstFlag::CACHE_SHARED => CacheAll, InstFlag::CACHE_READ_ONLY => CacheAllAndTexture, _ => return Err(UnconstrainedCandidateError::new(&"InstFlag", &inst_flag)), }) } } /// Cache operators for memory store instructions #[derive(Debug, Copy, Clone)] pub enum StoreCacheOperator { /// Cache write-back all coherent levels WriteBack, /// Cache at global level CacheGlobal, /// Cache streaming, likely to be accessed once CacheStreaming, } impl Default for StoreCacheOperator { fn default() -> Self { StoreCacheOperator::WriteBack } } impl fmt::Display for StoreCacheOperator { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use StoreCacheOperator::*; fmt.write_str(match self { WriteBack => "wb", CacheGlobal => "cg", CacheStreaming => "cs", }) } } impl TryFrom<InstFlag> for StoreCacheOperator { type Error = UnconstrainedCandidateError; fn try_from(inst_flag: InstFlag) -> Result<Self, Self::Error> { use StoreCacheOperator::*; Ok(match inst_flag { InstFlag::NO_CACHE => CacheStreaming, InstFlag::CACHE_GLOBAL => CacheGlobal, InstFlag::CACHE_SHARED => WriteBack, // TODO: InstFlag::CACHE_READ_ONLY is not "unconstrained" but invalid still _ => return Err(UnconstrainedCandidateError::new(&"InstFlag", &inst_flag)), }) } } /// The error type returned when type errors are encountered. #[derive(Debug, Clone)] pub struct TypeError { inner: TypeErrorInner, } impl TypeError { fn mismatch(a: ir::Type, b: ir::Type) -> Self { TypeErrorInner::Mismatch(a, b).into() } fn not_integer(t: ir::Type) -> Self { TypeErrorInner::NotInteger(t).into() } fn not_float(t: ir::Type) -> Self { TypeErrorInner::NotFloat(t).into() } } #[derive(Debug, Clone)] enum TypeErrorInner { Mismatch(ir::Type, ir::Type), NotInteger(ir::Type), NotFloat(ir::Type), } impl From<TypeErrorInner> for TypeError { fn from(inner: TypeErrorInner) -> Self { TypeError { inner } } } impl fmt::Display for TypeError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use TypeErrorInner::*; match self.inner { Mismatch(lhs, rhs) => { write!(fmt, "got incompatible types: `{}` and `{}`", lhs, rhs) } NotInteger(t) => write!(fmt, "expected an integer type; got `{}`", t), NotFloat(t) => write!(fmt, "expected a float type; got `{}`", t), } } } impl error::Error for TypeError {} #[derive(Debug, Clone)] pub struct InstructionError { inner: InstructionErrorInner, } impl fmt::Display for InstructionError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use InstructionErrorInner::*; match &self.inner { InvalidRoundingForType(rounding, t) => { write!(fmt, "got unexpected rounding {} for type {}", rounding, t) } InvalidBinopForType(op, t) => write!( fmt, "got unexpected operator {} with argument type {}", op, t ), InvalidRoundingForOp(op, rounding) => { write!(fmt, "got unexpected rounding {} for op {}", rounding, op) } InvalidType(t) => write!(fmt, "got unexpected type {}", t), IncompatibleTypes => write!(fmt, "got incompatible types"), InvalidVectorFactors(factors) => write!( fmt, "got unexpected vectorization factors: {}x{}", factors[0], factors[1] ), TypeError(err) => fmt::Display::fmt(err, fmt), MulSpecError(err) => fmt::Display::fmt(err, fmt), UnconstrainedCandidateError(err) => fmt::Display::fmt(err, fmt), } } } impl error::Error for InstructionError {} #[derive(Debug, Clone)] enum InstructionErrorInner { InvalidRoundingForType(ir::op::Rounding, ir::Type), InvalidBinopForType(ir::BinOp, ir::Type), InvalidRoundingForOp(ir::BinOp, ir::op::Rounding), InvalidType(ir::Type), IncompatibleTypes, InvalidVectorFactors([u32; 2]), TypeError(TypeError), MulSpecError(MulSpecError), UnconstrainedCandidateError(UnconstrainedCandidateError), } impl From<InstructionErrorInner> for InstructionError { fn from(inner: InstructionErrorInner) -> Self { InstructionError { inner } } } impl InstructionError { fn invalid_rounding_for_type(rounding: ir::op::Rounding, t: ir::Type) -> Self { InstructionErrorInner::InvalidRoundingForType(rounding, t).into() } fn invalid_rounding_for_op(op: ir::BinOp, rounding: ir::op::Rounding) -> Self { InstructionErrorInner::InvalidRoundingForOp(op, rounding).into() } fn invalid_binop_for_type(op: ir::BinOp, t: ir::Type) -> Self { InstructionErrorInner::InvalidBinopForType(op, t).into() } fn invalid_type(t: ir::Type) -> Self { InstructionErrorInner::InvalidType(t).into() } fn incompatible_types() -> Self { InstructionErrorInner::IncompatibleTypes.into() } fn invalid_vector_factors(vector_factors: [u32; 2]) -> Self { InstructionErrorInner::InvalidVectorFactors(vector_factors).into() } } impl From<TypeError> for InstructionError { fn from(error: TypeError) -> Self { InstructionErrorInner::TypeError(error).into() } } impl From<MulSpecError> for InstructionError { fn from(error: MulSpecError) -> Self { InstructionErrorInner::MulSpecError(error).into() } } impl From<UnconstrainedCandidateError> for InstructionError { fn from(error: UnconstrainedCandidateError) -> Self { InstructionErrorInner::UnconstrainedCandidateError(error).into() } }
mod shape; pub use shape::*; mod bound; pub use bound::*; mod target; pub use target::*; mod mapper; pub use mapper::*; mod select; #[cfg(test)] pub mod test;
use syn; use quote::quote; use std::io::Read; use std::fs::File; fn main() { let filename = "src/test_file.rs"; let mut file = File::open(&filename).expect("Unable to open file"); let mut src = String::new(); file.read_to_string(&mut src).expect("Unable to read file"); let syntax = syn::parse_file(&src).expect("Unable to parse file"); println!("{:#?}\n", syntax); println!("{:#?}", quote!(#syntax)); println!("{}", quote!(#syntax)); }
#[doc = "Reader of register DSI_VNPCCR"] pub type R = crate::R<u32, super::DSI_VNPCCR>; #[doc = "Reader of field `NPSIZE`"] pub type NPSIZE_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:12 - Null Packet Size"] #[inline(always)] pub fn npsize(&self) -> NPSIZE_R { NPSIZE_R::new((self.bits & 0x1fff) as u16) } }
extern crate dependencies; // extern crate rustc_serialize; #[macro_use] extern crate log; pub use self::dependencies::rustc_serialize; pub mod evolution; pub mod network;
//! Serde (de)serialization of worlds. //! //! As component types are not known at compile time, the world must be provided with the //! means to serialize each component. This is provided by the [`WorldSerializer`] implementation. //! This implementation also describes how [`ComponentTypeId`](super::storage::ComponentTypeId)s //! (which are not stable between compiles) are mapped to stable type identifiers. Components //! that are not known to the serializer will be omitted from the serialized output. //! //! The [`Registry`] provides a [`WorldSerializer`] implementation suitable for most situations. //! //! Serializing all entities with a `Position` component to JSON. //! ``` //! # use legion::*; //! # use legion::serialize::Canon; //! # let world = World::default(); //! # #[derive(serde::Serialize, serde::Deserialize)] //! # struct Position; //! // create a registry which uses strings as the external type ID //! let mut registry = Registry::<String>::default(); //! registry.register::<Position>("position".to_string()); //! registry.register::<f32>("f32".to_string()); //! registry.register::<bool>("bool".to_string()); //! //! // serialize entities with the `Position` component //! let entity_serializer = Canon::default(); //! let json = serde_json::to_value(&world.as_serializable( //! component::<Position>(), //! &registry, //! &entity_serializer, //! )) //! .unwrap(); //! println!("{:#}", json); //! //! // registries are also serde deserializers //! use serde::de::DeserializeSeed; //! let world: World = registry //! .as_deserialize(&entity_serializer) //! .deserialize(json) //! .unwrap(); //! ``` #[cfg(feature = "type-uuid")] pub use crate::internals::serialize::SerializableTypeUuid; pub use crate::internals::serialize::{ de::WorldDeserializer, id::{set_entity_serializer, Canon, CustomEntitySerializer, EntityName, EntitySerializer}, ser::{SerializableWorld, WorldSerializer}, AutoTypeKey, DeserializeIntoWorld, DeserializeNewWorld, Registry, TypeKey, UnknownType, };
use log::*; use crate::{ sync::{atomics::AtomicBox, treiber::TreiberStack}, table::prelude::*, }; use std::{ sync::atomic::{AtomicU64, Ordering}, thread, }; use thread::ThreadId; use super::errors::*; use super::readset::ReadSet; use super::utils; use crate::sync::ttas::TTas; use std::cell::RefCell; use std::{ borrow::{Borrow, BorrowMut}, time::Duration, }; use std::{ collections::BTreeMap, sync::{ atomic::{AtomicBool, AtomicPtr}, Arc, }, }; use crate::txn::conflicts::ConflictManager; use crate::txn::vars::TVar; use crate::txn::version::Version; use crate::txn::writeset::WriteSet; use lazy_static::*; use std::any::Any; #[derive(Clone)] /// /// Concurrency control for transaction system pub enum TransactionConcurrency { /// /// Optimistic Concurrency Control Optimistic, /// /// Pessimistic Concurrency Control Pessimistic, } #[derive(Clone)] /// /// Transaction Isolation levels for transaction system pub enum TransactionIsolation { /// /// [TransactionIsolation::ReadCommitted] isolation level means that always a committed value will be /// provided for read operations. Values are always read from in-memory cache every time a /// value is accessed. In other words, if the same key is accessed more than once within the /// same transaction, it may have different value every time since global cache memory /// may be updated concurrently by other threads. ReadCommitted, /// /// [TransactionIsolation::RepeatableRead] isolation level means that if a value was read once within transaction, /// then all consecutive reads will provide the same in-transaction value. With this isolation /// level accessed values are stored within in-transaction memory, so consecutive access to /// the same key within the same transaction will always return the value that was previously /// read or updated within this transaction. If concurrency is /// [TransactionConcurrency::Pessimistic], then a lock on the key will be acquired /// prior to accessing the value. RepeatableRead, /// /// [TransactionIsolation::Serializable] isolation level means that all transactions occur in a completely isolated fashion, /// as if all transactions in the system had executed serially, one after the other. Read access /// with this level happens the same way as with [TransactionIsolation::RepeatableRead] level. /// However, in [TransactionConcurrency::Optimistic] mode, if some transactions cannot be /// serially isolated from each other, then one winner will be picked and the other /// transactions in conflict will result with abort. Serializable, } #[derive(Debug, Clone)] /// /// State of the transaction which can be at any given time pub enum TransactionState { Active, Preparing, Prepared, MarkedRollback, Committing, Committed, RollingBack, RolledBack, Unknown, Suspended, } impl Default for TransactionState { fn default() -> Self { TransactionState::Unknown } } /// /// Management struct for single transaction /// /// This struct exposes various methods for controlling the transaction state throughout it's lifetime. #[derive(Clone)] pub struct Txn { /// Id of the transaction config tx_config_id: u64, // NOTE: NonZeroU64 is std lib thread id interpret. Wait for the feature flag removal. /// Id of the thread in which this transaction started. tid: ThreadId, /// Txn isolation level pub(crate) iso: TransactionIsolation, /// Txn concurrency level pub(crate) cc: TransactionConcurrency, /// Txn state pub(crate) state: Arc<AtomicBox<TransactionState>>, /// Txn timeout /// /// * Gets timeout value in milliseconds for this transaction. timeout: usize, /// If transaction was marked as rollback-only. rollback_only: Arc<AtomicBool>, /// Label of the transaction label: String, } impl Txn { /// /// Initiate transaction with given closure. pub fn begin<F, R>(&self, mut f: F) -> TxnResult<R> where F: FnMut(&mut Txn) -> R, R: 'static + Any + Clone + Send + Sync, { let r = loop { debug!("tx_begin_read::txid::{}", TxnManager::rts()); let me = self.clone(); Self::set_local(me); // Refurbish let mut me = Self::get_local(); me.on_start(); ///////////////////////// let res = f(&mut me); if me.on_validate::<R>() && me.commit() { me.on_commit::<R>(); break res; } ///////////////////////// me.on_abort::<R>(); }; Ok(r) } /// /// Read initiator to the scratchpad from transactional variables. pub fn read<T: Send + Sync + Any + Clone>(&self, var: &TVar<T>) -> T { var.open_read() } /// /// Write back initiator for given transactional variables. pub fn write<T: Send + Sync + Any + Clone>(&mut self, var: &mut TVar<T>, value: T) -> T { var.open_write(value) } /// Modify the transaction associated with the current thread such that the /// only possible outcome of the transaction is to roll back the /// transaction. pub fn set_rollback_only(&mut self, flag: bool) { self.rollback_only.swap(flag, Ordering::SeqCst); } /// Commits this transaction by initiating two-phase-commit process. pub fn commit(&self) -> bool { self.state.replace_with(|_| TransactionState::Committed); true } /// Ends the transaction. Transaction will be rolled back if it has not been committed. pub fn close(&self) { todo!() } /// Rolls back this transaction. /// It's allowed to roll back transaction from any thread at any time. pub fn rollback(&self) { self.state .replace_with(|_| TransactionState::MarkedRollback); } /// Resume a transaction if it was previously suspended. /// Supported only for optimistic transactions. pub fn resume(&self) { match self.cc { TransactionConcurrency::Optimistic => { self.state.replace_with(|_| TransactionState::Active); } _ => {} } } /// Suspends a transaction. It could be resumed later. /// Supported only for optimistic transactions. pub fn suspend(&self) { match self.cc { TransactionConcurrency::Optimistic => { self.state.replace_with(|_| TransactionState::Suspended); } _ => {} } } /// /// Internal stage to update in-flight rollback pub(crate) fn rolling_back(&self) { self.state.replace_with(|_| TransactionState::RollingBack); } /// /// Internal stage to finalize rollback pub(crate) fn rolled_back(&self) { self.state.replace_with(|_| TransactionState::RolledBack); } /// /// Set the transaction going. /// Callback that will run before everything starts fn on_start(&self) { TxnManager::set_rts(); self.state.replace_with(|_| TransactionState::Active); } /// /// Validates a transaction. /// Call this code when a transaction must decide whether it can commit. fn on_validate<T: 'static + Any + Clone + Send + Sync>(&self) -> bool { let mut ws = WriteSet::local(); let rs = ReadSet::local(); // TODO: Nanos or millis? Millis was the intention. if !ws.try_lock::<T>(Duration::from_millis(self.timeout as u64)) { // TODO: Can't acquire lock, write some good message here. // dbg!("Can't acquire lock"); return false; } for x in rs.get_all_versions().iter().cloned() { let v: TVar<T> = utils::version_to_dest(x); if v.is_locked() && !v.is_writer_held_by_current_thread() { // TODO: MSG: Currently locked // dbg!("Currently locked"); return false; } if !v.validate() { // TODO: MSG: Can't validate // dbg!("Can't validate"); return false; } } true } /// /// Finalizing the commit and flush the write-backs to the main memory fn on_commit<T: Any + Clone + Send + Sync>(&mut self) { if !ConflictManager::check::<T>(&self.iso) { self.on_abort::<T>(); } let mut ws = WriteSet::local(); let mut rs = ReadSet::local(); // TODO: MSG: // dbg!("Updating ws"); TxnManager::set_wts(); // TODO: MSG: // dbg!("Updated ws"); let w_ts = TxnManager::rts(); // TODO: MSG: // dbg!("Get write TS"); for (k, source) in ws.get_all::<T>().iter_mut() { // let mut dest: T = k.open_read(); k.data = Arc::new(source.clone()); k.set_stamp(w_ts); debug!("Enqueued writes are written"); } ws.unlock::<T>(); ws.clear::<T>(); rs.clear(); } #[cold] pub(crate) fn on_abort<T: Clone + Send + Sync>(&self) { let mut ws = WriteSet::local(); let mut rs = ReadSet::local(); // TODO: MSG // dbg!("ON ABORT"); TxnManager::set_rts(); ws.clear::<T>(); rs.clear(); } /// Sets tlocal txn. pub(crate) fn set_local(ntxn: Txn) { TXN.with(|txn| { let mut txn = txn.borrow_mut(); *txn = ntxn; }) } /// Gets tlocal txn. pub fn get_local() -> Txn { // TODO: not sure TXN.with(|tx| tx.borrow().clone()) } pub(crate) fn get_txn_config_id(&self) -> u64 { self.tx_config_id } } impl Default for Txn { #[cfg_attr(miri, ignore)] fn default() -> Self { Self { tx_config_id: 0, tid: thread::current().id(), iso: TransactionIsolation::ReadCommitted, cc: TransactionConcurrency::Optimistic, state: Arc::new(AtomicBox::new(TransactionState::default())), timeout: 0, rollback_only: Arc::new(AtomicBool::default()), label: "default".into(), } } } thread_local! { static LOCAL_VC: RefCell<u64> = RefCell::new(0_u64); static TXN: RefCell<Txn> = RefCell::new(Txn::default()); } lazy_static! { /// Global queues of transaction deltas. pub(crate) static ref GLOBAL_DELTAS: Arc<TTas<Vec<Version>>> = Arc::new(TTas::new(Vec::new())); /// TVar ids across all txns in the tx manager pub(crate) static ref GLOBAL_TVAR: Arc<AtomicU64> = Arc::new(AtomicU64::default()); /// Version clock across all transactions pub(crate) static ref GLOBAL_VCLOCK: Arc<AtomicU64> = Arc::new(AtomicU64::default()); } // Management layer /// /// Global level transaction management structure. /// /// This struct manages transactions across the whole program. /// Manager's clock is always forward moving. pub struct TxnManager { pub(crate) txid: Arc<AtomicU64>, } impl TxnManager { /// /// Instantiate transaction manager pub fn manager() -> Arc<TxnManager> { Arc::new(TxnManager { txid: Arc::new(AtomicU64::new(GLOBAL_VCLOCK.load(Ordering::SeqCst))), }) } /// /// VC management: Sets read timestamp for the ongoing txn pub(crate) fn set_rts() { LOCAL_VC.with(|lvc| { let mut lvc = lvc.borrow_mut(); *lvc = GLOBAL_VCLOCK.load(Ordering::SeqCst); }); } /// /// VC management: Reads read timestamp for the ongoing txn pub(crate) fn rts() -> u64 { LOCAL_VC.with(|lvc| *lvc.borrow()) } /// /// VC management: Sets write timestamp for the ongoing txn pub(crate) fn set_wts() { LOCAL_VC.with(|lvc| { let mut lvc = lvc.borrow_mut(); *lvc = GLOBAL_VCLOCK .fetch_add(1, Ordering::SeqCst) .saturating_add(1); }) } /// /// Dispense a new TVar ID pub(crate) fn dispense_tvar_id() -> u64 { GLOBAL_TVAR.fetch_add(1, Ordering::SeqCst).saturating_add(1) } /// /// Get latest dispensed TVar ID pub(crate) fn latest_tvar_id() -> u64 { GLOBAL_TVAR.fetch_add(1, Ordering::SeqCst) } /// /// Starts transaction with specified isolation, concurrency, timeout, invalidation flag, /// and number of participating entries. /// /// # Arguments /// * `cc`: [Concurrency Control](TransactionConcurrency) setting /// * `iso`: [Transaction Isolation](TransactionIsolation) setting /// * `timeout`: Timeout /// * `tx_size`: Number of entries participating in transaction (may be approximate). pub fn txn_build( &self, cc: TransactionConcurrency, iso: TransactionIsolation, timeout: usize, _tx_size: usize, label: String, ) -> Txn { match (&iso, &cc) { (TransactionIsolation::ReadCommitted, TransactionConcurrency::Optimistic) => { todo!("OCC, with Read Committed, hasn't been implemented."); } (_, TransactionConcurrency::Pessimistic) => { todo!("PCC, with all isolation levels, hasn't been implemented."); } _ => {} } Txn { tx_config_id: self.txid.load(Ordering::SeqCst), // tid: thread::current().id(), // Reset to thread id afterwards. iso, cc, state: Arc::new(AtomicBox::new(TransactionState::default())), timeout, rollback_only: Arc::new(AtomicBool::default()), label, } } } #[cfg(test)] mod txn_tests { use super::*; #[test] #[ignore] fn txn_optimistic_read_committed() { let data = 100_usize; let txn = TxnManager::manager().txn_build( TransactionConcurrency::Optimistic, TransactionIsolation::ReadCommitted, 100_usize, 1_usize, "txn_optimistic_read_committed".into(), ); let mut threads = vec![]; let tvar = TVar::new(data); for thread_no in 0..2 { let txn = txn.clone(); let mut tvar = tvar.clone(); let t = std::thread::Builder::new() .name(format!("t_{}", thread_no)) .spawn(move || { if thread_no == 0 { // Streamliner thread *tvar = txn .begin(|t| { let x = t.read(&tvar); assert_eq!(x, 100); thread::sleep(Duration::from_millis(300)); let x = t.read(&tvar); assert_eq!(x, 123_000); x }) .unwrap(); } else { // Interceptor thread *tvar = txn .begin(|t| { thread::sleep(Duration::from_millis(100)); let mut x = t.read(&tvar); assert_eq!(x, 100); x = 123_000; t.write(&mut tvar, x); thread::sleep(Duration::from_millis(100)); x }) .unwrap(); } }) .unwrap(); threads.push(t); } for t in threads.into_iter() { t.join().unwrap(); } } #[test] fn txn_optimistic_repeatable_read() { let data = 100_usize; let txn = TxnManager::manager().txn_build( TransactionConcurrency::Optimistic, TransactionIsolation::RepeatableRead, 100_usize, 1_usize, "txn_optimistic_repetable_read".into(), ); let mut threads = vec![]; let tvar = TVar::new(data); for thread_no in 0..2 { let txn = txn.clone(); let mut tvar = tvar.clone(); let t = std::thread::Builder::new() .name(format!("t_{}", thread_no)) .spawn(move || { if thread_no == 0 { // Streamliner thread txn.begin(|t| { let x = t.read(&tvar); assert_eq!(x, 100); thread::sleep(Duration::from_millis(300)); let x = t.read(&tvar); assert_eq!(x, 100); }) } else { // Interceptor thread txn.begin(|t| { thread::sleep(Duration::from_millis(100)); let mut x = t.read(&tvar); assert_eq!(x, 100); x = 123_000; t.write(&mut tvar, x); thread::sleep(Duration::from_millis(100)); }) } }) .unwrap(); threads.push(t); } for t in threads.into_iter() { t.join().unwrap(); } } #[test] fn txn_optimistic_serializable() { let data = 100_usize; let txn = TxnManager::manager().txn_build( TransactionConcurrency::Optimistic, TransactionIsolation::RepeatableRead, 100_usize, 1_usize, "txn_optimistic_serializable".into(), ); let mut threads = vec![]; let tvar = TVar::new(data); for thread_no in 0..100 { let txn = txn.clone(); let mut tvar = tvar.clone(); let t = std::thread::Builder::new() .name(format!("t_{}", thread_no)) .spawn(move || { if thread_no % 2 == 0 { // Streamliner thread *tvar = txn .begin(|t| { let x = t.read(&tvar); assert_eq!(x, 100); thread::sleep(Duration::from_millis(300)); let mut x = t.read(&tvar); assert_eq!(x, 100); x = 1453; t.write(&mut tvar, x); t.read(&tvar) }) .unwrap(); } else { // Interceptor thread *tvar = txn .begin(|t| { thread::sleep(Duration::from_millis(100)); let mut x = t.read(&tvar); assert_eq!(x, 100); x = 123_000; t.write(&mut tvar, x); thread::sleep(Duration::from_millis(100)); x }) .unwrap(); } }) .unwrap(); threads.push(t); } for t in threads.into_iter() { // TODO: Write skews can make this fail. In snapshot mode. let _ = t.join(); } } }
use crate::math::Vec3; pub struct Ray { pub origin: Vec3, pub direction: Vec3, } impl Ray { pub fn point_at(&self, distance: &f64) -> Vec3 { &self.origin + &(&self.direction * distance) } } #[cfg(test)] mod tests { use super::Ray; use crate::math::Vec3; #[test] fn point_at() { let ray = Ray { origin: Vec3 { x: 0.0, y: 0.0, z: 0.0, }, direction: Vec3 { x: 1.0, y: 3.0, z: 2.0, }, }; assert_eq!( Vec3 { x: 1.0, y: 3.0, z: 2.0 }, ray.point_at(&1.0) ); assert_eq!( Vec3 { x: 1.5, y: 4.5, z: 3.0 }, ray.point_at(&1.5) ); } }
use crate::backend::c; use linux_raw_sys::general::membarrier_cmd; /// A command for use with [`membarrier`] and [`membarrier_cpu`]. /// /// For `MEMBARRIER_CMD_QUERY`, see [`membarrier_query`]. /// /// [`membarrier`]: crate::process::membarrier /// [`membarrier_cpu`]: crate::process::membarrier_cpu /// [`membarrier_query`]: crate::process::membarrier_query #[derive(Copy, Clone, Eq, PartialEq, Debug)] #[repr(u32)] pub enum MembarrierCommand { /// `MEMBARRIER_CMD_GLOBAL` #[doc(alias = "Shared")] #[doc(alias = "MEMBARRIER_CMD_SHARED")] Global = membarrier_cmd::MEMBARRIER_CMD_GLOBAL as _, /// `MEMBARRIER_CMD_GLOBAL_EXPEDITED` GlobalExpedited = membarrier_cmd::MEMBARRIER_CMD_GLOBAL_EXPEDITED as _, /// `MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED` RegisterGlobalExpedited = membarrier_cmd::MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED as _, /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED` PrivateExpedited = membarrier_cmd::MEMBARRIER_CMD_PRIVATE_EXPEDITED as _, /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED` RegisterPrivateExpedited = membarrier_cmd::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED as _, /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE` PrivateExpeditedSyncCore = membarrier_cmd::MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE as _, /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE` RegisterPrivateExpeditedSyncCore = membarrier_cmd::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE as _, /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10) PrivateExpeditedRseq = membarrier_cmd::MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ as _, /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10) RegisterPrivateExpeditedRseq = membarrier_cmd::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ as _, } /// A resource value for use with [`getrlimit`], [`setrlimit`], and /// [`prlimit`]. /// /// [`getrlimit`]: crate::process::getrlimit /// [`setrlimit`]: crate::process::setrlimit /// [`prlimit`]: crate::process::prlimit #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(u32)] pub enum Resource { /// `RLIMIT_CPU` Cpu = linux_raw_sys::general::RLIMIT_CPU, /// `RLIMIT_FSIZE` Fsize = linux_raw_sys::general::RLIMIT_FSIZE, /// `RLIMIT_DATA` Data = linux_raw_sys::general::RLIMIT_DATA, /// `RLIMIT_STACK` Stack = linux_raw_sys::general::RLIMIT_STACK, /// `RLIMIT_CORE` Core = linux_raw_sys::general::RLIMIT_CORE, /// `RLIMIT_RSS` Rss = linux_raw_sys::general::RLIMIT_RSS, /// `RLIMIT_NPROC` Nproc = linux_raw_sys::general::RLIMIT_NPROC, /// `RLIMIT_NOFILE` Nofile = linux_raw_sys::general::RLIMIT_NOFILE, /// `RLIMIT_MEMLOCK` Memlock = linux_raw_sys::general::RLIMIT_MEMLOCK, /// `RLIMIT_AS` As = linux_raw_sys::general::RLIMIT_AS, /// `RLIMIT_LOCKS` Locks = linux_raw_sys::general::RLIMIT_LOCKS, /// `RLIMIT_SIGPENDING` Sigpending = linux_raw_sys::general::RLIMIT_SIGPENDING, /// `RLIMIT_MSGQUEUE` Msgqueue = linux_raw_sys::general::RLIMIT_MSGQUEUE, /// `RLIMIT_NICE` Nice = linux_raw_sys::general::RLIMIT_NICE, /// `RLIMIT_RTPRIO` Rtprio = linux_raw_sys::general::RLIMIT_RTPRIO, /// `RLIMIT_RTTIME` Rttime = linux_raw_sys::general::RLIMIT_RTTIME, } /// `EXIT_SUCCESS` pub const EXIT_SUCCESS: c::c_int = 0; /// `EXIT_FAILURE` pub const EXIT_FAILURE: c::c_int = 1; /// The status value of a child terminated with a [`Signal::Abort`] signal. /// /// [`Signal::Abort`]: crate::process::Signal::Abort pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + linux_raw_sys::general::SIGABRT as i32; /// A CPU identifier as a raw integer. pub type RawCpuid = u32; #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub(crate) struct RawCpuSet { #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] pub(crate) bits: [u32; 32], #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))] pub(crate) bits: [u64; 16], } #[inline] pub(crate) fn raw_cpu_set_new() -> RawCpuSet { #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] { RawCpuSet { bits: [0; 32] } } #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))] { RawCpuSet { bits: [0; 16] } } } pub(crate) const CPU_SETSIZE: usize = 8 * core::mem::size_of::<RawCpuSet>();
use crate::prelude::*; use super::super::raw_to_slice; use std::os::raw::c_void; use std::ptr; pub struct VkPhysicalDeviceMemoryBudgetPropertiesEXT { pub sType: VkStructureType, pub pNext: *const c_void, pub heapBudget: [VkDeviceSize; VK_MAX_MEMORY_HEAPS as usize], pub heapUsage: [VkDeviceSize; VK_MAX_MEMORY_HEAPS as usize], } impl VkPhysicalDeviceMemoryBudgetPropertiesEXT { pub fn new( heap_budget: [VkDeviceSize; VK_MAX_MEMORY_HEAPS as usize], heap_usage: [VkDeviceSize; VK_MAX_MEMORY_HEAPS as usize], ) -> Self { VkPhysicalDeviceMemoryBudgetPropertiesEXT { sType: VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT, pNext: ptr::null(), heapBudget: heap_budget, heapUsage: heap_usage, } } pub fn heap_budgets(&self, count: u32) -> &[VkDeviceSize] { raw_to_slice(self.heapBudget.as_ptr(), count) } pub fn heap_usages(&self, count: u32) -> &[VkDeviceSize] { raw_to_slice(self.heapUsage.as_ptr(), count) } } impl Default for VkPhysicalDeviceMemoryBudgetPropertiesEXT { fn default() -> Self { Self::new( [0; VK_MAX_MEMORY_HEAPS as usize], [0; VK_MAX_MEMORY_HEAPS as usize], ) } }
pub struct Solution; impl Solution { pub fn remove_duplicate_letters(s: String) -> String { let v = s .bytes() .map(|b| (b - b'a') as usize) .collect::<Vec<usize>>(); let mut last = vec![false; v.len()]; let mut exists = vec![false; 26]; for i in (0..v.len()).rev() { if !exists[v[i]] { last[i] = true; exists[v[i]] = true; } } let mut res = Vec::new(); let mut i = 0; while i < v.len() { let mut j = i + 1; while j < v.len() && !(exists[v[j - 1]] && last[j - 1]) { j += 1; } if let Some(k) = (i..j).filter(|&k| exists[v[k]]).min_by_key(|&k| v[k]) { exists[v[k]] = false; res.push(v[k]); i = k + 1; } else { break; } } String::from_utf8(res.into_iter().map(|b| b'a' + b as u8).collect()).unwrap() } } #[test] fn test0316() { fn case(s: &str, want: &str) { let got = Solution::remove_duplicate_letters(s.to_string()); assert_eq!(got, want); } case("bcabc", "abc"); case("cbacdcbc", "acdb"); }
use P37::totient; pub fn main() { println!("{}", totient(10)); }
use ::{TypeVariant, TypeData, WeakTypeContainer, Result}; use ::ir::TargetType; use super::VariantType; #[derive(Debug)] pub struct TerminatedBufferVariant { } impl TypeVariant for TerminatedBufferVariant { fn get_type(&self, _data: &TypeData) -> VariantType { VariantType::TerminatedBuffer } default_resolve_child_name_impl!(); default_has_property_impl!(); default_resolve_references!(); default_get_result_type_impl!(); }
type Choice = bool; pub struct Player { pub strat: Box<Strategy> } impl Player { fn new<T: Strategy>(s: T) -> Self { Player { strat: Box::new(s) } } } pub trait Strategy { // Static method signature; `Self` refers to the implementor type. fn new() -> Self; /// return the strategy's next choices fn choice(&mut self) -> Choice; /// let the strategy know the opponents last choice /// default impl does nothing. fn set_oppo_choice(&mut self, _oppo: Choice) { } /// reset the strategy before a new game /// default impl does nothing. fn reset(&mut self) { } /// self identify the type. fn name(&self) -> &'static str ; } pub struct Never { } impl Strategy for Never { fn name(&self) -> &'static str { "Never" } fn new() -> Never { Never {} } fn choice(&mut self) -> Choice { false } } pub struct Always {} impl Strategy for Always { fn name(&self) -> &'static str { "Always" } fn new() -> Always { Always {} } fn choice(&mut self) -> Choice { true } } pub struct AlternateTrueFalse { prev: Choice } impl Strategy for AlternateTrueFalse { fn name(&self) -> &'static str { "AlternateTrueFalse" } fn new() -> AlternateTrueFalse { AlternateTrueFalse { prev: false } } fn choice(&mut self) -> Choice { self.prev = !self.prev; self.prev } fn reset(&mut self) { self.prev = false; } } pub struct AlternateFalseTrue { prev: Choice } impl Strategy for AlternateFalseTrue { fn name(&self) -> &'static str { "AlternateFalseTrue" } fn new() -> AlternateFalseTrue { AlternateFalseTrue { prev: true } } fn choice(&mut self) -> Choice { self.prev = !self.prev; self.prev } fn reset(&mut self) { self.prev = true; } } // TitForTat start with true, all future choices are the same as the opponents last choice. pub struct TitForTat { prev: Choice } impl Strategy for TitForTat { fn name(&self) -> &'static str { "TitForTat" } fn choice(&mut self) -> Choice { self.prev } fn new() -> TitForTat { TitForTat { prev: true } } fn reset(&mut self) { self.prev = true; } fn set_oppo_choice(&mut self, oppo: Choice) { self.prev = oppo; } } #[cfg(test)] mod tests { use super::*; #[test] fn test_never() { let mut p1 = Never::new(); assert!(!p1.choice()); } #[test] fn test_always() { let mut p1 = Always::new(); assert!(p1.choice()); } #[test] fn test_alternate1() { let mut p1 = AlternateTrueFalse::new(); assert!(p1.choice()); assert!(!p1.choice()); assert!(p1.choice()); } #[test] fn test_alternate2() { let mut p1 = AlternateFalseTrue::new(); assert!(!p1.choice()); assert!(p1.choice()); assert!(!p1.choice()); } #[test] fn test_titfortat() { let mut p1 = TitForTat::new(); assert!(p1.choice()); assert!(p1.choice()); p1.set_oppo_choice(false); assert!(!p1.choice()); assert!(!p1.choice()); p1.set_oppo_choice(true); assert!(p1.choice()); assert!(p1.choice()); } #[test] fn test_player() { let mut strat = TitForTat::new(); let mut p1 = Player::new(strat); assert!(!p1.choice()); } }
use serde::{Deserialize, Serialize}; use crate::hook::Hook; use crate::stream_square_hook::StreamSquareHook; #[derive(Debug, Serialize, Deserialize)] pub struct StreamSquareHookField { pub (crate) hook: StreamSquareHook } impl StreamSquareHookField { pub fn new(hook_ask_stream_start_method:String, hook_ask_stream_start_url:String, hook_tell_stream_started_method:String, hook_tell_stream_started_url:String) -> StreamSquareHookField { StreamSquareHookField { hook : StreamSquareHook { ask_stream_start : Hook { _type : String::from("HttpCall"), method : hook_ask_stream_start_method, url : hook_ask_stream_start_url, }, tell_stream_started : Hook { _type : String::from("HttpCall"), method : hook_tell_stream_started_method, url : hook_tell_stream_started_url, }, } } } }
struct Element<K: PartialOrd, V> { pub key: K, pub value: V, } pub struct Heap<K: PartialOrd, V> { elements: Vec<Element<K,V>>, } fn father_index(element_index: usize) -> usize { return (element_index + 1) / 2 - 1; } fn child_index_l(element_index: usize) -> usize { return (element_index + 1) * 2 - 1; } fn child_index_r(element_index: usize) -> usize { return (element_index + 1) * 2; } impl<K: PartialOrd, V> Heap<K, V> { pub fn new() -> Heap<K, V> { let elements = vec![]; Heap { elements } } fn validate(&self) { for (index, elem) in self.elements.iter().enumerate() { let left_son = self.elements.get(child_index_l(index)); if let Some(left_son) = left_son { assert!(left_son.key >= elem.key); } let right_son = self.elements.get(child_index_r(index)); if let Some(right_son) = right_son { assert!(right_son.key >= elem.key); } } } pub fn push(&mut self, key: K, value: V) { self.elements.push(Element { key, value }); let mut index = self.elements.len() - 1; while index != 0 { let cur = &self.elements[index]; let index_of_father = father_index(index); let father = &self.elements[index_of_father]; if father.key > cur.key { self.elements.swap(index, index_of_father); index = index_of_father; } else { break; } } self.validate(); } pub fn pop(&mut self) -> Option<(K, V)> { if self.elements.len() == 0 { return None } if self.elements.len() == 1 { let Element{key, value} = self.elements.pop()?; return Some((key, value)) } let len = self.elements.len(); self.elements.swap(0, len - 1); let result = self.elements.remove(self.elements.len() - 1); let mut index = 0; let mut new_index = index; while child_index_l(index) < self.elements.len() { let cur = self.elements.get(index).unwrap(); let left_child_index = child_index_l(index); let right_child_index = child_index_r(index); let mut min = &cur.key; if let Some(right_child) = self.elements.get(right_child_index) { let left_child = self.elements.get(left_child_index).unwrap(); if left_child.key < right_child.key { new_index = left_child_index; min = &left_child.key; } else { new_index = right_child_index; min = &right_child.key; }; } else if let Some(left_child) = self.elements.get(left_child_index) { new_index = left_child_index; min = &left_child.key; } if min < &cur.key { self.elements.swap(index, new_index); index = new_index; } else { break; } } self.validate(); Some((result.key, result.value)) } } #[cfg(test)] mod tests { use super::*; use rand::random; #[test] fn heap_push() { let mut heap: Heap<i32, i32> = Heap::new(); heap.push(2, 1); heap.push(1, 1); heap.push(3, 1); heap.push(4, 1); heap.push(-1, 1); heap.push(9, 1); } #[test] fn heap_push_harder() { let mut heap: Heap<i32, i32> = Heap::new(); for _ in 0..1000 { heap.push(random(), 1); } } #[test] fn pop_empty() { let mut heap: Heap<i32, i32> = Heap::new(); assert_eq!(None, heap.pop()); } #[test] fn pop_full() { let mut heap: Heap<i32, i32> = Heap::new(); heap.push(2, 1); heap.push(1, 1); heap.push(3, 1); heap.push(4, 1); heap.push(-1, 1); heap.push(9, 1); assert_eq!(-1, heap.pop().unwrap().0); assert_eq!(1, heap.pop().unwrap().0); assert_eq!(2, heap.pop().unwrap().0); assert_eq!(3, heap.pop().unwrap().0); assert_eq!(4, heap.pop().unwrap().0); assert_eq!(9, heap.pop().unwrap().0); assert_eq!(None, heap.pop()); } #[test] fn pop_full_2() { let mut heap: Heap<f32, (i32, i32)> = Heap::new(); heap.push(2., (1,1)); heap.push(1., (1,1)); heap.push(3., (1,1)); heap.push(4., (1,1)); heap.push(-1., (1,1)); heap.push(9., (1,1)); assert_eq!(-1., heap.pop().unwrap().0); assert_eq!(1., heap.pop().unwrap().0); assert_eq!(2., heap.pop().unwrap().0); assert_eq!(3., heap.pop().unwrap().0); assert_eq!(4., heap.pop().unwrap().0); assert_eq!(9., heap.pop().unwrap().0); assert_eq!(None, heap.pop()); } }
#[macro_use] extern crate log; extern crate argparse; extern crate env_logger; extern crate hyper; extern crate mozprofile; extern crate mozrunner; extern crate regex; extern crate rustc_serialize; #[macro_use] extern crate webdriver; use std::borrow::ToOwned; use std::process::exit; use std::net::{SocketAddr, SocketAddrV4, Ipv4Addr}; use std::str::FromStr; use std::path::Path; use argparse::{ArgumentParser, StoreTrue, Store}; use webdriver::server::start; use marionette::{MarionetteHandler, BrowserLauncher, MarionetteSettings, extension_routes}; macro_rules! try_opt { ($expr:expr, $err_type:expr, $err_msg:expr) => ({ match $expr { Some(x) => x, None => return Err(WebDriverError::new($err_type, $err_msg)) } }) } mod marionette; struct Options { binary: String, webdriver_host: String, webdriver_port: u16, marionette_port: u16, connect_existing: bool } fn parse_args() -> Options { let mut opts = Options { binary: "".to_owned(), webdriver_host: "127.0.0.1".to_owned(), webdriver_port: 4444u16, marionette_port: 2828u16, connect_existing: false }; { let mut parser = ArgumentParser::new(); parser.set_description("WebDriver to marionette proxy."); parser.refer(&mut opts.binary) .add_option(&["-b", "--binary"], Store, "Path to the Firefox binary"); parser.refer(&mut opts.webdriver_host) .add_option(&["--webdriver-host"], Store, "Host to run webdriver server on"); parser.refer(&mut opts.webdriver_port) .add_option(&["--webdriver-port"], Store, "Port to run webdriver on"); parser.refer(&mut opts.marionette_port) .add_option(&["--marionette-port"], Store, "Port to run marionette on"); parser.refer(&mut opts.connect_existing) .add_option(&["--connect-existing"], StoreTrue, "Connect to an existing firefox process"); parser.parse_args_or_exit(); } if opts.binary == "" && !opts.connect_existing { println!("Must supply a binary path or --connect-existing\n"); exit(1) } opts } fn main() { env_logger::init().unwrap(); let opts = parse_args(); let host = &opts.webdriver_host[..]; let port = opts.webdriver_port; let addr = Ipv4Addr::from_str(host).map( |x| SocketAddr::V4(SocketAddrV4::new(x, port))).unwrap_or_else( |_| { println!("Invalid host address"); exit(1); } ); let launcher = if opts.connect_existing { BrowserLauncher::None } else { BrowserLauncher::BinaryLauncher(Path::new(&opts.binary).to_path_buf()) }; let settings = MarionetteSettings::new(opts.marionette_port, launcher); //TODO: what if binary isn't a valid path? start(addr, MarionetteHandler::new(settings), extension_routes()); }
use super::{Float, Floating}; use crate::common::*; typ! { pub fn Reduce<input>(input: Floating) -> Floating { match input { #[generics(base: Unsigned + NonZero, sig: Integer, exp: Integer)] Float::<base, sig, exp> => { if sig != 0 && sig % base == 0 { let new_sig: Integer = sig / base; let new_exp: Integer = exp + 1; Reduce(Float::<base, new_sig, new_exp>) } else { input } } } } pub fn FloatAdd<lhs, rhs>(lhs: Floating, rhs: Floating) -> Floating { match (lhs, rhs) { #[generics(base: Unsigned + NonZero, lsig: Integer, lexp: Integer, rsig: Integer, rexp: Integer)] (Float::<base, lsig, lexp>, Float::<base, rsig, rexp>) => { let min_exp: Integer = lexp.Min(rexp); let lpower = lexp - min_exp; let rpower = rexp - min_exp; let lsig = lsig * base.Pow(lpower); let rsig = rsig * base.Pow(rpower); let out_sig: Integer = lsig + rsig; Reduce(Float::<base, out_sig, min_exp>) } } } pub fn FloatMul<lhs, rhs>(lhs: Floating, rhs: Floating) -> Floating { match (lhs, rhs) { #[generics(base: Unsigned + NonZero, lsig: Integer, lexp: Integer, rsig: Integer, rexp: Integer)] (Float::<base, lsig, lexp>, Float::<base, rsig, rexp>) => { let sig: Integer = lsig * rsig; let exp: Integer = lexp + rexp; Reduce(Float::<base, sig, exp>) } } } }