text
stringlengths
8
4.13M
use necsim_core_bond::ClosedUnitF64; use crate::{cogs::Habitat, landscape::Location}; #[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait SpeciationProbability<H: Habitat>: crate::cogs::Backup + core::fmt::Debug { #[must_use] #[debug_requires(habitat.contains(location), "location is inside habitat")] fn get_speciation_probability_at_location( &self, location: &Location, habitat: &H, ) -> ClosedUnitF64; }
use super::*; use guion::{util::bounds::Dims, event::{imp::StdVarSup, variant::VariantSupport, standard::variants::RootEvent, variant::Variant}}; use SDLKeycode; #[allow(unused)] pub fn parse_event<E>(s: &SDLEvent, window_size: (u32,u32)) -> ParsedEvent<E> where E: Env, EEDest<E>: SDLDestination, EEKey<E>: From<Key>, EEvent<E>: StdVarSup<E> + VariantSupport<Event, E>, { let is = Event { e: s.clone(), ws: (window_size.0 as f32, window_size.1 as f32) }; use sdl2::event::WindowEvent; match s { SDLEvent::KeyDown { timestamp, window_id, keycode, scancode, keymod, repeat, } => ret(process_kbd_evt(scancode,*repeat,false),timestamp), SDLEvent::KeyUp { timestamp, window_id, keycode, scancode, keymod, repeat, } => ret(process_kbd_evt(scancode,*repeat,true),timestamp), SDLEvent::TextEditing { timestamp, window_id, text, start, length, } => ret(is,timestamp), SDLEvent::TextInput { timestamp, window_id, text, } => ret(RootEvent::TextInput{text: text.to_owned()},timestamp), SDLEvent::MouseMotion { timestamp, window_id, which, mousestate, x, y, xrel, yrel, } => ret(RootEvent::MouseMove{ pos: Offset{x: *x, y: *y}, },timestamp), SDLEvent::MouseButtonDown { timestamp, window_id, which, mouse_btn, clicks, x, y, } => ret(RootEvent::MouseDown{ key: Key::Mouse(*mouse_btn,Some(*which)).into(), },timestamp), SDLEvent::MouseButtonUp { timestamp, window_id, which, mouse_btn, clicks, x, y, } => ret(RootEvent::MouseUp{ key: Key::Mouse(*mouse_btn,Some(*which)).into(), },timestamp), SDLEvent::MouseWheel { timestamp, window_id, which, x, y, direction, } => ret(RootEvent::MouseScroll{x: (-*x)*8, y: (-*y)*32},timestamp), SDLEvent::JoyAxisMotion { timestamp, which, axis_idx, value, } => ret(is,timestamp), SDLEvent::JoyBallMotion { timestamp, which, ball_idx, xrel, yrel, } => ret(is,timestamp), SDLEvent::JoyHatMotion { timestamp, which, hat_idx, state, } => ret(is,timestamp), SDLEvent::JoyButtonDown { timestamp, which, button_idx, } => ret(is,timestamp), SDLEvent::JoyButtonUp { timestamp, which, button_idx, } => ret(is,timestamp), SDLEvent::JoyDeviceAdded { timestamp, which } => ret(is,timestamp), SDLEvent::JoyDeviceRemoved { timestamp, which } => ret(is,timestamp), SDLEvent::ControllerAxisMotion { timestamp, which, axis, value, } => ret(is,timestamp), SDLEvent::ControllerButtonDown { timestamp, which, button, } => ret(is,timestamp), SDLEvent::ControllerButtonUp { timestamp, which, button, } => ret(is,timestamp), SDLEvent::ControllerDeviceAdded { timestamp, which } => ret(is,timestamp), SDLEvent::ControllerDeviceRemoved { timestamp, which } => ret(is,timestamp), SDLEvent::ControllerDeviceRemapped { timestamp, which } => ret(is,timestamp), SDLEvent::FingerDown { timestamp, touch_id, finger_id, x, y, dx, dy, pressure, } => ret(is,timestamp), SDLEvent::FingerUp { timestamp, touch_id, finger_id, x, y, dx, dy, pressure, } => ret(is,timestamp), SDLEvent::FingerMotion { timestamp, touch_id, finger_id, x, y, dx, dy, pressure, } => ret(is,timestamp), SDLEvent::DollarGesture { timestamp, touch_id, gesture_id, num_fingers, error, x, y, } => ret(is,timestamp), SDLEvent::DollarRecord { timestamp, touch_id, gesture_id, num_fingers, error, x, y, } => ret(is,timestamp), SDLEvent::MultiGesture { timestamp, touch_id, d_theta, d_dist, x, y, num_fingers, } => ret(is,timestamp), SDLEvent::ClipboardUpdate { timestamp } => ret(is,timestamp), SDLEvent::DropFile { timestamp, window_id, filename, } => ret(is,timestamp), SDLEvent::DropText { timestamp, window_id, filename, } => ret(is,timestamp), SDLEvent::DropBegin { timestamp, window_id, } => ret(is,timestamp), SDLEvent::DropComplete { timestamp, window_id, } => ret(is,timestamp), SDLEvent::AudioDeviceAdded { timestamp, which, iscapture, } => ret(is,timestamp), SDLEvent::AudioDeviceRemoved { timestamp, which, iscapture, } => ret(is,timestamp), SDLEvent::RenderTargetsReset { timestamp } => ret(is,timestamp), SDLEvent::RenderDeviceReset { timestamp } => ret(is,timestamp), SDLEvent::User { timestamp, window_id, type_, code, data1, data2, } => ret(is,timestamp), SDLEvent::Unknown { timestamp, type_ } => ret(is,timestamp), SDLEvent::Quit { timestamp } => ret(is,timestamp), SDLEvent::AppTerminating { timestamp } => ret(is,timestamp), SDLEvent::AppLowMemory { timestamp } => ret(is,timestamp), SDLEvent::AppWillEnterBackground { timestamp } => ret(is,timestamp), SDLEvent::AppDidEnterBackground { timestamp } => ret(is,timestamp), SDLEvent::AppWillEnterForeground { timestamp } => ret(is,timestamp), SDLEvent::AppDidEnterForeground { timestamp } => ret(is,timestamp), SDLEvent::Window { timestamp, window_id, win_event, } => match win_event { WindowEvent::None => ret(is,timestamp), WindowEvent::Shown => ret(is,timestamp), WindowEvent::Hidden => ret(is,timestamp), WindowEvent::Exposed => ret(is,timestamp), WindowEvent::Moved(x,y) => ret(RootEvent::WindowMove{ pos: Offset{x: *x, y: *y}, size: Dims::from(window_size), },timestamp), WindowEvent::Resized(w,h) => ret(RootEvent::WindowResize{ size: Dims{w: *w as u32, h: *h as u32}, },timestamp), WindowEvent::SizeChanged(_, _) => ret(is,timestamp), WindowEvent::Minimized => ret(is,timestamp), WindowEvent::Maximized => ret(is,timestamp), WindowEvent::Restored => ret(is,timestamp), WindowEvent::Enter => ret(is,timestamp), WindowEvent::Leave => ret(RootEvent::MouseLeaveWindow{},timestamp), WindowEvent::FocusGained => ret(is,timestamp), WindowEvent::FocusLost => ret(is,timestamp), WindowEvent::Close => ret(is,timestamp), WindowEvent::TakeFocus => ret(is,timestamp), WindowEvent::HitTest => ret(is,timestamp), }, } } fn process_kbd_evt<E>(key: &Option<SDLScancode>, repeat: bool, up: bool) -> RootEvent<E> where E: Env, EEKey<E>: From<Key>, { if up { RootEvent::KbdUp{ key: Key::Kbd(key.expect("TODO")).into() } }else if repeat{ RootEvent::KbdPress{ key: Key::Kbd(key.expect("TODO")).into() } }else{ RootEvent::KbdDown{ key: Key::Kbd(key.expect("TODO")).into() } } } pub struct ParsedEvent<E> where E: Env { pub event: EEvent<E>, pub ts: u32, } fn ret<E,T>(event: T, ts: &u32) -> ParsedEvent<E> where E: Env, EEvent<E>: VariantSupport<T,E>, T: Variant<E> { ParsedEvent{ event: GEvent::from(event), ts: *ts, } } #[allow(unused)] pub fn event_dest_window(s: &SDLEvent) -> Option<u32> { match s { SDLEvent::KeyDown {window_id,..} => Some(*window_id), SDLEvent::KeyUp {window_id,..} => Some(*window_id), SDLEvent::TextEditing {window_id,..} => Some(*window_id), SDLEvent::TextInput {window_id,..} => Some(*window_id), SDLEvent::MouseMotion {window_id,..} => Some(*window_id), SDLEvent::MouseButtonDown {window_id,..} => Some(*window_id), SDLEvent::MouseButtonUp {window_id,..} => Some(*window_id), SDLEvent::MouseWheel {window_id,..} => Some(*window_id), SDLEvent::JoyAxisMotion {..} => None, SDLEvent::JoyBallMotion {..} => None, SDLEvent::JoyHatMotion {..} => None, SDLEvent::JoyButtonDown {..} => None, SDLEvent::JoyButtonUp {..} => None, SDLEvent::JoyDeviceAdded {..} => None, SDLEvent::JoyDeviceRemoved {..} => None, SDLEvent::ControllerAxisMotion {..} => None, SDLEvent::ControllerButtonDown {..} => None, SDLEvent::ControllerButtonUp {..} => None, SDLEvent::ControllerDeviceAdded {..} => None, SDLEvent::ControllerDeviceRemoved {..} => None, SDLEvent::ControllerDeviceRemapped {..} => None, SDLEvent::FingerDown {..} => None, SDLEvent::FingerUp {..} => None, SDLEvent::FingerMotion {..} => None, SDLEvent::DollarGesture {..} => None, SDLEvent::DollarRecord {..} => None, SDLEvent::MultiGesture {..} => None, SDLEvent::ClipboardUpdate {..} => None, SDLEvent::DropFile {window_id,..} => Some(*window_id), SDLEvent::DropText {window_id,..} => Some(*window_id), SDLEvent::DropBegin {window_id,..} => Some(*window_id), SDLEvent::DropComplete {window_id,..} => Some(*window_id), SDLEvent::AudioDeviceAdded {..} => None, SDLEvent::AudioDeviceRemoved {..} => None, SDLEvent::RenderTargetsReset {..} => None, SDLEvent::RenderDeviceReset {..} => None, SDLEvent::User {window_id,..} => Some(*window_id), SDLEvent::Unknown {..} => None, SDLEvent::Quit {..} => None, SDLEvent::AppTerminating {..} => None, SDLEvent::AppLowMemory {..} => None, SDLEvent::AppWillEnterBackground {..} => None, SDLEvent::AppDidEnterBackground {..} => None, SDLEvent::AppWillEnterForeground {..} => None, SDLEvent::AppDidEnterForeground {..} => None, SDLEvent::Window {window_id,..} => Some(*window_id), } }
use blake2b_simd::{Hash as Blake2bHash, Params as Blake2bParams}; use group::{cofactor::CofactorGroup, GroupEncoding}; pub const KDF_SAPLING_PERSONALIZATION: &[u8; 16] = b"DarkFiSaplingKDF"; /// Functions used for encrypting the note in transaction outputs. /// Sapling key agreement for note encryption. /// /// Implements section 5.4.4.3 of the Zcash Protocol Specification. pub fn sapling_ka_agree(esk: &jubjub::Fr, pk_d: &jubjub::ExtendedPoint) -> jubjub::SubgroupPoint { // [8 esk] pk_d // <ExtendedPoint as CofactorGroup>::clear_cofactor is implemented using // ExtendedPoint::mul_by_cofactor in the jubjub crate. // ExtendedPoint::multiply currently just implements double-and-add, // so using wNAF is a concrete speed improvement (as it operates over a window of bits // instead of individual bits). // We want that to be fast because it's in the hot path for trial decryption of notes on chain. let mut wnaf = group::Wnaf::new(); wnaf.scalar(esk).base(*pk_d).clear_cofactor() } /// Sapling KDF for note encryption. /// /// Implements section 5.4.4.4 of the Zcash Protocol Specification. pub fn kdf_sapling(dhsecret: jubjub::SubgroupPoint, epk: &jubjub::ExtendedPoint) -> Blake2bHash { Blake2bParams::new() .hash_length(32) .personal(KDF_SAPLING_PERSONALIZATION) .to_state() .update(&dhsecret.to_bytes()) .update(&epk.to_bytes()) .finalize() }
use std::rc::Rc; use super::configuration::Configuration; pub struct APIClient { accounts_api: Box<dyn crate::apis::AccountsApi>, budgets_api: Box<dyn crate::apis::BudgetsApi>, categories_api: Box<dyn crate::apis::CategoriesApi>, deprecated_api: Box<dyn crate::apis::DeprecatedApi>, months_api: Box<dyn crate::apis::MonthsApi>, payee_locations_api: Box<dyn crate::apis::PayeeLocationsApi>, payees_api: Box<dyn crate::apis::PayeesApi>, scheduled_transactions_api: Box<dyn crate::apis::ScheduledTransactionsApi>, transactions_api: Box<dyn crate::apis::TransactionsApi>, user_api: Box<dyn crate::apis::UserApi>, } impl APIClient { pub fn new(configuration: Configuration) -> APIClient { let rc = Rc::new(configuration); APIClient { accounts_api: Box::new(crate::apis::AccountsApiClient::new(rc.clone())), budgets_api: Box::new(crate::apis::BudgetsApiClient::new(rc.clone())), categories_api: Box::new(crate::apis::CategoriesApiClient::new(rc.clone())), deprecated_api: Box::new(crate::apis::DeprecatedApiClient::new(rc.clone())), months_api: Box::new(crate::apis::MonthsApiClient::new(rc.clone())), payee_locations_api: Box::new(crate::apis::PayeeLocationsApiClient::new(rc.clone())), payees_api: Box::new(crate::apis::PayeesApiClient::new(rc.clone())), scheduled_transactions_api: Box::new(crate::apis::ScheduledTransactionsApiClient::new(rc.clone())), transactions_api: Box::new(crate::apis::TransactionsApiClient::new(rc.clone())), user_api: Box::new(crate::apis::UserApiClient::new(rc.clone())), } } pub fn accounts_api(&self) -> &dyn crate::apis::AccountsApi{ self.accounts_api.as_ref() } pub fn budgets_api(&self) -> &dyn crate::apis::BudgetsApi{ self.budgets_api.as_ref() } pub fn categories_api(&self) -> &dyn crate::apis::CategoriesApi{ self.categories_api.as_ref() } pub fn deprecated_api(&self) -> &dyn crate::apis::DeprecatedApi{ self.deprecated_api.as_ref() } pub fn months_api(&self) -> &dyn crate::apis::MonthsApi{ self.months_api.as_ref() } pub fn payee_locations_api(&self) -> &dyn crate::apis::PayeeLocationsApi{ self.payee_locations_api.as_ref() } pub fn payees_api(&self) -> &dyn crate::apis::PayeesApi{ self.payees_api.as_ref() } pub fn scheduled_transactions_api(&self) -> &dyn crate::apis::ScheduledTransactionsApi{ self.scheduled_transactions_api.as_ref() } pub fn transactions_api(&self) -> &dyn crate::apis::TransactionsApi{ self.transactions_api.as_ref() } pub fn user_api(&self) -> &dyn crate::apis::UserApi{ self.user_api.as_ref() } }
use ws::{Handler, Sender, Handshake, Result, Message, Request}; use url; use base64; pub struct Client { pub out: Sender, pub auth_pass : String } impl Handler for Client { fn on_open(&mut self, _shake: Handshake) -> Result<()> { debug!("Socket opened"); self.out.send("[5, \"OnJsonApiEvent\"]") } fn on_message(&mut self, msg: Message) -> Result<()> { println!("Got message: {}", msg); Ok(()) } fn build_request(&mut self, url: &url::Url) -> Result<Request> { let mut req : Request = Request::from_url(url).unwrap(); let auth = format!("riot:{}", self.auth_pass); let auth_encoded = base64::encode(&auth); println!("{}", auth_encoded); req.headers_mut().push(("Authorization".into(), format!("Basic {}", auth_encoded).into())); req.headers_mut().push(("Sec-WebSocket-Protocol".into(), format!("wamp").into())); println!("Request built"); Ok(req) } }
use std::cell::Cell; use chiropterm::{Brush}; use crate::{UI, ui::Selection}; use super::{WidgetDimensions, InternalWidgetDimensions, WidgetMenu, Widgetlike}; pub struct WidgetCommon<T> { pub unique: T, pub(in crate) selection: Selection, pub(in crate) layout_token: Cell<u64>, last_dimensions: Cell<(isize, InternalWidgetDimensions)>, } // TODO: Store last 3 dimension estimates, since some widgets (like scrollable) try several widths impl<T: Widgetlike> WidgetCommon<T> { pub fn new(value: T) -> Self { WidgetCommon { unique: value, selection: Selection::not_selected(), last_dimensions: Cell::new((-1, InternalWidgetDimensions::zero())), layout_token: Cell::new(0), } } pub fn skip_draw<'frame>(&self, brush: Brush, menu: WidgetMenu<'frame, T>) { self.unique.skip_draw(menu.ui.is_selected(self.selection), brush, menu) } pub fn draw<'frame>(&self, brush: Brush, menu: WidgetMenu<'frame, T>) { self.unique.draw(menu.ui.is_selected(self.selection), brush, menu) } pub fn estimate_dimensions(&self, ui: &UI, mut width: isize) -> InternalWidgetDimensions { if width < 0 { width = 0; } // TODO: If it's 0, provide a stock answer let (last_width, last_dims) = self.last_dimensions.get(); if last_width == width { return last_dims; } let new_dims = self.unique.estimate_dimensions(ui, width).fixup(); self.last_dimensions.replace((last_width, new_dims)); new_dims } pub fn apply_layout_hacks(&self, wd: WidgetDimensions) -> WidgetDimensions { self.unique.layout_hacks().apply(wd) } pub fn clear_layout_cache_if_needed(&self, ui: &UI) { if self.layout_token.get() < ui.layout_token() { self.last_dimensions.replace((-1, InternalWidgetDimensions::zero())); self.unique.clear_layout_cache(&ui); self.layout_token.replace(ui.layout_token()); } } }
use super::{ annotate_types, apply_macros_to_function_map, build_functions, parse, parse_functions_and_macros, Builder, Compiler, GenericResult, }; use std::time::Instant; /// runs through the workflow as described /// in compiler-design. pub fn load_string_into_compiler(compiler: &mut Compiler, input: &str) -> GenericResult<()> { let token = parse(input); if cfg!(feature = "debug") { println!("parsing functions...") } let (mut functions, macros) = parse_functions_and_macros(compiler, token)?; if cfg!(feature = "debug") { println!( "applying macros {:?} to functions: {:?}...", &macros, &functions ); } apply_macros_to_function_map(&macros, &mut functions)?; if cfg!(feature = "debug") { println!( "applying annotating types for functions: {:?}...", &functions.keys() ); } let annotated_functions = annotate_types(compiler, &functions)?; if cfg!(feature = "debug") { println!("building functions: {:?}...", &annotated_functions.keys()); } build_functions(compiler, &annotated_functions)?; let mut builder = Builder::new(&compiler.llvm); builder.build(&compiler.data, &mut compiler.llvm.types); let f = builder.get_function("main")?; if cfg!(feature = "debug") { let before = Instant::now(); f(); println!("function duration: {}", before.elapsed().as_secs_f64()); } else { f(); } Ok(()) }
use std::fs::File; use std::io::prelude::*; #[derive(Debug, Deserialize)] pub struct Config { database: Database, } #[derive(Debug, Deserialize)] pub struct Database { url: Option<String>, pool_size: Option<u32>, } pub fn read_toml() -> Config { let config_path = "config.toml"; let mut config_file = match File::open(config_path) { Ok(f) => f, Err(e) => panic!("Error occurred opening file: {} - Err: {}", config_path, e), }; let mut config = String::new(); match config_file.read_to_string(&mut config) { Ok(s) => s, Err(e) => panic!("Error Reading file: {} - Err: {}", config_path, e), }; toml::from_str::<Config>(&config).unwrap() } impl Config { pub fn db(&self) -> &Database { &self.database } } impl Database { pub fn url(&self) -> String { if let Some(s) = &self.url { s.clone() } else { String::default() } } pub fn pool_size(&self) -> u32 { if let Some(n) = self.pool_size { n } else { 10 } } }
#[doc = "Reader of register CONN_1_CE_DATA_LIST_CFG"] pub type R = crate::R<u32, super::CONN_1_CE_DATA_LIST_CFG>; #[doc = "Writer for register CONN_1_CE_DATA_LIST_CFG"] pub type W = crate::W<u32, super::CONN_1_CE_DATA_LIST_CFG>; #[doc = "Register CONN_1_CE_DATA_LIST_CFG `reset()`'s with value 0"] impl crate::ResetValue for super::CONN_1_CE_DATA_LIST_CFG { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `DATA_LIST_INDEX_LAST_ACK_INDEX_C1`"] pub type DATA_LIST_INDEX_LAST_ACK_INDEX_C1_R = crate::R<u8, u8>; #[doc = "Write proxy for field `DATA_LIST_INDEX_LAST_ACK_INDEX_C1`"] pub struct DATA_LIST_INDEX_LAST_ACK_INDEX_C1_W<'a> { w: &'a mut W, } impl<'a> DATA_LIST_INDEX_LAST_ACK_INDEX_C1_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 & !0x0f) | ((value as u32) & 0x0f); self.w } } #[doc = "Reader of field `DATA_LIST_HEAD_UP_C1`"] pub type DATA_LIST_HEAD_UP_C1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DATA_LIST_HEAD_UP_C1`"] pub struct DATA_LIST_HEAD_UP_C1_W<'a> { w: &'a mut W, } impl<'a> DATA_LIST_HEAD_UP_C1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Reader of field `SLV_MD_CONFIG_C1`"] pub type SLV_MD_CONFIG_C1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `SLV_MD_CONFIG_C1`"] pub struct SLV_MD_CONFIG_C1_W<'a> { w: &'a mut W, } impl<'a> SLV_MD_CONFIG_C1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "Reader of field `MD_C1`"] pub type MD_C1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MD_C1`"] pub struct MD_C1_W<'a> { w: &'a mut W, } impl<'a> MD_C1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "Reader of field `MD_BIT_CLEAR_C1`"] pub type MD_BIT_CLEAR_C1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MD_BIT_CLEAR_C1`"] pub struct MD_BIT_CLEAR_C1_W<'a> { w: &'a mut W, } impl<'a> MD_BIT_CLEAR_C1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } #[doc = "Reader of field `PAUSE_DATA_C1`"] pub type PAUSE_DATA_C1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PAUSE_DATA_C1`"] pub struct PAUSE_DATA_C1_W<'a> { w: &'a mut W, } impl<'a> PAUSE_DATA_C1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8); self.w } } #[doc = "Reader of field `KILL_CONN`"] pub type KILL_CONN_R = crate::R<bool, bool>; #[doc = "Write proxy for field `KILL_CONN`"] pub struct KILL_CONN_W<'a> { w: &'a mut W, } impl<'a> KILL_CONN_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9); self.w } } #[doc = "Reader of field `KILL_CONN_AFTER_TX`"] pub type KILL_CONN_AFTER_TX_R = crate::R<bool, bool>; #[doc = "Write proxy for field `KILL_CONN_AFTER_TX`"] pub struct KILL_CONN_AFTER_TX_W<'a> { w: &'a mut W, } impl<'a> KILL_CONN_AFTER_TX_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10); self.w } } #[doc = "Reader of field `EMPTYPDU_SENT`"] pub type EMPTYPDU_SENT_R = crate::R<bool, bool>; #[doc = "Write proxy for field `EMPTYPDU_SENT`"] pub struct EMPTYPDU_SENT_W<'a> { w: &'a mut W, } impl<'a> EMPTYPDU_SENT_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11); self.w } } #[doc = "Reader of field `CURRENT_PDU_INDEX_C1`"] pub type CURRENT_PDU_INDEX_C1_R = crate::R<u8, u8>; impl R { #[doc = "Bits 0:3 - Data list index for start/resume. This field must be valid along with data_list_head_up and indicate the transmit packet buffer index at which the data is loaded. The default number of buffers in the IP is 5,but may be customized for a customer. The buffers are in-dexed 0 to 4. Hardware will start the next data transmission from the index indicated by this field."] #[inline(always)] pub fn data_list_index_last_ack_index_c1(&self) -> DATA_LIST_INDEX_LAST_ACK_INDEX_C1_R { DATA_LIST_INDEX_LAST_ACK_INDEX_C1_R::new((self.bits & 0x0f) as u8) } #[doc = "Bit 4 - Update the first packet buffer index ready for transmis-sion to start/resume data transfer after a pause. The bit must be set every time the firmware needs to indicate the start/resume."] #[inline(always)] pub fn data_list_head_up_c1(&self) -> DATA_LIST_HEAD_UP_C1_R { DATA_LIST_HEAD_UP_C1_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - This bit is set to configure the MD bit control when the design is in slave mode. 1 - MD bit will be decided on packet pending status 0 - MD bit will be decided on packet queued in next buffer status This bit has valid only when MD_BIT_CLEAR bit is not set"] #[inline(always)] pub fn slv_md_config_c1(&self) -> SLV_MD_CONFIG_C1_R { SLV_MD_CONFIG_C1_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 6 - MD bit set to '1' indicates device has more data to be sent."] #[inline(always)] pub fn md_c1(&self) -> MD_C1_R { MD_C1_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - This register field indicates whether the MD (More Data) bit needs to be controlled by 'software' or, 'hardware and software logic combined' 1 - MD bit is exclusively controlled by software, based on status of bit \\[6\\]. 0 - MD Bit in the transmitted PDU is controlled by software and hardware logic. MD bit is set in transmitted packet, only if the software has set the MD in bit \\[6\\] and either of the following conditions is true, a) If there are packets queued for transmission. b) If there is an acknowledgement awaited from the remote side for the packet transmitted."] #[inline(always)] pub fn md_bit_clear_c1(&self) -> MD_BIT_CLEAR_C1_R { MD_BIT_CLEAR_C1_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 8 - Pause data. 1 - pause data, 0 - do not pause. The current_pdu_index in hardware does not move to next in-dex until pause_data is cleared. But if the SENT bit is set for the current_pdu_index as which pause is set, data will be sent out"] #[inline(always)] pub fn pause_data_c1(&self) -> PAUSE_DATA_C1_R { PAUSE_DATA_C1_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 9 - Kills the connection immediately when the connection event is active"] #[inline(always)] pub fn kill_conn(&self) -> KILL_CONN_R { KILL_CONN_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 10 - Kills the connection when the connection event is active and a TX is completed"] #[inline(always)] pub fn kill_conn_after_tx(&self) -> KILL_CONN_AFTER_TX_R { KILL_CONN_AFTER_TX_R::new(((self.bits >> 10) & 0x01) != 0) } #[doc = "Bit 11 - This bit indicates if EMPTYPDU has been sent. IF ACK is received this bit will be cleared by HW"] #[inline(always)] pub fn emptypdu_sent(&self) -> EMPTYPDU_SENT_R { EMPTYPDU_SENT_R::new(((self.bits >> 11) & 0x01) != 0) } #[doc = "Bits 12:15 - The index of the transmit packet buffer that is currently in transmission/waiting for transmission."] #[inline(always)] pub fn current_pdu_index_c1(&self) -> CURRENT_PDU_INDEX_C1_R { CURRENT_PDU_INDEX_C1_R::new(((self.bits >> 12) & 0x0f) as u8) } } impl W { #[doc = "Bits 0:3 - Data list index for start/resume. This field must be valid along with data_list_head_up and indicate the transmit packet buffer index at which the data is loaded. The default number of buffers in the IP is 5,but may be customized for a customer. The buffers are in-dexed 0 to 4. Hardware will start the next data transmission from the index indicated by this field."] #[inline(always)] pub fn data_list_index_last_ack_index_c1(&mut self) -> DATA_LIST_INDEX_LAST_ACK_INDEX_C1_W { DATA_LIST_INDEX_LAST_ACK_INDEX_C1_W { w: self } } #[doc = "Bit 4 - Update the first packet buffer index ready for transmis-sion to start/resume data transfer after a pause. The bit must be set every time the firmware needs to indicate the start/resume."] #[inline(always)] pub fn data_list_head_up_c1(&mut self) -> DATA_LIST_HEAD_UP_C1_W { DATA_LIST_HEAD_UP_C1_W { w: self } } #[doc = "Bit 5 - This bit is set to configure the MD bit control when the design is in slave mode. 1 - MD bit will be decided on packet pending status 0 - MD bit will be decided on packet queued in next buffer status This bit has valid only when MD_BIT_CLEAR bit is not set"] #[inline(always)] pub fn slv_md_config_c1(&mut self) -> SLV_MD_CONFIG_C1_W { SLV_MD_CONFIG_C1_W { w: self } } #[doc = "Bit 6 - MD bit set to '1' indicates device has more data to be sent."] #[inline(always)] pub fn md_c1(&mut self) -> MD_C1_W { MD_C1_W { w: self } } #[doc = "Bit 7 - This register field indicates whether the MD (More Data) bit needs to be controlled by 'software' or, 'hardware and software logic combined' 1 - MD bit is exclusively controlled by software, based on status of bit \\[6\\]. 0 - MD Bit in the transmitted PDU is controlled by software and hardware logic. MD bit is set in transmitted packet, only if the software has set the MD in bit \\[6\\] and either of the following conditions is true, a) If there are packets queued for transmission. b) If there is an acknowledgement awaited from the remote side for the packet transmitted."] #[inline(always)] pub fn md_bit_clear_c1(&mut self) -> MD_BIT_CLEAR_C1_W { MD_BIT_CLEAR_C1_W { w: self } } #[doc = "Bit 8 - Pause data. 1 - pause data, 0 - do not pause. The current_pdu_index in hardware does not move to next in-dex until pause_data is cleared. But if the SENT bit is set for the current_pdu_index as which pause is set, data will be sent out"] #[inline(always)] pub fn pause_data_c1(&mut self) -> PAUSE_DATA_C1_W { PAUSE_DATA_C1_W { w: self } } #[doc = "Bit 9 - Kills the connection immediately when the connection event is active"] #[inline(always)] pub fn kill_conn(&mut self) -> KILL_CONN_W { KILL_CONN_W { w: self } } #[doc = "Bit 10 - Kills the connection when the connection event is active and a TX is completed"] #[inline(always)] pub fn kill_conn_after_tx(&mut self) -> KILL_CONN_AFTER_TX_W { KILL_CONN_AFTER_TX_W { w: self } } #[doc = "Bit 11 - This bit indicates if EMPTYPDU has been sent. IF ACK is received this bit will be cleared by HW"] #[inline(always)] pub fn emptypdu_sent(&mut self) -> EMPTYPDU_SENT_W { EMPTYPDU_SENT_W { w: self } } }
use std::f64::consts::PI; pub struct Mercator { tile_size: f64, } impl Mercator { /// Create a new Mercator with custom tile size. Tile sizes must be a power of two (256, 512, /// and so on). pub fn with_size(tile_size: usize) -> Mercator { Mercator { tile_size: tile_size as f64 } } /// Projects a given LL coordinate at a specific zoom level into decimal sub-pixel screen-coordinates. /// /// Zoom level is between 0 and 29 (inclusive). Every other zoom level will return a `None`. pub fn from_ll_to_subpixel<T: Coord>(&self, ll: &T, zoom: usize) -> Option<T> { if 30 > zoom { let c = self.tile_size * 2.0_f64.powi(zoom as i32); let bc = c / 360.0; let cc = c / (2.0 * PI); let d = c / 2.0; let e = d + ll.x() * bc; let f = ll.y().to_radians().sin().max(-0.9999).min(0.9999); let g = d + 0.5 * ((1.0 + f) / (1.0 - f)).ln() * -cc; Some(T::with_xy(e, g)) } else { None } } /// Projects a given LL coordinate at a specific zoom level into integer pixel screen-coordinates. /// /// Zoom level is between 0 and 29 (inclusive). Every other zoom level will return a `None`. pub fn from_ll_to_pixel<T: Coord>(&self, ll: &T, zoom: usize) -> Option<T> { match self.from_ll_to_subpixel(ll, zoom) { Some(subpixel) => Some(T::with_xy( (subpixel.x() + 0.5).floor(), (subpixel.y() + 0.5).floor() )), None => None } } /// Projects a given pixel position at a specific zoom level into LL world-coordinates. /// /// Zoom level is between 0 and 29 (inclusive). Every other zoom level will return a `None`. pub fn from_pixel_to_ll<T: Coord>(&self, px: &T, zoom: usize) -> Option<T> { if 30 > zoom { let c = self.tile_size * 2.0_f64.powi(zoom as i32); let bc = c / 360.0; let cc = c / (2.0 * PI); let e = c / 2.0; let f = (px.x() - e) / bc; let g = (px.y() - e) / -cc; let h = (2.0 * g.exp().atan() - 0.5 * PI).to_degrees(); Some(T::with_xy(f, h)) } else { None } } } impl Default for Mercator { fn default() -> Mercator { Mercator { tile_size: 256.0 } } } /// Projects a given LL coordinate at a specific zoom level into decimal pixel screen-coordinates using a /// default tile size of 256. /// /// Zoom level is between 0 and 29 (inclusive). Every other zoom level will return a `None`. /// /// ```rust /// extern crate googleprojection; /// /// let subpixel = googleprojection::from_ll_to_subpixel(&(13.2, 55.9), 2).unwrap(); /// /// assert!((subpixel.0 - 549.5466666666666).abs() < 1e-10); /// assert!((subpixel.1 - 319.3747774937304).abs() < 1e-10); /// ``` pub fn from_ll_to_subpixel<T: Coord>(ll: &T, zoom: usize) -> Option<T> { Mercator::with_size(256).from_ll_to_subpixel(&ll, zoom) } /// Projects a given LL coordinate at a specific zoom level into pixel screen-coordinates using a /// default tile size of 256. /// /// Zoom level is between 0 and 29 (inclusive). Every other zoom level will return a `None`. /// /// ```rust /// extern crate googleprojection; /// /// let pixel = googleprojection::from_ll_to_pixel(&(13.2, 55.9), 2).unwrap(); /// /// assert_eq!(pixel.0, 550.0); /// assert_eq!(pixel.1, 319.0); /// ``` pub fn from_ll_to_pixel<T: Coord>(ll: &T, zoom: usize) -> Option<T> { Mercator::with_size(256).from_ll_to_pixel(&ll, zoom) } /// Projects a given pixel position at a specific zoom level into LL world-coordinates using a /// default tile size of 256. /// /// Zoom level is between 0 and 29 (inclusive). Every other zoom level will return a `None`. /// /// ```rust /// extern crate googleprojection; /// /// let ll = googleprojection::from_pixel_to_ll(&(78.0, 78.0), 12).unwrap(); /// /// assert!((ll.0 - -179.9732208251953).abs() < 1e-10); /// assert!((ll.1 - 85.04881808980566).abs() < 1e-10); /// ``` pub fn from_pixel_to_ll<T: Coord>(px: &T, zoom: usize) -> Option<T> { Mercator::with_size(256).from_pixel_to_ll(&px, zoom) } /// A trait for everything that can be treated as a coordinate for a projection. /// /// Implement this trait if you have a custom type to be able to project to and from it directly. /// /// There exist an impl for this for `(f64, f64)` out of the box (formatted as `(x, y)`, or `(lon, /// lat)`). pub trait Coord { /// Return the first of the `f64` pair. fn x(&self) -> f64; /// Return the second of the `f64` pair. fn y(&self) -> f64; /// Construct a new Coord implementation from two `f64`. fn with_xy(f64, f64) -> Self; } impl Coord for (f64, f64) { fn x(&self) -> f64 { self.0 } fn y(&self) -> f64 { self.1 } fn with_xy(x: f64, y: f64) -> (f64, f64) { (x, y) } } #[cfg(test)] mod test { use Coord; const EPSILON: f64 = 1e-10; fn float_pair_close(pair: &(f64, f64), expected: &(f64, f64)) -> bool { ((pair.0 - expected.0).abs() < EPSILON) && ((pair.1 - expected.1).abs() < EPSILON) } #[test] fn it_maps_coords_for_f64_tuple() { let coord: (f64, f64) = Coord::with_xy(45.0, 33.0); assert_eq!(coord.x(), 45.0); assert_eq!(coord.y(), 33.0); } #[test] fn it_matches_google_maps_projection_extension() { let pixel_extension = 60.0; let starting_coord = (43.6532, -79.3832); // These data collected using Google Maps API OverlayView.getProjection().fromLatLngToDivPixel(), // adding 60 to x, subtracting 60 from y, then converting back using OverlayView.getProjection().fromDivPixelToLatLng() let answers = vec![ // ((lat, lng), zoom) ((50.800061065188856, -68.83632499999999), 3), ((47.34741387849921, -74.10976249999999), 4), ((45.530626397270055, -76.74648124999999), 5), ((44.599495541698985, -78.06484062499999), 6), ((44.12824279122392, -78.72402031249999), 7), ((43.891195023324286, -79.05361015624999), 8), ((43.77231589906095, -79.21840507812499), 9), ((43.712787543711634, -79.30080253906249), 10), ((43.68300117005328, -79.34200126953124), 11), ((43.66810243453164, -79.36260063476561), 12), ((43.66065167963645, -79.3729003173828), 13), ((43.65692595541019, -79.3780501586914), 14), ((43.65506300660299, -79.38062507934569), 15), ((43.65413151052596, -79.38191253967284), 16), ((43.653665757069085, -79.38255626983641), 17), ((43.653432878986074, -79.3828781349182), 18), ((43.6533164396059, -79.3830390674591), 19), ]; for answer in answers { let expected_ll = answer.0; let expected = (expected_ll.1, expected_ll.0); let zoom = answer.1; let subpixel = super::from_ll_to_subpixel(&(starting_coord.1, starting_coord.0), zoom).unwrap(); let actual = super::from_pixel_to_ll(&(subpixel.0 + pixel_extension, subpixel.1 - pixel_extension), zoom).unwrap(); assert!(float_pair_close(&actual, &expected), format!("Expected {:?} at zoom {} to be {:?} but was {:?}", &starting_coord, zoom, &expected, &actual)); } } #[test] fn it_projects_to_subpixels() { let answers = vec![((0.0, 0.0), 0, (128.0, 128.0)), ((0.0, 0.0), 1, (256.0, 256.0)), ((0.0, 0.0), 29, (6.8719476736e10, 6.8719476736e10)), ((0.0, 1.0), 0, (128.0, 127.2888527833)), ((1.0, 0.0), 0, (128.7111111111, 128.0)), ((1.0, 1.0), 0, (128.7111111111, 127.2888527833)), ((5.5, 5.5), 5, (4221.1555555555, 3970.6517891289)), ((100.0, 54.0), 12, (815559.1111111111, 336678.5009166745)), ((-45.0, 12.0), 6, (6144.0, 7641.8296348480))]; for answer in answers { let ll = answer.0; let zoom = answer.1; let expected = answer.2; let actual = super::from_ll_to_subpixel(&ll, zoom).unwrap(); assert!(float_pair_close(&actual, &expected), format!("Expected {:?} at zoom {} to be {:?} but was {:?}", &ll, zoom, &expected, &actual)); } } #[test] fn it_projects_to_pixels() { let answers = vec![((0.0, 0.0), 0, (128.0, 128.0)), ((0.0, 0.0), 1, (256.0, 256.0)), ((0.0, 0.0), 29, (6.8719476736e10, 6.8719476736e10)), ((0.0, 1.0), 0, (128.0, 127.0)), ((1.0, 0.0), 0, (129.0, 128.0)), ((1.0, 1.0), 0, (129.0, 127.0)), ((5.5, 5.5), 5, (4221.0, 3971.0)), ((100.0, 54.0), 12, (815559.0, 336679.0)), ((-45.0, 12.0), 6, (6144.0, 7642.0))]; for answer in answers { let ll = answer.0; let zoom = answer.1; let expected = answer.2; let actual = super::from_ll_to_pixel(&ll, zoom).unwrap(); assert!(float_pair_close(&actual, &expected), format!("Expected {:?} at zoom {} to be {:?} but was {:?}", &ll, zoom, &expected, &actual)); } } #[test] fn it_projects_to_longlat() { let answers = vec![((128.0, 128.0), 0, (0.0, 0.0)), ((256.0, 256.0), 1, (0.0, 0.0)), ((6.8719476736e10, 6.8719476736e10), 29, (0.0, 0.0)), ((128.0, 127.0), 0, (0.0, 1.4061088354351594)), ((129.0, 128.0), 0, (1.40625, 0.0)), ((129.0, 127.0), 0, (1.40625, 1.4061088354351594)), ((20.0, 19.0), 0, (-151.875, 82.11838360691269)), ((78.0, 78.0), 12, (-179.9732208251953, 85.04881808980566)), ((-67.0, -100.0), 6, (-181.47216796875, 85.2371040233303))]; for answer in answers { let pixel = answer.0; let zoom = answer.1; let expected = answer.2; let actual = super::from_pixel_to_ll(&pixel, zoom).unwrap(); assert!(float_pair_close(&actual, &expected), format!("Expected {:?} at zoom {} to be {:?} but was {:?}", &pixel, zoom, &expected, &actual)); } } #[test] fn it_returns_none_when_zooming_too_far() { assert_eq!(super::from_ll_to_pixel(&(0.0, 0.0), 30), None); assert_eq!(super::from_pixel_to_ll(&(0.0, 0.0), 30), None); } #[test] fn it_projects_with_custom_size() { use super::Mercator; let mercator = Mercator::with_size(512); let ll = mercator.from_pixel_to_ll(&(512.0, 512.0), 1).unwrap(); assert!(ll == (0.0, 0.0), format!("Pixels 512,512 is on LL 0,0 on zoom 1 on a mercator with 512 pixels \ per tile, but got result: {:?}", ll)); let px = mercator.from_ll_to_pixel(&(0.0, 0.0), 1).unwrap(); assert!(px == (512.0, 512.0), format!("LL 0,0 is on pixels 512,512 on zoom 1 on a mercator with 512 pixels \ per tile, but got result: {:?}", px)); } }
mod assembly; mod assembly_helper; mod assembly_printer; mod ast; mod ast_helper; mod code_block; mod code_generator; mod lexeme; mod parser; mod pointer_arithmetic_transformer; mod representation_manager; mod scanner; mod struct_analyzer; mod token_stream; mod type_checker; mod type_checker_helper; mod x86_code_generator; use std::env; use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::path::Path; use pointer_arithmetic_transformer::transform_pointer_arithmetic; use code_generator::GeneratesCode; /// Read the source code from the file fn read_file(name: &str) -> std::io::Result<String> { let mut f = try!(File::open(name)); let mut s = String::new(); try!(f.read_to_string(&mut s)); Ok(s) } /// Write the code to out/code.s file fn write_code(complete_code: &String, path: &Path) { let mut file = match File::create(&path) { Err(why) => panic!("couldn't create {}: {}", path.display(), Error::description(&why)), Ok(file) => file, }; match file.write_all(complete_code.as_bytes()) { Err(why) => { panic!("couldn't write to {}: {}", path.display(), Error::description(&why)) }, Ok(_) => println!("successfully wrote code"), } } /// Starter of the compiler fn main() { let filename_res = env::args().nth(1); if filename_res.is_none() { println!("You can run with cargo run <filename>.sc"); return; } let filename = &filename_res.unwrap(); let result = read_file(filename); if let Err(_) = result { panic!("Error reading file {}", filename); } let program_text = result.unwrap(); // Scanning let mut tokens = scanner::get_tokens(&program_text); // Parsing let mut prog = parser::parse(&mut tokens); // Type checking let mut type_checker = type_checker::TypeChecker::new(); let passed = type_checker.annotate_types(&mut prog); if !passed { println!("FAILED typechecker"); for err in type_checker.get_errors() { println!("{}", err); } return; } // Change all cases of pointer + i to something like // pointer + sizeof(type) * i transform_pointer_arithmetic(&mut prog); // Run typechecker again to be sure we didn't add any code // that doesn't typecheck. assert!(type_checker.annotate_types(&mut prog)); // Generating code let mut code_generator = x86_code_generator::X86CodeGenerator::new(); let codestr = code_generator.generate_code(&prog); // Write the code to a file let path = Path::new("out/code.s"); write_code(&codestr, path); }
//! Rejections //! //! Part of the power of the [`Filter`](../trait.Filter.html) system is being able to //! reject a request from a filter chain. This allows for filters to be //! combined with `or`, so that if one side of the chain finds that a request //! doesn't fulfill its requirements, the other side can try to process //! the request. //! //! Many of the built-in [`filters`](../filters) will automatically reject //! the request with an appropriate rejection. However, you can also build //! new custom [`Filter`](../trait.Filter.html)s and still want other routes to be //! matchable in the case a predicate doesn't hold. //! //! # Example //! //! ``` //! use warp::Filter; //! //! // Filter on `/:id`, but reject with 400 if the `id` is `0`. //! let route = warp::path::param() //! .and_then(|id: u32| { //! if id == 0 { //! Err(warp::reject()) //! } else { //! Ok("something since id is valid") //! } //! }); //! ``` use http; use ::never::Never; pub(crate) use self::sealed::{CombineRejection, Reject}; /// Rejects a request with a default `400 Bad Request`. #[inline] pub fn reject() -> Rejection { bad_request() } /// Rejects a request with `400 Bad Request`. #[inline] pub fn bad_request() -> Rejection { Reason::BAD_REQUEST.into() } /// Rejects a request with `404 Not Found`. #[inline] pub fn not_found() -> Rejection { Reason::empty().into() } // 405 Method Not Allowed #[inline] pub(crate) fn method_not_allowed() -> Rejection { Reason::METHOD_NOT_ALLOWED.into() } // 411 Length Required #[inline] pub(crate) fn length_required() -> Rejection { Reason::LENGTH_REQUIRED.into() } // 413 Payload Too Large #[inline] pub(crate) fn payload_too_large() -> Rejection { Reason::PAYLOAD_TOO_LARGE.into() } // 415 Unsupported Media Type // // Used by the body filters if the request payload content-type doesn't match // what can be deserialized. #[inline] pub(crate) fn unsupported_media_type() -> Rejection { Reason::UNSUPPORTED_MEDIA_TYPE.into() } /// Rejects a request with `500 Internal Server Error`. #[inline] pub fn server_error() -> Rejection { Reason::SERVER_ERROR.into() } /// Rejection of a request by a [`Filter`](::Filter). #[derive(Debug)] pub struct Rejection { reason: Reason, } bitflags! { struct Reason: u8 { // NOT_FOUND = 0 const BAD_REQUEST = 0b00000001; const METHOD_NOT_ALLOWED = 0b00000010; const LENGTH_REQUIRED = 0b00000100; const PAYLOAD_TOO_LARGE = 0b00001000; const UNSUPPORTED_MEDIA_TYPE = 0b00010000; const SERVER_ERROR = 0b10000000; } } impl Rejection { /// Return the HTTP status code that this rejection represents. pub fn status(&self) -> http::StatusCode { Reject::status(self) } } #[doc(hidden)] impl From<Reason> for Rejection { #[inline] fn from(reason: Reason) -> Rejection { Rejection { reason, } } } impl From<Never> for Rejection { #[inline] fn from(never: Never) -> Rejection { match never {} } } impl Reject for Never { fn status(&self) -> http::StatusCode { match *self {} } fn into_response(self) -> ::reply::Response { match self {} } } impl Reject for Rejection { fn status(&self) -> http::StatusCode { if self.reason.contains(Reason::SERVER_ERROR) { http::StatusCode::INTERNAL_SERVER_ERROR } else if self.reason.contains(Reason::UNSUPPORTED_MEDIA_TYPE) { http::StatusCode::UNSUPPORTED_MEDIA_TYPE } else if self.reason.contains(Reason::LENGTH_REQUIRED) { http::StatusCode::LENGTH_REQUIRED } else if self.reason.contains(Reason::PAYLOAD_TOO_LARGE) { http::StatusCode::PAYLOAD_TOO_LARGE } else if self.reason.contains(Reason::BAD_REQUEST) { http::StatusCode::BAD_REQUEST } else if self.reason.contains(Reason::METHOD_NOT_ALLOWED) { http::StatusCode::METHOD_NOT_ALLOWED } else { debug_assert!(self.reason.is_empty()); http::StatusCode::NOT_FOUND } } fn into_response(self) -> ::reply::Response { let code = self.status(); let mut res = http::Response::default(); *res.status_mut() = code; res } } mod sealed { use ::never::Never; use super::Rejection; pub trait Reject: ::std::fmt::Debug + Send { fn status(&self) -> ::http::StatusCode; fn into_response(self) -> ::reply::Response; } fn _assert_object_safe() { fn _assert(_: &Reject) {} } pub trait CombineRejection<E>: Send + Sized { type Rejection: Reject + From<Self> + From<E>; fn combine(self, other: E) -> Self::Rejection; } impl CombineRejection<Rejection> for Rejection { type Rejection = Rejection; fn combine(self, other: Rejection) -> Self::Rejection { Rejection { reason: self.reason | other.reason, } } } impl CombineRejection<Never> for Rejection { type Rejection = Rejection; fn combine(self, other: Never) -> Self::Rejection { match other {} } } impl CombineRejection<Rejection> for Never { type Rejection = Rejection; fn combine(self, _: Rejection) -> Self::Rejection { match self {} } } impl CombineRejection<Never> for Never { type Rejection = Never; fn combine(self, _: Never) -> Self::Rejection { match self {} } } }
#[cfg(windows)] fn main() { println!("cargo:rustc-link-search=native=./"); println!("cargo:rustc-link-lib=static=sciter.static"); println!("cargo:rustc-link-lib=comdlg32"); println!("cargo:rustc-link-lib=wininet"); println!("cargo:rustc-link-lib=windowscodecs"); } #[cfg(not(windows))] fn main() {}
use std::time::{Duration, Instant}; enum Event { Key(crate::Keys), Delete, Finished, } pub struct Res { text: text::Text, inputs: Vec<(Event, Duration)>, last_input: Option<Instant>, } impl Res { pub fn new(text: text::Text) -> Self { Res { text: text, inputs: Vec::new(), last_input: None, } } pub fn keys(&mut self, k: crate::Keys) { self.event(Event::Key(k)); } pub fn delete(&mut self) { self.event(Event::Delete); } pub fn finished(&mut self) { self.event(Event::Finished); } fn event(&mut self, e: Event) { if let Some(t) = self.last_input { self.inputs.push((e, t.elapsed())); } self.last_input = Some(Instant::now()); } pub fn source(&self) -> &str { &self.text.source } /// each time a key was typed pub fn total_hits(&self) -> u32 { self.inputs.len() as u32 } /// each time you typped a good key pub fn total_good_hits(&self) -> u32 { self.inputs.iter().fold(0, |acc, (ev, _)| match ev { Event::Key(crate::Keys::Valid(_)) | Event::Finished => acc + 1, _ => acc, }) } /// each time you made an error pub fn total_errors(&self) -> u32 { self.inputs.iter().fold(0, |acc, (ev, _)| match ev { Event::Key(crate::Keys::Invalid(_)) => acc + 1, _ => acc, }) } /// each useless key you typped because you were in an invalid state pub fn useless_hits(&self) -> u32 { self.inputs.iter().fold(0, |acc, (ev, _)| match ev { Event::Key(crate::Keys::Valid(_)) | Event::Finished => acc, _ => acc + 1, }) } /// the percentage of mistakes, lower is better pub fn precision(&self) -> f32 { let good_hits = self.total_good_hits() as f32; let total = self.total_hits() as f32; good_hits / total * 100.0 } /// total time pub fn total_duration(&self) -> Duration { self.inputs .iter() .fold(Duration::new(0, 0), |acc, (_, time)| acc + *time) } /// time lost typping errors pub fn time_lost_in_errors(&self) -> Duration { self.inputs .iter() .fold(Duration::new(0, 0), |acc, (ev, time)| match ev { Event::Key(crate::Keys::Valid(_)) | Event::Finished => acc, _ => acc + *time, }) } /// the percentage of total time lost in errors pub fn time_percentage_lost_in_errors(&self) -> f32 { let time_lost = self.time_lost_in_errors().as_millis() as f32; let total = self.total_duration().as_millis() as f32; time_lost / total * 100.0 } /// number of good keypress per seconds pub fn hits_per_seconds(&self) -> f32 { self.total_good_hits() as f32 / self.total_duration().as_millis() as f32 * 1000.0 } /// number of good keypress per minutes pub fn hits_per_minutes(&self) -> f32 { self.hits_per_seconds() * 60.0 } /// number of good word per minutes. This is an estimation computed considering the average /// word size has a length of 5 characters. pub fn word_per_minutes(&self) -> f32 { self.hits_per_minutes() / 5.0 } /// number of keypress per seconds pub fn theorical_hits_per_seconds(&self) -> f32 { self.total_hits() as f32 / self.total_duration().as_millis() as f32 * 1000.0 } /// number of keypress per minutes pub fn theorical_hits_per_minutes(&self) -> f32 { self.theorical_hits_per_seconds() * 60.0 } /// number of word you could have wrote per minutes if you didn’t made mistakes. This is /// an estimation computed considering the average word size has a length of 5 characters. pub fn theorical_word_per_minutes(&self) -> f32 { self.theorical_hits_per_minutes() / 5.0 } }
#[doc = "Register `AR` reader"] pub type R = crate::R<AR_SPEC>; #[doc = "Register `AR` writer"] pub type W = crate::W<AR_SPEC>; #[doc = "Field `ADDRESS` reader - Address Address to be sent to the external device. In HyperBus protocol, this field must be even as this protocol is 16-bit word oriented. In dual-memory configuration, AR\\[0\\] is forced to 1. Writes to this field are ignored when BUSY = 1 or when FMODE = 11 (Memory-mapped mode)."] pub type ADDRESS_R = crate::FieldReader<u32>; #[doc = "Field `ADDRESS` writer - Address Address to be sent to the external device. In HyperBus protocol, this field must be even as this protocol is 16-bit word oriented. In dual-memory configuration, AR\\[0\\] is forced to 1. Writes to this field are ignored when BUSY = 1 or when FMODE = 11 (Memory-mapped mode)."] pub type ADDRESS_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 32, O, u32>; impl R { #[doc = "Bits 0:31 - Address Address to be sent to the external device. In HyperBus protocol, this field must be even as this protocol is 16-bit word oriented. In dual-memory configuration, AR\\[0\\] is forced to 1. Writes to this field are ignored when BUSY = 1 or when FMODE = 11 (Memory-mapped mode)."] #[inline(always)] pub fn address(&self) -> ADDRESS_R { ADDRESS_R::new(self.bits) } } impl W { #[doc = "Bits 0:31 - Address Address to be sent to the external device. In HyperBus protocol, this field must be even as this protocol is 16-bit word oriented. In dual-memory configuration, AR\\[0\\] is forced to 1. Writes to this field are ignored when BUSY = 1 or when FMODE = 11 (Memory-mapped mode)."] #[inline(always)] #[must_use] pub fn address(&mut self) -> ADDRESS_W<AR_SPEC, 0> { ADDRESS_W::new(self) } #[doc = "Writes raw bits to the register."] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } } #[doc = "OCTOSPI address register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ar::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ar::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] pub struct AR_SPEC; impl crate::RegisterSpec for AR_SPEC { type Ux = u32; } #[doc = "`read()` method returns [`ar::R`](R) reader structure"] impl crate::Readable for AR_SPEC {} #[doc = "`write(|w| ..)` method takes [`ar::W`](W) writer structure"] impl crate::Writable for AR_SPEC { const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; } #[doc = "`reset()` method sets AR to value 0"] impl crate::Resettable for AR_SPEC { const RESET_VALUE: Self::Ux = 0; }
use num::{BigUint, FromPrimitive, ToPrimitive}; use util::factorial; pub fn run() -> u64 { let n = BigUint::from_u8(20).unwrap(); (factorial(BigUint::from_u8(2).unwrap() * n.clone()) / sq(factorial(n))).to_u64().unwrap() } fn sq(n: BigUint) -> BigUint { n.clone() * n }
#[derive(Debug, PartialEq)] pub struct City { pub size_in_sqm: u32 } impl City { pub fn new(size: u32) -> City { City { size_in_sqm: size } } } // pub fn compare_size(city: &City, city2: &City) -> &City { // if &city.size_in_sqm <= &city2.size_in_sqm { // city2 // } else { // city // } // } // since either city can be returned the input references must have the same lifetime to show relation pub fn compare_size_with_lifetimes<'a>(city: &'a City, city2: &'a City) -> (&'a City) { do_something_with_other_cities(city, city2); if &city.size_in_sqm <= &city2.size_in_sqm { city2 } else { city } } pub fn do_something_with_cities<'a, 'b, 'c>(city: &'a City, city2: &'b City, city3: &'c City) -> (&'b City) { //do something with other cities but retrun city2 city2 } fn do_something_with_other_cities<'a, 'b>(city: &'a City, city2: &'a City) -> u32 { city.size_in_sqm + city2.size_in_sqm } #[cfg(test)] mod tests { use super::*; #[test] fn compare_sizes_returns_largest_city() { let city1 = City::new(2); let city2 = City::new(4); let result = compare_size_with_lifetimes(&city1, &city2); assert_eq!(city2, *result); } #[test] fn do_something_with_other_cities_combines_sizes() { let city1 = City::new(2); let city2 = City::new(4); let result = do_something_with_other_cities(&city1, &city2); assert!(result == 6); } }
fn main() { let if_zero = false as i32; let if_one = true as i32; print!("{}\n{}", if_zero, if_one) }
use seed::prelude::*; use crate::chart; use crate::utils::*; use common::weather::WeatherEvent; type WeatherData = Vec<WeatherEvent>; #[derive(Clone, Debug)] pub enum Model { NotLoaded, Loading { duration: u32 }, Loaded { duration: u32, data: WeatherData }, Failed(String) } impl Default for Model { fn default() -> Self { Model::NotLoaded } } impl Model { fn selected_duration(&self) -> u32 { match self { Model::Loading { duration } => *duration, Model::Loaded { duration, data: _ } => *duration, _ => 0 } } } #[derive(Clone)] pub enum Message { Fetch { duration: u32 }, Fetched { duration: u32, data: WeatherData }, Failed(String) } fn chart(data: &Vec<WeatherEvent>, label: &str, y_min: Option<f64>, f: &dyn Fn(&WeatherEvent) -> f64) -> chart::Chart { chart::Chart { width: 600, height: 200, y_min, y_max: None, data: vec![ chart::Series { label: label.to_string(), data: data.iter().map(|e| chart::DataPoint { time: e.system_time(), value: f(e) }).collect() } ], bars: vec![] } } pub fn render(model: &Model) -> Node<Message> { let selected = model.selected_duration(); let buttons = vec![ (HOURS_6, "Last 6 Hours"), (DAY, "Last Day"), (DAYS_2, "Last 2 Days"), (WEEK, "Last Week") ]; div![ h2!["Weather"], buttons.iter().map(|(duration, title)| button![ attrs!{At::Class => if selected == *duration {SELECTED} else {UNSELECTED}}, simple_ev(Ev::Click, Message::Fetch { duration: *duration }), title ] ), match model { Model::NotLoaded => p![attrs!{At::Class => "placeholder"}, "Select a time range"], Model::Loading { duration: _ } => p![attrs!{At::Class => "placeholder"}, "Loading..."], Model::Failed(e) => p![attrs!{At::Class => "placeholder"}, e], Model::Loaded { duration: _, data } => { div![attrs!{At::Class => "chart"}, chart(data, "Temperature", Some(0.0), &|r| r.temperature) .render() .map_msg(|_| Message::Fetch { duration: DAY }), chart(data, "Humidity", Some(0.0), &|r| r.humidity) .render() .map_msg(|_| Message::Fetch { duration: DAY }), chart(data, "Barometric Pressure", None, &|r| r.pressure) .render() .map_msg(|_| Message::Fetch { duration: DAY }) ] } } ] } pub fn update(msg: Message, model: &mut Model, orders: &mut impl Orders<Message>) { match msg { Message::Fetch { duration } => { orders.perform_cmd(fetch_weather(duration)); *model = Model::Loading { duration }; } Message::Fetched { duration, data } => { *model = if data.is_empty() { Model::NotLoaded } else { Model::Loaded { duration, data } }; } Message::Failed(e) => { *model = Model::Failed(e); } } } pub fn after_mount(orders: &mut impl Orders<Message>) { orders.send_msg(Message::Fetch { duration: DAY }); } async fn fetch_weather(duration: u32) -> Message { let request = Request::new(format!("/api/weather/-{}/-0", duration)); match fetch(request).await { Err(e) => Message::Failed(format!("Failed to fetch weather: {:?}", e)), Ok(response) => response.json::<Vec<WeatherEvent>>().await .map_or_else( |e| Message::Failed(format!("Failed to parse weather data: {:?}", e)), |data| Message::Fetched { duration, data } ) } }
/* SPDX-License-Identifier: Apache-2.0 OR MIT Copyright 2020 The arboard contributors The project to which this file belongs is licensed under either of the Apache 2.0 or the MIT license at the licensee's choice. The terms and conditions of the chosen license apply to this file. */ use std::borrow::Cow; use std::convert::TryInto; use std::io::{self, Read, Seek}; use clipboard_win::Clipboard as SystemClipboard; use image::{ bmp::{BmpDecoder, BmpEncoder}, ColorType, ImageDecoder, }; use scopeguard::defer; use winapi::shared::minwindef::DWORD; use winapi::um::{ stringapiset::WideCharToMultiByte, winbase::{GlobalLock, GlobalSize, GlobalUnlock}, wingdi::{ CreateDIBitmap, DeleteObject, BITMAPV4HEADER, BI_BITFIELDS, CBM_INIT, CIEXYZTRIPLE, DIB_RGB_COLORS, }, winnls::CP_UTF8, winnt::LONG, winuser::{GetClipboardData, GetDC, SetClipboardData, CF_BITMAP, CF_UNICODETEXT}, }; use super::common::{Error, ImageData}; const MAX_OPEN_ATTEMPTS: usize = 5; const BITMAP_FILE_HEADER_SIZE: usize = 14; //const BITMAP_INFO_HEADER_SIZE: usize = 40; const BITMAP_V4_INFO_HEADER_SIZE: u32 = 108; struct FakeBitmapFile { file_header: [u8; BITMAP_FILE_HEADER_SIZE], bitmap: Vec<u8>, curr_pos: usize, } impl FakeBitmapFile { fn len(&self) -> usize { self.file_header.len() + self.bitmap.len() } } impl Seek for FakeBitmapFile { fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> { match pos { io::SeekFrom::Start(p) => self.curr_pos = p as usize, io::SeekFrom::End(p) => self.curr_pos = self.len() + p as usize, io::SeekFrom::Current(p) => self.curr_pos += p as usize, } Ok(self.curr_pos as u64) } } impl Read for FakeBitmapFile { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { let remaining = self.len() - self.curr_pos; let total_read_len = buf.len().min(remaining); let mut buf_pos = 0; if total_read_len == 0 { return Ok(0); } // Read from the header if self.curr_pos < self.file_header.len() { let copy_len = (self.file_header.len() - self.curr_pos).min(total_read_len); let header_end = self.curr_pos + copy_len; buf[0..copy_len].copy_from_slice(&self.file_header[self.curr_pos..header_end]); buf_pos += copy_len; self.curr_pos += copy_len; } // Read from the bitmap let remaining_read_len = total_read_len - buf_pos; if remaining_read_len > 0 { let bitmap_start = self.curr_pos - self.file_header.len(); if bitmap_start < self.bitmap.len() { let copy_len = (self.bitmap.len() - bitmap_start).min(remaining_read_len); let bitmap_end = bitmap_start + copy_len; let buf_end = buf_pos + copy_len; buf[buf_pos..buf_end].copy_from_slice(&self.bitmap[bitmap_start..bitmap_end]); self.curr_pos += copy_len; } } Ok(total_read_len) } } unsafe fn add_cf_bitmap(image: &ImageData) -> Result<(), Error> { let header = BITMAPV4HEADER { bV4Size: std::mem::size_of::<BITMAPV4HEADER>() as _, bV4Width: image.width as LONG, bV4Height: -(image.height as LONG), bV4Planes: 1, bV4BitCount: 32, bV4V4Compression: BI_BITFIELDS, bV4SizeImage: (4 * image.width * image.height) as DWORD, bV4XPelsPerMeter: 3000, bV4YPelsPerMeter: 3000, bV4ClrUsed: 0, bV4ClrImportant: 3, bV4RedMask: 0xff0000, bV4GreenMask: 0x00ff00, bV4BlueMask: 0x0000ff, bV4AlphaMask: 0x000000, bV4CSType: 0, bV4Endpoints: std::mem::MaybeUninit::<CIEXYZTRIPLE>::zeroed().assume_init(), bV4GammaRed: 0, bV4GammaGreen: 0, bV4GammaBlue: 0, }; let hdc = GetDC(std::ptr::null_mut()); let hbitmap = CreateDIBitmap( hdc, &header as *const BITMAPV4HEADER as *const _, CBM_INIT, image.bytes.as_ptr() as *const _, &header as *const BITMAPV4HEADER as *const _, DIB_RGB_COLORS, ); if SetClipboardData(CF_BITMAP, hbitmap as _).is_null() { DeleteObject(hbitmap as _); return Err(Error::Unknown { description: String::from("Call to `SetClipboardData` returned NULL"), }); } Ok(()) } pub fn get_string(out: &mut Vec<u8>) -> Result<(), Error> { use std::mem; use std::ptr; // This pointer must not be free'd. let ptr = unsafe { GetClipboardData(CF_UNICODETEXT) }; if ptr.is_null() { return Err(Error::ContentNotAvailable); } unsafe { let data_ptr = GlobalLock(ptr); if data_ptr.is_null() { return Err(Error::Unknown { description: "GlobalLock on clipboard data returned null.".into(), }); } defer!( GlobalUnlock(ptr); ); let char_count = GlobalSize(ptr) as usize / mem::size_of::<u16>(); let storage_req_size = WideCharToMultiByte( CP_UTF8, 0, data_ptr as _, char_count as _, ptr::null_mut(), 0, ptr::null(), ptr::null_mut(), ); if storage_req_size == 0 { return Err(Error::ConversionFailure); } let storage_cursor = out.len(); out.reserve(storage_req_size as usize); let storage_ptr = out.as_mut_ptr().add(storage_cursor) as *mut _; let output_size = WideCharToMultiByte( CP_UTF8, 0, data_ptr as _, char_count as _, storage_ptr, storage_req_size, ptr::null(), ptr::null_mut(), ); if output_size == 0 { return Err(Error::ConversionFailure); } out.set_len(storage_cursor + storage_req_size as usize); //It seems WinAPI always supposed to have at the end null char. //But just to be safe let's check for it and only then remove. if let Some(last_byte) = out.last() { if *last_byte == 0 { out.set_len(out.len() - 1); } } } Ok(()) } pub struct WindowsClipboardContext; impl WindowsClipboardContext { pub(crate) fn new() -> Result<Self, Error> { Ok(WindowsClipboardContext) } pub(crate) fn get_text(&mut self) -> Result<String, Error> { // Using this nifty RAII object to open and close the clipboard. let _cb = SystemClipboard::new_attempts(MAX_OPEN_ATTEMPTS) .map_err(|_| Error::ClipboardOccupied)?; let mut result = String::new(); get_string(unsafe { result.as_mut_vec() })?; Ok(result) } pub(crate) fn set_text(&mut self, data: String) -> Result<(), Error> { let _cb = SystemClipboard::new_attempts(MAX_OPEN_ATTEMPTS) .map_err(|_| Error::ClipboardOccupied)?; clipboard_win::set(clipboard_win::formats::Unicode, data).map_err(|_| Error::Unknown { description: "Could not place the specified text to the clipboard".into(), }) } pub(crate) fn get_image(&mut self) -> Result<ImageData, Error> { let _cb = SystemClipboard::new_attempts(MAX_OPEN_ATTEMPTS) .map_err(|_| Error::ClipboardOccupied)?; let format = clipboard_win::formats::CF_DIB; let size; match clipboard_win::raw::size(format) { Some(s) => size = s, None => return Err(Error::ContentNotAvailable), } let mut data = vec![0u8; size.into()]; clipboard_win::raw::get(format, &mut data).map_err(|_| Error::Unknown { description: "failed to get image data from the clipboard".into(), })?; let info_header_size = u32::from_le_bytes(data[..4].try_into().unwrap()); let mut fake_bitmap_file = FakeBitmapFile { bitmap: data, file_header: [0; BITMAP_FILE_HEADER_SIZE], curr_pos: 0 }; fake_bitmap_file.file_header[0] = b'B'; fake_bitmap_file.file_header[1] = b'M'; let file_size = u32::to_le_bytes((fake_bitmap_file.bitmap.len() + BITMAP_FILE_HEADER_SIZE) as u32); fake_bitmap_file.file_header[2..6].copy_from_slice(&file_size); let data_offset = u32::to_le_bytes(info_header_size + BITMAP_FILE_HEADER_SIZE as u32); fake_bitmap_file.file_header[10..14].copy_from_slice(&data_offset); let bmp_decoder = BmpDecoder::new(fake_bitmap_file).unwrap(); let (w, h) = bmp_decoder.dimensions(); let width = w as usize; let height = h as usize; let image = image::DynamicImage::from_decoder(bmp_decoder).map_err(|_| Error::ConversionFailure)?; Ok(ImageData { width, height, bytes: Cow::from(image.into_rgba8().into_raw()) }) } pub(crate) fn set_image(&mut self, image: ImageData) -> Result<(), Error> { //let clipboard = SystemClipboard::new()?; let mut bmp_data = Vec::with_capacity(image.bytes.len()); let mut cursor = std::io::Cursor::new(&mut bmp_data); let mut encoder = BmpEncoder::new(&mut cursor); encoder .encode(&image.bytes, image.width as u32, image.height as u32, ColorType::Rgba8) .map_err(|_| Error::ConversionFailure)?; let data_without_file_header = &bmp_data[BITMAP_FILE_HEADER_SIZE..]; let header_size = u32::from_le_bytes(data_without_file_header[..4].try_into().unwrap()); let format = if header_size > BITMAP_V4_INFO_HEADER_SIZE { clipboard_win::formats::CF_DIBV5 } else { clipboard_win::formats::CF_DIB }; let mut result: Result<(), Error> = Ok(()); //let mut success = false; clipboard_win::with_clipboard(|| { let success = clipboard_win::raw::set(format, data_without_file_header).is_ok(); let bitmap_result = unsafe { add_cf_bitmap(&image) }; if bitmap_result.is_err() && !success { result = Err(Error::Unknown { description: "Could not set the image for the clipboard in neither of `CF_DIB` and `CG_BITMAP` formats.".into(), }); } }) .map_err(|_| Error::ClipboardOccupied)?; result } }
use crate::*; use sqlx::SqlitePool; mod models; pub use models::*; mod findable; pub use findable::*; pub(crate) async fn user_from_discord_user_id( discord_user_id: i64, db_pool: &SqlitePool, ) -> Result<QueryOnRead<User>, sqlx::Error> { let existing_user_id: Option<i64> = sqlx::query!( "SELECT user_id FROM UserDiscordLinks WHERE external_discord_user_id = ?", discord_user_id, ) .fetch_optional(db_pool) .await? .map(|x| x.user_id); if let Some(existing_user_id) = existing_user_id { Ok(existing_user_id.into()) } else { let user: User = sqlx::query_as!(User, "INSERT INTO Users DEFAULT VALUES RETURNING *",) .fetch_one(db_pool) .await?; sqlx::query!( "INSERT INTO UserDiscordLinks (user_id, external_discord_user_id) VALUES (?, ?)", user.id, discord_user_id ) .fetch_optional(db_pool) .await?; Ok(user.into()) } } pub(crate) async fn user_twitch_link_from_user( user: &QueryOnRead<User>, db_pool: &SqlitePool, ) -> Result<Option<UserTwitchLink>, sqlx::Error> { let user_id = user.id(); sqlx::query_as!( UserTwitchLink, "SELECT * FROM UserTwitchLinks WHERE user_id = ?", user_id ) .fetch_optional(db_pool) .await } pub(crate) async fn user_github_link_from_user( user: &QueryOnRead<User>, db_pool: &SqlitePool, ) -> Result<Option<UserGithubLink>, sqlx::Error> { let user_id = user.id(); sqlx::query_as!( UserGithubLink, "SELECT * FROM UserGithubLinks WHERE user_id = ?", user_id ) .fetch_optional(db_pool) .await }
use std::path::Path; use serde::de::DeserializeOwned; use std::fs::OpenOptions; use std::error::Error; use std::str; pub fn deserialize_object<T>(source_path: impl AsRef<Path>) -> Result<T, Box<dyn Error>> where T: DeserializeOwned, { let file = OpenOptions::new().read(true).open(source_path.as_ref())?; let mmap = unsafe { ::memmap::Mmap::map(&file) }?; let content = str::from_utf8(&mmap)?; let object = ::serde_json::from_str(content)?; Ok(object) } pub fn fast_read(source_path: impl AsRef<Path>) -> Result<String, Box<dyn Error>> { let file = OpenOptions::new().read(true).open(source_path.as_ref())?; let mmap = unsafe { ::memmap::Mmap::map(&file) }?; Ok(str::from_utf8(&mmap)?.to_owned()) }
extern crate rustc_serialize; extern crate hyper; use rustc_serialize::json; use rustc_serialize::json::Json; #[macro_use] extern crate nickel; use nickel::status::StatusCode; use nickel::{Nickel, HttpRouter, MediaType, JsonBody}; #[derive(RustcDecodable, RustcEncodable)] struct Todo { status: i32, title: String, } fn main() { let mut server = Nickel::new(); let mut router = Nickel::router(); // index router.get("/api/todos", middleware! { |_, mut _res| let mut v: Vec<Todo> = vec![]; let todo1 = Todo{ status: 0, title: "Shopping".to_string(), }; v.push(todo1); let todo2 = Todo{ status: 1, title: "Movie".to_string(), }; v.push(todo2); let json_obj = json::encode(&v).unwrap(); _res.set(MediaType::Json); _res.set(StatusCode::Ok); return _res.send(json_obj); }); // detail router.get("/api/todos/:id", middleware! { |_req, mut _res| let id = _req.param("id"); println!("id: {:?}", id); let todo1 = Todo{ status: 0, title: "Shopping".to_string(), }; let json_obj = json::encode(&todo1).unwrap(); _res.set(MediaType::Json); _res.set(StatusCode::Ok); return _res.send(json_obj); }); // delete router.delete("/api/todos/:id", middleware! { |_req, mut _res| let id = _req.param("id"); println!("delete id: {:?}", id); let json_obj = Json::from_str("{}").unwrap(); _res.set(MediaType::Json); _res.set(StatusCode::Ok); return _res.send(json_obj); }); // create router.post("/api/todos", middleware! { |_req, mut _res| let todo = _req.json_as::<Todo>().unwrap(); let status = todo.status; let title = todo.title.to_string(); println!("create status {:?} title {}", status, title); let json_obj = Json::from_str("{}").unwrap(); _res.set(MediaType::Json); _res.set(StatusCode::Created); return _res.send(json_obj); }); // update router.put("/api/todos/:id", middleware! { |_req, mut _res| let todo = _req.json_as::<Todo>().unwrap(); let status = todo.status; let title = todo.title.to_string(); println!("update status {:?} title {}", status, title); let json_obj = Json::from_str("{}").unwrap(); _res.set(MediaType::Json); _res.set(StatusCode::Ok); return _res.send(json_obj); }); server.utilize(router); server.listen("127.0.0.1:6767"); }
//! The load option iterator. use crate::error::GetLoadOptionError; use crate::Adapter; use crate::LoadOption; use std::iter::Iterator; /// The load option iterator. pub struct LoadOptionIter<'a, I> where I: Iterator<Item = u16>, { /// The adapter reference. adapter: &'a Adapter, /// The numeric iterator to go over the boot options. number_iter: I, } impl<'a, I> Iterator for LoadOptionIter<'a, I> where I: Iterator<Item = u16>, { type Item = Result<LoadOption, GetLoadOptionError>; fn next(&mut self) -> Option<Self::Item> { loop { let number = match self.number_iter.next() { None => return None, Some(number) => number, }; match self.adapter.get_load_option(number) { Ok(Some(load_option)) => return Some(Ok(load_option)), Ok(None) => continue, // skip to the next value Err(err) => return Some(Err(err)), }; } } } impl<'a, I> LoadOptionIter<'a, I> where I: Iterator<Item = u16>, { /// Construct a new [`Self`] with the number iterator. pub fn with_number_iter(adapter: &'a Adapter, number_iter: I) -> Self { Self { adapter, number_iter, } } }
// mod human #[repr(C)] struct Brain { /*Internal State*/ pub fn get_next_move() -> Option<Direction> { /* * Things to consider: * 1. Meeting people -> * lower priority as neared to 300 friends * gender matters a bit * share 'some' of past experience * uses the 'Eye' to see if anyone near, talk with 'Mouth', the other party listens * with 'Ear', most probably you will be 'friends', the more talk the higher chance * 2. Observation (the original code logic) * random direction * 3. Ambition/Goal -> * 'Knowledge' (go to library), 'Mathematics' (reach mathematicians), 'Astronomy', * 'Mingle with people', 'Anime' (stays at current place, watches TV), 'Earn money', * 'Medidate' (attained universe's knowledge, no more moves, shares this knowledge * with people who come) * 4. Prev Goal (ie. prev direction) **/ unimplemented!(); } }
#[doc = "Register `LTDC_ICR` writer"] pub type W = crate::W<LTDC_ICR_SPEC>; #[doc = "Field `CLIF` writer - CLIF"] pub type CLIF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CFUIF` writer - CFUIF"] pub type CFUIF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CTERRIF` writer - CTERRIF"] pub type CTERRIF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CRRIF` writer - CRRIF"] pub type CRRIF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; impl W { #[doc = "Bit 0 - CLIF"] #[inline(always)] #[must_use] pub fn clif(&mut self) -> CLIF_W<LTDC_ICR_SPEC, 0> { CLIF_W::new(self) } #[doc = "Bit 1 - CFUIF"] #[inline(always)] #[must_use] pub fn cfuif(&mut self) -> CFUIF_W<LTDC_ICR_SPEC, 1> { CFUIF_W::new(self) } #[doc = "Bit 2 - CTERRIF"] #[inline(always)] #[must_use] pub fn cterrif(&mut self) -> CTERRIF_W<LTDC_ICR_SPEC, 2> { CTERRIF_W::new(self) } #[doc = "Bit 3 - CRRIF"] #[inline(always)] #[must_use] pub fn crrif(&mut self) -> CRRIF_W<LTDC_ICR_SPEC, 3> { CRRIF_W::new(self) } #[doc = "Writes raw bits to the register."] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } } #[doc = "LTDC Interrupt Clear Register\n\nYou can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ltdc_icr::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] pub struct LTDC_ICR_SPEC; impl crate::RegisterSpec for LTDC_ICR_SPEC { type Ux = u32; } #[doc = "`write(|w| ..)` method takes [`ltdc_icr::W`](W) writer structure"] impl crate::Writable for LTDC_ICR_SPEC { const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; } #[doc = "`reset()` method sets LTDC_ICR to value 0"] impl crate::Resettable for LTDC_ICR_SPEC { const RESET_VALUE: Self::Ux = 0; }
use protobuf; use protobuf::CodedInputStream; use protobuf::CodedOutputStream; use misc::*; pub fn protobuf_message_read < Type: protobuf::MessageStatic, NameFunction: Fn () -> String, > ( coded_input_stream: & mut CodedInputStream, name_function: NameFunction, ) -> Result <Type, String> { let message_length = protobuf_result_with_prefix ( || format! ( "Error reading {} length: ", name_function ()), coded_input_stream.read_raw_varint32 (), ) ?; let old_limit = protobuf_result_with_prefix ( || format! ( "Error preparing to read {}: ", name_function ()), coded_input_stream.push_limit ( message_length as u64), ) ?; let message = protobuf_result_with_prefix ( || format! ( "Error reading {}: ", name_function ()), protobuf::core::parse_from::<Type> ( coded_input_stream), ) ?; coded_input_stream.pop_limit ( old_limit); Ok (message) } #[ inline ] pub fn protobuf_message_write < NameFunction: Fn () -> String, Type: protobuf::MessageStatic, > ( name_function: NameFunction, coded_output_stream: & mut CodedOutputStream, message: & Type, ) -> Result <(), String> { // write size protobuf_result_with_prefix ( || format! ( "Error writing {} size", name_function ()), coded_output_stream.write_raw_varint32 ( message.compute_size ()), ) ?; // write message protobuf_result_with_prefix ( || format! ( "Error writing {}", name_function ()), message.write_to_with_cached_sizes ( coded_output_stream), ) ?; // return Ok (()) } // ex: noet ts=4 filetype=rust
use crate::tokens::{CommentKind, Keyword, NumberKind, Punct}; #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub enum RawToken { /// `true` of `false` Boolean(bool), /// The end of the file EoF, /// An identifier this will be either a variable name /// or a function/method name Ident, /// A word that has been reserved to not be used as an identifier Keyword(RawKeyword), /// A `null` literal value Null, /// A number, this includes integers (`1`), decimals (`0.1`), /// hex (`0x8f`), binary (`0b010011010`), and octal (`0o273`) Number(NumberKind), /// A punctuation mark, this includes all mathematical operators /// logical operators and general syntax punctuation Punct(Punct), /// A string literal, either double or single quoted, the associated /// value will be the unquoted string String { kind: StringKind, new_line_count: usize, last_len: usize, found_octal_escape: bool, }, /// A regular expression literal. /// ```js /// let regex = /[a-zA-Z]+/g; /// ``` RegEx(usize), /// The string parts of a template string /// ```js /// `things and stuff times ${10}` /// // ^^^^^^^^^^^^^^^^^^^^^^ ^ /// ``` Template { kind: TemplateKind, new_line_count: usize, last_len: usize, has_octal_escape: bool, found_invalid_unicode_escape: bool, found_invalid_hex_escape: bool, }, /// A comment, the associated value will contain the raw comment /// This will capture both inline comments `// I am an inline comment` /// and multi-line comments /// ```js /// /*multi lines /// * comments /// */ /// ``` Comment { kind: CommentKind, new_line_count: usize, last_len: usize, end_index: usize, }, } impl Copy for Keyword<()> {} impl RawToken { pub fn is_punct(&self) -> bool { matches!(self, RawToken::Punct(_)) } pub fn is_comment(&self) -> bool { matches!(self, RawToken::Comment { .. }) } pub fn is_div_punct(&self) -> bool { matches!( self, RawToken::Punct(Punct::ForwardSlash | Punct::ForwardSlashEqual) ) } } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum StringKind { Double, Single, } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum TemplateKind { NoSub, Head, Body, Tail, } #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub enum RawKeyword { Await, Break, Case, Catch, Class, Const, Continue, Debugger, Default, Delete, Do, Else, Enum, Export, Extends, Finally, For, Function, If, Implements, Import, In, InstanceOf, Interface, Let, New, Package, Private, Protected, Public, Return, Static, Super, Switch, This, Throw, Try, TypeOf, Var, Void, While, With, Yield, } impl RawKeyword { pub fn with_str(self, s: &str) -> crate::tokens::Keyword<&str> { match self { RawKeyword::Await => Keyword::Await(s), RawKeyword::Break => Keyword::Break(s), RawKeyword::Case => Keyword::Case(s), RawKeyword::Catch => Keyword::Catch(s), RawKeyword::Class => Keyword::Class(s), RawKeyword::Const => Keyword::Const(s), RawKeyword::Continue => Keyword::Continue(s), RawKeyword::Debugger => Keyword::Debugger(s), RawKeyword::Default => Keyword::Default(s), RawKeyword::Delete => Keyword::Delete(s), RawKeyword::Do => Keyword::Do(s), RawKeyword::Else => Keyword::Else(s), RawKeyword::Enum => Keyword::Enum(s), RawKeyword::Export => Keyword::Export(s), RawKeyword::Extends => Keyword::Extends(s), RawKeyword::Finally => Keyword::Finally(s), RawKeyword::For => Keyword::For(s), RawKeyword::Function => Keyword::Function(s), RawKeyword::If => Keyword::If(s), RawKeyword::Implements => Keyword::Implements(s), RawKeyword::Import => Keyword::Import(s), RawKeyword::In => Keyword::In(s), RawKeyword::InstanceOf => Keyword::InstanceOf(s), RawKeyword::Interface => Keyword::Interface(s), RawKeyword::Let => Keyword::Let(s), RawKeyword::New => Keyword::New(s), RawKeyword::Package => Keyword::Package(s), RawKeyword::Private => Keyword::Private(s), RawKeyword::Protected => Keyword::Protected(s), RawKeyword::Public => Keyword::Public(s), RawKeyword::Return => Keyword::Return(s), RawKeyword::Static => Keyword::Static(s), RawKeyword::Super => Keyword::Super(s), RawKeyword::Switch => Keyword::Switch(s), RawKeyword::This => Keyword::This(s), RawKeyword::Throw => Keyword::Throw(s), RawKeyword::Try => Keyword::Try(s), RawKeyword::TypeOf => Keyword::TypeOf(s), RawKeyword::Var => Keyword::Var(s), RawKeyword::Void => Keyword::Void(s), RawKeyword::While => Keyword::While(s), RawKeyword::With => Keyword::With(s), RawKeyword::Yield => Keyword::Yield(s), } } } impl<T> From<&Keyword<T>> for RawKeyword { fn from(k: &Keyword<T>) -> Self { match k { Keyword::Await(_) => RawKeyword::Await, Keyword::Break(_) => RawKeyword::Break, Keyword::Case(_) => RawKeyword::Case, Keyword::Catch(_) => RawKeyword::Catch, Keyword::Class(_) => RawKeyword::Class, Keyword::Const(_) => RawKeyword::Const, Keyword::Continue(_) => RawKeyword::Continue, Keyword::Debugger(_) => RawKeyword::Debugger, Keyword::Default(_) => RawKeyword::Default, Keyword::Delete(_) => RawKeyword::Delete, Keyword::Do(_) => RawKeyword::Do, Keyword::Else(_) => RawKeyword::Else, Keyword::Enum(_) => RawKeyword::Enum, Keyword::Export(_) => RawKeyword::Export, Keyword::Extends(_) => RawKeyword::Extends, Keyword::Finally(_) => RawKeyword::Finally, Keyword::For(_) => RawKeyword::For, Keyword::Function(_) => RawKeyword::Function, Keyword::If(_) => RawKeyword::If, Keyword::Implements(_) => RawKeyword::Implements, Keyword::Import(_) => RawKeyword::Import, Keyword::In(_) => RawKeyword::In, Keyword::InstanceOf(_) => RawKeyword::InstanceOf, Keyword::Interface(_) => RawKeyword::Interface, Keyword::Let(_) => RawKeyword::Let, Keyword::New(_) => RawKeyword::New, Keyword::Package(_) => RawKeyword::Package, Keyword::Private(_) => RawKeyword::Private, Keyword::Protected(_) => RawKeyword::Protected, Keyword::Public(_) => RawKeyword::Public, Keyword::Return(_) => RawKeyword::Return, Keyword::Static(_) => RawKeyword::Static, Keyword::Super(_) => RawKeyword::Super, Keyword::Switch(_) => RawKeyword::Switch, Keyword::This(_) => RawKeyword::This, Keyword::Throw(_) => RawKeyword::Throw, Keyword::Try(_) => RawKeyword::Try, Keyword::TypeOf(_) => RawKeyword::TypeOf, Keyword::Var(_) => RawKeyword::Var, Keyword::Void(_) => RawKeyword::Void, Keyword::While(_) => RawKeyword::While, Keyword::With(_) => RawKeyword::With, Keyword::Yield(_) => RawKeyword::Yield, } } }
//! A newtype with alignment of at least `A` bytes //! //! # Examples //! //! ``` //! use std::mem; //! //! use aligned_array::{Aligned, A2, A4, A16}; //! //! // Array aligned to a 2 byte boundary //! static X: Aligned<A2, [u8; 3]> = Aligned([0; 3]); //! //! // Array aligned to a 4 byte boundary //! static Y: Aligned<A4, [u8; 3]> = Aligned([0; 3]); //! //! // Unaligned array //! static Z: [u8; 3] = [0; 3]; //! //! // You can allocate the aligned arrays on the stack too //! let w: Aligned<A16, _> = Aligned([0u8; 3]); //! //! assert_eq!(mem::align_of_val(&X), 2); //! assert_eq!(mem::align_of_val(&Y), 4); //! assert_eq!(mem::align_of_val(&Z), 1); //! assert_eq!(mem::align_of_val(&w), 16); //! ``` #![deny(missing_docs)] #![deny(warnings)] #![cfg_attr(not(test), no_std)] use core::{ cmp::Ordering, fmt::{Debug, Display}, hash::{Hash, Hasher}, iter::{FromIterator, IntoIterator}, ops, }; use generic_array::{typenum, ArrayLength, GenericArray}; use typenum::{Diff, IsGreaterOrEqual, IsLessOrEqual, PartialDiv, Unsigned, B1, U8}; #[cfg(feature = "subtle")] pub use subtle; #[cfg(feature = "subtle")] use subtle::{Choice, ConstantTimeEq}; mod sealed; /// 2-byte alignment #[repr(C, align(2))] pub struct A2; /// 4-byte alignment #[repr(C, align(4))] pub struct A4; /// 8-byte alignment #[repr(C, align(8))] pub struct A8; /// 16-byte alignment #[repr(C, align(16))] pub struct A16; /// 32-byte alignment #[repr(C, align(32))] pub struct A32; /// 64-byte alignment #[repr(C, align(64))] pub struct A64; /// A newtype with alignment of at least `A` bytes #[repr(C)] pub struct Aligned<A, T> where T: ?Sized, { _alignment: [A; 0], value: T, } /// Changes the alignment of `value` to be at least `A` bytes #[allow(non_snake_case)] pub const fn Aligned<A, T>(value: T) -> Aligned<A, T> { Aligned { _alignment: [], value, } } impl<A, T> ops::Deref for Aligned<A, T> where A: sealed::Alignment, T: ?Sized, { type Target = T; #[inline] fn deref(&self) -> &T { &self.value } } impl<A, T> ops::DerefMut for Aligned<A, T> where A: sealed::Alignment, T: ?Sized, { #[inline] fn deref_mut(&mut self) -> &mut T { &mut self.value } } impl<A, T> ops::Index<ops::RangeTo<usize>> for Aligned<A, [T]> where A: sealed::Alignment, { type Output = Aligned<A, [T]>; fn index(&self, range: ops::RangeTo<usize>) -> &Aligned<A, [T]> { unsafe { &*(&self.value[range] as *const [T] as *const Aligned<A, [T]>) } } } impl<A, T> Clone for Aligned<A, T> where A: sealed::Alignment, T: Clone, { #[inline] fn clone(&self) -> Self { Self { _alignment: [], value: self.value.clone(), } } } impl<A, T> Default for Aligned<A, T> where A: sealed::Alignment, T: Default, { #[inline] fn default() -> Self { Self { _alignment: [], value: Default::default(), } } } impl<A, T> Debug for Aligned<A, T> where A: sealed::Alignment, T: Debug, { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.value.fmt(f) } } impl<A, T> Display for Aligned<A, T> where A: sealed::Alignment, T: Display, { #[inline] fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { self.value.fmt(f) } } impl<A, T> PartialEq for Aligned<A, T> where A: sealed::Alignment, T: PartialEq, { #[inline] fn eq(&self, other: &Self) -> bool { self.value == other.value } } impl<A, T> Eq for Aligned<A, T> where A: sealed::Alignment, T: Eq, { } impl<A, T> Hash for Aligned<A, T> where A: sealed::Alignment, T: Hash, { #[inline] fn hash<H: Hasher>(&self, state: &mut H) { self.value.hash(state); } } impl<A, T> Ord for Aligned<A, T> where A: sealed::Alignment, T: Ord, { #[inline] fn cmp(&self, other: &Self) -> Ordering { self.value.cmp(&other.value) } } impl<A, T> PartialOrd for Aligned<A, T> where A: sealed::Alignment, T: PartialOrd, { #[inline] fn partial_cmp(&self, other: &Self) -> Option<Ordering> { self.value.partial_cmp(&other.value) } } impl<A, T, V> FromIterator<V> for Aligned<A, T> where A: sealed::Alignment, T: FromIterator<V>, { fn from_iter<U: IntoIterator<Item = V>>(iter: U) -> Self { Aligned(T::from_iter(iter)) } } impl<A, T> IntoIterator for Aligned<A, T> where A: sealed::Alignment, T: IntoIterator, { type Item = T::Item; type IntoIter = T::IntoIter; fn into_iter(self) -> Self::IntoIter { self.value.into_iter() } } impl<'a, A, T> IntoIterator for &'a Aligned<A, T> where A: sealed::Alignment, &'a T: IntoIterator, { type Item = <&'a T as IntoIterator>::Item; type IntoIter = <&'a T as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { self.value.into_iter() } } impl<'a, A, T> IntoIterator for &'a mut Aligned<A, T> where A: sealed::Alignment, &'a mut T: IntoIterator, { type Item = <&'a mut T as IntoIterator>::Item; type IntoIter = <&'a mut T as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { self.value.into_iter() } } // Allow AsRef and AsMut for Aligned<A, T> when it is only making A smaller impl<'a, A, A2, T> AsRef<Aligned<A, T>> for &'a Aligned<A2, T> where A: sealed::Alignment, A2: sealed::Alignment, A::Num: IsLessOrEqual<A2::Num, Output = B1>, { #[inline] fn as_ref(&self) -> &Aligned<A, T> { assert_aligned(*self) } } // Allow AsRef and AsMut for Aligned<A, T> when it is only making A smaller impl<'a, A, A2, T> AsMut<Aligned<A, T>> for &'a mut Aligned<A2, T> where A: sealed::Alignment, A2: sealed::Alignment, A::Num: IsLessOrEqual<A2::Num, Output = B1>, { #[inline] fn as_mut(&mut self) -> &mut Aligned<A, T> { assert_aligned_mut(*self) } } /// Implement generic_array::GenericSequence for Aligned sequences unsafe impl<A, T, N> generic_array::sequence::GenericSequence<T> for Aligned<A, GenericArray<T, N>> where N: ArrayLength<T>, A: sealed::Alignment, { type Length = N; type Sequence = Self; #[inline] fn generate<F>(f: F) -> Self::Sequence where F: FnMut(usize) -> T, { Aligned(GenericArray::generate(f)) } } /// Implement generic_array::Split api for aligned bytes in a way that preserves aligment info /// TODO: This could be more generic, but we didn't need it yet. /// Instead of u8, a generic value T? unsafe impl<'a, A, N, K> generic_array::sequence::Split<u8, K> for &'a Aligned<A, GenericArray<u8, N>> where A: sealed::Alignment, N: ArrayLength<u8> + ops::Sub<K>, K: ArrayLength<u8> + PartialDiv<A::Num> + 'static, Diff<N, K>: ArrayLength<u8>, { type First = &'a Aligned<A, GenericArray<u8, K>>; type Second = &'a Aligned<A, GenericArray<u8, Diff<N, K>>>; #[inline] fn split(self) -> (Self::First, Self::Second) { // Correctness notes: // If self is aligned to A-byte boundary, and K is a multiple of A, // then `first`, the first K items of the array, is also aligned, // since its address is &self, // and `second`, the remaining items, are also aligned, since their // address differs from &self by a multiple of A. // This is true even if A does not divide N. let (first, second): (&GenericArray<u8, K>, &GenericArray<u8, Diff<N, K>>) = (&self.value).split(); (assert_aligned(first), assert_aligned(second)) } } /// Implement generic_array::Split API for aligned bytes in a way that preserves aligment info /// TODO: This could be more generic, but we didn't need it yet. /// Instead of u8, a generic value T? unsafe impl<'a, A, N, K> generic_array::sequence::Split<u8, K> for &'a mut Aligned<A, GenericArray<u8, N>> where A: sealed::Alignment, N: ArrayLength<u8> + ops::Sub<K>, K: ArrayLength<u8> + PartialDiv<A::Num> + 'static, Diff<N, K>: ArrayLength<u8>, { type First = &'a mut Aligned<A, GenericArray<u8, K>>; type Second = &'a mut Aligned<A, GenericArray<u8, Diff<N, K>>>; #[inline] fn split(self) -> (Self::First, Self::Second) { // Correctness notes: // If self is aligned to A-byte boundary, and K is a multiple of A, // then `first`, the first K items of the array, is also aligned, // since its address is &self, // and `second`, the remaining items, are also aligned, since their // address differs from &self by a multiple of A. // This is true even if A does not divide N. let (first, second): (&mut GenericArray<u8, K>, &mut GenericArray<u8, Diff<N, K>>) = (&mut self.value).split(); (assert_aligned_mut(first), assert_aligned_mut(second)) } } // Internal helper: Given &T, cast to &Aligned<A, T>. // In debug builds assert that the alignment claim is correct. #[inline] fn assert_aligned<A: sealed::Alignment, T>(t: &T) -> &Aligned<A, T> { unsafe { let ptr: *const T = t; assert!(ptr.align_offset(A::Num::USIZE) == 0); &*(ptr as *const Aligned<A, T>) } } // Internal helper: Given &mut T, cast to &mut Aligned<A, T>. // In debug builds assert that the alignment claim is correct. #[inline] fn assert_aligned_mut<A: sealed::Alignment, T>(t: &mut T) -> &mut Aligned<A, T> { unsafe { let ptr: *mut T = t; assert!(ptr.align_offset(A::Num::USIZE) == 0); &mut *(ptr as *mut Aligned<A, T>) } } /// Trait for types which can be viewed as native-endian integer slices /// This should generally just be, aligned slices of dumb bytes or similar. /// (Indeed the only intended implementor is Aligned<A8, GenericArray<u8, N>>) /// /// This should only be implemented when all the bytes in the underlying object /// can be accessed this way. So, the number of bytes should be divisible by 8 /// and aligned to an 8 byte boundary. /// /// TODO: This could be 3 traits instead, one for each integer type, /// but we didn't need that yet. pub trait AsNeSlice { /// Represent the value as native-endian u16's fn as_ne_u16_slice(&self) -> &[u16]; /// Represent the value as mutable native-endian u16's fn as_mut_ne_u16_slice(&mut self) -> &mut [u16]; /// Represent the value as native-endian u32's fn as_ne_u32_slice(&self) -> &[u32]; /// Represent the value as mutable native-endian u32's fn as_mut_ne_u32_slice(&mut self) -> &mut [u32]; /// Represent the value as native-endian u64's fn as_ne_u64_slice(&self) -> &[u64]; /// Represent the value as mutable native-endian u64's fn as_mut_ne_u64_slice(&mut self) -> &mut [u64]; } // Implement AsNeSlice for aligned bytes aligned at 8 bytes or larger impl<A, N> AsNeSlice for Aligned<A, GenericArray<u8, N>> where A: sealed::Alignment, A::Num: IsGreaterOrEqual<U8, Output = B1>, N: ArrayLength<u8> + PartialDiv<U8>, { #[inline] fn as_ne_u16_slice(&self) -> &[u16] { let (l, result, r) = unsafe { self.as_slice().align_to::<u16>() }; debug_assert!(l.is_empty()); debug_assert!(r.is_empty()); result } #[inline] fn as_mut_ne_u16_slice(&mut self) -> &mut [u16] { let (l, result, r) = unsafe { self.as_mut_slice().align_to_mut::<u16>() }; debug_assert!(l.is_empty()); debug_assert!(r.is_empty()); result } #[inline] fn as_ne_u32_slice(&self) -> &[u32] { let (l, result, r) = unsafe { self.as_slice().align_to::<u32>() }; debug_assert!(l.is_empty()); debug_assert!(r.is_empty()); result } #[inline] fn as_mut_ne_u32_slice(&mut self) -> &mut [u32] { let (l, result, r) = unsafe { self.as_mut_slice().align_to_mut::<u32>() }; debug_assert!(l.is_empty()); debug_assert!(r.is_empty()); result } #[inline] fn as_ne_u64_slice(&self) -> &[u64] { let (l, result, r) = unsafe { self.as_slice().align_to::<u64>() }; debug_assert!(l.is_empty()); debug_assert!(r.is_empty()); result } #[inline] fn as_mut_ne_u64_slice(&mut self) -> &mut [u64] { let (l, result, r) = unsafe { self.as_mut_slice().align_to_mut::<u64>() }; debug_assert!(l.is_empty()); debug_assert!(r.is_empty()); result } } /// Implement ct_eq for Aligned bytes implementing AsNeSlice /// /// Typically to invoke ct_eq on `Aligned<T>` you can `*` it to remove the aligned /// wrapper and then invoke `ct_eq`, there is no special implementation. /// /// In some cases, like aligned bytes, CtEq can be made faster by operating on 8 /// bytes at once, and it's nice to take advantage of that. #[cfg(feature = "subtle")] impl<A, N> ConstantTimeEq for Aligned<A, GenericArray<u8, N>> where A: sealed::Alignment, A::Num: IsGreaterOrEqual<U8, Output = B1>, N: ArrayLength<u8> + PartialDiv<U8>, { #[inline] fn ct_eq(&self, other: &Self) -> Choice { self.as_ne_u64_slice().ct_eq(&other.as_ne_u64_slice()) } } /// Trait for types which can be viewed as aligned chunks of bytes /// This should generally just be, larger chunks of dumb bytes or similar. pub trait AsAlignedChunks<A: sealed::Alignment, M: ArrayLength<u8> + PartialDiv<A::Num>> { /// Break self into aligned chunks of size M. /// This is not required to cover all the bytes of Self, /// trailing bytes that don't fit may be left off. fn as_aligned_chunks(&self) -> &[Aligned<A, GenericArray<u8, M>>]; /// Break self into mutable aligned chunks of size M. /// This is not required to cover all the bytes of Self, but must agree with /// as_aligned_chunks. fn as_mut_aligned_chunks(&mut self) -> &mut [Aligned<A, GenericArray<u8, M>>]; } // Implement AsAlignedChunks for Aligned GenericArray<u8, N> // // Note: If M does not divide N, then some of the bytes of Self won't be part // of any of the chunks. But this doesn't pose a problem for implementation, // and is helpful to some of the use-cases. impl<A, A2, N, M> AsAlignedChunks<A2, M> for Aligned<A, GenericArray<u8, N>> where A: sealed::Alignment, A2: sealed::Alignment, A2::Num: IsLessOrEqual<A::Num, Output = B1>, N: ArrayLength<u8>, M: ArrayLength<u8> + PartialDiv<A2::Num>, { #[inline] fn as_aligned_chunks(&self) -> &[Aligned<A2, GenericArray<u8, M>>] { unsafe { let ptr = self as *const Aligned<A, GenericArray<u8, N>> as *const Aligned<A2, GenericArray<u8, M>>; assert!(ptr.align_offset(A::Num::USIZE) == 0); assert!(M::USIZE > 0, "Division by zero"); // Correctness notes: // - Alignment of ptr is A, which exceeds A2 as required // - A2 divides M, so Aligned<A2, GenericArray<u8, M>> has no padding, and has size M. // - Size of buffer is at least N, which exceeds (N / M) * M. // - M is greater than 0, as it is NonZero and ArrayLength implies Unsigned core::slice::from_raw_parts(ptr, N::USIZE / M::USIZE) } } #[inline] fn as_mut_aligned_chunks(&mut self) -> &mut [Aligned<A2, GenericArray<u8, M>>] { unsafe { let ptr = self as *mut Aligned<A, GenericArray<u8, N>> as *mut Aligned<A2, GenericArray<u8, M>>; assert!(ptr.align_offset(A::Num::USIZE) == 0); assert!(M::USIZE > 0, "Division by zero"); // Correctness notes: // - Alignment of ptr is A, which exceeds A2 as required // - A2 divides M, so Aligned<A2, GenericArray<u8, M>> has no padding, and has size M. // - Size of buffer is at least N, which exceeds (N / M) * M. // - M is greater than 0, as it is NonZero and ArrayLength implies Unsigned core::slice::from_raw_parts_mut(ptr, N::USIZE / M::USIZE) } } } #[cfg(test)] mod testing { use super::*; use generic_array::arr; use core::mem; use generic_array::{ sequence::Split, typenum::{U128, U16, U192, U24, U32, U64, U8, U96}, }; // shorthand aliases to make it easier to write tests type A8Bytes<N> = Aligned<A8, GenericArray<u8, N>>; type A64Bytes<N> = Aligned<A64, GenericArray<u8, N>>; #[test] fn sanity() { let x: Aligned<A2, _> = Aligned([0u8; 3]); let y: Aligned<A4, _> = Aligned([0u8; 3]); let z: Aligned<A8, _> = Aligned([0u8; 3]); let w: Aligned<A16, _> = Aligned([0u8; 3]); // check alignment assert_eq!(mem::align_of_val(&x), 2); assert_eq!(mem::align_of_val(&y), 4); assert_eq!(mem::align_of_val(&z), 8); assert_eq!(mem::align_of_val(&w), 16); assert!(x.as_ptr() as usize % 2 == 0); assert!(y.as_ptr() as usize % 4 == 0); assert!(z.as_ptr() as usize % 8 == 0); assert!(w.as_ptr() as usize % 16 == 0); // test `deref` assert_eq!(x.len(), 3); assert_eq!(y.len(), 3); assert_eq!(z.len(), 3); assert_eq!(w.len(), 3); // alignment should be preserved after slicing let x: &Aligned<_, [_]> = &x; let y: &Aligned<_, [_]> = &y; let z: &Aligned<_, [_]> = &z; let w: &Aligned<_, [_]> = &w; let x: &Aligned<_, _> = &x[..2]; let y: &Aligned<_, _> = &y[..2]; let z: &Aligned<_, _> = &z[..2]; let w: &Aligned<_, _> = &w[..2]; assert!(x.as_ptr() as usize % 2 == 0); assert!(y.as_ptr() as usize % 4 == 0); assert!(z.as_ptr() as usize % 8 == 0); assert!(w.as_ptr() as usize % 16 == 0); // alignment should be preserved after boxing let x: Box<Aligned<A2, [u8]>> = Box::new(Aligned([0u8; 3])); let y: Box<Aligned<A4, [u8]>> = Box::new(Aligned([0u8; 3])); let z: Box<Aligned<A8, [u8]>> = Box::new(Aligned([0u8; 3])); let w: Box<Aligned<A16, [u8]>> = Box::new(Aligned([0u8; 3])); assert_eq!(mem::align_of_val(&*x), 2); assert_eq!(mem::align_of_val(&*y), 4); assert_eq!(mem::align_of_val(&*z), 8); assert_eq!(mem::align_of_val(&*w), 16); // test coercions let x: Aligned<A2, _> = Aligned([0u8; 3]); let y: &Aligned<A2, [u8]> = &x; let _: &[u8] = y; } #[test] fn aligned_split() { let x: A8Bytes<U24> = Aligned( arr![u8; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], ); let (y, z) = <&A8Bytes<U24> as Split<u8, U8>>::split(&x); assert_eq!(y, &Aligned(arr![u8; 0, 1, 2, 3, 4, 5, 6, 7])); assert_eq!( z, &Aligned(arr![u8; 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]) ); let (v, w) = <&A8Bytes<U24> as Split<u8, U16>>::split(&x); assert_eq!( v, &Aligned(arr![u8; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]) ); assert_eq!(w, &Aligned(arr![u8; 16, 17, 18, 19, 20, 21, 22, 23])); } #[test] fn aligned_split_64() { let mut x = A64Bytes::<U192>::default(); for (idx, byte) in x.iter_mut().enumerate() { *byte = idx as u8; } let (y, z) = <&A64Bytes<U192> as Split<u8, U64>>::split(&x); for (idx, byte) in y.iter().enumerate() { assert_eq!(*byte, idx as u8); } for (idx, byte) in z.iter().enumerate() { assert_eq!(*byte, 64 + idx as u8); } let (v, w) = <&A64Bytes<U192> as Split<u8, U128>>::split(&x); for (idx, byte) in v.iter().enumerate() { assert_eq!(*byte, idx as u8); } for (idx, byte) in w.iter().enumerate() { assert_eq!(*byte, 128 + idx as u8); } } #[test] fn test_aligned_chunks() { let buff = A8Bytes::<U32>::default(); let chunks = AsAlignedChunks::<A8, U16>::as_aligned_chunks(&buff); assert_eq!(chunks.len(), 2); let buff = A8Bytes::<U64>::default(); let chunks = AsAlignedChunks::<A8, U16>::as_aligned_chunks(&buff); assert_eq!(chunks.len(), 4); let buff = A8Bytes::<U96>::default(); let chunks = AsAlignedChunks::<A8, U8>::as_aligned_chunks(&buff); assert_eq!(chunks.len(), 12); } #[test] fn test_aligned_chunks_64() { let buff = A64Bytes::<U128>::default(); let chunks = AsAlignedChunks::<A64, U64>::as_aligned_chunks(&buff); assert_eq!(chunks.len(), 2); let buff = A64Bytes::<U64>::default(); let chunks = AsAlignedChunks::<A8, U8>::as_aligned_chunks(&buff); assert_eq!(chunks.len(), 8); let buff = A64Bytes::<U96>::default(); let chunks = AsAlignedChunks::<A32, U32>::as_aligned_chunks(&buff); assert_eq!(chunks.len(), 3); } // This test will only work on a little-endian machine #[cfg(target_arch = "x86_64")] #[test] fn test_as_ne_slice() { let mut buff = A8Bytes::<U32>::default(); { let u16s = buff.as_ne_u16_slice(); assert_eq!(u16s.len(), 16); for num in u16s.iter() { assert_eq!(*num, 0u16); } } { let u32s = buff.as_ne_u32_slice(); assert_eq!(u32s.len(), 8); for num in u32s.iter() { assert_eq!(*num, 0u32); } } { let u64s = buff.as_mut_ne_u64_slice(); assert_eq!(u64s.len(), 4); for num in u64s.iter() { assert_eq!(*num, 0u64); } u64s[2] = !7; } { let u64s = buff.as_ne_u64_slice(); assert_eq!(u64s.len(), 4); assert_eq!(u64s[0], 0u64); assert_eq!(u64s[1], 0u64); assert_eq!(u64s[2], !7u64); assert_eq!(u64s[3], 0u64); } { let u32s = buff.as_ne_u32_slice(); assert_eq!(u32s.len(), 8); assert_eq!(u32s[0], 0u32); assert_eq!(u32s[1], 0u32); assert_eq!(u32s[2], 0u32); assert_eq!(u32s[3], 0u32); assert_eq!(u32s[4], !7u32); assert_eq!(u32s[5], !0u32); assert_eq!(u32s[6], 0u32); assert_eq!(u32s[7], 0u32); } { let u16s = buff.as_ne_u16_slice(); assert_eq!(u16s.len(), 16); assert_eq!(u16s[0], 0u16); assert_eq!(u16s[1], 0u16); assert_eq!(u16s[2], 0u16); assert_eq!(u16s[3], 0u16); assert_eq!(u16s[4], 0u16); assert_eq!(u16s[5], 0u16); assert_eq!(u16s[6], 0u16); assert_eq!(u16s[7], 0u16); assert_eq!(u16s[8], !7u16); assert_eq!(u16s[9], !0u16); assert_eq!(u16s[10], !0u16); assert_eq!(u16s[11], !0u16); assert_eq!(u16s[12], 0u16); assert_eq!(u16s[13], 0u16); assert_eq!(u16s[14], 0u16); assert_eq!(u16s[15], 0u16); } { let u16s = buff.as_mut_ne_u16_slice(); u16s[2] = !5u16; } { let u32s = buff.as_ne_u32_slice(); assert_eq!(u32s.len(), 8); assert_eq!(u32s[0], 0u32); assert_eq!(u32s[1], !5u16 as u32); assert_eq!(u32s[2], 0u32); assert_eq!(u32s[3], 0u32); assert_eq!(u32s[4], !7u32); assert_eq!(u32s[5], !0u32); assert_eq!(u32s[6], 0u32); assert_eq!(u32s[7], 0u32); } { let u64s = buff.as_ne_u64_slice(); assert_eq!(u64s.len(), 4); assert_eq!(u64s[0], (!5u16 as u64) << 32); assert_eq!(u64s[1], 0u64); assert_eq!(u64s[2], !7u64); assert_eq!(u64s[3], 0u64); } } }
use std::cmp::min; fn read_line() -> String { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end().to_owned() } fn main() { let stdin = read_line(); let mut iter = stdin.split_whitespace(); let n: i64 = iter.next().unwrap().parse().unwrap(); let m: i64 = iter.next().unwrap().parse().unwrap(); let t: i64 = iter.next().unwrap().parse().unwrap(); let mut ans = "Yes"; let mut battery = n; let mut time = 0; for _ in 0..m { let stdin = read_line(); let mut iter = stdin.split_whitespace(); let a: i64 = iter.next().unwrap().parse().unwrap(); let b: i64 = iter.next().unwrap().parse().unwrap(); battery = battery - (a - time); if battery <= 0 { ans = "No"; break; } battery = min(n, battery + (b - a)); time = b; } battery = battery - (t - time); if battery <= 0 { ans = "No"; } println!("{}", ans); }
extern crate std; use super::super::prelude::{ LPCTSTR }; pub type Text = LPCTSTR;
use base64; use std::{error, fmt}; use serde_json; use openssl; #[derive(Debug)] pub enum Error { DecodeBase64(base64::DecodeError), DecodeJson(serde_json::Error), OpensslError(openssl::error::ErrorStack), InvalidToken, InvalidIssuer, InvalidAudience, InvalidSignature, NoMatchingSigningKey, UnsupportedAlgorithm, Expired, MissingField(&'static str), InvalidTypeField(&'static str), NoKeys } macro_rules! impl_from_error { ($f: ty, $e: expr) => { impl From<$f> for Error { fn from(f: $f) -> Error { $e(f) } } } } impl_from_error!(base64::DecodeError, Error::DecodeBase64); impl_from_error!(serde_json::Error, Error::DecodeJson); impl_from_error!(openssl::error::ErrorStack, Error::OpensslError); impl error::Error for Error { fn description(&self) -> &str { match *self { Error::DecodeBase64(ref err) => err.description(), Error::DecodeJson(ref err) => err.description(), Error::OpensslError(ref err) => err.description(), Error::InvalidToken => "Invalid Token", Error::InvalidIssuer => "Invalid Issuer", Error::InvalidAudience => "Invalid Audience", Error::InvalidSignature => "Invalid Signature", Error::Expired => "Expired", Error::UnsupportedAlgorithm => "Unsupported Algorithm", Error::NoMatchingSigningKey => "No Matching Signing Key", Error::MissingField(_) => "Missing Field", Error::InvalidTypeField(_) => "Invalid type on field", Error::NoKeys => "No Keys found", } } fn cause(&self) -> Option<&error::Error> { Some(match *self { Error::DecodeBase64(ref err) => err as &error::Error, Error::DecodeJson(ref err) => err as &error::Error, Error::OpensslError(ref err) => err as &error::Error, ref e => e as &error::Error, }) } } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Error::DecodeBase64(ref err) => fmt::Display::fmt(err, f), Error::DecodeJson(ref err) => fmt::Display::fmt(err, f), Error::OpensslError(ref err) => fmt::Display::fmt(err, f), Error::InvalidToken => write!(f, "{}", error::Error::description(self)), Error::InvalidIssuer => write!(f, "{}", error::Error::description(self)), Error::InvalidAudience => write!(f, "{}", error::Error::description(self)), Error::InvalidSignature => write!(f, "{}", error::Error::description(self)), Error::Expired => write!(f, "{}", error::Error::description(self)), Error::UnsupportedAlgorithm => write!(f, "{}", error::Error::description(self)), Error::NoMatchingSigningKey => write!(f, "{}", error::Error::description(self)), Error::MissingField(s) => write!(f, "Missing Field '{}'", s), Error::InvalidTypeField(s) => write!(f, "Invalid type on Field '{}'", s), Error::NoKeys => write!(f, "{}", error::Error::description(self)), } } }
// Unit testing for bitcountry currency, bitcountry treasury #[cfg(test)] use super::*; use frame_support::{assert_noop, assert_ok}; use mock::{Event, *}; use primitives::Balance; use sp_core::blake2_256; use sp_runtime::traits::BadOrigin; use sp_runtime::AccountId32; use sp_std::vec::Vec; fn get_mining_balance() -> Balance { Currencies::total_issuance(MiningCurrencyId::get()) } fn get_mining_balance_of(who: &AccountId) -> Balance { Currencies::free_balance(MiningCurrencyId::get(), who) } fn setup_minting_resource() -> DispatchResult { //Add ALICE as minting resource MiningModule::add_minting_origin(Origin::signed(ALICE), ALICE); Ok(()) } #[test] fn mint_mining_resource_should_work() { ExtBuilder::default().build().execute_with(|| { assert_ok!(setup_minting_resource()); let origin = Origin::signed(ALICE); assert_eq!(get_mining_balance(), 0); assert_ok!(MiningModule::mint(origin, 1000)); assert_eq!(get_mining_balance(), 1000); let event = mock::Event::mining(crate::Event::MiningResourceMinted(1000)); assert_eq!(last_event(), event); }); } #[test] fn burn_mining_resource_should_work() { ExtBuilder::default().build().execute_with(|| { assert_ok!(setup_minting_resource()); let origin = Origin::signed(ALICE); assert_eq!(get_mining_balance(), 0); assert_ok!(MiningModule::mint(origin.clone(), 1000)); assert_eq!(get_mining_balance(), 1000); let event = mock::Event::mining(crate::Event::MiningResourceMinted(1000)); assert_ok!(MiningModule::burn(origin, 300)); assert_eq!(get_mining_balance(), 700); assert_eq!( last_event(), mock::Event::mining(crate::Event::MiningResourceBurned(300)) ); }); } #[test] fn withdraw_mining_resource_should_work() { ExtBuilder::default().build().execute_with(|| { assert_ok!(setup_minting_resource()); let origin = Origin::signed(ALICE); assert_eq!(get_mining_balance(), 0); assert_ok!(MiningModule::mint(origin.clone(), 1000)); assert_eq!(get_mining_balance(), 1000); assert_eq!(get_mining_balance_of(&BOB), 0); assert_ok!(MiningModule::withdraw(origin, BOB, 300)); assert_eq!(get_mining_balance_of(&BOB), 300); let event = mock::Event::mining(crate::Event::WithdrawMiningResource(BOB, 300)); assert_eq!(last_event(), event); }); } #[test] fn mint_mining_resource_should_fail() { ExtBuilder::default().build().execute_with(|| { assert_noop!( MiningModule::mint(Origin::signed(ALICE), 1000), crate::Error::<Runtime>::NoPermission ); }) } #[test] fn burn_mining_resource_should_fail() { ExtBuilder::default().build().execute_with(|| { assert_noop!( MiningModule::burn(Origin::signed(ALICE), 1000), crate::Error::<Runtime>::NoPermission ); }) } #[test] fn deposit_mining_resource_should_fail() { ExtBuilder::default().build().execute_with(|| { assert_noop!( MiningModule::deposit(Origin::signed(ALICE), BOB, 1000), crate::Error::<Runtime>::NoPermission ); }) } #[test] fn withdraw_mining_resource_should_fail() { ExtBuilder::default().build().execute_with(|| { assert_noop!( MiningModule::withdraw(Origin::signed(ALICE), BOB, 1000), crate::Error::<Runtime>::NoPermission ); }) } #[test] fn deposit_mining_resource_should_work() { ExtBuilder::default().build().execute_with(|| { assert_ok!(setup_minting_resource()); let origin = Origin::signed(ALICE); assert_eq!(get_mining_balance(), 0); assert_ok!(MiningModule::mint(origin.clone(), 1000)); assert_eq!(get_mining_balance(), 1000); let treasury_id = MiningModule::bit_mining_resource_account_id(); //Transfer to BOB 300 assert_ok!(Currencies::transfer( Origin::signed(treasury_id), BOB, MiningCurrencyId::get(), 300 )); //BOB balance now is 300 assert_eq!(get_mining_balance_of(&BOB), 300); //BOB deposit to treasury so his hot wallet will be 100 - only ALICE can call this function assert_ok!(MiningModule::deposit(origin, BOB, 100)); assert_eq!(get_mining_balance_of(&BOB), 200); assert_eq!(get_mining_balance_of(&treasury_id), 800); let event = mock::Event::mining(crate::Event::DepositMiningResource(BOB, 100)); assert_eq!(last_event(), event); }); }
use std::fs; use std::env; use std::collections::HashMap; struct OccupiedSeatCounter { size: (usize, usize), layout: HashMap<String, char>, } impl OccupiedSeatCounter { fn count(&mut self) -> i32 { let mut rounds = 0; loop { let new_layout = self.process(); rounds += 1; // println!("Round: {}", rounds); if self.layouts_equal(&new_layout) { break; } else { self.layout = new_layout; } } println!("Rounds: {}", rounds); self.layout.iter().filter(|(_key, seat)| *seat.clone() == '#').count() as i32 } fn process(&self) -> HashMap<String, char> { let mut editable_layout: HashMap<String, char> = HashMap::new(); for row_index in 0 .. self.size.0 { 0; for column_index in 0 .. self.size.1 { let seat_key = self.get_seat_key(row_index as i32, column_index as i32); let seat = self.layout.get(&seat_key).unwrap().clone(); let occupied = self.count_adjacent_seat_occupied(row_index, column_index); if seat == 'L' && occupied == 0 { editable_layout.insert(seat_key, '#'); } else if seat == '#' && occupied >= 4 { editable_layout.insert(seat_key, 'L'); } else { editable_layout.insert(seat_key, seat); } } } editable_layout } fn count_adjacent_seat_occupied(&self, row_index: usize, column_index: usize) -> i32 { let mut count = 0; for iter_row_index in [-1, 0, 1].iter() { for iter_column_index in [-1, 0, 1].iter() { if *iter_row_index == 0 && *iter_column_index == 0 { continue; } let ri = row_index as i32 + iter_row_index; let ci = column_index as i32 + iter_column_index; let seat_key = self.get_seat_key(ri, ci); let seat_status = self.layout.get(&seat_key).unwrap_or(&'.').clone(); if seat_status == '#' { count += 1; } } } count } fn get_layout_copy(&self) -> HashMap<String, char>{ let mut layout_copy: HashMap<String, char> = HashMap::new(); for (key, value) in self.layout.iter() { layout_copy.insert(String::from(key), value.clone()); } layout_copy } fn get_seat_key(&self, row_index: i32, seat_index: i32) -> String { format!("{}{}", row_index, seat_index) } fn layouts_equal(&self, new_layout: &HashMap<String, char>) -> bool { self.layout.iter().filter(|(key, value)| { let key_ref = &key.to_string(); let val = new_layout.get(key_ref); if val.is_none() { println!("{}", key); } !new_layout.contains_key(key_ref) || val.is_none() || val.unwrap() != value.clone() }).count() == 0 } } struct Input { filename: String, } impl Input { fn new(filename: String) -> Input { Input { filename } } fn get_occupied_seat_counter(&self) -> OccupiedSeatCounter { let contents = self.file_contents(); let lines = contents.lines(); let mut layout: HashMap<String, char> = HashMap::new(); for (row_index, row) in lines.enumerate() { for (seat_index, seat) in row.chars().enumerate() { layout.insert(format!("{}{}", row_index, seat_index), seat); } } OccupiedSeatCounter { layout, size: (contents.lines().count(), contents.lines().last().unwrap().chars().count()) } } fn file_contents(&self) -> String { println!("Loading contents from file: {}", self.filename); return fs::read_to_string(&self.filename).expect("Something went wrong loading contents from file"); } } fn main() { let input_filename = env::args().nth(1).unwrap_or("input.txt".to_string()); let input = Input::new(input_filename); let mut occupied_seat_counter = input.get_occupied_seat_counter(); println!("Rows: {}, Columns: {}", occupied_seat_counter.size.0, occupied_seat_counter.size.1); println!("Answer one: {}", occupied_seat_counter.count()) }
#[doc = "Register `CR3` reader"] pub type R = crate::R<CR3_SPEC>; #[doc = "Register `CR3` writer"] pub type W = crate::W<CR3_SPEC>; #[doc = "Field `ITAMP1NOER` reader - Internal Tamper 1 no erase"] pub type ITAMP1NOER_R = crate::BitReader; #[doc = "Field `ITAMP1NOER` writer - Internal Tamper 1 no erase"] pub type ITAMP1NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP2NOER` reader - Internal Tamper 2 no erase"] pub type ITAMP2NOER_R = crate::BitReader; #[doc = "Field `ITAMP2NOER` writer - Internal Tamper 2 no erase"] pub type ITAMP2NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP3NOER` reader - Internal Tamper 3 no erase"] pub type ITAMP3NOER_R = crate::BitReader; #[doc = "Field `ITAMP3NOER` writer - Internal Tamper 3 no erase"] pub type ITAMP3NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP4NOER` reader - Internal Tamper 4 no erase"] pub type ITAMP4NOER_R = crate::BitReader; #[doc = "Field `ITAMP4NOER` writer - Internal Tamper 4 no erase"] pub type ITAMP4NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP5NOER` reader - Internal Tamper 5 no erase"] pub type ITAMP5NOER_R = crate::BitReader; #[doc = "Field `ITAMP5NOER` writer - Internal Tamper 5 no erase"] pub type ITAMP5NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP6NOER` reader - Internal Tamper 6 no erase"] pub type ITAMP6NOER_R = crate::BitReader; #[doc = "Field `ITAMP6NOER` writer - Internal Tamper 6 no erase"] pub type ITAMP6NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP7NOER` reader - Internal Tamper 7 no erase"] pub type ITAMP7NOER_R = crate::BitReader; #[doc = "Field `ITAMP7NOER` writer - Internal Tamper 7 no erase"] pub type ITAMP7NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP8NOER` reader - Internal Tamper 8 no erase"] pub type ITAMP8NOER_R = crate::BitReader; #[doc = "Field `ITAMP8NOER` writer - Internal Tamper 8 no erase"] pub type ITAMP8NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP9NOER` reader - Internal Tamper 9 no erase"] pub type ITAMP9NOER_R = crate::BitReader; #[doc = "Field `ITAMP9NOER` writer - Internal Tamper 9 no erase"] pub type ITAMP9NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP11NOER` reader - Internal Tamper 11 no erase"] pub type ITAMP11NOER_R = crate::BitReader; #[doc = "Field `ITAMP11NOER` writer - Internal Tamper 11 no erase"] pub type ITAMP11NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP12NOER` reader - Internal Tamper 12 no erase"] pub type ITAMP12NOER_R = crate::BitReader; #[doc = "Field `ITAMP12NOER` writer - Internal Tamper 12 no erase"] pub type ITAMP12NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP13NOER` reader - Internal Tamper 13 no erase"] pub type ITAMP13NOER_R = crate::BitReader; #[doc = "Field `ITAMP13NOER` writer - Internal Tamper 13 no erase"] pub type ITAMP13NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ITAMP15NOER` reader - Internal Tamper 15 no erase"] pub type ITAMP15NOER_R = crate::BitReader; #[doc = "Field `ITAMP15NOER` writer - Internal Tamper 15 no erase"] pub type ITAMP15NOER_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; impl R { #[doc = "Bit 0 - Internal Tamper 1 no erase"] #[inline(always)] pub fn itamp1noer(&self) -> ITAMP1NOER_R { ITAMP1NOER_R::new((self.bits & 1) != 0) } #[doc = "Bit 1 - Internal Tamper 2 no erase"] #[inline(always)] pub fn itamp2noer(&self) -> ITAMP2NOER_R { ITAMP2NOER_R::new(((self.bits >> 1) & 1) != 0) } #[doc = "Bit 2 - Internal Tamper 3 no erase"] #[inline(always)] pub fn itamp3noer(&self) -> ITAMP3NOER_R { ITAMP3NOER_R::new(((self.bits >> 2) & 1) != 0) } #[doc = "Bit 3 - Internal Tamper 4 no erase"] #[inline(always)] pub fn itamp4noer(&self) -> ITAMP4NOER_R { ITAMP4NOER_R::new(((self.bits >> 3) & 1) != 0) } #[doc = "Bit 4 - Internal Tamper 5 no erase"] #[inline(always)] pub fn itamp5noer(&self) -> ITAMP5NOER_R { ITAMP5NOER_R::new(((self.bits >> 4) & 1) != 0) } #[doc = "Bit 5 - Internal Tamper 6 no erase"] #[inline(always)] pub fn itamp6noer(&self) -> ITAMP6NOER_R { ITAMP6NOER_R::new(((self.bits >> 5) & 1) != 0) } #[doc = "Bit 6 - Internal Tamper 7 no erase"] #[inline(always)] pub fn itamp7noer(&self) -> ITAMP7NOER_R { ITAMP7NOER_R::new(((self.bits >> 6) & 1) != 0) } #[doc = "Bit 7 - Internal Tamper 8 no erase"] #[inline(always)] pub fn itamp8noer(&self) -> ITAMP8NOER_R { ITAMP8NOER_R::new(((self.bits >> 7) & 1) != 0) } #[doc = "Bit 8 - Internal Tamper 9 no erase"] #[inline(always)] pub fn itamp9noer(&self) -> ITAMP9NOER_R { ITAMP9NOER_R::new(((self.bits >> 8) & 1) != 0) } #[doc = "Bit 10 - Internal Tamper 11 no erase"] #[inline(always)] pub fn itamp11noer(&self) -> ITAMP11NOER_R { ITAMP11NOER_R::new(((self.bits >> 10) & 1) != 0) } #[doc = "Bit 11 - Internal Tamper 12 no erase"] #[inline(always)] pub fn itamp12noer(&self) -> ITAMP12NOER_R { ITAMP12NOER_R::new(((self.bits >> 11) & 1) != 0) } #[doc = "Bit 12 - Internal Tamper 13 no erase"] #[inline(always)] pub fn itamp13noer(&self) -> ITAMP13NOER_R { ITAMP13NOER_R::new(((self.bits >> 12) & 1) != 0) } #[doc = "Bit 14 - Internal Tamper 15 no erase"] #[inline(always)] pub fn itamp15noer(&self) -> ITAMP15NOER_R { ITAMP15NOER_R::new(((self.bits >> 14) & 1) != 0) } } impl W { #[doc = "Bit 0 - Internal Tamper 1 no erase"] #[inline(always)] #[must_use] pub fn itamp1noer(&mut self) -> ITAMP1NOER_W<CR3_SPEC, 0> { ITAMP1NOER_W::new(self) } #[doc = "Bit 1 - Internal Tamper 2 no erase"] #[inline(always)] #[must_use] pub fn itamp2noer(&mut self) -> ITAMP2NOER_W<CR3_SPEC, 1> { ITAMP2NOER_W::new(self) } #[doc = "Bit 2 - Internal Tamper 3 no erase"] #[inline(always)] #[must_use] pub fn itamp3noer(&mut self) -> ITAMP3NOER_W<CR3_SPEC, 2> { ITAMP3NOER_W::new(self) } #[doc = "Bit 3 - Internal Tamper 4 no erase"] #[inline(always)] #[must_use] pub fn itamp4noer(&mut self) -> ITAMP4NOER_W<CR3_SPEC, 3> { ITAMP4NOER_W::new(self) } #[doc = "Bit 4 - Internal Tamper 5 no erase"] #[inline(always)] #[must_use] pub fn itamp5noer(&mut self) -> ITAMP5NOER_W<CR3_SPEC, 4> { ITAMP5NOER_W::new(self) } #[doc = "Bit 5 - Internal Tamper 6 no erase"] #[inline(always)] #[must_use] pub fn itamp6noer(&mut self) -> ITAMP6NOER_W<CR3_SPEC, 5> { ITAMP6NOER_W::new(self) } #[doc = "Bit 6 - Internal Tamper 7 no erase"] #[inline(always)] #[must_use] pub fn itamp7noer(&mut self) -> ITAMP7NOER_W<CR3_SPEC, 6> { ITAMP7NOER_W::new(self) } #[doc = "Bit 7 - Internal Tamper 8 no erase"] #[inline(always)] #[must_use] pub fn itamp8noer(&mut self) -> ITAMP8NOER_W<CR3_SPEC, 7> { ITAMP8NOER_W::new(self) } #[doc = "Bit 8 - Internal Tamper 9 no erase"] #[inline(always)] #[must_use] pub fn itamp9noer(&mut self) -> ITAMP9NOER_W<CR3_SPEC, 8> { ITAMP9NOER_W::new(self) } #[doc = "Bit 10 - Internal Tamper 11 no erase"] #[inline(always)] #[must_use] pub fn itamp11noer(&mut self) -> ITAMP11NOER_W<CR3_SPEC, 10> { ITAMP11NOER_W::new(self) } #[doc = "Bit 11 - Internal Tamper 12 no erase"] #[inline(always)] #[must_use] pub fn itamp12noer(&mut self) -> ITAMP12NOER_W<CR3_SPEC, 11> { ITAMP12NOER_W::new(self) } #[doc = "Bit 12 - Internal Tamper 13 no erase"] #[inline(always)] #[must_use] pub fn itamp13noer(&mut self) -> ITAMP13NOER_W<CR3_SPEC, 12> { ITAMP13NOER_W::new(self) } #[doc = "Bit 14 - Internal Tamper 15 no erase"] #[inline(always)] #[must_use] pub fn itamp15noer(&mut self) -> ITAMP15NOER_W<CR3_SPEC, 14> { ITAMP15NOER_W::new(self) } #[doc = "Writes raw bits to the register."] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } } #[doc = "TAMP control register 3\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cr3::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`cr3::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] pub struct CR3_SPEC; impl crate::RegisterSpec for CR3_SPEC { type Ux = u32; } #[doc = "`read()` method returns [`cr3::R`](R) reader structure"] impl crate::Readable for CR3_SPEC {} #[doc = "`write(|w| ..)` method takes [`cr3::W`](W) writer structure"] impl crate::Writable for CR3_SPEC { const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; } #[doc = "`reset()` method sets CR3 to value 0"] impl crate::Resettable for CR3_SPEC { const RESET_VALUE: Self::Ux = 0; }
use num::complex::Complex64; use rand::prelude::*; use rustfft::FftPlanner; fn main() { let n = 3; let len = 1 << n; let mut rng = rand::thread_rng(); let mut rustfft: Vec<_> = (0..len) .map(|_| Complex64::new(rng.gen(), rng.gen())) .collect(); let mut my_fft = rustfft.clone(); for x in &rustfft { println!("{}", x); } let mut planner = FftPlanner::<f64>::new(); let plan = planner.plan_fft_forward(len); plan.process(&mut rustfft); fft(&mut my_fft, n); for (x, y) in rustfft.iter().zip(&my_fft) { println!("{} {}", x, y); } } fn fft(v: &mut Vec<Complex64>, n: u32) { let len = v.len(); assert_eq!(len, 1 << n); let mask1 = len - 1; let zeta = zeta_table(len); for i in 0..n { let mask2 = mask1 >> i + 1; *v = (0..v.len()) .map(|j| { let lower = j & mask2; let upper = j ^ lower; let shift = upper << 1 & mask1; v[shift | lower] + zeta[upper] * v[shift | mask2 + 1 | lower] }) .collect(); } } // 1 の len 乗根( len 個)の配列を返す fn zeta_table(len: usize) -> Vec<Complex64> { let mut ret = Vec::with_capacity(len); let pri = Complex64::from_polar(1., -std::f64::consts::TAU / len as f64); let mut tmp = Complex64::new(1., 0.); for _ in 0..len { ret.push(tmp); tmp *= pri; } ret }
pub(crate) trait StringExt { fn add(&mut self, ch: char) -> &mut Self; fn add_str(&mut self, s: &str) -> &mut Self; fn add_sep(&mut self, sep: char) -> &mut Self; fn add_sep_str(&mut self, sep: &str) -> &mut Self; } impl StringExt for String { fn add(&mut self, ch: char) -> &mut Self { self.push(ch); self } fn add_str(&mut self, s: &str) -> &mut Self { self.push_str(s); self } fn add_sep(&mut self, sep: char) -> &mut Self { if !self.is_empty() { self.push(sep); } self } fn add_sep_str(&mut self, sep: &str) -> &mut Self { if !self.is_empty() { self.push_str(sep) } self } }
#[doc = "Register `MMCCR` reader"] pub type R = crate::R<MMCCR_SPEC>; #[doc = "Register `MMCCR` writer"] pub type W = crate::W<MMCCR_SPEC>; #[doc = "Field `CR` reader - Counter reset"] pub type CR_R = crate::BitReader<CR_A>; #[doc = "Counter reset\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum CR_A { #[doc = "1: Reset all counters. Cleared automatically"] Reset = 1, } impl From<CR_A> for bool { #[inline(always)] fn from(variant: CR_A) -> Self { variant as u8 != 0 } } impl CR_R { #[doc = "Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> Option<CR_A> { match self.bits { true => Some(CR_A::Reset), _ => None, } } #[doc = "Reset all counters. Cleared automatically"] #[inline(always)] pub fn is_reset(&self) -> bool { *self == CR_A::Reset } } #[doc = "Field `CR` writer - Counter reset"] pub type CR_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, CR_A>; impl<'a, REG, const O: u8> CR_W<'a, REG, O> where REG: crate::Writable + crate::RegisterSpec, { #[doc = "Reset all counters. Cleared automatically"] #[inline(always)] pub fn reset(self) -> &'a mut crate::W<REG> { self.variant(CR_A::Reset) } } #[doc = "Field `CSR` reader - Counter stop rollover"] pub type CSR_R = crate::BitReader<CSR_A>; #[doc = "Counter stop rollover\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum CSR_A { #[doc = "0: Counters roll over to zero after reaching the maximum value"] Disabled = 0, #[doc = "1: Counters do not roll over to zero after reaching the maximum value"] Enabled = 1, } impl From<CSR_A> for bool { #[inline(always)] fn from(variant: CSR_A) -> Self { variant as u8 != 0 } } impl CSR_R { #[doc = "Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CSR_A { match self.bits { false => CSR_A::Disabled, true => CSR_A::Enabled, } } #[doc = "Counters roll over to zero after reaching the maximum value"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == CSR_A::Disabled } #[doc = "Counters do not roll over to zero after reaching the maximum value"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == CSR_A::Enabled } } #[doc = "Field `CSR` writer - Counter stop rollover"] pub type CSR_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, CSR_A>; impl<'a, REG, const O: u8> CSR_W<'a, REG, O> where REG: crate::Writable + crate::RegisterSpec, { #[doc = "Counters roll over to zero after reaching the maximum value"] #[inline(always)] pub fn disabled(self) -> &'a mut crate::W<REG> { self.variant(CSR_A::Disabled) } #[doc = "Counters do not roll over to zero after reaching the maximum value"] #[inline(always)] pub fn enabled(self) -> &'a mut crate::W<REG> { self.variant(CSR_A::Enabled) } } #[doc = "Field `ROR` reader - Reset on read"] pub type ROR_R = crate::BitReader<ROR_A>; #[doc = "Reset on read\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ROR_A { #[doc = "0: MMC counters do not reset on read"] Disabled = 0, #[doc = "1: MMC counters reset to zero after read"] Enabled = 1, } impl From<ROR_A> for bool { #[inline(always)] fn from(variant: ROR_A) -> Self { variant as u8 != 0 } } impl ROR_R { #[doc = "Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> ROR_A { match self.bits { false => ROR_A::Disabled, true => ROR_A::Enabled, } } #[doc = "MMC counters do not reset on read"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == ROR_A::Disabled } #[doc = "MMC counters reset to zero after read"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == ROR_A::Enabled } } #[doc = "Field `ROR` writer - Reset on read"] pub type ROR_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, ROR_A>; impl<'a, REG, const O: u8> ROR_W<'a, REG, O> where REG: crate::Writable + crate::RegisterSpec, { #[doc = "MMC counters do not reset on read"] #[inline(always)] pub fn disabled(self) -> &'a mut crate::W<REG> { self.variant(ROR_A::Disabled) } #[doc = "MMC counters reset to zero after read"] #[inline(always)] pub fn enabled(self) -> &'a mut crate::W<REG> { self.variant(ROR_A::Enabled) } } #[doc = "Field `MCF` reader - MMC counter freeze"] pub type MCF_R = crate::BitReader<MCF_A>; #[doc = "MMC counter freeze\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum MCF_A { #[doc = "0: All MMC counters update normally"] Unfrozen = 0, #[doc = "1: All MMC counters frozen to their current value"] Frozen = 1, } impl From<MCF_A> for bool { #[inline(always)] fn from(variant: MCF_A) -> Self { variant as u8 != 0 } } impl MCF_R { #[doc = "Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> MCF_A { match self.bits { false => MCF_A::Unfrozen, true => MCF_A::Frozen, } } #[doc = "All MMC counters update normally"] #[inline(always)] pub fn is_unfrozen(&self) -> bool { *self == MCF_A::Unfrozen } #[doc = "All MMC counters frozen to their current value"] #[inline(always)] pub fn is_frozen(&self) -> bool { *self == MCF_A::Frozen } } #[doc = "Field `MCF` writer - MMC counter freeze"] pub type MCF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O, MCF_A>; impl<'a, REG, const O: u8> MCF_W<'a, REG, O> where REG: crate::Writable + crate::RegisterSpec, { #[doc = "All MMC counters update normally"] #[inline(always)] pub fn unfrozen(self) -> &'a mut crate::W<REG> { self.variant(MCF_A::Unfrozen) } #[doc = "All MMC counters frozen to their current value"] #[inline(always)] pub fn frozen(self) -> &'a mut crate::W<REG> { self.variant(MCF_A::Frozen) } } impl R { #[doc = "Bit 0 - Counter reset"] #[inline(always)] pub fn cr(&self) -> CR_R { CR_R::new((self.bits & 1) != 0) } #[doc = "Bit 1 - Counter stop rollover"] #[inline(always)] pub fn csr(&self) -> CSR_R { CSR_R::new(((self.bits >> 1) & 1) != 0) } #[doc = "Bit 2 - Reset on read"] #[inline(always)] pub fn ror(&self) -> ROR_R { ROR_R::new(((self.bits >> 2) & 1) != 0) } #[doc = "Bit 31 - MMC counter freeze"] #[inline(always)] pub fn mcf(&self) -> MCF_R { MCF_R::new(((self.bits >> 31) & 1) != 0) } } impl W { #[doc = "Bit 0 - Counter reset"] #[inline(always)] #[must_use] pub fn cr(&mut self) -> CR_W<MMCCR_SPEC, 0> { CR_W::new(self) } #[doc = "Bit 1 - Counter stop rollover"] #[inline(always)] #[must_use] pub fn csr(&mut self) -> CSR_W<MMCCR_SPEC, 1> { CSR_W::new(self) } #[doc = "Bit 2 - Reset on read"] #[inline(always)] #[must_use] pub fn ror(&mut self) -> ROR_W<MMCCR_SPEC, 2> { ROR_W::new(self) } #[doc = "Bit 31 - MMC counter freeze"] #[inline(always)] #[must_use] pub fn mcf(&mut self) -> MCF_W<MMCCR_SPEC, 31> { MCF_W::new(self) } #[doc = "Writes raw bits to the register."] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } } #[doc = "Ethernet MMC control register (ETH_MMCCR)\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mmccr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mmccr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] pub struct MMCCR_SPEC; impl crate::RegisterSpec for MMCCR_SPEC { type Ux = u32; } #[doc = "`read()` method returns [`mmccr::R`](R) reader structure"] impl crate::Readable for MMCCR_SPEC {} #[doc = "`write(|w| ..)` method takes [`mmccr::W`](W) writer structure"] impl crate::Writable for MMCCR_SPEC { const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; } #[doc = "`reset()` method sets MMCCR to value 0"] impl crate::Resettable for MMCCR_SPEC { const RESET_VALUE: Self::Ux = 0; }
use std::cmp::Ordering; use crate::hit_record::HitRecord; use crate::hittable::Hittable; use crate::material::Material; use crate::object::Object; use crate::ray::Ray; trait ObjectLike: Hittable + Material {} pub struct ObjectList<'a> { pub objects: Vec<Box<dyn Object + 'a>>, } fn f64_cmp(x: f64, y: f64) -> Ordering { if x == y { Ordering::Equal } else if x < y { Ordering::Less } else { Ordering::Greater } } impl<'a> ObjectList<'a> { pub fn hit( &self, ray: &Ray, t_min: f64, t_max: f64, ) -> Option<(&Box<dyn Object + 'a>, HitRecord)> { self.objects .iter() .filter_map(|obj| obj.hit(ray, t_min, t_max).map(|hr| (obj, hr))) .min_by(|x, y| f64_cmp(x.1.t, y.1.t)) } }
#[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::PCFG { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, { let bits = self.register.get(); let r = R { bits: bits }; let mut w = W { bits: bits }; f(&r, &mut w); self.register.set(w.bits); } #[doc = r" Reads the contents of the register"] #[inline] pub fn read(&self) -> R { R { bits: self.register.get(), } } #[doc = r" Writes to the register"] #[inline] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { let mut w = W::reset_value(); f(&mut w); self.register.set(w.bits); } #[doc = r" Writes the reset value to the register"] #[inline] pub fn reset(&self) { self.write(|w| w) } } #[doc = "Possible values of the field `LRSWAP`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum LRSWAPR { #[doc = "Swap left and right channels (FIFO Read RIGHT_LEFT). value."] EN, #[doc = "No channel swapping (IFO Read LEFT_RIGHT). value."] NOSWAP, } impl LRSWAPR { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { LRSWAPR::EN => true, LRSWAPR::NOSWAP => false, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> LRSWAPR { match value { true => LRSWAPR::EN, false => LRSWAPR::NOSWAP, } } #[doc = "Checks if the value of the field is `EN`"] #[inline] pub fn is_en(&self) -> bool { *self == LRSWAPR::EN } #[doc = "Checks if the value of the field is `NOSWAP`"] #[inline] pub fn is_noswap(&self) -> bool { *self == LRSWAPR::NOSWAP } } #[doc = "Possible values of the field `PGARIGHT`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PGARIGHTR { #[doc = "40.5 db gain. value."] P405DB, #[doc = "39.0 db gain. value."] P390DB, #[doc = "37.5 db gain. value."] P375DB, #[doc = "36.0 db gain. value."] P360DB, #[doc = "34.5 db gain. value."] P345DB, #[doc = "33.0 db gain. value."] P330DB, #[doc = "31.5 db gain. value."] P315DB, #[doc = "30.0 db gain. value."] P300DB, #[doc = "28.5 db gain. value."] P285DB, #[doc = "27.0 db gain. value."] P270DB, #[doc = "25.5 db gain. value."] P255DB, #[doc = "24.0 db gain. value."] P240DB, #[doc = "22.5 db gain. value."] P225DB, #[doc = "21.0 db gain. value."] P210DB, #[doc = "19.5 db gain. value."] P195DB, #[doc = "18.0 db gain. value."] P180DB, #[doc = "16.5 db gain. value."] P165DB, #[doc = "15.0 db gain. value."] P150DB, #[doc = "13.5 db gain. value."] P135DB, #[doc = "12.0 db gain. value."] P120DB, #[doc = "10.5 db gain. value."] P105DB, #[doc = "9.0 db gain. value."] P90DB, #[doc = "7.5 db gain. value."] P75DB, #[doc = "6.0 db gain. value."] P60DB, #[doc = "4.5 db gain. value."] P45DB, #[doc = "3.0 db gain. value."] P30DB, #[doc = "1.5 db gain. value."] P15DB, #[doc = "0.0 db gain. value."] _0DB, #[doc = "-1.5 db gain. value."] M15DB, #[doc = "-3.0 db gain. value."] M300DB, #[doc = "-4.5 db gain. value."] M45DB, #[doc = "-6.0 db gain. value."] M60DB, } impl PGARIGHTR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { match *self { PGARIGHTR::P405DB => 31, PGARIGHTR::P390DB => 30, PGARIGHTR::P375DB => 29, PGARIGHTR::P360DB => 28, PGARIGHTR::P345DB => 27, PGARIGHTR::P330DB => 26, PGARIGHTR::P315DB => 25, PGARIGHTR::P300DB => 24, PGARIGHTR::P285DB => 23, PGARIGHTR::P270DB => 22, PGARIGHTR::P255DB => 21, PGARIGHTR::P240DB => 20, PGARIGHTR::P225DB => 19, PGARIGHTR::P210DB => 18, PGARIGHTR::P195DB => 17, PGARIGHTR::P180DB => 16, PGARIGHTR::P165DB => 15, PGARIGHTR::P150DB => 14, PGARIGHTR::P135DB => 13, PGARIGHTR::P120DB => 12, PGARIGHTR::P105DB => 11, PGARIGHTR::P90DB => 10, PGARIGHTR::P75DB => 9, PGARIGHTR::P60DB => 8, PGARIGHTR::P45DB => 7, PGARIGHTR::P30DB => 6, PGARIGHTR::P15DB => 5, PGARIGHTR::_0DB => 4, PGARIGHTR::M15DB => 3, PGARIGHTR::M300DB => 2, PGARIGHTR::M45DB => 1, PGARIGHTR::M60DB => 0, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: u8) -> PGARIGHTR { match value { 31 => PGARIGHTR::P405DB, 30 => PGARIGHTR::P390DB, 29 => PGARIGHTR::P375DB, 28 => PGARIGHTR::P360DB, 27 => PGARIGHTR::P345DB, 26 => PGARIGHTR::P330DB, 25 => PGARIGHTR::P315DB, 24 => PGARIGHTR::P300DB, 23 => PGARIGHTR::P285DB, 22 => PGARIGHTR::P270DB, 21 => PGARIGHTR::P255DB, 20 => PGARIGHTR::P240DB, 19 => PGARIGHTR::P225DB, 18 => PGARIGHTR::P210DB, 17 => PGARIGHTR::P195DB, 16 => PGARIGHTR::P180DB, 15 => PGARIGHTR::P165DB, 14 => PGARIGHTR::P150DB, 13 => PGARIGHTR::P135DB, 12 => PGARIGHTR::P120DB, 11 => PGARIGHTR::P105DB, 10 => PGARIGHTR::P90DB, 9 => PGARIGHTR::P75DB, 8 => PGARIGHTR::P60DB, 7 => PGARIGHTR::P45DB, 6 => PGARIGHTR::P30DB, 5 => PGARIGHTR::P15DB, 4 => PGARIGHTR::_0DB, 3 => PGARIGHTR::M15DB, 2 => PGARIGHTR::M300DB, 1 => PGARIGHTR::M45DB, 0 => PGARIGHTR::M60DB, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `P405DB`"] #[inline] pub fn is_p405db(&self) -> bool { *self == PGARIGHTR::P405DB } #[doc = "Checks if the value of the field is `P390DB`"] #[inline] pub fn is_p390db(&self) -> bool { *self == PGARIGHTR::P390DB } #[doc = "Checks if the value of the field is `P375DB`"] #[inline] pub fn is_p375db(&self) -> bool { *self == PGARIGHTR::P375DB } #[doc = "Checks if the value of the field is `P360DB`"] #[inline] pub fn is_p360db(&self) -> bool { *self == PGARIGHTR::P360DB } #[doc = "Checks if the value of the field is `P345DB`"] #[inline] pub fn is_p345db(&self) -> bool { *self == PGARIGHTR::P345DB } #[doc = "Checks if the value of the field is `P330DB`"] #[inline] pub fn is_p330db(&self) -> bool { *self == PGARIGHTR::P330DB } #[doc = "Checks if the value of the field is `P315DB`"] #[inline] pub fn is_p315db(&self) -> bool { *self == PGARIGHTR::P315DB } #[doc = "Checks if the value of the field is `P300DB`"] #[inline] pub fn is_p300db(&self) -> bool { *self == PGARIGHTR::P300DB } #[doc = "Checks if the value of the field is `P285DB`"] #[inline] pub fn is_p285db(&self) -> bool { *self == PGARIGHTR::P285DB } #[doc = "Checks if the value of the field is `P270DB`"] #[inline] pub fn is_p270db(&self) -> bool { *self == PGARIGHTR::P270DB } #[doc = "Checks if the value of the field is `P255DB`"] #[inline] pub fn is_p255db(&self) -> bool { *self == PGARIGHTR::P255DB } #[doc = "Checks if the value of the field is `P240DB`"] #[inline] pub fn is_p240db(&self) -> bool { *self == PGARIGHTR::P240DB } #[doc = "Checks if the value of the field is `P225DB`"] #[inline] pub fn is_p225db(&self) -> bool { *self == PGARIGHTR::P225DB } #[doc = "Checks if the value of the field is `P210DB`"] #[inline] pub fn is_p210db(&self) -> bool { *self == PGARIGHTR::P210DB } #[doc = "Checks if the value of the field is `P195DB`"] #[inline] pub fn is_p195db(&self) -> bool { *self == PGARIGHTR::P195DB } #[doc = "Checks if the value of the field is `P180DB`"] #[inline] pub fn is_p180db(&self) -> bool { *self == PGARIGHTR::P180DB } #[doc = "Checks if the value of the field is `P165DB`"] #[inline] pub fn is_p165db(&self) -> bool { *self == PGARIGHTR::P165DB } #[doc = "Checks if the value of the field is `P150DB`"] #[inline] pub fn is_p150db(&self) -> bool { *self == PGARIGHTR::P150DB } #[doc = "Checks if the value of the field is `P135DB`"] #[inline] pub fn is_p135db(&self) -> bool { *self == PGARIGHTR::P135DB } #[doc = "Checks if the value of the field is `P120DB`"] #[inline] pub fn is_p120db(&self) -> bool { *self == PGARIGHTR::P120DB } #[doc = "Checks if the value of the field is `P105DB`"] #[inline] pub fn is_p105db(&self) -> bool { *self == PGARIGHTR::P105DB } #[doc = "Checks if the value of the field is `P90DB`"] #[inline] pub fn is_p90db(&self) -> bool { *self == PGARIGHTR::P90DB } #[doc = "Checks if the value of the field is `P75DB`"] #[inline] pub fn is_p75db(&self) -> bool { *self == PGARIGHTR::P75DB } #[doc = "Checks if the value of the field is `P60DB`"] #[inline] pub fn is_p60db(&self) -> bool { *self == PGARIGHTR::P60DB } #[doc = "Checks if the value of the field is `P45DB`"] #[inline] pub fn is_p45db(&self) -> bool { *self == PGARIGHTR::P45DB } #[doc = "Checks if the value of the field is `P30DB`"] #[inline] pub fn is_p30db(&self) -> bool { *self == PGARIGHTR::P30DB } #[doc = "Checks if the value of the field is `P15DB`"] #[inline] pub fn is_p15db(&self) -> bool { *self == PGARIGHTR::P15DB } #[doc = "Checks if the value of the field is `_0DB`"] #[inline] pub fn is_0db(&self) -> bool { *self == PGARIGHTR::_0DB } #[doc = "Checks if the value of the field is `M15DB`"] #[inline] pub fn is_m15db(&self) -> bool { *self == PGARIGHTR::M15DB } #[doc = "Checks if the value of the field is `M300DB`"] #[inline] pub fn is_m300db(&self) -> bool { *self == PGARIGHTR::M300DB } #[doc = "Checks if the value of the field is `M45DB`"] #[inline] pub fn is_m45db(&self) -> bool { *self == PGARIGHTR::M45DB } #[doc = "Checks if the value of the field is `M60DB`"] #[inline] pub fn is_m60db(&self) -> bool { *self == PGARIGHTR::M60DB } } #[doc = "Possible values of the field `PGALEFT`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PGALEFTR { #[doc = "40.5 db gain. value."] P405DB, #[doc = "39.0 db gain. value."] P390DB, #[doc = "37.5 db gain. value."] P375DB, #[doc = "36.0 db gain. value."] P360DB, #[doc = "34.5 db gain. value."] P345DB, #[doc = "33.0 db gain. value."] P330DB, #[doc = "31.5 db gain. value."] P315DB, #[doc = "30.0 db gain. value."] P300DB, #[doc = "28.5 db gain. value."] P285DB, #[doc = "27.0 db gain. value."] P270DB, #[doc = "25.5 db gain. value."] P255DB, #[doc = "24.0 db gain. value."] P240DB, #[doc = "22.5 db gain. value."] P225DB, #[doc = "21.0 db gain. value."] P210DB, #[doc = "19.5 db gain. value."] P195DB, #[doc = "18.0 db gain. value."] P180DB, #[doc = "16.5 db gain. value."] P165DB, #[doc = "15.0 db gain. value."] P150DB, #[doc = "13.5 db gain. value."] P135DB, #[doc = "12.0 db gain. value."] P120DB, #[doc = "10.5 db gain. value."] P105DB, #[doc = "9.0 db gain. value."] P90DB, #[doc = "7.5 db gain. value."] P75DB, #[doc = "6.0 db gain. value."] P60DB, #[doc = "4.5 db gain. value."] P45DB, #[doc = "3.0 db gain. value."] P30DB, #[doc = "1.5 db gain. value."] P15DB, #[doc = "0.0 db gain. value."] _0DB, #[doc = "-1.5 db gain. value."] M15DB, #[doc = "-3.0 db gain. value."] M300DB, #[doc = "-4.5 db gain. value."] M45DB, #[doc = "-6.0 db gain. value."] M60DB, } impl PGALEFTR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { match *self { PGALEFTR::P405DB => 31, PGALEFTR::P390DB => 30, PGALEFTR::P375DB => 29, PGALEFTR::P360DB => 28, PGALEFTR::P345DB => 27, PGALEFTR::P330DB => 26, PGALEFTR::P315DB => 25, PGALEFTR::P300DB => 24, PGALEFTR::P285DB => 23, PGALEFTR::P270DB => 22, PGALEFTR::P255DB => 21, PGALEFTR::P240DB => 20, PGALEFTR::P225DB => 19, PGALEFTR::P210DB => 18, PGALEFTR::P195DB => 17, PGALEFTR::P180DB => 16, PGALEFTR::P165DB => 15, PGALEFTR::P150DB => 14, PGALEFTR::P135DB => 13, PGALEFTR::P120DB => 12, PGALEFTR::P105DB => 11, PGALEFTR::P90DB => 10, PGALEFTR::P75DB => 9, PGALEFTR::P60DB => 8, PGALEFTR::P45DB => 7, PGALEFTR::P30DB => 6, PGALEFTR::P15DB => 5, PGALEFTR::_0DB => 4, PGALEFTR::M15DB => 3, PGALEFTR::M300DB => 2, PGALEFTR::M45DB => 1, PGALEFTR::M60DB => 0, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: u8) -> PGALEFTR { match value { 31 => PGALEFTR::P405DB, 30 => PGALEFTR::P390DB, 29 => PGALEFTR::P375DB, 28 => PGALEFTR::P360DB, 27 => PGALEFTR::P345DB, 26 => PGALEFTR::P330DB, 25 => PGALEFTR::P315DB, 24 => PGALEFTR::P300DB, 23 => PGALEFTR::P285DB, 22 => PGALEFTR::P270DB, 21 => PGALEFTR::P255DB, 20 => PGALEFTR::P240DB, 19 => PGALEFTR::P225DB, 18 => PGALEFTR::P210DB, 17 => PGALEFTR::P195DB, 16 => PGALEFTR::P180DB, 15 => PGALEFTR::P165DB, 14 => PGALEFTR::P150DB, 13 => PGALEFTR::P135DB, 12 => PGALEFTR::P120DB, 11 => PGALEFTR::P105DB, 10 => PGALEFTR::P90DB, 9 => PGALEFTR::P75DB, 8 => PGALEFTR::P60DB, 7 => PGALEFTR::P45DB, 6 => PGALEFTR::P30DB, 5 => PGALEFTR::P15DB, 4 => PGALEFTR::_0DB, 3 => PGALEFTR::M15DB, 2 => PGALEFTR::M300DB, 1 => PGALEFTR::M45DB, 0 => PGALEFTR::M60DB, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `P405DB`"] #[inline] pub fn is_p405db(&self) -> bool { *self == PGALEFTR::P405DB } #[doc = "Checks if the value of the field is `P390DB`"] #[inline] pub fn is_p390db(&self) -> bool { *self == PGALEFTR::P390DB } #[doc = "Checks if the value of the field is `P375DB`"] #[inline] pub fn is_p375db(&self) -> bool { *self == PGALEFTR::P375DB } #[doc = "Checks if the value of the field is `P360DB`"] #[inline] pub fn is_p360db(&self) -> bool { *self == PGALEFTR::P360DB } #[doc = "Checks if the value of the field is `P345DB`"] #[inline] pub fn is_p345db(&self) -> bool { *self == PGALEFTR::P345DB } #[doc = "Checks if the value of the field is `P330DB`"] #[inline] pub fn is_p330db(&self) -> bool { *self == PGALEFTR::P330DB } #[doc = "Checks if the value of the field is `P315DB`"] #[inline] pub fn is_p315db(&self) -> bool { *self == PGALEFTR::P315DB } #[doc = "Checks if the value of the field is `P300DB`"] #[inline] pub fn is_p300db(&self) -> bool { *self == PGALEFTR::P300DB } #[doc = "Checks if the value of the field is `P285DB`"] #[inline] pub fn is_p285db(&self) -> bool { *self == PGALEFTR::P285DB } #[doc = "Checks if the value of the field is `P270DB`"] #[inline] pub fn is_p270db(&self) -> bool { *self == PGALEFTR::P270DB } #[doc = "Checks if the value of the field is `P255DB`"] #[inline] pub fn is_p255db(&self) -> bool { *self == PGALEFTR::P255DB } #[doc = "Checks if the value of the field is `P240DB`"] #[inline] pub fn is_p240db(&self) -> bool { *self == PGALEFTR::P240DB } #[doc = "Checks if the value of the field is `P225DB`"] #[inline] pub fn is_p225db(&self) -> bool { *self == PGALEFTR::P225DB } #[doc = "Checks if the value of the field is `P210DB`"] #[inline] pub fn is_p210db(&self) -> bool { *self == PGALEFTR::P210DB } #[doc = "Checks if the value of the field is `P195DB`"] #[inline] pub fn is_p195db(&self) -> bool { *self == PGALEFTR::P195DB } #[doc = "Checks if the value of the field is `P180DB`"] #[inline] pub fn is_p180db(&self) -> bool { *self == PGALEFTR::P180DB } #[doc = "Checks if the value of the field is `P165DB`"] #[inline] pub fn is_p165db(&self) -> bool { *self == PGALEFTR::P165DB } #[doc = "Checks if the value of the field is `P150DB`"] #[inline] pub fn is_p150db(&self) -> bool { *self == PGALEFTR::P150DB } #[doc = "Checks if the value of the field is `P135DB`"] #[inline] pub fn is_p135db(&self) -> bool { *self == PGALEFTR::P135DB } #[doc = "Checks if the value of the field is `P120DB`"] #[inline] pub fn is_p120db(&self) -> bool { *self == PGALEFTR::P120DB } #[doc = "Checks if the value of the field is `P105DB`"] #[inline] pub fn is_p105db(&self) -> bool { *self == PGALEFTR::P105DB } #[doc = "Checks if the value of the field is `P90DB`"] #[inline] pub fn is_p90db(&self) -> bool { *self == PGALEFTR::P90DB } #[doc = "Checks if the value of the field is `P75DB`"] #[inline] pub fn is_p75db(&self) -> bool { *self == PGALEFTR::P75DB } #[doc = "Checks if the value of the field is `P60DB`"] #[inline] pub fn is_p60db(&self) -> bool { *self == PGALEFTR::P60DB } #[doc = "Checks if the value of the field is `P45DB`"] #[inline] pub fn is_p45db(&self) -> bool { *self == PGALEFTR::P45DB } #[doc = "Checks if the value of the field is `P30DB`"] #[inline] pub fn is_p30db(&self) -> bool { *self == PGALEFTR::P30DB } #[doc = "Checks if the value of the field is `P15DB`"] #[inline] pub fn is_p15db(&self) -> bool { *self == PGALEFTR::P15DB } #[doc = "Checks if the value of the field is `_0DB`"] #[inline] pub fn is_0db(&self) -> bool { *self == PGALEFTR::_0DB } #[doc = "Checks if the value of the field is `M15DB`"] #[inline] pub fn is_m15db(&self) -> bool { *self == PGALEFTR::M15DB } #[doc = "Checks if the value of the field is `M300DB`"] #[inline] pub fn is_m300db(&self) -> bool { *self == PGALEFTR::M300DB } #[doc = "Checks if the value of the field is `M45DB`"] #[inline] pub fn is_m45db(&self) -> bool { *self == PGALEFTR::M45DB } #[doc = "Checks if the value of the field is `M60DB`"] #[inline] pub fn is_m60db(&self) -> bool { *self == PGALEFTR::M60DB } } #[doc = "Possible values of the field `MCLKDIV`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum MCLKDIVR { #[doc = "Divide input clock by 4 value."] MCKDIV4, #[doc = "Divide input clock by 3 value."] MCKDIV3, #[doc = "Divide input clock by 2 value."] MCKDIV2, #[doc = "Divide input clock by 1 value."] MCKDIV1, } impl MCLKDIVR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { match *self { MCLKDIVR::MCKDIV4 => 3, MCLKDIVR::MCKDIV3 => 2, MCLKDIVR::MCKDIV2 => 1, MCLKDIVR::MCKDIV1 => 0, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: u8) -> MCLKDIVR { match value { 3 => MCLKDIVR::MCKDIV4, 2 => MCLKDIVR::MCKDIV3, 1 => MCLKDIVR::MCKDIV2, 0 => MCLKDIVR::MCKDIV1, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `MCKDIV4`"] #[inline] pub fn is_mckdiv4(&self) -> bool { *self == MCLKDIVR::MCKDIV4 } #[doc = "Checks if the value of the field is `MCKDIV3`"] #[inline] pub fn is_mckdiv3(&self) -> bool { *self == MCLKDIVR::MCKDIV3 } #[doc = "Checks if the value of the field is `MCKDIV2`"] #[inline] pub fn is_mckdiv2(&self) -> bool { *self == MCLKDIVR::MCKDIV2 } #[doc = "Checks if the value of the field is `MCKDIV1`"] #[inline] pub fn is_mckdiv1(&self) -> bool { *self == MCLKDIVR::MCKDIV1 } } #[doc = r" Value of the field"] pub struct SINCRATER { bits: u8, } impl SINCRATER { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { self.bits } } #[doc = "Possible values of the field `ADCHPD`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADCHPDR { #[doc = "Enable high pass filter. value."] EN, #[doc = "Disable high pass filter. value."] DIS, } impl ADCHPDR { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADCHPDR::EN => true, ADCHPDR::DIS => false, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADCHPDR { match value { true => ADCHPDR::EN, false => ADCHPDR::DIS, } } #[doc = "Checks if the value of the field is `EN`"] #[inline] pub fn is_en(&self) -> bool { *self == ADCHPDR::EN } #[doc = "Checks if the value of the field is `DIS`"] #[inline] pub fn is_dis(&self) -> bool { *self == ADCHPDR::DIS } } #[doc = r" Value of the field"] pub struct HPCUTOFFR { bits: u8, } impl HPCUTOFFR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { self.bits } } #[doc = r" Value of the field"] pub struct CYCLESR { bits: u8, } impl CYCLESR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { self.bits } } #[doc = "Possible values of the field `SOFTMUTE`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum SOFTMUTER { #[doc = "Enable Soft Mute. value."] EN, #[doc = "Disable Soft Mute. value."] DIS, } impl SOFTMUTER { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { SOFTMUTER::EN => true, SOFTMUTER::DIS => false, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> SOFTMUTER { match value { true => SOFTMUTER::EN, false => SOFTMUTER::DIS, } } #[doc = "Checks if the value of the field is `EN`"] #[inline] pub fn is_en(&self) -> bool { *self == SOFTMUTER::EN } #[doc = "Checks if the value of the field is `DIS`"] #[inline] pub fn is_dis(&self) -> bool { *self == SOFTMUTER::DIS } } #[doc = "Possible values of the field `PDMCOREEN`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PDMCOREENR { #[doc = "Enable Data Streaming. value."] EN, #[doc = "Disable Data Streaming. value."] DIS, } impl PDMCOREENR { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { PDMCOREENR::EN => true, PDMCOREENR::DIS => false, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> PDMCOREENR { match value { true => PDMCOREENR::EN, false => PDMCOREENR::DIS, } } #[doc = "Checks if the value of the field is `EN`"] #[inline] pub fn is_en(&self) -> bool { *self == PDMCOREENR::EN } #[doc = "Checks if the value of the field is `DIS`"] #[inline] pub fn is_dis(&self) -> bool { *self == PDMCOREENR::DIS } } #[doc = "Values that can be written to the field `LRSWAP`"] pub enum LRSWAPW { #[doc = "Swap left and right channels (FIFO Read RIGHT_LEFT). value."] EN, #[doc = "No channel swapping (IFO Read LEFT_RIGHT). value."] NOSWAP, } impl LRSWAPW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { LRSWAPW::EN => true, LRSWAPW::NOSWAP => false, } } } #[doc = r" Proxy"] pub struct _LRSWAPW<'a> { w: &'a mut W, } impl<'a> _LRSWAPW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: LRSWAPW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Swap left and right channels (FIFO Read RIGHT_LEFT). value."] #[inline] pub fn en(self) -> &'a mut W { self.variant(LRSWAPW::EN) } #[doc = "No channel swapping (IFO Read LEFT_RIGHT). value."] #[inline] pub fn noswap(self) -> &'a mut W { self.variant(LRSWAPW::NOSWAP) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 31; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `PGARIGHT`"] pub enum PGARIGHTW { #[doc = "40.5 db gain. value."] P405DB, #[doc = "39.0 db gain. value."] P390DB, #[doc = "37.5 db gain. value."] P375DB, #[doc = "36.0 db gain. value."] P360DB, #[doc = "34.5 db gain. value."] P345DB, #[doc = "33.0 db gain. value."] P330DB, #[doc = "31.5 db gain. value."] P315DB, #[doc = "30.0 db gain. value."] P300DB, #[doc = "28.5 db gain. value."] P285DB, #[doc = "27.0 db gain. value."] P270DB, #[doc = "25.5 db gain. value."] P255DB, #[doc = "24.0 db gain. value."] P240DB, #[doc = "22.5 db gain. value."] P225DB, #[doc = "21.0 db gain. value."] P210DB, #[doc = "19.5 db gain. value."] P195DB, #[doc = "18.0 db gain. value."] P180DB, #[doc = "16.5 db gain. value."] P165DB, #[doc = "15.0 db gain. value."] P150DB, #[doc = "13.5 db gain. value."] P135DB, #[doc = "12.0 db gain. value."] P120DB, #[doc = "10.5 db gain. value."] P105DB, #[doc = "9.0 db gain. value."] P90DB, #[doc = "7.5 db gain. value."] P75DB, #[doc = "6.0 db gain. value."] P60DB, #[doc = "4.5 db gain. value."] P45DB, #[doc = "3.0 db gain. value."] P30DB, #[doc = "1.5 db gain. value."] P15DB, #[doc = "0.0 db gain. value."] _0DB, #[doc = "-1.5 db gain. value."] M15DB, #[doc = "-3.0 db gain. value."] M300DB, #[doc = "-4.5 db gain. value."] M45DB, #[doc = "-6.0 db gain. value."] M60DB, } impl PGARIGHTW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> u8 { match *self { PGARIGHTW::P405DB => 31, PGARIGHTW::P390DB => 30, PGARIGHTW::P375DB => 29, PGARIGHTW::P360DB => 28, PGARIGHTW::P345DB => 27, PGARIGHTW::P330DB => 26, PGARIGHTW::P315DB => 25, PGARIGHTW::P300DB => 24, PGARIGHTW::P285DB => 23, PGARIGHTW::P270DB => 22, PGARIGHTW::P255DB => 21, PGARIGHTW::P240DB => 20, PGARIGHTW::P225DB => 19, PGARIGHTW::P210DB => 18, PGARIGHTW::P195DB => 17, PGARIGHTW::P180DB => 16, PGARIGHTW::P165DB => 15, PGARIGHTW::P150DB => 14, PGARIGHTW::P135DB => 13, PGARIGHTW::P120DB => 12, PGARIGHTW::P105DB => 11, PGARIGHTW::P90DB => 10, PGARIGHTW::P75DB => 9, PGARIGHTW::P60DB => 8, PGARIGHTW::P45DB => 7, PGARIGHTW::P30DB => 6, PGARIGHTW::P15DB => 5, PGARIGHTW::_0DB => 4, PGARIGHTW::M15DB => 3, PGARIGHTW::M300DB => 2, PGARIGHTW::M45DB => 1, PGARIGHTW::M60DB => 0, } } } #[doc = r" Proxy"] pub struct _PGARIGHTW<'a> { w: &'a mut W, } impl<'a> _PGARIGHTW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PGARIGHTW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "40.5 db gain. value."] #[inline] pub fn p405db(self) -> &'a mut W { self.variant(PGARIGHTW::P405DB) } #[doc = "39.0 db gain. value."] #[inline] pub fn p390db(self) -> &'a mut W { self.variant(PGARIGHTW::P390DB) } #[doc = "37.5 db gain. value."] #[inline] pub fn p375db(self) -> &'a mut W { self.variant(PGARIGHTW::P375DB) } #[doc = "36.0 db gain. value."] #[inline] pub fn p360db(self) -> &'a mut W { self.variant(PGARIGHTW::P360DB) } #[doc = "34.5 db gain. value."] #[inline] pub fn p345db(self) -> &'a mut W { self.variant(PGARIGHTW::P345DB) } #[doc = "33.0 db gain. value."] #[inline] pub fn p330db(self) -> &'a mut W { self.variant(PGARIGHTW::P330DB) } #[doc = "31.5 db gain. value."] #[inline] pub fn p315db(self) -> &'a mut W { self.variant(PGARIGHTW::P315DB) } #[doc = "30.0 db gain. value."] #[inline] pub fn p300db(self) -> &'a mut W { self.variant(PGARIGHTW::P300DB) } #[doc = "28.5 db gain. value."] #[inline] pub fn p285db(self) -> &'a mut W { self.variant(PGARIGHTW::P285DB) } #[doc = "27.0 db gain. value."] #[inline] pub fn p270db(self) -> &'a mut W { self.variant(PGARIGHTW::P270DB) } #[doc = "25.5 db gain. value."] #[inline] pub fn p255db(self) -> &'a mut W { self.variant(PGARIGHTW::P255DB) } #[doc = "24.0 db gain. value."] #[inline] pub fn p240db(self) -> &'a mut W { self.variant(PGARIGHTW::P240DB) } #[doc = "22.5 db gain. value."] #[inline] pub fn p225db(self) -> &'a mut W { self.variant(PGARIGHTW::P225DB) } #[doc = "21.0 db gain. value."] #[inline] pub fn p210db(self) -> &'a mut W { self.variant(PGARIGHTW::P210DB) } #[doc = "19.5 db gain. value."] #[inline] pub fn p195db(self) -> &'a mut W { self.variant(PGARIGHTW::P195DB) } #[doc = "18.0 db gain. value."] #[inline] pub fn p180db(self) -> &'a mut W { self.variant(PGARIGHTW::P180DB) } #[doc = "16.5 db gain. value."] #[inline] pub fn p165db(self) -> &'a mut W { self.variant(PGARIGHTW::P165DB) } #[doc = "15.0 db gain. value."] #[inline] pub fn p150db(self) -> &'a mut W { self.variant(PGARIGHTW::P150DB) } #[doc = "13.5 db gain. value."] #[inline] pub fn p135db(self) -> &'a mut W { self.variant(PGARIGHTW::P135DB) } #[doc = "12.0 db gain. value."] #[inline] pub fn p120db(self) -> &'a mut W { self.variant(PGARIGHTW::P120DB) } #[doc = "10.5 db gain. value."] #[inline] pub fn p105db(self) -> &'a mut W { self.variant(PGARIGHTW::P105DB) } #[doc = "9.0 db gain. value."] #[inline] pub fn p90db(self) -> &'a mut W { self.variant(PGARIGHTW::P90DB) } #[doc = "7.5 db gain. value."] #[inline] pub fn p75db(self) -> &'a mut W { self.variant(PGARIGHTW::P75DB) } #[doc = "6.0 db gain. value."] #[inline] pub fn p60db(self) -> &'a mut W { self.variant(PGARIGHTW::P60DB) } #[doc = "4.5 db gain. value."] #[inline] pub fn p45db(self) -> &'a mut W { self.variant(PGARIGHTW::P45DB) } #[doc = "3.0 db gain. value."] #[inline] pub fn p30db(self) -> &'a mut W { self.variant(PGARIGHTW::P30DB) } #[doc = "1.5 db gain. value."] #[inline] pub fn p15db(self) -> &'a mut W { self.variant(PGARIGHTW::P15DB) } #[doc = "0.0 db gain. value."] #[inline] pub fn _0db(self) -> &'a mut W { self.variant(PGARIGHTW::_0DB) } #[doc = "-1.5 db gain. value."] #[inline] pub fn m15db(self) -> &'a mut W { self.variant(PGARIGHTW::M15DB) } #[doc = "-3.0 db gain. value."] #[inline] pub fn m300db(self) -> &'a mut W { self.variant(PGARIGHTW::M300DB) } #[doc = "-4.5 db gain. value."] #[inline] pub fn m45db(self) -> &'a mut W { self.variant(PGARIGHTW::M45DB) } #[doc = "-6.0 db gain. value."] #[inline] pub fn m60db(self) -> &'a mut W { self.variant(PGARIGHTW::M60DB) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bits(self, value: u8) -> &'a mut W { const MASK: u8 = 31; const OFFSET: u8 = 26; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `PGALEFT`"] pub enum PGALEFTW { #[doc = "40.5 db gain. value."] P405DB, #[doc = "39.0 db gain. value."] P390DB, #[doc = "37.5 db gain. value."] P375DB, #[doc = "36.0 db gain. value."] P360DB, #[doc = "34.5 db gain. value."] P345DB, #[doc = "33.0 db gain. value."] P330DB, #[doc = "31.5 db gain. value."] P315DB, #[doc = "30.0 db gain. value."] P300DB, #[doc = "28.5 db gain. value."] P285DB, #[doc = "27.0 db gain. value."] P270DB, #[doc = "25.5 db gain. value."] P255DB, #[doc = "24.0 db gain. value."] P240DB, #[doc = "22.5 db gain. value."] P225DB, #[doc = "21.0 db gain. value."] P210DB, #[doc = "19.5 db gain. value."] P195DB, #[doc = "18.0 db gain. value."] P180DB, #[doc = "16.5 db gain. value."] P165DB, #[doc = "15.0 db gain. value."] P150DB, #[doc = "13.5 db gain. value."] P135DB, #[doc = "12.0 db gain. value."] P120DB, #[doc = "10.5 db gain. value."] P105DB, #[doc = "9.0 db gain. value."] P90DB, #[doc = "7.5 db gain. value."] P75DB, #[doc = "6.0 db gain. value."] P60DB, #[doc = "4.5 db gain. value."] P45DB, #[doc = "3.0 db gain. value."] P30DB, #[doc = "1.5 db gain. value."] P15DB, #[doc = "0.0 db gain. value."] _0DB, #[doc = "-1.5 db gain. value."] M15DB, #[doc = "-3.0 db gain. value."] M300DB, #[doc = "-4.5 db gain. value."] M45DB, #[doc = "-6.0 db gain. value."] M60DB, } impl PGALEFTW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> u8 { match *self { PGALEFTW::P405DB => 31, PGALEFTW::P390DB => 30, PGALEFTW::P375DB => 29, PGALEFTW::P360DB => 28, PGALEFTW::P345DB => 27, PGALEFTW::P330DB => 26, PGALEFTW::P315DB => 25, PGALEFTW::P300DB => 24, PGALEFTW::P285DB => 23, PGALEFTW::P270DB => 22, PGALEFTW::P255DB => 21, PGALEFTW::P240DB => 20, PGALEFTW::P225DB => 19, PGALEFTW::P210DB => 18, PGALEFTW::P195DB => 17, PGALEFTW::P180DB => 16, PGALEFTW::P165DB => 15, PGALEFTW::P150DB => 14, PGALEFTW::P135DB => 13, PGALEFTW::P120DB => 12, PGALEFTW::P105DB => 11, PGALEFTW::P90DB => 10, PGALEFTW::P75DB => 9, PGALEFTW::P60DB => 8, PGALEFTW::P45DB => 7, PGALEFTW::P30DB => 6, PGALEFTW::P15DB => 5, PGALEFTW::_0DB => 4, PGALEFTW::M15DB => 3, PGALEFTW::M300DB => 2, PGALEFTW::M45DB => 1, PGALEFTW::M60DB => 0, } } } #[doc = r" Proxy"] pub struct _PGALEFTW<'a> { w: &'a mut W, } impl<'a> _PGALEFTW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PGALEFTW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "40.5 db gain. value."] #[inline] pub fn p405db(self) -> &'a mut W { self.variant(PGALEFTW::P405DB) } #[doc = "39.0 db gain. value."] #[inline] pub fn p390db(self) -> &'a mut W { self.variant(PGALEFTW::P390DB) } #[doc = "37.5 db gain. value."] #[inline] pub fn p375db(self) -> &'a mut W { self.variant(PGALEFTW::P375DB) } #[doc = "36.0 db gain. value."] #[inline] pub fn p360db(self) -> &'a mut W { self.variant(PGALEFTW::P360DB) } #[doc = "34.5 db gain. value."] #[inline] pub fn p345db(self) -> &'a mut W { self.variant(PGALEFTW::P345DB) } #[doc = "33.0 db gain. value."] #[inline] pub fn p330db(self) -> &'a mut W { self.variant(PGALEFTW::P330DB) } #[doc = "31.5 db gain. value."] #[inline] pub fn p315db(self) -> &'a mut W { self.variant(PGALEFTW::P315DB) } #[doc = "30.0 db gain. value."] #[inline] pub fn p300db(self) -> &'a mut W { self.variant(PGALEFTW::P300DB) } #[doc = "28.5 db gain. value."] #[inline] pub fn p285db(self) -> &'a mut W { self.variant(PGALEFTW::P285DB) } #[doc = "27.0 db gain. value."] #[inline] pub fn p270db(self) -> &'a mut W { self.variant(PGALEFTW::P270DB) } #[doc = "25.5 db gain. value."] #[inline] pub fn p255db(self) -> &'a mut W { self.variant(PGALEFTW::P255DB) } #[doc = "24.0 db gain. value."] #[inline] pub fn p240db(self) -> &'a mut W { self.variant(PGALEFTW::P240DB) } #[doc = "22.5 db gain. value."] #[inline] pub fn p225db(self) -> &'a mut W { self.variant(PGALEFTW::P225DB) } #[doc = "21.0 db gain. value."] #[inline] pub fn p210db(self) -> &'a mut W { self.variant(PGALEFTW::P210DB) } #[doc = "19.5 db gain. value."] #[inline] pub fn p195db(self) -> &'a mut W { self.variant(PGALEFTW::P195DB) } #[doc = "18.0 db gain. value."] #[inline] pub fn p180db(self) -> &'a mut W { self.variant(PGALEFTW::P180DB) } #[doc = "16.5 db gain. value."] #[inline] pub fn p165db(self) -> &'a mut W { self.variant(PGALEFTW::P165DB) } #[doc = "15.0 db gain. value."] #[inline] pub fn p150db(self) -> &'a mut W { self.variant(PGALEFTW::P150DB) } #[doc = "13.5 db gain. value."] #[inline] pub fn p135db(self) -> &'a mut W { self.variant(PGALEFTW::P135DB) } #[doc = "12.0 db gain. value."] #[inline] pub fn p120db(self) -> &'a mut W { self.variant(PGALEFTW::P120DB) } #[doc = "10.5 db gain. value."] #[inline] pub fn p105db(self) -> &'a mut W { self.variant(PGALEFTW::P105DB) } #[doc = "9.0 db gain. value."] #[inline] pub fn p90db(self) -> &'a mut W { self.variant(PGALEFTW::P90DB) } #[doc = "7.5 db gain. value."] #[inline] pub fn p75db(self) -> &'a mut W { self.variant(PGALEFTW::P75DB) } #[doc = "6.0 db gain. value."] #[inline] pub fn p60db(self) -> &'a mut W { self.variant(PGALEFTW::P60DB) } #[doc = "4.5 db gain. value."] #[inline] pub fn p45db(self) -> &'a mut W { self.variant(PGALEFTW::P45DB) } #[doc = "3.0 db gain. value."] #[inline] pub fn p30db(self) -> &'a mut W { self.variant(PGALEFTW::P30DB) } #[doc = "1.5 db gain. value."] #[inline] pub fn p15db(self) -> &'a mut W { self.variant(PGALEFTW::P15DB) } #[doc = "0.0 db gain. value."] #[inline] pub fn _0db(self) -> &'a mut W { self.variant(PGALEFTW::_0DB) } #[doc = "-1.5 db gain. value."] #[inline] pub fn m15db(self) -> &'a mut W { self.variant(PGALEFTW::M15DB) } #[doc = "-3.0 db gain. value."] #[inline] pub fn m300db(self) -> &'a mut W { self.variant(PGALEFTW::M300DB) } #[doc = "-4.5 db gain. value."] #[inline] pub fn m45db(self) -> &'a mut W { self.variant(PGALEFTW::M45DB) } #[doc = "-6.0 db gain. value."] #[inline] pub fn m60db(self) -> &'a mut W { self.variant(PGALEFTW::M60DB) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bits(self, value: u8) -> &'a mut W { const MASK: u8 = 31; const OFFSET: u8 = 21; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `MCLKDIV`"] pub enum MCLKDIVW { #[doc = "Divide input clock by 4 value."] MCKDIV4, #[doc = "Divide input clock by 3 value."] MCKDIV3, #[doc = "Divide input clock by 2 value."] MCKDIV2, #[doc = "Divide input clock by 1 value."] MCKDIV1, } impl MCLKDIVW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> u8 { match *self { MCLKDIVW::MCKDIV4 => 3, MCLKDIVW::MCKDIV3 => 2, MCLKDIVW::MCKDIV2 => 1, MCLKDIVW::MCKDIV1 => 0, } } } #[doc = r" Proxy"] pub struct _MCLKDIVW<'a> { w: &'a mut W, } impl<'a> _MCLKDIVW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: MCLKDIVW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "Divide input clock by 4 value."] #[inline] pub fn mckdiv4(self) -> &'a mut W { self.variant(MCLKDIVW::MCKDIV4) } #[doc = "Divide input clock by 3 value."] #[inline] pub fn mckdiv3(self) -> &'a mut W { self.variant(MCLKDIVW::MCKDIV3) } #[doc = "Divide input clock by 2 value."] #[inline] pub fn mckdiv2(self) -> &'a mut W { self.variant(MCLKDIVW::MCKDIV2) } #[doc = "Divide input clock by 1 value."] #[inline] pub fn mckdiv1(self) -> &'a mut W { self.variant(MCLKDIVW::MCKDIV1) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bits(self, value: u8) -> &'a mut W { const MASK: u8 = 3; const OFFSET: u8 = 17; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = r" Proxy"] pub struct _SINCRATEW<'a> { w: &'a mut W, } impl<'a> _SINCRATEW<'a> { #[doc = r" Writes raw bits to the field"] #[inline] pub unsafe fn bits(self, value: u8) -> &'a mut W { const MASK: u8 = 127; const OFFSET: u8 = 10; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADCHPD`"] pub enum ADCHPDW { #[doc = "Enable high pass filter. value."] EN, #[doc = "Disable high pass filter. value."] DIS, } impl ADCHPDW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADCHPDW::EN => true, ADCHPDW::DIS => false, } } } #[doc = r" Proxy"] pub struct _ADCHPDW<'a> { w: &'a mut W, } impl<'a> _ADCHPDW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADCHPDW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable high pass filter. value."] #[inline] pub fn en(self) -> &'a mut W { self.variant(ADCHPDW::EN) } #[doc = "Disable high pass filter. value."] #[inline] pub fn dis(self) -> &'a mut W { self.variant(ADCHPDW::DIS) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 9; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = r" Proxy"] pub struct _HPCUTOFFW<'a> { w: &'a mut W, } impl<'a> _HPCUTOFFW<'a> { #[doc = r" Writes raw bits to the field"] #[inline] pub unsafe fn bits(self, value: u8) -> &'a mut W { const MASK: u8 = 15; const OFFSET: u8 = 5; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = r" Proxy"] pub struct _CYCLESW<'a> { w: &'a mut W, } impl<'a> _CYCLESW<'a> { #[doc = r" Writes raw bits to the field"] #[inline] pub unsafe fn bits(self, value: u8) -> &'a mut W { const MASK: u8 = 7; const OFFSET: u8 = 2; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `SOFTMUTE`"] pub enum SOFTMUTEW { #[doc = "Enable Soft Mute. value."] EN, #[doc = "Disable Soft Mute. value."] DIS, } impl SOFTMUTEW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { SOFTMUTEW::EN => true, SOFTMUTEW::DIS => false, } } } #[doc = r" Proxy"] pub struct _SOFTMUTEW<'a> { w: &'a mut W, } impl<'a> _SOFTMUTEW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: SOFTMUTEW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable Soft Mute. value."] #[inline] pub fn en(self) -> &'a mut W { self.variant(SOFTMUTEW::EN) } #[doc = "Disable Soft Mute. value."] #[inline] pub fn dis(self) -> &'a mut W { self.variant(SOFTMUTEW::DIS) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 1; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `PDMCOREEN`"] pub enum PDMCOREENW { #[doc = "Enable Data Streaming. value."] EN, #[doc = "Disable Data Streaming. value."] DIS, } impl PDMCOREENW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { PDMCOREENW::EN => true, PDMCOREENW::DIS => false, } } } #[doc = r" Proxy"] pub struct _PDMCOREENW<'a> { w: &'a mut W, } impl<'a> _PDMCOREENW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PDMCOREENW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable Data Streaming. value."] #[inline] pub fn en(self) -> &'a mut W { self.variant(PDMCOREENW::EN) } #[doc = "Disable Data Streaming. value."] #[inline] pub fn dis(self) -> &'a mut W { self.variant(PDMCOREENW::DIS) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 0; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } impl R { #[doc = r" Value of the register as raw bits"] #[inline] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bit 31 - Left/right channel swap."] #[inline] pub fn lrswap(&self) -> LRSWAPR { LRSWAPR::_from({ const MASK: bool = true; const OFFSET: u8 = 31; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bits 26:30 - Right channel PGA gain."] #[inline] pub fn pgaright(&self) -> PGARIGHTR { PGARIGHTR::_from({ const MASK: u8 = 31; const OFFSET: u8 = 26; ((self.bits >> OFFSET) & MASK as u32) as u8 }) } #[doc = "Bits 21:25 - Left channel PGA gain."] #[inline] pub fn pgaleft(&self) -> PGALEFTR { PGALEFTR::_from({ const MASK: u8 = 31; const OFFSET: u8 = 21; ((self.bits >> OFFSET) & MASK as u32) as u8 }) } #[doc = "Bits 17:18 - PDM_CLK frequency divisor."] #[inline] pub fn mclkdiv(&self) -> MCLKDIVR { MCLKDIVR::_from({ const MASK: u8 = 3; const OFFSET: u8 = 17; ((self.bits >> OFFSET) & MASK as u32) as u8 }) } #[doc = "Bits 10:16 - SINC decimation rate."] #[inline] pub fn sincrate(&self) -> SINCRATER { let bits = { const MASK: u8 = 127; const OFFSET: u8 = 10; ((self.bits >> OFFSET) & MASK as u32) as u8 }; SINCRATER { bits } } #[doc = "Bit 9 - High pass filter control."] #[inline] pub fn adchpd(&self) -> ADCHPDR { ADCHPDR::_from({ const MASK: bool = true; const OFFSET: u8 = 9; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bits 5:8 - High pass filter coefficients."] #[inline] pub fn hpcutoff(&self) -> HPCUTOFFR { let bits = { const MASK: u8 = 15; const OFFSET: u8 = 5; ((self.bits >> OFFSET) & MASK as u32) as u8 }; HPCUTOFFR { bits } } #[doc = "Bits 2:4 - Number of clocks during gain-setting changes."] #[inline] pub fn cycles(&self) -> CYCLESR { let bits = { const MASK: u8 = 7; const OFFSET: u8 = 2; ((self.bits >> OFFSET) & MASK as u32) as u8 }; CYCLESR { bits } } #[doc = "Bit 1 - Soft mute control."] #[inline] pub fn softmute(&self) -> SOFTMUTER { SOFTMUTER::_from({ const MASK: bool = true; const OFFSET: u8 = 1; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 0 - Data Streaming Control."] #[inline] pub fn pdmcoreen(&self) -> PDMCOREENR { PDMCOREENR::_from({ const MASK: bool = true; const OFFSET: u8 = 0; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } } impl W { #[doc = r" Reset value of the register"] #[inline] pub fn reset_value() -> W { W { bits: 50021 } } #[doc = r" Writes raw bits to the register"] #[inline] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } #[doc = "Bit 31 - Left/right channel swap."] #[inline] pub fn lrswap(&mut self) -> _LRSWAPW { _LRSWAPW { w: self } } #[doc = "Bits 26:30 - Right channel PGA gain."] #[inline] pub fn pgaright(&mut self) -> _PGARIGHTW { _PGARIGHTW { w: self } } #[doc = "Bits 21:25 - Left channel PGA gain."] #[inline] pub fn pgaleft(&mut self) -> _PGALEFTW { _PGALEFTW { w: self } } #[doc = "Bits 17:18 - PDM_CLK frequency divisor."] #[inline] pub fn mclkdiv(&mut self) -> _MCLKDIVW { _MCLKDIVW { w: self } } #[doc = "Bits 10:16 - SINC decimation rate."] #[inline] pub fn sincrate(&mut self) -> _SINCRATEW { _SINCRATEW { w: self } } #[doc = "Bit 9 - High pass filter control."] #[inline] pub fn adchpd(&mut self) -> _ADCHPDW { _ADCHPDW { w: self } } #[doc = "Bits 5:8 - High pass filter coefficients."] #[inline] pub fn hpcutoff(&mut self) -> _HPCUTOFFW { _HPCUTOFFW { w: self } } #[doc = "Bits 2:4 - Number of clocks during gain-setting changes."] #[inline] pub fn cycles(&mut self) -> _CYCLESW { _CYCLESW { w: self } } #[doc = "Bit 1 - Soft mute control."] #[inline] pub fn softmute(&mut self) -> _SOFTMUTEW { _SOFTMUTEW { w: self } } #[doc = "Bit 0 - Data Streaming Control."] #[inline] pub fn pdmcoreen(&mut self) -> _PDMCOREENW { _PDMCOREENW { w: self } } }
fn main(){ let names = vec!["Kannan", "Mohtashim", "Kiran"]; for name in names.into_iter() { match name { "Mohtashim" => println!("There is a rustacean among us!"), _ => println!("Hello {}", name), } } // cannot reuse the collection after iteration println!("{:?}",names); //Error:Cannot access after ownership move }
use winit::{ElementState, Event, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode, WindowEvent, KeyboardInput}; use resource::Input; use util::Direction; pub struct MenuGameControlSystem; impl<'a> ::specs::System<'a> for MenuGameControlSystem { type SystemData = ( ::specs::Fetch<'a, ::resource::Events>, ::specs::FetchMut<'a, ::resource::ImGuiOption>, ::specs::FetchMut<'a, ::resource::MenuState>, ); fn run(&mut self, (events, mut imgui, mut menu_state): Self::SystemData) { let imgui = imgui.as_mut().unwrap(); imgui.set_mouse_draw_cursor(false); for ev in events.0.iter() { match *ev { Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), state: ElementState::Pressed, .. }, .. }, .. } => { menu_state.state = ::resource::MenuStateState::Pause; }, Event::WindowEvent { event: WindowEvent::CursorMoved { position: (x, y), .. }, .. } => imgui.set_mouse_pos(x as f32, y as f32), _ => (), } } } } pub struct MenuPauseControlSystem { mouse_down: [bool; 5], } impl MenuPauseControlSystem { pub fn new() -> Self { MenuPauseControlSystem { mouse_down: [false; 5], } } } impl<'a> ::specs::System<'a> for MenuPauseControlSystem { type SystemData = ( ::specs::Fetch<'a, ::resource::Events>, ::specs::FetchMut<'a, ::resource::ImGuiOption>, ::specs::FetchMut<'a, ::resource::MenuState>, ::specs::FetchMut<'a, ::resource::Save>, ::specs::FetchMut<'a, ::resource::LevelActions>, ); fn run(&mut self, (events, mut imgui, mut menu_state, mut save, mut level_actions): Self::SystemData) { let mut imgui = imgui.as_mut().unwrap(); imgui.set_mouse_draw_cursor(true); send_events_to_imgui(&events, &mut imgui, &mut self.mouse_down); match menu_state.state { ::resource::MenuStateState::Game => unreachable!(), ::resource::MenuStateState::Restart => { if menu_state.restart_later_button { menu_state.state = ::resource::MenuStateState::Pause; } } ::resource::MenuStateState::Help => { if menu_state.help_ok_button { menu_state.state = ::resource::MenuStateState::Pause; } } ::resource::MenuStateState::CreateCustom => { save.set_custom_level_conf_lazy(menu_state.custom_level_conf.clone()); if menu_state.custom_return_button { menu_state.state = ::resource::MenuStateState::Pause; } if menu_state.custom_play_button { menu_state.state = ::resource::MenuStateState::Game; level_actions.0.push(::resource::LevelAction::Custom); } } ::resource::MenuStateState::Input(input) => { for ev in events.0.iter() { let received_input = match *ev { Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), state: ElementState::Pressed, .. }, .. }, .. } => { menu_state.state = ::resource::MenuStateState::Pause; break; }, Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { virtual_keycode: Some(keycode), state: ElementState::Pressed, .. }, .. }, .. } => { ::resource::PossibleInput::VirtualKeyCode(keycode) }, Event::WindowEvent { event: WindowEvent::MouseInput { button, state: ElementState::Pressed, .. }, .. } => { ::resource::PossibleInput::MouseButton(button) }, _ => { continue; }, }; save.set_input(input, received_input); menu_state.state = ::resource::MenuStateState::Pause; } }, ::resource::MenuStateState::Pause => { for ev in events.0.iter() { match *ev { Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), state: ElementState::Pressed, .. }, .. }, .. } => { menu_state.state = ::resource::MenuStateState::Game; }, _ => (), } } if menu_state.create_custom_button { menu_state.state = ::resource::MenuStateState::CreateCustom; } if menu_state.continue_button { menu_state.state = ::resource::MenuStateState::Game; } if menu_state.return_hall_button { level_actions.0.push(::resource::LevelAction::ReturnHall); menu_state.state = ::resource::MenuStateState::Game; } if menu_state.set_shoot_button { menu_state.state = ::resource::MenuStateState::Input(Input::Shoot); } if menu_state.set_forward_button { menu_state.state = ::resource::MenuStateState::Input(Input::Direction(Direction::Forward)); } if menu_state.set_backward_button { menu_state.state = ::resource::MenuStateState::Input(Input::Direction(Direction::Backward)); } if menu_state.set_left_button { menu_state.state = ::resource::MenuStateState::Input(Input::Direction(Direction::Left)); } if menu_state.set_right_button { menu_state.state = ::resource::MenuStateState::Input(Input::Direction(Direction::Right)); } if menu_state.reset_button { save.reset_controls(); menu_state.mouse_sensibility_input = save.mouse_sensibility(); menu_state.field_of_view_slider = save.field_of_view(); } if menu_state.fullscreen_checkbox { save.toggle_fullscreen(); menu_state.state = ::resource::MenuStateState::Restart; } if menu_state.help_button { menu_state.state = ::resource::MenuStateState::Help; } save.set_mouse_sensibility_lazy(menu_state.mouse_sensibility_input); if save.set_vulkan_device_uuid_lazy(&menu_state.vulkan_device) { menu_state.state = ::resource::MenuStateState::Restart; } save.set_effect_volume_lazy(menu_state.music_volume_slider); save.set_music_volume_lazy(menu_state.effect_volume_slider); save.set_field_of_view_lazy(menu_state.field_of_view_slider); }, } } } fn send_events_to_imgui(events: &::resource::Events, imgui: &mut ::imgui::ImGui, mouse_down: &mut [bool; 5]) { for ev in events.0.iter() { match *ev { Event::WindowEvent { event: WindowEvent::MouseInput { button, state, .. }, .. } => { match button { MouseButton::Left => mouse_down[0] = state == ElementState::Pressed, MouseButton::Right => mouse_down[1] = state == ElementState::Pressed, MouseButton::Middle => mouse_down[2] = state == ElementState::Pressed, MouseButton::Other(0) => { mouse_down[3] = state == ElementState::Pressed } MouseButton::Other(1) => { mouse_down[4] = state == ElementState::Pressed } MouseButton::Other(_) => (), } imgui.set_mouse_down(&mouse_down); } Event::WindowEvent { event: WindowEvent::CursorMoved { position: (x, y), .. }, .. } => imgui.set_mouse_pos(x as f32, y as f32), Event::WindowEvent { event: WindowEvent::KeyboardInput { input, .. }, .. } => { let pressed = input.state == ElementState::Pressed; match input.virtual_keycode { Some(VirtualKeyCode::Tab) => imgui.set_key(0, pressed), Some(VirtualKeyCode::Left) => imgui.set_key(1, pressed), Some(VirtualKeyCode::Right) => imgui.set_key(2, pressed), Some(VirtualKeyCode::Up) => imgui.set_key(3, pressed), Some(VirtualKeyCode::Down) => imgui.set_key(4, pressed), Some(VirtualKeyCode::PageUp) => imgui.set_key(5, pressed), Some(VirtualKeyCode::PageDown) => imgui.set_key(6, pressed), Some(VirtualKeyCode::Home) => imgui.set_key(7, pressed), Some(VirtualKeyCode::End) => imgui.set_key(8, pressed), Some(VirtualKeyCode::Delete) => imgui.set_key(9, pressed), Some(VirtualKeyCode::Back) => imgui.set_key(10, pressed), Some(VirtualKeyCode::Return) => imgui.set_key(11, pressed), Some(VirtualKeyCode::Escape) => imgui.set_key(12, pressed), Some(VirtualKeyCode::A) => imgui.set_key(13, pressed), Some(VirtualKeyCode::C) => imgui.set_key(14, pressed), Some(VirtualKeyCode::V) => imgui.set_key(15, pressed), Some(VirtualKeyCode::X) => imgui.set_key(16, pressed), Some(VirtualKeyCode::Y) => imgui.set_key(17, pressed), Some(VirtualKeyCode::Z) => imgui.set_key(18, pressed), Some(VirtualKeyCode::LControl) | Some(VirtualKeyCode::RControl) => { imgui.set_key_ctrl(pressed) } Some(VirtualKeyCode::LShift) | Some(VirtualKeyCode::RShift) => { imgui.set_key_shift(pressed) } Some(VirtualKeyCode::LAlt) | Some(VirtualKeyCode::RAlt) => { imgui.set_key_alt(pressed) } Some(VirtualKeyCode::LWin) | Some(VirtualKeyCode::RWin) => { imgui.set_key_super(pressed) } _ => (), } } Event::WindowEvent { event: WindowEvent::MouseWheel { delta, phase: TouchPhase::Moved, .. }, .. } => { // TODO: does both are send ? does it depend on computer match delta { MouseScrollDelta::LineDelta(_, y) => imgui.set_mouse_wheel(y), MouseScrollDelta::PixelDelta(_, y) => imgui.set_mouse_wheel(y), } } Event::WindowEvent { event: WindowEvent::ReceivedCharacter(c), .. } => { imgui.add_input_character(c); } _ => (), } } }
use std::{ collections::VecDeque, ffi::OsStr, io::{Result, Write}, path::{Path, PathBuf}, process::{Command, Output}, }; fn main() -> std::result::Result<(), Box<dyn std::error::Error>> { if Command::new("glslc").output().is_err() { eprintln!("Error compiling shaders: 'glslc' not found, do you have the Vulkan SDK installed?"); eprintln!("Get it at https://vulkan.lunarg.com/"); std::process::exit(1); } let shader_files = find_shader_files(); for path in shader_files.iter() { println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); } compile_shaders(&shader_files); #[cfg(not(target_os = "windows"))] { use std::os::unix::fs::PermissionsExt; let profile = std::env::var("PROFILE").unwrap(); let script_name = format!("gfaestus-{}", profile); let script = mk_run_script(); let mut file = std::fs::File::create(&script_name)?; file.write_all(script.as_bytes())?; let metadata = file.metadata()?; let mut perm = metadata.permissions(); perm.set_mode(0o777); file.set_permissions(perm)?; } Ok(()) } fn mk_run_script() -> String { let working_dir = env!("CARGO_MANIFEST_DIR"); let profile = std::env::var("PROFILE").unwrap(); let script = format!( r#" #!/usr/bin/env if [ $# -lt 2 ]; then echo "Usage: $0 <GFA> <layout TSV>" else f=$(readlink -f $1) l=$(readlink -f $2) cd {working_dir} && {working_dir}/target/{profile}/gfaestus --debug $f $l ; cd - fi "#, ); script } fn find_shader_files() -> Vec<PathBuf> { let shader_dir_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("shaders"); let mut result: Vec<PathBuf> = Vec::new(); let mut directories: VecDeque<PathBuf> = VecDeque::new(); directories.push_back(shader_dir_path.clone()); while let Some(dir) = directories.pop_front() { std::fs::read_dir(dir) .unwrap() .map(Result::unwrap) .for_each(|path| { if path.file_type().unwrap().is_dir() { directories.push_back(path.path()); } else if path.file_type().unwrap().is_file() && path.path().extension() != Some(OsStr::new("spv")) && path.path().extension() != Some(OsStr::new("glsl")) { result.push(path.path()); } }); } result } fn compile_shaders(files: &[PathBuf]) { for path in files { let name = path.file_name().unwrap().to_str().unwrap(); let output_name = format!("{}.spv", &name); let mut output_path = path.clone(); output_path.pop(); output_path.push(output_name); let result = Command::new("glslc") .arg(&path) .arg("-o") .arg(output_path) .output(); handle_program_result(result); } } fn handle_program_result(result: Result<Output>) { match result { Ok(output) => { if output.status.success() { println!("Shader compilation succedeed."); print!( "{}", String::from_utf8(output.stdout).unwrap_or( "Failed to print program stdout".to_string() ) ); } else { eprintln!( "Shader compilation failed. Status: {}", output.status ); eprint!( "{}", String::from_utf8(output.stdout).unwrap_or( "Failed to print program stdout".to_string() ) ); eprint!( "{}", String::from_utf8(output.stderr).unwrap_or( "Failed to print program stderr".to_string() ) ); panic!("Shader compilation failed. Status: {}", output.status); } } Err(error) => { panic!("Failed to compile shader. Cause: {}", error); } } }
#[doc = "Reader of register PWR_TRIM_BODOVP_CTL"] pub type R = crate::R<u32, super::PWR_TRIM_BODOVP_CTL>; #[doc = "Writer for register PWR_TRIM_BODOVP_CTL"] pub type W = crate::W<u32, super::PWR_TRIM_BODOVP_CTL>; #[doc = "Register PWR_TRIM_BODOVP_CTL `reset()`'s with value 0x0004_0d04"] impl crate::ResetValue for super::PWR_TRIM_BODOVP_CTL { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0x0004_0d04 } } #[doc = "Reader of field `HVPORBOD_TRIPSEL`"] pub type HVPORBOD_TRIPSEL_R = crate::R<u8, u8>; #[doc = "Write proxy for field `HVPORBOD_TRIPSEL`"] pub struct HVPORBOD_TRIPSEL_W<'a> { w: &'a mut W, } impl<'a> HVPORBOD_TRIPSEL_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07); self.w } } #[doc = "Reader of field `HVPORBOD_OFSTRIM`"] pub type HVPORBOD_OFSTRIM_R = crate::R<u8, u8>; #[doc = "Write proxy for field `HVPORBOD_OFSTRIM`"] pub struct HVPORBOD_OFSTRIM_W<'a> { w: &'a mut W, } impl<'a> HVPORBOD_OFSTRIM_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4); self.w } } #[doc = "Reader of field `HVPORBOD_ITRIM`"] pub type HVPORBOD_ITRIM_R = crate::R<u8, u8>; #[doc = "Write proxy for field `HVPORBOD_ITRIM`"] pub struct HVPORBOD_ITRIM_W<'a> { w: &'a mut W, } impl<'a> HVPORBOD_ITRIM_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 7)) | (((value as u32) & 0x07) << 7); self.w } } #[doc = "Reader of field `LVPORBOD_TRIPSEL`"] pub type LVPORBOD_TRIPSEL_R = crate::R<u8, u8>; #[doc = "Write proxy for field `LVPORBOD_TRIPSEL`"] pub struct LVPORBOD_TRIPSEL_W<'a> { w: &'a mut W, } impl<'a> LVPORBOD_TRIPSEL_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 10)) | (((value as u32) & 0x07) << 10); self.w } } #[doc = "Reader of field `LVPORBOD_OFSTRIM`"] pub type LVPORBOD_OFSTRIM_R = crate::R<u8, u8>; #[doc = "Write proxy for field `LVPORBOD_OFSTRIM`"] pub struct LVPORBOD_OFSTRIM_W<'a> { w: &'a mut W, } impl<'a> LVPORBOD_OFSTRIM_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 14)) | (((value as u32) & 0x07) << 14); self.w } } #[doc = "Reader of field `LVPORBOD_ITRIM`"] pub type LVPORBOD_ITRIM_R = crate::R<u8, u8>; #[doc = "Write proxy for field `LVPORBOD_ITRIM`"] pub struct LVPORBOD_ITRIM_W<'a> { w: &'a mut W, } impl<'a> LVPORBOD_ITRIM_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 17)) | (((value as u32) & 0x07) << 17); self.w } } impl R { #[doc = "Bits 0:2 - HVPORBOD trip point selection. Monitors vddd. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn hvporbod_tripsel(&self) -> HVPORBOD_TRIPSEL_R { HVPORBOD_TRIPSEL_R::new((self.bits & 0x07) as u8) } #[doc = "Bits 4:6 - HVPORBOD offset trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn hvporbod_ofstrim(&self) -> HVPORBOD_OFSTRIM_R { HVPORBOD_OFSTRIM_R::new(((self.bits >> 4) & 0x07) as u8) } #[doc = "Bits 7:9 - HVPORBOD current trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn hvporbod_itrim(&self) -> HVPORBOD_ITRIM_R { HVPORBOD_ITRIM_R::new(((self.bits >> 7) & 0x07) as u8) } #[doc = "Bits 10:12 - LVPORBOD trip point selection. Monitors vccd. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn lvporbod_tripsel(&self) -> LVPORBOD_TRIPSEL_R { LVPORBOD_TRIPSEL_R::new(((self.bits >> 10) & 0x07) as u8) } #[doc = "Bits 14:16 - LVPORBOD offset trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn lvporbod_ofstrim(&self) -> LVPORBOD_OFSTRIM_R { LVPORBOD_OFSTRIM_R::new(((self.bits >> 14) & 0x07) as u8) } #[doc = "Bits 17:19 - LVPORBOD current trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn lvporbod_itrim(&self) -> LVPORBOD_ITRIM_R { LVPORBOD_ITRIM_R::new(((self.bits >> 17) & 0x07) as u8) } } impl W { #[doc = "Bits 0:2 - HVPORBOD trip point selection. Monitors vddd. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn hvporbod_tripsel(&mut self) -> HVPORBOD_TRIPSEL_W { HVPORBOD_TRIPSEL_W { w: self } } #[doc = "Bits 4:6 - HVPORBOD offset trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn hvporbod_ofstrim(&mut self) -> HVPORBOD_OFSTRIM_W { HVPORBOD_OFSTRIM_W { w: self } } #[doc = "Bits 7:9 - HVPORBOD current trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn hvporbod_itrim(&mut self) -> HVPORBOD_ITRIM_W { HVPORBOD_ITRIM_W { w: self } } #[doc = "Bits 10:12 - LVPORBOD trip point selection. Monitors vccd. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn lvporbod_tripsel(&mut self) -> LVPORBOD_TRIPSEL_W { LVPORBOD_TRIPSEL_W { w: self } } #[doc = "Bits 14:16 - LVPORBOD offset trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn lvporbod_ofstrim(&mut self) -> LVPORBOD_OFSTRIM_W { LVPORBOD_OFSTRIM_W { w: self } } #[doc = "Bits 17:19 - LVPORBOD current trim. This register is only reset by XRES/POR/BOD/OVP/HIBERNATE."] #[inline(always)] pub fn lvporbod_itrim(&mut self) -> LVPORBOD_ITRIM_W { LVPORBOD_ITRIM_W { w: self } } }
use std::collections::HashMap; use std::collections::HashSet; pub fn solve_part_one(input: &str) -> usize { let mut containers = HashMap::new(); input .lines() .for_each(|line| { let parts: Vec<&str> = line.split(" bags contain ").collect(); let container = parts[0]; let contains = parts[1]; if contains != "no other bags." { contains.split(", ").for_each(|containee| { let containee_words: Vec<&str> = containee.split_whitespace().collect(); let containee_name = format!("{} {}", containee_words[1], containee_words[2]); let containee_containers = containers.entry(containee_name).or_insert(HashSet::new()); (*containee_containers).insert(container); }); } }); let mut bag_containers: HashSet<String> = HashSet::new(); let initial_bag = "shiny gold"; bag_containers.insert(initial_bag.to_string()); let mut done = false; while !done { let len_before = bag_containers.len(); for bag_container in bag_containers.clone() { for (containee, containee_containers) in &containers { if *containee == bag_container { for containee_container in containee_containers { bag_containers.insert(containee_container.to_string()); } } } } if bag_containers.len() == len_before { done = true; } } bag_containers.remove(initial_bag); bag_containers.len() } #[derive(Debug)] struct Containee { name: String, count: usize, } pub fn solve(input: &str) -> usize { let mut containers = HashMap::new(); input .lines() .for_each(|line| { let parts: Vec<&str> = line.split(" bags contain ").collect(); let container = parts[0]; let contains = parts[1]; let mut containees: Vec<Containee> = Vec::new(); if contains != "no other bags." { contains.split(", ").for_each(|containee| { let containee_words: Vec<&str> = containee.split_whitespace().collect(); let name = format!("{} {}", containee_words[1], containee_words[2]); let count: usize = containee_words[0].parse().expect("oh no"); containees.push(Containee { name, count, }); }); } containers.insert(container, containees); }); let initial_bag = "shiny gold"; get_containees(initial_bag, &containers) - 1 } fn get_containees(container: &str, containers: &HashMap<&str, Vec<Containee>>) -> usize { containers.get(container).expect("oh no").iter().fold(1, |sum, containee| { sum + containee.count * get_containees(&containee.name, &containers) }) }
use serde::Serialize; const PROTOCOL_VER: u8 = 1; const CLIENT: &str = "vndb_rs"; const CLIENT_VER: &str = env!("CARGO_PKG_VERSION"); #[derive(Serialize, Debug)] pub(crate) struct LoginRequest<'a> { protocol: u8, client: &'static str, clientver: &'static str, #[serde(skip_serializing_if = "Option::is_none")] username: Option<&'a str>, #[serde(skip_serializing_if = "Option::is_none")] password: Option<&'a str>, } impl<'a> Default for LoginRequest<'a> { fn default() -> Self { Self { protocol: PROTOCOL_VER, client: CLIENT, clientver: CLIENT_VER, username: None, password: None, } } } impl<'a> LoginRequest<'a> { pub(crate) fn new(username: &'a str, password: &'a str) -> Self { let mut new = Self::default(); new.username = Some(username); new.password = Some(password); new } }
//https://tools.ietf.org/html/rfc2616 // SP = <US-ASCII SP, space (32)> // CTL = <any US-ASCII control character // (octets 0 - 31) and DEL (127)> // HTTP-message = Request | Response // generic-message = start-line // *(message-header CRLF) // CRLF // [ message-body ] // start-line = Request-Line | Status-Line // Request-Line = Method SP Request-URI SP HTTP-Version CRLF // Method = "OPTIONS" ; Section 9.2 // | "GET" ; Section 9.3 // | "HEAD" ; Section 9.4 // | "POST" ; Section 9.5 // | "PUT" ; Section 9.6 // | "DELETE" ; Section 9.7 // | "TRACE" ; Section 9.8 // | "CONNECT" ; Section 9.9 // | extension-method // extension-method = token // token = 1*<any CHAR except CTLs or separators> // separators = "(" | ")" | "<" | ">" | "@" // | "," | ";" | ":" | "\" | <"> // | "/" | "[" | "]" | "?" | "=" // | "{" | "}" | SP | HT // Request-URI = "*" | absoluteURI | abs_path | authority // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT #[macro_use] extern crate common_failures; #[macro_use] extern crate failure; pub mod uri; use common_failures::prelude::*; use std::io::BufRead; enum Method { Options, Get, Head, Post, Put, Delete, Trace, Connect, Extension(String), } impl From<String> for Method { fn from(string: String) -> Method { match string.as_str() { "OPTIONS" => Method::Options, "GET" => Method::Get, "HEAD" => Method::Head, "POST" => Method::Post, "PUT" => Method::Put, "DELETE" => Method::Delete, "TRACE" => Method::Trace, "CONNECT" => Method::Connect, _ => Method::Extension(string), } } } fn method(r: &mut BufRead) -> Result<Option<Method>> { match next_token(r)? { Some(token) => Ok(Some(Method::from(token))), None => Ok(None), } } struct ReadStep { len: usize, done: bool, } fn next_token(r: &mut BufRead) -> Result<Option<String>> { let mut token: String = String::new(); while { let step: ReadStep = { let buf: &[u8] = r.fill_buf()?; let mut len: usize = 0; let mut done: bool = false; for b in buf { if is_ctl(*b) || is_separator(*b) { done = true; break; } else { token.push(*b as char); len = len + 1; } } ReadStep { len: len, done: done || len == 0, } }; r.consume(step.len); !step.done } {} let token = match token.len() { 0 => None, _ => Some(token), }; Ok(token) } fn is_separator(c: u8) -> bool { match c { b'(' => true, b')' => true, b'<' => true, b'>' => true, b'@' => true, b',' => true, b';' => true, b':' => true, b'\\' => true, b'"' => true, b'/' => true, b'[' => true, b']' => true, b'?' => true, b'=' => true, b'{' => true, b'}' => true, b' ' => true, b'\t' => true, _ => false, } } fn is_ctl(c: u8) -> bool { c < 32 || c == 127 } fn is_sp(c: u8) -> bool { c == 32 } #[cfg(test)] mod tests { use super::*; use std::io::prelude::*; use std::io::BufReader; #[test] fn test_next_token() { let mut r = BufReader::new("".as_bytes()); let t = next_token(&mut r).unwrap(); assert_eq!(None, t); let mut r = BufReader::new("hello".as_bytes()); let t = next_token(&mut r).unwrap(); assert_eq!(Some(String::from("hello")), t); let mut r = BufReader::new("hello world".as_bytes()); let t = next_token(&mut r).unwrap(); assert_eq!(Some(String::from("hello")), t); let t = next_token(&mut r).unwrap(); assert_eq!(None, t); let mut b: [u8; 1] = [0; 1]; r.read_exact(&mut b).unwrap(); assert_eq!(b' ', b[0]); let t = next_token(&mut r).unwrap(); assert_eq!(Some(String::from("world")), t); let t = next_token(&mut r).unwrap(); assert_eq!(None, t); } }
extern crate sdl2; use super::renderer; use sdl2::render; use sdl2::ttf; use sdl2::video; pub struct Window { canvas: render::Canvas<video::Window>, } impl Window { pub fn from(window: video::Window) -> Result<Window, String> { Ok(Window { canvas: window .into_canvas() .present_vsync() .index(find_sdl_gl_driver().unwrap()) .build() .map_err(|err| match err { sdl2::IntegerOrSdlError::IntegerOverflows(..) => "integer overflows".to_owned(), sdl2::IntegerOrSdlError::SdlError(err) => err, })?, }) } pub fn create_renderer(&self) -> Result<renderer::Renderer, String> { Ok(renderer::Renderer::from( sdl2::ttf::init().map_err(|err| match err { ttf::InitError::AlreadyInitializedError => "".to_owned(), ttf::InitError::InitializationError(err) => format!("{}", err), })?, self.canvas.texture_creator(), )) } pub fn canvas(&self) -> &render::Canvas<video::Window> { &self.canvas } pub fn canvas_mut(&mut self) -> &mut render::Canvas<video::Window> { &mut self.canvas } } fn find_sdl_gl_driver() -> Option<u32> { for (index, item) in sdl2::render::drivers().enumerate() { if item.name == "opengl" { return Some(index as u32); } } None }
use std::time::Duration; use bson::doc; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; use typed_builder::TypedBuilder; use crate::{ bson::{Bson, Document}, concern::{ReadConcern, WriteConcern}, options::{Collation, CursorType}, selection_criteria::SelectionCriteria, serde_util, }; /// These are the valid options for creating a [`Database`](../struct.Database.html) with /// [`Client::database_with_options`](../struct.Client.html#method.database_with_options). #[derive(Clone, Debug, Default, Deserialize, TypedBuilder)] #[builder(field_defaults(default, setter(into)))] #[non_exhaustive] pub struct DatabaseOptions { /// The default read preference for operations. pub selection_criteria: Option<SelectionCriteria>, /// The default read concern for operations. pub read_concern: Option<ReadConcern>, /// The default write concern for operations. pub write_concern: Option<WriteConcern>, } /// These are the valid options for creating a collection with /// [`Database::create_collection`](../struct.Database.html#method.create_collection). #[skip_serializing_none] #[derive(Clone, Debug, Default, Deserialize, TypedBuilder, Serialize)] #[serde(rename_all = "camelCase")] #[builder(field_defaults(default, setter(into)))] #[non_exhaustive] pub struct CreateCollectionOptions { /// Whether the collection should be capped. If true, `size` must also be set. pub capped: Option<bool>, /// The maximum size (in bytes) for a capped collection. This option is ignored if `capped` is /// not set to true. #[serde(serialize_with = "serde_util::serialize_u64_option_as_i64")] pub size: Option<u64>, /// The maximum number of documents in a capped collection. The `size` limit takes precedence /// over this option. If a capped collection reaches the size limit before it reaches the /// maximum number of documents, MongoDB removes old documents. #[serde(serialize_with = "serde_util::serialize_u64_option_as_i64")] pub max: Option<u64>, /// The storage engine that the collection should use. The value should take the following /// form: /// /// `{ <storage-engine-name>: <options> }` pub storage_engine: Option<Document>, /// Specifies a validator to restrict the schema of documents which can exist in the /// collection. Expressions can be specified using any query operators except `$near`, /// `$nearSphere`, `$text`, and `$where`. pub validator: Option<Document>, /// Specifies how strictly the database should apply the validation rules to existing documents /// during an update. pub validation_level: Option<ValidationLevel>, /// Specifies whether the database should return an error or simply raise a warning if inserted /// documents do not pass the validation. pub validation_action: Option<ValidationAction>, /// The name of the source collection or view to base this view on. If specified, this will /// cause a view to be created rather than a collection. pub view_on: Option<String>, /// An array that consists of the aggregation pipeline stages to run against `view_on` to /// determine the contents of the view. pub pipeline: Option<Vec<Document>>, /// The default collation for the collection or view. pub collation: Option<Collation>, /// The write concern for the operation. pub write_concern: Option<WriteConcern>, /// The default configuration for indexes created on this collection, including the _id index. pub index_option_defaults: Option<IndexOptionDefaults>, /// An object containing options for creating time series collections. See the [`create` /// command documentation](https://www.mongodb.com/docs/manual/reference/command/create/) for /// supported options, and the [Time Series Collections documentation]( /// https://www.mongodb.com/docs/manual/core/timeseries-collections/) for more information. /// /// This feature is only available on server versions 5.0 and above. pub timeseries: Option<TimeseriesOptions>, /// Used to automatically delete documents in time series collections. See the [`create` /// command documentation](https://www.mongodb.com/docs/manual/reference/command/create/) for more /// information. #[serde(default, with = "serde_util::duration_option_as_int_seconds")] pub expire_after_seconds: Option<Duration>, /// Options for supporting change stream pre- and post-images. pub change_stream_pre_and_post_images: Option<ChangeStreamPreAndPostImages>, /// Options for clustered collections. pub clustered_index: Option<ClusteredIndex>, /// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the /// database profiler, currentOp and logs. /// /// This option is only available on server versions 4.4+. pub comment: Option<Bson>, /// Map of encrypted fields for the created collection. #[cfg(feature = "in-use-encryption-unstable")] pub encrypted_fields: Option<Document>, } /// Specifies how strictly the database should apply validation rules to existing documents during /// an update. #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] #[non_exhaustive] pub enum ValidationLevel { /// Perform no validation for inserts and updates. Off, /// Perform validation on all inserts and updates. Strict, /// Perform validation on inserts as well as updates on existing valid documents, but do not /// perform validations on updates on existing invalid documents. Moderate, } /// Specifies whether the database should return an error or simply raise a warning if inserted /// documents do not pass the validation. #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] #[non_exhaustive] pub enum ValidationAction { /// Return an error if inserted documents do not pass the validation. Error, /// Raise a warning if inserted documents do not pass the validation. Warn, } /// Specifies options for a clustered collection. Some fields have required values; the `Default` /// impl uses those values. #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct ClusteredIndex { /// Key pattern; currently required to be `{_id: 1}`. pub key: Document, /// Currently required to be `true`. pub unique: bool, /// Optional; will be automatically generated if not provided. pub name: Option<String>, /// Optional; currently must be `2` if provided. #[serde(skip_serializing_if = "Option::is_none")] pub v: Option<i32>, } impl Default for ClusteredIndex { fn default() -> Self { Self { key: doc! { "_id": 1 }, unique: true, name: None, v: None, } } } /// Specifies default configuration for indexes created on a collection, including the _id index. #[derive(Clone, Debug, TypedBuilder, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] #[non_exhaustive] pub struct IndexOptionDefaults { /// The `storageEngine` document should be in the following form: /// /// `{ <storage-engine-name>: <options> }` pub storage_engine: Document, } /// Specifies options for creating a timeseries collection. #[skip_serializing_none] #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, TypedBuilder)] #[serde(rename_all = "camelCase")] #[builder(field_defaults(default))] #[non_exhaustive] pub struct TimeseriesOptions { /// Name of the top-level field to be used for time. Inserted documents must have this field, /// and the field must be of the BSON UTC datetime type. pub time_field: String, /// Name of the top-level field describing the series. This field is used to group related data /// and may be of any BSON type, except for array. This name may not be the same as the /// timeField or _id. pub meta_field: Option<String>, /// The units you'd use to describe the expected interval between subsequent measurements for a /// time-series. Defaults to `TimeseriesGranularity::Seconds` if unset. pub granularity: Option<TimeseriesGranularity>, /// The maximum time between timestamps in the same bucket. This value must be between 1 and /// 31,536,000 seconds. If this value is set, the same value should be set for /// `bucket_rounding` and `granularity` should not be set. /// /// This option is only available on MongoDB 6.3+. #[serde( default, with = "serde_util::duration_option_as_int_seconds", rename = "bucketMaxSpanSeconds" )] pub bucket_max_span: Option<Duration>, /// The time interval that determines the starting timestamp for a new bucket. When a document /// requires a new bucket, MongoDB rounds down the document's timestamp value by this interval /// to set the minimum time for the bucket. If this value is set, the same value should be set /// for `bucket_max_span` and `granularity` should not be set. /// /// This option is only available on MongoDB 6.3+. #[serde( default, with = "serde_util::duration_option_as_int_seconds", rename = "bucketRoundingSeconds" )] pub bucket_rounding: Option<Duration>, } /// The units you'd use to describe the expected interval between subsequent measurements for a /// time-series. #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] #[non_exhaustive] pub enum TimeseriesGranularity { /// The expected interval between subsequent measurements is in seconds. Seconds, /// The expected interval between subsequent measurements is in minutes. Minutes, /// The expected interval between subsequent measurements is in hours. Hours, } /// Specifies the options to a [`Database::drop`](../struct.Database.html#method.drop) operation. #[derive(Clone, Debug, Default, TypedBuilder, Serialize)] #[serde(rename_all = "camelCase")] #[builder(field_defaults(default, setter(into)))] #[non_exhaustive] pub struct DropDatabaseOptions { /// The write concern for the operation. pub write_concern: Option<WriteConcern>, } /// Specifies the options to a /// [`Database::list_collections`](../struct.Database.html#method.list_collections) operation. #[skip_serializing_none] #[derive(Clone, Debug, Default, Deserialize, TypedBuilder, Serialize)] #[serde(rename_all = "camelCase")] #[builder(field_defaults(default, setter(into)))] #[non_exhaustive] pub struct ListCollectionsOptions { /// The number of documents the server should return per cursor batch. /// /// Note that this does not have any affect on the documents that are returned by a cursor, /// only the number of documents kept in memory at a given time (and by extension, the /// number of round trips needed to return the entire set of documents returned by the /// query). #[serde( serialize_with = "serde_util::serialize_u32_option_as_batch_size", rename(serialize = "cursor") )] pub batch_size: Option<u32>, /// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the /// database profiler, currentOp and logs. /// /// This option is only available on server versions 4.4+. pub comment: Option<Bson>, } /// Specifies the options to a /// [`Client::list_databases`](../struct.Client.html#method.list_databases) operation. #[skip_serializing_none] #[derive(Clone, Debug, Default, Deserialize, TypedBuilder, Serialize)] #[serde(rename_all = "camelCase")] #[builder(field_defaults(default, setter(into)))] #[non_exhaustive] pub struct ListDatabasesOptions { /// Determines which databases to return based on the user's access privileges. This option is /// only supported on server versions 4.0.5+. pub authorized_databases: Option<bool>, /// Tags the query with an arbitrary [`Bson`] value to help trace the operation through the /// database profiler, currentOp and logs. /// /// This option is only available on server versions 4.4+. pub comment: Option<Bson>, } /// Specifies how change stream pre- and post-images should be supported. #[derive(Clone, Debug, Default, Deserialize, TypedBuilder, Serialize)] #[serde(rename_all = "camelCase")] #[builder(field_defaults(default, setter(into)))] #[non_exhaustive] pub struct ChangeStreamPreAndPostImages { /// If `true`, change streams will be able to include pre- and post-images. pub enabled: bool, } /// Specifies the options to a /// [`Database::RunCursorCommand`](../struct.Database.html#method.run_cursor_command) operation. #[derive(Clone, Debug, Default, Deserialize, TypedBuilder)] #[builder(field_defaults(default, setter(into)))] #[serde(rename_all = "camelCase")] #[serde(default)] #[non_exhaustive] pub struct RunCursorCommandOptions { /// The default read preference for operations. pub selection_criteria: Option<SelectionCriteria>, /// The type of cursor to return. pub cursor_type: Option<CursorType>, /// Number of documents to return per batch. pub batch_size: Option<u32>, #[serde(rename = "maxtime", alias = "maxTimeMS")] #[serde(deserialize_with = "serde_util::deserialize_duration_option_from_u64_millis")] /// Optional non-negative integer value. Use this value to configure the maxTimeMS option sent /// on subsequent getMore commands. pub max_time: Option<Duration>, /// Optional BSON value. Use this value to configure the comment option sent on subsequent /// getMore commands. pub comment: Option<Bson>, }
use crate::services::bicycle_manager::*; use serde::{Deserialize, Serialize}; #[derive(Deserialize)] pub struct BicycleRequest { pub wheel_size: i32, pub description: String, } #[derive(Serialize)] pub struct BicycleResponse { pub id: i32, pub wheel_size: i32, pub description: String, } impl BicycleResponse { pub fn of(bicycle: BicycleOut) -> BicycleResponse { BicycleResponse { id: bicycle.id, wheel_size: bicycle.wheel_size, description: bicycle.description, } } }
use std::{time::Duration, u64}; use dbus::blocking::Connection; const DBUS_COMPIZ_ROOT: &str = "org.freedesktop.compiz"; const DBUS_EXPO_KEY: &str = "/org/freedesktop/compiz/expo/allscreens/expo_key"; /// The command to do this from the command line is: /// /// dbus-send --print-reply --type=method_call --dest=org.freedesktop.compiz /// /org/freedesktop/compiz/expo/allscreens/expo_key /// org.freedesktop.compiz.activate string:'root' /// int32:`xwininfo -root | grep id: | awk '{ print $4 }'` /// /// For sanity reasons, though, I'm using d-bus interface directly. /// pub fn trigger_expo() { let conn = Connection::new_session() .expect("D-Bus connection failed"); let proxy = conn.with_proxy(DBUS_COMPIZ_ROOT, DBUS_EXPO_KEY, Duration::from_secs(3)); let result: Result<(), dbus::Error> = proxy.method_call( DBUS_COMPIZ_ROOT, "activate", ("root", xorg_root_id() as i32), ); result.expect("call failed"); } /// /// Retrieve root window identifier from X11 runtime /// fn xorg_root_id() -> u64 { use x11::xlib::{XOpenDisplay, XRootWindow}; let display = std::ffi::CString::new(crate::config::XORG_DISPLAY).expect("wrong conversion"); unsafe { let xdisplay = XOpenDisplay(display.as_ptr()); let root_id = XRootWindow(xdisplay, 0); root_id } } #[test] fn test_expo_trigger() { println!("Triggering Expo"); trigger_expo(); }
use crate::{ app::util::arg::{category, formatter}, repository::{Package, Repository}, util::{optfilter::OptFilter, repoobject::RepoObject}, }; use clap::{App, ArgMatches, Error, SubCommand}; use std::path::Path; pub(crate) const NAME: &str = "packages"; pub(crate) const ABOUT: &str = "Iterate all packages in a repository"; pub(crate) fn subcommand<'x, 'y>() -> App<'x, 'y> { SubCommand::with_name(NAME) .about(ABOUT) .arg(formatter::arg()) .arg(category::arg()) } pub(crate) fn run(repo: &str, command: &ArgMatches<'_>) -> Result<(), Error> { let r = Repository::new(Path::new(repo)); let formatter = formatter::get(command); if let Some(categories) = category::get(command) { for cat in categories { let c = r.get_category(cat); if !c.is_legal() { panic!("{:?} is not legal in the given repository", c); } let citer = c.packages().expect("Error reading packages from repo"); for it in citer .filter_oks(Package::is_legal) .extract_errs(|e| panic!(e)) { println!("{}", it.render(&formatter)); } } } else { let citer = r.packages().expect("Error reading ebuilds from repo"); for it in citer.filter_oks(Package::is_legal).extract_errs(|e| panic!(e)) { println!("{}", it.render(&formatter)); } } Ok(()) }
use sha2::{Sha256, Sha512, Digest}; use crate::blockchain::block::Block; #[derive(Debug)] pub struct Verifier{ } impl Verifier { pub fn hash_block(&self, block: &Block) -> Vec<u8> { return self.hash_string_sha256(block.to_string()) } pub fn hash_string_sha256(&self, str: String) -> Vec<u8> { let mut hasher = Sha256::new(); hasher.input(str); let result = hasher.result(); result[..].to_vec() } pub fn verify_one_transaction(&self){ unimplemented!() } pub fn verify_all_transactions(&self){ unimplemented!() } }
pub fn sample() { println!("Lib"); }
extern crate clap; extern crate rust_htslib; extern crate bio; use clap::{Arg, App}; use rust_htslib::bam; use rust_htslib::prelude::*; use bio::io::fasta; #[derive(Clone)] pub struct GenomicInterval { pub tid: u32, pub chrom: String, // chromosome name pub start_pos: u32, // start of interval pub end_pos: u32, // end of interval (inclusive) } pub fn parse_target_names(bam_file: &String) -> Vec<String> { let bam = bam::Reader::from_path(bam_file).unwrap(); let header_view = bam.header(); let target_names_dec: Vec<&[u8]> = header_view.target_names(); let mut target_names: Vec<String> = vec![]; for t_name_dec in target_names_dec { let mut name_vec: Vec<char> = vec![]; for decr in t_name_dec { let dec: u8 = *decr; name_vec.push(dec as char); } let name_string: String = name_vec.into_iter().collect(); target_names.push(name_string); } target_names } pub fn u8_to_string(u: &[u8]) -> String { String::from_utf8(u.to_vec()).unwrap() } pub fn dna_vec(u: &[u8]) -> (Vec<char>) { let mut v: Vec<char> = Vec::with_capacity(u.len()); for cu in u.to_ascii_uppercase() { let c = cu as char; //assert!(c == 'A' || c == 'C' || c == 'G' || c == 'T' || c == 'N'); if c == 'A' || c == 'C' || c == 'G' || c == 'T' || c == 'N' { v.push(c); } else { eprintln!("Warning: Unexpected base \"{}\" encountered. Replaced with \"N\".", c); v.push('N'); } } v } pub fn get_whole_genome_intervals(bam_file: &String) -> Vec<GenomicInterval> { let bam = bam::Reader::from_path(bam_file).unwrap(); let header_view = bam.header(); let target_names_dec: Vec<&[u8]> = header_view.target_names(); let mut intervals: Vec<GenomicInterval> = vec![]; for (tid, t_name_dec) in target_names_dec.iter().enumerate() { let mut name_vec: Vec<char> = vec![]; for decr in t_name_dec.iter() { let dec: u8 = *decr; name_vec.push(dec as char); } let name_string: String = name_vec.into_iter().collect(); intervals.push(GenomicInterval{ tid: tid as u32, chrom: name_string, start_pos: 0, end_pos: header_view.target_len(tid as u32).unwrap()-1 }); } intervals } // given a bam file name and a possible genomic interval, // if the interval exists then just return a vector holding that lone interval // otherwise, if the interval is None, // return a vector holding GenomicIntervals representing the whole genome. pub fn get_interval_lst(bam_file: &String, interval: &Option<GenomicInterval>) -> Vec<GenomicInterval> { match interval { &Some(ref iv) => { vec![iv.clone()] } &None => { get_whole_genome_intervals(bam_file) } } } // this is really ugly. TODO a less verbose implementation pub fn parse_region_string(region_string: Option<&str>, bamfile_name: &String) -> Option<GenomicInterval> { let bam = bam::Reader::from_path(bamfile_name).unwrap(); match region_string { Some(r) if r.contains(":") && r.contains("-") => { let split1: Vec<&str> = r.split(":").collect(); if split1.len() != 2 { panic!("Invalid format for region. Please use <chrom> or <chrom:start-stop>"); } let split2: Vec<&str> = split1[1].split("-").collect(); if split2.len() != 2 { panic!("Invalid format for region. Please use <chrom> or <chrom:start-stop>"); } let iv_chrom = split1[0].to_string(); let iv_start = split2[0].parse::<u32>().expect("Invalid position value specified in region string."); let iv_end = split2[1].parse::<u32>().expect("Invalid position value specified in region string."); let mut tid: u32 = 0; for name in bam.header().target_names() { if u8_to_string(name) == iv_chrom { break; } tid += 1; } if tid as usize == bam.header().target_names().len() { panic!("Chromosome name for region is not in BAM file."); } Some(GenomicInterval { tid: tid, chrom: iv_chrom, start_pos: iv_start - 1, end_pos: iv_end - 1, }) } Some(r) => { let r_str = r.to_string(); let mut tid: u32 = 0; for name in bam.header().target_names() { if u8_to_string(name) == r_str { break; } tid += 1; } if tid as usize == bam.header().target_names().len() { panic!("Chromosome name for region is not in BAM file."); } let tlen = bam.header().target_len(tid).unwrap(); Some(GenomicInterval { tid: tid, chrom: r_str, start_pos: 0, end_pos: tlen - 1, }) } None => None, } } pub fn count_mapped_reads(bam_file: &String, fasta_file: &String, interval: &Option<GenomicInterval>, min_coverage: u32, min_mapq: u8, min_map_frac: f64, mapped_count_mode: bool) { let target_names = parse_target_names(&bam_file); let mut fasta = fasta::IndexedReader::from_file(&fasta_file).unwrap(); // pileup over all covered sites let mut ref_seq: Vec<char> = vec![]; let mut prev_tid = 4294967295; let a_str = "A".to_string(); let c_str = "C".to_string(); let g_str = "G".to_string(); let t_str = "T".to_string(); let interval_lst: Vec<GenomicInterval> = get_interval_lst(bam_file, interval); let mut bam_ix = bam::IndexedReader::from_path(bam_file).unwrap(); let mut count = 0; for iv in interval_lst { bam_ix.fetch(iv.tid as u32, iv.start_pos as u32, iv.end_pos as u32 + 1).ok().expect("Error seeking BAM file while extracting fragments."); let bam_pileup = bam_ix.pileup(); for p in bam_pileup { let pileup = p.unwrap(); let tid: usize = pileup.tid() as usize; let chrom: String = target_names[tid].clone(); let pos0: usize = pileup.pos() as usize; if chrom != iv.chrom || pos0 < iv.start_pos as usize || pos0 > iv.end_pos as usize { continue; } if tid != prev_tid { let mut ref_seq_u8: Vec<u8> = vec![]; fasta.read_all(&chrom, &mut ref_seq_u8).expect("Failed to read fasta sequence record."); ref_seq = dna_vec(&ref_seq_u8); } let ref_base_str = (ref_seq[pileup.pos() as usize]).to_string(); if ref_base_str.contains("N") { continue; } assert!(ref_base_str == a_str || ref_base_str == c_str || ref_base_str == g_str || ref_base_str == t_str); let mut depth: usize = 0; let mut well_mapped: usize = 0; // pileup the bases for a single position and count number of each base for alignment in pileup.alignments() { let record = alignment.record(); // may be faster to implement this as bitwise operation on raw flag in the future? if record.is_secondary() || record.is_quality_check_failed() || record.is_duplicate() || record.is_supplementary() { continue; } depth += 1; if record.is_unmapped() || record.mapq() < min_mapq { continue; } well_mapped += 1; } let well_mapped_frac = well_mapped as f64 / depth as f64; if mapped_count_mode { if well_mapped >= min_coverage as usize { count += 1; } } else { if depth >= min_coverage as usize && well_mapped_frac >= min_map_frac { count += 1; } } prev_tid = tid; } } println!("{}",count); } fn main() { let input_args = App::new("Map Counter") .version("0.1") .author("Peter Edge <edge.peterj@gmail.com>") .about("Given a bam, count the number of positions exceeding a given min coverage and \"well-mapped\" fraction.") .arg(Arg::with_name("Input BAM") .short("b") .long("bam") .value_name("BAM") .help("sorted, indexed BAM file.") .display_order(10) .required(true) .takes_value(true)) .arg(Arg::with_name("Input FASTA") .short("r") .long("ref") .value_name("FASTA") .help("indexed fasta reference that BAM file is aligned to") .display_order(20) .required(true) .takes_value(true)) .arg(Arg::with_name("Chrom") .short("C") .long("chrom") .value_name("string") .help("Chromosome to limit analysis to.") .display_order(30) .takes_value(true)) .arg(Arg::with_name("Min coverage") .short("c") .long("min_cov") .value_name("int") .help("Minimum coverage (of reads passing filters) to consider position as a potential SNV.") .display_order(40) .required(true) .default_value("0")) .arg(Arg::with_name("Well-mapped fraction") .short("f") .long("map_frac") .value_name("float") .help("Minimum fraction of mapped reads with mapq >= MAPQ_CUTOFF.") .display_order(50) .required(true) .default_value("0")) .arg(Arg::with_name("Min mapq") .short("q") .long("min_mapq") .value_name("int") .help("Map quality cutoff (for calculating well-mapped fraction).") .display_order(60) .default_value("60")) .arg(Arg::with_name("Mapped read count mode") .short("m") .long("mapped_count_mode") .help("Ignore map fraction and use total mapped read count. \ Return the total number of positions with at least min_cov reads having mapq>=min_mapq. \ Default behavior is to return the number of positions with at least min_cov reads, where \ at least map_frac of them have mapq>=min_mapq") .display_order(161)) .get_matches(); let bamfile_name = input_args.value_of("Input BAM").unwrap().to_string(); let fastafile_name = input_args.value_of("Input FASTA").unwrap().to_string(); let interval: Option<GenomicInterval> = parse_region_string(input_args.value_of("Chrom"), &bamfile_name); let min_mapq = input_args.value_of("Min mapq") .unwrap() .parse::<u8>() .expect("Argument min_mapq must be an int!"); let min_cov = input_args.value_of("Min coverage") .unwrap() .parse::<u32>() .expect("Argument min_cov must be an int!"); let min_map_frac = input_args.value_of("Well-mapped fraction") .unwrap() .parse::<f64>() .expect("Argument map_frac must be a positive float!"); let mapped_count_mode: bool = match input_args.occurrences_of("Mapped read count mode") { 0 => {false}, 1 => {true}, _ => { panic!("mapped_count_mode specified multiple times"); } }; count_mapped_reads(&bamfile_name, &fastafile_name, &interval, min_cov, min_mapq, min_map_frac, mapped_count_mode); }
use std::error::Error; use std::fs; pub fn run(config: Config) -> Result<(), Box<dyn Error>> { let file_contents = fs::read_to_string(config.filename).expect("something went wrong in reading file"); let result = search(&config.query, &file_contents); let number_of_result = result.len(); println!("{} results found !", number_of_result); for line in result { println!("\t{} - {}", line.line_number, line.content); } Ok(()) } fn search<'a>(term: &'a str, content: &'a str) -> Vec<LineResult<'a>> { let mut result_line: Vec<LineResult> = Vec::new(); let mut line_count: u32 = 0; for line in content.lines() { line_count += 1; if line.contains(term) { result_line.push(LineResult { content: line, line_number: line_count }); } } result_line } struct LineResult<'a> { content: &'a str, line_number: u32, } pub struct Config { pub query: String, pub filename: String, } impl Config { pub fn new(args: &[String]) -> Result<Config, &str> { if args.len() < 3 { return Err("Not enough arguments"); } let query: String = args[1].clone(); let filename: String = args[2].clone(); Ok(Config { query, filename }) } } #[cfg(test)] mod test { use super::*; #[test] fn one_result() { let test_query = "test"; let test_content = "/ this is a test sentence "; assert_eq!("this is a test sentence", search(test_query, test_content)[0].content) } }
use std::cmp; use std::ops::Range; use std::path::{Path, PathBuf}; use std::rc::Rc; #[derive(Debug)] pub struct Loc { path: Rc<PathBuf>, byte_range: Range<usize>, } impl Loc { pub fn new(path: Rc<PathBuf>, byte_range: Range<usize>) -> Self { Loc { path, byte_range } } pub fn path(&self) -> &Path { &self.path } pub fn range(&self) -> Range<usize> { self.byte_range.clone() } pub fn join(&self, other: &Loc) -> Loc { if self.path != other.path { panic!("can't join locs from disparate files"); } let start = cmp::min(self.byte_range.start, other.byte_range.start); let end = cmp::max(self.byte_range.end, other.byte_range.end); Loc { path: Rc::clone(&self.path), byte_range: start..end, } } }
use super::Part; use crate::util::int_code_computer::*; pub fn solve(input : String, part: Part) -> String { let opcodes:Vec<i64> = input.split(',') .map(|op| op.trim().parse().unwrap()) .collect(); let result = match part { Part::Part1 => part1(opcodes), Part::Part2 => part2(opcodes) }; format!("{}",result) } fn part1(mut opcodes:Vec<i64>) -> i64 { *(&mut opcodes[1]) = 12; *(&mut opcodes[2]) = 2; let mut program = Program::new(opcodes, None); program.run(); program.get_memory(0) } fn part2(opcodes:Vec<i64>) -> i64 { const RESULT:i64 = 19690720; let mut i = 0; let mut output = 0; while i < 100 { let mut j = 0; while j < 100 { let opcode_input = opcodes.clone(); let result = run_int_codes(i,j,opcode_input); //println!("i={}, j={}, result={}", i,j,result); if result == RESULT { output = 100 * i + j; //println!("Found the answer"); return output; } j +=1; } i+=1; }; output } fn run_int_codes(pos1:i64, pos2:i64, mut opcodes : Vec<i64>) -> i64 { *(&mut opcodes[1]) = pos1; *(&mut opcodes[2]) = pos2; let mut prog = Program::new(opcodes, None); prog.run(); prog.get_memory(0) } #[cfg(test)] mod tests { // Note this useful idiom: importing names from outer (for mod tests) scope. use super::*; #[test] fn test2() { let input = vec![1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,9,19,1,10,19,23,2,9,23,27,1,6,27,31,2,31,9,35,1,5,35,39,1,10,39,43,1,10,43,47,2,13,47,51,1,10,51,55,2,55,10,59,1,9,59,63,2,6,63,67,1,5,67,71,1,71,5,75,1,5,75,79,2,79,13,83,1,83,5,87,2,6,87,91,1,5,91,95,1,95,9,99,1,99,6,103,1,103,13,107,1,107,5,111,2,111,13,115,1,115,6,119,1,6,119,123,2,123,13,127,1,10,127,131,1,131,2,135,1,135,5,0,99,2,14,0,0]; println!("{:?}", part1(input)); } #[test] fn test5() { let opcodes = vec![1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,9,19,1,10,19,23,2,9,23,27,1,6,27,31,2,31,9,35,1,5,35,39,1,10,39,43,1,10,43,47,2,13,47,51,1,10,51,55,2,55,10,59,1,9,59,63,2,6,63,67,1,5,67,71,1,71,5,75,1,5,75,79,2,79,13,83,1,83,5,87,2,6,87,91,1,5,91,95,1,95,9,99,1,99,6,103,1,103,13,107,1,107,5,111,2,111,13,115,1,115,6,119,1,6,119,123,2,123,13,127,1,10,127,131,1,131,2,135,1,135,5,0,99,2,14,0,0]; for i in 0..99 { for j in 0..99 { let res = run_int_codes(i,j, opcodes.clone()); if res == 19690720 { break; } } } //println!("{:?}", part2(input)); } }
use base64; use crypto; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; fn main() { let input = File::open("10.txt").unwrap(); println!( "{}", String::from_utf8(decrypt( &base64::decode( &BufReader::new(input) .lines() .map(|x| x.unwrap()) .collect::<Vec<_>>() .join(""), ) .unwrap(), b"YELLOW SUBMARINE", &[0; 16], )) .unwrap() ); } fn decrypt(ciphertext: &[u8], key: &[u8], iv: &[u8]) -> Vec<u8> { let mut plaintext = Vec::with_capacity(ciphertext.len()); let mut prev_block = iv; ciphertext.chunks(16).for_each(|ciphertext_block| { let mut decryptor = crypto::aes::ecb_decryptor( crypto::aes::KeySize::KeySize128, key, crypto::blockmodes::NoPadding, ); let mut plaintext_block = [0; 16]; decryptor .decrypt( &mut crypto::buffer::RefReadBuffer::new(&ciphertext_block), &mut crypto::buffer::RefWriteBuffer::new(&mut plaintext_block), true, ) .unwrap(); plaintext.append( &mut plaintext_block .iter() .zip(prev_block.iter()) .map(|(a, b)| a ^ b) .collect::<Vec<u8>>(), ); prev_block = &ciphertext_block; }); return plaintext.to_vec(); } #[allow(dead_code)] fn encrypt(plaintext: &[u8], key: &[u8], iv: &[u8]) -> Vec<u8> { let mut ciphertext = Vec::with_capacity(plaintext.len()); let mut prev_block = iv.to_vec(); let mut ciphertext_block = [0; 16]; plaintext.chunks(16).for_each(|plaintext_block| { let mut encryptor = crypto::aes::ecb_encryptor( crypto::aes::KeySize::KeySize128, key, crypto::blockmodes::NoPadding, ); encryptor .encrypt( &mut crypto::buffer::RefReadBuffer::new( &mut plaintext_block .iter() .zip(prev_block.iter()) .map(|(a, b)| a ^ b) .collect::<Vec<u8>>(), ), &mut crypto::buffer::RefWriteBuffer::new(&mut ciphertext_block), true, ) .unwrap(); prev_block = ciphertext_block.to_vec(); ciphertext.extend_from_slice(&ciphertext_block); }); return ciphertext.to_vec(); } #[test] fn test_encrypt_decrypt() { let key = b"YELLOW SUBMARINE"; let iv = &[0; 16]; assert_eq!( decrypt( &encrypt(b"HELLO THERE!! GENERAL KENOBI!!!!", key, iv), key, iv ), b"HELLO THERE!! GENERAL KENOBI!!!!" ); }
fn main() { let n = { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end().parse().unwrap() }; let a = { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end() .split_whitespace() .map(|v| v.parse().unwrap()) .collect() }; let b = { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end() .split_whitespace() .map(|v| v.parse().unwrap()) .collect() }; let stdout = solve(n, a, b); stdout.iter().for_each(|s| { println!("{}", s); }) } fn solve(n: usize, a: Vec<isize>, b: Vec<isize>) -> Vec<String> { let mut ans = 0; (0..n).for_each(|i| { ans += (a[i] as i64) * (b[i] as i64); }); let mut buf = Vec::new(); if ans == 0 { buf.push(format!("Yes")); } else { buf.push(format!("No")); } buf }
use ::mem::malloc; // pub struct Context { // /// FX valid? // loadable: bool, // /// FX location // fx: usize, // /// Page table pointer // cr3: usize, // /// RFLAGS register // rflags: usize, // /// RBX register // rbx: usize, // /// R12 register // r12: usize, // /// R13 register // r13: usize, // /// R14 register // r14: usize, // /// R15 register // r15: usize, // /// Base pointer // rbp: usize, // /// Stack pointer // rsp: usize // } // impl Context { // pub fn new() -> Context { // Context { // loadable: false, // fx: 0, // // cr3: 0, // rflags: 0, // rbx: 0, // r12: 0, // r13: 0, // r14: 0, // r15: 0, // rbp: 0, // rsp: 0 // } // } // #[cold] // #[inline(never)] // #[naked] // pub unsafe fn switch_to(&mut self, next: &mut Context) { // asm!("fxsave [$0]" : : "r"(self.fx) : "memory" : "intel", "volatile"); // self.loadable = true; // if next.loadable { // asm!("fxrstor [$0]" : : "r"(next.fx) : "memory" : "intel", "volatile"); // }else{ // asm!("fninit" : : : "memory" : "intel", "volatile"); // } // // asm!("mov $0, cr3" : "=r"(self.cr3) : : "memory" : "intel", "volatile"); // // if next.cr3 != self.cr3 { // // asm!("mov cr3, $0" : : "r"(next.cr3) : "memory" : "intel", "volatile"); // // } // asm!("pushfq ; pop $0" : "=r"(self.rflags) : : "memory" : "intel", "volatile"); // asm!("push $0 ; popfq" : : "r"(next.rflags) : "memory" : "intel", "volatile"); // asm!("mov $0, rbx" : "=r"(self.rbx) : : "memory" : "intel", "volatile"); // asm!("mov rbx, $0" : : "r"(next.rbx) : "memory" : "intel", "volatile"); // asm!("mov $0, r12" : "=r"(self.r12) : : "memory" : "intel", "volatile"); // asm!("mov r12, $0" : : "r"(next.r12) : "memory" : "intel", "volatile"); // asm!("mov $0, r13" : "=r"(self.r13) : : "memory" : "intel", "volatile"); // asm!("mov r13, $0" : : "r"(next.r13) : "memory" : "intel", "volatile"); // asm!("mov $0, r14" : "=r"(self.r14) : : "memory" : "intel", "volatile"); // asm!("mov r14, $0" : : "r"(next.r14) : "memory" : "intel", "volatile"); // asm!("mov $0, r15" : "=r"(self.r15) : : "memory" : "intel", "volatile"); // asm!("mov r15, $0" : : "r"(next.r15) : "memory" : "intel", "volatile"); // asm!("mov $0, rsp" : "=r"(self.rsp) : : "memory" : "intel", "volatile"); // asm!("mov rsp, $0" : : "r"(next.rsp) : "memory" : "intel", "volatile"); // asm!("mov $0, rbp" : "=r"(self.rbp) : : "memory" : "intel", "volatile"); // asm!("mov rbp, $0" : : "r"(next.rbp) : "memory" : "intel", "volatile"); // } // } #[allow(dead_code)] #[repr(packed)] pub struct ScratchRegisters { pub r11: usize, pub r10: usize, pub r9: usize, pub r8: usize, pub rsi: usize, pub rdi: usize, pub rdx: usize, pub rcx: usize, pub rax: usize, } #[allow(unused_macros)] macro_rules! scratch_push { () => (asm!( "push rax push rcx push rdx push rdi push rsi push r8 push r9 push r10 push r11" : : : : "intel", "volatile" )); } #[allow(unused_macros)] macro_rules! scratch_pop { () => (asm!( "pop r11 pop r10 pop r9 pop r8 pop rsi pop rdi pop rdx pop rcx pop rax" : : : : "intel", "volatile" )); } pub fn proc_yield() { } #[derive(Debug)] pub struct ProcessManager { pub processes: [Proc; 16], pub count: usize, pub current: usize } pub static mut PROCESS_MANAGER: ProcessManager = ProcessManager::new(); impl ProcessManager { pub const fn new() -> ProcessManager { ProcessManager { processes: [Proc::empty(); 16], count: 0, current: 0 } } pub fn current_proc(&mut self) -> &mut Proc { &mut self.processes[self.current] } pub fn add_proc(&mut self, p: Proc) { self.processes[self.count] = p; self.count = self.count + 1; } pub fn tick(&mut self) { // if self.running { // let cur = &mut self.processes[self.current]; // unsafe { // asm!("mov $0, rsp" : "=r"(cur.kstack) : : : "intel"); // } // } let from_proc = self.current; let to_proc = (self.current + 1) % self.count; if from_proc == to_proc { return; } self.current = to_proc; unsafe { self.switch_to(to_proc, from_proc); } } pub unsafe fn switch_to(&mut self, to_proc: usize, from_proc: usize) { ::gdt::set_kernel_stack(x86_64::VirtAddr::new(self.processes[to_proc].kstack as u64)); self.do_switch(to_proc, from_proc); // x86_64::instructions::interrupts::disable(); // let ds = ::gdt::GDT.1.user_data.0; // let cs = ::gdt::GDT.1.user_code.0; // unsafe { // ::gdt::set_kernel_stack(x86_64::VirtAddr::new(self.kstack as u64)); // asm!("mov rsp, rax" : : "{rax}"(self.kstack) : : "intel", "volatile"); // asm!("push rax" : : "{rax}"(ds) : : "intel", "volatile"); // asm!("push rax" : : "{rax}"(self.stack) : : "intel", "volatile"); // asm!("pushf" : : : : "intel", "volatile"); // asm!("push rax" : : "{rax}"(cs) : : "intel", "volatile"); // asm!("push rax" : : "{rax}"(self.entry) : : "intel", "volatile"); // asm!("iretq" : : : : "intel", "volatile"); // println!("WTF"); // } } #[cold] #[inline(never)] #[naked] unsafe fn do_switch(&mut self, to_proc: usize, from_proc: usize) { asm!(" push rbx push rbp " : : : : "intel", "volatile"); asm!("mov rax, rsp" : "={rax}"(self.processes[from_proc].rsp) : : : "intel", "volatile"); // println!("Switching from {:x} to {:x}", self.processes[from_proc].rsp, self.processes[to_proc].rsp); asm!("mov rsp, rax" : : "{rax}"(self.processes[to_proc].rsp) : : "intel", "volatile"); asm!(" pop rbp pop rbx " : : : "rbp", "rbx" : "intel", "volatile"); } } #[repr(packed)] #[derive(Copy, Clone, Debug)] struct InterruptStack { pub entry: u64, pub css: u64, pub flags: u64, pub stack: u64, pub dss: u64 } impl InterruptStack { #[allow(unused)] pub unsafe fn load(addr: usize) -> &'static mut InterruptStack { &mut*(addr as *mut _) } } #[derive(Copy, Debug)] pub struct Proc { pub stack: usize, pub kstack: usize, pub rsp: usize, } impl Proc { pub fn new() -> Proc { let result = Proc { stack: malloc(4096) + 4096, kstack: (malloc(4096) + 4096), rsp: 0 }; result } pub const fn empty() -> Proc { Proc { stack: 0, kstack: 0, rsp: 0 } } pub fn schedule(&self) { } // fn prepare_kstack(&mut self, entry: usize) { // let ds = ::gdt::GDT.1.user_data.0; // let cs = ::gdt::GDT.1.user_code.0; // unsafe { // self.kstack = self.kstack - 5 * 8; // let s = InterruptStack::load(self.kstack); // s.entry = entry as u64; // s.css = cs as u64; // s.flags = 0x202; // s.stack = self.stack as u64; // s.dss = ds as u64; // } // // unsafe { // // ::gdt::set_kernel_stack(x86_64::VirtAddr::new(self.kstack as u64)); // // let original_sp; // // asm!("mov rsp, rax" : : "{rax}"(self.kstack) : : "intel", "volatile"); // // asm!("push rax" : : "{rax}"(ds) : : "intel", "volatile"); // // asm!("push rax" : : "{rax}"(self.stack) : : "intel", "volatile"); // // asm!("pushf" : : : : "intel", "volatile"); // // asm!("push rax" : : "{rax}"(cs) : : "intel", "volatile"); // // asm!("push rax" : : "{rax}"(self.entry) : : "intel", "volatile"); // // } // } } impl Clone for Proc { fn clone(&self) -> Proc { let mut made = Proc::new(); unsafe { ::mem::memcpy(made.stack - 4096, self.stack - 4096, 4096); ::mem::memcpy(made.kstack - 4096, self.kstack - 4096, 4096); } made.rsp = self.rsp; made.rsp += made.kstack - self.kstack; made } } pub fn run_in_user_mode(entry: usize, stack: usize) -> ! { let ds = ::gdt::GDT.1.user_data.0; let cs = ::gdt::GDT.1.user_code.0; unsafe { asm!("push $0" : : "r"(ds as u64) : : "intel", "volatile"); asm!("push $0" : : "r"(stack) : : "intel", "volatile"); asm!("push $0" : : "r"(0x202u64) : : "intel", "volatile"); asm!("push $0" : : "r"(cs as u64) : : "intel", "volatile"); asm!("push $0" : : "r"(entry) : : "intel", "volatile"); asm!("iretq" : : : : "intel", "volatile"); } panic!("we did an iret"); }
extern crate reqwest; use std::collections::HashMap; //holds data for instructor and students pub struct ClassIssueRequester { pub class_repo_address: String, pub username: String, pub password: String, } impl ClassIssueRequester { pub fn new( class_repo_address: String, username: String, password: String, ) -> ClassIssueRequester { ClassIssueRequester { class_repo_address, username, password, } } pub fn add_issue( &self, title: &str, body: &str, label: &str, ) -> Result<String, Box<std::error::Error>> { let label = [label]; let mut url_str = String::new(); url_str.push_str(&format!("{}/issues", self.class_repo_address)); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client .post(url) .basic_auth(&self.username, Some(&self.password)) .json(&json!({ "title": title, "body": body, "labels": label })) .send()?; let body = res.text().expect("error parsing"); Ok(body) } pub fn comment_on_issue( &self, body: &str, issue_num: u32, ) -> Result<String, Box<std::error::Error>> { let mut url_str = String::new(); url_str.push_str(&format!( "{}/issues/{}/comments", self.class_repo_address, issue_num )); let client = reqwest::Client::new(); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let mut res = client .post(url) .basic_auth(&self.username, Some(&self.password)) .json(&json!({ "body": body })) .send()?; let body = res.text().expect("error parsing"); //dbg!(&body); Ok(body) } pub fn get_issue(&self, issue_num: u32) -> Result<String, Box<std::error::Error>> { let mut url_str = String::new(); url_str.push_str(&format!("{}/issues/{}", self.class_repo_address, issue_num)); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client.get(url).basic_auth(&self.username, Some(&self.password)).send()?; dbg!(&res); let body = res.text().expect("error parsing"); Ok(body) } //GET /repos/:owner/:repo/issues/:issue_number/comments pub fn get_issue_comments(&self, issue_num: u32) -> Result<String, Box<std::error::Error>> { let mut url_str = String::new(); url_str.push_str(&format!( "{}/issues/{}/comments", self.class_repo_address, issue_num )); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client.get(url).basic_auth(&self.username, Some(&self.password)).send()?; let body = res.text().expect("error parsing"); Ok(body) } pub fn get_open_issues(&self, label: String) -> Result<String, Box<std::error::Error>> { let mut map = HashMap::new(); map.insert("state", "open"); map.insert("labels", &label); let mut url_str = String::new(); url_str.push_str(&format!("{}/issues", self.class_repo_address)); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client.get(url).basic_auth(&self.username, Some(&self.password)).json(&map).send()?; let body = res.text().expect("error parsing"); Ok(body) } pub fn get_all_issues(&self, label: String) -> Result<String, Box<std::error::Error>> { let mut map = HashMap::new(); map.insert("state", "all"); map.insert("labels", &label); let mut url_str = String::new(); url_str.push_str(&format!("{}/issues", self.class_repo_address)); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client.get(url).basic_auth(&self.username, Some(&self.password)).query(&map).send()?; let body = res.text().expect("error parsing"); Ok(body) } pub fn get_all_my_issues(&self, label: String) -> Result<String, Box<std::error::Error>> { let mut map = HashMap::new(); let username = &self.username; let state = &"all".to_string(); map.insert("creator", username); map.insert("state", state); map.insert("labels", &label); let mut url_str = String::new(); url_str.push_str(&format!("{}/issues", self.class_repo_address)); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client.get(url).basic_auth(&self.username, Some(&self.password)).query(&map).send()?; let body = res.text().expect("error parsing"); Ok(body) } pub fn close_issue(&self, issue_num: u32) -> Result<String, Box<std::error::Error>> { let mut map = HashMap::new(); map.insert("state", "closed"); let mut url_str = String::new(); url_str.push_str(&format!("{}/issues/{}", self.class_repo_address, issue_num)); //dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client .patch(url) .basic_auth(&self.username, Some(&self.password)) .json(&map) .send()?; let body = res.text().expect("error parsing"); Ok(body) } pub fn edit_comment(&self, body: &str, id: u32) -> Result<String, Box<std::error::Error>> { let mut map = HashMap::new(); map.insert("body", body); let mut url_str = String::new(); url_str.push_str(&format!( "{}/issues/comments/{}", self.class_repo_address, id )); dbg!(&url_str); let url = reqwest::Url::parse(&url_str).expect("invalid issue writing url"); let client = reqwest::Client::new(); let mut res = client .patch(url) .basic_auth(&self.username, Some(&self.password)) .json(&map) .send()?; let body = res.text().expect("error parsing"); dbg!(&body); Ok(body) } } #[cfg(test)] mod tests { use super::*; use std::env; const USERNAME: &str = "hortinstein"; const CLASS_REPO_ADDRESS: &str = "https://api.github.com/repos/replicatedu/issue_database"; #[test] fn close_issue() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db.close_issue(1).expect("error closing"); let deser: serde_json::Value = serde_json::from_str(&body).expect("error parsinge"); dbg!(&deser); assert!(deser["state"] == "closed"); } #[test] fn comment_issue() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db .comment_on_issue("test comment", 1) .expect("error closing"); let deser: serde_json::Value = serde_json::from_str(&body).expect("error parsinge"); dbg!(&deser); } #[test] fn add_issue() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db .add_issue("this is a unit test", "testing add issue", "test") .expect("error closing"); let deser: serde_json::Value = serde_json::from_str(&body).expect("error parsinge"); dbg!(&deser); assert!(deser["state"] == "open"); } #[test] fn get_issue() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db.get_issue(8).expect("error closing"); let deser: serde_json::Value = serde_json::from_str(&body).expect("error parsinge"); dbg!(&deser); assert!(&deser["title"] == "this is a unit test"); assert!(&deser["body"] == "testing add issue"); let array_val = deser["labels"].clone(); dbg!(&array_val); //let array: Vec<String> = serde_json::from_value(array_val).expect("error"); let a = array_val[0]["name"].clone(); let testlabel: String = serde_json::from_value(a).expect("not good"); assert!(testlabel == "test"); } #[test] fn get_open_issues() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db .get_open_issues("test".to_string()) .expect("error closing"); let deser: Vec<serde_json::Value> = serde_json::from_str(&body).expect("error parsinge"); for x in deser { let title: String = serde_json::from_value(x["title"].clone()).expect("err"); let number: u32 = serde_json::from_value(x["number"].clone()).expect("err"); let issue_body: String = serde_json::from_value(x["body"].clone()).expect("err"); dbg!(title); dbg!(number); //dbg!(issue_body); issue_db.close_issue(number); } } #[test] fn get_all_issues() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db .get_all_issues("test".to_string()) .expect("error closing"); let deser: Vec<serde_json::Value> = serde_json::from_str(&body).expect("error parsinge"); for x in deser { //dbg!(&x); let title: String = serde_json::from_value(x["title"].clone()).expect("err"); let number: u32 = serde_json::from_value(x["number"].clone()).expect("err"); let issue_body: String = serde_json::from_value(x["body"].clone()).expect("err"); dbg!(title); dbg!(number); //dbg!(issue_body); issue_db.close_issue(number); } } #[test] fn get_all_my_issues() { let password = env::var("GITHUB_PASSWORD").expect("set the GITHUB_PASSWORD env"); let issue_db = ClassIssueRequester::new( CLASS_REPO_ADDRESS.to_string(), USERNAME.to_string(), password.to_string(), ); let body = issue_db .get_all_my_issues("test".to_string()) .expect("error closing"); let deser: Vec<serde_json::Value> = serde_json::from_str(&body).expect("error parsinge"); for x in deser { //dbg!(&x); let title: String = serde_json::from_value(x["title"].clone()).expect("err"); let number: u32 = serde_json::from_value(x["number"].clone()).expect("err"); let issue_body: String = serde_json::from_value(x["body"].clone()).expect("err"); dbg!(title); dbg!(number); //dbg!(issue_body); issue_db.close_issue(number); } } }
pub mod credential; pub mod http; pub mod oauth_client; pub use credential::authorize; pub use http::HttpClient; pub use oauth_client::{ DiscordOauthProvider, DiscordOauthProviderBuilder, DiscordOauthScope, OauthClient, OauthProvider, };
use std::fs::File; use std::io::{prelude::*, BufReader}; use super::Tile; /// This is also known as the joker pub const WILDCARD : char = '*'; /// Simple struct that stores information about how many times we add this tile /// in the tileset pub struct TileInfo { tile : Tile, occurences : u32, } /// Stores all the TileInfo pub struct TileSet { infos : Vec<TileInfo>, } impl TileInfo { /// Create a TileInfo /// /// # Arguments /// * `c` - The character on the tile. /// * `occurences` - How many of this letter must be present in the bag. /// * `score` - The score it gives. pub fn new(c : char, occurences : u32, score : u8) -> TileInfo { // If this is a wildcard, set the flag let wildcard = match c { WILDCARD => true, _ => false, }; let tile = Tile::new(c, score, wildcard); TileInfo { tile, occurences, } } /// Get the letter of this TileInfo's Tile pub fn c(&self) -> char { return self.tile.letter(); } /// Get the occurences pub fn occurences(&self) -> u32 { return self.occurences; } /// Get the score of the Tile pub fn score(&self) -> u8 { return self.tile.points(); } /// Get a copy of the tile pub fn tile(&self) -> Tile { self.tile.clone() } } impl TileSet { /// Create a TileSet from a vector of `TileInfo` /// /// Maybe someone need it, otherwise there is `from_file()` pub fn from_vec(vec : Vec<TileInfo>) -> TileSet { TileSet { infos : vec, } } /// Create a TileSet from a file /// /// The file need to have a special format to be understood. /// It is read line by line, and each one describe a TileInfo. /// A TileInfo is described like so : /// <letter> <occurences> <score> /// /// Have a look at the TileInfo constructor for more informations about these parameters. pub fn from_file(filename : &str) -> TileSet { let mut ts_vec : Vec<TileInfo> = Vec::new(); let file = File::open(filename).unwrap(); let reader = BufReader::new(file); for line in reader.lines() { let line = line.unwrap(); let data : Vec<&str> = line.split_whitespace().collect(); assert!(data.len() == 3, "not 3 elements on one line in tileset file"); let c : char = data[0].parse().expect("The first word of a line should be a char"); let occurences : u32 = data[1].parse().expect("The second word should be a number"); let score : u8 = data[2].parse().expect("The third word should be a number"); let ti = TileInfo::new(c, occurences, score); ts_vec.push(ti); } TileSet { infos : ts_vec } } /// Get the score of a letter /// /// It will look for the first tile with this score and get its score. /// TODO : It's complexity is O(n) pub fn get_points(&self, letter : char) -> u8 { let mut it = self.infos.iter(); let pos = it.position(|e| e.tile.letter() == letter); match pos { Some(p) => { return self.infos.get(p).unwrap().tile.points(); } None => { // If we don't know this letter we return 0 return 0; } } } pub fn infos(&self) -> &Vec<TileInfo> { return &self.infos; } }
use predicates::prelude::Predicate; use predicates::str::contains; use short::BIN_NAME; use test_utils::init; use test_utils::{HOME_CFG_FILE, PROJECT_CFG_FILE}; mod test_utils; #[test] fn cmd_show_no_setup_no_env() { let mut e = init("cmd_show_no_setup_no_env"); e.add_file( PROJECT_CFG_FILE, r#" setups: {} "#, ); e.setup(); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .assert() .to_string(); assert!(contains("no setup is configured. You can use").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-s") .assert() .to_string(); assert!(contains("``````").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-e") .assert() .to_string(); assert!(contains("``````").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-f") .assert() .to_string(); assert!(contains("```[:]```").eval(&r)); } #[test] fn cmd_show_no_setup() { let mut e = init("cmd_show_no_setup"); e.add_file( PROJECT_CFG_FILE, r#" setups: {} "#, ); e.add_file( HOME_CFG_FILE, format!( r#" projects: - file: {file} current: setup: setup_1 setups: {{}} "#, file = e.path().unwrap().join(PROJECT_CFG_FILE).to_string_lossy() ), ); e.setup(); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .assert() .to_string(); assert!(contains("no env is configured for `setup_1`").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-s") .assert() .to_string(); assert!(contains("```setup_1```").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-e") .assert() .to_string(); assert!(contains("``````").eval(&r)); } #[test] fn cmd_show_format() { let mut e = init("cmd_show"); e.add_file( PROJECT_CFG_FILE, r#" setups: {} "#, ); e.add_file( HOME_CFG_FILE, format!( r#" projects: - file: {file} current: setup: setup_1 env: example setups: {{}}"#, file = e.path().unwrap().join(PROJECT_CFG_FILE).to_string_lossy() ), ); e.setup(); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .args(&["-f"]) .assert() .to_string(); assert!(contains("[setup_1:example]").count(1).eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .args(&["-f", "{setup}-{env}"]) .assert() .to_string(); assert!(contains("setup_1-example").count(1).eval(&r)); } #[test] fn cmd_show() { let mut e = init("cmd_show"); e.add_file( PROJECT_CFG_FILE, r#" setups: {} "#, ); e.add_file( HOME_CFG_FILE, format!( r#" projects: - file: {file} current: setup: setup_1 env: example setups: {{}}"#, file = e.path().unwrap().join(PROJECT_CFG_FILE).to_string_lossy() ), ); e.setup(); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .assert() .to_string(); assert!(contains("your current setup is `setup_1`:`example`").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-s") .assert() .to_string(); assert!(contains("```setup_1```").eval(&r)); let mut command = e.command(BIN_NAME).unwrap(); let r = command .env("RUST_LOG", "debug") .arg("show") .arg("-e") .assert() .to_string(); assert!(contains("```example```").eval(&r)); }
// and enums use std::fmt::Display; pub trait Euclidean { fn cross(); fn magnitude() { println!("Hello World"); } } #[derive(Debug)] pub struct Vector3 { pub x: i32, pub y: i32, pub z: i32, } impl Vector3 { fn dot(&self, other: &Vector3) -> i32 { self.x * other.x + self.y * other.y + self.z * other.z } } impl Euclidean for Vector3 { fn cross() {} } // FIELD INIT SHORTHAND pub fn build_vector3(x: i32, y: i32, z: i32) -> Vector3 { Vector3 { x, y, z } } // STRUCT UPDATE SYNTAX pub fn update_x(vec: Vector3) -> Vector3 { Vector3 { x: 5, ..vec } } // use trait as a parameter type pub fn compound_mag(x: &impl Euclidean, y: &(impl Euclidean + Display)) // multiple required traits { } // above is sugar for below, restrictions on generic types pub fn compound_mag_long<T: Euclidean + Display>(x: &T) -> impl Display // specify just traits of a return type { 5 // for display trait } // use where for easier reading pub fn compound_mag_where<T>(x: &T) where T: Euclidean + Display { } enum ColourChannel { Red, Green, Blue } #[derive(Debug)] enum IpAddr { V4(u8, u8, u8, u8), V6(String), } // can add methods to enums as well impl IpAddr { fn print(&self) { println!("{:?}", self); } }
mod test_support; use apllodb_immutable_schema_engine::ApllodbImmutableSchemaEngine; use apllodb_immutable_schema_engine_infra::test_support::{session_with_tx, test_setup}; use apllodb_shared_components::{ ApllodbError, ApllodbResult, Expression, NnSqlValue, Schema, SchemaIndex, SqlState, SqlType, SqlValue, }; use apllodb_storage_engine_interface::{ ColumnConstraints, ColumnDataType, ColumnDefinition, Row, RowProjectionQuery, RowSelectionQuery, StorageEngine, TableConstraintKind, TableConstraints, TableName, WithTxMethods, }; #[ctor::ctor] fn setup() { test_setup(); } #[async_std::test] async fn test_create_table_success() -> ApllodbResult<()> { let engine = ApllodbImmutableSchemaEngine::default(); let session = session_with_tx(&engine).await?; let t_name = TableName::new("t")?; let c1_def = ColumnDefinition::new( ColumnDataType::factory("c1", SqlType::integer(), false), ColumnConstraints::default(), ); let session = engine .with_tx() .create_table( session, t_name.clone(), TableConstraints::new(vec![TableConstraintKind::PrimaryKey { column_names: vec![c1_def.column_data_type().column_name().clone()], }])?, vec![c1_def], ) .await?; engine.with_tx().abort_transaction(session).await?; Ok(()) } #[async_std::test] async fn test_create_table_failure_duplicate_table() -> ApllodbResult<()> { let engine = ApllodbImmutableSchemaEngine::default(); let session = session_with_tx(&engine).await?; let t_name = &TableName::new("t")?; let c1_def = ColumnDefinition::new( ColumnDataType::factory("c1", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let coldefs = vec![c1_def.clone()]; let tc = TableConstraints::new(vec![TableConstraintKind::PrimaryKey { column_names: vec![c1_def.column_data_type().column_name().clone()], }])?; let session = engine .with_tx() .create_table(session, t_name.clone(), tc.clone(), coldefs.clone()) .await?; match engine .with_tx() .create_table(session, t_name.clone(), tc, coldefs.clone()) .await { // Internally, new record is trying to be INSERTed but it is made wait by tx2. // (Since SQLite's transaction is neither OCC nor MVCC, tx1 is made wait here before transaction commit.) Err(e) => assert_eq!(ApllodbError::from(e).kind(), &SqlState::NameErrorDuplicate), Ok(_) => panic!("should rollback"), } Ok(()) } #[async_std::test] async fn test_insert() -> ApllodbResult<()> { let engine = ApllodbImmutableSchemaEngine::default(); let session = session_with_tx(&engine).await?; let t_name = &TableName::new("t")?; let c_id_def = ColumnDefinition::new( ColumnDataType::factory("id", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let c1_def = ColumnDefinition::new( ColumnDataType::factory("c1", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let coldefs = vec![c_id_def.clone(), c1_def.clone()]; let tc = TableConstraints::new(vec![TableConstraintKind::PrimaryKey { column_names: vec![c_id_def.column_data_type().column_name().clone()], }])?; let session = engine .with_tx() .create_table(session, t_name.clone(), tc, coldefs) .await?; let session = engine .with_tx() .insert( session, t_name.clone(), vec![ c_id_def.column_data_type().column_name().clone(), c1_def.column_data_type().column_name().clone(), ], vec![Row::new(vec![ SqlValue::NotNull(NnSqlValue::Integer(1)), SqlValue::NotNull(NnSqlValue::Integer(100)), ])], ) .await?; let (mut records, session) = engine .with_tx() .select( session, t_name.clone(), RowProjectionQuery::All, RowSelectionQuery::FullScan, ) .await?; let schema = records.as_schema().clone(); let (id_pos, _) = schema.index(&SchemaIndex::from( c_id_def.column_data_type().column_name().as_str(), ))?; let (c1_pos, _) = schema.index(&SchemaIndex::from( c1_def.column_data_type().column_name().as_str(), ))?; let record = records.next().unwrap(); assert_eq!(record.get::<i32>(id_pos)?, Some(1)); assert_eq!(record.get::<i32>(c1_pos)?, Some(100)); assert!(records.next().is_none()); engine.with_tx().commit_transaction(session).await?; Ok(()) } #[async_std::test] async fn test_update() -> ApllodbResult<()> { let engine = ApllodbImmutableSchemaEngine::default(); let session = session_with_tx(&engine).await?; let t_name = &TableName::new("t")?; let c_id_def = ColumnDefinition::new( ColumnDataType::factory("id", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let c1_def = ColumnDefinition::new( ColumnDataType::factory("c1", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let coldefs = vec![c_id_def.clone(), c1_def.clone()]; let tc = TableConstraints::new(vec![TableConstraintKind::PrimaryKey { column_names: vec![c_id_def.column_data_type().column_name().clone()], }])?; let session = engine .with_tx() .create_table(session, t_name.clone(), tc.clone(), coldefs) .await?; let session = engine .with_tx() .insert( session, t_name.clone(), vec![ c_id_def.column_data_type().column_name().clone(), c1_def.column_data_type().column_name().clone(), ], vec![Row::new(vec![ SqlValue::NotNull(NnSqlValue::Integer(1)), SqlValue::NotNull(NnSqlValue::Integer(100)), ])], ) .await?; let (mut records, session) = engine .with_tx() .select( session, t_name.clone(), RowProjectionQuery::All, RowSelectionQuery::FullScan, ) .await?; { let schema = records.as_schema().clone(); let (id_pos, _) = schema.index(&SchemaIndex::from( c_id_def.column_data_type().column_name().as_str(), ))?; let (c1_pos, _) = schema.index(&SchemaIndex::from( c1_def.column_data_type().column_name().as_str(), ))?; let record = records.next().unwrap(); assert_eq!(record.get::<i32>(id_pos)?, Some(1)); assert_eq!(record.get::<i32>(c1_pos)?, Some(100)); assert!(records.next().is_none()); } // update non-PK let session = engine.with_tx().update( session, t_name.clone(), hmap! { c1_def.column_data_type().column_name().clone() => Expression::ConstantVariant(SqlValue::NotNull(NnSqlValue::Integer(200))) }, RowSelectionQuery::FullScan, ).await?; let (mut records, session) = engine .with_tx() .select( session, t_name.clone(), RowProjectionQuery::All, RowSelectionQuery::FullScan, ) .await?; { let schema = records.as_schema().clone(); let (id_pos, _) = schema.index(&SchemaIndex::from( c_id_def.column_data_type().column_name().as_str(), ))?; let (c1_pos, _) = schema.index(&SchemaIndex::from( c1_def.column_data_type().column_name().as_str(), ))?; let record = records.next().unwrap(); assert_eq!(record.get::<i32>(id_pos)?, Some(1)); assert_eq!(record.get::<i32>(c1_pos)?, Some(200)); assert!(records.next().is_none()); } // update PK let session =engine.with_tx(). update( session, t_name.clone(), hmap! { c_id_def.column_data_type().column_name().clone() => Expression::ConstantVariant(SqlValue::NotNull(NnSqlValue::Integer(2))) }, RowSelectionQuery::FullScan, ).await?; let (mut records, session) = engine .with_tx() .select( session, t_name.clone(), RowProjectionQuery::All, RowSelectionQuery::FullScan, ) .await?; { let schema = records.as_schema().clone(); let (id_pos, _) = schema.index(&SchemaIndex::from( c_id_def.column_data_type().column_name().as_str(), ))?; let (c1_pos, _) = schema.index(&SchemaIndex::from( c1_def.column_data_type().column_name().as_str(), ))?; let record = records.next().unwrap(); assert_eq!(record.get::<i32>(id_pos)?, Some(2)); assert_eq!(record.get::<i32>(c1_pos)?, Some(200)); assert!(records.next().is_none()); } engine.with_tx().commit_transaction(session).await?; Ok(()) } #[async_std::test] async fn test_delete() -> ApllodbResult<()> { let engine = ApllodbImmutableSchemaEngine::default(); let session = session_with_tx(&engine).await?; let t_name = &TableName::new("t")?; let c_id_def = ColumnDefinition::new( ColumnDataType::factory("id", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let c1_def = ColumnDefinition::new( ColumnDataType::factory("c1", SqlType::integer(), false), ColumnConstraints::new(vec![])?, ); let coldefs = vec![c_id_def.clone(), c1_def.clone()]; let tc = TableConstraints::new(vec![TableConstraintKind::PrimaryKey { column_names: vec![c_id_def.column_data_type().column_name().clone()], }])?; let session = engine .with_tx() .create_table(session, t_name.clone(), tc.clone(), coldefs) .await?; let session = engine .with_tx() .insert( session, t_name.clone(), vec![ c_id_def.column_data_type().column_name().clone(), c1_def.column_data_type().column_name().clone(), ], vec![Row::new(vec![ SqlValue::NotNull(NnSqlValue::Integer(1)), SqlValue::NotNull(NnSqlValue::Integer(100)), ])], ) .await?; let (rows, session) = engine .with_tx() .select( session, t_name.clone(), RowProjectionQuery::ColumnIndexes( vec![SchemaIndex::new( Some(t_name.as_str().to_string()), c_id_def .column_data_type() .column_name() .as_str() .to_string(), )] .into_iter() .collect(), ), RowSelectionQuery::FullScan, ) .await?; assert_eq!(rows.count(), 1); let session = engine .with_tx() .delete(session, t_name.clone(), RowSelectionQuery::FullScan) .await?; let (rows, session) = engine .with_tx() .select( session, t_name.clone(), RowProjectionQuery::ColumnIndexes( vec![SchemaIndex::new( Some(t_name.as_str().to_string()), c_id_def .column_data_type() .column_name() .as_str() .to_string(), )] .into_iter() .collect(), ), RowSelectionQuery::FullScan, ) .await?; assert_eq!(rows.count(), 0); engine.with_tx().commit_transaction(session).await?; Ok(()) }
struct Solution; struct BytePos { idx: Option<usize>, byte: u8, } impl Solution { pub fn is_palindrome(s: String) -> bool { if s.len() == 0 { return true; } let chars = s.as_bytes(); let mut left = 0; let mut right = chars.len() - 1; while left < right { let left_byte = Solution::next_valid_byte(chars, left); let right_byte = Solution::prev_valid_byte(chars, right); if left_byte.idx.is_none() || right_byte.idx.is_none() { break; } if left_byte.byte != right_byte.byte { return false; } left = left_byte.idx.unwrap() + 1; match right_byte.idx { Some(0) => break, Some(idx) => right = idx - 1, None => {} }; } true } fn next_valid_byte(bytes: &[u8], cur_ptr: usize) -> BytePos { for i in cur_ptr..bytes.len() { match bytes[i] as char { 'A'..='Z' => { return BytePos { byte: bytes[i] + 32, idx: Some(i), } } 'a'..='z' | '0'..='9' => { return BytePos { byte: bytes[i], idx: Some(i), } } _ => {} } } return BytePos { byte: 0, idx: None }; } fn prev_valid_byte(bytes: &[u8], cur_ptr: usize) -> BytePos { for i in (0..=cur_ptr).rev() { match bytes[i] as char { 'A'..='Z' => { return BytePos { byte: bytes[i] + 32, idx: Some(i), } } 'a'..='z' | '0'..='9' => { return BytePos { byte: bytes[i], idx: Some(i), } } _ => {} } } return BytePos { byte: 0, idx: None }; } } #[cfg(test)] mod tests { use super::*; #[test] fn test_is_palindrome_example1() { assert_eq!( Solution::is_palindrome("A man, a plan, a canal: Panama".to_owned()), true ); } #[test] fn test_is_palindrome_example2() { assert_eq!(Solution::is_palindrome("race a car".to_owned()), false); } #[test] fn test_empty_string() { assert_eq!(Solution::is_palindrome("".to_owned()), true); } #[test] fn test_case1() { assert_eq!(Solution::is_palindrome("a.".to_owned()), true); } }
use crate::models::player::Player; use crate::models::pressure_plate::{Plate, PlateMaterial}; use bevy::prelude::*; use bevy::sprite::collide_aabb::collide; use crate::models::explosion::Explosion; use crate::level; use crate::models::points::Points; use crate::systems::gravity::GravityLevel; pub fn init( mut player_positions: Query<(&mut Transform, &Sprite), With<Player>>, mut plates: Query<(&mut Transform, &Sprite), With<Plate>>, commands: &mut Commands, mut plate: Query<Entity, With<Plate>>, mut explosion: Query<Entity, With<Explosion>>, plate_materials: Res<PlateMaterial>, mut gravity: ResMut<GravityLevel>, mut points: ResMut<Points>, ) { for (player_transform, player_sprite) in player_positions.iter_mut() { for (plate_transform, plate_sprite) in plates.iter_mut() { let collision = collide( player_transform.translation, player_sprite.size, plate_transform.translation, plate_sprite.size, ); if collision.is_some() { // FIXME Is sometimes called multiple times let point = level::reset( commands, &mut plate, &mut explosion, &plate_materials, &mut gravity, ); if point { points.0 += 1; } } } } }
//#[path = "common.rs"] //mod common; use crate::common; #[derive(Debug)] pub struct XMLSimpParser { xml: Vec<char>, p: usize, xml_buf: Vec<char>, pub tokenized_text_list: Vec<common::TokenizedText>, // why need pub? } impl XMLSimpParser { pub fn new(s: &String) -> Self { XMLSimpParser { xml: s.chars().collect(), p: 0, xml_buf: Vec::new(), tokenized_text_list: Vec::new(), } } pub fn parse(&mut self) -> &Vec<common::TokenizedText> { self.simp_parse(); return &self.tokenized_text_list; } pub fn counter_parse(&self) -> String { return self.simp_combine(); } fn eat(&mut self) -> char { let val = self.xml[self.p]; self.p += 1; return val; } fn simp_parse(&mut self) { loop { let c = self.eat(); if self.p == self.xml.len() { self.xml_buf.push(c); self.tokenize(); self.xml_buf = Vec::new(); return; } match c { '<' => { self.tokenize(); self.xml_buf = vec![c]; } '>' => { self.xml_buf.push(c); self.tokenize(); self.xml_buf = Vec::new(); } _ => self.xml_buf.push(c), } } } fn tokenize(&mut self) { if self.xml_buf.len() == 0 { return; } let bufs: String = (&self.xml_buf).into_iter().collect(); let buf = &self.xml_buf; let token = if bufs.find('<') != Some(0) { common::XMLSimpToken::Text } else if buf.len() >= 4 && bufs.find("<?") == Some(0) { // <?...?> common::XMLSimpToken::TagProlog } else if bufs == "</w:p>" { common::XMLSimpToken::TagWpEnd } else if bufs == "</w:t>" { common::XMLSimpToken::TagWtEnd } else if buf.len() >= 3 && buf[buf.len() - 1] == '>' && buf[buf.len() - 2] == '/' { // </> <.../> common::XMLSimpToken::TagOtherBegEnd } else if buf.len() >= 3 && bufs.find("</") == Some(0) { // </...> common::XMLSimpToken::TagOtherEnd } else if bufs == "<w:p>" || bufs.find("<w:p ") == Some(0) { common::XMLSimpToken::TagWpBeg } else if bufs == "<w:t>" || bufs.find("<w:t ") == Some(0) { common::XMLSimpToken::TagWtBeg } else { common::XMLSimpToken::TagOtherBeg }; self.tokenized_text_list .push(common::TokenizedText { token, text: bufs }); } fn simp_combine(&self) -> String { let mut content = String::new(); for stru in &self.tokenized_text_list { content += &stru.text; } content } }
#![allow(non_snake_case, non_upper_case_globals)] const G_RAW: f64 = 6.674e-11; #[derive(Copy, Clone)] struct RawNBody { position: Raw2D, accel: Raw2D, velocity: Raw2D, mass: f64, } #[derive(Copy, Clone, Debug)] struct Raw2D(f64, f64); impl Raw2D { fn dist(&self, other: &Raw2D) -> (f64, f64, f64) { let &Raw2D(x1, y1) = self; let &Raw2D(x2, y2) = other; let xd = x2 - x1; let yd = y2 - y1; (xd, yd, (xd * xd + yd * yd).sqrt()) } } const RawNBodies: [RawNBody; 4] = [RawNBody { position: Raw2D(1500.0, 2500.0), accel: Raw2D(0.0, 0.0), velocity: Raw2D(0.0, 0.0), mass: 2000.0, }, RawNBody { position: Raw2D(3500.0, 500.0), accel: Raw2D(0.0, 0.0), velocity: Raw2D(0.0, 0.0), mass: 2000.0, }, RawNBody { position: Raw2D(200.0, 4500.0), accel: Raw2D(0.0, 0.0), velocity: Raw2D(0.0, 0.0), mass: 2000.0, }, RawNBody { position: Raw2D(-1500.0, 750.0), accel: Raw2D(0.0, 0.0), velocity: Raw2D(0.0, 0.0), mass: 2000.0, }]; #[inline(never)] pub fn raw_nbody() { let mut bodies = RawNBodies.to_vec(); for _ in 0..10000 { //calculate accelerations for a in 0..bodies.len() { bodies[a].accel = Raw2D(0.0, 0.0); for b in 0..bodies.len() { if a == b { continue; } let La = bodies[a].position; let Lb = bodies[b].position; let Ma = bodies[a].mass; let Mb = bodies[b].mass; let (Dx, Dy, dist) = La.dist(&Lb); let force = G_RAW / ((dist * dist) / (Ma * Mb)); let Fx = force * (Dx / Dy); let Fy = force * (Dy / Dx); let Ax = Fx / Ma; let Ay = Fy / Ma; bodies[a].accel = Raw2D(bodies[a].accel.0 + Ax, bodies[a].accel.1 + Ay); } } for a in 0..bodies.len() { //integrate acceleration into velocity let Raw2D(Vx, Vy) = bodies[a].velocity; let Raw2D(Ax, Ay) = bodies[a].accel; bodies[a].velocity = Raw2D(Vx + Ax * 0.1, Vy + Ay * 0.1); //integrate velocity into position let Raw2D(Vx, Vy) = bodies[a].velocity; let Raw2D(x, y) = bodies[a].position; bodies[a].position = Raw2D(x + Vx * 0.1, y + Vy * 0.1); } } }
/* * @author :: Preston Wang-Stosur-Bassett * @date :: October 8, 2020 * @description :: This package returns the hsk level for a simplified chinese character */ use std::collections::HashMap; use bincode::deserialize_from; static HSK_DATA: &'static [u8] = include_bytes!("../data/hsk.data"); pub struct Hsk { hsk_map: HashMap<String, u8> } impl Hsk { pub fn new() -> Hsk { return Hsk { hsk_map: deserialize_from(HSK_DATA).unwrap() } } pub fn get_hsk(&self, character: &str) -> u8 { return match self.hsk_map.get(character) { Some(hsk_level) => *hsk_level, None => 0 } } }
use priv_prelude::*; use spawn; /// Spawn a thread with a single interface, operating a behind a NAT. pub fn behind_nat_v4<F, R>( handle: &Handle, nat: NatV4Builder, public_ip: Ipv4Addr, func: F, ) -> (SpawnComplete<R>, Ipv4Plug) where R: Send + 'static, F: FnOnce() -> R + Send + 'static, { let subnet = match nat.get_subnet() { Some(subnet) => subnet, None => SubnetV4::random_local(), }; let nat = nat.subnet(subnet); let iface = { Ipv4IfaceBuilder::new() .address(subnet.random_client_addr()) .netmask(subnet.netmask()) .route(RouteV4::new(SubnetV4::global(), Some(subnet.gateway_ip()))) }; let (spawn_complete, ipv4_plug) = spawn::with_ipv4_iface(handle, iface, func); let (ipv4_plug_0, ipv4_plug_1) = Ipv4Plug::new_wire(); nat.spawn(handle, ipv4_plug_1, ipv4_plug, public_ip); (spawn_complete, ipv4_plug_0) }
use crate::NewService; use std::task::{Context, Poll}; use tower::util::{Oneshot, ServiceExt}; pub trait RecognizeRoute<T> { type Key: Clone; fn recognize(&self, t: &T) -> Self::Key; } #[derive(Clone, Debug)] pub struct NewRouter<T, N> { new_recgonize: T, inner: N, } #[derive(Clone, Debug)] pub struct Router<T, N> { recognize: T, inner: N, } impl<K, N> NewRouter<K, N> { pub fn new(new_recgonize: K, inner: N) -> Self { Self { new_recgonize, inner, } } } impl<T, K, N> NewService<T> for NewRouter<K, N> where K: NewService<T>, N: Clone, { type Service = Router<K::Service, N>; fn new_service(&mut self, t: T) -> Self::Service { Router { recognize: self.new_recgonize.new_service(t), inner: self.inner.clone(), } } } impl<K, N, S, Req> tower::Service<Req> for Router<K, N> where K: RecognizeRoute<Req>, N: NewService<K::Key, Service = S>, S: tower::Service<Req>, { type Response = S::Response; type Error = S::Error; type Future = Oneshot<S, Req>; fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { Poll::Ready(Ok(())) } fn call(&mut self, req: Req) -> Self::Future { let key = self.recognize.recognize(&req); self.inner.new_service(key).oneshot(req) } } impl<T, K, F> RecognizeRoute<T> for F where K: Clone, F: Fn(&T) -> K, { type Key = K; fn recognize(&self, t: &T) -> Self::Key { (self)(t) } }
//! Provides the [logistic](http://en.wikipedia.org/wiki/Logistic_function) and //! related functions use crate::error::StatsError; use crate::Result; /// Computes the logistic function pub fn logistic(p: f64) -> f64 { 1.0 / ((-p).exp() + 1.0) } /// Computes the logit function /// /// # Panics /// /// If `p < 0.0` or `p > 1.0` pub fn logit(p: f64) -> f64 { checked_logit(p).unwrap() } /// Computes the logit function /// /// # Errors /// /// If `p < 0.0` or `p > 1.0` pub fn checked_logit(p: f64) -> Result<f64> { if !(0.0..=1.0).contains(&p) { Err(StatsError::ArgIntervalIncl("p", 0.0, 1.0)) } else { Ok((p / (1.0 - p)).ln()) } } #[rustfmt::skip] #[cfg(test)] mod tests { use std::f64; #[test] fn test_logistic() { assert_eq!(super::logistic(f64::NEG_INFINITY), 0.0); assert_eq!(super::logistic(-11.512915464920228103874353849992239636376994324587), 0.00001); assert_almost_eq!(super::logistic(-6.9067547786485535272274487616830597875179908939086), 0.001, 1e-18); assert_almost_eq!(super::logistic(-2.1972245773362193134015514347727700402304323440139), 0.1, 1e-16); assert_eq!(super::logistic(0.0), 0.5); assert_almost_eq!(super::logistic(2.1972245773362195801634726294284168954491240598975), 0.9, 1e-15); assert_almost_eq!(super::logistic(6.9067547786485526081487245019905638981131702804661), 0.999, 1e-15); assert_eq!(super::logistic(11.512915464924779098232747799811946290419057060965), 0.99999); assert_eq!(super::logistic(f64::INFINITY), 1.0); } #[test] fn test_logit() { assert_eq!(super::logit(0.0), f64::NEG_INFINITY); assert_eq!(super::logit(0.00001), -11.512915464920228103874353849992239636376994324587); assert_eq!(super::logit(0.001), -6.9067547786485535272274487616830597875179908939086); assert_eq!(super::logit(0.1), -2.1972245773362193134015514347727700402304323440139); assert_eq!(super::logit(0.5), 0.0); assert_eq!(super::logit(0.9), 2.1972245773362195801634726294284168954491240598975); assert_eq!(super::logit(0.999), 6.9067547786485526081487245019905638981131702804661); assert_eq!(super::logit(0.99999), 11.512915464924779098232747799811946290419057060965); assert_eq!(super::logit(1.0), f64::INFINITY); } #[test] #[should_panic] fn test_logit_p_lt_0() { super::logit(-1.0); } #[test] #[should_panic] fn test_logit_p_gt_1() { super::logit(2.0); } #[test] fn test_checked_logit_p_lt_0() { assert!(super::checked_logit(-1.0).is_err()); } #[test] fn test_checked_logit_p_gt_1() { assert!(super::checked_logit(2.0).is_err()); } }
pub fn intersection(mut nums1: Vec<i32>, mut nums2: Vec<i32>) -> Vec<i32> { use std::cmp::Ordering::*; nums1.sort(); nums2.sort(); let mut p1 = 0; let mut p2 = 0; let mut result: Vec<i32> = vec![]; while p1 < nums1.len() && p2 < nums2.len() { match nums1[p1].cmp(&nums2[p2]) { Less => { p1 += 1; } Equal => { if let Some(&a) = result.last() { if a < nums1[p1] { result.push(nums1[p1]); } } else { result.push(nums1[p1]); } p1 += 1; p2 += 1; } Greater => { p2 += 1; } } } result }
/// An enum to represent all characters in the ArabicPresentationFormsA block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum ArabicPresentationFormsA { /// \u{fb50}: 'ﭐ' ArabicLetterAlefWaslaIsolatedForm, /// \u{fb51}: 'ﭑ' ArabicLetterAlefWaslaFinalForm, /// \u{fb52}: 'ﭒ' ArabicLetterBeehIsolatedForm, /// \u{fb53}: 'ﭓ' ArabicLetterBeehFinalForm, /// \u{fb54}: 'ﭔ' ArabicLetterBeehInitialForm, /// \u{fb55}: 'ﭕ' ArabicLetterBeehMedialForm, /// \u{fb56}: 'ﭖ' ArabicLetterPehIsolatedForm, /// \u{fb57}: 'ﭗ' ArabicLetterPehFinalForm, /// \u{fb58}: 'ﭘ' ArabicLetterPehInitialForm, /// \u{fb59}: 'ﭙ' ArabicLetterPehMedialForm, /// \u{fb5a}: 'ﭚ' ArabicLetterBehehIsolatedForm, /// \u{fb5b}: 'ﭛ' ArabicLetterBehehFinalForm, /// \u{fb5c}: 'ﭜ' ArabicLetterBehehInitialForm, /// \u{fb5d}: 'ﭝ' ArabicLetterBehehMedialForm, /// \u{fb5e}: 'ﭞ' ArabicLetterTtehehIsolatedForm, /// \u{fb5f}: 'ﭟ' ArabicLetterTtehehFinalForm, /// \u{fb60}: 'ﭠ' ArabicLetterTtehehInitialForm, /// \u{fb61}: 'ﭡ' ArabicLetterTtehehMedialForm, /// \u{fb62}: 'ﭢ' ArabicLetterTehehIsolatedForm, /// \u{fb63}: 'ﭣ' ArabicLetterTehehFinalForm, /// \u{fb64}: 'ﭤ' ArabicLetterTehehInitialForm, /// \u{fb65}: 'ﭥ' ArabicLetterTehehMedialForm, /// \u{fb66}: 'ﭦ' ArabicLetterTtehIsolatedForm, /// \u{fb67}: 'ﭧ' ArabicLetterTtehFinalForm, /// \u{fb68}: 'ﭨ' ArabicLetterTtehInitialForm, /// \u{fb69}: 'ﭩ' ArabicLetterTtehMedialForm, /// \u{fb6a}: 'ﭪ' ArabicLetterVehIsolatedForm, /// \u{fb6b}: 'ﭫ' ArabicLetterVehFinalForm, /// \u{fb6c}: 'ﭬ' ArabicLetterVehInitialForm, /// \u{fb6d}: 'ﭭ' ArabicLetterVehMedialForm, /// \u{fb6e}: 'ﭮ' ArabicLetterPehehIsolatedForm, /// \u{fb6f}: 'ﭯ' ArabicLetterPehehFinalForm, /// \u{fb70}: 'ﭰ' ArabicLetterPehehInitialForm, /// \u{fb71}: 'ﭱ' ArabicLetterPehehMedialForm, /// \u{fb72}: 'ﭲ' ArabicLetterDyehIsolatedForm, /// \u{fb73}: 'ﭳ' ArabicLetterDyehFinalForm, /// \u{fb74}: 'ﭴ' ArabicLetterDyehInitialForm, /// \u{fb75}: 'ﭵ' ArabicLetterDyehMedialForm, /// \u{fb76}: 'ﭶ' ArabicLetterNyehIsolatedForm, /// \u{fb77}: 'ﭷ' ArabicLetterNyehFinalForm, /// \u{fb78}: 'ﭸ' ArabicLetterNyehInitialForm, /// \u{fb79}: 'ﭹ' ArabicLetterNyehMedialForm, /// \u{fb7a}: 'ﭺ' ArabicLetterTchehIsolatedForm, /// \u{fb7b}: 'ﭻ' ArabicLetterTchehFinalForm, /// \u{fb7c}: 'ﭼ' ArabicLetterTchehInitialForm, /// \u{fb7d}: 'ﭽ' ArabicLetterTchehMedialForm, /// \u{fb7e}: 'ﭾ' ArabicLetterTchehehIsolatedForm, /// \u{fb7f}: 'ﭿ' ArabicLetterTchehehFinalForm, /// \u{fb80}: 'ﮀ' ArabicLetterTchehehInitialForm, /// \u{fb81}: 'ﮁ' ArabicLetterTchehehMedialForm, /// \u{fb82}: 'ﮂ' ArabicLetterDdahalIsolatedForm, /// \u{fb83}: 'ﮃ' ArabicLetterDdahalFinalForm, /// \u{fb84}: 'ﮄ' ArabicLetterDahalIsolatedForm, /// \u{fb85}: 'ﮅ' ArabicLetterDahalFinalForm, /// \u{fb86}: 'ﮆ' ArabicLetterDulIsolatedForm, /// \u{fb87}: 'ﮇ' ArabicLetterDulFinalForm, /// \u{fb88}: 'ﮈ' ArabicLetterDdalIsolatedForm, /// \u{fb89}: 'ﮉ' ArabicLetterDdalFinalForm, /// \u{fb8a}: 'ﮊ' ArabicLetterJehIsolatedForm, /// \u{fb8b}: 'ﮋ' ArabicLetterJehFinalForm, /// \u{fb8c}: 'ﮌ' ArabicLetterRrehIsolatedForm, /// \u{fb8d}: 'ﮍ' ArabicLetterRrehFinalForm, /// \u{fb8e}: 'ﮎ' ArabicLetterKehehIsolatedForm, /// \u{fb8f}: 'ﮏ' ArabicLetterKehehFinalForm, /// \u{fb90}: 'ﮐ' ArabicLetterKehehInitialForm, /// \u{fb91}: 'ﮑ' ArabicLetterKehehMedialForm, /// \u{fb92}: 'ﮒ' ArabicLetterGafIsolatedForm, /// \u{fb93}: 'ﮓ' ArabicLetterGafFinalForm, /// \u{fb94}: 'ﮔ' ArabicLetterGafInitialForm, /// \u{fb95}: 'ﮕ' ArabicLetterGafMedialForm, /// \u{fb96}: 'ﮖ' ArabicLetterGuehIsolatedForm, /// \u{fb97}: 'ﮗ' ArabicLetterGuehFinalForm, /// \u{fb98}: 'ﮘ' ArabicLetterGuehInitialForm, /// \u{fb99}: 'ﮙ' ArabicLetterGuehMedialForm, /// \u{fb9a}: 'ﮚ' ArabicLetterNgoehIsolatedForm, /// \u{fb9b}: 'ﮛ' ArabicLetterNgoehFinalForm, /// \u{fb9c}: 'ﮜ' ArabicLetterNgoehInitialForm, /// \u{fb9d}: 'ﮝ' ArabicLetterNgoehMedialForm, /// \u{fb9e}: 'ﮞ' ArabicLetterNoonGhunnaIsolatedForm, /// \u{fb9f}: 'ﮟ' ArabicLetterNoonGhunnaFinalForm, /// \u{fba0}: 'ﮠ' ArabicLetterRnoonIsolatedForm, /// \u{fba1}: 'ﮡ' ArabicLetterRnoonFinalForm, /// \u{fba2}: 'ﮢ' ArabicLetterRnoonInitialForm, /// \u{fba3}: 'ﮣ' ArabicLetterRnoonMedialForm, /// \u{fba4}: 'ﮤ' ArabicLetterHehWithYehAboveIsolatedForm, /// \u{fba5}: 'ﮥ' ArabicLetterHehWithYehAboveFinalForm, /// \u{fba6}: 'ﮦ' ArabicLetterHehGoalIsolatedForm, /// \u{fba7}: 'ﮧ' ArabicLetterHehGoalFinalForm, /// \u{fba8}: 'ﮨ' ArabicLetterHehGoalInitialForm, /// \u{fba9}: 'ﮩ' ArabicLetterHehGoalMedialForm, /// \u{fbaa}: 'ﮪ' ArabicLetterHehDoachashmeeIsolatedForm, /// \u{fbab}: 'ﮫ' ArabicLetterHehDoachashmeeFinalForm, /// \u{fbac}: 'ﮬ' ArabicLetterHehDoachashmeeInitialForm, /// \u{fbad}: 'ﮭ' ArabicLetterHehDoachashmeeMedialForm, /// \u{fbae}: 'ﮮ' ArabicLetterYehBarreeIsolatedForm, /// \u{fbaf}: 'ﮯ' ArabicLetterYehBarreeFinalForm, /// \u{fbb0}: 'ﮰ' ArabicLetterYehBarreeWithHamzaAboveIsolatedForm, /// \u{fbb1}: 'ﮱ' ArabicLetterYehBarreeWithHamzaAboveFinalForm, /// \u{fbb2}: '﮲' ArabicSymbolDotAbove, /// \u{fbb3}: '﮳' ArabicSymbolDotBelow, /// \u{fbb4}: '﮴' ArabicSymbolTwoDotsAbove, /// \u{fbb5}: '﮵' ArabicSymbolTwoDotsBelow, /// \u{fbb6}: '﮶' ArabicSymbolThreeDotsAbove, /// \u{fbb7}: '﮷' ArabicSymbolThreeDotsBelow, /// \u{fbb8}: '﮸' ArabicSymbolThreeDotsPointingDownwardsAbove, /// \u{fbb9}: '﮹' ArabicSymbolThreeDotsPointingDownwardsBelow, /// \u{fbba}: '﮺' ArabicSymbolFourDotsAbove, /// \u{fbbb}: '﮻' ArabicSymbolFourDotsBelow, /// \u{fbbc}: '﮼' ArabicSymbolDoubleVerticalBarBelow, /// \u{fbbd}: '﮽' ArabicSymbolTwoDotsVerticallyAbove, /// \u{fbbe}: '﮾' ArabicSymbolTwoDotsVerticallyBelow, /// \u{fbbf}: '﮿' ArabicSymbolRing, /// \u{fbc0}: '﯀' ArabicSymbolSmallTahAbove, /// \u{fbc1}: '﯁' ArabicSymbolSmallTahBelow, /// \u{fbd3}: 'ﯓ' ArabicLetterNgIsolatedForm, /// \u{fbd4}: 'ﯔ' ArabicLetterNgFinalForm, /// \u{fbd5}: 'ﯕ' ArabicLetterNgInitialForm, /// \u{fbd6}: 'ﯖ' ArabicLetterNgMedialForm, /// \u{fbd7}: 'ﯗ' ArabicLetterUIsolatedForm, /// \u{fbd8}: 'ﯘ' ArabicLetterUFinalForm, /// \u{fbd9}: 'ﯙ' ArabicLetterOeIsolatedForm, /// \u{fbda}: 'ﯚ' ArabicLetterOeFinalForm, /// \u{fbdb}: 'ﯛ' ArabicLetterYuIsolatedForm, /// \u{fbdc}: 'ﯜ' ArabicLetterYuFinalForm, /// \u{fbdd}: 'ﯝ' ArabicLetterUWithHamzaAboveIsolatedForm, /// \u{fbde}: 'ﯞ' ArabicLetterVeIsolatedForm, /// \u{fbdf}: 'ﯟ' ArabicLetterVeFinalForm, /// \u{fbe0}: 'ﯠ' ArabicLetterKirghizOeIsolatedForm, /// \u{fbe1}: 'ﯡ' ArabicLetterKirghizOeFinalForm, /// \u{fbe2}: 'ﯢ' ArabicLetterKirghizYuIsolatedForm, /// \u{fbe3}: 'ﯣ' ArabicLetterKirghizYuFinalForm, /// \u{fbe4}: 'ﯤ' ArabicLetterEIsolatedForm, /// \u{fbe5}: 'ﯥ' ArabicLetterEFinalForm, /// \u{fbe6}: 'ﯦ' ArabicLetterEInitialForm, /// \u{fbe7}: 'ﯧ' ArabicLetterEMedialForm, /// \u{fbe8}: 'ﯨ' ArabicLetterUighurKazakhKirghizAlefMaksuraInitialForm, /// \u{fbe9}: 'ﯩ' ArabicLetterUighurKazakhKirghizAlefMaksuraMedialForm, /// \u{fbea}: 'ﯪ' ArabicLigatureYehWithHamzaAboveWithAlefIsolatedForm, /// \u{fbeb}: 'ﯫ' ArabicLigatureYehWithHamzaAboveWithAlefFinalForm, /// \u{fbec}: 'ﯬ' ArabicLigatureYehWithHamzaAboveWithAeIsolatedForm, /// \u{fbed}: 'ﯭ' ArabicLigatureYehWithHamzaAboveWithAeFinalForm, /// \u{fbee}: 'ﯮ' ArabicLigatureYehWithHamzaAboveWithWawIsolatedForm, /// \u{fbef}: 'ﯯ' ArabicLigatureYehWithHamzaAboveWithWawFinalForm, /// \u{fbf0}: 'ﯰ' ArabicLigatureYehWithHamzaAboveWithUIsolatedForm, /// \u{fbf1}: 'ﯱ' ArabicLigatureYehWithHamzaAboveWithUFinalForm, /// \u{fbf2}: 'ﯲ' ArabicLigatureYehWithHamzaAboveWithOeIsolatedForm, /// \u{fbf3}: 'ﯳ' ArabicLigatureYehWithHamzaAboveWithOeFinalForm, /// \u{fbf4}: 'ﯴ' ArabicLigatureYehWithHamzaAboveWithYuIsolatedForm, /// \u{fbf5}: 'ﯵ' ArabicLigatureYehWithHamzaAboveWithYuFinalForm, /// \u{fbf6}: 'ﯶ' ArabicLigatureYehWithHamzaAboveWithEIsolatedForm, /// \u{fbf7}: 'ﯷ' ArabicLigatureYehWithHamzaAboveWithEFinalForm, /// \u{fbf8}: 'ﯸ' ArabicLigatureYehWithHamzaAboveWithEInitialForm, /// \u{fbf9}: 'ﯹ' ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraIsolatedForm, /// \u{fbfa}: 'ﯺ' ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraFinalForm, /// \u{fbfb}: 'ﯻ' ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraInitialForm, /// \u{fbfc}: 'ﯼ' ArabicLetterFarsiYehIsolatedForm, /// \u{fbfd}: 'ﯽ' ArabicLetterFarsiYehFinalForm, /// \u{fbfe}: 'ﯾ' ArabicLetterFarsiYehInitialForm, /// \u{fbff}: 'ﯿ' ArabicLetterFarsiYehMedialForm, /// \u{fc00}: 'ﰀ' ArabicLigatureYehWithHamzaAboveWithJeemIsolatedForm, /// \u{fc01}: 'ﰁ' ArabicLigatureYehWithHamzaAboveWithHahIsolatedForm, /// \u{fc02}: 'ﰂ' ArabicLigatureYehWithHamzaAboveWithMeemIsolatedForm, /// \u{fc03}: 'ﰃ' ArabicLigatureYehWithHamzaAboveWithAlefMaksuraIsolatedForm, /// \u{fc04}: 'ﰄ' ArabicLigatureYehWithHamzaAboveWithYehIsolatedForm, /// \u{fc05}: 'ﰅ' ArabicLigatureBehWithJeemIsolatedForm, /// \u{fc06}: 'ﰆ' ArabicLigatureBehWithHahIsolatedForm, /// \u{fc07}: 'ﰇ' ArabicLigatureBehWithKhahIsolatedForm, /// \u{fc08}: 'ﰈ' ArabicLigatureBehWithMeemIsolatedForm, /// \u{fc09}: 'ﰉ' ArabicLigatureBehWithAlefMaksuraIsolatedForm, /// \u{fc0a}: 'ﰊ' ArabicLigatureBehWithYehIsolatedForm, /// \u{fc0b}: 'ﰋ' ArabicLigatureTehWithJeemIsolatedForm, /// \u{fc0c}: 'ﰌ' ArabicLigatureTehWithHahIsolatedForm, /// \u{fc0d}: 'ﰍ' ArabicLigatureTehWithKhahIsolatedForm, /// \u{fc0e}: 'ﰎ' ArabicLigatureTehWithMeemIsolatedForm, /// \u{fc0f}: 'ﰏ' ArabicLigatureTehWithAlefMaksuraIsolatedForm, /// \u{fc10}: 'ﰐ' ArabicLigatureTehWithYehIsolatedForm, /// \u{fc11}: 'ﰑ' ArabicLigatureThehWithJeemIsolatedForm, /// \u{fc12}: 'ﰒ' ArabicLigatureThehWithMeemIsolatedForm, /// \u{fc13}: 'ﰓ' ArabicLigatureThehWithAlefMaksuraIsolatedForm, /// \u{fc14}: 'ﰔ' ArabicLigatureThehWithYehIsolatedForm, /// \u{fc15}: 'ﰕ' ArabicLigatureJeemWithHahIsolatedForm, /// \u{fc16}: 'ﰖ' ArabicLigatureJeemWithMeemIsolatedForm, /// \u{fc17}: 'ﰗ' ArabicLigatureHahWithJeemIsolatedForm, /// \u{fc18}: 'ﰘ' ArabicLigatureHahWithMeemIsolatedForm, /// \u{fc19}: 'ﰙ' ArabicLigatureKhahWithJeemIsolatedForm, /// \u{fc1a}: 'ﰚ' ArabicLigatureKhahWithHahIsolatedForm, /// \u{fc1b}: 'ﰛ' ArabicLigatureKhahWithMeemIsolatedForm, /// \u{fc1c}: 'ﰜ' ArabicLigatureSeenWithJeemIsolatedForm, /// \u{fc1d}: 'ﰝ' ArabicLigatureSeenWithHahIsolatedForm, /// \u{fc1e}: 'ﰞ' ArabicLigatureSeenWithKhahIsolatedForm, /// \u{fc1f}: 'ﰟ' ArabicLigatureSeenWithMeemIsolatedForm, /// \u{fc20}: 'ﰠ' ArabicLigatureSadWithHahIsolatedForm, /// \u{fc21}: 'ﰡ' ArabicLigatureSadWithMeemIsolatedForm, /// \u{fc22}: 'ﰢ' ArabicLigatureDadWithJeemIsolatedForm, /// \u{fc23}: 'ﰣ' ArabicLigatureDadWithHahIsolatedForm, /// \u{fc24}: 'ﰤ' ArabicLigatureDadWithKhahIsolatedForm, /// \u{fc25}: 'ﰥ' ArabicLigatureDadWithMeemIsolatedForm, /// \u{fc26}: 'ﰦ' ArabicLigatureTahWithHahIsolatedForm, /// \u{fc27}: 'ﰧ' ArabicLigatureTahWithMeemIsolatedForm, /// \u{fc28}: 'ﰨ' ArabicLigatureZahWithMeemIsolatedForm, /// \u{fc29}: 'ﰩ' ArabicLigatureAinWithJeemIsolatedForm, /// \u{fc2a}: 'ﰪ' ArabicLigatureAinWithMeemIsolatedForm, /// \u{fc2b}: 'ﰫ' ArabicLigatureGhainWithJeemIsolatedForm, /// \u{fc2c}: 'ﰬ' ArabicLigatureGhainWithMeemIsolatedForm, /// \u{fc2d}: 'ﰭ' ArabicLigatureFehWithJeemIsolatedForm, /// \u{fc2e}: 'ﰮ' ArabicLigatureFehWithHahIsolatedForm, /// \u{fc2f}: 'ﰯ' ArabicLigatureFehWithKhahIsolatedForm, /// \u{fc30}: 'ﰰ' ArabicLigatureFehWithMeemIsolatedForm, /// \u{fc31}: 'ﰱ' ArabicLigatureFehWithAlefMaksuraIsolatedForm, /// \u{fc32}: 'ﰲ' ArabicLigatureFehWithYehIsolatedForm, /// \u{fc33}: 'ﰳ' ArabicLigatureQafWithHahIsolatedForm, /// \u{fc34}: 'ﰴ' ArabicLigatureQafWithMeemIsolatedForm, /// \u{fc35}: 'ﰵ' ArabicLigatureQafWithAlefMaksuraIsolatedForm, /// \u{fc36}: 'ﰶ' ArabicLigatureQafWithYehIsolatedForm, /// \u{fc37}: 'ﰷ' ArabicLigatureKafWithAlefIsolatedForm, /// \u{fc38}: 'ﰸ' ArabicLigatureKafWithJeemIsolatedForm, /// \u{fc39}: 'ﰹ' ArabicLigatureKafWithHahIsolatedForm, /// \u{fc3a}: 'ﰺ' ArabicLigatureKafWithKhahIsolatedForm, /// \u{fc3b}: 'ﰻ' ArabicLigatureKafWithLamIsolatedForm, /// \u{fc3c}: 'ﰼ' ArabicLigatureKafWithMeemIsolatedForm, /// \u{fc3d}: 'ﰽ' ArabicLigatureKafWithAlefMaksuraIsolatedForm, /// \u{fc3e}: 'ﰾ' ArabicLigatureKafWithYehIsolatedForm, /// \u{fc3f}: 'ﰿ' ArabicLigatureLamWithJeemIsolatedForm, /// \u{fc40}: 'ﱀ' ArabicLigatureLamWithHahIsolatedForm, /// \u{fc41}: 'ﱁ' ArabicLigatureLamWithKhahIsolatedForm, /// \u{fc42}: 'ﱂ' ArabicLigatureLamWithMeemIsolatedForm, /// \u{fc43}: 'ﱃ' ArabicLigatureLamWithAlefMaksuraIsolatedForm, /// \u{fc44}: 'ﱄ' ArabicLigatureLamWithYehIsolatedForm, /// \u{fc45}: 'ﱅ' ArabicLigatureMeemWithJeemIsolatedForm, /// \u{fc46}: 'ﱆ' ArabicLigatureMeemWithHahIsolatedForm, /// \u{fc47}: 'ﱇ' ArabicLigatureMeemWithKhahIsolatedForm, /// \u{fc48}: 'ﱈ' ArabicLigatureMeemWithMeemIsolatedForm, /// \u{fc49}: 'ﱉ' ArabicLigatureMeemWithAlefMaksuraIsolatedForm, /// \u{fc4a}: 'ﱊ' ArabicLigatureMeemWithYehIsolatedForm, /// \u{fc4b}: 'ﱋ' ArabicLigatureNoonWithJeemIsolatedForm, /// \u{fc4c}: 'ﱌ' ArabicLigatureNoonWithHahIsolatedForm, /// \u{fc4d}: 'ﱍ' ArabicLigatureNoonWithKhahIsolatedForm, /// \u{fc4e}: 'ﱎ' ArabicLigatureNoonWithMeemIsolatedForm, /// \u{fc4f}: 'ﱏ' ArabicLigatureNoonWithAlefMaksuraIsolatedForm, /// \u{fc50}: 'ﱐ' ArabicLigatureNoonWithYehIsolatedForm, /// \u{fc51}: 'ﱑ' ArabicLigatureHehWithJeemIsolatedForm, /// \u{fc52}: 'ﱒ' ArabicLigatureHehWithMeemIsolatedForm, /// \u{fc53}: 'ﱓ' ArabicLigatureHehWithAlefMaksuraIsolatedForm, /// \u{fc54}: 'ﱔ' ArabicLigatureHehWithYehIsolatedForm, /// \u{fc55}: 'ﱕ' ArabicLigatureYehWithJeemIsolatedForm, /// \u{fc56}: 'ﱖ' ArabicLigatureYehWithHahIsolatedForm, /// \u{fc57}: 'ﱗ' ArabicLigatureYehWithKhahIsolatedForm, /// \u{fc58}: 'ﱘ' ArabicLigatureYehWithMeemIsolatedForm, /// \u{fc59}: 'ﱙ' ArabicLigatureYehWithAlefMaksuraIsolatedForm, /// \u{fc5a}: 'ﱚ' ArabicLigatureYehWithYehIsolatedForm, /// \u{fc5b}: 'ﱛ' ArabicLigatureThalWithSuperscriptAlefIsolatedForm, /// \u{fc5c}: 'ﱜ' ArabicLigatureRehWithSuperscriptAlefIsolatedForm, /// \u{fc5d}: 'ﱝ' ArabicLigatureAlefMaksuraWithSuperscriptAlefIsolatedForm, /// \u{fc5e}: 'ﱞ' ArabicLigatureShaddaWithDammatanIsolatedForm, /// \u{fc5f}: 'ﱟ' ArabicLigatureShaddaWithKasratanIsolatedForm, /// \u{fc60}: 'ﱠ' ArabicLigatureShaddaWithFathaIsolatedForm, /// \u{fc61}: 'ﱡ' ArabicLigatureShaddaWithDammaIsolatedForm, /// \u{fc62}: 'ﱢ' ArabicLigatureShaddaWithKasraIsolatedForm, /// \u{fc63}: 'ﱣ' ArabicLigatureShaddaWithSuperscriptAlefIsolatedForm, /// \u{fc64}: 'ﱤ' ArabicLigatureYehWithHamzaAboveWithRehFinalForm, /// \u{fc65}: 'ﱥ' ArabicLigatureYehWithHamzaAboveWithZainFinalForm, /// \u{fc66}: 'ﱦ' ArabicLigatureYehWithHamzaAboveWithMeemFinalForm, /// \u{fc67}: 'ﱧ' ArabicLigatureYehWithHamzaAboveWithNoonFinalForm, /// \u{fc68}: 'ﱨ' ArabicLigatureYehWithHamzaAboveWithAlefMaksuraFinalForm, /// \u{fc69}: 'ﱩ' ArabicLigatureYehWithHamzaAboveWithYehFinalForm, /// \u{fc6a}: 'ﱪ' ArabicLigatureBehWithRehFinalForm, /// \u{fc6b}: 'ﱫ' ArabicLigatureBehWithZainFinalForm, /// \u{fc6c}: 'ﱬ' ArabicLigatureBehWithMeemFinalForm, /// \u{fc6d}: 'ﱭ' ArabicLigatureBehWithNoonFinalForm, /// \u{fc6e}: 'ﱮ' ArabicLigatureBehWithAlefMaksuraFinalForm, /// \u{fc6f}: 'ﱯ' ArabicLigatureBehWithYehFinalForm, /// \u{fc70}: 'ﱰ' ArabicLigatureTehWithRehFinalForm, /// \u{fc71}: 'ﱱ' ArabicLigatureTehWithZainFinalForm, /// \u{fc72}: 'ﱲ' ArabicLigatureTehWithMeemFinalForm, /// \u{fc73}: 'ﱳ' ArabicLigatureTehWithNoonFinalForm, /// \u{fc74}: 'ﱴ' ArabicLigatureTehWithAlefMaksuraFinalForm, /// \u{fc75}: 'ﱵ' ArabicLigatureTehWithYehFinalForm, /// \u{fc76}: 'ﱶ' ArabicLigatureThehWithRehFinalForm, /// \u{fc77}: 'ﱷ' ArabicLigatureThehWithZainFinalForm, /// \u{fc78}: 'ﱸ' ArabicLigatureThehWithMeemFinalForm, /// \u{fc79}: 'ﱹ' ArabicLigatureThehWithNoonFinalForm, /// \u{fc7a}: 'ﱺ' ArabicLigatureThehWithAlefMaksuraFinalForm, /// \u{fc7b}: 'ﱻ' ArabicLigatureThehWithYehFinalForm, /// \u{fc7c}: 'ﱼ' ArabicLigatureFehWithAlefMaksuraFinalForm, /// \u{fc7d}: 'ﱽ' ArabicLigatureFehWithYehFinalForm, /// \u{fc7e}: 'ﱾ' ArabicLigatureQafWithAlefMaksuraFinalForm, /// \u{fc7f}: 'ﱿ' ArabicLigatureQafWithYehFinalForm, /// \u{fc80}: 'ﲀ' ArabicLigatureKafWithAlefFinalForm, /// \u{fc81}: 'ﲁ' ArabicLigatureKafWithLamFinalForm, /// \u{fc82}: 'ﲂ' ArabicLigatureKafWithMeemFinalForm, /// \u{fc83}: 'ﲃ' ArabicLigatureKafWithAlefMaksuraFinalForm, /// \u{fc84}: 'ﲄ' ArabicLigatureKafWithYehFinalForm, /// \u{fc85}: 'ﲅ' ArabicLigatureLamWithMeemFinalForm, /// \u{fc86}: 'ﲆ' ArabicLigatureLamWithAlefMaksuraFinalForm, /// \u{fc87}: 'ﲇ' ArabicLigatureLamWithYehFinalForm, /// \u{fc88}: 'ﲈ' ArabicLigatureMeemWithAlefFinalForm, /// \u{fc89}: 'ﲉ' ArabicLigatureMeemWithMeemFinalForm, /// \u{fc8a}: 'ﲊ' ArabicLigatureNoonWithRehFinalForm, /// \u{fc8b}: 'ﲋ' ArabicLigatureNoonWithZainFinalForm, /// \u{fc8c}: 'ﲌ' ArabicLigatureNoonWithMeemFinalForm, /// \u{fc8d}: 'ﲍ' ArabicLigatureNoonWithNoonFinalForm, /// \u{fc8e}: 'ﲎ' ArabicLigatureNoonWithAlefMaksuraFinalForm, /// \u{fc8f}: 'ﲏ' ArabicLigatureNoonWithYehFinalForm, /// \u{fc90}: 'ﲐ' ArabicLigatureAlefMaksuraWithSuperscriptAlefFinalForm, /// \u{fc91}: 'ﲑ' ArabicLigatureYehWithRehFinalForm, /// \u{fc92}: 'ﲒ' ArabicLigatureYehWithZainFinalForm, /// \u{fc93}: 'ﲓ' ArabicLigatureYehWithMeemFinalForm, /// \u{fc94}: 'ﲔ' ArabicLigatureYehWithNoonFinalForm, /// \u{fc95}: 'ﲕ' ArabicLigatureYehWithAlefMaksuraFinalForm, /// \u{fc96}: 'ﲖ' ArabicLigatureYehWithYehFinalForm, /// \u{fc97}: 'ﲗ' ArabicLigatureYehWithHamzaAboveWithJeemInitialForm, /// \u{fc98}: 'ﲘ' ArabicLigatureYehWithHamzaAboveWithHahInitialForm, /// \u{fc99}: 'ﲙ' ArabicLigatureYehWithHamzaAboveWithKhahInitialForm, /// \u{fc9a}: 'ﲚ' ArabicLigatureYehWithHamzaAboveWithMeemInitialForm, /// \u{fc9b}: 'ﲛ' ArabicLigatureYehWithHamzaAboveWithHehInitialForm, /// \u{fc9c}: 'ﲜ' ArabicLigatureBehWithJeemInitialForm, /// \u{fc9d}: 'ﲝ' ArabicLigatureBehWithHahInitialForm, /// \u{fc9e}: 'ﲞ' ArabicLigatureBehWithKhahInitialForm, /// \u{fc9f}: 'ﲟ' ArabicLigatureBehWithMeemInitialForm, /// \u{fca0}: 'ﲠ' ArabicLigatureBehWithHehInitialForm, /// \u{fca1}: 'ﲡ' ArabicLigatureTehWithJeemInitialForm, /// \u{fca2}: 'ﲢ' ArabicLigatureTehWithHahInitialForm, /// \u{fca3}: 'ﲣ' ArabicLigatureTehWithKhahInitialForm, /// \u{fca4}: 'ﲤ' ArabicLigatureTehWithMeemInitialForm, /// \u{fca5}: 'ﲥ' ArabicLigatureTehWithHehInitialForm, /// \u{fca6}: 'ﲦ' ArabicLigatureThehWithMeemInitialForm, /// \u{fca7}: 'ﲧ' ArabicLigatureJeemWithHahInitialForm, /// \u{fca8}: 'ﲨ' ArabicLigatureJeemWithMeemInitialForm, /// \u{fca9}: 'ﲩ' ArabicLigatureHahWithJeemInitialForm, /// \u{fcaa}: 'ﲪ' ArabicLigatureHahWithMeemInitialForm, /// \u{fcab}: 'ﲫ' ArabicLigatureKhahWithJeemInitialForm, /// \u{fcac}: 'ﲬ' ArabicLigatureKhahWithMeemInitialForm, /// \u{fcad}: 'ﲭ' ArabicLigatureSeenWithJeemInitialForm, /// \u{fcae}: 'ﲮ' ArabicLigatureSeenWithHahInitialForm, /// \u{fcaf}: 'ﲯ' ArabicLigatureSeenWithKhahInitialForm, /// \u{fcb0}: 'ﲰ' ArabicLigatureSeenWithMeemInitialForm, /// \u{fcb1}: 'ﲱ' ArabicLigatureSadWithHahInitialForm, /// \u{fcb2}: 'ﲲ' ArabicLigatureSadWithKhahInitialForm, /// \u{fcb3}: 'ﲳ' ArabicLigatureSadWithMeemInitialForm, /// \u{fcb4}: 'ﲴ' ArabicLigatureDadWithJeemInitialForm, /// \u{fcb5}: 'ﲵ' ArabicLigatureDadWithHahInitialForm, /// \u{fcb6}: 'ﲶ' ArabicLigatureDadWithKhahInitialForm, /// \u{fcb7}: 'ﲷ' ArabicLigatureDadWithMeemInitialForm, /// \u{fcb8}: 'ﲸ' ArabicLigatureTahWithHahInitialForm, /// \u{fcb9}: 'ﲹ' ArabicLigatureZahWithMeemInitialForm, /// \u{fcba}: 'ﲺ' ArabicLigatureAinWithJeemInitialForm, /// \u{fcbb}: 'ﲻ' ArabicLigatureAinWithMeemInitialForm, /// \u{fcbc}: 'ﲼ' ArabicLigatureGhainWithJeemInitialForm, /// \u{fcbd}: 'ﲽ' ArabicLigatureGhainWithMeemInitialForm, /// \u{fcbe}: 'ﲾ' ArabicLigatureFehWithJeemInitialForm, /// \u{fcbf}: 'ﲿ' ArabicLigatureFehWithHahInitialForm, /// \u{fcc0}: 'ﳀ' ArabicLigatureFehWithKhahInitialForm, /// \u{fcc1}: 'ﳁ' ArabicLigatureFehWithMeemInitialForm, /// \u{fcc2}: 'ﳂ' ArabicLigatureQafWithHahInitialForm, /// \u{fcc3}: 'ﳃ' ArabicLigatureQafWithMeemInitialForm, /// \u{fcc4}: 'ﳄ' ArabicLigatureKafWithJeemInitialForm, /// \u{fcc5}: 'ﳅ' ArabicLigatureKafWithHahInitialForm, /// \u{fcc6}: 'ﳆ' ArabicLigatureKafWithKhahInitialForm, /// \u{fcc7}: 'ﳇ' ArabicLigatureKafWithLamInitialForm, /// \u{fcc8}: 'ﳈ' ArabicLigatureKafWithMeemInitialForm, /// \u{fcc9}: 'ﳉ' ArabicLigatureLamWithJeemInitialForm, /// \u{fcca}: 'ﳊ' ArabicLigatureLamWithHahInitialForm, /// \u{fccb}: 'ﳋ' ArabicLigatureLamWithKhahInitialForm, /// \u{fccc}: 'ﳌ' ArabicLigatureLamWithMeemInitialForm, /// \u{fccd}: 'ﳍ' ArabicLigatureLamWithHehInitialForm, /// \u{fcce}: 'ﳎ' ArabicLigatureMeemWithJeemInitialForm, /// \u{fccf}: 'ﳏ' ArabicLigatureMeemWithHahInitialForm, /// \u{fcd0}: 'ﳐ' ArabicLigatureMeemWithKhahInitialForm, /// \u{fcd1}: 'ﳑ' ArabicLigatureMeemWithMeemInitialForm, /// \u{fcd2}: 'ﳒ' ArabicLigatureNoonWithJeemInitialForm, /// \u{fcd3}: 'ﳓ' ArabicLigatureNoonWithHahInitialForm, /// \u{fcd4}: 'ﳔ' ArabicLigatureNoonWithKhahInitialForm, /// \u{fcd5}: 'ﳕ' ArabicLigatureNoonWithMeemInitialForm, /// \u{fcd6}: 'ﳖ' ArabicLigatureNoonWithHehInitialForm, /// \u{fcd7}: 'ﳗ' ArabicLigatureHehWithJeemInitialForm, /// \u{fcd8}: 'ﳘ' ArabicLigatureHehWithMeemInitialForm, /// \u{fcd9}: 'ﳙ' ArabicLigatureHehWithSuperscriptAlefInitialForm, /// \u{fcda}: 'ﳚ' ArabicLigatureYehWithJeemInitialForm, /// \u{fcdb}: 'ﳛ' ArabicLigatureYehWithHahInitialForm, /// \u{fcdc}: 'ﳜ' ArabicLigatureYehWithKhahInitialForm, /// \u{fcdd}: 'ﳝ' ArabicLigatureYehWithMeemInitialForm, /// \u{fcde}: 'ﳞ' ArabicLigatureYehWithHehInitialForm, /// \u{fcdf}: 'ﳟ' ArabicLigatureYehWithHamzaAboveWithMeemMedialForm, /// \u{fce0}: 'ﳠ' ArabicLigatureYehWithHamzaAboveWithHehMedialForm, /// \u{fce1}: 'ﳡ' ArabicLigatureBehWithMeemMedialForm, /// \u{fce2}: 'ﳢ' ArabicLigatureBehWithHehMedialForm, /// \u{fce3}: 'ﳣ' ArabicLigatureTehWithMeemMedialForm, /// \u{fce4}: 'ﳤ' ArabicLigatureTehWithHehMedialForm, /// \u{fce5}: 'ﳥ' ArabicLigatureThehWithMeemMedialForm, /// \u{fce6}: 'ﳦ' ArabicLigatureThehWithHehMedialForm, /// \u{fce7}: 'ﳧ' ArabicLigatureSeenWithMeemMedialForm, /// \u{fce8}: 'ﳨ' ArabicLigatureSeenWithHehMedialForm, /// \u{fce9}: 'ﳩ' ArabicLigatureSheenWithMeemMedialForm, /// \u{fcea}: 'ﳪ' ArabicLigatureSheenWithHehMedialForm, /// \u{fceb}: 'ﳫ' ArabicLigatureKafWithLamMedialForm, /// \u{fcec}: 'ﳬ' ArabicLigatureKafWithMeemMedialForm, /// \u{fced}: 'ﳭ' ArabicLigatureLamWithMeemMedialForm, /// \u{fcee}: 'ﳮ' ArabicLigatureNoonWithMeemMedialForm, /// \u{fcef}: 'ﳯ' ArabicLigatureNoonWithHehMedialForm, /// \u{fcf0}: 'ﳰ' ArabicLigatureYehWithMeemMedialForm, /// \u{fcf1}: 'ﳱ' ArabicLigatureYehWithHehMedialForm, /// \u{fcf2}: 'ﳲ' ArabicLigatureShaddaWithFathaMedialForm, /// \u{fcf3}: 'ﳳ' ArabicLigatureShaddaWithDammaMedialForm, /// \u{fcf4}: 'ﳴ' ArabicLigatureShaddaWithKasraMedialForm, /// \u{fcf5}: 'ﳵ' ArabicLigatureTahWithAlefMaksuraIsolatedForm, /// \u{fcf6}: 'ﳶ' ArabicLigatureTahWithYehIsolatedForm, /// \u{fcf7}: 'ﳷ' ArabicLigatureAinWithAlefMaksuraIsolatedForm, /// \u{fcf8}: 'ﳸ' ArabicLigatureAinWithYehIsolatedForm, /// \u{fcf9}: 'ﳹ' ArabicLigatureGhainWithAlefMaksuraIsolatedForm, /// \u{fcfa}: 'ﳺ' ArabicLigatureGhainWithYehIsolatedForm, /// \u{fcfb}: 'ﳻ' ArabicLigatureSeenWithAlefMaksuraIsolatedForm, /// \u{fcfc}: 'ﳼ' ArabicLigatureSeenWithYehIsolatedForm, /// \u{fcfd}: 'ﳽ' ArabicLigatureSheenWithAlefMaksuraIsolatedForm, /// \u{fcfe}: 'ﳾ' ArabicLigatureSheenWithYehIsolatedForm, /// \u{fcff}: 'ﳿ' ArabicLigatureHahWithAlefMaksuraIsolatedForm, /// \u{fd00}: 'ﴀ' ArabicLigatureHahWithYehIsolatedForm, /// \u{fd01}: 'ﴁ' ArabicLigatureJeemWithAlefMaksuraIsolatedForm, /// \u{fd02}: 'ﴂ' ArabicLigatureJeemWithYehIsolatedForm, /// \u{fd03}: 'ﴃ' ArabicLigatureKhahWithAlefMaksuraIsolatedForm, /// \u{fd04}: 'ﴄ' ArabicLigatureKhahWithYehIsolatedForm, /// \u{fd05}: 'ﴅ' ArabicLigatureSadWithAlefMaksuraIsolatedForm, /// \u{fd06}: 'ﴆ' ArabicLigatureSadWithYehIsolatedForm, /// \u{fd07}: 'ﴇ' ArabicLigatureDadWithAlefMaksuraIsolatedForm, /// \u{fd08}: 'ﴈ' ArabicLigatureDadWithYehIsolatedForm, /// \u{fd09}: 'ﴉ' ArabicLigatureSheenWithJeemIsolatedForm, /// \u{fd0a}: 'ﴊ' ArabicLigatureSheenWithHahIsolatedForm, /// \u{fd0b}: 'ﴋ' ArabicLigatureSheenWithKhahIsolatedForm, /// \u{fd0c}: 'ﴌ' ArabicLigatureSheenWithMeemIsolatedForm, /// \u{fd0d}: 'ﴍ' ArabicLigatureSheenWithRehIsolatedForm, /// \u{fd0e}: 'ﴎ' ArabicLigatureSeenWithRehIsolatedForm, /// \u{fd0f}: 'ﴏ' ArabicLigatureSadWithRehIsolatedForm, /// \u{fd10}: 'ﴐ' ArabicLigatureDadWithRehIsolatedForm, /// \u{fd11}: 'ﴑ' ArabicLigatureTahWithAlefMaksuraFinalForm, /// \u{fd12}: 'ﴒ' ArabicLigatureTahWithYehFinalForm, /// \u{fd13}: 'ﴓ' ArabicLigatureAinWithAlefMaksuraFinalForm, /// \u{fd14}: 'ﴔ' ArabicLigatureAinWithYehFinalForm, /// \u{fd15}: 'ﴕ' ArabicLigatureGhainWithAlefMaksuraFinalForm, /// \u{fd16}: 'ﴖ' ArabicLigatureGhainWithYehFinalForm, /// \u{fd17}: 'ﴗ' ArabicLigatureSeenWithAlefMaksuraFinalForm, /// \u{fd18}: 'ﴘ' ArabicLigatureSeenWithYehFinalForm, /// \u{fd19}: 'ﴙ' ArabicLigatureSheenWithAlefMaksuraFinalForm, /// \u{fd1a}: 'ﴚ' ArabicLigatureSheenWithYehFinalForm, /// \u{fd1b}: 'ﴛ' ArabicLigatureHahWithAlefMaksuraFinalForm, /// \u{fd1c}: 'ﴜ' ArabicLigatureHahWithYehFinalForm, /// \u{fd1d}: 'ﴝ' ArabicLigatureJeemWithAlefMaksuraFinalForm, /// \u{fd1e}: 'ﴞ' ArabicLigatureJeemWithYehFinalForm, /// \u{fd1f}: 'ﴟ' ArabicLigatureKhahWithAlefMaksuraFinalForm, /// \u{fd20}: 'ﴠ' ArabicLigatureKhahWithYehFinalForm, /// \u{fd21}: 'ﴡ' ArabicLigatureSadWithAlefMaksuraFinalForm, /// \u{fd22}: 'ﴢ' ArabicLigatureSadWithYehFinalForm, /// \u{fd23}: 'ﴣ' ArabicLigatureDadWithAlefMaksuraFinalForm, /// \u{fd24}: 'ﴤ' ArabicLigatureDadWithYehFinalForm, /// \u{fd25}: 'ﴥ' ArabicLigatureSheenWithJeemFinalForm, /// \u{fd26}: 'ﴦ' ArabicLigatureSheenWithHahFinalForm, /// \u{fd27}: 'ﴧ' ArabicLigatureSheenWithKhahFinalForm, /// \u{fd28}: 'ﴨ' ArabicLigatureSheenWithMeemFinalForm, /// \u{fd29}: 'ﴩ' ArabicLigatureSheenWithRehFinalForm, /// \u{fd2a}: 'ﴪ' ArabicLigatureSeenWithRehFinalForm, /// \u{fd2b}: 'ﴫ' ArabicLigatureSadWithRehFinalForm, /// \u{fd2c}: 'ﴬ' ArabicLigatureDadWithRehFinalForm, /// \u{fd2d}: 'ﴭ' ArabicLigatureSheenWithJeemInitialForm, /// \u{fd2e}: 'ﴮ' ArabicLigatureSheenWithHahInitialForm, /// \u{fd2f}: 'ﴯ' ArabicLigatureSheenWithKhahInitialForm, /// \u{fd30}: 'ﴰ' ArabicLigatureSheenWithMeemInitialForm, /// \u{fd31}: 'ﴱ' ArabicLigatureSeenWithHehInitialForm, /// \u{fd32}: 'ﴲ' ArabicLigatureSheenWithHehInitialForm, /// \u{fd33}: 'ﴳ' ArabicLigatureTahWithMeemInitialForm, /// \u{fd34}: 'ﴴ' ArabicLigatureSeenWithJeemMedialForm, /// \u{fd35}: 'ﴵ' ArabicLigatureSeenWithHahMedialForm, /// \u{fd36}: 'ﴶ' ArabicLigatureSeenWithKhahMedialForm, /// \u{fd37}: 'ﴷ' ArabicLigatureSheenWithJeemMedialForm, /// \u{fd38}: 'ﴸ' ArabicLigatureSheenWithHahMedialForm, /// \u{fd39}: 'ﴹ' ArabicLigatureSheenWithKhahMedialForm, /// \u{fd3a}: 'ﴺ' ArabicLigatureTahWithMeemMedialForm, /// \u{fd3b}: 'ﴻ' ArabicLigatureZahWithMeemMedialForm, /// \u{fd3c}: 'ﴼ' ArabicLigatureAlefWithFathatanFinalForm, /// \u{fd3d}: 'ﴽ' ArabicLigatureAlefWithFathatanIsolatedForm, /// \u{fd3e}: '﴾' OrnateLeftParenthesis, /// \u{fd3f}: '﴿' OrnateRightParenthesis, /// \u{fd50}: 'ﵐ' ArabicLigatureTehWithJeemWithMeemInitialForm, /// \u{fd51}: 'ﵑ' ArabicLigatureTehWithHahWithJeemFinalForm, /// \u{fd52}: 'ﵒ' ArabicLigatureTehWithHahWithJeemInitialForm, /// \u{fd53}: 'ﵓ' ArabicLigatureTehWithHahWithMeemInitialForm, /// \u{fd54}: 'ﵔ' ArabicLigatureTehWithKhahWithMeemInitialForm, /// \u{fd55}: 'ﵕ' ArabicLigatureTehWithMeemWithJeemInitialForm, /// \u{fd56}: 'ﵖ' ArabicLigatureTehWithMeemWithHahInitialForm, /// \u{fd57}: 'ﵗ' ArabicLigatureTehWithMeemWithKhahInitialForm, /// \u{fd58}: 'ﵘ' ArabicLigatureJeemWithMeemWithHahFinalForm, /// \u{fd59}: 'ﵙ' ArabicLigatureJeemWithMeemWithHahInitialForm, /// \u{fd5a}: 'ﵚ' ArabicLigatureHahWithMeemWithYehFinalForm, /// \u{fd5b}: 'ﵛ' ArabicLigatureHahWithMeemWithAlefMaksuraFinalForm, /// \u{fd5c}: 'ﵜ' ArabicLigatureSeenWithHahWithJeemInitialForm, /// \u{fd5d}: 'ﵝ' ArabicLigatureSeenWithJeemWithHahInitialForm, /// \u{fd5e}: 'ﵞ' ArabicLigatureSeenWithJeemWithAlefMaksuraFinalForm, /// \u{fd5f}: 'ﵟ' ArabicLigatureSeenWithMeemWithHahFinalForm, /// \u{fd60}: 'ﵠ' ArabicLigatureSeenWithMeemWithHahInitialForm, /// \u{fd61}: 'ﵡ' ArabicLigatureSeenWithMeemWithJeemInitialForm, /// \u{fd62}: 'ﵢ' ArabicLigatureSeenWithMeemWithMeemFinalForm, /// \u{fd63}: 'ﵣ' ArabicLigatureSeenWithMeemWithMeemInitialForm, /// \u{fd64}: 'ﵤ' ArabicLigatureSadWithHahWithHahFinalForm, /// \u{fd65}: 'ﵥ' ArabicLigatureSadWithHahWithHahInitialForm, /// \u{fd66}: 'ﵦ' ArabicLigatureSadWithMeemWithMeemFinalForm, /// \u{fd67}: 'ﵧ' ArabicLigatureSheenWithHahWithMeemFinalForm, /// \u{fd68}: 'ﵨ' ArabicLigatureSheenWithHahWithMeemInitialForm, /// \u{fd69}: 'ﵩ' ArabicLigatureSheenWithJeemWithYehFinalForm, /// \u{fd6a}: 'ﵪ' ArabicLigatureSheenWithMeemWithKhahFinalForm, /// \u{fd6b}: 'ﵫ' ArabicLigatureSheenWithMeemWithKhahInitialForm, /// \u{fd6c}: 'ﵬ' ArabicLigatureSheenWithMeemWithMeemFinalForm, /// \u{fd6d}: 'ﵭ' ArabicLigatureSheenWithMeemWithMeemInitialForm, /// \u{fd6e}: 'ﵮ' ArabicLigatureDadWithHahWithAlefMaksuraFinalForm, /// \u{fd6f}: 'ﵯ' ArabicLigatureDadWithKhahWithMeemFinalForm, /// \u{fd70}: 'ﵰ' ArabicLigatureDadWithKhahWithMeemInitialForm, /// \u{fd71}: 'ﵱ' ArabicLigatureTahWithMeemWithHahFinalForm, /// \u{fd72}: 'ﵲ' ArabicLigatureTahWithMeemWithHahInitialForm, /// \u{fd73}: 'ﵳ' ArabicLigatureTahWithMeemWithMeemInitialForm, /// \u{fd74}: 'ﵴ' ArabicLigatureTahWithMeemWithYehFinalForm, /// \u{fd75}: 'ﵵ' ArabicLigatureAinWithJeemWithMeemFinalForm, /// \u{fd76}: 'ﵶ' ArabicLigatureAinWithMeemWithMeemFinalForm, /// \u{fd77}: 'ﵷ' ArabicLigatureAinWithMeemWithMeemInitialForm, /// \u{fd78}: 'ﵸ' ArabicLigatureAinWithMeemWithAlefMaksuraFinalForm, /// \u{fd79}: 'ﵹ' ArabicLigatureGhainWithMeemWithMeemFinalForm, /// \u{fd7a}: 'ﵺ' ArabicLigatureGhainWithMeemWithYehFinalForm, /// \u{fd7b}: 'ﵻ' ArabicLigatureGhainWithMeemWithAlefMaksuraFinalForm, /// \u{fd7c}: 'ﵼ' ArabicLigatureFehWithKhahWithMeemFinalForm, /// \u{fd7d}: 'ﵽ' ArabicLigatureFehWithKhahWithMeemInitialForm, /// \u{fd7e}: 'ﵾ' ArabicLigatureQafWithMeemWithHahFinalForm, /// \u{fd7f}: 'ﵿ' ArabicLigatureQafWithMeemWithMeemFinalForm, /// \u{fd80}: 'ﶀ' ArabicLigatureLamWithHahWithMeemFinalForm, /// \u{fd81}: 'ﶁ' ArabicLigatureLamWithHahWithYehFinalForm, /// \u{fd82}: 'ﶂ' ArabicLigatureLamWithHahWithAlefMaksuraFinalForm, /// \u{fd83}: 'ﶃ' ArabicLigatureLamWithJeemWithJeemInitialForm, /// \u{fd84}: 'ﶄ' ArabicLigatureLamWithJeemWithJeemFinalForm, /// \u{fd85}: 'ﶅ' ArabicLigatureLamWithKhahWithMeemFinalForm, /// \u{fd86}: 'ﶆ' ArabicLigatureLamWithKhahWithMeemInitialForm, /// \u{fd87}: 'ﶇ' ArabicLigatureLamWithMeemWithHahFinalForm, /// \u{fd88}: 'ﶈ' ArabicLigatureLamWithMeemWithHahInitialForm, /// \u{fd89}: 'ﶉ' ArabicLigatureMeemWithHahWithJeemInitialForm, /// \u{fd8a}: 'ﶊ' ArabicLigatureMeemWithHahWithMeemInitialForm, /// \u{fd8b}: 'ﶋ' ArabicLigatureMeemWithHahWithYehFinalForm, /// \u{fd8c}: 'ﶌ' ArabicLigatureMeemWithJeemWithHahInitialForm, /// \u{fd8d}: 'ﶍ' ArabicLigatureMeemWithJeemWithMeemInitialForm, /// \u{fd8e}: 'ﶎ' ArabicLigatureMeemWithKhahWithJeemInitialForm, /// \u{fd8f}: 'ﶏ' ArabicLigatureMeemWithKhahWithMeemInitialForm, /// \u{fd92}: 'ﶒ' ArabicLigatureMeemWithJeemWithKhahInitialForm, /// \u{fd93}: 'ﶓ' ArabicLigatureHehWithMeemWithJeemInitialForm, /// \u{fd94}: 'ﶔ' ArabicLigatureHehWithMeemWithMeemInitialForm, /// \u{fd95}: 'ﶕ' ArabicLigatureNoonWithHahWithMeemInitialForm, /// \u{fd96}: 'ﶖ' ArabicLigatureNoonWithHahWithAlefMaksuraFinalForm, /// \u{fd97}: 'ﶗ' ArabicLigatureNoonWithJeemWithMeemFinalForm, /// \u{fd98}: 'ﶘ' ArabicLigatureNoonWithJeemWithMeemInitialForm, /// \u{fd99}: 'ﶙ' ArabicLigatureNoonWithJeemWithAlefMaksuraFinalForm, /// \u{fd9a}: 'ﶚ' ArabicLigatureNoonWithMeemWithYehFinalForm, /// \u{fd9b}: 'ﶛ' ArabicLigatureNoonWithMeemWithAlefMaksuraFinalForm, /// \u{fd9c}: 'ﶜ' ArabicLigatureYehWithMeemWithMeemFinalForm, /// \u{fd9d}: 'ﶝ' ArabicLigatureYehWithMeemWithMeemInitialForm, /// \u{fd9e}: 'ﶞ' ArabicLigatureBehWithKhahWithYehFinalForm, /// \u{fd9f}: 'ﶟ' ArabicLigatureTehWithJeemWithYehFinalForm, /// \u{fda0}: 'ﶠ' ArabicLigatureTehWithJeemWithAlefMaksuraFinalForm, /// \u{fda1}: 'ﶡ' ArabicLigatureTehWithKhahWithYehFinalForm, /// \u{fda2}: 'ﶢ' ArabicLigatureTehWithKhahWithAlefMaksuraFinalForm, /// \u{fda3}: 'ﶣ' ArabicLigatureTehWithMeemWithYehFinalForm, /// \u{fda4}: 'ﶤ' ArabicLigatureTehWithMeemWithAlefMaksuraFinalForm, /// \u{fda5}: 'ﶥ' ArabicLigatureJeemWithMeemWithYehFinalForm, /// \u{fda6}: 'ﶦ' ArabicLigatureJeemWithHahWithAlefMaksuraFinalForm, /// \u{fda7}: 'ﶧ' ArabicLigatureJeemWithMeemWithAlefMaksuraFinalForm, /// \u{fda8}: 'ﶨ' ArabicLigatureSeenWithKhahWithAlefMaksuraFinalForm, /// \u{fda9}: 'ﶩ' ArabicLigatureSadWithHahWithYehFinalForm, /// \u{fdaa}: 'ﶪ' ArabicLigatureSheenWithHahWithYehFinalForm, /// \u{fdab}: 'ﶫ' ArabicLigatureDadWithHahWithYehFinalForm, /// \u{fdac}: 'ﶬ' ArabicLigatureLamWithJeemWithYehFinalForm, /// \u{fdad}: 'ﶭ' ArabicLigatureLamWithMeemWithYehFinalForm, /// \u{fdae}: 'ﶮ' ArabicLigatureYehWithHahWithYehFinalForm, /// \u{fdaf}: 'ﶯ' ArabicLigatureYehWithJeemWithYehFinalForm, /// \u{fdb0}: 'ﶰ' ArabicLigatureYehWithMeemWithYehFinalForm, /// \u{fdb1}: 'ﶱ' ArabicLigatureMeemWithMeemWithYehFinalForm, /// \u{fdb2}: 'ﶲ' ArabicLigatureQafWithMeemWithYehFinalForm, /// \u{fdb3}: 'ﶳ' ArabicLigatureNoonWithHahWithYehFinalForm, /// \u{fdb4}: 'ﶴ' ArabicLigatureQafWithMeemWithHahInitialForm, /// \u{fdb5}: 'ﶵ' ArabicLigatureLamWithHahWithMeemInitialForm, /// \u{fdb6}: 'ﶶ' ArabicLigatureAinWithMeemWithYehFinalForm, /// \u{fdb7}: 'ﶷ' ArabicLigatureKafWithMeemWithYehFinalForm, /// \u{fdb8}: 'ﶸ' ArabicLigatureNoonWithJeemWithHahInitialForm, /// \u{fdb9}: 'ﶹ' ArabicLigatureMeemWithKhahWithYehFinalForm, /// \u{fdba}: 'ﶺ' ArabicLigatureLamWithJeemWithMeemInitialForm, /// \u{fdbb}: 'ﶻ' ArabicLigatureKafWithMeemWithMeemFinalForm, /// \u{fdbc}: 'ﶼ' ArabicLigatureLamWithJeemWithMeemFinalForm, /// \u{fdbd}: 'ﶽ' ArabicLigatureNoonWithJeemWithHahFinalForm, /// \u{fdbe}: 'ﶾ' ArabicLigatureJeemWithHahWithYehFinalForm, /// \u{fdbf}: 'ﶿ' ArabicLigatureHahWithJeemWithYehFinalForm, /// \u{fdc0}: 'ﷀ' ArabicLigatureMeemWithJeemWithYehFinalForm, /// \u{fdc1}: 'ﷁ' ArabicLigatureFehWithMeemWithYehFinalForm, /// \u{fdc2}: 'ﷂ' ArabicLigatureBehWithHahWithYehFinalForm, /// \u{fdc3}: 'ﷃ' ArabicLigatureKafWithMeemWithMeemInitialForm, /// \u{fdc4}: 'ﷄ' ArabicLigatureAinWithJeemWithMeemInitialForm, /// \u{fdc5}: 'ﷅ' ArabicLigatureSadWithMeemWithMeemInitialForm, /// \u{fdc6}: 'ﷆ' ArabicLigatureSeenWithKhahWithYehFinalForm, /// \u{fdc7}: 'ﷇ' ArabicLigatureNoonWithJeemWithYehFinalForm, /// \u{fdf0}: 'ﷰ' ArabicLigatureSallaUsedAsKoranicStopSignIsolatedForm, /// \u{fdf1}: 'ﷱ' ArabicLigatureQalaUsedAsKoranicStopSignIsolatedForm, /// \u{fdf2}: 'ﷲ' ArabicLigatureAllahIsolatedForm, /// \u{fdf3}: 'ﷳ' ArabicLigatureAkbarIsolatedForm, /// \u{fdf4}: 'ﷴ' ArabicLigatureMohammadIsolatedForm, /// \u{fdf5}: 'ﷵ' ArabicLigatureSalamIsolatedForm, /// \u{fdf6}: 'ﷶ' ArabicLigatureRasoulIsolatedForm, /// \u{fdf7}: 'ﷷ' ArabicLigatureAlayheIsolatedForm, /// \u{fdf8}: 'ﷸ' ArabicLigatureWasallamIsolatedForm, /// \u{fdf9}: 'ﷹ' ArabicLigatureSallaIsolatedForm, /// \u{fdfa}: 'ﷺ' ArabicLigatureSallallahouAlayheWasallam, /// \u{fdfb}: 'ﷻ' ArabicLigatureJallajalalouhou, /// \u{fdfc}: '﷼' RialSign, /// \u{fdfd}: '﷽' ArabicLigatureBismillahArDashRahmanArDashRaheem, } impl Into<char> for ArabicPresentationFormsA { fn into(self) -> char { match self { ArabicPresentationFormsA::ArabicLetterAlefWaslaIsolatedForm => 'ﭐ', ArabicPresentationFormsA::ArabicLetterAlefWaslaFinalForm => 'ﭑ', ArabicPresentationFormsA::ArabicLetterBeehIsolatedForm => 'ﭒ', ArabicPresentationFormsA::ArabicLetterBeehFinalForm => 'ﭓ', ArabicPresentationFormsA::ArabicLetterBeehInitialForm => 'ﭔ', ArabicPresentationFormsA::ArabicLetterBeehMedialForm => 'ﭕ', ArabicPresentationFormsA::ArabicLetterPehIsolatedForm => 'ﭖ', ArabicPresentationFormsA::ArabicLetterPehFinalForm => 'ﭗ', ArabicPresentationFormsA::ArabicLetterPehInitialForm => 'ﭘ', ArabicPresentationFormsA::ArabicLetterPehMedialForm => 'ﭙ', ArabicPresentationFormsA::ArabicLetterBehehIsolatedForm => 'ﭚ', ArabicPresentationFormsA::ArabicLetterBehehFinalForm => 'ﭛ', ArabicPresentationFormsA::ArabicLetterBehehInitialForm => 'ﭜ', ArabicPresentationFormsA::ArabicLetterBehehMedialForm => 'ﭝ', ArabicPresentationFormsA::ArabicLetterTtehehIsolatedForm => 'ﭞ', ArabicPresentationFormsA::ArabicLetterTtehehFinalForm => 'ﭟ', ArabicPresentationFormsA::ArabicLetterTtehehInitialForm => 'ﭠ', ArabicPresentationFormsA::ArabicLetterTtehehMedialForm => 'ﭡ', ArabicPresentationFormsA::ArabicLetterTehehIsolatedForm => 'ﭢ', ArabicPresentationFormsA::ArabicLetterTehehFinalForm => 'ﭣ', ArabicPresentationFormsA::ArabicLetterTehehInitialForm => 'ﭤ', ArabicPresentationFormsA::ArabicLetterTehehMedialForm => 'ﭥ', ArabicPresentationFormsA::ArabicLetterTtehIsolatedForm => 'ﭦ', ArabicPresentationFormsA::ArabicLetterTtehFinalForm => 'ﭧ', ArabicPresentationFormsA::ArabicLetterTtehInitialForm => 'ﭨ', ArabicPresentationFormsA::ArabicLetterTtehMedialForm => 'ﭩ', ArabicPresentationFormsA::ArabicLetterVehIsolatedForm => 'ﭪ', ArabicPresentationFormsA::ArabicLetterVehFinalForm => 'ﭫ', ArabicPresentationFormsA::ArabicLetterVehInitialForm => 'ﭬ', ArabicPresentationFormsA::ArabicLetterVehMedialForm => 'ﭭ', ArabicPresentationFormsA::ArabicLetterPehehIsolatedForm => 'ﭮ', ArabicPresentationFormsA::ArabicLetterPehehFinalForm => 'ﭯ', ArabicPresentationFormsA::ArabicLetterPehehInitialForm => 'ﭰ', ArabicPresentationFormsA::ArabicLetterPehehMedialForm => 'ﭱ', ArabicPresentationFormsA::ArabicLetterDyehIsolatedForm => 'ﭲ', ArabicPresentationFormsA::ArabicLetterDyehFinalForm => 'ﭳ', ArabicPresentationFormsA::ArabicLetterDyehInitialForm => 'ﭴ', ArabicPresentationFormsA::ArabicLetterDyehMedialForm => 'ﭵ', ArabicPresentationFormsA::ArabicLetterNyehIsolatedForm => 'ﭶ', ArabicPresentationFormsA::ArabicLetterNyehFinalForm => 'ﭷ', ArabicPresentationFormsA::ArabicLetterNyehInitialForm => 'ﭸ', ArabicPresentationFormsA::ArabicLetterNyehMedialForm => 'ﭹ', ArabicPresentationFormsA::ArabicLetterTchehIsolatedForm => 'ﭺ', ArabicPresentationFormsA::ArabicLetterTchehFinalForm => 'ﭻ', ArabicPresentationFormsA::ArabicLetterTchehInitialForm => 'ﭼ', ArabicPresentationFormsA::ArabicLetterTchehMedialForm => 'ﭽ', ArabicPresentationFormsA::ArabicLetterTchehehIsolatedForm => 'ﭾ', ArabicPresentationFormsA::ArabicLetterTchehehFinalForm => 'ﭿ', ArabicPresentationFormsA::ArabicLetterTchehehInitialForm => 'ﮀ', ArabicPresentationFormsA::ArabicLetterTchehehMedialForm => 'ﮁ', ArabicPresentationFormsA::ArabicLetterDdahalIsolatedForm => 'ﮂ', ArabicPresentationFormsA::ArabicLetterDdahalFinalForm => 'ﮃ', ArabicPresentationFormsA::ArabicLetterDahalIsolatedForm => 'ﮄ', ArabicPresentationFormsA::ArabicLetterDahalFinalForm => 'ﮅ', ArabicPresentationFormsA::ArabicLetterDulIsolatedForm => 'ﮆ', ArabicPresentationFormsA::ArabicLetterDulFinalForm => 'ﮇ', ArabicPresentationFormsA::ArabicLetterDdalIsolatedForm => 'ﮈ', ArabicPresentationFormsA::ArabicLetterDdalFinalForm => 'ﮉ', ArabicPresentationFormsA::ArabicLetterJehIsolatedForm => 'ﮊ', ArabicPresentationFormsA::ArabicLetterJehFinalForm => 'ﮋ', ArabicPresentationFormsA::ArabicLetterRrehIsolatedForm => 'ﮌ', ArabicPresentationFormsA::ArabicLetterRrehFinalForm => 'ﮍ', ArabicPresentationFormsA::ArabicLetterKehehIsolatedForm => 'ﮎ', ArabicPresentationFormsA::ArabicLetterKehehFinalForm => 'ﮏ', ArabicPresentationFormsA::ArabicLetterKehehInitialForm => 'ﮐ', ArabicPresentationFormsA::ArabicLetterKehehMedialForm => 'ﮑ', ArabicPresentationFormsA::ArabicLetterGafIsolatedForm => 'ﮒ', ArabicPresentationFormsA::ArabicLetterGafFinalForm => 'ﮓ', ArabicPresentationFormsA::ArabicLetterGafInitialForm => 'ﮔ', ArabicPresentationFormsA::ArabicLetterGafMedialForm => 'ﮕ', ArabicPresentationFormsA::ArabicLetterGuehIsolatedForm => 'ﮖ', ArabicPresentationFormsA::ArabicLetterGuehFinalForm => 'ﮗ', ArabicPresentationFormsA::ArabicLetterGuehInitialForm => 'ﮘ', ArabicPresentationFormsA::ArabicLetterGuehMedialForm => 'ﮙ', ArabicPresentationFormsA::ArabicLetterNgoehIsolatedForm => 'ﮚ', ArabicPresentationFormsA::ArabicLetterNgoehFinalForm => 'ﮛ', ArabicPresentationFormsA::ArabicLetterNgoehInitialForm => 'ﮜ', ArabicPresentationFormsA::ArabicLetterNgoehMedialForm => 'ﮝ', ArabicPresentationFormsA::ArabicLetterNoonGhunnaIsolatedForm => 'ﮞ', ArabicPresentationFormsA::ArabicLetterNoonGhunnaFinalForm => 'ﮟ', ArabicPresentationFormsA::ArabicLetterRnoonIsolatedForm => 'ﮠ', ArabicPresentationFormsA::ArabicLetterRnoonFinalForm => 'ﮡ', ArabicPresentationFormsA::ArabicLetterRnoonInitialForm => 'ﮢ', ArabicPresentationFormsA::ArabicLetterRnoonMedialForm => 'ﮣ', ArabicPresentationFormsA::ArabicLetterHehWithYehAboveIsolatedForm => 'ﮤ', ArabicPresentationFormsA::ArabicLetterHehWithYehAboveFinalForm => 'ﮥ', ArabicPresentationFormsA::ArabicLetterHehGoalIsolatedForm => 'ﮦ', ArabicPresentationFormsA::ArabicLetterHehGoalFinalForm => 'ﮧ', ArabicPresentationFormsA::ArabicLetterHehGoalInitialForm => 'ﮨ', ArabicPresentationFormsA::ArabicLetterHehGoalMedialForm => 'ﮩ', ArabicPresentationFormsA::ArabicLetterHehDoachashmeeIsolatedForm => 'ﮪ', ArabicPresentationFormsA::ArabicLetterHehDoachashmeeFinalForm => 'ﮫ', ArabicPresentationFormsA::ArabicLetterHehDoachashmeeInitialForm => 'ﮬ', ArabicPresentationFormsA::ArabicLetterHehDoachashmeeMedialForm => 'ﮭ', ArabicPresentationFormsA::ArabicLetterYehBarreeIsolatedForm => 'ﮮ', ArabicPresentationFormsA::ArabicLetterYehBarreeFinalForm => 'ﮯ', ArabicPresentationFormsA::ArabicLetterYehBarreeWithHamzaAboveIsolatedForm => 'ﮰ', ArabicPresentationFormsA::ArabicLetterYehBarreeWithHamzaAboveFinalForm => 'ﮱ', ArabicPresentationFormsA::ArabicSymbolDotAbove => '﮲', ArabicPresentationFormsA::ArabicSymbolDotBelow => '﮳', ArabicPresentationFormsA::ArabicSymbolTwoDotsAbove => '﮴', ArabicPresentationFormsA::ArabicSymbolTwoDotsBelow => '﮵', ArabicPresentationFormsA::ArabicSymbolThreeDotsAbove => '﮶', ArabicPresentationFormsA::ArabicSymbolThreeDotsBelow => '﮷', ArabicPresentationFormsA::ArabicSymbolThreeDotsPointingDownwardsAbove => '﮸', ArabicPresentationFormsA::ArabicSymbolThreeDotsPointingDownwardsBelow => '﮹', ArabicPresentationFormsA::ArabicSymbolFourDotsAbove => '﮺', ArabicPresentationFormsA::ArabicSymbolFourDotsBelow => '﮻', ArabicPresentationFormsA::ArabicSymbolDoubleVerticalBarBelow => '﮼', ArabicPresentationFormsA::ArabicSymbolTwoDotsVerticallyAbove => '﮽', ArabicPresentationFormsA::ArabicSymbolTwoDotsVerticallyBelow => '﮾', ArabicPresentationFormsA::ArabicSymbolRing => '﮿', ArabicPresentationFormsA::ArabicSymbolSmallTahAbove => '﯀', ArabicPresentationFormsA::ArabicSymbolSmallTahBelow => '﯁', ArabicPresentationFormsA::ArabicLetterNgIsolatedForm => 'ﯓ', ArabicPresentationFormsA::ArabicLetterNgFinalForm => 'ﯔ', ArabicPresentationFormsA::ArabicLetterNgInitialForm => 'ﯕ', ArabicPresentationFormsA::ArabicLetterNgMedialForm => 'ﯖ', ArabicPresentationFormsA::ArabicLetterUIsolatedForm => 'ﯗ', ArabicPresentationFormsA::ArabicLetterUFinalForm => 'ﯘ', ArabicPresentationFormsA::ArabicLetterOeIsolatedForm => 'ﯙ', ArabicPresentationFormsA::ArabicLetterOeFinalForm => 'ﯚ', ArabicPresentationFormsA::ArabicLetterYuIsolatedForm => 'ﯛ', ArabicPresentationFormsA::ArabicLetterYuFinalForm => 'ﯜ', ArabicPresentationFormsA::ArabicLetterUWithHamzaAboveIsolatedForm => 'ﯝ', ArabicPresentationFormsA::ArabicLetterVeIsolatedForm => 'ﯞ', ArabicPresentationFormsA::ArabicLetterVeFinalForm => 'ﯟ', ArabicPresentationFormsA::ArabicLetterKirghizOeIsolatedForm => 'ﯠ', ArabicPresentationFormsA::ArabicLetterKirghizOeFinalForm => 'ﯡ', ArabicPresentationFormsA::ArabicLetterKirghizYuIsolatedForm => 'ﯢ', ArabicPresentationFormsA::ArabicLetterKirghizYuFinalForm => 'ﯣ', ArabicPresentationFormsA::ArabicLetterEIsolatedForm => 'ﯤ', ArabicPresentationFormsA::ArabicLetterEFinalForm => 'ﯥ', ArabicPresentationFormsA::ArabicLetterEInitialForm => 'ﯦ', ArabicPresentationFormsA::ArabicLetterEMedialForm => 'ﯧ', ArabicPresentationFormsA::ArabicLetterUighurKazakhKirghizAlefMaksuraInitialForm => 'ﯨ', ArabicPresentationFormsA::ArabicLetterUighurKazakhKirghizAlefMaksuraMedialForm => 'ﯩ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefIsolatedForm => 'ﯪ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefFinalForm => 'ﯫ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAeIsolatedForm => 'ﯬ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAeFinalForm => 'ﯭ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithWawIsolatedForm => 'ﯮ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithWawFinalForm => 'ﯯ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithUIsolatedForm => 'ﯰ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithUFinalForm => 'ﯱ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithOeIsolatedForm => 'ﯲ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithOeFinalForm => 'ﯳ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYuIsolatedForm => 'ﯴ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYuFinalForm => 'ﯵ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithEIsolatedForm => 'ﯶ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithEFinalForm => 'ﯷ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithEInitialForm => 'ﯸ', ArabicPresentationFormsA::ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraIsolatedForm => 'ﯹ', ArabicPresentationFormsA::ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraFinalForm => 'ﯺ', ArabicPresentationFormsA::ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraInitialForm => 'ﯻ', ArabicPresentationFormsA::ArabicLetterFarsiYehIsolatedForm => 'ﯼ', ArabicPresentationFormsA::ArabicLetterFarsiYehFinalForm => 'ﯽ', ArabicPresentationFormsA::ArabicLetterFarsiYehInitialForm => 'ﯾ', ArabicPresentationFormsA::ArabicLetterFarsiYehMedialForm => 'ﯿ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithJeemIsolatedForm => 'ﰀ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHahIsolatedForm => 'ﰁ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemIsolatedForm => 'ﰂ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefMaksuraIsolatedForm => 'ﰃ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYehIsolatedForm => 'ﰄ', ArabicPresentationFormsA::ArabicLigatureBehWithJeemIsolatedForm => 'ﰅ', ArabicPresentationFormsA::ArabicLigatureBehWithHahIsolatedForm => 'ﰆ', ArabicPresentationFormsA::ArabicLigatureBehWithKhahIsolatedForm => 'ﰇ', ArabicPresentationFormsA::ArabicLigatureBehWithMeemIsolatedForm => 'ﰈ', ArabicPresentationFormsA::ArabicLigatureBehWithAlefMaksuraIsolatedForm => 'ﰉ', ArabicPresentationFormsA::ArabicLigatureBehWithYehIsolatedForm => 'ﰊ', ArabicPresentationFormsA::ArabicLigatureTehWithJeemIsolatedForm => 'ﰋ', ArabicPresentationFormsA::ArabicLigatureTehWithHahIsolatedForm => 'ﰌ', ArabicPresentationFormsA::ArabicLigatureTehWithKhahIsolatedForm => 'ﰍ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemIsolatedForm => 'ﰎ', ArabicPresentationFormsA::ArabicLigatureTehWithAlefMaksuraIsolatedForm => 'ﰏ', ArabicPresentationFormsA::ArabicLigatureTehWithYehIsolatedForm => 'ﰐ', ArabicPresentationFormsA::ArabicLigatureThehWithJeemIsolatedForm => 'ﰑ', ArabicPresentationFormsA::ArabicLigatureThehWithMeemIsolatedForm => 'ﰒ', ArabicPresentationFormsA::ArabicLigatureThehWithAlefMaksuraIsolatedForm => 'ﰓ', ArabicPresentationFormsA::ArabicLigatureThehWithYehIsolatedForm => 'ﰔ', ArabicPresentationFormsA::ArabicLigatureJeemWithHahIsolatedForm => 'ﰕ', ArabicPresentationFormsA::ArabicLigatureJeemWithMeemIsolatedForm => 'ﰖ', ArabicPresentationFormsA::ArabicLigatureHahWithJeemIsolatedForm => 'ﰗ', ArabicPresentationFormsA::ArabicLigatureHahWithMeemIsolatedForm => 'ﰘ', ArabicPresentationFormsA::ArabicLigatureKhahWithJeemIsolatedForm => 'ﰙ', ArabicPresentationFormsA::ArabicLigatureKhahWithHahIsolatedForm => 'ﰚ', ArabicPresentationFormsA::ArabicLigatureKhahWithMeemIsolatedForm => 'ﰛ', ArabicPresentationFormsA::ArabicLigatureSeenWithJeemIsolatedForm => 'ﰜ', ArabicPresentationFormsA::ArabicLigatureSeenWithHahIsolatedForm => 'ﰝ', ArabicPresentationFormsA::ArabicLigatureSeenWithKhahIsolatedForm => 'ﰞ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemIsolatedForm => 'ﰟ', ArabicPresentationFormsA::ArabicLigatureSadWithHahIsolatedForm => 'ﰠ', ArabicPresentationFormsA::ArabicLigatureSadWithMeemIsolatedForm => 'ﰡ', ArabicPresentationFormsA::ArabicLigatureDadWithJeemIsolatedForm => 'ﰢ', ArabicPresentationFormsA::ArabicLigatureDadWithHahIsolatedForm => 'ﰣ', ArabicPresentationFormsA::ArabicLigatureDadWithKhahIsolatedForm => 'ﰤ', ArabicPresentationFormsA::ArabicLigatureDadWithMeemIsolatedForm => 'ﰥ', ArabicPresentationFormsA::ArabicLigatureTahWithHahIsolatedForm => 'ﰦ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemIsolatedForm => 'ﰧ', ArabicPresentationFormsA::ArabicLigatureZahWithMeemIsolatedForm => 'ﰨ', ArabicPresentationFormsA::ArabicLigatureAinWithJeemIsolatedForm => 'ﰩ', ArabicPresentationFormsA::ArabicLigatureAinWithMeemIsolatedForm => 'ﰪ', ArabicPresentationFormsA::ArabicLigatureGhainWithJeemIsolatedForm => 'ﰫ', ArabicPresentationFormsA::ArabicLigatureGhainWithMeemIsolatedForm => 'ﰬ', ArabicPresentationFormsA::ArabicLigatureFehWithJeemIsolatedForm => 'ﰭ', ArabicPresentationFormsA::ArabicLigatureFehWithHahIsolatedForm => 'ﰮ', ArabicPresentationFormsA::ArabicLigatureFehWithKhahIsolatedForm => 'ﰯ', ArabicPresentationFormsA::ArabicLigatureFehWithMeemIsolatedForm => 'ﰰ', ArabicPresentationFormsA::ArabicLigatureFehWithAlefMaksuraIsolatedForm => 'ﰱ', ArabicPresentationFormsA::ArabicLigatureFehWithYehIsolatedForm => 'ﰲ', ArabicPresentationFormsA::ArabicLigatureQafWithHahIsolatedForm => 'ﰳ', ArabicPresentationFormsA::ArabicLigatureQafWithMeemIsolatedForm => 'ﰴ', ArabicPresentationFormsA::ArabicLigatureQafWithAlefMaksuraIsolatedForm => 'ﰵ', ArabicPresentationFormsA::ArabicLigatureQafWithYehIsolatedForm => 'ﰶ', ArabicPresentationFormsA::ArabicLigatureKafWithAlefIsolatedForm => 'ﰷ', ArabicPresentationFormsA::ArabicLigatureKafWithJeemIsolatedForm => 'ﰸ', ArabicPresentationFormsA::ArabicLigatureKafWithHahIsolatedForm => 'ﰹ', ArabicPresentationFormsA::ArabicLigatureKafWithKhahIsolatedForm => 'ﰺ', ArabicPresentationFormsA::ArabicLigatureKafWithLamIsolatedForm => 'ﰻ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemIsolatedForm => 'ﰼ', ArabicPresentationFormsA::ArabicLigatureKafWithAlefMaksuraIsolatedForm => 'ﰽ', ArabicPresentationFormsA::ArabicLigatureKafWithYehIsolatedForm => 'ﰾ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemIsolatedForm => 'ﰿ', ArabicPresentationFormsA::ArabicLigatureLamWithHahIsolatedForm => 'ﱀ', ArabicPresentationFormsA::ArabicLigatureLamWithKhahIsolatedForm => 'ﱁ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemIsolatedForm => 'ﱂ', ArabicPresentationFormsA::ArabicLigatureLamWithAlefMaksuraIsolatedForm => 'ﱃ', ArabicPresentationFormsA::ArabicLigatureLamWithYehIsolatedForm => 'ﱄ', ArabicPresentationFormsA::ArabicLigatureMeemWithJeemIsolatedForm => 'ﱅ', ArabicPresentationFormsA::ArabicLigatureMeemWithHahIsolatedForm => 'ﱆ', ArabicPresentationFormsA::ArabicLigatureMeemWithKhahIsolatedForm => 'ﱇ', ArabicPresentationFormsA::ArabicLigatureMeemWithMeemIsolatedForm => 'ﱈ', ArabicPresentationFormsA::ArabicLigatureMeemWithAlefMaksuraIsolatedForm => 'ﱉ', ArabicPresentationFormsA::ArabicLigatureMeemWithYehIsolatedForm => 'ﱊ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemIsolatedForm => 'ﱋ', ArabicPresentationFormsA::ArabicLigatureNoonWithHahIsolatedForm => 'ﱌ', ArabicPresentationFormsA::ArabicLigatureNoonWithKhahIsolatedForm => 'ﱍ', ArabicPresentationFormsA::ArabicLigatureNoonWithMeemIsolatedForm => 'ﱎ', ArabicPresentationFormsA::ArabicLigatureNoonWithAlefMaksuraIsolatedForm => 'ﱏ', ArabicPresentationFormsA::ArabicLigatureNoonWithYehIsolatedForm => 'ﱐ', ArabicPresentationFormsA::ArabicLigatureHehWithJeemIsolatedForm => 'ﱑ', ArabicPresentationFormsA::ArabicLigatureHehWithMeemIsolatedForm => 'ﱒ', ArabicPresentationFormsA::ArabicLigatureHehWithAlefMaksuraIsolatedForm => 'ﱓ', ArabicPresentationFormsA::ArabicLigatureHehWithYehIsolatedForm => 'ﱔ', ArabicPresentationFormsA::ArabicLigatureYehWithJeemIsolatedForm => 'ﱕ', ArabicPresentationFormsA::ArabicLigatureYehWithHahIsolatedForm => 'ﱖ', ArabicPresentationFormsA::ArabicLigatureYehWithKhahIsolatedForm => 'ﱗ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemIsolatedForm => 'ﱘ', ArabicPresentationFormsA::ArabicLigatureYehWithAlefMaksuraIsolatedForm => 'ﱙ', ArabicPresentationFormsA::ArabicLigatureYehWithYehIsolatedForm => 'ﱚ', ArabicPresentationFormsA::ArabicLigatureThalWithSuperscriptAlefIsolatedForm => 'ﱛ', ArabicPresentationFormsA::ArabicLigatureRehWithSuperscriptAlefIsolatedForm => 'ﱜ', ArabicPresentationFormsA::ArabicLigatureAlefMaksuraWithSuperscriptAlefIsolatedForm => 'ﱝ', ArabicPresentationFormsA::ArabicLigatureShaddaWithDammatanIsolatedForm => 'ﱞ', ArabicPresentationFormsA::ArabicLigatureShaddaWithKasratanIsolatedForm => 'ﱟ', ArabicPresentationFormsA::ArabicLigatureShaddaWithFathaIsolatedForm => 'ﱠ', ArabicPresentationFormsA::ArabicLigatureShaddaWithDammaIsolatedForm => 'ﱡ', ArabicPresentationFormsA::ArabicLigatureShaddaWithKasraIsolatedForm => 'ﱢ', ArabicPresentationFormsA::ArabicLigatureShaddaWithSuperscriptAlefIsolatedForm => 'ﱣ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithRehFinalForm => 'ﱤ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithZainFinalForm => 'ﱥ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemFinalForm => 'ﱦ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithNoonFinalForm => 'ﱧ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefMaksuraFinalForm => 'ﱨ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYehFinalForm => 'ﱩ', ArabicPresentationFormsA::ArabicLigatureBehWithRehFinalForm => 'ﱪ', ArabicPresentationFormsA::ArabicLigatureBehWithZainFinalForm => 'ﱫ', ArabicPresentationFormsA::ArabicLigatureBehWithMeemFinalForm => 'ﱬ', ArabicPresentationFormsA::ArabicLigatureBehWithNoonFinalForm => 'ﱭ', ArabicPresentationFormsA::ArabicLigatureBehWithAlefMaksuraFinalForm => 'ﱮ', ArabicPresentationFormsA::ArabicLigatureBehWithYehFinalForm => 'ﱯ', ArabicPresentationFormsA::ArabicLigatureTehWithRehFinalForm => 'ﱰ', ArabicPresentationFormsA::ArabicLigatureTehWithZainFinalForm => 'ﱱ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemFinalForm => 'ﱲ', ArabicPresentationFormsA::ArabicLigatureTehWithNoonFinalForm => 'ﱳ', ArabicPresentationFormsA::ArabicLigatureTehWithAlefMaksuraFinalForm => 'ﱴ', ArabicPresentationFormsA::ArabicLigatureTehWithYehFinalForm => 'ﱵ', ArabicPresentationFormsA::ArabicLigatureThehWithRehFinalForm => 'ﱶ', ArabicPresentationFormsA::ArabicLigatureThehWithZainFinalForm => 'ﱷ', ArabicPresentationFormsA::ArabicLigatureThehWithMeemFinalForm => 'ﱸ', ArabicPresentationFormsA::ArabicLigatureThehWithNoonFinalForm => 'ﱹ', ArabicPresentationFormsA::ArabicLigatureThehWithAlefMaksuraFinalForm => 'ﱺ', ArabicPresentationFormsA::ArabicLigatureThehWithYehFinalForm => 'ﱻ', ArabicPresentationFormsA::ArabicLigatureFehWithAlefMaksuraFinalForm => 'ﱼ', ArabicPresentationFormsA::ArabicLigatureFehWithYehFinalForm => 'ﱽ', ArabicPresentationFormsA::ArabicLigatureQafWithAlefMaksuraFinalForm => 'ﱾ', ArabicPresentationFormsA::ArabicLigatureQafWithYehFinalForm => 'ﱿ', ArabicPresentationFormsA::ArabicLigatureKafWithAlefFinalForm => 'ﲀ', ArabicPresentationFormsA::ArabicLigatureKafWithLamFinalForm => 'ﲁ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemFinalForm => 'ﲂ', ArabicPresentationFormsA::ArabicLigatureKafWithAlefMaksuraFinalForm => 'ﲃ', ArabicPresentationFormsA::ArabicLigatureKafWithYehFinalForm => 'ﲄ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemFinalForm => 'ﲅ', ArabicPresentationFormsA::ArabicLigatureLamWithAlefMaksuraFinalForm => 'ﲆ', ArabicPresentationFormsA::ArabicLigatureLamWithYehFinalForm => 'ﲇ', ArabicPresentationFormsA::ArabicLigatureMeemWithAlefFinalForm => 'ﲈ', ArabicPresentationFormsA::ArabicLigatureMeemWithMeemFinalForm => 'ﲉ', ArabicPresentationFormsA::ArabicLigatureNoonWithRehFinalForm => 'ﲊ', ArabicPresentationFormsA::ArabicLigatureNoonWithZainFinalForm => 'ﲋ', ArabicPresentationFormsA::ArabicLigatureNoonWithMeemFinalForm => 'ﲌ', ArabicPresentationFormsA::ArabicLigatureNoonWithNoonFinalForm => 'ﲍ', ArabicPresentationFormsA::ArabicLigatureNoonWithAlefMaksuraFinalForm => 'ﲎ', ArabicPresentationFormsA::ArabicLigatureNoonWithYehFinalForm => 'ﲏ', ArabicPresentationFormsA::ArabicLigatureAlefMaksuraWithSuperscriptAlefFinalForm => 'ﲐ', ArabicPresentationFormsA::ArabicLigatureYehWithRehFinalForm => 'ﲑ', ArabicPresentationFormsA::ArabicLigatureYehWithZainFinalForm => 'ﲒ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemFinalForm => 'ﲓ', ArabicPresentationFormsA::ArabicLigatureYehWithNoonFinalForm => 'ﲔ', ArabicPresentationFormsA::ArabicLigatureYehWithAlefMaksuraFinalForm => 'ﲕ', ArabicPresentationFormsA::ArabicLigatureYehWithYehFinalForm => 'ﲖ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithJeemInitialForm => 'ﲗ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHahInitialForm => 'ﲘ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithKhahInitialForm => 'ﲙ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemInitialForm => 'ﲚ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHehInitialForm => 'ﲛ', ArabicPresentationFormsA::ArabicLigatureBehWithJeemInitialForm => 'ﲜ', ArabicPresentationFormsA::ArabicLigatureBehWithHahInitialForm => 'ﲝ', ArabicPresentationFormsA::ArabicLigatureBehWithKhahInitialForm => 'ﲞ', ArabicPresentationFormsA::ArabicLigatureBehWithMeemInitialForm => 'ﲟ', ArabicPresentationFormsA::ArabicLigatureBehWithHehInitialForm => 'ﲠ', ArabicPresentationFormsA::ArabicLigatureTehWithJeemInitialForm => 'ﲡ', ArabicPresentationFormsA::ArabicLigatureTehWithHahInitialForm => 'ﲢ', ArabicPresentationFormsA::ArabicLigatureTehWithKhahInitialForm => 'ﲣ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemInitialForm => 'ﲤ', ArabicPresentationFormsA::ArabicLigatureTehWithHehInitialForm => 'ﲥ', ArabicPresentationFormsA::ArabicLigatureThehWithMeemInitialForm => 'ﲦ', ArabicPresentationFormsA::ArabicLigatureJeemWithHahInitialForm => 'ﲧ', ArabicPresentationFormsA::ArabicLigatureJeemWithMeemInitialForm => 'ﲨ', ArabicPresentationFormsA::ArabicLigatureHahWithJeemInitialForm => 'ﲩ', ArabicPresentationFormsA::ArabicLigatureHahWithMeemInitialForm => 'ﲪ', ArabicPresentationFormsA::ArabicLigatureKhahWithJeemInitialForm => 'ﲫ', ArabicPresentationFormsA::ArabicLigatureKhahWithMeemInitialForm => 'ﲬ', ArabicPresentationFormsA::ArabicLigatureSeenWithJeemInitialForm => 'ﲭ', ArabicPresentationFormsA::ArabicLigatureSeenWithHahInitialForm => 'ﲮ', ArabicPresentationFormsA::ArabicLigatureSeenWithKhahInitialForm => 'ﲯ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemInitialForm => 'ﲰ', ArabicPresentationFormsA::ArabicLigatureSadWithHahInitialForm => 'ﲱ', ArabicPresentationFormsA::ArabicLigatureSadWithKhahInitialForm => 'ﲲ', ArabicPresentationFormsA::ArabicLigatureSadWithMeemInitialForm => 'ﲳ', ArabicPresentationFormsA::ArabicLigatureDadWithJeemInitialForm => 'ﲴ', ArabicPresentationFormsA::ArabicLigatureDadWithHahInitialForm => 'ﲵ', ArabicPresentationFormsA::ArabicLigatureDadWithKhahInitialForm => 'ﲶ', ArabicPresentationFormsA::ArabicLigatureDadWithMeemInitialForm => 'ﲷ', ArabicPresentationFormsA::ArabicLigatureTahWithHahInitialForm => 'ﲸ', ArabicPresentationFormsA::ArabicLigatureZahWithMeemInitialForm => 'ﲹ', ArabicPresentationFormsA::ArabicLigatureAinWithJeemInitialForm => 'ﲺ', ArabicPresentationFormsA::ArabicLigatureAinWithMeemInitialForm => 'ﲻ', ArabicPresentationFormsA::ArabicLigatureGhainWithJeemInitialForm => 'ﲼ', ArabicPresentationFormsA::ArabicLigatureGhainWithMeemInitialForm => 'ﲽ', ArabicPresentationFormsA::ArabicLigatureFehWithJeemInitialForm => 'ﲾ', ArabicPresentationFormsA::ArabicLigatureFehWithHahInitialForm => 'ﲿ', ArabicPresentationFormsA::ArabicLigatureFehWithKhahInitialForm => 'ﳀ', ArabicPresentationFormsA::ArabicLigatureFehWithMeemInitialForm => 'ﳁ', ArabicPresentationFormsA::ArabicLigatureQafWithHahInitialForm => 'ﳂ', ArabicPresentationFormsA::ArabicLigatureQafWithMeemInitialForm => 'ﳃ', ArabicPresentationFormsA::ArabicLigatureKafWithJeemInitialForm => 'ﳄ', ArabicPresentationFormsA::ArabicLigatureKafWithHahInitialForm => 'ﳅ', ArabicPresentationFormsA::ArabicLigatureKafWithKhahInitialForm => 'ﳆ', ArabicPresentationFormsA::ArabicLigatureKafWithLamInitialForm => 'ﳇ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemInitialForm => 'ﳈ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemInitialForm => 'ﳉ', ArabicPresentationFormsA::ArabicLigatureLamWithHahInitialForm => 'ﳊ', ArabicPresentationFormsA::ArabicLigatureLamWithKhahInitialForm => 'ﳋ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemInitialForm => 'ﳌ', ArabicPresentationFormsA::ArabicLigatureLamWithHehInitialForm => 'ﳍ', ArabicPresentationFormsA::ArabicLigatureMeemWithJeemInitialForm => 'ﳎ', ArabicPresentationFormsA::ArabicLigatureMeemWithHahInitialForm => 'ﳏ', ArabicPresentationFormsA::ArabicLigatureMeemWithKhahInitialForm => 'ﳐ', ArabicPresentationFormsA::ArabicLigatureMeemWithMeemInitialForm => 'ﳑ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemInitialForm => 'ﳒ', ArabicPresentationFormsA::ArabicLigatureNoonWithHahInitialForm => 'ﳓ', ArabicPresentationFormsA::ArabicLigatureNoonWithKhahInitialForm => 'ﳔ', ArabicPresentationFormsA::ArabicLigatureNoonWithMeemInitialForm => 'ﳕ', ArabicPresentationFormsA::ArabicLigatureNoonWithHehInitialForm => 'ﳖ', ArabicPresentationFormsA::ArabicLigatureHehWithJeemInitialForm => 'ﳗ', ArabicPresentationFormsA::ArabicLigatureHehWithMeemInitialForm => 'ﳘ', ArabicPresentationFormsA::ArabicLigatureHehWithSuperscriptAlefInitialForm => 'ﳙ', ArabicPresentationFormsA::ArabicLigatureYehWithJeemInitialForm => 'ﳚ', ArabicPresentationFormsA::ArabicLigatureYehWithHahInitialForm => 'ﳛ', ArabicPresentationFormsA::ArabicLigatureYehWithKhahInitialForm => 'ﳜ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemInitialForm => 'ﳝ', ArabicPresentationFormsA::ArabicLigatureYehWithHehInitialForm => 'ﳞ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemMedialForm => 'ﳟ', ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHehMedialForm => 'ﳠ', ArabicPresentationFormsA::ArabicLigatureBehWithMeemMedialForm => 'ﳡ', ArabicPresentationFormsA::ArabicLigatureBehWithHehMedialForm => 'ﳢ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemMedialForm => 'ﳣ', ArabicPresentationFormsA::ArabicLigatureTehWithHehMedialForm => 'ﳤ', ArabicPresentationFormsA::ArabicLigatureThehWithMeemMedialForm => 'ﳥ', ArabicPresentationFormsA::ArabicLigatureThehWithHehMedialForm => 'ﳦ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemMedialForm => 'ﳧ', ArabicPresentationFormsA::ArabicLigatureSeenWithHehMedialForm => 'ﳨ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemMedialForm => 'ﳩ', ArabicPresentationFormsA::ArabicLigatureSheenWithHehMedialForm => 'ﳪ', ArabicPresentationFormsA::ArabicLigatureKafWithLamMedialForm => 'ﳫ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemMedialForm => 'ﳬ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemMedialForm => 'ﳭ', ArabicPresentationFormsA::ArabicLigatureNoonWithMeemMedialForm => 'ﳮ', ArabicPresentationFormsA::ArabicLigatureNoonWithHehMedialForm => 'ﳯ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemMedialForm => 'ﳰ', ArabicPresentationFormsA::ArabicLigatureYehWithHehMedialForm => 'ﳱ', ArabicPresentationFormsA::ArabicLigatureShaddaWithFathaMedialForm => 'ﳲ', ArabicPresentationFormsA::ArabicLigatureShaddaWithDammaMedialForm => 'ﳳ', ArabicPresentationFormsA::ArabicLigatureShaddaWithKasraMedialForm => 'ﳴ', ArabicPresentationFormsA::ArabicLigatureTahWithAlefMaksuraIsolatedForm => 'ﳵ', ArabicPresentationFormsA::ArabicLigatureTahWithYehIsolatedForm => 'ﳶ', ArabicPresentationFormsA::ArabicLigatureAinWithAlefMaksuraIsolatedForm => 'ﳷ', ArabicPresentationFormsA::ArabicLigatureAinWithYehIsolatedForm => 'ﳸ', ArabicPresentationFormsA::ArabicLigatureGhainWithAlefMaksuraIsolatedForm => 'ﳹ', ArabicPresentationFormsA::ArabicLigatureGhainWithYehIsolatedForm => 'ﳺ', ArabicPresentationFormsA::ArabicLigatureSeenWithAlefMaksuraIsolatedForm => 'ﳻ', ArabicPresentationFormsA::ArabicLigatureSeenWithYehIsolatedForm => 'ﳼ', ArabicPresentationFormsA::ArabicLigatureSheenWithAlefMaksuraIsolatedForm => 'ﳽ', ArabicPresentationFormsA::ArabicLigatureSheenWithYehIsolatedForm => 'ﳾ', ArabicPresentationFormsA::ArabicLigatureHahWithAlefMaksuraIsolatedForm => 'ﳿ', ArabicPresentationFormsA::ArabicLigatureHahWithYehIsolatedForm => 'ﴀ', ArabicPresentationFormsA::ArabicLigatureJeemWithAlefMaksuraIsolatedForm => 'ﴁ', ArabicPresentationFormsA::ArabicLigatureJeemWithYehIsolatedForm => 'ﴂ', ArabicPresentationFormsA::ArabicLigatureKhahWithAlefMaksuraIsolatedForm => 'ﴃ', ArabicPresentationFormsA::ArabicLigatureKhahWithYehIsolatedForm => 'ﴄ', ArabicPresentationFormsA::ArabicLigatureSadWithAlefMaksuraIsolatedForm => 'ﴅ', ArabicPresentationFormsA::ArabicLigatureSadWithYehIsolatedForm => 'ﴆ', ArabicPresentationFormsA::ArabicLigatureDadWithAlefMaksuraIsolatedForm => 'ﴇ', ArabicPresentationFormsA::ArabicLigatureDadWithYehIsolatedForm => 'ﴈ', ArabicPresentationFormsA::ArabicLigatureSheenWithJeemIsolatedForm => 'ﴉ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahIsolatedForm => 'ﴊ', ArabicPresentationFormsA::ArabicLigatureSheenWithKhahIsolatedForm => 'ﴋ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemIsolatedForm => 'ﴌ', ArabicPresentationFormsA::ArabicLigatureSheenWithRehIsolatedForm => 'ﴍ', ArabicPresentationFormsA::ArabicLigatureSeenWithRehIsolatedForm => 'ﴎ', ArabicPresentationFormsA::ArabicLigatureSadWithRehIsolatedForm => 'ﴏ', ArabicPresentationFormsA::ArabicLigatureDadWithRehIsolatedForm => 'ﴐ', ArabicPresentationFormsA::ArabicLigatureTahWithAlefMaksuraFinalForm => 'ﴑ', ArabicPresentationFormsA::ArabicLigatureTahWithYehFinalForm => 'ﴒ', ArabicPresentationFormsA::ArabicLigatureAinWithAlefMaksuraFinalForm => 'ﴓ', ArabicPresentationFormsA::ArabicLigatureAinWithYehFinalForm => 'ﴔ', ArabicPresentationFormsA::ArabicLigatureGhainWithAlefMaksuraFinalForm => 'ﴕ', ArabicPresentationFormsA::ArabicLigatureGhainWithYehFinalForm => 'ﴖ', ArabicPresentationFormsA::ArabicLigatureSeenWithAlefMaksuraFinalForm => 'ﴗ', ArabicPresentationFormsA::ArabicLigatureSeenWithYehFinalForm => 'ﴘ', ArabicPresentationFormsA::ArabicLigatureSheenWithAlefMaksuraFinalForm => 'ﴙ', ArabicPresentationFormsA::ArabicLigatureSheenWithYehFinalForm => 'ﴚ', ArabicPresentationFormsA::ArabicLigatureHahWithAlefMaksuraFinalForm => 'ﴛ', ArabicPresentationFormsA::ArabicLigatureHahWithYehFinalForm => 'ﴜ', ArabicPresentationFormsA::ArabicLigatureJeemWithAlefMaksuraFinalForm => 'ﴝ', ArabicPresentationFormsA::ArabicLigatureJeemWithYehFinalForm => 'ﴞ', ArabicPresentationFormsA::ArabicLigatureKhahWithAlefMaksuraFinalForm => 'ﴟ', ArabicPresentationFormsA::ArabicLigatureKhahWithYehFinalForm => 'ﴠ', ArabicPresentationFormsA::ArabicLigatureSadWithAlefMaksuraFinalForm => 'ﴡ', ArabicPresentationFormsA::ArabicLigatureSadWithYehFinalForm => 'ﴢ', ArabicPresentationFormsA::ArabicLigatureDadWithAlefMaksuraFinalForm => 'ﴣ', ArabicPresentationFormsA::ArabicLigatureDadWithYehFinalForm => 'ﴤ', ArabicPresentationFormsA::ArabicLigatureSheenWithJeemFinalForm => 'ﴥ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahFinalForm => 'ﴦ', ArabicPresentationFormsA::ArabicLigatureSheenWithKhahFinalForm => 'ﴧ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemFinalForm => 'ﴨ', ArabicPresentationFormsA::ArabicLigatureSheenWithRehFinalForm => 'ﴩ', ArabicPresentationFormsA::ArabicLigatureSeenWithRehFinalForm => 'ﴪ', ArabicPresentationFormsA::ArabicLigatureSadWithRehFinalForm => 'ﴫ', ArabicPresentationFormsA::ArabicLigatureDadWithRehFinalForm => 'ﴬ', ArabicPresentationFormsA::ArabicLigatureSheenWithJeemInitialForm => 'ﴭ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahInitialForm => 'ﴮ', ArabicPresentationFormsA::ArabicLigatureSheenWithKhahInitialForm => 'ﴯ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemInitialForm => 'ﴰ', ArabicPresentationFormsA::ArabicLigatureSeenWithHehInitialForm => 'ﴱ', ArabicPresentationFormsA::ArabicLigatureSheenWithHehInitialForm => 'ﴲ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemInitialForm => 'ﴳ', ArabicPresentationFormsA::ArabicLigatureSeenWithJeemMedialForm => 'ﴴ', ArabicPresentationFormsA::ArabicLigatureSeenWithHahMedialForm => 'ﴵ', ArabicPresentationFormsA::ArabicLigatureSeenWithKhahMedialForm => 'ﴶ', ArabicPresentationFormsA::ArabicLigatureSheenWithJeemMedialForm => 'ﴷ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahMedialForm => 'ﴸ', ArabicPresentationFormsA::ArabicLigatureSheenWithKhahMedialForm => 'ﴹ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemMedialForm => 'ﴺ', ArabicPresentationFormsA::ArabicLigatureZahWithMeemMedialForm => 'ﴻ', ArabicPresentationFormsA::ArabicLigatureAlefWithFathatanFinalForm => 'ﴼ', ArabicPresentationFormsA::ArabicLigatureAlefWithFathatanIsolatedForm => 'ﴽ', ArabicPresentationFormsA::OrnateLeftParenthesis => '﴾', ArabicPresentationFormsA::OrnateRightParenthesis => '﴿', ArabicPresentationFormsA::ArabicLigatureTehWithJeemWithMeemInitialForm => 'ﵐ', ArabicPresentationFormsA::ArabicLigatureTehWithHahWithJeemFinalForm => 'ﵑ', ArabicPresentationFormsA::ArabicLigatureTehWithHahWithJeemInitialForm => 'ﵒ', ArabicPresentationFormsA::ArabicLigatureTehWithHahWithMeemInitialForm => 'ﵓ', ArabicPresentationFormsA::ArabicLigatureTehWithKhahWithMeemInitialForm => 'ﵔ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithJeemInitialForm => 'ﵕ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithHahInitialForm => 'ﵖ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithKhahInitialForm => 'ﵗ', ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithHahFinalForm => 'ﵘ', ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithHahInitialForm => 'ﵙ', ArabicPresentationFormsA::ArabicLigatureHahWithMeemWithYehFinalForm => 'ﵚ', ArabicPresentationFormsA::ArabicLigatureHahWithMeemWithAlefMaksuraFinalForm => 'ﵛ', ArabicPresentationFormsA::ArabicLigatureSeenWithHahWithJeemInitialForm => 'ﵜ', ArabicPresentationFormsA::ArabicLigatureSeenWithJeemWithHahInitialForm => 'ﵝ', ArabicPresentationFormsA::ArabicLigatureSeenWithJeemWithAlefMaksuraFinalForm => 'ﵞ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithHahFinalForm => 'ﵟ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithHahInitialForm => 'ﵠ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithJeemInitialForm => 'ﵡ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithMeemFinalForm => 'ﵢ', ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithMeemInitialForm => 'ﵣ', ArabicPresentationFormsA::ArabicLigatureSadWithHahWithHahFinalForm => 'ﵤ', ArabicPresentationFormsA::ArabicLigatureSadWithHahWithHahInitialForm => 'ﵥ', ArabicPresentationFormsA::ArabicLigatureSadWithMeemWithMeemFinalForm => 'ﵦ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahWithMeemFinalForm => 'ﵧ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahWithMeemInitialForm => 'ﵨ', ArabicPresentationFormsA::ArabicLigatureSheenWithJeemWithYehFinalForm => 'ﵩ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithKhahFinalForm => 'ﵪ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithKhahInitialForm => 'ﵫ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithMeemFinalForm => 'ﵬ', ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithMeemInitialForm => 'ﵭ', ArabicPresentationFormsA::ArabicLigatureDadWithHahWithAlefMaksuraFinalForm => 'ﵮ', ArabicPresentationFormsA::ArabicLigatureDadWithKhahWithMeemFinalForm => 'ﵯ', ArabicPresentationFormsA::ArabicLigatureDadWithKhahWithMeemInitialForm => 'ﵰ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithHahFinalForm => 'ﵱ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithHahInitialForm => 'ﵲ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithMeemInitialForm => 'ﵳ', ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithYehFinalForm => 'ﵴ', ArabicPresentationFormsA::ArabicLigatureAinWithJeemWithMeemFinalForm => 'ﵵ', ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithMeemFinalForm => 'ﵶ', ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithMeemInitialForm => 'ﵷ', ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithAlefMaksuraFinalForm => 'ﵸ', ArabicPresentationFormsA::ArabicLigatureGhainWithMeemWithMeemFinalForm => 'ﵹ', ArabicPresentationFormsA::ArabicLigatureGhainWithMeemWithYehFinalForm => 'ﵺ', ArabicPresentationFormsA::ArabicLigatureGhainWithMeemWithAlefMaksuraFinalForm => 'ﵻ', ArabicPresentationFormsA::ArabicLigatureFehWithKhahWithMeemFinalForm => 'ﵼ', ArabicPresentationFormsA::ArabicLigatureFehWithKhahWithMeemInitialForm => 'ﵽ', ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithHahFinalForm => 'ﵾ', ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithMeemFinalForm => 'ﵿ', ArabicPresentationFormsA::ArabicLigatureLamWithHahWithMeemFinalForm => 'ﶀ', ArabicPresentationFormsA::ArabicLigatureLamWithHahWithYehFinalForm => 'ﶁ', ArabicPresentationFormsA::ArabicLigatureLamWithHahWithAlefMaksuraFinalForm => 'ﶂ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithJeemInitialForm => 'ﶃ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithJeemFinalForm => 'ﶄ', ArabicPresentationFormsA::ArabicLigatureLamWithKhahWithMeemFinalForm => 'ﶅ', ArabicPresentationFormsA::ArabicLigatureLamWithKhahWithMeemInitialForm => 'ﶆ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemWithHahFinalForm => 'ﶇ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemWithHahInitialForm => 'ﶈ', ArabicPresentationFormsA::ArabicLigatureMeemWithHahWithJeemInitialForm => 'ﶉ', ArabicPresentationFormsA::ArabicLigatureMeemWithHahWithMeemInitialForm => 'ﶊ', ArabicPresentationFormsA::ArabicLigatureMeemWithHahWithYehFinalForm => 'ﶋ', ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithHahInitialForm => 'ﶌ', ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithMeemInitialForm => 'ﶍ', ArabicPresentationFormsA::ArabicLigatureMeemWithKhahWithJeemInitialForm => 'ﶎ', ArabicPresentationFormsA::ArabicLigatureMeemWithKhahWithMeemInitialForm => 'ﶏ', ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithKhahInitialForm => 'ﶒ', ArabicPresentationFormsA::ArabicLigatureHehWithMeemWithJeemInitialForm => 'ﶓ', ArabicPresentationFormsA::ArabicLigatureHehWithMeemWithMeemInitialForm => 'ﶔ', ArabicPresentationFormsA::ArabicLigatureNoonWithHahWithMeemInitialForm => 'ﶕ', ArabicPresentationFormsA::ArabicLigatureNoonWithHahWithAlefMaksuraFinalForm => 'ﶖ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithMeemFinalForm => 'ﶗ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithMeemInitialForm => 'ﶘ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithAlefMaksuraFinalForm => 'ﶙ', ArabicPresentationFormsA::ArabicLigatureNoonWithMeemWithYehFinalForm => 'ﶚ', ArabicPresentationFormsA::ArabicLigatureNoonWithMeemWithAlefMaksuraFinalForm => 'ﶛ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemWithMeemFinalForm => 'ﶜ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemWithMeemInitialForm => 'ﶝ', ArabicPresentationFormsA::ArabicLigatureBehWithKhahWithYehFinalForm => 'ﶞ', ArabicPresentationFormsA::ArabicLigatureTehWithJeemWithYehFinalForm => 'ﶟ', ArabicPresentationFormsA::ArabicLigatureTehWithJeemWithAlefMaksuraFinalForm => 'ﶠ', ArabicPresentationFormsA::ArabicLigatureTehWithKhahWithYehFinalForm => 'ﶡ', ArabicPresentationFormsA::ArabicLigatureTehWithKhahWithAlefMaksuraFinalForm => 'ﶢ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithYehFinalForm => 'ﶣ', ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithAlefMaksuraFinalForm => 'ﶤ', ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithYehFinalForm => 'ﶥ', ArabicPresentationFormsA::ArabicLigatureJeemWithHahWithAlefMaksuraFinalForm => 'ﶦ', ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithAlefMaksuraFinalForm => 'ﶧ', ArabicPresentationFormsA::ArabicLigatureSeenWithKhahWithAlefMaksuraFinalForm => 'ﶨ', ArabicPresentationFormsA::ArabicLigatureSadWithHahWithYehFinalForm => 'ﶩ', ArabicPresentationFormsA::ArabicLigatureSheenWithHahWithYehFinalForm => 'ﶪ', ArabicPresentationFormsA::ArabicLigatureDadWithHahWithYehFinalForm => 'ﶫ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithYehFinalForm => 'ﶬ', ArabicPresentationFormsA::ArabicLigatureLamWithMeemWithYehFinalForm => 'ﶭ', ArabicPresentationFormsA::ArabicLigatureYehWithHahWithYehFinalForm => 'ﶮ', ArabicPresentationFormsA::ArabicLigatureYehWithJeemWithYehFinalForm => 'ﶯ', ArabicPresentationFormsA::ArabicLigatureYehWithMeemWithYehFinalForm => 'ﶰ', ArabicPresentationFormsA::ArabicLigatureMeemWithMeemWithYehFinalForm => 'ﶱ', ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithYehFinalForm => 'ﶲ', ArabicPresentationFormsA::ArabicLigatureNoonWithHahWithYehFinalForm => 'ﶳ', ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithHahInitialForm => 'ﶴ', ArabicPresentationFormsA::ArabicLigatureLamWithHahWithMeemInitialForm => 'ﶵ', ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithYehFinalForm => 'ﶶ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemWithYehFinalForm => 'ﶷ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithHahInitialForm => 'ﶸ', ArabicPresentationFormsA::ArabicLigatureMeemWithKhahWithYehFinalForm => 'ﶹ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithMeemInitialForm => 'ﶺ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemWithMeemFinalForm => 'ﶻ', ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithMeemFinalForm => 'ﶼ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithHahFinalForm => 'ﶽ', ArabicPresentationFormsA::ArabicLigatureJeemWithHahWithYehFinalForm => 'ﶾ', ArabicPresentationFormsA::ArabicLigatureHahWithJeemWithYehFinalForm => 'ﶿ', ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithYehFinalForm => 'ﷀ', ArabicPresentationFormsA::ArabicLigatureFehWithMeemWithYehFinalForm => 'ﷁ', ArabicPresentationFormsA::ArabicLigatureBehWithHahWithYehFinalForm => 'ﷂ', ArabicPresentationFormsA::ArabicLigatureKafWithMeemWithMeemInitialForm => 'ﷃ', ArabicPresentationFormsA::ArabicLigatureAinWithJeemWithMeemInitialForm => 'ﷄ', ArabicPresentationFormsA::ArabicLigatureSadWithMeemWithMeemInitialForm => 'ﷅ', ArabicPresentationFormsA::ArabicLigatureSeenWithKhahWithYehFinalForm => 'ﷆ', ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithYehFinalForm => 'ﷇ', ArabicPresentationFormsA::ArabicLigatureSallaUsedAsKoranicStopSignIsolatedForm => 'ﷰ', ArabicPresentationFormsA::ArabicLigatureQalaUsedAsKoranicStopSignIsolatedForm => 'ﷱ', ArabicPresentationFormsA::ArabicLigatureAllahIsolatedForm => 'ﷲ', ArabicPresentationFormsA::ArabicLigatureAkbarIsolatedForm => 'ﷳ', ArabicPresentationFormsA::ArabicLigatureMohammadIsolatedForm => 'ﷴ', ArabicPresentationFormsA::ArabicLigatureSalamIsolatedForm => 'ﷵ', ArabicPresentationFormsA::ArabicLigatureRasoulIsolatedForm => 'ﷶ', ArabicPresentationFormsA::ArabicLigatureAlayheIsolatedForm => 'ﷷ', ArabicPresentationFormsA::ArabicLigatureWasallamIsolatedForm => 'ﷸ', ArabicPresentationFormsA::ArabicLigatureSallaIsolatedForm => 'ﷹ', ArabicPresentationFormsA::ArabicLigatureSallallahouAlayheWasallam => 'ﷺ', ArabicPresentationFormsA::ArabicLigatureJallajalalouhou => 'ﷻ', ArabicPresentationFormsA::RialSign => '﷼', ArabicPresentationFormsA::ArabicLigatureBismillahArDashRahmanArDashRaheem => '﷽', } } } impl std::convert::TryFrom<char> for ArabicPresentationFormsA { type Error = (); fn try_from(c: char) -> Result<Self, Self::Error> { match c { 'ﭐ' => Ok(ArabicPresentationFormsA::ArabicLetterAlefWaslaIsolatedForm), 'ﭑ' => Ok(ArabicPresentationFormsA::ArabicLetterAlefWaslaFinalForm), 'ﭒ' => Ok(ArabicPresentationFormsA::ArabicLetterBeehIsolatedForm), 'ﭓ' => Ok(ArabicPresentationFormsA::ArabicLetterBeehFinalForm), 'ﭔ' => Ok(ArabicPresentationFormsA::ArabicLetterBeehInitialForm), 'ﭕ' => Ok(ArabicPresentationFormsA::ArabicLetterBeehMedialForm), 'ﭖ' => Ok(ArabicPresentationFormsA::ArabicLetterPehIsolatedForm), 'ﭗ' => Ok(ArabicPresentationFormsA::ArabicLetterPehFinalForm), 'ﭘ' => Ok(ArabicPresentationFormsA::ArabicLetterPehInitialForm), 'ﭙ' => Ok(ArabicPresentationFormsA::ArabicLetterPehMedialForm), 'ﭚ' => Ok(ArabicPresentationFormsA::ArabicLetterBehehIsolatedForm), 'ﭛ' => Ok(ArabicPresentationFormsA::ArabicLetterBehehFinalForm), 'ﭜ' => Ok(ArabicPresentationFormsA::ArabicLetterBehehInitialForm), 'ﭝ' => Ok(ArabicPresentationFormsA::ArabicLetterBehehMedialForm), 'ﭞ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehehIsolatedForm), 'ﭟ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehehFinalForm), 'ﭠ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehehInitialForm), 'ﭡ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehehMedialForm), 'ﭢ' => Ok(ArabicPresentationFormsA::ArabicLetterTehehIsolatedForm), 'ﭣ' => Ok(ArabicPresentationFormsA::ArabicLetterTehehFinalForm), 'ﭤ' => Ok(ArabicPresentationFormsA::ArabicLetterTehehInitialForm), 'ﭥ' => Ok(ArabicPresentationFormsA::ArabicLetterTehehMedialForm), 'ﭦ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehIsolatedForm), 'ﭧ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehFinalForm), 'ﭨ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehInitialForm), 'ﭩ' => Ok(ArabicPresentationFormsA::ArabicLetterTtehMedialForm), 'ﭪ' => Ok(ArabicPresentationFormsA::ArabicLetterVehIsolatedForm), 'ﭫ' => Ok(ArabicPresentationFormsA::ArabicLetterVehFinalForm), 'ﭬ' => Ok(ArabicPresentationFormsA::ArabicLetterVehInitialForm), 'ﭭ' => Ok(ArabicPresentationFormsA::ArabicLetterVehMedialForm), 'ﭮ' => Ok(ArabicPresentationFormsA::ArabicLetterPehehIsolatedForm), 'ﭯ' => Ok(ArabicPresentationFormsA::ArabicLetterPehehFinalForm), 'ﭰ' => Ok(ArabicPresentationFormsA::ArabicLetterPehehInitialForm), 'ﭱ' => Ok(ArabicPresentationFormsA::ArabicLetterPehehMedialForm), 'ﭲ' => Ok(ArabicPresentationFormsA::ArabicLetterDyehIsolatedForm), 'ﭳ' => Ok(ArabicPresentationFormsA::ArabicLetterDyehFinalForm), 'ﭴ' => Ok(ArabicPresentationFormsA::ArabicLetterDyehInitialForm), 'ﭵ' => Ok(ArabicPresentationFormsA::ArabicLetterDyehMedialForm), 'ﭶ' => Ok(ArabicPresentationFormsA::ArabicLetterNyehIsolatedForm), 'ﭷ' => Ok(ArabicPresentationFormsA::ArabicLetterNyehFinalForm), 'ﭸ' => Ok(ArabicPresentationFormsA::ArabicLetterNyehInitialForm), 'ﭹ' => Ok(ArabicPresentationFormsA::ArabicLetterNyehMedialForm), 'ﭺ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehIsolatedForm), 'ﭻ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehFinalForm), 'ﭼ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehInitialForm), 'ﭽ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehMedialForm), 'ﭾ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehehIsolatedForm), 'ﭿ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehehFinalForm), 'ﮀ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehehInitialForm), 'ﮁ' => Ok(ArabicPresentationFormsA::ArabicLetterTchehehMedialForm), 'ﮂ' => Ok(ArabicPresentationFormsA::ArabicLetterDdahalIsolatedForm), 'ﮃ' => Ok(ArabicPresentationFormsA::ArabicLetterDdahalFinalForm), 'ﮄ' => Ok(ArabicPresentationFormsA::ArabicLetterDahalIsolatedForm), 'ﮅ' => Ok(ArabicPresentationFormsA::ArabicLetterDahalFinalForm), 'ﮆ' => Ok(ArabicPresentationFormsA::ArabicLetterDulIsolatedForm), 'ﮇ' => Ok(ArabicPresentationFormsA::ArabicLetterDulFinalForm), 'ﮈ' => Ok(ArabicPresentationFormsA::ArabicLetterDdalIsolatedForm), 'ﮉ' => Ok(ArabicPresentationFormsA::ArabicLetterDdalFinalForm), 'ﮊ' => Ok(ArabicPresentationFormsA::ArabicLetterJehIsolatedForm), 'ﮋ' => Ok(ArabicPresentationFormsA::ArabicLetterJehFinalForm), 'ﮌ' => Ok(ArabicPresentationFormsA::ArabicLetterRrehIsolatedForm), 'ﮍ' => Ok(ArabicPresentationFormsA::ArabicLetterRrehFinalForm), 'ﮎ' => Ok(ArabicPresentationFormsA::ArabicLetterKehehIsolatedForm), 'ﮏ' => Ok(ArabicPresentationFormsA::ArabicLetterKehehFinalForm), 'ﮐ' => Ok(ArabicPresentationFormsA::ArabicLetterKehehInitialForm), 'ﮑ' => Ok(ArabicPresentationFormsA::ArabicLetterKehehMedialForm), 'ﮒ' => Ok(ArabicPresentationFormsA::ArabicLetterGafIsolatedForm), 'ﮓ' => Ok(ArabicPresentationFormsA::ArabicLetterGafFinalForm), 'ﮔ' => Ok(ArabicPresentationFormsA::ArabicLetterGafInitialForm), 'ﮕ' => Ok(ArabicPresentationFormsA::ArabicLetterGafMedialForm), 'ﮖ' => Ok(ArabicPresentationFormsA::ArabicLetterGuehIsolatedForm), 'ﮗ' => Ok(ArabicPresentationFormsA::ArabicLetterGuehFinalForm), 'ﮘ' => Ok(ArabicPresentationFormsA::ArabicLetterGuehInitialForm), 'ﮙ' => Ok(ArabicPresentationFormsA::ArabicLetterGuehMedialForm), 'ﮚ' => Ok(ArabicPresentationFormsA::ArabicLetterNgoehIsolatedForm), 'ﮛ' => Ok(ArabicPresentationFormsA::ArabicLetterNgoehFinalForm), 'ﮜ' => Ok(ArabicPresentationFormsA::ArabicLetterNgoehInitialForm), 'ﮝ' => Ok(ArabicPresentationFormsA::ArabicLetterNgoehMedialForm), 'ﮞ' => Ok(ArabicPresentationFormsA::ArabicLetterNoonGhunnaIsolatedForm), 'ﮟ' => Ok(ArabicPresentationFormsA::ArabicLetterNoonGhunnaFinalForm), 'ﮠ' => Ok(ArabicPresentationFormsA::ArabicLetterRnoonIsolatedForm), 'ﮡ' => Ok(ArabicPresentationFormsA::ArabicLetterRnoonFinalForm), 'ﮢ' => Ok(ArabicPresentationFormsA::ArabicLetterRnoonInitialForm), 'ﮣ' => Ok(ArabicPresentationFormsA::ArabicLetterRnoonMedialForm), 'ﮤ' => Ok(ArabicPresentationFormsA::ArabicLetterHehWithYehAboveIsolatedForm), 'ﮥ' => Ok(ArabicPresentationFormsA::ArabicLetterHehWithYehAboveFinalForm), 'ﮦ' => Ok(ArabicPresentationFormsA::ArabicLetterHehGoalIsolatedForm), 'ﮧ' => Ok(ArabicPresentationFormsA::ArabicLetterHehGoalFinalForm), 'ﮨ' => Ok(ArabicPresentationFormsA::ArabicLetterHehGoalInitialForm), 'ﮩ' => Ok(ArabicPresentationFormsA::ArabicLetterHehGoalMedialForm), 'ﮪ' => Ok(ArabicPresentationFormsA::ArabicLetterHehDoachashmeeIsolatedForm), 'ﮫ' => Ok(ArabicPresentationFormsA::ArabicLetterHehDoachashmeeFinalForm), 'ﮬ' => Ok(ArabicPresentationFormsA::ArabicLetterHehDoachashmeeInitialForm), 'ﮭ' => Ok(ArabicPresentationFormsA::ArabicLetterHehDoachashmeeMedialForm), 'ﮮ' => Ok(ArabicPresentationFormsA::ArabicLetterYehBarreeIsolatedForm), 'ﮯ' => Ok(ArabicPresentationFormsA::ArabicLetterYehBarreeFinalForm), 'ﮰ' => Ok(ArabicPresentationFormsA::ArabicLetterYehBarreeWithHamzaAboveIsolatedForm), 'ﮱ' => Ok(ArabicPresentationFormsA::ArabicLetterYehBarreeWithHamzaAboveFinalForm), '﮲' => Ok(ArabicPresentationFormsA::ArabicSymbolDotAbove), '﮳' => Ok(ArabicPresentationFormsA::ArabicSymbolDotBelow), '﮴' => Ok(ArabicPresentationFormsA::ArabicSymbolTwoDotsAbove), '﮵' => Ok(ArabicPresentationFormsA::ArabicSymbolTwoDotsBelow), '﮶' => Ok(ArabicPresentationFormsA::ArabicSymbolThreeDotsAbove), '﮷' => Ok(ArabicPresentationFormsA::ArabicSymbolThreeDotsBelow), '﮸' => Ok(ArabicPresentationFormsA::ArabicSymbolThreeDotsPointingDownwardsAbove), '﮹' => Ok(ArabicPresentationFormsA::ArabicSymbolThreeDotsPointingDownwardsBelow), '﮺' => Ok(ArabicPresentationFormsA::ArabicSymbolFourDotsAbove), '﮻' => Ok(ArabicPresentationFormsA::ArabicSymbolFourDotsBelow), '﮼' => Ok(ArabicPresentationFormsA::ArabicSymbolDoubleVerticalBarBelow), '﮽' => Ok(ArabicPresentationFormsA::ArabicSymbolTwoDotsVerticallyAbove), '﮾' => Ok(ArabicPresentationFormsA::ArabicSymbolTwoDotsVerticallyBelow), '﮿' => Ok(ArabicPresentationFormsA::ArabicSymbolRing), '﯀' => Ok(ArabicPresentationFormsA::ArabicSymbolSmallTahAbove), '﯁' => Ok(ArabicPresentationFormsA::ArabicSymbolSmallTahBelow), 'ﯓ' => Ok(ArabicPresentationFormsA::ArabicLetterNgIsolatedForm), 'ﯔ' => Ok(ArabicPresentationFormsA::ArabicLetterNgFinalForm), 'ﯕ' => Ok(ArabicPresentationFormsA::ArabicLetterNgInitialForm), 'ﯖ' => Ok(ArabicPresentationFormsA::ArabicLetterNgMedialForm), 'ﯗ' => Ok(ArabicPresentationFormsA::ArabicLetterUIsolatedForm), 'ﯘ' => Ok(ArabicPresentationFormsA::ArabicLetterUFinalForm), 'ﯙ' => Ok(ArabicPresentationFormsA::ArabicLetterOeIsolatedForm), 'ﯚ' => Ok(ArabicPresentationFormsA::ArabicLetterOeFinalForm), 'ﯛ' => Ok(ArabicPresentationFormsA::ArabicLetterYuIsolatedForm), 'ﯜ' => Ok(ArabicPresentationFormsA::ArabicLetterYuFinalForm), 'ﯝ' => Ok(ArabicPresentationFormsA::ArabicLetterUWithHamzaAboveIsolatedForm), 'ﯞ' => Ok(ArabicPresentationFormsA::ArabicLetterVeIsolatedForm), 'ﯟ' => Ok(ArabicPresentationFormsA::ArabicLetterVeFinalForm), 'ﯠ' => Ok(ArabicPresentationFormsA::ArabicLetterKirghizOeIsolatedForm), 'ﯡ' => Ok(ArabicPresentationFormsA::ArabicLetterKirghizOeFinalForm), 'ﯢ' => Ok(ArabicPresentationFormsA::ArabicLetterKirghizYuIsolatedForm), 'ﯣ' => Ok(ArabicPresentationFormsA::ArabicLetterKirghizYuFinalForm), 'ﯤ' => Ok(ArabicPresentationFormsA::ArabicLetterEIsolatedForm), 'ﯥ' => Ok(ArabicPresentationFormsA::ArabicLetterEFinalForm), 'ﯦ' => Ok(ArabicPresentationFormsA::ArabicLetterEInitialForm), 'ﯧ' => Ok(ArabicPresentationFormsA::ArabicLetterEMedialForm), 'ﯨ' => Ok(ArabicPresentationFormsA::ArabicLetterUighurKazakhKirghizAlefMaksuraInitialForm), 'ﯩ' => Ok(ArabicPresentationFormsA::ArabicLetterUighurKazakhKirghizAlefMaksuraMedialForm), 'ﯪ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefIsolatedForm), 'ﯫ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefFinalForm), 'ﯬ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAeIsolatedForm), 'ﯭ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAeFinalForm), 'ﯮ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithWawIsolatedForm), 'ﯯ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithWawFinalForm), 'ﯰ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithUIsolatedForm), 'ﯱ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithUFinalForm), 'ﯲ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithOeIsolatedForm), 'ﯳ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithOeFinalForm), 'ﯴ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYuIsolatedForm), 'ﯵ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYuFinalForm), 'ﯶ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithEIsolatedForm), 'ﯷ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithEFinalForm), 'ﯸ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithEInitialForm), 'ﯹ' => Ok(ArabicPresentationFormsA::ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraIsolatedForm), 'ﯺ' => Ok(ArabicPresentationFormsA::ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraFinalForm), 'ﯻ' => Ok(ArabicPresentationFormsA::ArabicLigatureUighurKirghizYehWithHamzaAboveWithAlefMaksuraInitialForm), 'ﯼ' => Ok(ArabicPresentationFormsA::ArabicLetterFarsiYehIsolatedForm), 'ﯽ' => Ok(ArabicPresentationFormsA::ArabicLetterFarsiYehFinalForm), 'ﯾ' => Ok(ArabicPresentationFormsA::ArabicLetterFarsiYehInitialForm), 'ﯿ' => Ok(ArabicPresentationFormsA::ArabicLetterFarsiYehMedialForm), 'ﰀ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithJeemIsolatedForm), 'ﰁ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHahIsolatedForm), 'ﰂ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemIsolatedForm), 'ﰃ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefMaksuraIsolatedForm), 'ﰄ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYehIsolatedForm), 'ﰅ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithJeemIsolatedForm), 'ﰆ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithHahIsolatedForm), 'ﰇ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithKhahIsolatedForm), 'ﰈ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithMeemIsolatedForm), 'ﰉ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithAlefMaksuraIsolatedForm), 'ﰊ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithYehIsolatedForm), 'ﰋ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithJeemIsolatedForm), 'ﰌ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHahIsolatedForm), 'ﰍ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithKhahIsolatedForm), 'ﰎ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemIsolatedForm), 'ﰏ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithAlefMaksuraIsolatedForm), 'ﰐ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithYehIsolatedForm), 'ﰑ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithJeemIsolatedForm), 'ﰒ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithMeemIsolatedForm), 'ﰓ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithAlefMaksuraIsolatedForm), 'ﰔ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithYehIsolatedForm), 'ﰕ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithHahIsolatedForm), 'ﰖ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithMeemIsolatedForm), 'ﰗ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithJeemIsolatedForm), 'ﰘ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithMeemIsolatedForm), 'ﰙ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithJeemIsolatedForm), 'ﰚ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithHahIsolatedForm), 'ﰛ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithMeemIsolatedForm), 'ﰜ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithJeemIsolatedForm), 'ﰝ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithHahIsolatedForm), 'ﰞ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithKhahIsolatedForm), 'ﰟ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemIsolatedForm), 'ﰠ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithHahIsolatedForm), 'ﰡ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithMeemIsolatedForm), 'ﰢ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithJeemIsolatedForm), 'ﰣ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithHahIsolatedForm), 'ﰤ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithKhahIsolatedForm), 'ﰥ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithMeemIsolatedForm), 'ﰦ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithHahIsolatedForm), 'ﰧ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemIsolatedForm), 'ﰨ' => Ok(ArabicPresentationFormsA::ArabicLigatureZahWithMeemIsolatedForm), 'ﰩ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithJeemIsolatedForm), 'ﰪ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithMeemIsolatedForm), 'ﰫ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithJeemIsolatedForm), 'ﰬ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithMeemIsolatedForm), 'ﰭ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithJeemIsolatedForm), 'ﰮ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithHahIsolatedForm), 'ﰯ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithKhahIsolatedForm), 'ﰰ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithMeemIsolatedForm), 'ﰱ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithAlefMaksuraIsolatedForm), 'ﰲ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithYehIsolatedForm), 'ﰳ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithHahIsolatedForm), 'ﰴ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithMeemIsolatedForm), 'ﰵ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithAlefMaksuraIsolatedForm), 'ﰶ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithYehIsolatedForm), 'ﰷ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithAlefIsolatedForm), 'ﰸ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithJeemIsolatedForm), 'ﰹ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithHahIsolatedForm), 'ﰺ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithKhahIsolatedForm), 'ﰻ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithLamIsolatedForm), 'ﰼ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemIsolatedForm), 'ﰽ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithAlefMaksuraIsolatedForm), 'ﰾ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithYehIsolatedForm), 'ﰿ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemIsolatedForm), 'ﱀ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHahIsolatedForm), 'ﱁ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithKhahIsolatedForm), 'ﱂ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemIsolatedForm), 'ﱃ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithAlefMaksuraIsolatedForm), 'ﱄ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithYehIsolatedForm), 'ﱅ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithJeemIsolatedForm), 'ﱆ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithHahIsolatedForm), 'ﱇ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithKhahIsolatedForm), 'ﱈ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithMeemIsolatedForm), 'ﱉ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithAlefMaksuraIsolatedForm), 'ﱊ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithYehIsolatedForm), 'ﱋ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemIsolatedForm), 'ﱌ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHahIsolatedForm), 'ﱍ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithKhahIsolatedForm), 'ﱎ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithMeemIsolatedForm), 'ﱏ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithAlefMaksuraIsolatedForm), 'ﱐ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithYehIsolatedForm), 'ﱑ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithJeemIsolatedForm), 'ﱒ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithMeemIsolatedForm), 'ﱓ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithAlefMaksuraIsolatedForm), 'ﱔ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithYehIsolatedForm), 'ﱕ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithJeemIsolatedForm), 'ﱖ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHahIsolatedForm), 'ﱗ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithKhahIsolatedForm), 'ﱘ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemIsolatedForm), 'ﱙ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithAlefMaksuraIsolatedForm), 'ﱚ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithYehIsolatedForm), 'ﱛ' => Ok(ArabicPresentationFormsA::ArabicLigatureThalWithSuperscriptAlefIsolatedForm), 'ﱜ' => Ok(ArabicPresentationFormsA::ArabicLigatureRehWithSuperscriptAlefIsolatedForm), 'ﱝ' => Ok(ArabicPresentationFormsA::ArabicLigatureAlefMaksuraWithSuperscriptAlefIsolatedForm), 'ﱞ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithDammatanIsolatedForm), 'ﱟ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithKasratanIsolatedForm), 'ﱠ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithFathaIsolatedForm), 'ﱡ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithDammaIsolatedForm), 'ﱢ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithKasraIsolatedForm), 'ﱣ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithSuperscriptAlefIsolatedForm), 'ﱤ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithRehFinalForm), 'ﱥ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithZainFinalForm), 'ﱦ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemFinalForm), 'ﱧ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithNoonFinalForm), 'ﱨ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithAlefMaksuraFinalForm), 'ﱩ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithYehFinalForm), 'ﱪ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithRehFinalForm), 'ﱫ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithZainFinalForm), 'ﱬ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithMeemFinalForm), 'ﱭ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithNoonFinalForm), 'ﱮ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithAlefMaksuraFinalForm), 'ﱯ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithYehFinalForm), 'ﱰ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithRehFinalForm), 'ﱱ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithZainFinalForm), 'ﱲ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemFinalForm), 'ﱳ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithNoonFinalForm), 'ﱴ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithAlefMaksuraFinalForm), 'ﱵ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithYehFinalForm), 'ﱶ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithRehFinalForm), 'ﱷ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithZainFinalForm), 'ﱸ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithMeemFinalForm), 'ﱹ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithNoonFinalForm), 'ﱺ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithAlefMaksuraFinalForm), 'ﱻ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithYehFinalForm), 'ﱼ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithAlefMaksuraFinalForm), 'ﱽ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithYehFinalForm), 'ﱾ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithAlefMaksuraFinalForm), 'ﱿ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithYehFinalForm), 'ﲀ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithAlefFinalForm), 'ﲁ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithLamFinalForm), 'ﲂ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemFinalForm), 'ﲃ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithAlefMaksuraFinalForm), 'ﲄ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithYehFinalForm), 'ﲅ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemFinalForm), 'ﲆ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithAlefMaksuraFinalForm), 'ﲇ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithYehFinalForm), 'ﲈ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithAlefFinalForm), 'ﲉ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithMeemFinalForm), 'ﲊ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithRehFinalForm), 'ﲋ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithZainFinalForm), 'ﲌ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithMeemFinalForm), 'ﲍ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithNoonFinalForm), 'ﲎ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithAlefMaksuraFinalForm), 'ﲏ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithYehFinalForm), 'ﲐ' => Ok(ArabicPresentationFormsA::ArabicLigatureAlefMaksuraWithSuperscriptAlefFinalForm), 'ﲑ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithRehFinalForm), 'ﲒ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithZainFinalForm), 'ﲓ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemFinalForm), 'ﲔ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithNoonFinalForm), 'ﲕ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithAlefMaksuraFinalForm), 'ﲖ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithYehFinalForm), 'ﲗ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithJeemInitialForm), 'ﲘ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHahInitialForm), 'ﲙ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithKhahInitialForm), 'ﲚ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemInitialForm), 'ﲛ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHehInitialForm), 'ﲜ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithJeemInitialForm), 'ﲝ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithHahInitialForm), 'ﲞ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithKhahInitialForm), 'ﲟ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithMeemInitialForm), 'ﲠ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithHehInitialForm), 'ﲡ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithJeemInitialForm), 'ﲢ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHahInitialForm), 'ﲣ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithKhahInitialForm), 'ﲤ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemInitialForm), 'ﲥ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHehInitialForm), 'ﲦ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithMeemInitialForm), 'ﲧ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithHahInitialForm), 'ﲨ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithMeemInitialForm), 'ﲩ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithJeemInitialForm), 'ﲪ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithMeemInitialForm), 'ﲫ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithJeemInitialForm), 'ﲬ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithMeemInitialForm), 'ﲭ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithJeemInitialForm), 'ﲮ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithHahInitialForm), 'ﲯ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithKhahInitialForm), 'ﲰ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemInitialForm), 'ﲱ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithHahInitialForm), 'ﲲ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithKhahInitialForm), 'ﲳ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithMeemInitialForm), 'ﲴ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithJeemInitialForm), 'ﲵ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithHahInitialForm), 'ﲶ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithKhahInitialForm), 'ﲷ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithMeemInitialForm), 'ﲸ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithHahInitialForm), 'ﲹ' => Ok(ArabicPresentationFormsA::ArabicLigatureZahWithMeemInitialForm), 'ﲺ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithJeemInitialForm), 'ﲻ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithMeemInitialForm), 'ﲼ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithJeemInitialForm), 'ﲽ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithMeemInitialForm), 'ﲾ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithJeemInitialForm), 'ﲿ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithHahInitialForm), 'ﳀ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithKhahInitialForm), 'ﳁ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithMeemInitialForm), 'ﳂ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithHahInitialForm), 'ﳃ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithMeemInitialForm), 'ﳄ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithJeemInitialForm), 'ﳅ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithHahInitialForm), 'ﳆ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithKhahInitialForm), 'ﳇ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithLamInitialForm), 'ﳈ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemInitialForm), 'ﳉ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemInitialForm), 'ﳊ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHahInitialForm), 'ﳋ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithKhahInitialForm), 'ﳌ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemInitialForm), 'ﳍ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHehInitialForm), 'ﳎ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithJeemInitialForm), 'ﳏ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithHahInitialForm), 'ﳐ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithKhahInitialForm), 'ﳑ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithMeemInitialForm), 'ﳒ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemInitialForm), 'ﳓ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHahInitialForm), 'ﳔ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithKhahInitialForm), 'ﳕ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithMeemInitialForm), 'ﳖ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHehInitialForm), 'ﳗ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithJeemInitialForm), 'ﳘ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithMeemInitialForm), 'ﳙ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithSuperscriptAlefInitialForm), 'ﳚ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithJeemInitialForm), 'ﳛ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHahInitialForm), 'ﳜ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithKhahInitialForm), 'ﳝ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemInitialForm), 'ﳞ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHehInitialForm), 'ﳟ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithMeemMedialForm), 'ﳠ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHamzaAboveWithHehMedialForm), 'ﳡ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithMeemMedialForm), 'ﳢ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithHehMedialForm), 'ﳣ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemMedialForm), 'ﳤ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHehMedialForm), 'ﳥ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithMeemMedialForm), 'ﳦ' => Ok(ArabicPresentationFormsA::ArabicLigatureThehWithHehMedialForm), 'ﳧ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemMedialForm), 'ﳨ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithHehMedialForm), 'ﳩ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemMedialForm), 'ﳪ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHehMedialForm), 'ﳫ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithLamMedialForm), 'ﳬ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemMedialForm), 'ﳭ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemMedialForm), 'ﳮ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithMeemMedialForm), 'ﳯ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHehMedialForm), 'ﳰ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemMedialForm), 'ﳱ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHehMedialForm), 'ﳲ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithFathaMedialForm), 'ﳳ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithDammaMedialForm), 'ﳴ' => Ok(ArabicPresentationFormsA::ArabicLigatureShaddaWithKasraMedialForm), 'ﳵ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithAlefMaksuraIsolatedForm), 'ﳶ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithYehIsolatedForm), 'ﳷ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithAlefMaksuraIsolatedForm), 'ﳸ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithYehIsolatedForm), 'ﳹ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithAlefMaksuraIsolatedForm), 'ﳺ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithYehIsolatedForm), 'ﳻ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithAlefMaksuraIsolatedForm), 'ﳼ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithYehIsolatedForm), 'ﳽ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithAlefMaksuraIsolatedForm), 'ﳾ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithYehIsolatedForm), 'ﳿ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithAlefMaksuraIsolatedForm), 'ﴀ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithYehIsolatedForm), 'ﴁ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithAlefMaksuraIsolatedForm), 'ﴂ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithYehIsolatedForm), 'ﴃ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithAlefMaksuraIsolatedForm), 'ﴄ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithYehIsolatedForm), 'ﴅ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithAlefMaksuraIsolatedForm), 'ﴆ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithYehIsolatedForm), 'ﴇ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithAlefMaksuraIsolatedForm), 'ﴈ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithYehIsolatedForm), 'ﴉ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithJeemIsolatedForm), 'ﴊ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahIsolatedForm), 'ﴋ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithKhahIsolatedForm), 'ﴌ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemIsolatedForm), 'ﴍ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithRehIsolatedForm), 'ﴎ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithRehIsolatedForm), 'ﴏ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithRehIsolatedForm), 'ﴐ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithRehIsolatedForm), 'ﴑ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithAlefMaksuraFinalForm), 'ﴒ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithYehFinalForm), 'ﴓ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithAlefMaksuraFinalForm), 'ﴔ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithYehFinalForm), 'ﴕ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithAlefMaksuraFinalForm), 'ﴖ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithYehFinalForm), 'ﴗ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithAlefMaksuraFinalForm), 'ﴘ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithYehFinalForm), 'ﴙ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithAlefMaksuraFinalForm), 'ﴚ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithYehFinalForm), 'ﴛ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithAlefMaksuraFinalForm), 'ﴜ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithYehFinalForm), 'ﴝ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithAlefMaksuraFinalForm), 'ﴞ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithYehFinalForm), 'ﴟ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithAlefMaksuraFinalForm), 'ﴠ' => Ok(ArabicPresentationFormsA::ArabicLigatureKhahWithYehFinalForm), 'ﴡ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithAlefMaksuraFinalForm), 'ﴢ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithYehFinalForm), 'ﴣ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithAlefMaksuraFinalForm), 'ﴤ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithYehFinalForm), 'ﴥ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithJeemFinalForm), 'ﴦ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahFinalForm), 'ﴧ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithKhahFinalForm), 'ﴨ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemFinalForm), 'ﴩ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithRehFinalForm), 'ﴪ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithRehFinalForm), 'ﴫ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithRehFinalForm), 'ﴬ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithRehFinalForm), 'ﴭ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithJeemInitialForm), 'ﴮ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahInitialForm), 'ﴯ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithKhahInitialForm), 'ﴰ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemInitialForm), 'ﴱ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithHehInitialForm), 'ﴲ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHehInitialForm), 'ﴳ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemInitialForm), 'ﴴ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithJeemMedialForm), 'ﴵ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithHahMedialForm), 'ﴶ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithKhahMedialForm), 'ﴷ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithJeemMedialForm), 'ﴸ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahMedialForm), 'ﴹ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithKhahMedialForm), 'ﴺ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemMedialForm), 'ﴻ' => Ok(ArabicPresentationFormsA::ArabicLigatureZahWithMeemMedialForm), 'ﴼ' => Ok(ArabicPresentationFormsA::ArabicLigatureAlefWithFathatanFinalForm), 'ﴽ' => Ok(ArabicPresentationFormsA::ArabicLigatureAlefWithFathatanIsolatedForm), '﴾' => Ok(ArabicPresentationFormsA::OrnateLeftParenthesis), '﴿' => Ok(ArabicPresentationFormsA::OrnateRightParenthesis), 'ﵐ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithJeemWithMeemInitialForm), 'ﵑ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHahWithJeemFinalForm), 'ﵒ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHahWithJeemInitialForm), 'ﵓ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithHahWithMeemInitialForm), 'ﵔ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithKhahWithMeemInitialForm), 'ﵕ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithJeemInitialForm), 'ﵖ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithHahInitialForm), 'ﵗ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithKhahInitialForm), 'ﵘ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithHahFinalForm), 'ﵙ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithHahInitialForm), 'ﵚ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithMeemWithYehFinalForm), 'ﵛ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithMeemWithAlefMaksuraFinalForm), 'ﵜ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithHahWithJeemInitialForm), 'ﵝ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithJeemWithHahInitialForm), 'ﵞ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithJeemWithAlefMaksuraFinalForm), 'ﵟ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithHahFinalForm), 'ﵠ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithHahInitialForm), 'ﵡ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithJeemInitialForm), 'ﵢ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithMeemFinalForm), 'ﵣ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithMeemWithMeemInitialForm), 'ﵤ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithHahWithHahFinalForm), 'ﵥ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithHahWithHahInitialForm), 'ﵦ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithMeemWithMeemFinalForm), 'ﵧ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahWithMeemFinalForm), 'ﵨ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahWithMeemInitialForm), 'ﵩ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithJeemWithYehFinalForm), 'ﵪ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithKhahFinalForm), 'ﵫ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithKhahInitialForm), 'ﵬ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithMeemFinalForm), 'ﵭ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithMeemWithMeemInitialForm), 'ﵮ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithHahWithAlefMaksuraFinalForm), 'ﵯ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithKhahWithMeemFinalForm), 'ﵰ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithKhahWithMeemInitialForm), 'ﵱ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithHahFinalForm), 'ﵲ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithHahInitialForm), 'ﵳ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithMeemInitialForm), 'ﵴ' => Ok(ArabicPresentationFormsA::ArabicLigatureTahWithMeemWithYehFinalForm), 'ﵵ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithJeemWithMeemFinalForm), 'ﵶ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithMeemFinalForm), 'ﵷ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithMeemInitialForm), 'ﵸ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithAlefMaksuraFinalForm), 'ﵹ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithMeemWithMeemFinalForm), 'ﵺ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithMeemWithYehFinalForm), 'ﵻ' => Ok(ArabicPresentationFormsA::ArabicLigatureGhainWithMeemWithAlefMaksuraFinalForm), 'ﵼ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithKhahWithMeemFinalForm), 'ﵽ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithKhahWithMeemInitialForm), 'ﵾ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithHahFinalForm), 'ﵿ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithMeemFinalForm), 'ﶀ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHahWithMeemFinalForm), 'ﶁ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHahWithYehFinalForm), 'ﶂ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHahWithAlefMaksuraFinalForm), 'ﶃ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithJeemInitialForm), 'ﶄ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithJeemFinalForm), 'ﶅ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithKhahWithMeemFinalForm), 'ﶆ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithKhahWithMeemInitialForm), 'ﶇ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemWithHahFinalForm), 'ﶈ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemWithHahInitialForm), 'ﶉ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithHahWithJeemInitialForm), 'ﶊ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithHahWithMeemInitialForm), 'ﶋ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithHahWithYehFinalForm), 'ﶌ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithHahInitialForm), 'ﶍ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithMeemInitialForm), 'ﶎ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithKhahWithJeemInitialForm), 'ﶏ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithKhahWithMeemInitialForm), 'ﶒ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithKhahInitialForm), 'ﶓ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithMeemWithJeemInitialForm), 'ﶔ' => Ok(ArabicPresentationFormsA::ArabicLigatureHehWithMeemWithMeemInitialForm), 'ﶕ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHahWithMeemInitialForm), 'ﶖ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHahWithAlefMaksuraFinalForm), 'ﶗ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithMeemFinalForm), 'ﶘ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithMeemInitialForm), 'ﶙ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithAlefMaksuraFinalForm), 'ﶚ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithMeemWithYehFinalForm), 'ﶛ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithMeemWithAlefMaksuraFinalForm), 'ﶜ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemWithMeemFinalForm), 'ﶝ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemWithMeemInitialForm), 'ﶞ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithKhahWithYehFinalForm), 'ﶟ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithJeemWithYehFinalForm), 'ﶠ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithJeemWithAlefMaksuraFinalForm), 'ﶡ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithKhahWithYehFinalForm), 'ﶢ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithKhahWithAlefMaksuraFinalForm), 'ﶣ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithYehFinalForm), 'ﶤ' => Ok(ArabicPresentationFormsA::ArabicLigatureTehWithMeemWithAlefMaksuraFinalForm), 'ﶥ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithYehFinalForm), 'ﶦ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithHahWithAlefMaksuraFinalForm), 'ﶧ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithMeemWithAlefMaksuraFinalForm), 'ﶨ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithKhahWithAlefMaksuraFinalForm), 'ﶩ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithHahWithYehFinalForm), 'ﶪ' => Ok(ArabicPresentationFormsA::ArabicLigatureSheenWithHahWithYehFinalForm), 'ﶫ' => Ok(ArabicPresentationFormsA::ArabicLigatureDadWithHahWithYehFinalForm), 'ﶬ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithYehFinalForm), 'ﶭ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithMeemWithYehFinalForm), 'ﶮ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithHahWithYehFinalForm), 'ﶯ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithJeemWithYehFinalForm), 'ﶰ' => Ok(ArabicPresentationFormsA::ArabicLigatureYehWithMeemWithYehFinalForm), 'ﶱ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithMeemWithYehFinalForm), 'ﶲ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithYehFinalForm), 'ﶳ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithHahWithYehFinalForm), 'ﶴ' => Ok(ArabicPresentationFormsA::ArabicLigatureQafWithMeemWithHahInitialForm), 'ﶵ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithHahWithMeemInitialForm), 'ﶶ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithMeemWithYehFinalForm), 'ﶷ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemWithYehFinalForm), 'ﶸ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithHahInitialForm), 'ﶹ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithKhahWithYehFinalForm), 'ﶺ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithMeemInitialForm), 'ﶻ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemWithMeemFinalForm), 'ﶼ' => Ok(ArabicPresentationFormsA::ArabicLigatureLamWithJeemWithMeemFinalForm), 'ﶽ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithHahFinalForm), 'ﶾ' => Ok(ArabicPresentationFormsA::ArabicLigatureJeemWithHahWithYehFinalForm), 'ﶿ' => Ok(ArabicPresentationFormsA::ArabicLigatureHahWithJeemWithYehFinalForm), 'ﷀ' => Ok(ArabicPresentationFormsA::ArabicLigatureMeemWithJeemWithYehFinalForm), 'ﷁ' => Ok(ArabicPresentationFormsA::ArabicLigatureFehWithMeemWithYehFinalForm), 'ﷂ' => Ok(ArabicPresentationFormsA::ArabicLigatureBehWithHahWithYehFinalForm), 'ﷃ' => Ok(ArabicPresentationFormsA::ArabicLigatureKafWithMeemWithMeemInitialForm), 'ﷄ' => Ok(ArabicPresentationFormsA::ArabicLigatureAinWithJeemWithMeemInitialForm), 'ﷅ' => Ok(ArabicPresentationFormsA::ArabicLigatureSadWithMeemWithMeemInitialForm), 'ﷆ' => Ok(ArabicPresentationFormsA::ArabicLigatureSeenWithKhahWithYehFinalForm), 'ﷇ' => Ok(ArabicPresentationFormsA::ArabicLigatureNoonWithJeemWithYehFinalForm), 'ﷰ' => Ok(ArabicPresentationFormsA::ArabicLigatureSallaUsedAsKoranicStopSignIsolatedForm), 'ﷱ' => Ok(ArabicPresentationFormsA::ArabicLigatureQalaUsedAsKoranicStopSignIsolatedForm), 'ﷲ' => Ok(ArabicPresentationFormsA::ArabicLigatureAllahIsolatedForm), 'ﷳ' => Ok(ArabicPresentationFormsA::ArabicLigatureAkbarIsolatedForm), 'ﷴ' => Ok(ArabicPresentationFormsA::ArabicLigatureMohammadIsolatedForm), 'ﷵ' => Ok(ArabicPresentationFormsA::ArabicLigatureSalamIsolatedForm), 'ﷶ' => Ok(ArabicPresentationFormsA::ArabicLigatureRasoulIsolatedForm), 'ﷷ' => Ok(ArabicPresentationFormsA::ArabicLigatureAlayheIsolatedForm), 'ﷸ' => Ok(ArabicPresentationFormsA::ArabicLigatureWasallamIsolatedForm), 'ﷹ' => Ok(ArabicPresentationFormsA::ArabicLigatureSallaIsolatedForm), 'ﷺ' => Ok(ArabicPresentationFormsA::ArabicLigatureSallallahouAlayheWasallam), 'ﷻ' => Ok(ArabicPresentationFormsA::ArabicLigatureJallajalalouhou), '﷼' => Ok(ArabicPresentationFormsA::RialSign), '﷽' => Ok(ArabicPresentationFormsA::ArabicLigatureBismillahArDashRahmanArDashRaheem), _ => Err(()), } } } impl Into<u32> for ArabicPresentationFormsA { fn into(self) -> u32 { let c: char = self.into(); let hex = c .escape_unicode() .to_string() .replace("\\u{", "") .replace("}", ""); u32::from_str_radix(&hex, 16).unwrap() } } impl std::convert::TryFrom<u32> for ArabicPresentationFormsA { type Error = (); fn try_from(u: u32) -> Result<Self, Self::Error> { if let Ok(c) = char::try_from(u) { Self::try_from(c) } else { Err(()) } } } impl Iterator for ArabicPresentationFormsA { type Item = Self; fn next(&mut self) -> Option<Self> { let index: u32 = (*self).into(); use std::convert::TryFrom; Self::try_from(index + 1).ok() } } impl ArabicPresentationFormsA { /// The character with the lowest index in this unicode block pub fn new() -> Self { ArabicPresentationFormsA::ArabicLetterAlefWaslaIsolatedForm } /// The character's name, in sentence case pub fn name(&self) -> String { let s = std::format!("ArabicPresentationFormsA{:#?}", self); string_morph::to_sentence_case(&s) } }
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_fd.rs,v 1.1 2023/02/05 08:32:24 he Exp $ --- third_party/rust/authenticator/src/netbsd/fd.rs.orig 2020-09-02 20:55:30.875594185 +0000 +++ third_party/rust/authenticator/src/netbsd/fd.rs @@ -0,0 +1,47 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +extern crate libc; + +use std::ffi::CString; +use std::io; +use std::mem; +use std::os::raw::c_int; +use std::os::unix::io::RawFd; + +#[derive(Debug)] +pub struct Fd { + pub fileno: RawFd, +} + +impl Fd { + pub fn open(path: &str, flags: c_int) -> io::Result<Fd> { + let cpath = CString::new(path.as_bytes())?; + let rv = unsafe { libc::open(cpath.as_ptr(), flags) }; + if rv == -1 { + return Err(io::Error::last_os_error()); + } + Ok(Fd { fileno: rv }) + } +} + +impl Drop for Fd { + fn drop(&mut self) { + unsafe { libc::close(self.fileno) }; + } +} + +impl PartialEq for Fd { + fn eq(&self, other: &Fd) -> bool { + let mut st: libc::stat = unsafe { mem::zeroed() }; + let mut sto: libc::stat = unsafe { mem::zeroed() }; + if unsafe { libc::fstat(self.fileno, &mut st) } == -1 { + return false; + } + if unsafe { libc::fstat(other.fileno, &mut sto) } == -1 { + return false; + } + (st.st_dev == sto.st_dev) & (st.st_ino == sto.st_ino) + } +}
use glium::glutin::{self, event_loop::EventLoop, window::WindowBuilder, dpi::PhysicalSize}; use glium::{Display, Program, DrawParameters, texture::Texture2d}; use crate::textures::create_texture_map; use std::collections::HashMap; use crate::shaders; #[cfg(windows)] use glium::glutin::platform::windows::WindowBuilderExtWindows; pub struct RenderContainer<'a> { pub display: Display, pub main_program: Program, pub skybox_program: Program, pub ui_program: Program, pub params: DrawParameters<'a>, pub textures: HashMap<String, Texture2d> } impl RenderContainer<'_> { #[cfg(windows)] fn create_window_builder(init_size: PhysicalSize<u32>, title: &str) -> WindowBuilder { glutin::window::WindowBuilder::new() .with_drag_and_drop(false) .with_title(title) .with_inner_size(init_size) } #[cfg(unix)] fn create_window_builder(init_size: PhysicalSize<u32>, title: &str) -> WindowBuilder { glutin::window::WindowBuilder::new() .with_title(title) .with_inner_size(init_size) } pub fn new(event_loop: &EventLoop<()>, width: usize, height: usize, title: &str, fullscreen: bool) -> Self { let init_size = glutin::dpi::PhysicalSize { width: width as u32, height: height as u32 }; let wb = Self::create_window_builder(init_size, title); let cb = glutin::ContextBuilder::new(); let display = glium::Display::new(wb, cb, &event_loop).unwrap(); let main_program = shaders::main_program(&display); let skybox_program = shaders::skybox_program(&display); let ui_program = shaders::ui_program(&display); let textures = create_texture_map(&display).unwrap(); let result = Self { display: display, main_program: main_program, skybox_program: skybox_program, ui_program: ui_program, params: DrawParameters { depth: glium::Depth { test: glium::draw_parameters::DepthTest::IfLess, write: true, ..Default::default() }, blend: glium::draw_parameters::Blend::alpha_blending(), backface_culling: glium::draw_parameters::BackfaceCullingMode::CullClockwise, ..Default::default() }, textures: textures }; result.update_size_and_mode(width, height, fullscreen); result } pub fn update_size_and_mode(&self, width: usize, height: usize, fullscreen: bool) { let gl_window = self.display.gl_window(); let window = gl_window.window(); let desired_size = glutin::dpi::PhysicalSize { width: width as u32, height: height as u32 }; if fullscreen { let mut bit_depth = 0u16; let mut refresh_rate = 0u16; window.current_monitor().unwrap().video_modes().for_each(|v| { if v.bit_depth() > bit_depth { bit_depth = v.bit_depth(); } if v.refresh_rate() > refresh_rate { refresh_rate = v.refresh_rate(); } }); let fallback_video_mode = window.current_monitor().unwrap().video_modes() .find(|v| v.bit_depth() == bit_depth && v.refresh_rate() == refresh_rate).unwrap(); let video_mode = window.current_monitor().unwrap().video_modes() .filter(|v| v.bit_depth() == bit_depth && v.refresh_rate() == refresh_rate) .find(|v| v.size() == desired_size) .unwrap_or(fallback_video_mode); window.set_fullscreen(Some(glutin::window::Fullscreen::Exclusive(video_mode))); } else { window.set_inner_size(desired_size); window.set_fullscreen(None); } } }
use std::env; use std::fs::{copy, File, OpenOptions}; use std::io::Write; use std::path::{Path, PathBuf}; use cargo::ops::NewOptions; use cargo::ops::VersionControl::NoVcs; use cargo::Config; fn main() { let (year, problem_number) = extract_args(); let proj_dir = create_package(year, problem_number); write_dependencies(&proj_dir); create_input_file(&proj_dir); copy_template(&proj_dir); } fn write_dependencies(proj_dir: &Path) { let mut toml_path = PathBuf::from(proj_dir); toml_path.push("Cargo.toml"); OpenOptions::new() .append(true) .open(&toml_path) .expect("Couldn't find Cargo.toml") .write_all("hymns = { path = \"../../hymns\" }".as_bytes()) .expect("Couldn't write to Cargo.toml."); } fn extract_args() -> (u8, u8) { let mut args = env::args(); args.next(); // skip arg 0 let year = args .next() .and_then(|y_str| { if y_str.len() == 2 { y_str.parse().ok() } else { None } }) .expect("Expected a 2 digit year."); let problem_number = args .next() .and_then(|p_str| p_str.parse().ok()) .expect("Invalid problem number."); (year, problem_number) } fn create_package(year: u8, problem_number: u8) -> PathBuf { let formatted_name = format!("aoc{:02}-{:02}", year, problem_number); let package_dir: PathBuf = [ env!("CARGO_MANIFEST_DIR"), "..", &format!("20{:02}", year), &formatted_name, ] .iter() .collect(); let options = NewOptions::new( Some(NoVcs), true, false, package_dir.clone(), Some(formatted_name), None, None, ) .unwrap(); cargo::ops::new(&options, &Config::default().unwrap()).expect("Project already exists."); package_dir } fn create_input_file(proj_dir: &Path) { let input_file: PathBuf = [proj_dir.to_str().unwrap(), "input.txt"].iter().collect(); File::create(&input_file).expect("Could not create input file."); } fn copy_template(proj_dir: &Path) { let src: PathBuf = [env!("CARGO_MANIFEST_DIR"), "template.rs"].iter().collect(); let dst: PathBuf = [proj_dir.to_str().unwrap(), "src", "main.rs"] .iter() .collect(); copy(&src, &dst).expect("Could not copy template."); }
mod device; mod messages; mod noise; mod peer; mod timestamp; mod types; // publicly exposed interface pub use device::Device;
use jsonrpc_client_core::{expand_params, jsonrpc_client}; use jsonrpc_types::{ Block, BlockTemplate, Header, Node, Transaction, TransactionWithStatus, TxPoolInfo, TxTrace, }; use numext_fixed_hash::H256; jsonrpc_client!(pub struct RpcClient { pub fn local_node_info(&mut self) -> RpcRequest<Node>; pub fn get_peers(&mut self) -> RpcRequest<Vec<Node>>; pub fn add_node(&mut self, peer_id: String, address: String) -> RpcRequest<()>; pub fn get_block_template( &mut self, cycles_limit: Option<String>, bytes_limit: Option<String>, proposals_limit: Option<String>, max_version: Option<u32> ) -> RpcRequest<BlockTemplate>; pub fn submit_block(&mut self, work_id: String, data: Block) -> RpcRequest<Option<H256>>; pub fn send_transaction(&mut self, tx: Transaction) -> RpcRequest<H256>; pub fn tx_pool_info(&mut self) -> RpcRequest<TxPoolInfo>; pub fn trace_transaction(&mut self, tx: Transaction) -> RpcRequest<H256>; pub fn get_transaction_trace(&mut self, hash: H256) -> RpcRequest<Option<Vec<TxTrace>>>; pub fn get_block(&mut self, hash: H256) -> RpcRequest<Option<Block>>; pub fn get_transaction(&mut self, hash: H256) -> RpcRequest<Option<TransactionWithStatus>>; pub fn get_block_hash(&mut self, number: String) -> RpcRequest<Option<H256>>; pub fn get_tip_header(&mut self) -> RpcRequest<Header>; pub fn get_tip_block_number(&mut self) -> RpcRequest<String>; pub fn enqueue_test_transaction(&mut self, tx: Transaction) -> RpcRequest<H256>; });
extern mod rustcheck; use rustcheck::*; use std::*; fn prop_even(x : int) -> bool { return x % 2 == 0; } fn gen_even() -> int { let i : int = rustcheck::gen_int(); if i % 2 == 0 { i } else { i + 1 } } fn main() { for_all(prop_even, [gen_int]); for_all(prop_even, [gen_even]); }
use std::collections::HashMap; use serde::Deserialize; use serde_derive::{Serialize, Deserialize}; use erased_serde::Serialize; // macros use erased_serde::{serialize_trait_object, __internal_serialize_trait_object}; pub trait SerializeDebug: erased_serde::Serialize + std::fmt::Debug {} serialize_trait_object!(SerializeDebug); #[derive(Serialize, Deserialize, Debug)] pub struct RTEntity { id: String, } #[derive(Serialize, Debug)] pub struct NewQuery { pub query: Vec<String>, pub defs: Option<HashMap<String, Box<SerializeDebug>>>, } #[derive(Serialize, Debug)] pub struct NewStatement { template: String, values: Vec<Box<SerializeDebug>>, } impl NewStatement { pub fn new(template: String, values: Vec<Box<SerializeDebug>>) -> Self { NewStatement { template, values } } } #[derive(Deserialize, Debug)] pub struct QueryMatch { values: HashMap<String, String> } impl QueryMatch { pub fn get_value<'a, T>(&'a self, name: &str) -> Option<T> where T: Deserialize<'a> { self.values.get(name) .map(|val| serde_json::from_str::<T>(val).expect("no parsing errors")) } } pub trait RTVMHandle where Self: std::marker::Sized { fn new_entity() -> RTEntity; fn listen(query: NewQuery, callback: impl Fn(Self, Option<QueryMatch>)); fn insert(statement: NewStatement); }
//! This is the x86_64 implementation of the `AddressSpaceManager` trait. use super::paging::inactive_page_table::InactivePageTable; use super::paging::page_table_entry::*; use super::paging::page_table_manager::PageTableManager; use super::paging::{convert_flags, Page, PageFrame, CURRENT_PAGE_TABLE}; use super::PAGE_SIZE; use core::ptr; use memory::{address_space_manager, Address, AddressSpace, PageFlags, PhysicalAddress, VirtualAddress}; use super::{KERNEL_STACK_AREA_BASE, KERNEL_STACK_MAX_SIZE, KERNEL_STACK_OFFSET, USER_STACK_AREA_BASE, USER_STACK_MAX_SIZE, USER_STACK_OFFSET}; use multitasking::{Stack, ThreadID}; use multitasking::stack::AccessType; pub struct AddressSpaceManager { table: InactivePageTable } impl address_space_manager::AddressSpaceManager for AddressSpaceManager { fn new() -> AddressSpaceManager { AddressSpaceManager { table: InactivePageTable::copy_from_current() } } fn idle() -> AddressSpaceManager { AddressSpaceManager { table: InactivePageTable::from_current_table() } } fn write_to(&mut self, buffer: &[u8], address: VirtualAddress, flags: PageFlags) { let flags = convert_flags(flags); let start_page_num = address.page_num(); let end_page_num = (address + buffer.len() - 1).page_num() + 1; let mut current_offset = address.offset_in_page(); let mut current_buffer_position = 0; // For all pages. for page_num in start_page_num..end_page_num { let page_address = VirtualAddress::from_page_num(page_num); // First map with write permissions. self.table .change_permissions_or_map(Page::from_address(page_address), WRITABLE); // Get the physical address. let mut entry = self.table.get_entry_and_map(page_address); let physical_address = entry .points_to() .expect("The just mapped page isn't mapped."); // Write to the physical address. let (new_current_buffer_position, new_current_offset) = CURRENT_PAGE_TABLE .lock() .with_temporary_page(&PageFrame::from_address(physical_address), |page| { let start_address = page.get_address() + current_offset; let write_length = if (PAGE_SIZE - current_offset) >= buffer.len() - current_buffer_position { // If the rest fits within the page. buffer.len() - current_buffer_position } else { // There is still more to fill. PAGE_SIZE - current_offset }; unsafe { ptr::copy_nonoverlapping( buffer.as_ptr(), start_address.as_mut_ptr(), write_length ); } ( current_buffer_position + write_length, (current_offset + write_length) % PAGE_SIZE ) }); current_offset = new_current_offset; current_buffer_position = new_current_buffer_position; // Change to the desired flags. entry.set_flags(flags); } self.table.unmap(); } unsafe fn get_page_table_address(&self) -> PhysicalAddress { self.table.get_frame().get_address() } fn map_page(&mut self, page_address: VirtualAddress, flags: PageFlags) { let flags = convert_flags(flags); self.table.map_page(Page::from_address(page_address), flags); self.table.unmap(); } unsafe fn unmap_page(&mut self, start_address: VirtualAddress) { self.table.unmap_page(Page::from_address(start_address)); self.table.unmap(); } unsafe fn unmap_page_unchecked(&mut self, start_address: VirtualAddress) { self.table .unmap_page_unchecked(Page::from_address(start_address)); self.table.unmap(); } fn create_kernel_stack(id: ThreadID, address_space: &mut AddressSpace) -> Stack { let tid: usize = id.into(); Stack::new( 0x4000, KERNEL_STACK_MAX_SIZE, KERNEL_STACK_AREA_BASE + KERNEL_STACK_OFFSET * tid, AccessType::KernelOnly, Some(address_space) ) } fn create_user_stack(id: ThreadID, address_space: &mut AddressSpace) -> Stack { let tid: usize = id.into(); Stack::new( 0x2000, USER_STACK_MAX_SIZE, USER_STACK_AREA_BASE + USER_STACK_OFFSET * tid, AccessType::UserAccessible, Some(address_space) ) } fn create_idle_stack(cpu_id: usize) -> Stack { Stack::new( 0x3000, KERNEL_STACK_MAX_SIZE, KERNEL_STACK_AREA_BASE + KERNEL_STACK_OFFSET * cpu_id, AccessType::KernelOnly, None ) } }
use block::Block; use util::run_command; pub struct Title { max_chars: usize, } impl Title { pub fn new(max: usize) -> Title { Title { max_chars: max, } } pub fn get_title(&self) -> String { let title = run_command("xdotool getwindowname $(xdotool getactivewindow)"); // Truncate long titles if title.chars().count() > self.max_chars { let mut end = self.max_chars; // Don't end on a space while title.chars().nth(end - 1).unwrap() == ' ' { end -= 1; } return title.chars().take(end).collect::<String>() + "..."; } title } } impl Block for Title { fn new() -> Title { Title::new(50) } fn output(&self) -> String { self.get_title() } }
use super::token::literal::OperatorKind; use super::types::Type; #[derive(Debug, Clone)] pub enum Operator { Plus, Minus, Times, Devide, Equal, NotEqual, } impl Operator { pub fn from_ope_kind(kind: OperatorKind) -> Self { use OperatorKind::*; match kind { Plus => Operator::Plus, Minus => Operator::Minus, Times => Operator::Times, Devide => Operator::Devide, Equal => Operator::Equal, NotEqual => Operator::NotEqual, _ => unreachable!(), } } pub fn is_arithmetic(&self) -> bool { use Operator::*; match self { Plus | Minus | Times | Devide => true, _ => false, } } pub fn is_equivalence(&self) -> bool { use Operator::*; match self { Equal | NotEqual => true, _ => false, } } pub fn as_code(&self) -> String { use Operator::*; let s = match self { Plus => "add", Minus => "sub", Times => "mul", Devide => "sdiv", Equal => "eq", NotEqual => "ne", }; format!("{}", s) } pub fn type_check_binary(&self, l: Type, r: Type) -> bool { // TODO: 型を増やして処理を詳しくする. if self.is_arithmetic() { l == r } else if self.is_equivalence() { l == r } else { unreachable!() } } pub fn type_check_unary(&self, t: Type) -> bool { // TODO: 型を増やして処理を詳しくする. if self.is_arithmetic() { t == Type::int() } else { unreachable!() } } } impl std::fmt::Display for Operator { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { use Operator::*; match self { Plus => write!(f, "+"), Minus => write!(f, "-"), Times => write!(f, "*"), Devide => write!(f, "/"), Equal => write!(f, "=="), NotEqual => write!(f, "!="), } } }
#[doc = "Reader of register RCC_FMCCKSELR"] pub type R = crate::R<u32, super::RCC_FMCCKSELR>; #[doc = "Writer for register RCC_FMCCKSELR"] pub type W = crate::W<u32, super::RCC_FMCCKSELR>; #[doc = "Register RCC_FMCCKSELR `reset()`'s with value 0"] impl crate::ResetValue for super::RCC_FMCCKSELR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "FMCSRC\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum FMCSRC_A { #[doc = "0: aclk clock selected as kernel\r\n peripheral clock (default after\r\n reset)"] B_0X0 = 0, #[doc = "1: pll3_r_ck clock selected as kernel\r\n peripheral clock"] B_0X1 = 1, #[doc = "2: pll4_p_ck clock selected as kernel\r\n peripheral clock"] B_0X2 = 2, #[doc = "3: per_ck clock selected as kernel\r\n peripheral clock"] B_0X3 = 3, } impl From<FMCSRC_A> for u8 { #[inline(always)] fn from(variant: FMCSRC_A) -> Self { variant as _ } } #[doc = "Reader of field `FMCSRC`"] pub type FMCSRC_R = crate::R<u8, FMCSRC_A>; impl FMCSRC_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> FMCSRC_A { match self.bits { 0 => FMCSRC_A::B_0X0, 1 => FMCSRC_A::B_0X1, 2 => FMCSRC_A::B_0X2, 3 => FMCSRC_A::B_0X3, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == FMCSRC_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == FMCSRC_A::B_0X1 } #[doc = "Checks if the value of the field is `B_0X2`"] #[inline(always)] pub fn is_b_0x2(&self) -> bool { *self == FMCSRC_A::B_0X2 } #[doc = "Checks if the value of the field is `B_0X3`"] #[inline(always)] pub fn is_b_0x3(&self) -> bool { *self == FMCSRC_A::B_0X3 } } #[doc = "Write proxy for field `FMCSRC`"] pub struct FMCSRC_W<'a> { w: &'a mut W, } impl<'a> FMCSRC_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: FMCSRC_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "aclk clock selected as kernel peripheral clock (default after reset)"] #[inline(always)] pub fn b_0x0(self) -> &'a mut W { self.variant(FMCSRC_A::B_0X0) } #[doc = "pll3_r_ck clock selected as kernel peripheral clock"] #[inline(always)] pub fn b_0x1(self) -> &'a mut W { self.variant(FMCSRC_A::B_0X1) } #[doc = "pll4_p_ck clock selected as kernel peripheral clock"] #[inline(always)] pub fn b_0x2(self) -> &'a mut W { self.variant(FMCSRC_A::B_0X2) } #[doc = "per_ck clock selected as kernel peripheral clock"] #[inline(always)] pub fn b_0x3(self) -> &'a mut W { self.variant(FMCSRC_A::B_0X3) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03); self.w } } impl R { #[doc = "Bits 0:1 - FMCSRC"] #[inline(always)] pub fn fmcsrc(&self) -> FMCSRC_R { FMCSRC_R::new((self.bits & 0x03) as u8) } } impl W { #[doc = "Bits 0:1 - FMCSRC"] #[inline(always)] pub fn fmcsrc(&mut self) -> FMCSRC_W { FMCSRC_W { w: self } } }
use super::super::prelude::{ HICON }; pub type Icon = HICON; //TODO there some function define at : Icon Functions (Windows) need reinterfacing
use std::borrow::Cow; #[derive(Debug, serde::Serialize)] #[serde(rename_all = "snake_case", tag = "type")] pub enum TestCaseResult { Pass, Skip { kind: SkipKind, reason: String }, Recommendation { kind: String }, Failure { kind: FailureKind }, Error { kind: ErrorKind }, } #[derive(Debug, serde::Serialize)] #[serde(rename_all = "snake_case", tag = "type")] pub enum FailureKind { ServerError { status_code: u16 }, UnexpectedStatusCode { status_code: u16 }, ResponseConformance, ResponseHeadersConformance, ContentTypeConformance, RequestTimeout, MissingContentType, MalformedMediaType, } #[derive(Debug, serde::Serialize)] #[serde(rename_all = "snake_case", tag = "type")] pub enum ErrorKind { // Can not reliably reproduce the failure. Flaky, Unsatisfiable, // Schema is not valid. Schema, Internal, } #[derive(Debug, serde::Serialize)] #[serde(rename_all = "snake_case", tag = "type")] pub enum SkipKind { // Some assumption imposed by the fuzzer is not valid. InvalidAssumption, // Fuzzer can not test an endpoint. CanNotTest, // Not interesting in the research scope. NotInteresting, } #[derive(Debug, serde::Serialize)] pub struct TestCase<'a> { method: Option<Cow<'a, str>>, path: Option<Cow<'a, str>>, result: TestCaseResult, } impl<'a> TestCase<'a> { pub fn new( method: Option<impl Into<Cow<'a, str>>>, path: Option<impl Into<Cow<'a, str>>>, result: TestCaseResult, ) -> TestCase<'a> { TestCase { method: method.map(|x| x.into()), path: path.map(|x| x.into()), result, } } pub fn pass(method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>) -> TestCase<'a> { TestCase::new(Some(method), Some(path), TestCaseResult::Pass) } pub fn skip( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, kind: SkipKind, reason: String, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Skip { kind, reason }, ) } pub fn recommendation( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, kind: String, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Recommendation { kind }, ) } pub fn error( method: Option<impl Into<Cow<'a, str>>>, path: Option<impl Into<Cow<'a, str>>>, kind: ErrorKind, ) -> TestCase<'a> { TestCase::new(method, path, TestCaseResult::Error { kind }) } pub fn server_error( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, status_code: u16, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::ServerError { status_code }, }, ) } pub fn unexpected_status_code( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, status_code: u16, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::UnexpectedStatusCode { status_code }, }, ) } pub fn response_conformance( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::ResponseConformance, }, ) } pub fn content_type_conformance( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::ContentTypeConformance, }, ) } pub fn malformed_media_type( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::MalformedMediaType, }, ) } pub fn missing_content_type( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::MissingContentType, }, ) } pub fn response_headers_conformance( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::ResponseHeadersConformance, }, ) } pub fn request_timeout( method: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, ) -> TestCase<'a> { TestCase::new( Some(method), Some(path), TestCaseResult::Failure { kind: FailureKind::RequestTimeout, }, ) } }
pub mod beacon_state_accessors; pub mod beacon_state_mutators; pub mod crypto; pub mod math; pub mod misc; pub mod predicates;
use envconfig::Envconfig; #[derive(Envconfig)] pub struct Config { #[envconfig(from = "mutate_wall", default = "0.05")] pub mutate_wall: f64, #[envconfig(from = "mutate_passage", default = "0.05")] pub mutate_passage: f64, #[envconfig(from = "mutate_waypoint", default = "0.05")] pub mutate_waypoint: f64, #[envconfig(from = "add_wall", default = "0.1")] pub add_wall: f64, #[envconfig(from = "delete_wall", default = "0.005")] pub delete_wall: f64, #[envconfig(from = "add_waypoint", default = "0.1")] pub add_waypoint: f64, #[envconfig(from = "increase_size", default = "0.1")] pub increase_size: f64, #[envconfig(from = "cell_dimension", default = "32.0")] pub cell_dimension: f64, }
use crate::Result; use rumqtt::{MqttClient, QoS}; use std::sync::{Arc, Mutex}; pub struct Subscriber { client: Arc<Mutex<MqttClient>>, /// FIXME: resubscribe when clcean_session == true subscriptions: Vec<String>, } impl Subscriber { pub fn new(client: Arc<Mutex<MqttClient>>) -> Self { Self { client, subscriptions: Vec::new(), } } pub fn subscribe<S>(&mut self, topic: S) -> Result<()> where S: Into<String>, { let topic = topic.into(); loop { if let Ok(mut client) = self.client.try_lock() { client.subscribe(&topic, QoS::AtLeastOnce)?; self.subscriptions.push(topic); return Ok(()); } else { println!("WAIT"); } } // self.client.lock().unwrap().subscribe(&topic, QoS::AtLeastOnce)?; // self.subscriptions.push(topic); // Ok(()) } }
#[doc = "Register `OPTSR_PRG` reader"] pub type R = crate::R<OPTSR_PRG_SPEC>; #[doc = "Register `OPTSR_PRG` writer"] pub type W = crate::W<OPTSR_PRG_SPEC>; #[doc = "Field `BOR_LEV` reader - BOR reset level option configuration bits"] pub type BOR_LEV_R = crate::FieldReader; #[doc = "Field `BOR_LEV` writer - BOR reset level option configuration bits"] pub type BOR_LEV_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 2, O>; #[doc = "Field `IWDG1_HW` reader - IWDG1 option configuration bit"] pub type IWDG1_HW_R = crate::BitReader; #[doc = "Field `IWDG1_HW` writer - IWDG1 option configuration bit"] pub type IWDG1_HW_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `nRST_STOP_D1` reader - Option byte erase after D1 DStop option configuration bit"] pub type N_RST_STOP_D1_R = crate::BitReader; #[doc = "Field `nRST_STOP_D1` writer - Option byte erase after D1 DStop option configuration bit"] pub type N_RST_STOP_D1_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `nRST_STBY_D1` reader - Option byte erase after D1 DStandby option configuration bit"] pub type N_RST_STBY_D1_R = crate::BitReader; #[doc = "Field `nRST_STBY_D1` writer - Option byte erase after D1 DStandby option configuration bit"] pub type N_RST_STBY_D1_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `RDP` reader - Readout protection level option configuration byte"] pub type RDP_R = crate::FieldReader; #[doc = "Field `RDP` writer - Readout protection level option configuration byte"] pub type RDP_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 8, O>; #[doc = "Field `FZ_IWDG_STOP` reader - IWDG Stop mode freeze option configuration bit"] pub type FZ_IWDG_STOP_R = crate::BitReader; #[doc = "Field `FZ_IWDG_STOP` writer - IWDG Stop mode freeze option configuration bit"] pub type FZ_IWDG_STOP_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `FZ_IWDG_SDBY` reader - IWDG Standby mode freeze option configuration bit"] pub type FZ_IWDG_SDBY_R = crate::BitReader; #[doc = "Field `FZ_IWDG_SDBY` writer - IWDG Standby mode freeze option configuration bit"] pub type FZ_IWDG_SDBY_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `ST_RAM_SIZE` reader - DTCM size select option configuration bits"] pub type ST_RAM_SIZE_R = crate::FieldReader; #[doc = "Field `ST_RAM_SIZE` writer - DTCM size select option configuration bits"] pub type ST_RAM_SIZE_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 2, O>; #[doc = "Field `SECURITY` reader - Security option configuration bit"] pub type SECURITY_R = crate::BitReader; #[doc = "Field `SECURITY` writer - Security option configuration bit"] pub type SECURITY_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `RSS1` reader - User option configuration bit 1"] pub type RSS1_R = crate::BitReader; #[doc = "Field `RSS1` writer - User option configuration bit 1"] pub type RSS1_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `RSS2` reader - User option configuration bit 2"] pub type RSS2_R = crate::BitReader; #[doc = "Field `RSS2` writer - User option configuration bit 2"] pub type RSS2_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `IO_HSLV` reader - I/O high-speed at low-voltage (PRODUCT_BELOW_25V)"] pub type IO_HSLV_R = crate::BitReader; #[doc = "Field `IO_HSLV` writer - I/O high-speed at low-voltage (PRODUCT_BELOW_25V)"] pub type IO_HSLV_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `SWAP_BANK_OPT` reader - Bank swapping option configuration bit"] pub type SWAP_BANK_OPT_R = crate::BitReader; #[doc = "Field `SWAP_BANK_OPT` writer - Bank swapping option configuration bit"] pub type SWAP_BANK_OPT_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; impl R { #[doc = "Bits 2:3 - BOR reset level option configuration bits"] #[inline(always)] pub fn bor_lev(&self) -> BOR_LEV_R { BOR_LEV_R::new(((self.bits >> 2) & 3) as u8) } #[doc = "Bit 4 - IWDG1 option configuration bit"] #[inline(always)] pub fn iwdg1_hw(&self) -> IWDG1_HW_R { IWDG1_HW_R::new(((self.bits >> 4) & 1) != 0) } #[doc = "Bit 6 - Option byte erase after D1 DStop option configuration bit"] #[inline(always)] pub fn n_rst_stop_d1(&self) -> N_RST_STOP_D1_R { N_RST_STOP_D1_R::new(((self.bits >> 6) & 1) != 0) } #[doc = "Bit 7 - Option byte erase after D1 DStandby option configuration bit"] #[inline(always)] pub fn n_rst_stby_d1(&self) -> N_RST_STBY_D1_R { N_RST_STBY_D1_R::new(((self.bits >> 7) & 1) != 0) } #[doc = "Bits 8:15 - Readout protection level option configuration byte"] #[inline(always)] pub fn rdp(&self) -> RDP_R { RDP_R::new(((self.bits >> 8) & 0xff) as u8) } #[doc = "Bit 17 - IWDG Stop mode freeze option configuration bit"] #[inline(always)] pub fn fz_iwdg_stop(&self) -> FZ_IWDG_STOP_R { FZ_IWDG_STOP_R::new(((self.bits >> 17) & 1) != 0) } #[doc = "Bit 18 - IWDG Standby mode freeze option configuration bit"] #[inline(always)] pub fn fz_iwdg_sdby(&self) -> FZ_IWDG_SDBY_R { FZ_IWDG_SDBY_R::new(((self.bits >> 18) & 1) != 0) } #[doc = "Bits 19:20 - DTCM size select option configuration bits"] #[inline(always)] pub fn st_ram_size(&self) -> ST_RAM_SIZE_R { ST_RAM_SIZE_R::new(((self.bits >> 19) & 3) as u8) } #[doc = "Bit 21 - Security option configuration bit"] #[inline(always)] pub fn security(&self) -> SECURITY_R { SECURITY_R::new(((self.bits >> 21) & 1) != 0) } #[doc = "Bit 26 - User option configuration bit 1"] #[inline(always)] pub fn rss1(&self) -> RSS1_R { RSS1_R::new(((self.bits >> 26) & 1) != 0) } #[doc = "Bit 27 - User option configuration bit 2"] #[inline(always)] pub fn rss2(&self) -> RSS2_R { RSS2_R::new(((self.bits >> 27) & 1) != 0) } #[doc = "Bit 29 - I/O high-speed at low-voltage (PRODUCT_BELOW_25V)"] #[inline(always)] pub fn io_hslv(&self) -> IO_HSLV_R { IO_HSLV_R::new(((self.bits >> 29) & 1) != 0) } #[doc = "Bit 31 - Bank swapping option configuration bit"] #[inline(always)] pub fn swap_bank_opt(&self) -> SWAP_BANK_OPT_R { SWAP_BANK_OPT_R::new(((self.bits >> 31) & 1) != 0) } } impl W { #[doc = "Bits 2:3 - BOR reset level option configuration bits"] #[inline(always)] #[must_use] pub fn bor_lev(&mut self) -> BOR_LEV_W<OPTSR_PRG_SPEC, 2> { BOR_LEV_W::new(self) } #[doc = "Bit 4 - IWDG1 option configuration bit"] #[inline(always)] #[must_use] pub fn iwdg1_hw(&mut self) -> IWDG1_HW_W<OPTSR_PRG_SPEC, 4> { IWDG1_HW_W::new(self) } #[doc = "Bit 6 - Option byte erase after D1 DStop option configuration bit"] #[inline(always)] #[must_use] pub fn n_rst_stop_d1(&mut self) -> N_RST_STOP_D1_W<OPTSR_PRG_SPEC, 6> { N_RST_STOP_D1_W::new(self) } #[doc = "Bit 7 - Option byte erase after D1 DStandby option configuration bit"] #[inline(always)] #[must_use] pub fn n_rst_stby_d1(&mut self) -> N_RST_STBY_D1_W<OPTSR_PRG_SPEC, 7> { N_RST_STBY_D1_W::new(self) } #[doc = "Bits 8:15 - Readout protection level option configuration byte"] #[inline(always)] #[must_use] pub fn rdp(&mut self) -> RDP_W<OPTSR_PRG_SPEC, 8> { RDP_W::new(self) } #[doc = "Bit 17 - IWDG Stop mode freeze option configuration bit"] #[inline(always)] #[must_use] pub fn fz_iwdg_stop(&mut self) -> FZ_IWDG_STOP_W<OPTSR_PRG_SPEC, 17> { FZ_IWDG_STOP_W::new(self) } #[doc = "Bit 18 - IWDG Standby mode freeze option configuration bit"] #[inline(always)] #[must_use] pub fn fz_iwdg_sdby(&mut self) -> FZ_IWDG_SDBY_W<OPTSR_PRG_SPEC, 18> { FZ_IWDG_SDBY_W::new(self) } #[doc = "Bits 19:20 - DTCM size select option configuration bits"] #[inline(always)] #[must_use] pub fn st_ram_size(&mut self) -> ST_RAM_SIZE_W<OPTSR_PRG_SPEC, 19> { ST_RAM_SIZE_W::new(self) } #[doc = "Bit 21 - Security option configuration bit"] #[inline(always)] #[must_use] pub fn security(&mut self) -> SECURITY_W<OPTSR_PRG_SPEC, 21> { SECURITY_W::new(self) } #[doc = "Bit 26 - User option configuration bit 1"] #[inline(always)] #[must_use] pub fn rss1(&mut self) -> RSS1_W<OPTSR_PRG_SPEC, 26> { RSS1_W::new(self) } #[doc = "Bit 27 - User option configuration bit 2"] #[inline(always)] #[must_use] pub fn rss2(&mut self) -> RSS2_W<OPTSR_PRG_SPEC, 27> { RSS2_W::new(self) } #[doc = "Bit 29 - I/O high-speed at low-voltage (PRODUCT_BELOW_25V)"] #[inline(always)] #[must_use] pub fn io_hslv(&mut self) -> IO_HSLV_W<OPTSR_PRG_SPEC, 29> { IO_HSLV_W::new(self) } #[doc = "Bit 31 - Bank swapping option configuration bit"] #[inline(always)] #[must_use] pub fn swap_bank_opt(&mut self) -> SWAP_BANK_OPT_W<OPTSR_PRG_SPEC, 31> { SWAP_BANK_OPT_W::new(self) } #[doc = "Writes raw bits to the register."] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } } #[doc = "FLASH option status register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`optsr_prg::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`optsr_prg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] pub struct OPTSR_PRG_SPEC; impl crate::RegisterSpec for OPTSR_PRG_SPEC { type Ux = u32; } #[doc = "`read()` method returns [`optsr_prg::R`](R) reader structure"] impl crate::Readable for OPTSR_PRG_SPEC {} #[doc = "`write(|w| ..)` method takes [`optsr_prg::W`](W) writer structure"] impl crate::Writable for OPTSR_PRG_SPEC { const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; } #[doc = "`reset()` method sets OPTSR_PRG to value 0"] impl crate::Resettable for OPTSR_PRG_SPEC { const RESET_VALUE: Self::Ux = 0; }
use std::error::Error; use std::net::SocketAddr; use futures::{future, Future, Stream}; use hyper; use hyper::{Body, Method, Request, Response, StatusCode}; use serde_json as json; use nodes; use nodes::{NodeInfo, NodeKeys}; use log; #[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Clone)] pub struct ValidatorInfo(NodeKeys, NodeInfo); pub type ResponseFuture = Box<Future<Item = Response<Body>, Error = hyper::Error> + Send + 'static>; pub fn serve(req: Request<Body>, addr: SocketAddr) -> ResponseFuture { info!(log::SERVER, "Processing request"; "remote" => %addr, "method" => %req.method(), "uri" => %req.uri()); match (req.method(), req.uri().path()) { (&Method::GET, "/nodes") => get_nodes(), (&Method::POST, "/nodes") => post_node(req.into_body(), addr), _ => Box::new(future::ok( Response::builder() .status(StatusCode::NOT_FOUND) .body(Body::empty()) .unwrap(), )), } } fn get_nodes() -> ResponseFuture { let nodes = json::to_string_pretty(&nodes::list()).expect("Unable to deserialize nodes list."); Box::new(future::ok(Response::new(nodes.into()))) } fn update_peer(vi: ValidatorInfo) -> ResponseFuture { nodes::update(vi.0, vi.1); Box::new(future::ok(Response::new(Body::empty()))) } fn post_node(body: Body, addr: SocketAddr) -> ResponseFuture { let post = body .concat2() .and_then(move |v| match json::from_slice::<ValidatorInfo>(&v) { Ok(mut info) => { let fix_addr = |reported: &mut String| { let offset = reported.find(':').unwrap_or(reported.len()); reported.replace_range(..offset, &format!("{}", addr.ip())); }; fix_addr(&mut info.1.public); fix_addr(&mut info.1.private); fix_addr(&mut info.1.peer); update_peer(info) } Err(e) => Box::new(future::ok( Response::builder() .status(StatusCode::BAD_REQUEST) .body(e.description().to_string().into()) .unwrap(), )), }); Box::new(post) }
use super::{color::Color, TexstureLayer}; use crate::JsObject; use std::{cell::Cell, ops::Deref, rc::Rc}; use wasm_bindgen::prelude::*; pub struct Table { name: String, size: [f64; 2], pixel_ratio: [f64; 2], is_bind_to_grid: bool, drawing_texture: TexstureLayer, drawing_texture_is_changed: Cell<bool>, measure_texture: TexstureLayer, measure_texture_is_changed: bool, image_texture_id: Option<u128>, } pub struct TableData(JsObject); impl Table { pub fn new() -> Self { let texture_width = 4096; let texture_height = 4096; let size = [1.0, 1.0]; let pixel_ratio = [1.0, 1.0]; Self { name: "テーブル".into(), size, pixel_ratio, is_bind_to_grid: true, drawing_texture: TexstureLayer::new(&[texture_width, texture_height]), drawing_texture_is_changed: Cell::new(true), measure_texture: TexstureLayer::new(&[texture_width, texture_height]), measure_texture_is_changed: true, image_texture_id: None, } } pub fn set_name(&mut self, name: String) { self.name = name; } pub fn name(&self) -> &String { &self.name } pub fn set_size(&mut self, size: [f64; 2]) { let new_pixel_ratio = [4096.0 / size[0], 4096.0 / size[1]]; let _ = self.drawing_texture.context().scale( new_pixel_ratio[0] / self.pixel_ratio[0], new_pixel_ratio[1] / self.pixel_ratio[1], ); let _ = self.measure_texture.context().scale( new_pixel_ratio[0] / self.pixel_ratio[0], new_pixel_ratio[1] / self.pixel_ratio[1], ); self.pixel_ratio = new_pixel_ratio; self.size = size; } pub fn size(&self) -> &[f64; 2] { &self.size } pub fn set_is_bind_to_grid(&mut self, is_bind_to_grid: bool) { self.is_bind_to_grid = is_bind_to_grid; } pub fn is_bind_to_grid(&self) -> bool { self.is_bind_to_grid } pub fn drawing_texture_element(&self) -> Option<&web_sys::HtmlCanvasElement> { if self.drawing_texture_is_changed.get() { Some(self.drawing_texture.element()) } else { None } } pub fn measure_texture_element(&self) -> Option<&web_sys::HtmlCanvasElement> { if self.measure_texture_is_changed { Some(self.measure_texture.element()) } else { None } } pub fn image_texture_id(&self) -> Option<&u128> { self.image_texture_id.as_ref() } pub fn set_image_texture_id(&mut self, data_id: u128) { self.image_texture_id = Some(data_id); } pub fn rendered(&mut self) { self.clear_measure(); self.drawing_texture_is_changed.set(false); self.measure_texture_is_changed = false; } fn set_img(&self, img: &web_sys::HtmlImageElement) { let context = self.drawing_texture.context(); let _ = context.draw_image_with_html_image_element_and_dw_and_dh( img, 0.0, 0.0, 4096.0 / self.pixel_ratio[0], 4096.0 / self.pixel_ratio[1], ); self.drawing_texture_is_changed.set(true); } fn get_texture_position(&self, position: &[f64; 2], ignore_binding: bool) -> [f64; 2] { let p = position; let p = if self.is_bind_to_grid && !ignore_binding { [(p[0] * 2.0).round() / 2.0, (p[1] * 2.0).round() / 2.0] } else { [p[0], p[1]] }; [(p[0] + self.size[0] / 2.0), -(p[1] - self.size[1] / 2.0)] } pub fn draw_cursor( &self, position: &[f64; 2], _radius: f64, _outer_color: Color, _inner_color: Color, ) { let _context = self.drawing_texture.context(); let [_px, _py] = self.get_texture_position(position, false); } pub fn draw_line(&mut self, begin: &[f64; 2], end: &[f64; 2], color: Color, line_width: f64) { let context = self.drawing_texture.context(); let [bx, by] = self.get_texture_position(begin, true); let [ex, ey] = self.get_texture_position(end, true); context.set_line_width(line_width); context.set_line_cap("round"); context.set_stroke_style(&color.to_jsvalue()); context .set_global_composite_operation("source-over") .unwrap(); context.begin_path(); context.move_to(bx, by); context.line_to(ex, ey); context.fill(); context.stroke(); self.drawing_texture_is_changed.set(true); } pub fn erace_line(&mut self, begin: &[f64; 2], end: &[f64; 2], line_width: f64) { let context = self.drawing_texture.context(); let [bx, by] = self.get_texture_position(begin, true); let [ex, ey] = self.get_texture_position(end, true); context .set_global_composite_operation("destination-out") .unwrap(); context.set_line_width(line_width); context.set_line_cap("round"); context.begin_path(); context.move_to(bx, by); context.line_to(ex, ey); context.fill(); context.stroke(); context .set_global_composite_operation("source-over") .unwrap(); self.drawing_texture_is_changed.set(true); } pub fn draw_measure( &mut self, begin: &[f64; 2], end: &[f64; 2], color: Color, line_width: f64, with_cirlce: bool, ) -> f64 { let context = self.measure_texture.context(); let [bx, by] = self.get_texture_position(begin, false); let [ex, ey] = self.get_texture_position(end, false); let radious = ((ex - bx).powi(2) + (ey - by).powi(2)).sqrt(); context.set_line_width(line_width); context.set_line_cap("butt"); context.set_stroke_style(&color.to_jsvalue()); context.set_fill_style(&JsValue::from("transparent")); context .set_global_composite_operation("source-over") .expect(""); context.begin_path(); context.move_to(bx, by); context.line_to(ex, ey); context.move_to(bx + radious, by); if with_cirlce { let _ = context.arc(bx, by, radious, 0.0, 2.0 * std::f64::consts::PI); } context.fill(); context.stroke(); self.measure_texture_is_changed = true; radious } pub fn clear_measure(&mut self) { let context = self.measure_texture.context(); context.clear_rect(0.0, 0.0, self.size[0], self.size[1]); self.measure_texture_is_changed = true; } pub fn as_data(&self) -> TableData { TableData(object! { name: &self.name, size: array![self.size[0], self.size[1]], is_bind_to_grid: self.is_bind_to_grid, drawing_texture: self.drawing_texture.element().to_data_url().unwrap(), image_texture_id: self.image_texture_id.map(|x| x.to_string()) }) } } impl Into<Rc<Table>> for TableData { fn into(self) -> Rc<Table> { use js_sys::Array; use wasm_bindgen::JsCast; let obj = self.0; let name = obj .get("name") .and_then(|x| x.as_string()) .unwrap_or(String::from("")); let size = Array::from(&obj.get("size").unwrap()); let size = [size.get(0).as_f64().unwrap(), size.get(1).as_f64().unwrap()]; let drawing_texture = obj.get("drawing_texture").unwrap().as_string().unwrap(); let is_bind_to_grid = obj.get("is_bind_to_grid").unwrap().as_bool().unwrap(); let image_texture_id = obj .get("image_texture_id") .and_then(|x| x.as_string()) .and_then(|x| x.parse().ok()); let texture_width = 4096; let texture_height = 4096; let mut table = Table { name, size: [1.0, 1.0], pixel_ratio: [1.0, 1.0], is_bind_to_grid: is_bind_to_grid, drawing_texture: TexstureLayer::new(&[texture_width, texture_height]), drawing_texture_is_changed: Cell::new(true), measure_texture: TexstureLayer::new(&[texture_width, texture_height]), measure_texture_is_changed: true, image_texture_id: image_texture_id, }; table.set_size(size); let table = Rc::new(table); let img = Rc::new(crate::util::html_image_element()); let a = { let table = Rc::clone(&table); let img = Rc::clone(&img); Closure::once(Box::new(move || { table.set_img(&img); })) }; img.set_onload(Some(&a.as_ref().unchecked_ref())); a.forget(); img.set_src(&drawing_texture); table } } impl Into<JsObject> for TableData { fn into(self) -> JsObject { self.0 } } impl From<JsObject> for TableData { fn from(obj: JsObject) -> Self { Self(obj) } } impl Deref for TableData { type Target = JsObject; fn deref(&self) -> &Self::Target { &self.0 } }
#![no_main] #![no_std] extern crate cortex_m_rt; extern crate panic_halt; use cortex_m_rt::{entry, exception}; #[entry] fn foo() -> ! { loop {} } #[exception] fn DefaultHandler(_irq: i16) {} //~^ ERROR defining a `DefaultHandler` is unsafe and requires an `unsafe fn` #[exception] fn HardFault() {} //~^ ERROR defining a `HardFault` handler is unsafe and requires an `unsafe fn` #[exception] fn NonMaskableInt() {} //~^ ERROR defining a `NonMaskableInt` handler is unsafe and requires an `unsafe fn`
#[doc = "Reader of register MDMA_C7ISR"] pub type R = crate::R<u32, super::MDMA_C7ISR>; #[doc = "TEIF7\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TEIF7_A { #[doc = "0: No transfer error on stream\r\n x"] B_0X0 = 0, #[doc = "1: A transfer error occurred on stream\r\n x"] B_0X1 = 1, } impl From<TEIF7_A> for bool { #[inline(always)] fn from(variant: TEIF7_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TEIF7`"] pub type TEIF7_R = crate::R<bool, TEIF7_A>; impl TEIF7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TEIF7_A { match self.bits { false => TEIF7_A::B_0X0, true => TEIF7_A::B_0X1, } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == TEIF7_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == TEIF7_A::B_0X1 } } #[doc = "CTCIF7\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CTCIF7_A { #[doc = "0: No channel transfer complete event\r\n on channel x"] B_0X0 = 0, #[doc = "1: A channel transfer complete event\r\n occurred on channel x"] B_0X1 = 1, } impl From<CTCIF7_A> for bool { #[inline(always)] fn from(variant: CTCIF7_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `CTCIF7`"] pub type CTCIF7_R = crate::R<bool, CTCIF7_A>; impl CTCIF7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CTCIF7_A { match self.bits { false => CTCIF7_A::B_0X0, true => CTCIF7_A::B_0X1, } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == CTCIF7_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == CTCIF7_A::B_0X1 } } #[doc = "BRTIF7\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum BRTIF7_A { #[doc = "0: No block repeat transfer complete\r\n event on channel x"] B_0X0 = 0, #[doc = "1: A block repeat transfer complete\r\n event occurred on channel x"] B_0X1 = 1, } impl From<BRTIF7_A> for bool { #[inline(always)] fn from(variant: BRTIF7_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `BRTIF7`"] pub type BRTIF7_R = crate::R<bool, BRTIF7_A>; impl BRTIF7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> BRTIF7_A { match self.bits { false => BRTIF7_A::B_0X0, true => BRTIF7_A::B_0X1, } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == BRTIF7_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == BRTIF7_A::B_0X1 } } #[doc = "BTIF7\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum BTIF7_A { #[doc = "0: No block transfer complete event on\r\n channel x"] B_0X0 = 0, #[doc = "1: A block transfer complete event\r\n occurred on channel x"] B_0X1 = 1, } impl From<BTIF7_A> for bool { #[inline(always)] fn from(variant: BTIF7_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `BTIF7`"] pub type BTIF7_R = crate::R<bool, BTIF7_A>; impl BTIF7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> BTIF7_A { match self.bits { false => BTIF7_A::B_0X0, true => BTIF7_A::B_0X1, } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == BTIF7_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == BTIF7_A::B_0X1 } } #[doc = "TCIF7\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TCIF7_A { #[doc = "0: No buffer transfer complete event on\r\n channel x"] B_0X0 = 0, #[doc = "1: A buffer transfer complete event\r\n occurred on channel x"] B_0X1 = 1, } impl From<TCIF7_A> for bool { #[inline(always)] fn from(variant: TCIF7_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TCIF7`"] pub type TCIF7_R = crate::R<bool, TCIF7_A>; impl TCIF7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TCIF7_A { match self.bits { false => TCIF7_A::B_0X0, true => TCIF7_A::B_0X1, } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == TCIF7_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == TCIF7_A::B_0X1 } } #[doc = "CRQA7\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CRQA7_A { #[doc = "0: The MDMA transfer RQ is inactive for\r\n channel x."] B_0X0 = 0, #[doc = "1: The MDMA transfer RQ is active for\r\n channel x"] B_0X1 = 1, } impl From<CRQA7_A> for bool { #[inline(always)] fn from(variant: CRQA7_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `CRQA7`"] pub type CRQA7_R = crate::R<bool, CRQA7_A>; impl CRQA7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CRQA7_A { match self.bits { false => CRQA7_A::B_0X0, true => CRQA7_A::B_0X1, } } #[doc = "Checks if the value of the field is `B_0X0`"] #[inline(always)] pub fn is_b_0x0(&self) -> bool { *self == CRQA7_A::B_0X0 } #[doc = "Checks if the value of the field is `B_0X1`"] #[inline(always)] pub fn is_b_0x1(&self) -> bool { *self == CRQA7_A::B_0X1 } } impl R { #[doc = "Bit 0 - TEIF7"] #[inline(always)] pub fn teif7(&self) -> TEIF7_R { TEIF7_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - CTCIF7"] #[inline(always)] pub fn ctcif7(&self) -> CTCIF7_R { CTCIF7_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - BRTIF7"] #[inline(always)] pub fn brtif7(&self) -> BRTIF7_R { BRTIF7_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - BTIF7"] #[inline(always)] pub fn btif7(&self) -> BTIF7_R { BTIF7_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - TCIF7"] #[inline(always)] pub fn tcif7(&self) -> TCIF7_R { TCIF7_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 16 - CRQA7"] #[inline(always)] pub fn crqa7(&self) -> CRQA7_R { CRQA7_R::new(((self.bits >> 16) & 0x01) != 0) } }
use std::io::Write; use std::io::BufReader; use std::io::BufRead; fn main() { let mut rd = BufReader::new(std::io::stdin()); let stdin = std::str::from_utf8; let mut input = Vec::new(); rd.read_until(b'\n', &mut input).unwrap(); let n: i32 = stdin(&mut input).unwrap() .trim().parse().unwrap(); let mut b = [0; 10001]; input.clear(); for _ in 0..n { rd.read_until(b'\n',&mut input).unwrap(); b[stdin(&mut input).unwrap() .trim().parse::<usize>().unwrap()]+=1; input.clear(); } for i in 1..10001 { input.clear(); if b[i]!=0{ for _ in 0..b[i] { write!(input,"{}\n", i).unwrap(); } print!("{}", stdin(&input).unwrap()); } } } // fn to_int (buf: Vec<u8>) -> usize { // let mut n: usize = 0; // for i in buf[..buf.len()-2].iter().enumerate(){ // n = n*10 + (*(i.1)-b'0') as usize; // } // return n // } // fn main() { // let mut rd = BufReader::new(std::io::stdin()); // let mut v = Vec::new(); // rd.read_until(b'\n', &mut v).unwrap(); // let n: usize = to_int(v.clone()); // let mut b = [0; 10001]; // v.clear(); // for _ in 0..n { // rd.read_until(b'\n', &mut v).unwrap(); // b[to_int(v.clone())]+=1; // v.clear(); // } // for i in 1..10001 { // if b[i]!=0 { // for _ in 0..b[i] { // write!(v, "{}\n", i).unwrap(); // } // print!("{}", std::str::from_utf8(&v).unwrap()); // v.clear(); // } // } // }
//! Testing doctest with tarpaulin use std::env; use std::path::PathBuf; // doctest /// Get my own package path for e.g. setting configuration from /// ```rust /// # use test_tarpaulin_env::cargo_manifest_path::*; /// # use std::path::PathBuf; /// # /// # fn main() { /// let test_dir = get_my_path("test_data"); /// assert_ne!(test_dir, PathBuf::from("")); /// println!("test_dir evaluated to = lossy?:{}", test_dir.display()); /// # } /// ``` // the below will panic! as bug when CARGO_MANIFEST_DIR cannot be unwrapped pub fn get_my_path(test_dir_name: &str) -> PathBuf { let mut test_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); test_dir.push("tests"); test_dir.push("data"); test_dir.push(test_dir_name); test_dir } #[cfg(test)] mod tests { use super::*; #[test] fn cargo_manifest_path() { let test_dir = get_my_path(""); println!("Test dir evaluated to = {}", test_dir.display()); assert_ne!(test_dir, PathBuf::from("")); } }