text
stringlengths
8
4.13M
//#![feature(proc_macro_hygiene)] #![feature(asm)] extern crate monoasm; extern crate monoasm_macro; use monoasm::test; use monoasm::JitMemory; use monoasm_macro::monoasm; mod fact; mod fibo; fn syscall() -> fn(()) -> u64 { let hello = "こんにちは世界\n\0"; let mut jit: JitMemory = JitMemory::new(); monoasm!(jit,...
use std::collections::HashMap; use crate::util::*; use crate::intcode::*; extern crate num_bigint; extern crate num_traits; fn robot(program:&mut Program, inputvalue:i64) -> usize { // initialize inputs let mut input = Vec::new(); input.push(fi64(inputvalue)); let mut x=0; let mut y=0; let mut panels = ...
use std::net::{ToSocketAddrs, SocketAddr}; use hyper::server::Server; use hyper::net::Fresh; use hyper::server::Listening; use hyper::error::Result as HttpResult; use hyper::server::request::Request as HttpRequest; use hyper::server::response::Response as HttpResponse; use std::io::Read; pub struct XmlrpcServer { ...
use machine::state::State; /// preload data immediate pub fn preldi(_state: &mut State, _x: u8, _y: u8, _z: u8) { // Nothing to do here :) }
use crate::event::{ GameKeyboardEvent, GameMouseButtonEvent, GameMouseMotionEvent, UiEvent, }; pub trait Interfaceable { fn on_key_press(&mut self, _event: &GameKeyboardEvent) -> Result<(bool, UiEvent), String> { Ok((false, UiEvent::None)) } fn on_key_release(&mut self, _event: &Ga...
use itertools::Itertools; use std::convert; use std::convert::TryInto; use std::fmt; use std::io; use std::io::Write; use std::num; use std::str; const BOARD_SIZE: usize = 3; #[derive(Clone, Copy, PartialEq, Eq)] enum Player { X, O, } impl Player { fn toggle(self) -> Player { match self { ...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::RSER { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut ...
pub use failure::{format_err, Error}; pub type Result<T> = std::result::Result<T, Error>; pub mod board; pub mod util;
#[macro_use] extern crate criterion; use benchmarks::readers::iterators::*; use criterion::{black_box, Criterion, ParameterizedBenchmark}; use readers::prelude::{Index, IndexIterator}; fn roll_fn(size: usize, m: usize) -> usize { let mut total = 0; for i in 0..size { let k = i % 5; for j in 0..m { t...
use std::collections::BTreeMap; use markdown::parsers::format_links; use tasks::CompileState; use crate::{get_template_file, render_includes, Render}; pub struct LinkPage { pub links: BTreeMap<String, Vec<String>>, } impl LinkPage { pub fn new(links: BTreeMap<String, Vec<String>>) -> Self { LinkPage...
use regex::Regex; use aoc_runner_derive::aoc; const MAX_RULES: usize = 130; fn parse_input_day19(input: &str) -> (Vec<String>, Vec<String>) { let mut input = input.split("\n\n"); let rule_regex = Regex::new(r#"^(\d+): "?([\d\s\|\w]+)"?$"#).unwrap(); let raw_rules: Vec<_> = input.next().unwrap().lines().c...
// Copyright (c) 2015 Alcatel-Lucent, (c) 2016 Nokia // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // * Redistributions of source code must retain the above copyright // notice,...
#![cfg_attr(feature = "dev", allow(unstable_features))] #![cfg_attr(feature = "dev", feature(plugin))] #![cfg_attr(feature = "dev", plugin(clippy))] mod logger; mod toml_file; mod git; mod changelog; mod commit_analyzer; mod cargo; mod error; mod github; mod config; extern crate rustc_serialize; extern crate toml; ex...
#![cfg_attr(feature = "clippy", feature(plugin))] #![cfg_attr(feature = "clippy", plugin(clippy))] use { anyhow::{anyhow, Result}, clap::Parser, console::style, rs_tracing::{ close_trace_file, close_trace_file_internal, open_trace_file, trace_scoped, trace_scoped_internal, trace_to_file...
use anyhow::{anyhow, Result}; use nalgebra::DMatrix; pub fn parse(input: &str) -> Result<DMatrix<u32>> { let mut ncols = 0; let mut nrows = 0; let mut data = Vec::new(); for line in input.lines().filter(|line| !line.trim().is_empty()) { let digits: Vec<u32> = line .trim() ...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::MyWorld; use cucumber::{Steps, StepsBuilder}; use starcoin_logger::prelude::*; use starcoin_rpc_client::RpcClient; use std::env; use std::sync::Arc; pub fn steps() -> Steps<MyWorld> { let mut builder: StepsBuilder<MyW...
#[allow(unused_imports)] use tracing::{error, info, warn, debug}; use error_chain::bail; use std::sync::Arc; use crate::error::*; use crate::meta::*; use crate::validator::*; use crate::event::*; use crate::transaction::*; use crate::spec::*; use super::*; impl EventValidator for TreeAuthorityPlugin { fn clone_v...
#![allow(non_snake_case)] extern crate bulletproofs; extern crate curve25519_dalek; extern crate merlin; extern crate rand; use bulletproofs::r1cs::*; use bulletproofs::{BulletproofGens, PedersenGens}; use curve25519_dalek::ristretto::CompressedRistretto; use curve25519_dalek::scalar::Scalar; use merlin::Transcript; ...
/* * Copyright 2018 Fluence Labs 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 by applicable law or a...
pub mod shared; pub mod game;
// Copyright (C) 2021 Scott Lamb <slamb@slamb.org> // SPDX-License-Identifier: MIT OR Apache-2.0 //! Track RTSP interleaved channel->stream assignments. use std::num::NonZeroU8; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum ChannelType { Rtp, Rtcp, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub ...
use yew::prelude::*; use crate::{resources::*, ECS}; pub(crate) struct HealthView { model: ECS, } #[derive(Clone, Properties)] pub(crate) struct HealthProps { pub(crate) ecs: ECS, } #[derive(Clone)] pub(crate) enum HealthMsg {} impl Component for HealthView { type Message = HealthMsg; type Properti...
use std::borrow::Borrow; use std::hash::Hash; use crate::cache::InsertionPolicy; pub struct AlwaysInsertPolicy {} impl Default for AlwaysInsertPolicy { fn default() -> Self { AlwaysInsertPolicy {} } } impl<K> InsertionPolicy<K> for AlwaysInsertPolicy { fn should_add(&mut self, _key: &K) -> bool ...
use crate::models::SiteModel; use crate::utils::{from_doc, to_doc, CliError, Result}; use async_trait::async_trait; use chrono::offset::Utc; use mongodb::options::{FindOptions, UpdateModifications}; use std::result; #[async_trait] pub trait ISiteRepository: Send + Sync { async fn list(&self, from: u32, length: u32...
use crate::uuid; use std::error::Error as ErrorTrait; use std::fmt; use std::io; #[derive(Debug, PartialEq)] pub struct Error(String); impl Error { pub fn new(s: &str) -> Error { Error(s.to_string()) } } impl From<&str> for Error { fn from(s: &str) -> Error { Error(s.to_string()) } } ...
use reset_router::{Request, RequestExtensions, Response, Router, SharedService}; use std::sync::Arc; pub struct Handler(Arc<String>); impl SharedService for Handler { type Response = Response; type Error = Box<dyn std::error::Error + Send + Sync + 'static>; type Future = futures::future::Ready<Result<Self...
use std::sync::Arc; use abscissa_core::{Command, Options, Runnable}; use tokio::runtime::Runtime as TokioRuntime; use ibc::events::IbcEvent; use ibc::ics24_host::identifier::{ChainId, ClientId}; use ibc_relayer::upgrade_chain::{build_and_send_upgrade_chain_message, UpdatePlanOptions}; use ibc_relayer::{ chain::{C...
use crate::framework::response::ApiResult; use serde::Deserialize; pub mod get; pub mod post; pub use get::{ReleaseInfo, ReleaseList}; pub use post::{ReleaseCreate, ReleaseCreateParams, ReleaseRollback, ReleaseRollbackParams}; impl ApiResult for Release {} impl ApiResult for Vec<Release> {} /// Heroku Release /// /...
use std::io::{stdin, Read}; pub fn run() { let program = read_memory(); for i in 0..100 { for j in 0..100 { let mut memory = program.clone(); memory[1] = i; memory[2] = j; run_computer(&mut memory); if memory[0] == 19690720 { ...
fn do_the_thing(data: &[isize], window_length: usize) -> Option<usize> { for (index, number) in data.iter().enumerate().skip(window_length) { let mut not_a_sum = true; for window_number_1 in &data[(index-window_length)..index] { for window_number_2 in &data[(index-window_length)..index]...
use std::fs; fn read_word(opcodes: &Vec<i32>, start_idx: usize) -> (i32, i32, i32) { (opcodes[opcodes[start_idx + 1] as usize], opcodes[opcodes[start_idx + 2] as usize], opcodes[start_idx + 3]) } fn run_program(opcodes: &mut Vec<i32>) { let mut curr_idx: usize = 0; loop { let op = opcode...
use crate::memory::address::PhysicalPageNumber; use crate::memory::config::{PAGE_ENTRY_SIZE, PAGE_SIZE}; use crate::memory::frame::frame_tracker::FrameTracker; use crate::memory::mapping::page_table_entry::PageTableEntry; #[repr(C)] pub struct PageTable { // PageTableSize = PageEntrySize = 4 KiB = 512 * 8 Byte ...
//! //! Tests an oddity that irises when a macro creates a macro_rules. //! This happens when a macro wants to partially apply `tt_equal` and then //! use the resulting macro as a predicate (in this case for use in `tt_call::replace`. //! //! In the predicate macro `is_placeholder`, 'some_placeholder' is inserted as a ...
// Copyright 2020 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 { diagnostics_data::Logs, diagnostics_hierarchy::{assert_data_tree, testing::AnyProperty}, diagnostics_reader::{ArchiveReader, Inspect}, ...
/* Copyright © 2020, Jason Ekstrand * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish,...
use std::{fmt, fs, io, process}; use std::sync::atomic::{AtomicU32, Ordering}; use byteorder::{BigEndian, WriteBytesExt}; use crc::crc32; use crypto::digest::Digest; use crypto::md5; use hostname; use rand::{thread_rng, Rng}; #[derive(Clone, Hash, Eq, PartialEq, Ord, PartialOrd)] pub struct Xid { bytes: [u8; SIZEO...
/// To annotate values with type-level names use std::marker::PhantomData; struct _Named<Name, A> { value: A, _phantom: PhantomData<Name>, } struct _Name; /// A trait describing a value annotated with a type-level `name`, which can /// then be used to describe certain type-level properties about the value. /...
use log::trace; use std::time::Duration; pub struct FrameContext<P: image::Pixel> { pub current: usize, pub limits: usize, pub timestamp: Duration, pub frame: image::ImageBuffer<P, Vec<<P as image::Pixel>::Subpixel>>, pub width: u32, pub height: u32, } impl<P: 'static + image::Pixel> FrameCont...
use data::DataSet; use core::{Message, EvalResult}; use evo_sys::eval::eval; use params; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use std::sync::mpsc; use std::thread; use core::config::ThreadDefaults; use core::config::config::process_thread_defaults; use std::time::Duration; use evo_sys...
use std::env::{self, VarError}; use std::fs::File; use std::io::prelude::*; use std::path::PathBuf; use std::result::Result as StdResult; use crate::{InitializationError, InitializationResult}; mod errors; pub mod parsers; pub use self::errors::*; use self::parsers::*; /// Credentials of the resource Owner /// req...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::*; use std::fs; static EXPECTED_SINGLE_NODE_CONFIG: &[u8] = include_bytes!("../../data/configs/single.node.config.toml"); #[test] fn verify_test_config() { // This test likely failed because there was a breaking ch...
use super::{Impl, Component, ComponentName, Multiplier}; #[derive(Clone, Copy, Debug, PartialEq)] pub enum DataType { Length, Number, Percentage, LengthPercentage, Color, Image, Url, Integer, Angle, Time, Resolution, TransformFunction, TransformList, CustomIdent,...
use lazy_static::lazy_static; use rust_stemmers::{Algorithm, Stemmer}; use std::collections::HashSet; lazy_static! { static ref STOP_WORDS: HashSet<String> = { [ "a", "and", "be", "have", "i", "in", "of", "that", "the", "to", ] .iter() .map(|word| word.to_string()) ...
use super::node_info::{NodeTypeEnum, NodeInfo, get_max_score}; use std::iter::repeat; pub fn show_tree(indent: usize, handle: &NodeInfo) { let node = handle; // FIXME: don't allocate print!("{}", repeat(" ").take(indent).collect::<String>()); match node.node_type { NodeTypeEnum::Text => { ...
use std::{path::PathBuf, process::Command}; use himawari_render::Options; use anyhow::Result; use clap::Parser; use image::ImageFormat; #[derive(Parser)] #[clap(name = "himawari_cli")] #[clap(bin_name = "himawari_cli")] enum Commands { Wallpaper(WallpaperCommand), Image(ImageCommand) } #[derive(clap::Args)] stru...
use crate::message_dyn::MessageDyn; use crate::reflect::acc::v2::AccessorV2; use crate::reflect::ReflectFieldRef; pub(crate) mod v2; #[derive(Debug)] pub(crate) enum GeneratedFieldAccessor { V2(AccessorV2), } /// Accessor object is constructed in generated code. /// Should not be used directly. #[derive(Debug)] ...
/// 42. /// /// 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 /// /// /// /// 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)。 感谢 Marcos 贡献此图。 /// /// 示例: /// /// 输入: [0,1,0,2,1,0,1,3,2,1,2,1] /// 输出: 6 /// /// 来源:力扣(LeetCode) /// 链接:https://leetcode-cn.com/problems/trapping-rain-water /// 著作权...
pub mod field; pub mod product; pub mod submission;
// This file is part of mbedtls. 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/mbedtls/master/COPYRIGHT. No part of mbedtls, including this file, may be copied, modified, propagated, or distributed except...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct NodeSensorsNodeSensor { /// The count of values in this sensor group. #[serde(rename = "count")] pub count: Option<i32>, /// The name of this sensor group. #[serde(rename = "name")] pub name: Opt...
pub fn rabbits(n: u64, k: u64) -> u64 { let mut immature_pairs = 1; let mut mature_pairs = 0; for _ in 1..n { let offspring_pairs = mature_pairs * k; mature_pairs += immature_pairs; immature_pairs = offspring_pairs; } immature_pairs + mature_pairs } #[cfg(test)] mod rabbit...
use std::collections::HashMap; use std::env; use std::fmt; use std::fs::File; use std::io::{self, Write}; use std::process::exit; use crate::flags::{FlagParseError, Flags, ParseOutcome}; use crate::rustc; use crate::util::*; #[derive(Debug)] pub(crate) enum OptionError { FlagError(FlagParseError), Generic(Str...
mod util; use scpi::cmd_qonly; use scpi::{error::Result, tree::prelude::*}; use util::TestDevice; use std::convert::TryFrom; use std::marker::PhantomData; extern crate std; #[derive(Default)] struct EchoCommand<T>(PhantomData<T>); impl<T> EchoCommand<T> { const fn new() -> Self { Self(PhantomData) ...
#![allow(unused_imports)] use color_eyre::eyre::{self, WrapErr}; use structopt::StructOpt; use tracing::{event, info, instrument, span, warn, Level}; use {{crate_name}}::*; #[instrument] fn main() -> eyre::Result<()> { let args = Opt::from_args(); install_tracing(&args.tracing_filter); color_eyre::instal...
use crate::err; /// Structs implementing the `JsonSerializable` trait are losslessly transformable to and from /// (optionally base64 encoded) JSON and back again. /// /// `ClaimSet` and `JWTHeader` implement this trait. `JWT` implements this trait, transitively /// using those implementations as part of its own imple...
use crate::components; use crate::prelude::*; pub fn tooltips( positions: Query<(&PointC, &components::Name, Option<&Health>)>, player_fov_query: Query<&FieldOfView, With<Player>>, (mouse_pos, camera): (Res<Point>, Res<Camera>), ) { let offset = Point::new(camera.left_x, camera.top_y); let map_pos ...
use crate::alloc; use crate::page; use crate::{info, print, println}; use crate::cpu::TrapFrame; use crate::symbols::*; #[repr(C)] pub struct ELFHeader { pub magic: u32, pub elf: [u8; 12], pub etype: u16, pub machine: u16, pub version: u32, pub entry: u64, pub phoff: u64, pub shoff: u64...
use std::error::Error; use std::convert::From; pub struct MoroccoError { pub message: String } impl <A: Error> From<A> for MoroccoError { fn from(err: A) -> MoroccoError { let message = String::from(err.description()); MoroccoError { message } } } pub enum PutResult ...
#![feature(test)] extern crate test; use cache_metrics::Cache; use test::Bencher; #[bench] fn bench_hit(b: &mut Bencher) { let mut cache = Cache::new(500); b.iter(|| { cache.insert(&5); }); } #[bench] fn bench_miss(b: &mut Bencher) { let mut cache = Cache::new(1000000); // Pre fill th...
#![allow(dead_code)] // For now, come back to this when compiler has matured -- MH 27/05/21 use std::collections::VecDeque; /// Simple double ended queue that ensures that all elements are unique. Queue /// elements are not ordered (we expect the queue to be rather small). pub struct DequeSet<T: Eq> { inner: VecD...
use queen_attack::*; use rstest::*; #[test] fn chess_position_on_the_board_is_some() { assert!(ChessPosition::new(2, 4).is_some()); } #[rstest] #[case(- 1, 2)] #[case(8, 2)] #[case(5, - 1)] #[case(5, 8)] fn chess_position_off_the_board_is_none(#[case] rank: i32, #[case] file: i32) { assert!(ChessPosition::new...
//! Write `ReadPair` objects to a set of FASTQ files. use failure::{Error, ResultExt}; use std::io::Write; use std::path::{Path, PathBuf}; use crate::read_pair::{ReadPair, WhichRead}; use crate::read_pair_iter::InputFastqs; use crate::utils; /// Read sequencing data from a parallel set of FASTQ files. /// Illumina s...
//! Terra is a large scale terrain generation and rendering library built on top of wgpu. #![cfg_attr(test, feature(test))] #[cfg(test)] extern crate test; #[macro_use] extern crate lazy_static; extern crate rshader; mod cache; mod coordinates; mod generate; mod gpu_state; mod mapfile; mod priority_cache; mod sky; m...
use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt, Debug)] pub enum Cmdline { /// Print u-blox messages from a file. File { /// Path to captured messages. #[structopt(name = "PATH")] path: PathBuf, }, /// Print u-blox messages from a serial port. Serial { ...
use std::collections::BTreeMap; pub fn transform(input: &BTreeMap<i32, Vec<char>>) -> BTreeMap<char, i32> { let mut input_clone = input.clone(); let mut output: BTreeMap<char, i32> = BTreeMap::new(); for (score, character_array) in input_clone.iter_mut() { for character in character_array { ...
use crate::bootboot_bindings::*; /* #define MMapEnt_Ptr(a) (a->ptr) #define MMapEnt_Size(a) (a->size & 0xFFFFFFFFFFFFFFF0) #define MMapEnt_Type(a) (a->size & 0xF) #define MMapEnt_IsFree(a) ((a->size&0xF)==1) #define MMAP_USED 0 /* don't use. Reserved or unknown regions */ #define MMAP_FREE 1 /* usable mem...
use anyhow::Error; #[derive(Debug, PartialEq, Eq, Clone)] pub enum Response { Say(String), Act(String), Notice(String), None, } pub enum Outcome { Success(Response), Failure(Error), Forward(String), } pub trait IntoResponse { fn into_response(self) -> Response; } impl IntoResponse fo...
use diesel::insert; use diesel::prelude::*; use diesel::sqlite::SqliteConnection; use config::ConnectionConfig; use store::models::{Clip, NewClip}; use store::schema::clips; use store::schema::clips::dsl::*; pub struct Indexer { store: SqliteConnection } impl Indexer { pub fn new(connection_config: &Connec...
fn main() { println!("Char:\n"); let _x = 'x'; let a = '\u{2764}'; println!("{}", a); let z: char = '9'; println!("O {} é dígito?", z.is_digit(10)); println!("O {} é binário?", z.is_digit(2)); let b: char = '→'; let c: String = a.escape_unicode().collect(); println!("{} em unicod...
use sdl2::rect::Rect; #[derive(Clone, Debug)] pub struct Space { internal: Rect, relative: bool, } impl Space { pub fn new(x: i32, y: i32, width: u32, height: u32, rel_pos: bool) -> Self { Self { internal: Rect::new(x, y, width, height), relative: rel_pos, } } ...
use super::*; pub enum Operation { Request, Reply, } impl fmt::Display for Operation { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Operation::Reply => write!(f, "Reply"), Operation::Request => write!(f, "Request") } } } pub struct Ar...
use crate::{position::{Direction, Position}, terminal::Terminal}; pub struct Weapon { ammo: u16, clip: u8, clipSize: u16, fallOff: bool, weaponType: WeaponType, bulletsShot: Vec<Bullet>, } impl ToString for Weapon { fn to_string(&self) -> String { format!("ammo:{} clip:{} falloff:{...
/// # 6. ZigZag Conversion /// /// The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) /// /// P A H N /// A P L S I I G /// Y I R /// And then read line by line: "PAHNAPLSIIGYIR" /// /// W...
use std::error::Error; use std::fs; use crate::commands::factory::SilentCommand; use crate::models::commands::DeleteFile as DeleteFileModel; use crate::services::disk_path; pub struct DeleteFile { pub model: DeleteFileModel, } impl SilentCommand for DeleteFile { fn exec(self) -> Option<Box<dyn Error>> { ...
//! List intrinsics use crate::{ common::sourcemap::Smid, eval::machine::intrinsic::{CallGlobal1, CallGlobal2, Const, StgIntrinsic}, }; use super::{ panic::Panic, syntax::{ dsl::{annotated_lambda, case, data, local, lref, str, value}, LambdaForm, }, tags::DataConstructor, }; /...
#![cfg_attr( not(feature = "use_hashbrown"), feature(hash_drain_filter, hash_raw_entry, hash_set_entry) )] pub mod clause; pub(crate) mod helpers; pub mod join; pub mod tuple; #[cfg(feature = "datascript")] pub mod datascript; use std::borrow::Borrow; use crate::join::Join; pub use crate::join::{Hash, Merge...
// 6.3.2 Codeモジュール // Hackアセンブリ言語のニーモニックをバイナリコードへ変換する use crate::parser::Command; pub fn code(command: Command) -> [bool; 16] { match command { // A命令 // 0vvvv vvvv vvvv vvvv Command::ACommand(s) => { // A命令のvalue部分を、2進数の文字列に変換 let bit_string = format!("{:b}", s.par...
use crate::common::*; #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] pub(crate) struct FileInfo { pub(crate) length: Bytes, pub(crate) path: FilePath, #[serde( skip_serializing_if = "Option::is_none", default, with = "unwrap_or_skip" )] pub(crate) md5sum: Option<Md5Digest>, }
pub mod status; pub mod user;
use std::net::{IpAddr, Ipv4Addr}; use std::ops::Range; use std::path::PathBuf; use configr::{Config, Configr}; use serde::{Deserialize, Serialize}; #[derive(Configr, Deserialize, Serialize, Debug, Clone)] pub struct AppConfig { pub ip: IpAddr, pub port_range: Range<u16>, pub catch_all: CatchAllPort, pub web_root...
use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use clap::{App, Arg}; #[derive(Clone, Copy, Debug, PartialEq)] enum SeatState { Floor, Empty, Occupied, } impl std::fmt::Display for SeatState { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { ...
pub mod start;
pub mod dto; pub mod pik; pub mod calc; pub mod log; pub mod types;
use super::*; use super::super::super::core::memory::*; use super::tiles::*; use super::obj::*; pub fn render_mode_1(dispcnt: u16, memory: &mut GbaMemory, line: u16, lines: &mut GbaDisplayLines) { lines.bg0_enable = true; lines.bg1_enable = true; lines.bg2_enable = true; lines.bg3_enable = false; // I use this i...
fn main() { for x in 0usize..100usize { let x = x as f64 / 100.0 * std::f64::consts::PI * 2.0; let sin_x = x.sin(); let cos_x = x.cos(); debug_plotter::plot!((x, sin_x) as "sin(x)", (x, cos_x) as "cos(x)" where caption = "Trigonometry", x_desc = "x"); } }
#![allow(unused_imports)] use proconio::{fastout, input, marker::*}; #[fastout] fn main() { input! { cs: Chars }; let mut ans = true; for (i, c) in cs.into_iter().enumerate() { if c == 'U' || c == 'D' || (i % 2 == 1 && c == 'L') || (i % 2 == 0 && c == 'R') { // ok ...
use std::fmt::{Display, Formatter, Error}; use std::fmt; #[derive(Debug)] pub enum Command { Inbox, Outbox, CopyTo(Reference), CopyFrom(Reference), Add(Reference), Subtract(Reference), Increment(Reference), Decrement(Reference), Jump(LabelRef), JumpIfZero(LabelRef), JumpIfNe...
//! # Net packets //! //! These packets are net entities that are used to send data from the one endpoint to another. //! A packet is defined by a single byte in the stream and then may be read accordingly. They //! resemble commands, and may be understood differently depending on the type of endpoint. extern crate by...
#[derive(thiserror::Error, Debug)] pub enum VersionFileError { #[error( "Meilisearch (v{}) failed to infer the version of the database. Please consider using a dump to load your data.", env!("CARGO_PKG_VERSION").to_string() )] MissingVersionFile, #[error("Version file is corrupted and th...
#![warn(clippy::all)] use futures::future::{self, Future}; use futures::stream::Stream; use hyper::{ rt::{self, Future as HyperFuture}, service::service_fn, Body, Error as HyperError, Method, Request, Response, Server, StatusCode, }; use std::{ error::Error, fmt::{self, Display}, net::{AddrPars...
fn use_alphabet(alphabet: &[char]) { println!("{:?}", alphabet[1]); } pub fn main() { let s = "aaa \n "; println!("__{}__", s); println!("__{}__", s.trim_end()); println!("{:?}", s.chars().nth(1)); let alphabet: [char; 3] = ['a', 'b', 'c']; println!("{:?}", alphabet[1]); use_alphabet(...
use crate::pedersen::*; use ark_crypto_primitives::{commitment::pedersen::constraints::CommGadget, CommitmentGadget}; use ark_ed_on_bls12_381::{constraints::EdwardsVar, *}; use ark_r1cs_std::{ alloc::AllocVar, eq::EqGadget, fields::fp::FpVar, groups::curves::twisted_edwards::AffineVar, uint8::UInt8, }; use ark_relati...
// //! 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 by a...
pub mod service; pub(crate) use service::Service; pub mod algorithm; pub(crate) use algorithm::Algorithm; pub mod help; pub(crate) use help::Help;
use crate::session_data::SessionData; use crate::AppData; use actix_web::error::ErrorInternalServerError; use actix_web::web::Data; use actix_web::Error; use actix_web::HttpResponse; use askama::Template; use rustgym_schema::adventofcode_description::AdventOfCodeDescription; use rustgym_schema::adventofcode_solution::A...
#[doc = "Register `ST2DTCTL` reader"] pub struct R(crate::R<ST2DTCTL_SPEC>); impl core::ops::Deref for R { type Target = crate::R<ST2DTCTL_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<ST2DTCTL_SPEC>> for R { #[inline(always)] fn from(reader: ...
//! Convert [Romaji](https://en.wikipedia.org/wiki/Romaji) to [Kana](https://en.wikipedia.org/wiki/Kana), lowercase text will result in [Hiragana](https://en.wikipedia.org/wiki/Hiragana) and uppercase text will result in [Katakana](https://en.wikipedia.org/wiki/Katakana). //! //! # Examples //! ``` //! use wana_kana::t...
//! //! Working with files and blobs on the Web. //! //! These APIs come in two flavors: //! //! 1. a callback style (that more directly mimics the JavaScript APIs), and //! 2. a `Future` API. mod blob; mod file_list; mod file_reader; mod object_url; pub use blob::*; pub use file_list::*; pub use file_reader::*; pub ...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct NodeHardware { #[serde(rename = "nodes")] pub nodes: Option<Vec <crate::models::NodeHardwareNode>>, /// Total number of items available. #[serde(rename = "total")] pub total: Option<i32>, }
// 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...