text
stringlengths
8
4.13M
use crate::adapter::AdapterType; use crate::factory::{FactoryType, IFactory, IFactory1, IFactory2, IFactory3}; use com_wrapper::ComWrapper; use dcommon::error::Error; use winapi::shared::dxgi::{IDXGIFactory, IDXGIFactory1}; use winapi::shared::dxgi1_2::IDXGIFactory2; use winapi::shared::dxgi1_3::IDXGIFactory3; use win...
extern crate structopt; #[macro_use] extern crate structopt_derive; use structopt::StructOpt; fn bits(byte: u8) -> Vec<bool> { vec![ byte >> 7 & 0x1 == 0x1, byte >> 6 & 0x1 == 0x1, byte >> 5 & 0x1 == 0x1, byte >> 4 & 0x1 == 0x1, byte >> 3 & 0x1 == 0x1, byte >> 2 & 0...
use std::future::Future; use std::net::SocketAddr; use std::pin::Pin; use std::task::Poll; use hyper::HeaderMap; use hyper::{body::HttpBody, Body, Request, Response}; use pin_project::pin_project; use tonic::async_trait; use tonic_example::echo_server::{Echo, EchoServer}; use tonic_example::{EchoReply, EchoRequest}; u...
use std::collections::HashMap; type Registers = HashMap<String, isize>; use Op::*; use Cond::*; enum Op { Inc(String, isize), Dec(String, isize) } impl Op { fn parse(symbol: &str, register: String, value: isize) -> Op { match symbol { "inc" => Inc(register, value), "dec" ...
//! Tests for the commands use super::{Commands, CommandParsingError, Command}; fn test_command_parsing(test_output: bool) { let examples = vec![ "{\"cmd\": \"write_to_disk\", \"db_key\": \"DB_KEY\"}", "{\"cmd\": \"read_from_disk\", \"db_key\": \"DB_KEY\"}", "{\"cmd\": \"list_keys\", \"db_...
pub mod bst; pub trait Map { type Key; type Value; fn new() -> Self; fn find(&self, &Self::Key) -> Option<&Self::Value>; fn ins(&mut self, Self::Key, Self::Value) -> &mut Self; fn del(&mut self, &Self::Key) -> Option<Self::Value>; }
mod aoc; mod day_1; mod day_2; mod day_3; mod day_4; mod day_5; mod day_6; /// fn main() { day_1::part_1(); day_1::part_2(); day_2::part_1(); day_2::part_2(); day_3::part_1(); day_3::part_2(); day_4::part_1(); day_4::part_2(); day_5::part_1(); day_5::part_2(); day_6::pa...
//! List detected readers use crate::terminal::STDOUT; use gumdrop::Options; use std::{ io::{self, Write}, process::exit, }; use termcolor::{ColorSpec, StandardStreamLock, WriteColor}; use yubikey::{Context, Serial}; /// The `readers` subcommand #[derive(Debug, Options)] pub struct ReadersCmd {} impl Readers...
use cargo_deb::*; use cargo_deb::control::ControlArchiveBuilder; use std::env; use std::path::Path; use std::process; struct CliOptions { no_build: bool, strip_override: Option<bool>, separate_debug_symbols: bool, fast: bool, verbose: bool, quiet: bool, install: bool, selected_package_n...
use itertools::Itertools; use std::fs::read_to_string; fn main() { test("src/four.txt"); test("src/four-test.txt"); } #[derive(Debug, Clone)] struct Board(Vec<Vec<(u32, bool)>>, bool); impl Board { fn parse<'a>(x: impl Iterator<Item = &'a str>) -> Self { Board( x.skip(1) ...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use anyhow::Context; use slog::debug; use crate::mp::sync::blocking_queue::BlockingQueue; use crate::mp::threads::worker::Worker...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Softwa...
pub mod album; pub mod artist; pub mod category; pub mod common; pub mod episode; pub mod page; pub mod playlist; pub mod show; pub mod track; pub mod user; pub use album::*; pub use artist::*; pub use category::*; pub use common::*; pub use page::*; pub use playlist::*; pub use show::*; pub use track::*;
use std::collections::HashMap; use std::fmt; #[derive(Deserialize, Debug, PartialEq, Eq, Hash, Clone)] pub struct Name(String); impl fmt::Display for Name { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) } } #[derive(Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Cop...
#![feature(test)] extern crate test; extern crate uuid_v1; use test::Bencher; use uuid_v1::new_v1; #[bench] fn bench_new_v1(b: &mut Bencher) { b.iter(|| new_v1()); }
pub mod publication; pub mod request; pub mod response;
use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct SearchHistory { pub expression: String, pub uses: i64, }
use std::{ io::Cursor, path::{Path, PathBuf}, }; use base64::Engine; use g_code::{ emit::{format_gcode_fmt, format_gcode_io, FormatOptions}, parse::snippet_parser, }; use js_sys::Date; use log::Level; use roxmltree::Document; use svg2gcode::{svg2program, ConversionOptions, Machine}; use yew::prelude::*...
use super::{Pos, Vel}; use shipyard::{AllStoragesViewMut, Delete, EntitiesViewMut, ViewMut, World}; #[test] #[rustfmt::skip] fn world() { // ANCHOR: world let mut world = World::new(); let id = world.add_entity((Pos::new(), Vel::new())); world.delete_component::<Vel>(id); world.delete_component::<(Pos, Vel)>(id); //...
use crate::env::AppData; use mysql::{prelude::Queryable, Row, Params, params}; use crate::error::Error; pub mod check; pub mod describe; fn check_session(data: &AppData, session_id: &str) -> Result<(), Error> { let mut conn = data.pool.get_conn()?; match conn.exec_first::<Row, &str, Params>("SELECT...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // 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.a...
//! Linux I/O #![deny(missing_docs)] #![deny(rust_2018_compatibility)] #![deny(rust_2018_idioms)] #![deny(warnings)] #![no_std] use core::slice; use cty::c_uint; use linux_sys::Error; pub mod process; pub mod time; /// *Unbuffered* standard output singleton pub struct Stdout; impl Stdout { const FILENO: c_uin...
use std::time::Duration; const NANOS_PER_MILLI: u32 = 1_000_000; const MILLIS_PER_SEC: u64 = 1_000; pub fn millis(duration: Duration) -> u64 { // Round up. let millis = (duration.subsec_nanos() + NANOS_PER_MILLI - 1) / NANOS_PER_MILLI; duration.as_secs().saturating_mul(MILLIS_PER_SEC).saturating_add(milli...
// Gather all response related structs, that are used to map JSON responses to objects. use crate::types::ConversationId; use crate::types::ProfileId; use serde::Deserialize; use std::convert::TryFrom; #[derive(Deserialize, Debug)] pub struct AccesTokenResponse { pub access_token: String, } // Used as intermediat...
// Copyright 2016 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. //! Type-safe bindings for Magenta timer objects. use {ClockId, Duration, HandleBase, Handle, HandleRef, Status, Time}; use {sys, into_result}; /// An ob...
mod app; mod service; mod view; use crate::app::App; use crate::view::file_tree::FileTreePresenter; use crate::view::property::PropertyPresenter; use crate::view::log::LogPresenter; use crate::view::menu::MainMenuPresenter; use crate::view::Presenter; use gdk::Screen; use gtk::prelude::*; use gtk::{ CssProvider, O...
use scraper::node::Node; #[derive(Debug)] pub struct Document(pub BlockElements); #[derive(Debug)] pub struct BlockElements(pub Vec<BlockElement>); #[derive(Debug, PartialEq)] pub enum BlockElement { Table(table::Table), Heading { level: HeadingType, contents: InlineElements, }, List(...
use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use syn::parse::{Parse, ParseStream}; use syn::{Attribute, Ident, Result}; #[derive(Debug, PartialEq)] pub enum StructAttrKind { Storage, Other, } #[derive(Debug)] pub enum StructAttr { Storage, Other(TokenStream), } impl StructAttr { ...
use log::info; use std::fs::File; use std::io::Read; use std::panic::set_hook; use std::process::exit; pub fn read_file(file_name: &str) -> std::io::Result<String> { let mut file = File::open(file_name)?; let mut contents = String::new(); file.read_to_string(&mut contents)?; Ok(contents) } pub fn prin...
use crossbeam_channel::{bounded, Receiver}; use std::io::{Read, Write}; use std::os::unix::fs::DirBuilderExt; use std::os::unix::net::UnixListener; use std::process::{Command, Stdio}; use std::{env, fs, path, thread}; // This function sends a Kakoune command to the given Kakoune session. pub fn kak_command(command: &s...
use std::path::Path; use std::fs::{File, read_dir, remove_file}; use crate::service::{ServiceEntry, full_path, PASS_PATH}; use crate::hash::{HashAlg, get_digest, bin_to_str, TextMode}; pub fn exists(name: &str) -> bool { full_path(name).exists() } fn create_key(pass: &str) -> Vec<u8> { let mut digest = get...
trait Duplicable { fn dupl(&self) -> String; } impl Duplicable for String { fn dupl(&self) -> String { format!("{0}{0}", *self) } } impl Duplicable for i32 { fn dupl(&self) -> String { format!("{}", *self * 2) } } // fn duplicate<T: Duplicable> (x: T) { // println!("{}", x.dup...
//! Common implementation use super::{ decimal_to_packed_bcd, hours_to_register, packed_bcd_to_decimal, some_or_invalid_error, }; use crate::{ interface::{ReadData, WriteData}, BitFlags, DateTimeAccess, Datelike, Ds323x, Error, Hours, NaiveDate, NaiveDateTime, NaiveTime, Register, Rtcc, Timelike, }; i...
/* https://leetcode-cn.com/problems/ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof/ 面试题46. 把数字翻译成字符串 给定一个数字,我们按照如下规则把它翻译为字符串:0 翻译成 “a” ,1 翻译成 “b”,……,11 翻译成 “l”,……,25 翻译成 “z”。一个数字可能有多个翻译。请编程实现一个函数,用来计算一个数字有多少种不同的翻译方法。 示例 1: 输入: 12258 输出: 5 解释: 12258有5种不同的翻译,分别是"bccfi", "bwfi", "bczi", "mcfi"和"mzi" 提示: 0 <= num < 231 ...
use super::{Collision, Vec3, Ray}; use num::{Float}; pub trait Plane { fn hits(&self, ray: &Ray) -> Option<Collision>; fn min_extents(&self) -> Vec3; fn max_extents(&self) -> Vec3; fn translate(&self, t: Vec3) -> Self; } impl<T: Plane> Plane for Vec<T> { fn hits(&self, ray: &Ray) -> Option<Collis...
#![allow(non_camel_case_types, non_snake_case)] extern crate xcb; extern crate libc; pub mod ffi; #[macro_use] mod util; #[cfg(feature = "icccm")] pub mod icccm; #[cfg(feature = "ewmh")] pub mod ewmh; #[cfg(feature = "image")] pub mod image; #[cfg(feature = "cursor")] pub mod cursor; #[cfg(feature = "keysyms")]...
pub struct ClientOptions<'a> { pub user_agent: &'a str, } pub struct Client<'a> { pub global_device_endpoint: &'a str, pub id_scope: &'a str, pub registration_id: &'a str, pub options: ClientOptions<'a>, } impl<'a> Default for ClientOptions<'a> { #[inline] fn default() -> ClientOptions<'a>...
pub trait MemIO { fn read_byte(&self, addr: u16) -> u8; fn read_word(&self, addr: u16) -> u16; fn write_byte(&mut self, addr: u16, val: u8); fn memdump(&self, from: usize, bytes: usize); }
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // 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.a...
use swc_atoms::JsWord; use swc_common::{SyntaxContext, Visit, VisitWith}; use swc_ecma_ast::*; pub struct VarCollector<'a> { pub to: &'a mut Vec<(JsWord, SyntaxContext)>, } impl<'a> Visit<VarDeclarator> for VarCollector<'a> { fn visit(&mut self, node: &VarDeclarator) { node.name.visit_with(self); ...
use std::env; #[derive(Debug, PartialEq, Eq)] pub enum DesktopEnvironment { Unknown, Cinnamon, Enlightenment, GNOME, KDE, LXDE, LXQT, MacOs, Mate, Unity, Windows, XFCE, } pub fn detect() -> DesktopEnvironment { if cfg!(target_os = "macos") { DesktopEnvironme...
use bevy::prelude::*; pub(super) fn setup_materials( mut commands: Commands, mut materials: ResMut<Assets<ColorMaterial>>, ) { commands.insert_resource(super::types::Materials { stop_material: materials.add(Color::rgb(0.9, 0.9, 0.9).into()), tram_material: materials.add(Color::rgb(0.1, 0.7,...
// Copyright 2019 Conflux Foundation. All rights reserved. // Conflux is free software and distributed under GNU General Public License. // See http://www.gnu.org/licenses/ // Transaction execution environment. use super::{executive::*, suicide as suicide_impl, InternalContractMap}; use crate::{ bytes::Bytes, ...
use crate::common::*; pub struct Table { table: PrettyTable, } impl Display for Table { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.table.to_string()) } } impl Table { pub fn new() -> Self { let mut table = PrettyTable::new(); table.set_format(*format::consts::FOR...
use crate::client::{Client, MessageReturn}; use crate::message::MessageId; use crate::torrent::Torrent; use crate::utility; use std::{thread, time}; const MAX_REQ_SIZE: i64 = 16384; pub fn download_piece(client: &mut Client, index: u32, piece_length: i64) -> Vec<u8> { let mut no_of_iterations = piece_length / MA...
use super::super::types::{PieceName, Role}; use super::super::cell::Cell; use super::{Piece, PieceState, PieceStateTrait}; use super::super::board::Board; use super::super::chess_move::Move; use super::piece_utils; pub struct King { pub state: PieceState } impl Piece for King { fn get_state(&self) -> Box<&dyn...
pub mod types; pub mod importer; pub use self::types::*; pub use self::importer::*;
//系统常量 pub const START_DATE: &'static str = "2019-11-01"; pub const AUTHOR: &'static str = "Joshua Conero"; pub const VERSION: &'static str = "0.2.0"; pub const RELEASE: &'static str = "2020-01-04"; pub const PROJECT: &'static str = "uymas"; pub mod cmd; #[cfg(test)] mod tests { use crate::cmd; #[test] f...
//@ignore-target-windows: No libc on Windows //@ignore-target-apple: `syscall` is not supported on macOS //@compile-flags: -Zmiri-panic-on-unsupported fn main() { unsafe { libc::syscall(0); } }
#[macro_use] extern crate structopt; use structopt::StructOpt; #[derive(StructOpt, Debug)] enum Options { #[structopt(name = "remove")] RemoveFile(Remove), #[structopt(name = "rename")] RenameFile(Rename) } #[derive(StructOpt, Debug)] struct Remove { #[structopt(name = "FILE")] path: String }...
//! //! At a high level this is what is tested during //! this run. For each core we are assigned we will //! start a job //! //! //! +------------+ +-------------------------+ //! | | | | //! | job | | +--nvmf----> MS1 | //! | | | | ...
struct User { username: String, email: String, sign_in_count: u64, active: bool } fn create_with_shorthand_notation(email:String, username:String) -> User { User { email, username, active: true, sign_in_count: 0 } } fn create_from_existing(email:String, username:String, user:User) -> User ...
extern crate gcc; fn main() { gcc::compile_library("libnsexec.a", &["src/nsexec.c"]); }
fn main() { let mut a4 = [6, 4, 2, 8, 0, 9, 4, 3, 7, 5, 1, 7]; // 一部の要素を昇順にソートする a4[2..6].sort(); assert_eq!(&a4[2..6], &[0, 2, 8, 9]); // スライスを2つの可変スライスへ分割する #[allow(unused_variables)] let (s4a, s4b) = (&mut a4).split_at_mut(5); // &mutを省略しても結果は同じ。型強制によって自動的にスライスが作られる // a4[2..6]...
pub mod error; pub mod ssh_config; #[cfg(feature = "syn")] pub mod terrarust; pub mod vagrant_machine_readable_quote_unquote; pub mod version; const RON: &str = "r"; const JSON: &str = "j"; const YAML: &str = "y"; const TOML: &str = "m"; #[cfg(feature = "syn")] const TERRARUST: &str = "t"; const SSH_CONFIG: &str = "h"...
use std::path::Path; use std::convert::TryInto; use std::io; use std::fmt; mod binary_parse; use binary_parse::Primitive; fn read_ne_u8(input: &mut &[u8]) -> u8 { let (int_bytes, rest) = input.split_at(std::mem::size_of::<u8>()); *input = rest; u8::from_ne_bytes(int_bytes.try_into().unwrap()) } fn read_...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // 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.a...
use std::env; use std::process; fn main() { let config_const_values = read_toml(env::args()).unwrap_or_else(|err| { eprintln!("Problem parsing argument: {}", err); process::exit(1); }); println!("Original: {:#?}", config_const_values); println!( "[Postgresql].Database: {}", ...
pub use self::listener::Listener; pub mod file; pub mod interval; pub mod listener; pub mod once; use std::error::Error; use tokio::runtime::Runtime; /// We want Times to impliment Default + Clone for deriving and safety issues. /// Default allows a useful library serde to find default values for missing informati...
use std::collections::HashMap; use std::sync::RwLock; use anyhow::{Context, Error, Result}; use matchit::Router as MatchItRouter; use pyo3::types::PyAny; use crate::routers::Router; use crate::types::function_info::{FunctionInfo, MiddlewareType}; type RouteMap = RwLock<MatchItRouter<FunctionInfo>>; /// Contains the...
use crate::video_model::role::Role; #[derive(Debug, Deserialize)] pub struct People { pub first_name: Option<String>, pub last_name: String, pub role: Role, pub character: Option<String>, }
use crate::debot::term_browser::terminal_input; use serde_json::Value; use ton_client::abi::Abi; use ton_client::debot::{DebotInterface, InterfaceResult}; use super::dinterface::{decode_answer_id, decode_int256, decode_prompt}; use ton_client::encoding::decode_abi_bigint; const ID: &'static str = "c5a9558b2664aed7dc3e...
use super::{RpcTaskError, TaskId}; use common::{true_f, HttpStatusCode, StatusCode}; use derive_more::Display; /// In most cases, the RPC task status request may fail with either [`RpcTaskStatusError::NoSuchTask`] or [`RpcTaskStatusError::Internal`]. /// Please do not add new error variants unless they are used in mos...
use crate::{GpuLoc, GpuDev}; use cuda::runtime::{CudaDevice}; use std::cell::{Cell}; thread_local! { static TL_PCTX_STATE: Cell<CudaPCtxState> = Cell::new(CudaPCtxState::Rst); } #[derive(Clone, Copy)] enum CudaPCtxState { Rst, Drp(GpuDev), Set(GpuDev), } pub struct CudaPCtxRef { dev: GpuDev, } impl Drop...
#[derive(Debug)] struct Person<'a> { name: &'a str, age: u8, } struct Nil; struct Pair(i32, f32); #[derive(Debug)] struct Point { x: f32, y: f32, } #[allow(dead_code)] #[derive(Debug)] struct Rectangle { p1: Point, p2: Point, } fn rect_area(rect: Rectangle) -> f32 { let Point { x: x1, y...
use std::f64::consts::PI; use crate::dxf::polyline::PolyLine; use crate::dxf::vertex::Vertex; #[derive(Debug, Clone)] pub struct Circle { pub centre: Vertex, pub radius: f64 } impl Circle { pub fn into_polyline(self) -> PolyLine { let mut points = vec![]; let circumference: f64 = 2.0 * PI...
use crate::shared::{ cq::{ backend::{ accounts::cq::RegisterIndividualBuyerAccount, Body::REGISTERINDIVIDUALBUYERACCOUNT, }, CQBody }, domain::{ backend::{routing_keys::ACCOUNT_BUYER_ROUTE, DomainName as BackEndDomainName}, types::PersonalInfor...
// while loop fn main() { let mut n = 0; while n < 10 { n += 1; println!("Counting... {}", n); } println!("Done"); }
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 ...
pub mod pos;
extern crate rustc_serialize; extern crate docopt; mod tokenizer; mod parser; mod generator; use std::fs::File; use std::io::Read; use docopt::Docopt; // Usage string static USAGE: &'static str = " Usage: cbLIA <source> "; // Args struct for usage string #[derive(RustcDecodable)] struct Args { arg_source: St...
use crate::{ errors::{SyntaxErr, SyntaxErrReason}, tokens::{Token, TokenKind}, }; use std::{convert::TryInto, str::Chars}; pub struct Lexer<'a> { s: Chars<'a>, } impl<'a> Lexer<'a> { pub fn new(s: &'a str) -> Lexer<'a> { Lexer { s: s.chars() } } } impl<'a> Iterator for Lexer<'a> { typ...
use crate::cache::StoreCache; use crate::store::ChainStore; use ckb_db::{ iter::{DBIterator, DBIteratorItem, Direction}, Col, DBPinnableSlice, RocksDBSnapshot, }; use std::sync::Arc; pub struct StoreSnapshot { pub(crate) inner: RocksDBSnapshot, pub(crate) cache: Arc<StoreCache>, } impl<'a> ChainStore<...
type ty_mach = tag( ty_i8(), ty_i16(), ty_i32(), ty_i64(), ty_u8(), ty_u16(), ty_u32(), ty_u64(), ty_f32(), ty_f16() ); fn ty_mach_to_str(ty_mach tm) -> str { alt (tm) { case (ty_u8()) { ret "u8"; } case (ty_i8()) { ret "i8"; } case (ty_u16()) { ret ...
use derive_more::Display; use parking_lot::RwLock; use protocol::{ async_trait, codec::ProtocolCodecSync, traits::{ IntoIteratorByRef, StorageAdapter, StorageBatchModify, StorageIterator, StorageSchema, }, Bytes, ProtocolError, ProtocolErrorKind, ProtocolResult, }; use std::{ collection...
use crate::core::pbrt::{Float, consts::PI}; use crate::core::geometry::{Point3f, Vector3f, Normal3f}; use crate::core::transform::Transform; use super::triangle::TriangleMesh; use std::hash::{Hash, Hasher}; use smallvec::SmallVec; use std::sync::Arc; use std::cmp::Ordering; use hashbrown::{HashSet, HashMap}; macro_rul...
use crate::shading::Shader; use cgmath::Vector3; #[derive(Debug)] pub struct Collision<'a> { pub point: Vector3<f64>, pub normal: Vector3<f64>, pub shading_data: &'a Box<Shader>, }
extern crate linxal; extern crate itertools; extern crate rand; extern crate ndarray; use ndarray::prelude::*; use linxal::generate::{MG, RandomGeneral, RandomUnitary}; use linxal::types::{c32, c64}; use linxal::properties::{is_unitary, is_diagonal}; use rand::thread_rng; fn test_gen_unitary<T: MG> () { for t i...
use std::io::BufReader; use std::io::BufRead; use std::fs::File; extern crate clap; use self::clap::{Arg,App}; pub fn get_file_path() -> Option<String> { let matches = App::new("Advent of Code 2018") .version("1.0") .about("At some point, I will finish this challenge") ...
mod db_oidc; mod db_oidc_multiple; mod db_otp; mod fixed_otp; mod fixed_password; mod kerberos; mod ldap; mod php_bb; mod uru; /// The result of an attempt at authentication pub enum AuthResult { /// The user should be denied access Failure, /// The user should be granted access by sending a JWT as a response ...
//! This is main file but there is nothing to running. //! use `cargo test` to test each problems. // https://doc.rust-lang.org/book/ch11-03-test-organization.html#the-tests-module-and-cfgtest // https://doc.rust-lang.org/book/ch07-05-separating-modules-into-different-files.html#separating-modules-into-different-files...
use crate::inputs::key::Key; use std::collections::HashMap; use std::fmt; use std::fmt::Display; use std::slice::Iter; #[derive(Debug, Clone, Copy, Eq, PartialEq)] pub enum Action { Quit, } impl Action { pub fn iterator() -> Iter<'static, Action> { static ACTIONS: [Action; 1] = [Action::Quit]; ...
use actix_web::{get, web, Responder}; #[get("/{id}/{name}")] pub async fn index_path(info: web::Path<(u32, String)>) -> impl Responder { format!("Hello {}! id:{}", info.1, info.0) } #[get("/")] pub async fn index() -> impl Responder { format!("Hello Guys!!!!") }
fn five() ->(i32,f64,u8) { let tup=(400,5.5,1); tup } fn main() { let x=five(); println!("{} {} {}",x.0,x.1,x.2); }
//Started script log at Sun Jun 24 15:47:23 2018 getFixture(19).select(); getFixture(19).deselect(); getFixture(18).select(); getFixture(18).deselect(); getFixture(22).select(); getFixture(22).deselect(); getFixture(17).select(); getFixture(17).deselect(); getFixture(1).select(); getFixture(1).deselect(); getFixture(2...
use ops::operation::Operation; use vm::state; pub struct Not; impl Operation for Not { fn run(&self, vm_state: &mut state::VMState) { let ci = vm_state.get_current_instruction(); let val = vm_state.get_mem_or_register_value(ci + 2); let reg = vm_state.get_mem_raw(ci + 1); let new_val = (!val) % 32768; vm_st...
use super::*; use super::puzzles::Data; use std::vec::Vec; #[derive(Clone)] #[derive(Debug)] #[derive(std::cmp::PartialEq)] pub enum Instruction{ N(i64), E(i64), S(i64), W(i64), R(i64), L(i64), F(i64), } impl Instruction{ /*fn get_data(&self)->i64{ match self{ Inst...
use chrono::Utc; use diesel::prelude::*; use diesel::{self, PgConnection}; use crate::models::{NewTrackName, TrackId, TrackName}; pub struct TrackNameRepository<'a> { connection: &'a PgConnection, } impl<'a> TrackNameRepository<'a> { pub fn new(connection: &PgConnection) -> TrackNameRepository<'_> { ...
//! This module holds all the different types that can appear in our ASTs. There //! is no functionality implemented here, just basic types. Every AST node type //! is generic and can hold an extra value. This is useful to carry metadata //! along with the AST (e.g. source spans). use serde::Serialize; use std::fmt::{...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // 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.a...
// Copyright 2020 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 use super::{utils, Provider}; use crate::authenticators::ApplicationIdentity; use crate::key_info_managers::KeyIdentity; use parsec_interface::operations::{psa_asymmetric_decrypt, psa_asymmetric_encrypt}; use parsec_interface::...
extern crate iron; extern crate handlebars as hbs; extern crate handlebars_iron as hbi; extern crate hyper; extern crate mount; extern crate router; extern crate staticfile; use iron::{prelude::*,IronResult, status, Set}; use hbs::Handlebars; use hbi::{HandlebarsEngine}; use mount::Mount; use staticfile::Static; use s...
use actix_web::{HttpResponse, ResponseError}; use log::error; use std::fmt; pub const URL_TO_SAVE: &str = "store"; pub const URL_TO_PREVIEW: &str = "preview"; pub fn create_preview(filename: String) { let width = 100; let height = 100; let img = image::open(format!("{}/{}", URL_TO_SAVE, filename)).unwrap(...
pub mod bitmap; pub mod pixel; pub mod rect; use exr::prelude::write_rgb_f32_file; #[allow(clippy::wildcard_imports)] use graphite::*; use bitmap::Bitmap; use pixel::Pixel; use crate::color::{Color, Rgb}; const BLOCK_SIZE: I2 = A2(32, 32); pub type Image = Bitmap<Pixel>; macro_rules! conv { ($expr:expr) => { ...
/** * [66] Plus One * * You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's. Increment the large integer...
//@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows -Zmiri-permissive-provenance #![feature(ptr_internals)] fn main() { into_raw(); into_unique(); boxed_pair_to_vec(); } fn into_raw() { unsafe { let b = Box::new(4i32); let r = Box::into_raw(b); // "lose the ta...
mod serialize; use super::{Area, DragTarget, DropTarget}; use dock::DockHandle; use rect::{Rect, Direction}; /// Handle to a split #[derive(Debug, PartialEq, Clone, Copy)] pub struct SplitHandle(pub u64); /// Given rectangle area is split in two parts. #[derive(Debug, Clone)] pub struct Split { /// Children ...
use std::fmt; use crate::descriptor::field_descriptor_proto; use crate::descriptor::FieldDescriptorProto; use crate::message_dyn::MessageDyn; use crate::reflect::acc::v2::map::MapFieldAccessorHolder; use crate::reflect::acc::v2::repeated::RepeatedFieldAccessorHolder; use crate::reflect::acc::v2::singular::SingularFiel...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Ethernet DMA bus control register"] pub dma_bctl: DMA_BCTL, #[doc = "0x04 - Ethernet DMA transmit poll enable register"] pub dma_tpen: DMA_TPEN, #[doc = "0x08 - Ethernet DMA receive poll enable register"] pub dma_rp...
#![allow(dead_code)] use std::collections::HashSet; use go::{Player, Board, Stone}; use engine; #[cfg(test)] mod test; /// A KoState as used by the aga super ko rules /// /// Stores a board-layout and the current player. Such a /// combination is not allowed to repeat with the same game. #[derive(Hash, PartialEq, Cl...