text stringlengths 8 4.13M |
|---|
#[doc = "Reader of register COMP1_CSR"]
pub type R = crate::R<u32, super::COMP1_CSR>;
#[doc = "Writer for register COMP1_CSR"]
pub type W = crate::W<u32, super::COMP1_CSR>;
#[doc = "Register COMP1_CSR `reset()`'s with value 0"]
impl crate::ResetValue for super::COMP1_CSR {
type Type = u32;
#[inline(always)]
... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use std::num::NonZeroU32;
use std::time::Duration;
use governor::{Quota, DirectRateLimiter};
use governor::clock::Clock;
use log::debug;
pub struct RateLimiter {
limiters: Vec<DirectRateLimiter>,
}
impl RateLimiter {
pub fn new() -> RateLimiter {
RateLimiter {
limiters: Vec::new(),
... |
#[macro_use]
extern crate log;
extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
pub mod converters;
pub mod hashes;
pub mod random;
pub mod ecc;
pub mod types;
pub mod net;
pub mod db;
pub mod mac;
pub mod client;
pub mod server;
|
//! Where miscellaneous traits reside.
use std::{borrow::Borrow, ops::Deref};
#[allow(unused_imports)]
use core_extensions::SelfOps;
use crate::{
pointer_trait::{CanTransmuteElement, TransmuteElement},
sabi_types::{RMut, RRef},
std_types::{RSlice, RStr, RString, RVec},
};
///////////////////////////////... |
//! Tests auto-converted from "sass-spec/spec/parser/interpolate/44_selector/todo_single_escape"
#[allow(unused)]
use super::rsass;
#[allow(unused)]
use rsass::precision;
// Ignoring "11_escaped_interpolated_value", tests with expected error not implemented yet.
// Ignoring "21_escaped_interpolated_variable", tests w... |
// 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 {
fuchsia_criterion::criterion::{black_box, Bencher, Criterion},
fuchsia_zircon as zx,
};
pub fn benches(c: &mut Criterion) {
c.bench_func... |
#![feature(test)]
extern crate test;
extern crate password_maker_lib;
use test::test::Bencher;
use password_maker_lib::printout_password;
#[cfg(not(debug_assertions))]
#[bench]
#[ignore]
fn printout_password_bench(b: &mut Bencher)
-> ()
{
let length = 10000;
let amount = 75000;
b.iter(||
{
... |
use crate::gpu::GPU;
use crate::memory_map::*;
// abstract memory into its logical parts instead of one big array
// currently do not have an implementation for echo ram
pub struct MemoryBus {
bios: [u8; 0xff],
rom_bank0: [u8; 0x4000],
rom_bankn: [u8; 0x4000],
// vram: [u8; 0x2000],
eram: [u8; 0x20... |
use crate::Event;
use snafu::Snafu;
pub mod util;
#[cfg(feature = "transforms-add_fields")]
pub mod add_fields;
#[cfg(feature = "transforms-add_tags")]
pub mod add_tags;
#[cfg(feature = "transforms-ansi_stripper")]
pub mod ansi_stripper;
#[cfg(feature = "transforms-aws_ec2_metadata")]
pub mod aws_ec2_metadata;
#[cfg(... |
// Copyright 2014 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 ... |
macro_rules! declare_enabled_traits {
(
auto_traits[
$(($auto_trait:ident, $auto_trait_query:ident, $auto_trait_path:path)),* $(,)*
]
regular_traits[
$(($regular_trait:ident, $regular_trait_query:ident, $regular_trait_path:path)),* $(,)*
]
) => (
... |
use std::collections::HashMap;
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::RwLock;
use directories::ProjectDirs;
pub const CLIENT_ID: &str = "d420a117a32841c2b3474932e49fb54b";
#[derive(Clone, Serialize, Deserialize, Debug, Default)]
pub struct Config {
pub default_keybindings: Option<bool>,
... |
#[macro_use]
extern crate bencher;
extern crate svgdom;
use std::fs;
use std::env;
use std::io::Read;
use bencher::Bencher;
use svgdom::{Document, WriteBuffer};
const TEN_MIB: usize = 10 * 1024 * 1024;
fn load_file(path: &str) -> String {
let path = env::current_dir().unwrap().join(path);
let mut file = fs... |
use std::path::PathBuf;
use crate::fs::LllDirList;
use crate::history::{DirectoryHistory, LllHistory};
use crate::sort;
use crate::ui;
use crate::window::{LllPanel, LllView};
use crate::LllConfig;
use crate::THEME_T;
pub struct LllTab {
pub history: LllHistory,
pub curr_path: PathBuf,
pub curr_list: LllD... |
#[cfg(all(not(target_arch = "wasm32"), test))]
mod test;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::term::prelude::Term;
/// `orelse/2` infix operator.
///
/// Short-circuiting, but doesn't enforce `right` is boolean. If you need to enforce `boolean` for
/// both operands, use `or_2`.
#[native_im... |
use crate::types::{
Cipher, DecryptedShare, NrOfShuffles, PublicParameters, TopicId, TopicResult, VoteId,
Wrapper,
};
use crate::{
helpers::params::get_public_params, Ciphers, DecryptedShares, Error, Sealers, Tally,
Trait,
};
use crypto::encryption::ElGamal;
use crypto::types::Cipher as BigCipher;
use f... |
// Copyright (c) 2014 Michael Woerister
//
// 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, publ... |
use crate::architecture::*;
use crate::loader::*;
use crate::memory::backing::Memory;
use crate::Error;
use log::warn;
use std::collections::BTreeMap;
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
/// The address where the first library will be loaded
const DEFAULT_LIB_BASE: u64 = 0x4000_0000;
... |
#[doc = "Reader of register C5ISR"]
pub type R = crate::R<u32, super::C5ISR>;
#[doc = "Reader of field `TEIF5`"]
pub type TEIF5_R = crate::R<bool, bool>;
#[doc = "Reader of field `CTCIF5`"]
pub type CTCIF5_R = crate::R<bool, bool>;
#[doc = "Reader of field `BRTIF5`"]
pub type BRTIF5_R = crate::R<bool, bool>;
#[doc = "R... |
use crate::{
database::Database,
services::{stdin::StdinService, stdout::StdoutService},
utils::{module_for_path, packages_path},
Exit, ProgramResult,
};
use candy_frontend::{ast_to_hir::AstToHir, hir, TracingConfig};
use candy_vm::{
execution_controller::RunForever,
fiber::EndedReason,
heap... |
#[doc = "Reader of register ITLINE1"]
pub type R = crate::R<u32, super::ITLINE1>;
#[doc = "Reader of field `PVDOUT`"]
pub type PVDOUT_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - PVD supply monitoring interrupt request pending (EXTI line 16)."]
#[inline(always)]
pub fn pvdout(&self) -> PVDOUT_R {
... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
use std::cmp::{Ord, Ordering};
use std::collections::{BinaryHeap, HashSet};
use std::time::Instant;
use tokio::stream::StreamExt;
use tracing::debug;
use crate::protobuf::*;
/// Maintains outstanding client orders to be retried when the timeout is reached
pub(crate) struct ClientOrderManager {
orders: BinaryHeap... |
//! Permissions
use serde::{Deserialize, Serialize};
/// Permissions for a resource
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Permission {
/// Access Type
pub action: Action,
/// Resource object
pub resource: crate::models::Resource,
}
impl Permission {
/// Return ... |
/// Calculate additive persistance for a number, return it as `Some(persistance)`
///
/// If the input is less than 10, return `None` because the persistance is solved
fn collapse(mut number: u128) -> Option<u128> {
if number < 10 {
return None
}
let mut sum = 0;
while number > 0 {
sum ... |
/// The `Array` global object
pub mod array;
/// The `Boolean` global object
pub mod boolean;
/// The `console` global object
pub mod console;
/// The `Error` global objects
pub mod error;
/// The `Function` global object
pub mod function;
/// The `JSON` global object
pub mod json;
/// The `Math` global object
pub mod ... |
#![feature(alloc)]
use std::boxed;
use std::fmt::Debug;
use std::mem::{min_align_of_val, align_of_val, size_of_val};
use std::rt::heap::deallocate;
use std::marker::PhantomData;
#[allow(dead_code)]
#[derive(Debug, Copy, Clone)]
struct Something {
value: u8
}
#[allow(dead_code)]
fn printalign<T: Debug>(v: T) {
... |
use std::io::{self, BufRead, Read};
struct Slope {
right: usize,
down: usize,
}
#[derive(Clone)]
struct Location {
x: usize,
y: usize,
}
#[derive(Clone)]
struct Map {
// u8 so it easy to count; 1 = tree, 0 = no tree.
map: Vec<Vec<u8>>,
current_pos: Location,
}
impl Map {
fn new<F: Re... |
mod selection;
mod snake;
pub use selection::SelectionScreen;
|
use efm32gg_hal::gpio;
use embedded_hal::digital::InputPin;
use efm32gg_hal::gpio::EFM32Pin;
pub struct Buttons {
button0: gpio::pins::PB9<gpio::Input>,
button1: gpio::pins::PB10<gpio::Input>,
}
/// A representation of the two user buttons on the STK3700
impl Buttons {
pub fn new(pb9: gpio::pins::PB9<gpio... |
pub mod art_book;
pub mod book;
pub mod fifo;
pub mod optimised_fifo;
|
use console::{style, StyledObject};
pub fn url(msg: &str) -> StyledObject<&str> {
style(msg).blue().bold()
}
pub fn warning(msg: &str) -> StyledObject<&str> {
style(msg).red().bold()
}
pub fn highlight(msg: &str) -> StyledObject<&str> {
style(msg).yellow().bold()
}
|
use std::ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign};
use crate::structs::offset4::Offset4;
impl<'a> Add for &'a Offset4 {
type Output = Offset4;
fn add(self, rhs: Self) -> Self::Output {
let mut res = self.clone();
res.0 += rhs.0;
res.1 += rhs.1;
res.... |
use crate::structs::Component;
use libloading::{Library, Symbol};
use std::any::Any;
use std::collections::HashMap;
use std::fmt::Debug;
use std::fs::read_dir;
use std::fs::DirEntry;
use std::path::PathBuf;
pub type PluginCreate<'a> = unsafe fn(Library) -> *mut dyn Plugin;
pub type ComponentsHashMap = Vec<HashMap<Stri... |
#[derive(Debug, Clone)]
pub enum ChessKind {
LEAF,
TRUNK,
BRANCH,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Position {
pub(crate) x: usize,
pub(crate) y: usize,
}
#[derive(Clone, Debug)]
pub struct Chess {
pub kind: ChessKind,
pub position: Position,
pub camp: Camp,
}
... |
// Write code here.
//
// To see what the code looks like after macro expansion:
// $ cargo expand
//
// To run the code:
// $ cargo run
use seq::seq;
seq!(N in 0..16 {
#[derive(Copy, Clone, PartialEq, Debug)]
enum Interrupt {
#(
Irq#N,
)*
}
});
fn main() {
let int... |
use leptos::*;
#[component]
pub fn Button(cx: Scope, children: Children) -> impl IntoView {
view! { cx,
<button class="p-1 my-2 transition bg-green-400 border-2 border-gray-900 rounded-md active:bg-green-300 hover:border-white">
{children(cx)}
</button>
}
}
|
use std::convert::TryInto;
use proptest::strategy::Just;
use proptest::{prop_assert, prop_assert_eq};
use liblumen_alloc::erts::term::prelude::*;
use crate::erlang::make_tuple_2::result;
use crate::test::strategy;
#[test]
fn without_arity_errors_badarg() {
run!(
|arc_process| {
(
... |
use bigneon_api::config::{Config, Environment};
use bigneon_db::dev::*;
use bigneon_db::models::User;
use diesel::Connection;
use diesel::PgConnection;
use std::sync::Arc;
#[derive(Clone)]
pub struct TestDatabase {
pub connection: Arc<PgConnection>,
}
#[allow(dead_code)]
impl TestDatabase {
pub fn new() -> Te... |
use std::io::{Read};
use pest::{Parser};
use template::parse::{self, TemplateParser, Rule};
use template::{ComponentTemplate};
/// A template, used to define how a group of components should be layouted and initialized based
/// on model data.
#[derive(Debug)]
pub struct Template {
pub root: ComponentTemplate,
}... |
//! Compile-time assertions to ensure that invariants are met.
//!
//! _All_ assertions within this crate are performed at **compile-time**. This
//! allows for finding errors quickly and early when it comes to ensuring
//! certain features or aspects of a codebase.
//!
//! # Usage
//!
//! This crate is available [on c... |
use futures::TryStreamExt;
use sqlx::{sqlite::SqliteQueryAs, Connect, Connection, Executor, Sqlite, SqliteConnection};
use sqlx_test::new;
#[cfg_attr(feature = "runtime-async-std", async_std::test)]
#[cfg_attr(feature = "runtime-tokio", tokio::test)]
async fn it_connects() -> anyhow::Result<()> {
Ok(new::<Sqlite>(... |
use juniper::GraphQLScalar;
#[derive(GraphQLScalar)]
#[graphql(transparent)]
struct Scalar(i32, i32);
fn main() {}
|
use crate::terrain::*;
use std::fmt;
use rand::Rng;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Forest {
layout: Vec<ForestFeature>,
size: usize,
}
impl Forest {
///
/// Generates a forest of specified size
/// the height and width are always the same
/// size
///
pub fn new(siz... |
use std::{sync::Arc, collections::HashMap};
use imgui::{Context, sys::ImDrawCmd, internal::RawWrapper, FontSource, TextureId};
use sourcerenderer_core::{graphics::{Backend, Device, MemoryUsage, BufferUsage, Scissor, Viewport, SampleCount, TextureUsage, Format, TextureDimension, TextureInfo, TextureViewInfo}, Vec2, Vec... |
//! Monitoring metrics.
use std::sync::Arc;
use chrono::{DateTime, Utc};
use rpki::tal::TalInfo;
//------------ Metrics -------------------------------------------------------
#[derive(Clone, Debug)]
pub struct Metrics {
/// Time when these metrics have been collected.
time: DateTime<Utc>,
/// Per-TAL ... |
#[doc = "Reader of register D2CFGR"]
pub type R = crate::R<u32, super::D2CFGR>;
#[doc = "Writer for register D2CFGR"]
pub type W = crate::W<u32, super::D2CFGR>;
#[doc = "Register D2CFGR `reset()`'s with value 0"]
impl crate::ResetValue for super::D2CFGR {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
pub mod streaming;
|
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use serde::{Deserialize, Serialize};
#[derive(Debug, Hash, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct ContractEvent {}
|
use crate::common::CommonState;
use crate::edit::apply_map_edits;
use crate::game::{State, Transition, WizardState};
use crate::helpers::ID;
use crate::render::{draw_signal_cycle, DrawCtx, DrawOptions, DrawTurn, TrafficSignalDiagram};
use crate::ui::{ShowEverything, UI};
use abstutil::Timer;
use ezgui::{hotkey, Choice,... |
fn foo<'a, 'b>(t: &'a i32, f: &'b i32) {
}
|
use std::io;
use dsrv::server::Server;
fn main() -> io::Result<()> {
std::env::set_var("RUST_LOG", "user_auth=info,dsrv=info cargo run");
Server::new().run(None)
}
|
use std::io::{BufRead, stdin};
use std::fmt::Write;
fn main() {
let stdin = stdin();
let mut iterator = stdin.lock().lines();
let values: Vec<i64> = iterator
.next()
.unwrap()
.unwrap()
.split_whitespace()
.map(|s| s.parse().unwrap())
.collect();
let mu... |
pub mod test_helpers;
mod file_finder_test_suite {
use crate::test_helpers::*;
use hackscanner_lib::*;
#[test]
fn find_files_test() {
let rules = get_rules_multiple_results();
let matches = file_finder::find_files(get_test_dir(), &rules);
assert_multiple_paths(matches);
}
... |
/// Asserts that constant expressions evaluate to `true`.
///
/// Constant expressions can be ensured to have certain properties via this
/// macro If the expression evaluates to `false`, the file will fail to compile.
/// This is synonymous to [`static_assert` in C++][static_assert].
///
/// # Alternatives
///
/// The... |
#![feature(
wasm_import_module,
global_allocator,
)]
extern crate wee_alloc;
extern crate nabi;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[macro_export]
macro_rules! print {
($($arg:tt)*) => {{
$crate::print(&format!($($arg)*));
}};
}
#[macro_export]... |
//! **MySQL** database and connection types.
pub use arguments::MySqlArguments;
pub use connection::MySqlConnection;
pub use cursor::MySqlCursor;
pub use database::MySql;
pub use error::MySqlError;
pub use row::MySqlRow;
pub use type_info::MySqlTypeInfo;
pub use value::{MySqlData, MySqlValue};
mod arguments;
mod conn... |
extern crate iqdb;
fn main() {
let url = ::std::env::args().nth(1).expect("Expect 1 image URL");
let services = iqdb::available_services().unwrap();
let matches = iqdb::search_by_url(&url, &services).unwrap();
matches.iter().for_each(|m| println!("{:?}", m));
}
|
/*
Copyright (c) 2015, 2016 Saurav Sachidanand
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, di... |
pub mod blank;
pub mod height_map;
|
#[doc = "Reader of register MACMDIOAR"]
pub type R = crate::R<u32, super::MACMDIOAR>;
#[doc = "Writer for register MACMDIOAR"]
pub type W = crate::W<u32, super::MACMDIOAR>;
#[doc = "Register MACMDIOAR `reset()`'s with value 0"]
impl crate::ResetValue for super::MACMDIOAR {
type Type = u32;
#[inline(always)]
... |
use std::cmp::Ordering;
use std::collections;
use std::io;
use std::num::TryFromIntError;
use std::option::Option::Some;
use rand::Rng;
use t_c::test_vector;
use crate::structures::{Coin, State};
use std::borrow::Borrow;
mod structures;
mod variables;
mod lib;
mod front_of_house;
mod t_c;
fn main() {
// guess_... |
fn main() {
cpp_build::Config::new()
.compiler("g++")
.flag("-fopenmp")
.flag("-std=c++17")
.opt_level(3)
.build("src/calculation/openmp/cpp_interface.rs");
} |
fn main() {
for i in 1..=3 {
println!("count-{}", i);
}
print!("aaa");
print!("bbb");
} |
use std::collections::hash_map::*;
use std::ffi::OsStr;
use std::fs::File;
use std::env;
use std::io::{self, BufReader};
use std::path::{Path, PathBuf};
use std::str;
use hangouts_json_parser::{raw, Hangouts};
fn usage() {
eprintln!("usage: {} <json path> <participant name>", env::args().next().unwrap());
}
fn ch... |
extern crate chrono;
#[macro_use]
extern crate clap;
#[macro_use]
extern crate nom;
extern crate uuid;
use clap::{App, Arg, SubCommand};
use std::fs::File;
use std::io::Read;
use std::path::Path;
mod vm;
mod instruction;
mod repl;
mod assembler;
mod scheduler;
fn main() {
let yaml = load_yaml!("cli.yml");
le... |
// 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 rule::Rule;
#[test]
fn char_in() {
let digit = Rule::new(|_, l| Ok((l.chars().next().unwrap() as u32) - 48));
digit.char_in('0', '9');
let af = Rule::new(|_, l| Ok((l.chars().next().unwrap() as u32) - 55));
af.char_in('A', 'F');
let hex = Rule::default();
hex.any_of(vec![&digit, &af])... |
extern crate pretty_bytes;
use std::mem;
use std::net::UdpSocket;
use std::process::exit;
use pretty_bytes::converter::convert;
use crate::tftp::shared::{data_channel::{DataChannel, DataChannelMode}, err_packet::ErrorPacket, request_packet::{ReadRequestPacket, WriteRequestPacket}, Serializable, STRIDE_SIZE, TFTPPack... |
//! A Rust wrapper around the `easy-ecc` C library.
#![warn(missing_docs)]
#[macro_use]
extern crate serde_hex;
extern crate libc;
pub mod secp256r1;
|
use std::fs;
use std::path::PathBuf;
use guarding_core::rule_executor::rule_error::MismatchType;
use crate::exec_guarding;
fn test_dir() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("_fixtures")
.join("java")
}
#[test]
fn should_working_in_process() {
let path = test_dir().joi... |
// 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::File;
use std::io::BufReader;
use std::io::Read;
fn main() {
let file = File::open("input").expect("Failed to read");
let mut buf_reader = BufReader::new(file);
let mut contents = String::new();
buf_reader.read_to_string(&mut contents).expect("Failed to bufferize file");
let lines = ... |
use itertools::Itertools;
use regex::Regex;
use std::borrow::Borrow;
use std::fs::File;
use std::io::{BufRead, BufReader, Error, ErrorKind, Read};
use std::str::FromStr;
use lazy_static::lazy_static; // 1.3.0
lazy_static! {
static ref byr_present: Regex = Regex::new(r"\bbyr\s*:").unwrap();
static ref iyr_pres... |
use fastanvil::{
render_region, CCoord, Dimension, HeightMode, JavaChunk, RCoord, RegionFileLoader,
TopShadeRenderer,
};
use std::path::{Path, PathBuf};
use crate::palette::BlockPalette;
pub async fn render_map(palette: BlockPalette, path: PathBuf) {
let loader =
RegionFileLoader::<JavaChunk>::new... |
use std::collections::BTreeMap;
use std::io::{self, BufRead};
/*
use std::rc::Rc;
use std::cell::{
struct Node {
children: Vec<Rc<Node>>,
}
impl Node {
fn new() -> Self {
Self {
children: Vec::new(),
}
}
}
*/
type Children<'a> = BTreeMap<&'a str, Vec<&'a str>>;
fn f(n: &str,... |
// Copyright 2021 rust-ipfs-api Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://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 except accord... |
use crate::errors::Result;
use cap_std::fs::Dir;
use std::fs::File;
use std::path::Path;
pub fn open_dir<P: AsRef<Path>>(path: P) -> Result<Dir> {
Ok(unsafe { Dir::open_ambient_dir(path)? })
}
pub fn open_wasi_dir<P: AsRef<Path>>(path: P) -> Result<wasi_cap_std_sync::dir::Dir> {
Ok(wasi_cap_std_sync::dir::Dir... |
use cargo::core::manifest::Target;
use cargo::core::package_id::PackageId;
use cargo::util::errors::{CargoResult, ProcessError};
use cargo::util::process_builder::ProcessBuilder;
use derive_more::Display;
use failure::{Fallible, ResultExt as _};
use fixedbitset::FixedBitSet;
use once_cell::sync::Lazy;
use regex::Regex;... |
use msfs::sim_connect::{
data_definition, Period, SimConnect, SimConnectRecv, SIMCONNECT_OBJECT_ID_USER,
};
#[data_definition]
#[derive(Debug)]
struct Data {
#[name = "RADIO HEIGHT"]
#[epsilon = 0.01]
height: f64,
#[name = "AIRSPEED INDICATED"]
#[epsilon = 0.01]
airspeed: f64,
}
#[data_def... |
use std::ops::{Add, Div, Mul, Sub};
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Vec2 {
pub x: f64,
pub y: f64,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Bbox {
min: Vec2,
max: Vec2,
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Circle {
pub center: Vec2,
pub radius... |
pub use game_camera as camera;
pub use game_controller as controller;
pub use game_core as core;
pub use game_input as input;
pub use game_physics as physics;
pub use game_tiles as tiles;
pub use game_wasi as wasi;
mod plugins;
use game_lib::bevy::{
diagnostic::{DiagnosticsPlugin, FrameTimeDiagnosticsPlugin},
... |
//! A dynamically sized, multi-channel audio buffer.
use audio_core::{
Buf, Channel, ChannelMut, Channels, ChannelsMut, ExactSizeBuf, ResizableBuf, Sample,
};
use std::cmp;
use std::fmt;
use std::hash;
use std::mem;
use std::ops;
use std::ptr;
use std::slice;
mod iter;
pub use self::iter::{Iter, IterMut};
/// A ... |
use lazy_static::lazy_static;
use std::path::PathBuf;
#[cfg(not(debug_assertions))]
use dirs::data_local_dir;
#[cfg(not(debug_assertions))]
use std::path::Path;
use std::sync::Mutex;
// Paths
#[cfg(debug_assertions)]
lazy_static! {
static ref ORG_PATH: PathBuf = std::env::current_dir()
.expect("Couldn't ... |
/// The current state of a button
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[repr(u8)]
pub enum ButtonState {
/// The button was activated this frame
Pressed = 0,
/// The button is active but was not activated this frame
Held = 1,
/// The button was released this frame
Released = 2,
... |
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
use std::env;
fn tail(file_path: &str) -> io::Result<String> {
let f = File::open(file_path)?;
let reader = BufReader::new(f);
reader.lines().last().unwrap_or(Ok(String::new()))
}
fn main() {
match tail("hoge.txt") {
... |
use futures_core::future::BoxFuture;
use crate::any::{Any, AnyConnectOptions, AnyKind};
use crate::connection::Connection;
use crate::error::Error;
#[cfg(feature = "postgres")]
use crate::postgres;
#[cfg(feature = "sqlite")]
use crate::sqlite;
#[cfg(feature = "mssql")]
use crate::mssql;
#[cfg(feature = "mysql")]
u... |
pub use VkDisplaySurfaceCreateFlagsKHR::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkDisplaySurfaceCreateFlagsKHR {
VK_DISPLAY_SURFACE_CREATE_NULL_BIT = 0,
}
use crate::SetupVkFlags;
#[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub struct VkDisplaySurfaceCreateFlagBitsKHR(u32... |
use crate::vec3::{Vec3, Point3};
use rand::{self, Rng};
const POINT_COUNT: i32 = 256;
pub struct Perlin {
ran_vec: Vec<Vec3>,
perm_x: Vec<i32>,
perm_y: Vec<i32>,
perm_z: Vec<i32>,
}
impl Perlin {
fn permute(p: &mut Vec<i32>) {
let mut rng = rand::thread_rng();
// TODO Refactor la... |
pub fn find_special_integer(arr: Vec<i32>) -> i32 {
use std::collections::HashMap;
let mut kvp_arr: Vec<_> = arr
.iter()
.fold(HashMap::new(), |mut acc, val| {
let entry = acc.entry(*val).or_insert(0);
*entry += 1;
acc
})
.into_iter()
... |
extern crate yumeko;
fn main() {
yumeko::play_blackjack();
}
|
#[doc = "Reader of register DSCLKCFG"]
pub type R = crate::R<u32, super::DSCLKCFG>;
#[doc = "Writer for register DSCLKCFG"]
pub type W = crate::W<u32, super::DSCLKCFG>;
#[doc = "Register DSCLKCFG `reset()`'s with value 0"]
impl crate::ResetValue for super::DSCLKCFG {
type Type = u32;
#[inline(always)]
fn re... |
// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]
#[macro_use]
extern crate error_chain;
// #[macro_use]
// extern crate serde_derive;
#[macro_use]
extern crate log;
pub mod classifier;
mod dir_entry;
pub mod errors;
pub mod file_finder;
mod fs;
mod join;
mod matcher;
pub mod rating;
mod rule;
mod s... |
#![allow(clippy::comparison_chain)]
#![allow(clippy::collapsible_if)]
use std::cmp::Reverse;
use std::cmp::{max, min};
use std::collections::{BTreeSet, HashMap, HashSet};
use std::fmt::Debug;
use itertools::Itertools;
use whiteread::parse_line;
const ten97: usize = 1000_000_007;
/// 2の逆元 mod ten97.割りたいときに使う
const in... |
// Models
pub mod scores;
pub mod maps;
pub mod users;
|
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(not(target_os = "android"))]
include!("bindings.rs");
#[cfg(target_os = "android")]
include!("bindings_android.rs"); |
use std::env;
use std::error::Error;
use std::fs;
pub struct Config {
pattern: String,
filename: String,
case_sensitive: bool,
}
impl Config {
pub fn new(args: &[String]) -> Result<Config, &'static str> {
if args.len() < 3 {
return Err("Not enough arguments");
}
le... |
use std::ffi::OsString;
use async_fuse::FileType;
use menmos_client::Query;
use super::{Error, Result};
use crate::MenmosFS;
#[derive(Debug)]
pub struct ReadDirEntry {
pub ino: u64,
pub offset: i64,
pub kind: FileType,
pub name: OsString,
}
pub struct ReadDirReply {
pub entries: Vec<ReadDirEntry... |
use super::*;
mod registered;
#[test]
fn unregistered_errors_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::atom(),
strategy::term(arc_process.clone()),
)
},
|(arc_process, name, message)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.