text
stringlengths
8
4.13M
pub mod close_strings; pub mod concatenated_binary; pub mod diagonal_sort; pub mod get_smallest_string; pub mod k_length_apart; pub mod merge_k_lists; pub mod minimum_effort_path;
extern crate rand; extern crate ndarray; #[macro_use] extern crate ndarray_linalg; extern crate da_lab; use ndarray::Array; use ndarray_linalg::*; use rand::distributions::IndependentSample; use std::f64::consts::E; use da_lab::weight::*; fn close_max(a: &Vec<f64>, b: &Vec<f64>, atol: f64) { let a = Array::from...
//! Variable metadata. use partial_ref::{partial, PartialRef}; use rustc_hash::FxHashSet as HashSet; use varisat_formula::Var; use crate::{ context::{parts::*, Context}, processing::{process_step, CheckedProofStep, CheckedSamplingMode, CheckedUserVar}, CheckerError, }; /// Data for each literal. #[derive...
use std::fmt::{self, Debug}; #[derive(Copy, Clone, PartialEq, Eq)] pub struct Color { pub r: u8, pub g: u8, pub b: u8, } impl Color { pub const fn new(r: u8, g: u8, b: u8) -> Self { Color { r, g, b } } pub const BLUE: Color = Color::new(0, 0, 0xFF); } impl Debug for Color { fn fm...
use crate::mask::Mask; /// A mask where every element is set. #[derive(Default, Debug, Clone, Copy)] pub struct All(()); impl Mask for All { type Iter = Iter; fn test(&self, _: usize) -> bool { true } fn iter(&self) -> Self::Iter { Iter { index: 0 } } } /// The iterator for the [...
fn main() { let d1 = [1, 2, 3]; println!("{:?}", d1); for x in &d1 { println!("res = {}", x); } print_each(&d1); } fn print_each(list: &[i32]) { for n in list { println!("v = {}", n); } }
use nannou::prelude::*; use super::rect::RectExtension; use crate::snapshot::rand::Rand; pub trait F32Extension { fn rescale(&self, input_min: f32, input_max: f32, output_min: f32, output_max: f32) -> f32; fn normalize(&self, input_min: f32, input_max: f32) -> f32; fn denormalize(&self, output_min: f32, o...
use crate::extractors::amp_spectrum; use crate::utils; pub fn compute(signal: &Vec<f64>) -> f64 { let amp_spec: Vec<f64> = amp_spectrum::compute(signal); let mus: Vec<f64> = (1..5) .map(|x| utils::mu(x as i32, &amp_spec)) .into_iter() .collect(); let numerator = -3.0 * mus...
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: u32 = rd.get(); let x = n * 108 / 100; let y = 206; if x < y { println!("Yay!"); } else if x == y { println!("so-so"); } else { print...
#[doc = "Reader of register OR"] pub type R = crate::R<u32, super::OR>; #[doc = "Writer for register OR"] pub type W = crate::W<u32, super::OR>; #[doc = "Register OR `reset()`'s with value 0"] impl crate::ResetValue for super::OR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
/* * Copyright 2017 Bitwise IO, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agree...
// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #[macro_use] pub mod serde_ext; mod v1_to_v2; pub mod v2; use { crate::{serde_ext::*, v2::FontsManifest as FontsManifestV2}, char_set::CharSet, ...
use std::fmt::Debug; use std::io; use std::str::FromStr; fn read_and_divide_line<T>() -> Vec<T> where T: FromStr, <T as FromStr>::Err: Debug, { let mut target_line = String::new(); io::stdin().read_line(&mut target_line).unwrap(); target_line .trim() .split_whitespace() .map...
const RAM_SIZE: usize = 65536; const SPR_RAM_SIZE: usize = 256; const NAME_TABLE_ADDRS: [usize; 4] = [0x2000, 0x2400, 0x2800, 0x2c00]; #[derive(Default)] pub struct PPU { io_regs: [u8; 8], // Control register 1 name_table: usize, addr_incr: u32, pattern_table: usize, background_table: usize, ...
use rdev::{simulate, Button, EventType, Key, SimulateError}; use std::{thread, time}; fn send(event_type: &EventType) { let delay = time::Duration::from_millis(20); match simulate(event_type) { Ok(()) => (), Err(SimulateError) => { println!("We could not send {:?}", event_type); ...
use std::{ fmt::{Debug, Display}, sync::Arc, }; use async_trait::async_trait; use data_types::PartitionId; use parking_lot::Mutex; /// A source of partitions, noted by [`PartitionId`](data_types::PartitionId), that may potentially need compacting. #[async_trait] pub(crate) trait PartitionsSource: Debug + Disp...
use std::io; use std::path::PathBuf; use serde_json; use structopt::StructOpt; use telamon::explorer::{eventlog::EventLog, mcts}; #[derive(Debug, StructOpt)] #[structopt(name = "parse_event_log")] struct Opt { #[structopt( parse(from_os_str), short = "i", long = "input", default_v...
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let t: usize = rd.get(); for _ in 0..t { let k: usize = rd.get(); let n: usize = rd.get(); let m: usize = rd.get(); let a: Vec<usize> = rd.get_vec(n)...
use std::cmp; fn main() { let (earliest_timestamp_to_depart, delta_time_and_bus_frequency_list) = get_input(); let mut min_wait = u64::MAX; let mut bus_id =0; for bus in &delta_time_and_bus_frequency_list { let time = bus.1 - earliest_timestamp_to_depart%bus.1; if time < min_wait ...
#![cfg_attr(feature = "strict", deny(warnings))] use std::fmt::*; use std::marker::*; pub struct Map { pub height: u8, pub width: u8, pub players: Vec<Vec<Player>> } impl Display for Map { fn fmt(&self, f: &mut Formatter) -> Result { for row in &self.players { for player in row { write!(f, ...
#![no_main] #![no_std] extern crate cortex_m; #[macro_use] extern crate cortex_m_rt as rt; extern crate panic_semihosting; extern crate pwm_speaker; extern crate stm32f103xx_hal as hal; use hal::delay::Delay; use hal::prelude::*; use rt::ExceptionFrame; entry!(main); fn main() -> ! { let dp = hal::stm32f103xx::...
#![feature(crate_in_paths)] extern crate failure; #[macro_use] extern crate maplit; extern crate oatie; extern crate rand; extern crate regex; extern crate serde; extern crate taken; #[macro_use] extern crate serde_derive; extern crate colored; extern crate htmlescape; #[macro_use] extern crate lazy_static; extern cra...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type NotePlacementChangedPreviewEventArgs = *mut ::core::ffi::c_void; pub type NoteVisibilityChangedPreviewEventArgs = *mut ::core::ffi::c_void; pub type No...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless ...
//! # Parse a subset of [InfluxQL] //! //! [InfluxQL]: https://docs.influxdata.com/influxdb/v1.8/query_language #![deny(rustdoc::broken_intra_doc_links, rust_2018_idioms)] #![warn( missing_copy_implementations, missing_docs, clippy::explicit_iter_loop, // See https://github.com/influxdata/influxdb_iox/...
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
//! Global model reconstruction use partial_ref::{partial, PartialRef}; use varisat_formula::Lit; use varisat_internal_proof::ProofStep; use crate::{ context::{parts::*, Context}, proof, state::SatState, }; /// Global model reconstruction #[derive(Default)] pub struct Model { /// Assignment of the g...
///! This module contains the signatures of all NIFs in SSA IR ///! ///! The purpose of this is to centralize the registration of native functions that the ///! compiler is aware of and can reason about. If the code generator needs to implement ///! an op using a native function, it should be registered here with the a...
use super::{ FracAdd, FracAddOp, FracDiv, FracDivOp, FracMul, FracMulOp, FracSub, FracSubOp, Fraction, Irreducible, UFraction, }; use crate::common::*; // positive fraction type pub struct PFrac<Frac>(PhantomData<Frac>) where Frac: UFraction; impl<Frac> Fraction for PFrac<Frac> where Frac: UFraction,...
#[derive(Clone, PartialEq, ::prost::Message)] pub struct HelloEntity { #[prost(string, tag = "1")] pub entity_message: std::string::String, #[prost(double, tag = "2")] pub entity_double: f64, #[prost(int32, tag = "3")] pub entity_int32: i32, #[prost(int64, tag = "4")] pub entity_int64: i...
use rune::termcolor::{ColorChoice, StandardStream}; use rune::{Diagnostics, EmitDiagnostics as _, Options, Sources}; use runestick::{FromValue as _, Source, Vm}; use std::error::Error; use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { let context = rune_modules::default_context()?...
#![allow(dead_code, unused)] use clap::clap_app; use log::{error, warn}; use once_cell::sync::Lazy; use regex::Regex; use serde_json::Value; use std::{collections::HashMap, sync::Arc}; use tokio::{ io::{AsyncRead, AsyncWrite}, sync::RwLock, }; use tower_lsp::{ jsonrpc::Result as TResult, lsp_types::*, Clien...
use local::api::stream_server; use local::iota_channels_lite::channel_author::Channel; use local::security::keystore::KeyManager; use local::types::config::Config; use std::fs::File; use std::sync::{Arc, Mutex}; use iota_streams::app::transport::tangle::client::SendTrytesOptions; #[tokio::main] async fn main() -> Re...
use crate::utils::*; pub(crate) const NAME: &[&str] = &["fmt::Write"]; pub(crate) fn derive(data: &Data, items: &mut Vec<ItemImpl>) -> Result<()> { derive_trait!( data, parse_quote!(::core::fmt::Write)?, parse_quote! { trait Write { #[inline] fn ...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { failure::{format_err, Error}, fuchsia_async as fasync, futures::{channel::mpsc, prelude::*}, std::collections::HashSet, std::fmt,...
use mod_int::ModInt998244353; use proconio::input; macro_rules! add { ($a: expr, $b: expr) => { $a = ($a + $b) % 998244353; }; } fn main() { input! { n: usize, a: usize, b: usize, p: usize, q: usize, }; let mut dp_p = vec![vec![0; (p + 1) * (n + 1) ...
pub mod primal; pub mod dual; pub mod incidence;
// Valid Anagram // https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3636/ pub struct Solution; use std::collections::HashMap; impl Solution { pub fn is_anagram(s: String, t: String) -> bool { if s.len() != t.len() { return f...
use crate::util::id::PatternID; /// The kind of match semantics to use for a DFA. /// /// The default match kind is `LeftmostFirst`. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum MatchKind { /// Report all possible matches. All, /// Report only the leftmost matches. When multiple leftmost matches e...
use opengl_graphics::{GlGraphics, GlyphCache}; use piston::input::RenderArgs; use graphics::Context; pub struct TextWriter{ } impl TextWriter { pub fn new() -> TextWriter { TextWriter { } } pub fn render_text( &mut self, ctx: &Context, gl: &mut GlGraphics, ...
// Copyright (C) 2019 Frank Rehberger // // Licensed under the Apache License, Version 2.0 or MIT License //! # Rust build-script dependencies generator //! //! Rust build-script dependencies generator is intended for the build-script `build.rs'. All files //! matching the user defined GLOB pattern will be added to C...
extern crate pairing; extern crate bellman; extern crate rand; extern crate jubjub; #[macro_use] extern crate lazy_static; pub mod base; pub mod b2c; pub mod c2b; pub mod c2p; pub mod p2c; pub mod common_verify; pub mod contract; pub mod incrementalmerkletree; pub mod pedersen; pub mod convert; pub use conve...
use actix::MessageResponse; #[derive(MessageResponse)] struct Added(usize); fn main() {}
extern crate deunicode; use deunicode::deunicode; use std::ffi::OsStr; use std::fs::{create_dir, DirEntry, File}; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use std::process::Command; /// Sass spec version targeted. const VERSION: f32 = 3.6; fn main() -> Result<(), Error> { let base = PathB...
use log::error; /// The central error type for the application. These should be converted by the main program into /// readable error messages for the user. #[derive(Debug)] pub enum Error { ConfigFileBad(&'static str), ConfigFileUnreadable(&'static str), } impl Error { /// Log the error, consuming it. Ow...
use super::interrupt; use super::uart; use crate::{putfmt, phys_to_virt}; use super::consts::*; //通过MMIO地址对平台级中断控制器PLIC的寄存器进行设置 //基于opensbi后一般运行于Hart0 S态,为Target1 //PLIC是async cause 11 //声明claim会清除中断源上的相应pending位。 //即使mip寄存器的MEIP位没有置位, 也可以claim; 声明不被阀值寄存器的设置影响; //获取按优先级排序后的下一个可用的中断ID pub fn next() -> Option<u32> { ...
mod attributes; mod raster; use std::fs::*; use image::{Rgba, Frame, Delay, gif::Encoder}; use glam::{vec3, Vec3}; use attributes::*; use raster::*; use anyhow::Result; fn main() -> Result <()> { let file = read_to_string("data/uniform.json")?; let render_type = RenderType::Png; let primitive_type = Primi...
// use std::io; use std::io::{self, Write}; fn main() { print!("Masukan angka yang akan dicari faktornya: "); let stdout = io::stdout(); let mut handle = stdout.lock(); let _ = handle.flush(); let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); let limit: i32 = mat...
// This file is part of Webb. // Copyright (C) 2021 Webb Technologies Inc. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.o...
//! # USB peripheral. //! //! Mostly builds upon the [`stm32_usbd`] crate. //! //! ## Examples //! //! See [examples/usb_serial.rs] for a usage example. //! //! [examples/usb_serial.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.7.0/examples/usb_serial.rs use crate::pac::{RCC, USB}; use stm32_usbd::UsbPeripher...
//! Load WAV files use crate::audio::GenericMusicStream; use std::io; use cpal::Sample; use either::Either; pub(super) fn decode<R: io::Read + Send + 'static>(reader: R) -> Result<GenericMusicStream<impl Iterator<Item = f32>>, String> { let buf_reader = io::BufReader::new(reader); let wav_reader = hound::Wa...
use super::error::{PineError, PineErrorKind, PineResult}; use super::input::{Input, StrRange}; use super::utils::skip_ws; use nom::{ branch::alt, bytes::complete::{escaped, is_not, tag, take_until}, character::complete::one_of, sequence::delimited, sequence::preceded, Err, }; const ESCAPE_CODE:...
use std::collections::LinkedList; /// A text editing operation #[derive(Clone)] pub enum Operation { InsertText(String, usize), RemoveTextBefore(String, usize), RemoveTextAfter(String, usize), MoveText(usize, usize, usize), CompositeOp(Vec<Operation>), } /// An undo/redo stack of text editing oper...
use std::sync::Mutex; use std::thread; #[derive(Debug)] pub struct InnerThread(Mutex<Option<thread::JoinHandle<()>>>); impl InnerThread { pub fn new(join_handle: thread::JoinHandle<()>) -> Self { Self(Mutex::new(Some(join_handle))) } pub fn join(&self) { self.0.lock().unwrap().take().unwr...
mod compiler; mod scratch; pub fn compile( module: &mut impl cranelift_module::Module, file: impl std::io::Read + std::io::Seek, ) { let project = scratch::ProjectInfo::new(file).unwrap(); let mut variables = vec![]; let mut procedures = vec![]; let mut scripts = vec![]; for target in pro...
use std::cmp::min; use line_drawing::Bresenham; use line_drawing::XiaolinWu; use Canvas; use Drawable; /// A drawable object that represents a line pub struct Line { /// The first point of the line pub pt1: (usize, usize), /// The second point of the line pub pt2: (usize, usize), /// The color of...
#![allow(non_upper_case_globals)] extern crate log; extern crate rand; extern crate regex; extern crate etherparse; extern crate lazy_static; use lazy_static::lazy_static; use crate::utils; use regex::Regex; use std::sync::{mpsc, Mutex}; use etherparse::PacketBuilder; use crate::config::tcp_rule::TcpRule; #[allow(unu...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct AAAccountingData { pub userName: super::super::Foundation::BSTR, pub clientName: super:...
use sea_schema::migration::prelude::*; pub struct Migration; impl MigrationName for Migration { fn name(&self) -> &str { "m20220424_000004_create_payments_table" } } #[async_trait::async_trait] impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { ...
use std::thread; use std::sync::mpsc::{channel,sync_channel}; use std::os::unix::net::{UnixListener}; use std::io::{BufReader,BufWriter}; use std::path::Path; use crate::control::{Request,Response,Config,Manifest,ManagementInterface,ManagementTicket,Status,LastResult}; pub fn start_server(socket_path: &Path) -> Mana...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_create_cell( input: &crate::input::CreateCellInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWrite...
use std::fs::File; use std::io::Read; use std::collections::HashMap; fn get_orbiting<'a>(obj: &str, orbits: &'a Vec<(String, String)>) -> &'a String { &orbits.iter().find(|&orbit| orbit.1 == *obj).unwrap().0 } fn calculate_orbits(obj: &String, orbits: &Vec<(String, String)>, num_orbits: &mut HashMap<String, u64>)...
use prettytable::{Attr, color}; use crate::node_module::*; use crate::node_module::standard_module::StandardModule; use crate::semver::Semver; pub struct DiffedPair<'a> { pub name: &'a str, pub version: (&'a Option<Semver>, &'a Option<Semver>), pub dep_type: (&'a DepType, &'a DepType), } impl<'a> DiffedP...
use fraction::ToPrimitive; use crate::rse::*; use crate::io::*; use crate::gp::*; /// A mix table item describes a mix parameter, e.g. volume or reverb #[derive(Debug,Clone,PartialEq,Eq,Default)] pub struct MixTableItem { pub value: u8, pub duration: u8, pub all_tracks: bool, } //impl Default for MixTable...
use std::mem; /// Represents a value that is not checked at first, and upon being checked it might be available /// or unavailable. pub enum MaybeUnavailable<T> { // I'm not that great at naming. NotChecked, Unavailable, Available(T), } impl<T> MaybeUnavailable<T> { /// Resets this value to the no...
use core::alloc::Layout; use core::iter; use core::ptr; use core::slice; use core::str; use liblumen_core::offset_of; use liblumen_term::{Encoding as EncodingTrait, Tag}; use crate::borrow::CloneToProcess; use crate::erts::exception::AllocResult; use crate::erts::process::alloc::TermAlloc; use crate::erts::string::{s...
import syntax::ast; import ast::mutability; import ast::local_def; import ast::respan; import ast::spanned; import syntax::visit; import metadata::csearch; import driver::session; import util::common; import util::common::*; import syntax::codemap::span; import std::map::new_int_hash; import std::map::new_str_hash; imp...
mod conn; mod payload; use serde::{Deserialize, Serialize}; use tokio::net::{TcpListener, TcpStream}; use conn::Conn; use payload::Payload; #[derive(Debug, Serialize, Deserialize)] enum Frame { Version(u32), Message(String), Bye, } // what do we do // we do replies and responses // then we implement a b...
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
use crate::input::eventsystem::EventSystem; use crate::prelude::*; use crate::vri::openvrintegration::OpenVRIntegration; use crate::wsi::windowsystemintegration::WindowSystemIntegration; use crate::xri::openxrintegration::OpenXRIntegration; use utilities::prelude::*; use vulkan_rs::prelude::*; use sdl2::Sdl; use std...
use std::collections::HashMap; use url::Url; use crate::*; #[derive(Clone)] /// Ergonomic wrapper around the popular Url crate pub struct Url2(pub(crate) Box<(Url, Option<HashMap<String, String>>)>); impl Url2 { // would love to use std::convert::TryFrom, except for conflicting // blanket implementation: htt...
use std::hash::{Hash, Hasher}; use std::marker::PhantomData; use std::ops::{Index, IndexMut}; #[derive(Debug)] pub struct Arena<T> { data: Vec<Node<T>>, first_free: Option<usize>, } #[derive(Debug)] enum Node<T> { Free { next_free: Option<usize> }, Occupied(T), } #[derive(Debug)] pub struct ArenaId<T...
#![allow(dead_code)] #[macro_use] extern crate log; #[macro_use] extern crate serde_json; use structopt::StructOpt; mod args; mod error; use error::GenericResult; mod logging; mod server; #[tokio::main] async fn main() { if let Err(error) = run().await { error!("{}", error); ...
fn foo<T: <caret>Send + Sync>(t: T, f: F) { }
//! A lazy connector for Tonic gRPC [`Channel`] instances. use std::{ sync::{ atomic::{AtomicUsize, Ordering}, Arc, }, time::Duration, }; use async_trait::async_trait; use generated_types::influxdata::iox::ingester::v1::{ write_service_client::WriteServiceClient, WriteRequest, }; use o...
pub use VkSparseImageFormatFlags::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkSparseImageFormatFlags { VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x0000_0001, VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x0000_0002, VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x0000_0...
use std::{ collections::HashMap, io::{Cursor, Read, Write}, net::{TcpListener, TcpStream}, sync::Arc, }; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use bytes::{Buf, BufMut, Bytes, BytesMut}; use lazy_static::lazy_static; use rustls::Session; use zenith_utils::postgres_backend::{AuthType,...
use rand::Rng; use std::{fmt, io}; const WORDS: &[&str] = &[ "abruptly", "absurd", "abyss", "affix", "askew", "avenue", "awkward", "axiom", "azure", "bagpipes", "bandwagon", "banjo", "bayou", "beekeeper", "bikini", "blitz", "blizzard", "boggle", ...
use libc; use core::ptr; use alloc::borrow::ToOwned; use super::KAuthResult; use kernel::KAuthVNodeAction; #[derive(Debug)] pub struct ScopeListener(*const libc::c_void); impl Drop for ScopeListener { fn drop(&mut self) { extern "C" { fn kauth_unlisten_scope(scope: *const libc::c_void); ...
extern crate byteorder; mod nes; fn main() { let mut nes = nes::NES::new(); let file_name = "roms/donkey.nes"; println!("Loading ROM file {}:", file_name); match nes::load_nes_file(file_name) { Ok(rom) => { println!(" number of PRGROM banks: {}", rom.num_prg_banks); ...
// Configuration Management module pub mod cli;
//! A module for caching or updating git repositories. use crate::db_queries::{update_repo, UpdateUrlError}; use crate::elm_package::{ElmPackage, ElmPackageError}; use crate::git_repo::GitError; use fn_search_backend::Config; use std::path::Path; use std::{error::Error, fmt}; /// Configuration options for caching the...
// auto generated, do not modify. // created: Wed Jan 20 00:44:03 2016 // src-file: /QtNetwork/qsslerror.h // dst-file: /src/network/qsslerror.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)]...
use std::env; use std::fs; fn compute_fuel_for_module(module_weight: i32) -> i32 { return (((module_weight as f64) / 3_f64).floor() as i32) - 2; } fn compute_recursive_fuel_for_module(weight: i32) -> i32 { let intermediate = compute_fuel_for_module(weight); if intermediate <= 0 { return 0; } ...
use ffmpeg::format; use ocl::{self, OclPrm}; use super::*; use crate::capture; use crate::hooks::hw::FrameCapture; use crate::utils::MaybeUnavailable; /// Resampling FPS converter which averages input frames for smooth motion. pub struct SamplingConverter { /// Difference, in video frames, between how much time p...
// Copyright 2020 IOTA Stiftung // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
use amethyst::{ animation::AnimationControlSet, ecs::{Entities, Join, ReadStorage, System, WriteStorage}, renderer::SpriteRender, }; use crate::components::{animation, Direction, Player, PlayerState}; #[derive(Default)] pub struct PlayerAnimationSystem; impl<'s> System<'s> for PlayerAnimationSystem { ...
use hdbconnect_async::HdbResult; mod test_utils; #[tokio::test] async fn test_080_conn_pooling_for_rocket() -> HdbResult<()> { let _log_handle = test_utils::init_logger(); if cfg!(feature = "rocket_pool") { log::info!("testing feature 'rocket_pool'"); #[cfg(feature = "rocket_pool")] in...
#![cfg_attr(not(feature = "std"), no_std)] #![warn( missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub )] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) ))] //! Pre-allocated storage for a uniform data type. /...
use tonic_ws_transport::WsConnection; use futures_util::StreamExt; use tokio::net::TcpListener; use tokio_stream::wrappers::TcpListenerStream; use tonic::{transport::Server, Request, Response, Status}; use hello_world::greeter_server::{Greeter, GreeterServer}; use hello_world::{HelloReply, HelloRequest}; pub mod hel...
use super::*; use rand::Rng; use regex::Regex; pub fn ontest_config(cfg: &mut web::ServiceConfig) { cfg.service(do_login) .service(do_login_phone) .service(do_login_refresh) .service(do_login_status) .service(do_logout) .service(user_playlist) .service(song_url) ...
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
use std::ascii::escape_default; pub fn bytes_to_string(s: &[u8]) -> String { s.iter() .map(|c| escape_default(*c).map(|sc| sc as char).collect::<String>()) .collect::<Vec<String>>() .concat() }
#[cfg(all( any(target_arch = "x86", target_arch = "x86_64"), all(target_feature = "aes", target_feature = "sse2") ))] #[path = "./aesni_x86.rs"] mod platform; // AArch64 CPU 特性名称: // https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/src/detect/arch/aarch64.rs #[cfg(all( target_arch = "aar...
#[doc = "Reader of register TXCSRL3"] pub type R = crate::R<u8, super::TXCSRL3>; #[doc = "Writer for register TXCSRL3"] pub type W = crate::W<u8, super::TXCSRL3>; #[doc = "Register TXCSRL3 `reset()`'s with value 0"] impl crate::ResetValue for super::TXCSRL3 { type Type = u8; #[inline(always)] fn reset_value...
use reqwest::get; use std::collections::HashMap; #[derive(Debug, Deserialize)] struct List { #[serde(rename = "Data")] data: HashMap<String, LCoin>, } #[derive(Debug, Deserialize)] struct LCoin { #[serde(rename = "FullName")] name: String, } #[derive(Debug, Deserialize)] struct History { #[serde(rename = "...
// ========= struct SegTree<T> { // num: 葉(元データ)の数, data: ノードの値, neutral: 単位元, merge: 区間クエリ, update_point: 点更新 num: usize, data: Vec<T>, neutral: T, merge: Box<Fn(T, T) -> T>, update_point: Box<Fn(T, T) -> T>, } impl<T: Clone + Copy + std::fmt::Debug> SegTree<T> { // v...元配列, neutral...初期値か...
use core::str::Split; use std::borrow::Cow; use regex::Regex; static OLD_FILE_NAME_HEADER: &str = "--- "; static NEW_FILE_NAME_HEADER: &str = "+++ "; static HUNK_HEADER_PREFIX: &str = "@@"; pub fn parse_diff(diff: &str) -> Vec<File> { let mut state = ParseState::new(); let diff: Cow<'_, str> = Cow::Borrowed...