content
stringlengths
12
392k
id
int64
0
1.08k
pub fn write_bin_len<W>(wr: &mut W, len: u32) -> Result<Marker, ValueWriteError> where W: Write { if len < 256 { try!(write_marker(wr, Marker::Bin8)); write_data_u8(wr, len as u8).and(Ok(Marker::Bin8)) } else if len < 65536 { try!(write_marker(wr, Marker::Bin16)); write_data_...
800
fn test_invalid_variable_4() { let parsed_data = parse(&"$invalid: [ 1, 2, 3]"); assert!(parsed_data .unwrap_err() .downcast_ref::<ParseError>() .is_some()); }
801
pub fn quick_sort_rayon<T: Send + PartialOrd + Debug>(v: &mut[T]) { if v.len() <= 1 { return; } let p = pivot(v); println!("{:?}", v); let (a, b) = v.split_at_mut(p); // put f2 on queue then start f1; // if another thread is ready it will steal f2 // this works recursively recurs...
802
fn sub(value: i32) -> i32 { value - 1 }
803
fn store ( & self _val : ( ) _order : Ordering ) { }
804
pub fn readline_and_print() -> io::Result<()> { let f = File::open("/Users/liwei/coding/rust/git/rust/basic/fs/Cargo.toml")?; let f = BufReader::new(f); for line in f.lines() { if let Ok(line) = line { println!("{:?}", line); } } Ok(()) }
805
fn yield_spin_loop_unfair() { yield_spin_loop(false); }
806
fn to_rust_typestr(s: &str) -> String { use inflector::cases::pascalcase::to_pascal_case; let s = to_pascal_case(s); fixup(s) }
807
fn find_first_zero_space_node(nodes: & HashMap<String, Node>, from: &Node) -> Option<Node> { let mut scan_list: Vec<&Node> = vec![from]; let mut used_list: HashSet<String> = HashSet::new(); loop { let mut temp_list: Vec<&Node> = Vec::new(); let mut any_found = false; for node in &sca...
808
fn download_and_verify(url: &str, hash: &str) -> crate::Result<Vec<u8>> { common::print_info(format!("Downloading {}", url).as_str())?; let response = attohttpc::get(url).send()?; let data: Vec<u8> = response.bytes()?; common::print_info("validating hash")?; let mut hasher = sha2::Sha256::new(); hasher....
809
pub fn ap(f: Value, arg: Value) -> Value { Rc::new(RefCell::new(V { val: Value_::Apply(f, arg), computed: false, })) }
810
fn func_2() { if func_1() != Some( CONSTANT ) { unsafe { abort(); } } }
811
fn inc_8() { run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(IndirectScaledDisplaced(EAX, Two, 1716018741, Some(OperandSize::Byte), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[254, 4, 69, 53,...
812
fn init() { let project = project("init").build(); project.cargo_fuzz().arg("init").assert().success(); assert!(project.fuzz_dir().is_dir()); assert!(project.fuzz_cargo_toml().is_file()); assert!(project.fuzz_targets_dir().is_dir()); assert!(project.fuzz_target_path("fuzz_target_1").is_file()); ...
813
fn any_method_supports_media(resources: &[Resource]) -> bool { resources.iter().any(|resource| { resource .methods .iter() .any(|method| method.supports_media_download || method.media_upload.is_some()) }) }
814
fn inc_1() { run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(Direct(DX)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[66], OperandSize::Word) }
815
fn main() { println!("Visit http://localhost:8080 to try this example."); //Read the page before we start let page = Arc::new(read_string("examples/handler_storage/page.html").unwrap()); //The shared counter state let value = Arc::new(RwLock::new(0)); let router = insert_routes!{ Tree...
816
async fn fallback_route(_req: HttpRequest) -> impl Responder { HttpResponse::NotFound().json("Route not found") }
817
pub fn bit_xor<E, CS>(cs: CS, left: &Scalar<E>, right: &Scalar<E>) -> Result<Scalar<E>, Error> where E: IEngine, CS: ConstraintSystem<E>, { fn inner<E, CS>(mut cs: CS, left: &Scalar<E>, right: &Scalar<E>) -> Result<Scalar<E>, Error> where E: IEngine, CS: ConstraintSystem<E>, { ...
818
pub fn load ( & self ) - > T { unsafe { atomic_load ( self . as_ptr ( ) ) } }
819
fn inc_12() { run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(IndirectScaledIndexedDisplaced(RDI, RDI, Four, 553850230, Some(OperandSize::Byte), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[25...
820
fn find_single_byte_key(data: &[u8]) -> u8 { let mut best_key = 0; let mut best_score = 1_000_000f64; for x in 0..255 { let decrypt = utils::single_byte_xor(&data, x); let score = freq_analysis::text_score(&decrypt); if score <= best_score { best_score = score; ...
821
pub fn u_le8(x: u64, y: u64) -> u64 { ((((y | H8) - (x & !H8)) | (x ^ y)) ^ (x & !y)) & H8 }
822
fn parseLightInfo(reader: &mut BufReader<&File>, buf: &mut String, lights: &mut Vec<Light>) -> Model { let mut light = Light { lightType: "" as str, radius: 0.0, period: 0, position: Vec3f::new(0.0, 0.0, 0.0), Color: Vec3f::new(0.0, 0.0, 0.0), }; //Firstly, re...
823
fn main() { let nhits = 20; let ntrials = 2000; let nnanos = 60 * 1000 * 1000 * 1000; let ntransfers = 1000; let nbrokers = 8; let tolerance = 0.05; let ops = (ntransfers * nbrokers) as f64; let million = (1000 * 1000) as f64; let mut sum = 0.0; let mut hits = 0; let mut trial = 0; let limit ...
824
fn split_node(ng: &mut NameGen, beta: &RcNode) { let t = beta.get_body(); match &*t { Term::CFG { kind, name, args } => { let names1 = ng.fresh_name_list(args.len()); let args1 = names1.iter().map(|x| Term::var(x)).collect(); let t1 = Term::mk_cfg(kind.clone(), name, ...
825
pub fn cmp_op(inputs: OpInputs) -> EmulatorResult<()> { // CMP compares the A-value to the B-value. If the result of the // comparison is equal, the instruction after the next instruction // (PC + 2) is queued (skipping the next instruction). Otherwise, the // the next instruction is queued (PC + 1). ...
826
fn wrap_use<T: quote::ToTokens>(name: syn::Ident, ty: &str, content: &T) -> quote::Tokens { let dummy_const = syn::Ident::new(&format!("_IMPL_{}_FOR_{}", ty.to_uppercase(), name), Span::call_site()); quote! { #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] const #dumm...
827
pub extern "x86-interrupt" fn break_point() { CommonExceptionHandler( 3); }
828
fn write_fixval<W>(wr: &mut W, marker: Marker) -> Result<(), FixedValueWriteError> where W: Write { wr.write_u8(marker.to_u8()).map_err(|err| FixedValueWriteError(From::from(err))) }
829
fn main() { env_logger::init_from_env(Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "warn")); example!(Six; RunFor::Part1, (), "COM)B\nB)C\nC)D\nD)E\nE)F\nB)G\nG)H\nD)I\nE)J\nJ)K\nK)L", RunFor::Part2, (), "COM)B\nB)C\nC)D\nD)E\nE)F\nB)G\nG)H\nD)I\nE)J\nJ)K\nK)L\nK)YOU\nI)SAN" ); ...
830
fn schema_id_to_ident(id: &str) -> syn::Ident { to_ident(&to_rust_typestr(id)) }
831
fn bench_topology(c: &mut Criterion, bench_name: &'static str) { let num_lines: usize = 10_000; let line_size: usize = 100; let in_addr = next_addr(); let out_addr = next_addr(); let mut group = c.benchmark_group(format!("{}/{}", bench_name, "topology")); group.sampling_mode(SamplingMode::Flat...
832
fn mac_to_string(mac: Option<MacAddr>) -> String { match mac { Some(m) => m.to_string(), None => "Unknown mac address".to_string(), } }
833
pub fn update_future<'a, C, I, P>( config: &'a Config, vidx_list: I, client: &'a Client<C, Body>, logger: &'a Logger, progress: P ) -> impl Future<Item = Vec<PathBuf>, Error = Error> + 'a where C: Connect, I: IntoIterator<Item = String> + 'a, P: DownloadProgress + 'a, { l...
834
pub fn threaded_quick_sort<T: 'static + PartialOrd + Debug + Send>(v: &mut [T]) { if v.len() <= 1 { return; } let p = pivot(v); println!("{:?}", v); let (a, b) = v.split_at_mut(p); let raw_a = a as *mut [T]; let raw_s = RawSend(raw_a); unsafe { let handle = std::thread::s...
835
pub fn render() { // let a = ext_rec(); // let some = a.calcArea(); // log!("got event! {}", some); // log!("got event!"); let app = seed::App::build(|_, _| Model::default(), update, view) .finish() .run(); app.update(Msg::FetchData); }
836
fn system_call_take_payload<T: Any + Clone>(message: SystemCall) -> (SystemCall, T) { use core::mem::{size_of}; let addr = task_buffer_addr(); unsafe { let buffer = &mut *(addr as *mut TaskBuffer); buffer.call = Some(message); system_call_raw(); let payload_addr = &mut buf...
837
fn help() { cargo_fuzz().arg("help").assert().success(); }
838
fn criterion_benchmark(c: &mut Criterion) { let mut group = c.benchmark_group("fyrstikker"); group.sampling_mode(SamplingMode::Flat).sample_size(10); group.bench_function("fyrstikker 40", |b| { b.iter(|| fyrstikk_tal_kombinasjonar(40)) }); group.bench_function("fyrstikker 2000", |b| { ...
839
fn main() { let num = input("Ingrese un número: ") .unwrap() .parse::<i32>() .expect("Expected a number"); if num % 2 == 0 { println!("`{}` es un número par.", num); } else { println!("`{}` es un número impar", num); } }
840
pub fn median_filter(frame : ImageBuffer<Luma<u8>, Vec<u8>>) -> ImageBuffer<Luma<u8>, Vec<u8>> { let mut result = ImageBuffer::new(640, 480); let mut kernel = [0; 9]; for i in 1..638 { for j in 1..478 { // Fill the kernel for k in 0..3 { for l in 0..3 { ...
841
fn get_submodules( repo: &Repository, at: &Commit, ) -> Result<Vec<Submodule>, Box<dyn std::error::Error>> { let submodule_cfg = modules_file(&repo, &at)?; let submodule_cfg = Config::parse(&submodule_cfg)?; let mut path_to_url = HashMap::new(); let entries = submodule_cfg.entries(None)?; fo...
842
async fn get_price_ticker() { let exchange = init().await; let req = GetPriceTickerRequest { market_pair: "eth_btc".to_string(), }; let resp = exchange.get_price_ticker(&req).await.unwrap(); println!("{:?}", resp); }
843
pub fn test_wxorx_crash_64() { let buffer = fs::read("tests/programs/wxorx_crash_64").unwrap().into(); let result = run::<u64, SparseMemory<u64>>(&buffer, &vec!["wxorx_crash_64".into()]); assert_eq!(result.err(), Some(Error::MemOutOfBound)); }
844
fn add_media_to_alt_param(params: &mut [Param]) { if let Some(alt_param) = params.iter_mut().find(|p| p.id == "alt") { if let Param { typ: Type { type_desc: TypeDesc::Enum(enum_desc), .. }, .. } = alt_par...
845
pub async fn client_async_tls<R, S>( request: R, stream: S, ) -> Result<(WebSocketStream<ClientStream<S>>, Response), Error> where R: IntoClientRequest + Unpin, S: 'static + tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin, AutoStream<S>: Unpin, { client_async_tls_with_connector_and_config(r...
846
pub fn part2() { let input = crate::common::read_stdin_to_string(); let matches = find_part2_matches(&input).expect("No matches found"); let common_letters: String = matches .0 .chars() .zip(matches.1.chars()) .filter(|(letter_1, letter_2)| letter_1 == letter_2) .ma...
847
fn main() { let key = utils::random_key(); let nonce = utils::u64_to_bytes(0); let crypter = stream::CTR::new(&key, &nonce).unwrap(); let d = load_data(); let mut d: Vec<Vec<u8>> = d.into_iter().map(|s| crypter.crypt(&s)).collect(); truncate_to_shortest(&mut d); let d_t = transpose(&d); ...
848
pub fn parse(raw: &str) -> Option<game::Game> { let game_raw: GameRaw = serde_json::from_str(raw).ok()?; let even_initial_timelines = game_raw .timelines .iter() .any(|tl| tl.index == -0.5 || tl.index == 0.5); let min_timeline = game_raw.timelines .iter() .map(|tl| ...
849
async fn index(_req: HttpRequest) -> impl Responder { HttpResponse::Ok().json("Catalog API root") }
850
pub async fn render_window_wasm(subaction: brawllib_rs::high_level_fighter::HighLevelSubaction) { use brawllib_rs::renderer::app::state::{AppEventIncoming, State}; use brawllib_rs::renderer::app::App; use wasm_bindgen::prelude::*; use web_sys::HtmlElement; let document = web_sys::window().unwrap()....
851
fn inc_10() { run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(IndirectScaledIndexedDisplaced(RAX, RDI, Two, 366931006, Some(OperandSize::Byte), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[254...
852
fn reflect(v: &Vec3, n: &Vec3) -> Vec3 { *v - *n * 2.0 * dot(v, n) }
853
pub fn write_uint32(buf: &mut Vec<u8>, u: u32) -> usize { let mut size = 0; size += write_uint16(buf, (u & 0xffff) as u16); size += write_uint16(buf, ((u >> 16) & 0xffff) as u16); size }
854
pub fn parse_opts() -> Result<CliStatus, Error> { let opt = Opt::from_args(); log::debug!("Cli opts are: {:?}", opt); match opt.cmd { Command::Generate => { generate_empty_config().context("Failed to generate config")?; log::info!("config.yml generated"); Ok(CliS...
855
fn solve_2(input: &str) -> usize { let types = "abcdefghijklmnopqrstuvwxyz"; let min: Option<usize> = types .chars() .map(|c| { let first = input.to_string().replace(c, ""); first.replace(c.to_ascii_uppercase(), "") }) .map(|s| solve_1(&s)) .min();...
856
fn build_serverprefix(s: ~str) -> Result<IRCToken, ~str> { Ok(PrefixT(Prefix {nick: s, user: ~"", host: ~""})) }
857
fn vector_test() { { fn build_vector() -> Vec<i16> { let mut v: Vec<i16> = Vec::<i16>::new(); v.push(10i16); v.push(20i16); v } fn build_vector_2() -> Vec<i16> { let mut v = Vec::new(); v.push(10); v.push(20...
858
pub fn merge_sort<T: PartialOrd + Debug>(mut v: Vec<T>) -> Vec<T> { // sort the left half // sort the right half O(n*ln(n)) // bring the sorted half together O(n) if v.len() <= 1 { return v; } let mut res = Vec::with_capacity(v.len()); let b = v.split_off(v.len()/2); let a = merg...
859
pub unsafe fn gatt_svr_init() -> i32 { // Leaks the eff out of the svc_def let svcs_ptr = alloc_svc_def(); print_svcs(svcs_ptr); ble_svc_gap_init(); ble_svc_gatt_init(); let mut rc; rc = ble_gatts_count_cfg(svcs_ptr); esp_assert!(rc == 0, cstr!("RC err after ble_gatts_count_cfg\n")); ...
860
pub fn u16_to_u8(n: u16) -> (u8, u8) { (((n >> 8) as u8), (n as u8)) }
861
pub fn median(set: &[f32]) -> f32 { let mut copy = vec![0.; set.len()]; copy[..].clone_from_slice(set); copy.sort_by(|a, b| a.partial_cmp(b).unwrap()); let middle_index = copy.len() / 2; if copy.len() % 2 == 0 { return mean(&copy[middle_index - 1..middle_index]); } copy[middle_index]...
862
fn fist_5() { run_test(&Instruction { mnemonic: Mnemonic::FIST, operand1: Some(IndirectScaledIndexed(EDX, ECX, Four, Some(OperandSize::Word), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[223, 20, 138], Operan...
863
fn expect_money_conserved(table: &Table) { let mut history: BTreeMap<u32, Vec<Row>> = BTreeMap::new(); for c in table.scan() { history.entry(c.t).or_insert(Vec::new()).push(Row { k: c.k, v: c.v }); } let mut tracker: HashMap<i32, i32> = HashMap::new(); for (_, rs) in history { for r in rs { trac...
864
fn draw_foot<Message, B>( renderer: &mut Renderer<B>, foot: &Option<Element<'_, Message, Renderer<B>>>, layout: Layout<'_>, cursor_position: Point, viewport: &Rectangle, style: &Style, ) -> (Primitive, mouse::Interaction) where B: Backend + backend::Text, { let mut foot_children = layout...
865
pub fn task_set_inactive(target: CAddr) { system_call(SystemCall::TaskSetInactive { request: target }); }
866
pub(super) fn construct<A: Allocate>( worker: &mut timely::worker::Worker<A>, config: &LoggingConfig, event_queue: EventQueue<ReachabilityEvent>, compute_state: &ComputeState, ) -> BTreeMap<LogVariant, (KeysValsHandle, Rc<dyn Any>)> { let interval_ms = std::cmp::max(1, config.interval.as_millis()); ...
867
fn drop ( & mut self ) { if mem : : needs_drop : : < T > ( ) { unsafe { self . as_ptr ( ) . drop_in_place ( ) ; } } }
868
fn main() { let file_name = "input.txt"; let instructions = parse_file(file_name); let (registers, largest_value) = process_instructions(&instructions); println!("Day 8, part 1: {}", get_largest_register_value(&registers)); println!("Day 8, part 2: {}", largest_value); }
869
pub fn make_buffer_with_indexed<T, F: FnMut (usize) -> T> (len: usize, mut f: F) -> Box<[T]> { let mut v = Vec::with_capacity(len); for i in 0..len { v.push(f(i)) } v.into_boxed_slice() }
870
fn multi_field_uniques_are_preserved_when_generating_data_model_from_a_schema() { let ref_data_model = Datamodel { models: vec![Model { database_name: None, name: "User".to_string(), documentation: None, is_embedded: false, is_commented_out: false,...
871
pub fn fill_buffer_clone<T: Clone> (b: &mut [T], v: &T) { fill_buffer_with(b, move || v.clone()) }
872
fn main() { let days = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "twelfth"]; let lyrics = ["A partridge in a pear tree", "Two turtle doves, and", "Three french hens", "Four calling birds", "Five golden rings", "Six geese a-laying", "Seven swans ...
873
pub fn causet_partitioner_request_scan(request: &CausetPartitionerRequest, dest: &mut [u8]) -> bool { let mut dest_iter = dest.iter_mut(); let mut prev_user_soliton_id_iter = request.prev_user_soliton_id.iter(); let mut current_user_soliton_id_iter = request.current_user_soliton_id.iter(); let mut curre...
874
pub async fn connect_async_with_tls_connector_and_config<R>( request: R, connector: Option<Connector>, config: Option<WebSocketConfig>, ) -> Result<(WebSocketStream<ConnectStream>, Response), Error> where R: IntoClientRequest + Unpin, { let request: Request = request.into_client_request()?; let...
875
pub fn clear(gl: &gl::Gl) { gl.clear(gl::COLOR_BUFFER_BIT); }
876
pub fn test_load_elf_crash_64() { let buffer = fs::read("tests/programs/load_elf_crash_64").unwrap().into(); let result = run::<u64, SparseMemory<u64>>(&buffer, &vec!["load_elf_crash_64".into()]); assert_eq!(result.err(), Some(Error::MemWriteOnExecutablePage)); }
877
fn main() { // 创建一个通道 let (tx, rx): (mpsc::Sender<i32>, mpsc::Receiver<i32>) = mpsc::channel(); // 创建线程用于发送消息 thread::spawn(move || { // 发送一个消息,此处是数字id tx.send(1).unwrap(); }); // 在主线程中接收子线程发送的消息并输出 println!("receive {}", rx.recv().unwrap()); }
878
pub extern "C" fn soliton_panic_causet_partitioner_database_type_name() -> *const c_char { CString::new("").unwrap().as_ptr() }
879
fn test_solve_2() { assert_eq!(solve_2("dabAcCaCBAcCcaDA"), 4); }
880
pub fn start_conflict_resolver_factory(ledger: &mut Ledger_Proxy, key: Vec<u8>) { let (s1, s2) = Channel::create(ChannelOpts::Normal).unwrap(); let resolver_client = ConflictResolverFactory_Client::from_handle(s1.into_handle()); let resolver_client_ptr = ::fidl::InterfacePtr { inner: resolver_client...
881
pub fn challenge_4() { let mut file = File::open("data/4.txt").unwrap(); let mut all_file = String::new(); file.read_to_string(&mut all_file).unwrap(); let mut best_guess = (vec![], 0, f64::INFINITY); for line in all_file.lines() { let data = hex::decode(line).expect("Test"); let (...
882
fn read_init() -> State { let stdin = io::stdin(); let mut lines = stdin.lock().lines().map(|x| x.unwrap()); let line = lines.next().unwrap(); let mut wh = line.split(" "); let w: u32= wh.next().unwrap().parse().unwrap(); let h: u32= wh.next().unwrap().parse().unwrap(); let line = lines.n...
883
fn reduce(input: &str) -> String { let mut result: (Option<char>, String) = input .chars() .fold((None, String::new()), |mut acc, c| match acc { (None, _) => { acc.0 = Some(c); acc } (Some(p), _) ...
884
fn alloc_svc_def() -> *const ble_gatt_svc_def { leaky_box!( ble_gatt_svc_def { type_: BLE_GATT_SVC_TYPE_PRIMARY as u8, uuid: ble_uuid16_declare!(GATT_HRS_UUID), includes: ptr::null_mut(), characteristics: leaky_box!( ble_gatt_chr_def { ...
885
fn initialize(lines: &Vec<String>) -> Vec<Day> { let regex = Regex::new(r"(\d\d-\d\d) ((?:23|00):\d\d)\] (Guard #(\d*)|wakes|falls)").expect("Building Regex failed"); let mut events = lines.iter().map(|l| GuardEvent::from_line(l, &regex)).collect::<Vec<GuardEvent>>(); events.sort_by(|GuardEvent {date: date1...
886
pub fn test_rvc_pageend() { // The last instruction of a executable memory page is an RVC instruction. let buffer = fs::read("tests/programs/rvc_pageend").unwrap().into(); let core_machine = DefaultCoreMachine::<u64, SparseMemory<u64>>::new(ISA_IMC, VERSION0, u64::max_value()); let mut machine =...
887
fn generate_resource_data(settings: &Settings) -> crate::Result<ResourceMap> { let mut resources = ResourceMap::new(); let regex = Regex::new(r"[^\w\d\.]")?; let cwd = std::env::current_dir()?; for src in settings.resource_files() { let src = src?; let filename = src .file_name() .expect("f...
888
pub fn crate_inherent_impls(tcx: TyCtxt<'_>, (): ()) -> CrateInherentImpls { let mut collect = InherentCollect { tcx, impls_map: Default::default() }; for id in tcx.hir().items() { collect.check_item(id); } collect.impls_map }
889
pub fn acrn_remove_dir(path: &str) -> Result<(), String> { fs::remove_dir_all(path).map_err(|e| e.to_string()) }
890
fn inc_21() { run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(Direct(EDX)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[66], OperandSize::Dword) }
891
fn inc_20() { run_test(&Instruction { mnemonic: Mnemonic::INC, operand1: Some(IndirectDisplaced(SI, 122, Some(OperandSize::Dword), None)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 255, 68, 122], OperandSize:...
892
fn skip_whitespace(input: &str) -> &str { space0::<&str, nom::error::Error<&str>>(input).unwrap().0 }
893
fn load_asset_to_vmo(path: &Path) -> Result<mem::Buffer, Error> { let file = File::open(path)?; let vmo = fdio::get_vmo_copy_from_file(&file)?; let size = file.metadata()?.len(); Ok(mem::Buffer { vmo, size }) }
894
pub fn smart_to_total_words() -> TotalWords { let mut words_vec: Vec<Words> = Vec::new(); for i in 1..22 { let words = smart_to_words(i); words_vec.push(words); } TotalWords::new(words_vec) }
895
fn hard_fault(ef: &ExceptionFrame) -> ! { panic!("Hardfault... : {:#?}", ef); }
896
pub fn file_append() -> io::Result<()> { let filename = "foo.txt"; let file = OpenOptions::new() .read(true) .write(true) .create(true) // .create_new(true) .append(true) // .truncate(true) .open(filename); match file { Ok(mut stream) => { ...
897
fn read_matrix<T>() -> Vec<Vec<T>> where T: std::str::FromStr, T::Err: std::fmt::Debug, { use std::io::prelude::*; let stdin = stdin(); let mut reader = BufReader::with_capacity(100 * 1024, stdin); let mut line = String::with_capacity(100); let mut matrix: Vec<Vec<T>> = Vec::new(); whil...
898
pub fn write_board(board_name: String, contents: String) -> Result<(), String> { let mut configurator = Configurator::new(); unsafe { configurator.set_working_folder(WORKING_FOLDER.clone()); } configurator.write_board(board_name, contents) }
899