text stringlengths 3.09k 13.9k |
|---|
use std::future::Future;
use actix_service::{boxed, fn_service};
use crate::{
service::{BoxedHttpServiceFactory, ServiceRequest, ServiceResponse},
FromRequest, HttpResponse, Responder,
};
/// The interface for request handlers.
///
/// # What Is A Request Handler
/// A request handler has three requirements:... |
use serde_json;
use std::fs::File;
use std::io::{self, BufReader, Read};
use std::process;
use tempfile;
#[derive(Serialize, Deserialize, Debug)]
pub struct Metrics {
pub time_namelookup: f32,
pub time_connect: f32,
pub time_pretransfer: f32,
pub time_redirect: f32,
pub time_starttransfer: f32,
... |
use std::{any::Any, sync::Arc};
use async_trait::async_trait;
use crate::arrow::array::Int16Builder;
use datafusion::{
arrow::{
array::{
Array, ArrayRef, BooleanBuilder, Int32Builder, ListBuilder, StringBuilder,
UInt32Builder,
},
datatypes::{DataType, Field, Schema,... |
use {
crate::{log_to_console, pd_func_caller, pd_func_caller_log},
alloc::{boxed::Box, format, string::String, vec::Vec},
anyhow::{ensure, Error},
core::ptr,
crankstart_sys::{ctypes::c_void, size_t, FileOptions, PDButtons, SDFile},
cstr_core::CStr,
cstr_core::CString,
};
pub use crankstart_... |
// Proof of knowledge of signature for signature defined in 2018 paper, CT-RSA 2018 (eprint 2017/1197).
use crate::pok_sig::{PoKOfSignature as PoKOfSignature16, PoKOfSignatureProof};
use amcl_wrapper::field_elem::FieldElement;
use crate::signature_2018::Signature;
use crate::keys::{Verkey, Params};
use crate::errors::... |
// P_3_1_3_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// <NAME>, <NAME>, <NAME>, <NAME>
// with contributions by <NAME> and <NAME>
// Copyright 2018
//
// http://www.generative-gestaltung.de
//
// Licensed under the Apache License, Ver... |
use codec::{Decode, Encode};
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_runtime::RuntimeDebug;
use sp_std::convert::TryFrom;
use sp_std::{prelude::Vec, vec};
#[allow(unused_imports)]
use CurrencyType::*;
macro_rules! create_currency_id {
($(#[$meta:meta])*
$vis:vis enum TokenSymbol {
... |
extern crate libc;
#[macro_use]
extern crate lazy_static;
extern crate time;
extern crate toml;
#[macro_use]
extern crate serde_derive;
use agent::Agent;
use bytecode::printer::ClassfilePrinter;
use bytecode::classfile::Constant;
use bytecode::io::ClassWriter;
use config::Config;
use context::static_context;
use instr... |
use std::fmt::{Debug, Display};
use std::path::{Path, PathBuf};
use std::result::Result as StdResult;
use async_stream::try_stream;
use futures::stream::Stream;
use tokio::fs::DirEntry;
use tokio::io::Error as IoError;
use crate::{Error, Result};
pub(crate) async fn read_bool(path: &Path) -> Result<bool> {
let v... |
#![allow(non_snake_case)]
use crate::native::{new_fn, JNIEnv, JNINativeMethod, JNIResult};
use crate::oop::{self, Class, Oop};
use crate::runtime::{self, require_class3};
use crate::{new_br, util};
use std::sync::atomic::Ordering;
pub fn get_native_methods() -> Vec<JNINativeMethod> {
vec![
new_fn(
... |
// Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use crate::{
components::{action_dropdown, alert_indicator, lock_indicator, paging, table as t, Placement},
extensions::MergeAttrs,
generated::css_classes:... |
// Copyright 2021 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 {
anyhow::{anyhow, Error},
byteorder::{BigEndian, ByteOrder, WriteBytesExt},
fuchsia_component::server::ServiceFs,
fuchsia_inspect::{In... |
// STD Dependencies -----------------------------------------------------------
use std::fmt;
use std::collections::HashMap;
// Macros ---------------------------------------------------------------------
#[macro_export]
macro_rules! require_unique_server {
() => (
fn require_unique_server(&self) -> bool ... |
#![cfg(feature = "sqlite")]
extern crate rusqlite;
use super::{Image,Tag,AnyWith,parse_tag};
use self::rusqlite::{Result as SQLResult, Row, Connection};
use std::path::Path;
pub struct Db(Connection);
impl Default for Db {
fn default() -> Self {
Self::new()
}
}
impl Db {
pub fn new() -> Self {... |
//! Memory profile of a DDlog program.
use differential_dataflow::logging::DifferentialEvent;
use fnv::FnvHashMap;
use sequence_trie::SequenceTrie;
use std::cell::RefCell;
use std::cmp::max;
use std::fmt;
use std::time::Duration;
use timely::logging::{OperatesEvent, ScheduleEvent, StartStop, TimelyEvent};
thread_loca... |
// Copyright 2022 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 {
assert_matches::assert_matches,
blobfs_ramdisk::BlobfsRamdisk,
fidl_fuchsia_component_resolution::{self as fresolution, ResolverMarker, R... |
use core::fmt;
use std::str::FromStr;
use chrono::{DateTime, Local};
use thiserror::Error;
use super::args::{ForeignPath, ForwardPath, ReversePath};
#[derive(Clone, Debug, Default)]
pub struct Message {
pub headers: Vec<(String, String)>,
pub body: String,
}
impl Message {
pub fn new<T: Into<DateTime<Local>>>(da... |
use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder};
use anyhow::Result;
use serde::{Deserialize, Serialize};
use sgx_types::*;
use sgx_urts::SgxEnclave;
use std::convert::TryInto;
use std::str::FromStr;
use web3::contract::{Contract, Options};
use web3::types::Address;
static ENCLAVE_FILE: &'sta... |
use object::read::{File as ElfFile, Object, ObjectSymbol};
use postform_decoder::{print_log, ElfMetadata, SerialDecoder, POSTFORM_VERSION};
use postform_rtt::{
attach_rtt, configure_rtt_mode, disable_cdebugen, download_firmware, run_core, RttError,
RttMode,
};
use probe_rs::{DebugProbeError, DebugProbeSelector,... |
// Copyright Materialize, Inc. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License... |
extern crate askama_shared as shared;
#[macro_use]
extern crate nom;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
extern crate syn;
mod generator;
mod input;
mod parser;
use input::{Print, Source, TemplateInput};
use parser::{Expr, Macro, Node};
use proc_macro::TokenStream;
use ... |
use std::f64::consts::PI;
pub use anyhow::{anyhow, Result};
use lle::{
num_complex::{Complex, Complex64},
CoupledLleSolver, Evolver, LinearOp, LleSolver,
};
pub struct Worker {
core: CoupledLleSolver<
f64,
[Complex64; SHELL_LEN],
lle::LinearOpAdd<(lle::DiffOrder, Complex64), (lle::... |
use error::{Error, ErrorKind, Result};
use sparse_vector::SparseVector;
use clap::{App, Arg, ArgMatches, SubCommand};
use futures::executor::ThreadPoolBuilder;
use futures::prelude::*;
use futures::stream::iter_result;
use std::collections::{HashMap, HashSet};
use std::f64::EPSILON;
use std::fs::{DirBuilder, File};
... |
use std::cmp::max;
use std::io::BufRead;
use std::fs::File;
use std::io::BufReader;
extern crate permutator;
use permutator::Permutation;
fn main() {
let f = File::open("input.txt").unwrap();
let mut reader = BufReader::new(f);
let mut buf = String::new();
reader.read_line(&mut buf);
let xs: Vec<i... |
//
// Copyright (C) 2018 Kubos Corporation
//
// 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 agree... |
use std::{convert::TryFrom, sync::Arc};
use hdk3::prelude::{CellId, WasmError};
use holo_hash::AgentPubKey;
use holochain_keystore::AgentPubKeyExt;
use holochain_serialized_bytes::SerializedBytes;
use holochain_state::env::EnvironmentWrite;
use holochain_types::{
app::InstalledCell,
dna::{DnaDef, DnaFile},
};
... |
use crate::error::BitGenericError;
use crate::obj::Oid;
use rustc_hash::FxHasher;
use rustc_hex::{FromHex, ToHex};
use sha1::digest::consts::U4;
use sha1::digest::Output;
use sha1::{digest, Digest, Sha1};
use std::convert::TryInto;
use std::fmt::{self, Debug, Display, Formatter};
use std::hash::Hasher;
use std::ops::In... |
//! Additional common hooks that can be used out of the box with minimal config.
use crate::core::{
client::Client, helpers::spawn, hooks::Hook, manager::WindowManager, ring::Selector,
};
use std::collections::HashMap;
/**
* Automatically set the X root window WM_NAME property to be the WM_NAME of the
* active w... |
use lazy_static::lazy_static;
use regex::Regex;
use std::{borrow::Cow, cmp::Ordering, collections::HashMap, fmt, str::FromStr};
#[cfg(test)]
mod tests;
struct DialogueFormat {
cols: HashMap<String, usize>,
}
#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct Centisec(u32);
#[derive(PartialEq, Eq)]
struct Dialogue... |
use std::{
fs::File,
io::{BufReader, BufWriter},
path::PathBuf,
};
use anyhow::{anyhow, Context};
use matrix_sdk::{
room::Room,
ruma::{
events::{room::member::MemberEventContent, AnyMessageEventContent, StrippedStateEvent},
RoomId,
},
Client, ClientConfig, Session, SyncSetti... |
// Copyright (C) 2017-2019 Baidu, Inc. 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, this list of condit... |
use crate::ansi::strip_ansi_escape;
use crate::item::{Item, ItemType};
use lazy_static::lazy_static;
use regex::Regex;
use std::convert::From;
pub fn parse<'a, 'b>(haystack: &'a str) -> Result<impl Iterator<Item = Item> + 'b, String> {
let mut items: Vec<Item> = Vec::new();
let haystack = strip_ansi_escape(hay... |
// Copyright 2018 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::runtime::{EHandle, PacketReceiver, ReceiverRegistration},
fuchsia_zircon::{self as zx, AsHandleRef},
futures::task::{AtomicWaker, ... |
use crate::error::{LoftyError, Result};
use crate::types::properties::FileProperties;
use std::time::Duration;
use byteorder::{LittleEndian, ReadBytesExt};
const PCM: u16 = 0x0001;
const IEEE_FLOAT: u16 = 0x0003;
const EXTENSIBLE: u16 = 0xFFFE;
#[allow(missing_docs, non_camel_case_types)]
#[derive(Debug, Copy, Clon... |
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
//
// 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 applicab... |
use druid::{
widget::Controller,
widget::LineBreaking,
widget::Painter,
widget::{prelude::*, RawLabel},
ArcStr, Data, Lens, MouseButton, Point, Widget, WidgetExt as _, WidgetId, WidgetPod,
};
use super::{TabId, CLOSE_TAB};
use crate::{theme, widget::Icon};
#[derive(Debug, Clone, Data, Lens)]
pub s... |
//
// MIT License
//
// Copyright (c) 2018 Stegos
//
// 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, m... |
use crate::userlib::NewFromString;
use crate::UserLibError;
use std::cmp::Eq;
use std::convert::TryFrom;
use std::fmt::{self, Debug, Display};
/// A record(line) in the user database `/etc/shadow` found in most linux systems.
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Shadow {
pos: u32,
source: String,... |
mod alpha;
mod base;
mod blend;
mod channel;
mod hsv;
mod iter;
mod rgb;
pub mod space;
#[cfg(test)]
mod test;
use std::str;
use num_traits::NumCast;
pub use self::alpha::*;
pub use base::*;
pub use blend::*;
pub use channel::*;
pub use hsv::*;
pub use iter::*;
pub use rgb::*;
use angle::*;
use space::{std_gamma_... |
use proc_macro2::{TokenStream, Span};
use quote::{quote, ToTokens, TokenStreamExt};
use syn::Ident;
use fnv::{FnvHashMap as Map, FnvHashSet as Set};
use crate::graph::{Graph, Node, NodeId, Range, Meta};
use crate::leaf::Leaf;
mod fork;
mod leaf;
mod rope;
mod context;
use self::context::Context;
pub struct Generato... |
//! The ruin module contains various strategies to destroy small, medium or large parts of an
//! existing solution.
use crate::construction::heuristics::InsertionContext;
use crate::solver::RefinementContext;
use std::iter::once;
use std::sync::{Arc, RwLock};
/// A trait which specifies logic to destroy parts of sol... |
//! Various code point constants and code point sets of general interest.
/// The maximum code point value that can be represented in a single UTF-16 code
/// unit.
pub const MAX_BMP: u32 = 0xFFFF;
/// Code for U+0009 CHARACTER TABULATION.
pub const CHARACTER_TABULATION: u32 = 0x0009;
/// Code for U+000B LINE TABULAT... |
use std::path::{Path, PathBuf};
use crate::toc::TOC;
use std::fs::OpenOptions;
use std::io::{Seek, SeekFrom};
use crate::builder::Builder;
use crate::entries::Entries;
use crate::entry::Entry;
use crate::header::Metadata;
use crate::error::{Result, Error};
const MAGIC_NUMBER: u128 = 0x169f57e6bbb98f2d139ee9a294f9cd3c;... |
//! [aurelius](https://github.com/euclio/aurelius) is a complete solution for rendering and
//! previewing markdown.
//!
//! This crate provides a server that can render and update an HTML preview of markdown without a
//! client-side refresh. The server listens for both WebSocket and HTTP connections on arbitrary
//! ... |
use crate::{
chessmove::MoveSetChunk, BitBoard, BoardPos, Color, File, MoveSet, Piece, Rank, State, bitboard::masks,
};
pub fn all_pseudo_legal(state: &State) -> MoveSet {
let mut ms = MoveSet::new_empty();
for piece in Piece::all() {
for pos in state
.board
.color_piece_bo... |
use crate::game::{Game, Tile};
use std::convert::TryInto;
use strum_macros::EnumIter;
// These are ordered so they're most efficient when iterated through
#[derive(EnumIter)]
pub enum Symmetry {
FlipH,
FlipV,
Rotate90,
Rotate180,
Rotate270,
NoSymmetry,
}
impl Symmetry {
pub fn reverse(self... |
use std::f64::{NEG_INFINITY, consts::PI};
use crate::core::math;
use crate::space::*;
use crate::primitive::{Primitive, OptionalPrimitive};
use crate::interaction::RayIntersection;
use crate::Material;
/**
A sphere of any size positioned somewhere in 3D space
*/
#[derive(Debug)]
pub struct Sphere {
pub origin:... |
//! This is the primary binary for the Bottlerocket API server.
#![deny(rust_2018_idioms)]
#[macro_use]
extern crate log;
use libc::gid_t;
use nix::{
sys::wait::{waitpid, WaitPidFlag, WaitStatus},
unistd::{Gid, Pid},
};
use signal_hook::{consts::SIGCHLD, iterator::Signals};
use simplelog::{Config as LogConfi... |
// Copyright 2020 <NAME>
// SPDX-License-Identifier: Apache-2.0
use crate::{
account::{AccountHandle, AccountSynchronizeStep},
account_manager::{AccountStore, AccountsSynchronizer},
address::{AddressOutput, AddressWrapper, IotaAddress},
client::ClientOptions,
message::{Message, MessagePayload, Tran... |
#[derive(Debug,Copy,Clone)]
pub struct Entry {
id: usize,
width: u32,
height: u32,
}
impl Entry {
pub fn new( id: usize, width: u32, height: u32 ) -> Entry {
Entry {
id: id,
width: width,
height: height,
}
}
}
#[derive(Debug)]
pub struct EntryWithPosition {
pub id: usize,
pub width: u32,
pub... |
use std::io::Write;
use crate::ast::ast::*;
use crate::ast::error::*;
use crate::output::output::*;
// return文のコンパイル
// returnする値のastはexprs[0]
pub fn execute_return<T: Write>(mut ast: Ast, buf: &mut OutputBuffer<T>) {
if let Some(mut return_expr) = ast.exprs.take() {
output_ast(return_expr.swap_remove(0),... |
// This file is part of syslog. 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/syslog/master/COPYRIGHT. No part of syslog, including this file, may be copied, modified, propagated, or distributed except ac... |
pub mod color;
use self::color::Color;
use super::ppm::{Ppm, PpmColor};
use std::cmp;
#[derive(Debug)]
pub struct Canvas {
pixels: Vec<Vec<Color>>,
width: usize,
height: usize,
}
impl Canvas {
/** Create a new Canvas with width and height.
*
* All pixels are initialized to black (0, 0, 0)... |
extern crate getopts;
use getopts::Options;
use std::env;
use std::process::{exit, Command};
const AWS_BUCKET_URL: &str = "https://s3.amazonaws.com/bosh-core-stemcells";
const GCP_BUCKET_URL: &str = "https://storage.googleapis.com/bosh-core-stemcells";
const ALICLOUD: &str = "alicloud";
const ALICLOUD_PATH: &str = "a... |
use std::cmp;
use num::BigUint;
use crate::domain::Countable;
use crate::domain::{Bits,Bytes};
use crate::machine::Width;
use crate::machine::MicroCode;
// ================================================================
// Format
// ================================================================
/// Defines a forma... |
use kurisu::*;
use std::path::PathBuf;
#[derive(Debug, Kurisu)]
#[kurisu(
name = "grep",
version = "3.0",
desc = "Search for PATTERN in each FILE or standard input. PATTERN is, by default, a basic regular expression (BRE)."
)]
/// 'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.
/// Direct invocation as ... |
use bitcoin::{Address, Transaction};
use bitcoin_hashes::hex::ToHex;
use minimint::config::load_from_file;
use minimint::modules::mint::tiered::coins::Coins;
use minimint::modules::wallet::txoproof::TxOutProof;
use minimint_api::encoding::Decodable;
use minimint_api::Amount;
use mint_client::mint::SpendableCoin;
use mi... |
use std::cell::RefCell;
use std::collections::VecDeque;
use std::fmt;
use std::rc::{Rc, Weak};
use std::sync::atomic::{AtomicUsize, Ordering};
type NodeMut<T> = RefCell<Node<T>>;
pub type RcNode<T> = Rc<NodeMut<T>>;
pub type WeakNode<T> = Weak<NodeMut<T>>;
static GLOBAL_NODE_ID: AtomicUsize = AtomicUsize::new(0);
pu... |
// Copyright 2020 The OctoSQL 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 required by applicable law or agree... |
use crate::runner::*;
use std::env;
use std::fs::{create_dir, create_dir_all, File, OpenOptions};
use std::io::prelude::*;
use std::io::{self, BufReader, BufWriter};
use std::path::{Path, PathBuf};
use std::sync::mpsc;
use structopt::StructOpt;
use tracing::{error, info, warn};
use tracing_subscriber::{EnvFilter, Layer... |
//! SPI Commands for the Waveshare 2.7" B 3 color E-Ink Display
use crate::traits;
/// EPD2IN7B commands
///
/// More information can be found in the [specification](https://www.waveshare.com/w/upload/d/d8/2.7inch-e-paper-b-specification.pdf)
#[allow(dead_code)]
#[derive(Copy, Clone)]
pub(crate) enum Command {
///... |
use crate::Session;
use crate::SessionError;
use log::{self, debug};
use oauth2::basic::BasicClient;
use oauth2::reqwest::async_http_client;
use oauth2::{
AuthUrl, AuthorizationCode, ClientId, ClientSecret, CsrfToken, RedirectUrl, Scope,
TokenResponse, TokenUrl,
};
use serde::{Deserialize, Serialize};
use tokio... |
//! Persistence
//!
//! CRUD of `invitation` & `users` tables
use std::time::Duration;
use rbatis::core::db::DBPoolOptions;
use rbatis::crud::{Skip, CRUD};
use rbatis::executor::Executor;
use rbatis::rbatis::Rbatis;
use super::hash_password;
use crate::constant::CONFIG;
use crate::error::{ServiceError, ServiceResult... |
pub type Seed = [u8; 16];
pub type Xs = [core::num::Wrapping<u32>; 4];
pub fn xorshift(xs: &mut Xs) -> u32 {
let mut t = xs[3];
xs[3] = xs[2];
xs[2] = xs[1];
xs[1] = xs[0];
t ^= t << 11;
t ^= t >> 8;
xs[0] = t ^ xs[0] ^ (xs[0] >> 19);
xs[0].0
}
pub fn xs_u32(xs: &mut Xs, min: u32, ... |
//
use std::ascii::AsciiExt;
use std::env;
use std::fs;
use std::process;
//
fn string_to_str(string: &String) -> &str {
return &string;
}
//
fn string_to_lower(string: &String) -> String {
return string.chars().map(|c| c.to_ascii_lowercase()).collect();
}
//
fn path_is_file(path: &String) -> bool {
retu... |
const DIAGRAM_CONTAINER: &str =
"#main > div.docblock.type-decl > div > div > div.railroad_container";
const OPTIONS: &str =
"#main > div.docblock.type-decl > div > div > div.railroad_container > div > div > img";
const OPT_FULLSCREEN: &str =
"#main > div.docblock.type-decl > div > div > div.railroad_contai... |
use crate::lib::cmd_base::Cmd;
use crate::lib::fs::{
add_into_shared_credentials, add_shared_config, load_config, Account, CredentialOutputTarget,
};
use crate::lib::io::{get_input, MasqueradeOutputExt};
use crate::lib::totp::TOTP;
use clap::{App, Arg, ArgMatches, SubCommand};
use rusoto_core::credential::ProfilePr... |
use super::{
config::{Config, Metadata},
env::Env,
ndk,
target::Target,
};
use crate::{
dot_cargo,
target::TargetTrait as _,
templating::{self, Pack},
util::{
self,
cli::{Report, Reportable, TextWrapper},
ln,
},
};
use path_abs::PathOps;
use std::{fs, path::Pa... |
use std::collections::VecDeque;
use std::collections::HashMap;
use std::collections::HashSet;
use std::hash::Hash;
use std::fmt::Debug;
use std::cmp::max;
use std::iter::FromIterator;
pub trait StateGraph<S, V>
where S: Copy {
fn insert(&mut self, state: S);
fn contains(&self, state: &S) -> bool;
fn c... |
use gl;
use gl_api::{
buffer::{Buffer, BufferTarget},
layout::Layout,
limits::Limits,
shader::program::Program,
vertex_array::VertexArray,
BufferIndex, PrimitiveType,
};
use glutin::GlWindow;
use std::{
any::{Any, TypeId},
cell::{Cell, RefCell},
collections::HashMap,
marker::Phan... |
#![warn(clippy::cargo)]
#![warn(clippy::pedantic)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::multiple_crate_versions)]
#![allow(clippy::must_use_candidate)]
use anyhow::{anyhow, Result};
use glutin_window::GlutinWindow;
use graphics::color::{BLACK, WHITE};
use graphics::line;
use graphics::rectangle;
use ... |
use std::collections::HashMap;
#[aoc_generator(day3)]
fn parse_input(input: &str) -> Vec<Vec<u8>> {
let mut output: Vec<Vec<u8>> = vec![];
for line in input.lines() {
let line = line.trim();
if line.is_empty() {
continue;
}
let vals = line.chars().map(|x| x.to_digit(... |
use std::io::{self,Write};
use std::{ptr,slice,str};
use std::error::Error;
use std::fmt::{self,Display};
use std::ffi::CString;
use std::fs::{self,File};
use std::path::Path;
use std::collections::HashMap;
use libc;
use nix;
#[derive(Debug)]
pub enum LogHandleError {
Utf8(str::Utf8Error),
Syscall(i32, String... |
use super::{collect_def_sites, collect_use_sites, hit_test, Doc, LangService, TPos16, TRange};
use crate::{
cps::*,
front::name_resolution::NameSymbol,
lang_service::{
doc_analysis::*,
lang_service::{loc_to_range, to_range16},
},
parse::*,
scope::lexical_referent::LexicalReferent... |
//! All supported metric definitions and unit/register associations.
//!
//! All read functions, e.g. [`Metriful::read()`](fn@crate::Metriful::read), only accept a single metric
//! definition. To read multiple metrics at once, instead use one of the
//! "combined read" pseudo-metrics:
//! * [`struct@METRIC_COMBINED_A... |
// Copyright 2014 <NAME> (IRCAM)
// 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 in wri... |
// Copyright 2020 Google LLC
//
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
// The main part of the FFT computation (before taking the least significant
// digit) corresponds to a linear operation Pv, where P is the nxn matrix
// with the repeating patterns on the rows.
// P has O(n^2) non-zero elements, but the 'derivative' of the pattern has
// only O(n log(n)) non-zero elements. This can be... |
use futures_util::future::TryFutureExt;
use lazy_static::lazy_static;
use rustls::{ClientConfig, OwnedTrustAnchor};
use rustls_pemfile::{certs, rsa_private_keys};
use std::convert::TryFrom;
use std::io::{BufReader, Cursor, ErrorKind};
use std::net::SocketAddr;
use std::sync::mpsc::channel;
use std::sync::Arc;
use std::... |
use std::collections::{HashMap, HashSet};
use std::io;
use std::{cell::RefCell, net::SocketAddr, usize};
use crypto::{digest::Digest, sha2::Sha256};
use mio::{net::TcpListener, unix::UnixReady, Events, Poll, PollOpt, Ready, Token};
use pool::DcPool;
use pump::Pump;
use slab::Slab;
const MAX_PUMPS: usize = 1024 * 1024... |
use std::fmt::Debug;
use std::fs::File;
use std::io::{BufWriter, Write};
use hashbrown::{HashMap};
use crate::lang::{GraphNode, SemanticModel};
use crate::writers::stream_writer::{StreamClassWriter, WriteMode};
use super::StreamWriter;
use self::temp_object_props::TempObjectProps;
use self::class_writers::track_wit... |
use alloc_crate::alloc::{Allocator, Global};
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll, Waker};
use super::structs::TaskStatus;
use crate::structures::handle_list::NodeHandle;
use crate::structures::HandleList;
/// Possible modes for waiting on a WaitQueue.
#[derive(Debug, Copy, Clo... |
use aoc_2021::input_file;
use std::{cmp::Ordering, fs};
#[derive(Debug, PartialEq)]
enum Payload {
Literal(Vec<u8>),
SubPackets(Vec<Packet>),
}
#[derive(Debug, PartialEq)]
struct Packet {
size: usize,
version: u8,
type_id: u8,
payload: Payload,
}
impl Packet {
fn new(size: usize, version:... |
mod board;
mod event_manager;
mod shuffle;
mod utils;
use event_manager::{EventManager, MouseEvent};
use shuffle::{shuffle, ShiftAction};
use std::cell::RefCell;
use std::collections::VecDeque;
use std::rc::Rc;
use utils::{window, Direction, Point};
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
// When the ... |
/***********************************************************************************************************************
* Copyright (c) 2020 by the authors
*
* Author: <NAME> <<EMAIL>>
* License: Apache License 2.0 / MIT
*********************************************************************************************... |
use crate::field::{CellPos, Field};
use std::collections::{HashMap, HashSet};
pub const MAX_INTEGRATION: i32 = std::i32::MAX / 2; // GRID_SIZE * 10 * 10 * 10;
pub const GRID_SIZE: usize = 8;
pub const GRID_SIZE_MINUS: usize = GRID_SIZE - 1;
pub const CELLS: usize = GRID_SIZE * GRID_SIZE;
#[derive(PartialEq, Debug, ... |
extern crate separator;
use separator::FixedPlaceSeparatable;
use std::io;
use std::fmt;
use super::asset::{Asset,AssetClass};
use super::account::{self, AccountType, Account};
pub struct User {
fname: String,
lname: String,
pub accounts: Vec<Account>,
allocation: Account,
target: Account,
}
impl f... |
use diesel::dsl::now;
use diesel::prelude::*;
use std::borrow::Cow;
use crate::app::App;
use crate::util::CargoResult;
use crate::models::{Crate, CrateOwner, NewEmail, Owner, OwnerKind, Rights};
use crate::schema::{crate_owners, emails, users};
use crate::views::{EncodablePrivateUser, EncodablePublicUser};
/// The m... |
// The Nature of Code
// <NAME>
// http://natureofcode.com
//
// Example 7-1: Wolfram Cellular Automata
// Simple demonstration of a Wolfram 1-dimensional cellular automata
use nannou::prelude::*;
use std::ops::Range;
fn main() {
nannou::app(model).update(update).run();
}
// A Type to manage the CA
struct Ca {
... |
mod function;
mod global;
mod memory;
mod table;
pub use function::*;
pub use global::*;
pub use memory::*;
use std::sync::Arc;
pub use table::*;
use wasmer::{Extern, Instance};
#[allow(non_camel_case_types)]
#[derive(Clone)]
pub struct wasm_extern_t {
// this is how we ensure the instance stays alive
pub(cra... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::collections::HashMap;
use std::io::Write;
use std::sync::Arc;
use fxhash::FxHashMap;
use crate::codegen;
use crate::explorer::Candidate;
use crate::ir;
use crate::model::{self, HwPressure};
use crate::search_space::{DimKind, InstFlag, MemSpace, SearchSpace};
use super::{
ArgMap, ArrayArgument, AsyncCall... |
use crate::id;
use std::ops::Range;
#[cfg(feature = "trace")]
use std::{borrow::Cow, io::Write as _};
//TODO: consider a readable Id that doesn't include the backend
type FileName = String;
pub const FILE_NAME: &str = "trace.ron";
#[cfg(feature = "trace")]
pub(crate) fn new_render_bundle_encoder_descriptor<'a>(
... |
use crate::vec::Vector as _;
use crate::{line_search::*, Status};
use opensrdk_linear_algebra::*;
use std::collections::LinkedList;
/// # Limited memory BFGS
///
/// https://en.wikipedia.org/wiki/Limited-memory_BFGS
///
/// - `memory`: Array length of memory
/// - `delta`: Threshold of the difference between the value... |
use anyhow::Result;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst};
use std::sync::Arc;
use std::thread;
use wasmtime::*;
use wasmtime_wasi::{sync::WasiCtxBuilder, Was... |
// mod color;
use image::{imageops::ColorMap, Pixel, Rgb, RgbImage};
use imageproc::{
contrast::otsu_level,
map::{blue_channel, green_channel, map_colors, red_channel},
};
/// Convert an image to Black, White, and Red.
///
/// The result is still RGB, but only uses three colors.
pub fn to_bwr(mut image: image... |
use azure_core::modify_conditions::IfMatchCondition;
use azure_core::prelude::*;
use azure_core::HttpClient;
use azure_cosmos::prelude::*;
use azure_cosmos::responses::GetDocumentResponse;
use futures::stream::StreamExt;
use std::borrow::Cow;
use std::error::Error;
use std::sync::Arc;
#[macro_use]
extern crate serde_de... |
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum Technique {
DealWithIncrement(i64),
Reverse,
Cut(i64),
}
impl Technique {
const NOOP: Self = Self::Cut(0);
fn apply(&self, pos: i64, deck_size: i64) -> i64 {
match *self {
Technique::DealWithIncrement(incr) => (pos * incr) % dec... |
use ndarray::Array2;
use regex::Regex;
use std::fs;
use std::fs::File;
use std::io::{self, BufRead, Error};
use std::path::Path;
// The output is wrapped in a Result to allow matching on errors
// Returns an Iterator to the Reader of the lines of the file.
#[allow(dead_code)]
fn read_lines<P>(filename: P) -> Result<Ve... |
use crate::math::{Point, Real, Vector};
use crate::shape::{FeatureId, PolygonalFeature, PolygonalFeatureMap, SupportMap};
use crate::utils;
use na::{self, ComplexField, RealField, Unit};
/// A 2D convex polygon.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug)]
pub struct ConvexPol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.