text stringlengths 8 4.13M |
|---|
#[doc = "Reader of register STAT1"]
pub type R = crate::R<u32, super::STAT1>;
#[doc = "Writer for register STAT1"]
pub type W = crate::W<u32, super::STAT1>;
#[doc = "Register STAT1 `reset()`'s with value 0xc0"]
impl crate::ResetValue for super::STAT1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> ... |
use codespan::Location;
use std::io;
use termcolor::WriteColor;
use crate::term::Config;
/// The 'location focus' of a source code snippet.
///
/// This is displayed in a way that other tools can understand, for
/// example when command+clicking in iTerm.
///
/// ```text
/// test:2:9
/// ```
pub struct Locus<'a> {
... |
use amethyst::{GameData, SimpleState, StateData, StateEvent, SimpleTrans, Trans};
use amethyst::assets::Loader;
use amethyst::core::Transform;
use amethyst::ecs::{Builder, World};
use amethyst::input::{VirtualKeyCode, is_key_down};
use amethyst::renderer::Camera;
use amethyst::ui::{Anchor, LineMode, TtfFormat, UiText, ... |
//! This crate provides a non-invasive implementation of a **disjoint-set tree** data structure.
//!
//! # Disjoint-Set Tree
//!
//! **[Disjoint sets] data structure**, or **DSU**, or **union-find data structure**, or **merge-
//! find set**, is a data structure that stores a collection of disjoint sets. It provides
//... |
use crate::deferred::DeferredValue::{Initialized, WaitingForValue};
use std::ops::Deref;
use std::sync::Mutex;
pub struct Deferred<T> {
value: Mutex<DeferredValue<T>>,
}
pub enum DeferredValue<T> {
Initialized(T),
WaitingForValue,
}
impl<T> Deferred<T> {
pub fn new() -> Self {
Self {
... |
fn longest(a1: &str, a2: &str) -> String {
let mut chars: Vec<char> = a1.to_string().chars().collect();
let chars2: Vec<char> = a2.to_string().chars().collect();
chars.extend(chars2); chars.sort(); chars.dedup();
chars.into_iter().collect()
}
#[test]
fn test0() {
assert_eq!( longest("aretheyh... |
use crate::{parser::Operator, parser_state::Type, Expr, Expression, ParseError, ParserWorkingSet};
impl<'a> ParserWorkingSet<'a> {
pub fn math_result_type(
&self,
lhs: &mut Expression,
op: &mut Expression,
rhs: &mut Expression,
) -> (Type, Option<ParseError>) {
match &op... |
// ====================================================
// Netlyser Copyright(C) 2019 Furkan Türkal
// This program comes with ABSOLUTELY NO WARRANTY; This is free software,
// and you are welcome to redistribute it under certain conditions; See
// file LICENSE, which is part of this source code package, for details.
/... |
// RaftFS :: A fancy filesystem that manages synchronized mirrors.
//
// Implemented using fuse_mt::FilesystemMT.
//
// Copyright (c) 2016-2017 by William R. Fraser
//
use std;
use std::ffi::{CStr, CString, OsStr, OsString};
use std::fs::{self, File};
use std::io::{self, Read, Write, Seek, SeekFrom};
use std::os::unix... |
extern crate rand;
extern crate wasm_bindgen;
mod functions;
mod neural_network;
mod neuron;
|
use colored::*;
use std::borrow::Cow;
use std::cell::RefCell;
use std::rc::Rc;
use anyhow::{Context, Result};
use clap::ArgMatches;
use crate::cli::cfg::get_cfg;
use crate::cli::error::CliError;
use crate::cli::settings::get_settings;
use crate::cli::terminal::confirm::{confirm, EnumConfirm};
use crate::cli::terminal... |
use std::env::current_exe;
use std::fs::File;
use std::io::{self, Read};
use std::path::PathBuf;
use std::vec::IntoIter;
#[derive(Debug)]
pub struct Command {
exe: Option<PathBuf>,
args: Vec<String>,
}
impl Command {
pub fn new() -> Self {
Command { exe: None, args: vec![] }
}
pub fn arg(... |
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;
/// Weight functions for pallet_session.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
fn set_keys() -> Weigh... |
use std::iter;
use std::convert::TryInto;
pub fn is_square_free(n: i64) -> bool {
// Enough to test 4 followed by all odd squares that are less than n.
let n = n.abs();
!iter::once(2i64)
.chain((3..n).into_iter().step_by(2))
.map(|i| i.pow(2))
.take_while(|i| i <= &n)
.any(|... |
use bootstrap;
use std::fs::{self, File};
use std::io;
use std::io::prelude::*;
use std::os::unix::fs::*;
use std::path::{Path, PathBuf};
use time::{self, Timespec};
use util::RecursiveDirIterator;
use zip::write::*;
/// Update metadata information.
#[derive(Clone)]
pub enum UpdateEndpoint {
Zsync {
url: ... |
use crate::conv_req::convert_req;
use crate::Options;
use actix_web::{http::StatusCode, web, HttpRequest, HttpResponse};
use fmterr::fmt_err;
use perseus::error_pages::ErrorPageData;
use perseus::html_shell::interpolate_page_data;
use perseus::router::{match_route, RouteInfo, RouteVerdict};
use perseus::{
err_to_st... |
#[doc = "Register `SECCFGR` reader"]
pub type R = crate::R<SECCFGR_SPEC>;
#[doc = "Register `SECCFGR` writer"]
pub type W = crate::W<SECCFGR_SPEC>;
#[doc = "Field `SYSCFGSEC` reader - SYSCFG clock control security"]
pub type SYSCFGSEC_R = crate::BitReader;
#[doc = "Field `SYSCFGSEC` writer - SYSCFG clock control securi... |
pub extern crate style;
pub extern crate cssparser;
pub extern crate style_traits;
pub extern crate servo_url;
use style::properties::longhands::background_size;
use style::properties::longhands::{
background_attachment, background_clip, background_color, background_image,
};
use style::properties::longhands::{
... |
mod container;
mod generation;
mod icons;
mod template;
pub use template::get_template;
|
use super::constants::{LEDGERS_FREEZE, GET_FROZEN_LEDGERS};
#[derive(Serialize, PartialEq, Debug)]
pub struct LedgersFreezeOperation {
#[serde(rename = "type")]
pub _type: String,
pub ledgers_ids: Vec<u64>,
}
impl LedgersFreezeOperation {
pub fn new(ledgers_ids: Vec<u64>) -> LedgersFreezeOperation {
... |
pub fn write(fd: u64, buf: u64, count: u64) -> u64 {
let buf = buf as usize;
let count = count as usize;
println!("Syscall: write fd={:x} buf={:x} count={:x}", fd, buf, count);
unsafe {
let s = ::utils::zs_to_str_n(buf, count);
println!("-> {}", s);
}
count as u64
}
|
use crate::{
bytes::Bytes,
core::error::OutPointError,
core::{BlockView, Capacity, DepType, TransactionInfo, TransactionView},
packed::{Byte32, CellOutput, OutPoint, OutPointVec},
prelude::*,
};
use ckb_error::Error;
use ckb_occupied_capacity::Result as CapacityResult;
use std::collections::{HashMap... |
#[derive(Debug)]
pub struct Request {
uri: String,
method: String,
http_version: String,
header: String,
body: String,
}
impl Request {
pub fn new() -> Self {
Self {
uri: String::default(),
method: String::default(),
http_version: String::default(),
... |
use middle::ir::MOpcode;
use middle::ssa::cfg_traits::CFG;
use middle::ssa::ssa_traits::*;
use middle::ssa::ssastorage::SSAStorage;
use petgraph::graph::NodeIndex;
use std::collections::HashSet;
pub fn run(ssa: &mut SSAStorage) -> () {
loop {
let copies = CopyInfo::gather_copies(ssa);
if copies.i... |
use std::sync::atomic::{AtomicU64, Ordering};
#[derive(Default, Debug)]
pub(crate) struct AssociationStats {
n_datas: AtomicU64,
n_sacks: AtomicU64,
n_t3timeouts: AtomicU64,
n_ack_timeouts: AtomicU64,
n_fast_retrans: AtomicU64,
}
impl AssociationStats {
pub(crate) fn inc_datas(&self) {
... |
use err_derive::Error;
use sha2::{Digest, Sha256};
use std::fs::File;
use std::io::{self, Read};
#[derive(Debug, Error)]
pub enum ValidateError {
#[error(display = "checksum failed; expected {}, found {}", expected, found)]
Checksum { expected: String, found: String },
#[error(display = "I/O error while ch... |
pub fn v2s(s: Vec<char>) -> String {
let s: String = s.into_iter().collect();
s.trim().to_owned()
}
|
use byteorder::{ByteOrder, NativeEndian};
use crate::{
traits::{Emitable, Parseable},
DecodeError, Field,
};
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct RouteCacheInfo {
pub clntref: u32,
pub last_use: u32,
pub expires: u32,
pub error: u32,
pub used: u32,
pub id: u32,
p... |
mod code;
pub use code::*; |
#[doc = "Register `BMTRGR` reader"]
pub type R = crate::R<BMTRGR_SPEC>;
#[doc = "Register `BMTRGR` writer"]
pub type W = crate::W<BMTRGR_SPEC>;
#[doc = "Field `SW` reader - SW"]
pub type SW_R = crate::BitReader<SW_A>;
#[doc = "SW\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SW_A {
#[... |
#![feature(proc_macro_hygiene)]
use hdk::prelude::*;
use hdk_proc_macros::zome;
// see https://developer.holochain.org/api/0.0.44-alpha3/hdk/ for info on using the hdk library
// This is a sample zome that defines an entry type "MyEntry" that can be committed to the
// agent's chain via the exposed function create_my... |
use parameterized_macro::parameterized;
#[parameterized(zzz = { "a", "b" }, aaa = { 1, 2, 3 })]
pub(crate) fn my_test(v: &str, w: i32) {}
fn main() {}
|
pub fn build_proverb(list: &[&str]) -> String {
if list.len() == 1 {
return format!("And all for the want of a {}.", list[0]);
}
let mut output = String::new();
for i in 0..list.len() {
if i + 1 == list.len() {
output.push_str(format!("And all for the want of a {}.", list[0]... |
#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![allow(const_err)]
#![allow(unused_imports)]
use libusb_sys as ffi;
use libc::{c_int,c_uchar};
use crate::ftdi::constants::{*};
use crate::ftdi::eeprom::ftdi_eeprom;
use std::sync::{Arc, Mutex};
use std::{mem::{MaybeUninit}, slice, io, ptr};
use snafu::{ensure, Ba... |
use crate::demo::data::DemoTick;
use crate::demo::parser::MalformedSendPropDefinitionError;
use crate::demo::sendprop::{
RawSendPropDefinition, SendPropDefinition, SendPropFlag, SendPropIdentifier, SendPropType,
};
use crate::{Parse, ParseError, ParserState, Result, Stream};
use bitbuffer::{
BitRead, BitReadStr... |
extern crate bank;
use bank::account::Account as Account;
use bank::writer::output_statement as output_statement;
#[derive(Debug,PartialEq)]
struct Statement {
bytes: Vec<u8>,
}
#[test]
fn account_stores_all_transactions() {
let mut account = Account::new(0);
account.deposit(200);
account.deposit(400)... |
extern crate ralloc;
mod util;
use std::collections::BTreeMap;
#[test]
fn btreemap() {
util::multiply(|| {
let mut map = BTreeMap::new();
util::acid(|| {
map.insert("Nicolas", "Cage");
map.insert("is", "God");
map.insert("according", "to");
map.ins... |
use crate::plan::MutatorContext;
use crate::scheduler::gc_work::ProcessEdgesWork;
use crate::scheduler::*;
use crate::util::OpaquePointer;
use crate::vm::VMBinding;
/// VM-specific methods for garbage collection.
pub trait Collection<VM: VMBinding> {
/// Stop all the mutator threads. MMTk calls this method when it... |
//! This module contains settings for render strategy of papergrid.
//!
//! - [`TrimStrategy`] and [`AlignmentStrategy`] allows to set [`Alignment`] settings.
//! - [`TabSize`] sets a default tab size.
//! - [`Charset`] responsible for special char treatment.
//! - [`Justification`] responsible for justification space ... |
$NetBSD: patch-vendor_stacker_src_lib.rs,v 1.7 2023/01/23 18:49:04 he Exp $
Avoid missing pthread_* on older SunOS.
--- vendor/stacker/src/lib.rs.orig 2020-07-13 18:18:17.000000000 +0000
+++ vendor/stacker/src/lib.rs
@@ -407,7 +407,7 @@ cfg_if! {
);
Some(mi.assume_init().AllocationBase as us... |
/*
* Rustパターン(記法)。
* CreatedAt: 2019-07-07
*/
fn main() {
let mut setting_value = Some(5);
let new_setting_value = Some(10);
match (setting_value, new_setting_value) {
(Some(_), Some(_)) => {
println!("既存の値の変更を上書きできません");
}
_ => {
setting_value = new_settin... |
//! A simple example that demonstrates the **Graph** widget functionality.
#[macro_use] extern crate conrod;
extern crate conrod_graph_widget;
extern crate petgraph;
use conrod::{widget, Borderable, Colorable, Labelable, Positionable, Sizeable, Widget};
use conrod::backend::glium::glium::{self, Surface};
use conrod_g... |
extern crate libc;
use std::ptr;
use std::io::Error;
type Address = u64;
type Word = u64;
const PTRACE_GETREGS:libc::c_uint = 12;
#[derive(Clone, Default, Debug)]
struct Registers {
pub r15: Word,
pub r14: Word,
pub r13: Word,
pub r12: Word,
pub rbp: Word,
pub rbx: Word,
pub r11: Word,
pub r10: Word... |
use ast::*;
use back::env::{Env, SmartEnv};
use back::runtime_error::{check_args, RuntimeError};
use back::specials;
use back::trampoline;
use back::trampoline::{ContinuationResult, Flag};
use loc::Loc;
use std::rc::Rc;
pub type NodeResult = Result<Node, RuntimeError>;
pub fn eval_node(env: SmartEnv, node: Node, _: V... |
use std::{
collections::HashMap,
fs::{self, File},
io::Read,
str::{from_utf8, FromStr},
};
use framework::{app, encode_base64, macros::serde_json::{self, json}, App, Canvas, Ui, Size};
use lsp_types::{
notification::{DidChangeTextDocument, DidOpenTextDocument, Initialized, Notification},
reques... |
use crate::{qjs::Error as JsError, ValueError};
use std::{
error::Error as StdError,
ffi::NulError,
fmt::{Display, Formatter, Result as FmtResult},
io::Error as IoError,
result::Result as StdResult,
str::Utf8Error,
string::FromUtf8Error,
};
pub type Result<T> = StdResult<T, Error>;
#[deriv... |
use crate::error::*;
use std::cmp::Ordering;
use std::path::{Path, PathBuf};
use std::convert::TryFrom;
use crate::unity::InstalledComponents;
use crate::unity::Version;
#[derive(Deserialize, Serialize)]
#[serde(rename_all = "PascalCase")]
pub struct AppInfo {
pub c_f_bundle_version: String,
pub unity_build_nu... |
use core::{marker::PhantomData, ops::Index};
use hashbrown::hash_map::HashMap;
use slab::Slab;
use necsim_core::{
cogs::{Backup, Habitat, OriginSampler},
landscape::IndexedLocation,
lineage::Lineage,
};
use crate::cogs::lineage_reference::in_memory::InMemoryLineageReference;
mod store;
#[allow(clippy::... |
use vendored_sha3::{Digest, Sha3_384};
use super::Hash;
/// SHA3_384 alias Sha3_384 and implements Hash.
pub type SHA3_384 = Sha3_384;
/// The blocksize of SHA3-384 in bytes.
pub const BLOCK_SIZE384: usize = 104;
/// The size of a SHA3-384 checksum in bytes.
pub const SIZE384: usize = 48;
impl Hash for SHA3_384 {
... |
use super::*;
use crate::libs::random_id::U128Id;
impl Renderer {
pub fn reset_canvas_size(canvas: &web_sys::HtmlCanvasElement, dpr: f64) -> [f64; 2] {
let bb = canvas.get_bounding_client_rect();
let w = bb.width() * dpr;
let h = bb.height() * dpr;
canvas.set_width(w as u32);
... |
#[doc = "Register `AHB1RSTR` reader"]
pub type R = crate::R<AHB1RSTR_SPEC>;
#[doc = "Register `AHB1RSTR` writer"]
pub type W = crate::W<AHB1RSTR_SPEC>;
#[doc = "Field `GPDMA1RST` reader - GPDMA1 block reset Set and reset by software."]
pub type GPDMA1RST_R = crate::BitReader;
#[doc = "Field `GPDMA1RST` writer - GPDMA1 ... |
// Copyright 2020-Present (c) Raja Lehtihet & Wael El Oraiby
//
// 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 ... |
use chore::*;
use regex::Regex;
#[test]
fn general() -> Result<()> {
let ansii_color = Regex::new("\x1b\\[[0-9;]*m").unwrap();
for (args, tasks, expect) in &[
(
vec!["list"],
concat!(
"(M) 2001-02-03 @home +chore add tests\n",
"(Z) foo | bar\n",
"add... |
#[doc = "Register `IFCR` reader"]
pub type R = crate::R<IFCR_SPEC>;
#[doc = "Register `IFCR` writer"]
pub type W = crate::W<IFCR_SPEC>;
#[doc = "Field `CTEIF` reader - Clear Transfer error interrupt flag Programming this bit to 1 clears the TEIF flag in the DMA2D_ISR register"]
pub type CTEIF_R = crate::BitReader;
#[do... |
use std::{borrow::Cow, collections::HashMap};
use excel_column_id::ColumnId;
use crate::{
cell::ColIndex,
shared_strings::{SharedStringIndex, SharedStrings},
};
#[derive(Default)]
pub struct Context {
pub(crate) shared_strings: SharedStrings,
pub(crate) column_ids_cache: HashMap<ColIndex, ColumnId>,
... |
//! # 13. 罗马数字转整数
//! https://leetcode-cn.com/problems/roman-to-integer/
//!罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。
//! 字符 数值
//! I 1
//! V 5
//! X 10
//! L 50
//! C 100
//! D 500
//! M 1000
//! 例如, 罗马数字 2 写做 II ,即为两个并列的 1。12 写做 XII ... |
#[feature(managed_boxes)];
#[desc = "Test game I write to learn rust"];
#[license = "GPLv2"];
extern mod nphysics;
extern mod rsfml;
mod engine;
fn main() {
print("helloWorld");
let mut engine = engine::Engine::new();
print(format!("{:?}\n",engine.textureCache.load(~"images/rust-logo.png")));
en... |
use {Result, Error};
use sys::{cpuinfo, memory};
use std::{fmt, result};
use self::Hardware::{
RaspberryPi
};
#[derive(Clone, Copy, Debug)]
pub struct Board {
pub hardware: Hardware,
pub cpu: CPU,
pub memory: Option<u32>,
pub overvolted: bool
}
#[derive(Clone, Copy, Debug)]
pub enum Hardware {
... |
use super::super::prelude::{
HCURSOR
};
pub type Cursor = HCURSOR; |
#[doc = "Register `IER` reader"]
pub type R = crate::R<IER_SPEC>;
#[doc = "Register `IER` writer"]
pub type W = crate::W<IER_SPEC>;
#[doc = "Field `TMEIE` reader - TMEIE"]
pub type TMEIE_R = crate::BitReader<TMEIE_A>;
#[doc = "TMEIE\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TMEIE_A {
... |
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
let stdin = stdin();
let stdin = stdin.lock();
let token: String = stdin
.bytes()
.map(|c| c.expect("failed to read char") as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
... |
use super::Task; // Import our tasks
use alloc::collections::VecDeque; // VecDeque (allows us to insert tasks on either side of the vec, so we can prioritise certain tasks)
use crate::println;
/// # SimpleExecutor
///
/// SimpleExecutor is a simple executor of async tasks, and shouldn't be used in production
///
///... |
#![cfg_attr(feature = "unstable", feature(test))]
// Launch program : cargo run --release < input/input.txt
// Launch benchmark : cargo +nightly bench --features "unstable"
/*
Benchmark results:
running 5 tests
test tests::test_part_1 ... ignored
test tests::test_part_2 ... ignored
test bench::bench_... |
// This file is part of rdma-core. 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/rdma-core/master/COPYRIGHT. No part of rdma-core, including this file, may be copied, modified, propagated, or distributed ... |
use crate::classification::structural::BracketType;
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
pub(crate) struct DelimiterClassifierImpl256 {
opening: i8,
}
impl DelimiterClassifierImpl256 {
pub(crate) fn new(opening: BracketType) -> Self {
... |
//! Filesystem session
//!
//! A session runs a filesystem implementation while it is being mounted to a specific mount
//! point. A session begins by mounting the filesystem and ends by unmounting it. While the
//! filesystem is mounted, the session loop receives, dispatches and replies to kernel requests
//! for file... |
#![allow(deprecated)]
use murmurhash3::murmurhash3_x86_32;
use rand::random;
type Seed = u32;
fn create_seed() -> Seed {
random()
}
fn hash(key: Seed, item: usize) -> u32 {
let data: [u8; 4] = unsafe { ::std::mem::transmute(item as u32) };
murmurhash3_x86_32(&data, key)
}
pub struct AMSSketch {
k: u... |
use std::ops;
use std::collections::{HashMap, HashSet};
use super::utils::{tf_data_type_to_rust, wrap_type, join_vec, type_to_string};
use tensorflow_protos::types::DataType;
use codegen as cg;
pub(crate) trait AddToImpl {
fn add_to_impl(&self, impl_: &mut OpImpl, lib: &mut OpLib) -> Result<(), String>;
}
pub(cr... |
use time;
use super::{Listener, DistanceModel, SoundEvent, Gain, SoundName, SoundProviderResult};
use super::context::{SoundContext};
use super::source::SoundSourceLoan;
use super::errors::*;
use puck_core::{HashMap, Vec3f};
use cgmath::{Zero};
#[derive(Debug, Clone)]
pub struct SoundRender {
pub master_gain: f3... |
use crate::isa::{IsaResult, IsaError, SnesOffset};
/// A struct representing the encoding state.
pub struct EncodeCursor<'a> {
offset: usize,
data: &'a mut Vec<u8>,
}
impl <'a> EncodeCursor<'a> {
pub fn new(data: &'a mut Vec<u8>) -> Self {
EncodeCursor { offset: 0, data }
}
pub fn seek(&mu... |
#![deny(unused_extern_crates)]
#![warn(
clippy::all,
clippy::nursery,
clippy::pedantic,
future_incompatible,
missing_copy_implementations,
// missing_docs,
nonstandard_style,
rust_2018_idioms,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unused_qualifications
)]... |
use amethyst::{
ecs::{Join, Read, ReadStorage, System, WriteStorage},
input::InputHandler,
};
use crate::component::{Direction, Paddle};
pub struct PaddleSystem;
impl<'s> System<'s> for PaddleSystem {
type SystemData = (
ReadStorage<'s, Paddle>,
WriteStorage<'s, Direction>,
Read<'... |
use anyhow::Result;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum TomlError {
#[error("\"{0}\" section could not be found in your config. Add it with [{0}]")]
SectionNotFound(String),
#[error("The language \"{0}\" could not be found in your config.")]
LanguageNotFound(String),
#[error("T... |
mod utils;
mod websocket;
use serde::{Deserialize, Serialize};
use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
use pacosako::{
analysis::{self, puzzle, ReplayData},
editor, fen,
setup_options::SetupOptions,
PacoAction, PacoBoard, PacoError,
};
/// This module provides all the methods that should ... |
#[doc = "Reader of register INTR_MASKED"]
pub type R = crate::R<u32, super::INTR_MASKED>;
#[doc = "Reader of field `EDGE0`"]
pub type EDGE0_R = crate::R<bool, bool>;
#[doc = "Reader of field `EDGE1`"]
pub type EDGE1_R = crate::R<bool, bool>;
#[doc = "Reader of field `EDGE2`"]
pub type EDGE2_R = crate::R<bool, bool>;
#[... |
use chrono::prelude::*;
use std::io::{self, Write};
#[derive(Debug, Clone, PartialEq)]
pub struct Point {
pub time: DateTime<FixedOffset>,
pub lat: f64,
pub lon: f64,
pub ele: f64,
pub speed: f64,
pub course: f64,
}
pub fn write_gpx(mut w: impl Write, segments: &[&[Point]]) -> io::Result<()> {... |
#[cfg(all(test, feature = "subtle"))]
mod test {
use cryptographer::subtle;
use vendored_rand as rand;
fn random_bytes() -> (Vec<u8>, Vec<u8>) {
let ell = (rand::random::<u8>() as usize) + 1;
let mut x = vec![0u8; ell];
for v in &mut x {
*v = rand::random();
}
... |
use messagebus::{
derive::{Error as MbError, Message},
error, Message, TypeTagged,
};
use thiserror::Error;
#[derive(Debug, Error, MbError)]
enum Error {
#[error("Error({0})")]
Error(anyhow::Error),
}
impl<M: Message> From<error::Error<M>> for Error {
fn from(err: error::Error<M>) -> Self {
... |
//! Implements the CLI interface.
use std::convert::TryFrom;
use std::num::ParseIntError;
use std::path::PathBuf;
use std::str::FromStr;
use structopt::StructOpt;
use thiserror::Error;
use crate::pascal_voc::PrepareOpts;
#[derive(StructOpt, Debug)]
pub enum Command {
/// Use a PASCAL-VOC dataset
PascalVoc(Pa... |
use game;
use std::collections::HashMap;
use board::Board;
const INITIAL_DEPTH: i32 = 0;
const TIED: i32 = 0;
const MAX_SCORE: i32 = 1000;
const INCREMENT: i32 = 1;
const EARLY_STAGES_OF_GAME: usize = 1;
const FIRST_MOVE: i32 = 4;
const SECOND_MOVE: i32 = 0;
pub fn find_space(board: &Board) -> i32 {
if is_game_in... |
pub mod compute_py;
pub mod config_py;
pub mod geo_py;
pub mod stl_py;
|
//! `plbc`, the <b>P</b>aral<b>l</b>isp <b>B</b>ootstrap <b>C</b>ompiler, interprets Parallisp
//! code.
extern crate getopts;
extern crate nom;
extern crate plb;
use getopts::Options;
use plb::ParallispError;
use plb::parser::parse;
use plb::interpreter::eval_all;
use plb::interpreter::macros::process_macros;
use pl... |
use docopt::Docopt;
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
const USAGE: &str = "
Usage: tn edit <note-name>
tn list
tn remove <note-name>
tn show <note-name>
tn (-h | --help)
tn --version
tn --bash-completion
tn --commands
Options:
... |
use std::io;
use std::io::Write;
use std::env;
fn run_cmd (cmd: String) { // what does this return?
println!("{}", cmd);
//cmd.clear(); // use this to clear string when done with cmd
}
fn main() {
let mut status = true;
loop { // rust doesn't have do { while() }
let mut current_dir = match e... |
#[doc = "Reader of register MMMS_DATA_MEM_DESCRIPTOR[%s]"]
pub type R = crate::R<u32, super::MMMS_DATA_MEM_DESCRIPTOR>;
#[doc = "Writer for register MMMS_DATA_MEM_DESCRIPTOR[%s]"]
pub type W = crate::W<u32, super::MMMS_DATA_MEM_DESCRIPTOR>;
#[doc = "Register MMMS_DATA_MEM_DESCRIPTOR[%s] `reset()`'s with value 0"]
impl ... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
use f... |
// Copyright 2017 Dmitry Tantsur <divius.inside@gmail.com>
//
// 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 ap... |
#![allow(unused_imports)]
#![allow(dead_code)]
#[macro_use]
extern crate lazy_static;
mod application;
mod message;
mod message_validator;
mod network;
mod data_dictionary;
mod quickfix_errors;
mod session;
mod types;
use std::io::{BufRead, BufReader, Read, Write};
use std::net::{Ipv4Addr, SocketAddrV4, TcpListener,... |
//! Contains types and definitions for Serial IO registers.
use super::*;
/// Serial IO Control. Read/Write.
pub const SIOCNT: VolAddress<SioControlSetting, Safe, Safe> =
unsafe { VolAddress::new(0x400_0128) };
/// Serial IO Data. Read/Write.
pub const SIODATA8: VolAddress<u16, Safe, Safe> = unsafe { VolAddress::n... |
use std::any::Any;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use rand::prelude::*;
#[cfg(feature = "testing")]
use data_buffer::vec_clone::VecClone;
use data_buffer::{VecCopy, VecDyn};
use dyn_derive::dyn_trait;
static SEED: [u8; 32] = [3; 32];
#[dyn_trait(suffix = "VTable", dyn_crat... |
/// An enum to represent all characters in the Tagalog block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Tagalog {
/// \u{1700}: 'ᜀ'
LetterA,
/// \u{1701}: 'ᜁ'
LetterI,
/// \u{1702}: 'ᜂ'
LetterU,
/// \u{1703}: 'ᜃ'
LetterKa,
/// \u{1704}: 'ᜄ'
LetterGa,
/// \u... |
#![no_std]
//! Generic parallel GPIO interface for display drivers
use embedded_hal::digital::OutputPin;
pub use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
type Result<T = ()> = core::result::Result<T, DisplayError>;
/// This trait represents the data pins of a parallel bus.
///
/// See [... |
use serde::Deserialize;
#[derive(Debug, Default, Deserialize)]
pub struct MultiDimensional {
#[serde(rename = "k")]
pub value: Vec<f64>,
#[serde(rename = "x")]
pub expression: Option<String>,
#[serde(rename = "ix")]
pub index: Option<i64>,
}
|
use super::Room;
impl Room {
pub fn add_character_texture(&mut self) -> Cmd {}
}
|
enum CarType {
hatch,
sedan,
suv
}
fn print_size(car:CarType){
match car {
hatch => println!("Small sized car"),
sedan => println!("Medium sized car"),
suv => println!("Large sized car")
}
}
fn main() {
print_size(CarType::hatch);
print_size(CarType::sedan);
pri... |
#![feature(uniform_paths)]
mod linked_stack;
mod singly_linked_list;
pub use linked_stack::LinkedStack;
pub use singly_linked_list::SinglyLinkedList;
|
use std::path::PathBuf;
use std::process::{Child, Command};
use std::thread::sleep;
use std::{convert::TryInto, fs, time::Duration};
use criterion::measurement::WallTime;
use criterion::{criterion_group, criterion_main, BenchmarkGroup, Criterion};
use reqwest::blocking::Client;
use reqwest::blocking::ClientBuilder;
us... |
extern crate openssl;
#[macro_use]
extern crate juniper;
#[macro_use]
extern crate diesel;
extern crate serde_json;
use actix_cors::Cors;
use actix_web::{middleware, web, App, HttpServer};
use crate::db::get_db_pool;
use crate::handlers::register;
mod db;
mod handlers;
mod schema;
mod schemas;
#[actix_rt::main]
as... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
use std::io;
use std::net::SocketAddr;
use std::path::Path;
use bytes::BytesMut;
use futures::futu... |
mod context;
mod errors;
mod lisp_ops;
mod storage;
mod value;
pub use context::Context;
pub use errors::{ErrorKind, LispError, LispResult};
pub use lisp_ops::LispOps;
pub use value::LispValue;
pub trait LispData: Sized {
type Integer;
type Symbol;
type ByteArray;
fn is_nil(&self) -> bool;
fn is_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.