text stringlengths 8 4.13M |
|---|
use crate::groups::{Hand, OpenSet, Set, Tiles, TilesNewType};
use crate::tiles::Tile;
use std::fmt::{Display, Formatter, Error};
/// 手牌をパースする
#[derive(Debug)]
pub struct ParsedHand {
/// 手牌(晒した牌を含む)
pub tiles: Vec<Tile>,
/// 最終形候補
pub nodes: Vec<Node>,
/// 当たり牌
pub winning: Tile,
}
impl Parsed... |
// Copyright 2019 The n-sql Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// ex... |
use std::fmt;
use std::ops::Deref;
use firefly_llvm::{Linkage, StringRef};
use crate::{AddressSpace, Context, Location, SymbolTable, Variadic};
use crate::{Attribute, AttributeBase, NamedAttribute};
use crate::{Builder, BuilderBase, OpBuilder};
use crate::{InvalidTypeCastError, OwnedRegion};
use crate::{Operation, Op... |
mod kalaha;
mod engine;
use std::io;
use crate::kalaha::*;
use crate::engine::best_move;
fn main() {
let mut player = PLAYER_ONE;
let mut kalaha = Kalaha::new();
loop {
println!("{}", kalaha.to_string(player));
println!("Player {} is on turn", player + 1);
let mut buf = String::new... |
use std::io::Error;
use std::io::ErrorKind;
#[derive(Debug)]
pub enum Verb {
GET,
HEAD,
POST,
PUT,
DELETE,
CONNECT,
OPTIONS,
TRACE,
PATCH,
}
impl Verb {
pub fn from_string(verb: &str) -> Result<self::Verb, Error> {
match verb {
"GET" => Ok(self::Verb::GET),
... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Envelope {
start_flag: bool,
loop_flag: bool,
constant_flag: bool,
divider: u8,
decay_level: u8,
value: u8,
}
impl Envelope {
pub fn new() -> Envelope {
Envelope {
start_flag: false,
... |
// This version of the Summary trait has a method signature, instead of a
// default implementaion of the summarize method:
// pub trait Summary {
// fn summarize(&self) -> String;
// }
// This version of the Summary trait has a default implementaion of the
// summarize method:
pub trait Summary {
fn summari... |
#![no_main]
#[macro_use]
extern crate libfuzzer_sys;
fuzz_target!(|data: &[u8]| {
let mut buf = data.to_vec();
let mut decoder = quiche::h3::qpack::Decoder::new();
decoder.decode(&mut buf, std::u64::MAX).ok();
});
|
extern crate bit_vec;
use std::hash::{Hash, Hasher, SipHasher};
use std::marker::PhantomData;
pub struct Bloom<T: Hash> {
size: usize,
hashes: usize,
bit_array: bit_vec::BitVec,
phantom: PhantomData<T>,
}
impl<T> Bloom<T> where T: Hash {
pub fn new(size: usize, hashes: usize) -> Bloom<T> {
... |
#[macro_use] extern crate rocket;
// Try visiting:
// http://127.0.0.1:8000/downloads
#[get("/downloads")]
fn downloads() -> &'static str {
"downloads"
}
#[launch]
fn rocket() -> _ {
rocket::build()
.mount("/", routes![downloads])
}
|
#[doc = "Reader of register APB2_FZ"]
pub type R = crate::R<u32, super::APB2_FZ>;
#[doc = "Writer for register APB2_FZ"]
pub type W = crate::W<u32, super::APB2_FZ>;
#[doc = "Register APB2_FZ `reset()`'s with value 0"]
impl crate::ResetValue for super::APB2_FZ {
type Type = u32;
#[inline(always)]
fn reset_va... |
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
struct Foo<'a, 'b: 'a>(&'a &'b ());
impl<'a, 'b> Foo<'a, 'b> {
fn xmute(a: &'b ()) -> &'a () {
unreachable!()
}
}
pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
Foo::<'a, 'b>::xmute(u)
//[base]~^ ERROR lifetim... |
#[doc = "Reader of register EMACMPC"]
pub type R = crate::R<u32, super::EMACMPC>;
#[doc = "Writer for register EMACMPC"]
pub type W = crate::W<u32, super::EMACMPC>;
#[doc = "Register EMACMPC `reset()`'s with value 0"]
impl crate::ResetValue for super::EMACMPC {
type Type = u32;
#[inline(always)]
fn reset_va... |
extern crate libc as c;
use std;
use std::io::Result;
use std::net::SocketAddrV4;
use super::addr::{into_c_sockaddr,from_c_sockaddr,to_ptr,to_mut_ptr};
pub struct Socket {
fd : c::c_int
}
impl Socket {
pub fn new(domain: c::c_int, sock_type: c::c_int, protocol: c::c_int) -> Result<Self> {
let fd = un... |
// Copyright (c) 2020 Allen Wild
// SPDX-License-Identifier: MIT OR Apache-2.0
//! # yall: Yet Another Little Logger
//!
//! A simple lightweight backend for the [`log`](::log) crate.
//!
//! * Logs to stderr
//! * Simple standard terminal colors, no RGB or 256-color themes that may clash with the
//! terminal... |
#![no_std]
#[derive(num_derive::FromPrimitive)]
pub enum ABC {
A,
B,
C,
}
|
use crate::lexer::*;
use crate::parsers::expression::argument::indexing_argument_list;
use crate::parsers::expression::argument::operator_expression_list;
use crate::parsers::expression::argument::splatting_argument;
use crate::parsers::expression::method::method_invocation_without_parenthesis;
use crate::parsers::expr... |
#[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::INTENSET {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w ... |
use rustc_hash::{FxHashMap, FxHashSet};
use std::cmp;
use std::fmt::Display;
use std::ops::RangeInclusive;
pub const INPUT: &str = include_str!("../input.txt");
const SPAWN_POINT: Point = (500, 0);
type Point = (usize, usize);
#[derive(Debug, Clone)]
pub enum Material {
Rock,
Sand,
}
#[derive(Debug, Clone)... |
/// The desired render color of a Rapier collider.
pub struct RapierRenderColor(pub f32, pub f32, pub f32);
|
pub use ffi::c_void;
pub type c_char = i8;
pub type c_uchar = u8;
pub type c_schar = i8;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type ... |
// Copyright 2023 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 ... |
extern crate crypto;
fn main() {
// let mut sha256 = Sha256::new();
// sha256.input_str(input.as_slice());
//
// for i in range(0i,16) {
// println!("i == {}, hash == {}", i, sha256.result_str());
// let bytes = sha256.result_bytes();
// sha256.reset();
// sha256.input(b... |
use std::io::prelude::*;
use std::str::FromStr;
fn max(a:i32,b:i32) -> (i32,i32) {
if a >= b {
(a,b)
} else {
(b,a)
}
}
fn gcd(a:i32,b:i32) -> i32 {
let r = a % b;
if r == 0 {
b
} else {
gcd(b,r)
}
}
fn ans( i : Vec<i32> ) -> (i32,i32) {... |
mod arc_node;
mod atom;
mod atom_utf8;
mod big;
mod binary;
mod bit_binary;
mod export;
mod f64;
mod i32;
mod integer;
mod isize;
mod list;
mod map;
mod new_float;
mod new_function;
mod new_pid;
mod newer_reference;
mod pid;
mod sign;
mod small_atom;
mod small_atom_utf8;
mod small_integer;
mod string;
pub mod term;
mod... |
use proptest::strategy::Just;
use crate::erlang::binary_to_term_1::result;
use crate::test::strategy;
#[test]
fn without_binary_errors_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::is_not_binary(arc_process.clone()),
)... |
use std::{
io::{self, Error, ErrorKind},
net::SocketAddr,
};
use log::debug;
use tokio::net::lookup_host;
use crate::context::Context;
/// Perform a DNS resolution
pub async fn resolve(context: &Context, addr: &str, port: u16, check_forbidden: bool) -> io::Result<Vec<SocketAddr>> {
match lookup_host((add... |
#[macro_use]
extern crate lazy_static;
pub mod a_command;
pub mod c_command;
pub mod codegen;
pub mod l_command;
pub mod parser;
pub mod symbols;
|
use crate::map_head::MapHead;
use crate::rlew_reader::RlewReader;
use crate::map_builder::MapBuilder;
use std::fs::File;
use std::io::{Read, Cursor};
use byteorder::{ReadBytesExt, LittleEndian};
#[test]
pub fn loads_headers() {
let mut f = File::open("MAPHEAD.WL6").unwrap();
let head = MapHead::parse(&mut f).u... |
//! This module contains everything needed to instantiate an interpreter.
//! This separation exists to ensure that no fancy miri features like
//! interpreting common C functions leak into CTFE.
use std::hash::Hash;
use rustc::mir::interpret::{AllocId, EvalResult, Scalar, Pointer, AccessKind, GlobalId};
use super::{... |
use std::cell::RefCell;
use std::rc::Rc;
use std::borrow::Borrow;
use shrev::EventChannel;
use wasm_bindgen::prelude::*;
use wasm_bindgen::*;
use web_sys::*;
use web_sys::WebGl2RenderingContext as GL;
pub fn init_canvas() -> Result<HtmlCanvasElement, JsValue> {
let window = web_sys::window().unwrap();
let doc... |
extern crate rand;
use rand::Rng;
pub fn private_key(p: u64) -> u64 {
let mut rng = rand::thread_rng();
rng.gen_range(2, p)
}
pub fn public_key(p: u64, g: u64, a: u64) -> u64 {
modular_exponentiation(g, a, p)
}
pub fn secret(p: u64, b_pub: u64, a: u64) -> u64 {
modular_exponentiation(b_pub, a, p)
}
... |
use anyhow::Result;
use async_trait::async_trait;
use bytes::Bytes;
use crate::util::Node;
#[async_trait]
pub trait Filesystem {
async fn delete_file(&self, path: &String) -> anyhow::Result<()>;
async fn delete_directory(&self, path: &String) -> anyhow::Result<()>;
// required for s3, used mostly in Self... |
//! Simple tool for user-friendly output in Rust CLI programs.
//!
//! The main goal is to enable programs to provide feedback about their
//! progress to users, in a more advanced way than outputting lines. This
//! library concerns itself with stderr and lets stdout be used for direct
//! output.
//!
//! The central ... |
// 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 ... |
#[allow(clippy::float_cmp)]
mod vec3;
use image::{ImageBuffer, RgbImage};
use indicatif::ProgressBar;
pub use vec3::Vec3;
fn main() {
let x = Vec3::new(1.0, 1.0, 1.0);
println!("{:?}", x);
let mut img: RgbImage = ImageBuffer::new(1024, 512);
let bar = ProgressBar::new(1024);
for x in 0..1024 {
... |
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
fn show_help() {
let cmd_program = env::args()
.next()
.expect("failed to get the command which invoke this program (i.e. args[0])");
println!("Utility for getting / creating workspace.");
println!("Usage: {} [subcommand]", cmd_pro... |
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ControlTableError {
#[error("Dynamixel model {model:?} does not support field {name:?}")]
NoMatchingAddress { model: Model, name: DataName },
}
/// The levels of permission a user is granted in terms of an item in the
/// control table.
#[derive(Debug)]
p... |
// 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 crate::ping_tracker::Pong;
use byteorder::{ReadBytesExt, WriteBytesExt};
use failure::Error;
use rand::Rng;
/// Labels a node with a mesh-unique addre... |
use crate::{Function, NodeId, NullFunction, Port, PortDirection, PortIndex, RenderContext};
pub struct Node {
pub id: NodeId,
pub name: String,
pub function: Box<Function>,
pub x: i32,
pub y: i32,
pub inputs: Vec<Port>,
pub outputs: Vec<Port>,
}
impl Node {
pub fn new(id: NodeId, name:... |
#[cfg(target_arch = "wasm32")]
mod internal {
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = LumenStatsAlloc)]
pub fn on_alloc(tag: String, size: usize, align: usize, ptr: *mut u8);
#[wasm_bindgen(js_namespace = LumenStatsAlloc)]
pu... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_System_Com_StructuredStorage")]
pub fn BindIFilterFromStorage(pstg: super::super::System::Com::StructuredStorage::IStorage, punkou... |
use super::error::{PineError, PineErrorKind, PineResult};
use super::input::{Input, Position, StrRange};
use super::state::{AstState, PineInputError};
use super::utils::skip_ws;
use nom::{
branch::alt,
bytes::complete::{tag, take_while},
combinator::recognize,
sequence::pair,
Err, InputTake,
};
#[d... |
use libc::*;
#[repr(C)]
pub enum CFStreamErrorDomain {
kCFStreamErrorDomainCustom = -1,
kCFStreamErrorDomainPOSIX = 1,
kCFStreamErrorDomainMacOSStatus,
}
pub struct CFStreamError {
domain: CFStreamErrorDomain,
error: int32_t
}
|
pub fn check_inclusion(window: String, subject: String) -> bool {
let get_idx = |c: u8| (c - b'a') as usize;
let mut window_alphabet_counter = [0u8; 26];
window
.bytes()
.for_each(|b| window_alphabet_counter[get_idx(b)] += 1);
let (window_len, subject_letters) = (window.len(), subject.... |
use std::error::Error;
use std::fmt::{Debug, Formatter};
use sic_core::image::FilterType;
// Wrapper for image::FilterType.
// Does only exists, because image::FilterType does not implement PartialEq and Debug.
#[derive(Copy)]
pub enum FilterTypeWrap {
Inner(FilterType),
}
impl PartialEq<FilterTypeWrap> for Filt... |
use syn::{
parse::{Parse, ParseStream},
punctuated::Punctuated,
Error, Ident, Token,
};
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
///////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone)]
struct StringAndVariable {
variable: Ident,
... |
#[doc = "Reader of register TXIS"]
pub type R = crate::R<u16, super::TXIS>;
#[doc = "Reader of field `EP0`"]
pub type EP0_R = crate::R<bool, bool>;
#[doc = "Reader of field `EP1`"]
pub type EP1_R = crate::R<bool, bool>;
#[doc = "Reader of field `EP2`"]
pub type EP2_R = crate::R<bool, bool>;
#[doc = "Reader of field `EP... |
use juniper::{graphql_interface, GraphQLInputObject};
#[derive(GraphQLInputObject)]
pub struct ObjB {
id: i32,
}
#[graphql_interface]
trait Character {
fn id(&self) -> ObjB;
}
fn main() {}
|
//! Common functions, definitions and extensions for parsing and code generation
//! related to [`ScalarValue`].
//!
//! [`ScalarValue`]: juniper::ScalarValue
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use syn::{
parse::{Parse, ParseStream},
parse_quote,
spanned::Spanned,
};
/// Possible v... |
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkSubmitInfo {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub waitSemaphoreCount: u32,
pub pWaitSemaphores: *const VkSemaphore,
pub pWaitDstStageMask: *const VkPipelineStageFlagBits,
... |
static MAX_HEALTH: i32 = 100;
static GAME_NAME: &'static str = "Monster Attack";
use std::f32::consts;
fn main() {
const PI: f32 = 3.14;
// {} = placeholder
println!("The Game you are playing is called {}.", GAME_NAME);
println!("You start with {} health points.", MAX_HEALTH);
println!("In the Game {0} you start... |
mod remove_dups;
pub use self::remove_dups::*;
|
#[doc = "Reader of register PRADC"]
pub type R = crate::R<u32, super::PRADC>;
#[doc = "Reader of field `R0`"]
pub type R0_R = crate::R<bool, bool>;
#[doc = "Reader of field `R1`"]
pub type R1_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - ADC Module 0 Peripheral Ready"]
#[inline(always)]
pub fn r0(&sel... |
#[macro_use]
extern crate lazy_static;
extern crate serde;
use core_model::CocoConfig;
use core_model::PluginInterface;
use std::process::Command;
pub use ctags::ctags_cmd;
pub use ctags::ctags_opt;
pub use ctags::ctags_parser;
pub use plantuml::plantuml_render;
pub mod coco_struct_plugin;
pub mod ctags;
pub mod p... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct BackPressedEventArgs(pub ::windows::core::IIns... |
extern crate gcc;
fn main() {
gcc::compile_library("libbridgesample.a", &["src/rtp.c"]);
}
|
use na::Matrix4;
use std::{cell::RefCell, rc::Rc};
use crate::graphics::{position, position::WindowCorner, Drawable, Font, Rectangle};
use crate::gui::{Label, UiElement};
use crate::State;
/// Vertical offset factor for the label.
const LABEL_V_FAC: f32 = 1.5;
/// A simple slider giving a value from 0.0 to 1.0.
pub ... |
mod agent;
mod associated;
mod colors;
mod navigate;
mod route_explorer;
mod route_viewer;
mod shortcuts;
mod speed;
mod time;
mod trip_explorer;
mod turn_cycler;
mod warp;
pub use self::agent::AgentTools;
pub use self::colors::{
BuildingColorer, BuildingColorerBuilder, ColorLegend, RoadColorer, RoadColorerBuilder... |
#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
use crate::backend::c;
#[cfg(any(
linux_kernel,
target_os = "freebsd",
target_os = "illumos",
target_os = "espidf"
))]
use bitflags::bitflags;
#[cfg(any(
linux_kernel,
target_os = "freebsd",
target_os = "illumos",
t... |
use super::*;
use std::io::{BufRead, BufReader};
use std::path::PathBuf;
static mut ANIMATIONS: Option<Vec<AnimData>> = None;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Anim {
Stand,
Run,
RunBack,
Jump,
JumpSide,
Fall,
Crouch,
CrouchRun,
Reload,
Throw,
Recoil,
... |
use crate::*;
use KbctKeyStatus::*;
use std::collections::{HashMap, BTreeSet};
fn key(str: &str) -> i32 {
match str {
"A" => 1,
"B" => 2,
"C" => 3,
"D" => 4,
"1" => 11,
"2" => 12,
"3" => 13,
"4" => 14,
_ => -1
}
}
fn create_keymap_func(f: fn(&str) -> i32) -> impl Fn(&String) -> Option<i32> {
move... |
use std::{collections::BTreeMap, sync::Arc};
use async_trait::async_trait;
use iox_query::{exec::Executor, test::TestDatabase};
use parking_lot::Mutex;
use trace::span::Span;
use tracker::{
AsyncSemaphoreMetrics, InstrumentedAsyncOwnedSemaphorePermit, InstrumentedAsyncSemaphore,
};
use crate::QueryNamespaceProvid... |
#![allow(dead_code, unused_imports)]
use crate::entities::student;
use crate::{connection::pg_connection::get_pg_pool, entities::student::StudentConverter};
use serde_derive::{Deserialize, Serialize};
pub async fn create(
request: student::CreateStudentRequest,
) -> anyhow::Result<student::CreateStudentResponse> ... |
use regex::Regex;
use std::fs;
fn main() {
let result = solve_puzzle("input");
println!("And the result is {}", result);
}
struct Boat {
facing: char,
x: i32,
y: i32,
}
impl Boat {
fn distance(self) -> u32 {
(self.x.abs() + self.y.abs()) as u32
}
fn new() -> Boat {
Bo... |
use crate::terrain::Terrain;
use crate::ball::Ball;
pub struct Game {
pub terrain: Terrain,
pub ball: Ball,
}
impl Game {
pub fn new(width: u32, height: u32, pos_x: u32, pos_y: u32) -> Game {
Game {
terrain: Terrain::new(width, height),
ball: Ball::new(pos_x, pos_y),
... |
use queues::*;
use std::{
collections::{HashMap, VecDeque},
fs,
};
fn read_file(filename: &str) -> (Vec<Vec<char>>, Vec<(i32, i32)>, (i32, i32)) {
let mut file_string = fs::read_to_string(filename).expect("Could not read file");
let mut end = (0, 0);
let mut starts = Vec::new();
let mut matrix ... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use regex::Regex;
use std::collections::HashSet;
use std::fs;
fn solution_1() {
let mut hits = 0;
let contents = fs::read_to_string("input.txt").expect("something went wrong");
let mut cs: Vec<String> = contents.split("\n").map(|x| x.to_string()).collect();
let mut find_bags: HashSet<String> = HashSet... |
use gilrs::{Axis, Button, GamepadId, Gilrs};
/// A wrapper around GILRS library, designed exclusively for an Xbox controller.
/// This only provides a simple implementation for getting button and axis information.
pub struct XboxController {
gilrs: Gilrs,
id: Option<GamepadId>,
}
#[allow(dead_code)]
impl XboxCont... |
use crate::color::Color;
use crate::intersectable::plane::Plane;
use crate::intersectable::sphere::Sphere;
use crate::light::Light;
use crate::light::LightType;
use crate::material::Material;
use crate::vector::Vec3;
use super::Scene;
impl Scene {
/// Adds a new Sphere to the Scene
///
/// # Arguments
... |
// Copyright 2019 The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// dis... |
use crate::errors::Error;
use serde::Deserialize;
use std::fmt;
use std::fmt::Display;
use std::str::FromStr;
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Deserialize)]
pub enum Severity {
CRITICAL = 90,
MAJOR = 60,
MINOR = 40,
NOTICE = 20,
NONE = 0,
EASE = -20,
EASE2X = -40,
W... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
extern crate clap;
use clap::{Arg, App};
#[macro_use]
extern crate lazy_static;
mod process_files;
mod line_details;
use crate::process_files::process_files;
fn main() {
let matches = App::new("Git me the oldest line")
.version("0.1.0")
.author("iexus <2.-@twopointline.com>")
.about("Find... |
use std::net::SocketAddr;
use std::sync::Mutex;
use crate::layer::manager::LayerManager;
use crate::network::NetworkInterface;
use crate::scene::SceneManager;
use crate::timer::TimerManager;
#[derive(Debug)]
pub struct Context {
pub layer_manager: LayerManager,
pub scene_manager: SceneManager,
pub timer_m... |
//! <div align="center">
//! <img alt="Rune Logo" src="https://raw.githubusercontent.com/rune-rs/rune/main/assets/icon.png" />
//! </div>
//!
//! <br>
//!
//! <div align="center">
//! <a href="https://rune-rs.github.io">
//! <b>Visit the site 🌐</b>
//! </a>
//! -
//! <a href="https://rune-rs.github.io/book/">
... |
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![cfg_attr(feature="cargo-clippy", allow(too_many_arguments))]
#![cfg_attr(feature="cargo-clippy", allow(large_enum_variant))]
// Crates we don't manage
extern crate rand;
extern crate libc;
extern crate time;
extern cr... |
/*!
This module contains the definition of the program's main error type.
*/
use std::borrow::Cow;
use std::error::Error;
use std::fmt;
use std::io;
use std::result::Result as StdResult;
/**
Shorthand for the program's common result type.
*/
pub type Result<T> = StdResult<T, MainError>;
/**
Represents an error in th... |
use super::{project_settings::ProjectSettings, user::UserInfo};
use serde::Deserialize;
/// Данные о проверке существования пользователя
/// https://developers.xsolla.com/ru/api/v2/getting-started/#api_webhooks_user_validation
#[derive(Debug, Deserialize)]
pub struct UserExistsCheckData {
pub settings: ProjectSett... |
#[doc = "Reader of register AHB3RSTR"]
pub type R = crate::R<u32, super::AHB3RSTR>;
#[doc = "Writer for register AHB3RSTR"]
pub type W = crate::W<u32, super::AHB3RSTR>;
#[doc = "Register AHB3RSTR `reset()`'s with value 0"]
impl crate::ResetValue for super::AHB3RSTR {
type Type = u32;
#[inline(always)]
fn re... |
pub(super) mod edits;
pub(super) mod fixtures;
pub(super) mod query_helpers;
pub(super) mod random;
pub(super) mod scope_sequence;
use lazy_static::lazy_static;
use std::{env, time, usize};
lazy_static! {
pub static ref SEED: usize = {
let seed = env::var("TREE_SITTER_TEST_SEED")
.map(|s| usiz... |
use crate::utils;
use std::io::{self};
fn read_problem_data() -> io::Result<Vec<Vec<char>>> {
let mut result = Vec::new();
if let Ok(lines) = utils::read_lines("data/day3.txt") {
for line in lines {
if let Ok(s) = line {
result.push(s.chars().collect());
}
... |
#![no_std]
#![no_main]
#![feature(asm)]
#![feature(intrinsics)]
#![feature(lang_items)]
#![feature(compiler_builtins_lib)]
extern crate uefi;
extern crate rlibc;
use uefi::SimpleTextOutput;
use uefi::graphics::{PixelFormat,Pixel};
use core::panic::PanicInfo;
use core::num::Wrapping;
use core::mem;
use core::fmt::Writ... |
// 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 std::fs;
use approx::assert_abs_diff_eq;
use super::super::SysFsDevice;
use crate::platform::traits::BatteryDevice;
use crate::{State, Technology};
// https://github.com/svartalf/rust-battery/issues/28
//
// This test is not actually covers the `ENODEV` case,
// but it would be nice to have some test cases,
// e... |
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//! This file contains arbitrary types for use across quickcheck tests
use rand::thread_rng;
use rand::distributions::range::Range;
use rand::distributions::IndependentSample;
use quickcheck::{Arbitrary, Gen};
use vertre... |
use std::cmp::Ordering;
use defs::{Vector3, FloatType, IntType, FLOAT_ULPS_TOLERANCE};
use ::na;
use ::numt::Num;
use ::numt::float::Float;
use ::flcmp::ApproxOrdUlps;
pub trait CompareWithTolerance<T: Float> {
fn compare_eps(&self, rhs: &T) -> Ordering;
fn less_eps(&self, rhs: &T) -> bool;
fn less_eq_eps... |
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Keyword {
Void,
Undefined,
Null,
True,
False,
U1,
U8,
U16,
U32,
U64,
Neg,
Not,
Add,
Sub,
Mul,
Umod,
Udiv,
Smod,
Sdiv,
Shr,
Shl,
Sar,
And,
Or,
Xor,
Cmp,
Eq,
... |
use std::cell::RefCell;
use std::rc::Rc;
use std::vec::Vec;
// Useful for debugging
fn print_type_of<T>(_: &T) {
println!("{}", std::any::type_name::<T>())
}
fn main() {
let val_raw = 0;
let val = Rc::new(RefCell::new(val_raw));
let vec = Rc::new(RefCell::new(Vec::new()));
vec.borrow_mut().push(0... |
mod intersect;
pub use intersect::{SortedIntersect, SortedIntersectIter};
mod markers;
pub use markers::{AssumeSorted, AssumingSortedIter, Sorted};
mod components;
pub use components::{Components, ComponentsIter, Point, TaggedComponent, TaggedComponentExt};
|
// 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::Error,
fidl_fuchsia_overnet::MeshControllerProxyInterface,
futures::{future::try_join, prelude::*},
std::io::{Read, Write},
... |
use crate::account::*;
use crate::agent::Agent;
use crate::asset::*;
use crate::rate::*;
use borsh::{BorshDeserialize, BorshSerialize};
use near_bindgen::{env, near_bindgen};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
pub type AccountId = Vec<u8>;
#[near_bindgen]
#[derive(Serialize, Deseriali... |
//! encoding and decoding paths for use with the clipboard.
use std::collections::HashMap;
use std::fmt::Write;
use druid::kurbo::{Affine, BezPath, PathEl, Point, Rect, Shape};
use lopdf::content::{Content, Operation};
use lopdf::{Document, Object, Stream};
use crate::cubic_path::CubicPath;
use crate::design_space:... |
use std::os::raw::c_void;
use crate::gl_wrapper::{BufferUpdateFrequency, NULLPTR};
#[derive(Debug)]
#[derive(Clone)]
pub struct VertexAttribute {
pub index: u32,
pub components: u32,
}
#[derive(Debug)]
#[derive(Clone)]
pub struct VBO {
pub(crate) id: u32,
length: usize,
pub(crate) attributes: Vec<... |
use nom::bytes::complete::take;
use nom::bytes::complete::{take_while, take_while1};
use nom::character::complete::line_ending;
use nom::combinator::{map, peek};
#[cfg(test)]
use nom::error::ErrorKind;
use nom::sequence::{pair, terminated};
#[cfg(test)]
use nom::Err::Error;
use nom::IResult;
fn is_simple(x: char) -> b... |
extern crate gcc;
extern crate regex;
mod cpu;
mod softfloat;
fn main() {
cpu::build();
softfloat::build();
}
|
use zip::ZipArchive;
use std::{io::Cursor, collections::HashMap};
use crate::RawDataRead;
pub struct PakFile {
archive: ZipArchive<Cursor<Box<[u8]>>>,
depth_file_names: HashMap<String, String>,
}
impl PakFile {
pub(crate) fn new(data: Box<[u8]>) -> Self {
let archive = ZipArchive::new(Cursor::new(data)).unw... |
use franklin_crypto::bellman::{Engine, Field, PrimeField};
use crate::common::params::HasherParams;
use crate::common::matrix::{compute_optimized_matrixes, mmul_assign, try_inverse};
pub fn poseidon_params<E: Engine, const RATE: usize, const WIDTH: usize>(
) -> (HasherParams<E, RATE, WIDTH>, E::Fr) {
let securit... |
struct Person {
name: String,
age: u8,
}
impl std::fmt::Display for Person {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
write!(fmt, "{} {}", self.name, self.age);
Ok(())
}
}
struct People {
name: String,
population: Vec<Person>,
as_of_year... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.