text stringlengths 3.09k 13.9k |
|---|
// Copyright 2017-2021 <NAME> <<EMAIL>>
//
// 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 according... |
#![allow(
clippy::float_cmp,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_precision_loss,
clippy::cast_sign_loss,
clippy::missing_const_for_fn
)]
use std::fmt::{Display, Formatter, Result};
use rand::prelude::SliceRandom;
use rand::rngs::ThreadRng;
use rand::Rng;
... |
#![feature(map_first_last)]
use std::fmt::Debug;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use anyhow::Result;
use clap::Parser;
use futures::Future;
use futures::stream::StreamExt;
use reqwest::{Client, StatusCode};
use slug::slugify;
use tokio::io::AsyncWriteExt;
use tracing::{instrument, Instrument};
use... |
use crate::{
engine::Engine,
graphics::{ RenderQueueKey, compose_render_queue_key },
resources::{ Material, MaterialHandle, Mesh, MeshHandle, ResourceManager },
ecs::{ EntityHandle, ComponentStorage, Component, SceneHandle, DeferredUpdateComponentRequest, DeferredUpdateManagerPointer, DeferredUpdateCom... |
use config::StorageConfig;
use models::MessageResponse;
use tokio::fs;
use std::{
panic,
path::{Path, PathBuf},
};
use actix_web::{
dev::{ServiceRequest, ServiceResponse},
http::StatusCode,
middleware::Logger,
web::{self, Data},
App, HttpRequest, HttpServer,
};
use actix_files::{Files, Na... |
use anyhow::Result;
extern crate clap;
use clap::{App, Arg, SubCommand};
extern crate clipboard;
extern crate rpassword;
#[allow(unused_imports)]
use ctap_hid_fido2::util;
use ctap_hid_fido2::{str_buf, Cfg};
mod bio;
mod common;
mod cred;
mod info;
mod memo;
mod pin;
use once_cell::sync::Lazy;
static CFG: Lazy<Cfg... |
use clap::{App, Arg};
use libavif_sys::{
avifDecoderCreate, avifDecoderRead, avifImage, avifImageCreateEmpty, avifImageYUVToRGB,
avifROData, AVIF_RESULT_OK,
};
use std::{
convert::TryFrom,
fs::File,
io::{self, BufWriter, Read},
path::Path,
ptr,
};
fn main() {
let matches = App::new("dav... |
use crate::input::Input;
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet, VecDeque};
const DIRECTIONS: [(i32, i32); 4] = [(0, 1), (0, -1), (-1, 0), (1, 0)];
struct Maze {
cols: usize,
array: Vec<u8>,
portals: HashMap<(i32, i32), ((i32, i32), i32)>,
start_location: (i32, ... |
use errors::{MelodyErrors, MelodyErrorsKind};
use rand::{seq::SliceRandom, thread_rng};
use rodio;
use song::{Playlist, Song};
use std::fmt;
use std::fs::File;
use std::io::{BufReader, Write};
use tabwriter::TabWriter;
use utils::fmt_duration;
/// Music Player Status
/// Showing the status of the Music player
#[derive... |
use ::chain::block::Block;
use ::chain::transaction::{Transaction, TransactionType};
use crypto_rs::el_gamal::ciphertext::CipherText;
use crypto_rs::el_gamal::additive::Operate;
use crypto_rs::el_gamal::encryption::{PublicKey, encrypt};
use crypto_rs::arithmetic::mod_int::ModInt;
use num::Zero;
use std::collections::Ha... |
use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::fmt::Debug;
use std::ops::Add;
/// グラフの辺を表すトレイトです。
pub trait Edge<T> {
fn from(&self) -> usize;
fn to(&self) -> usize;
/// 始点から [`from`] までの距離 `d` を受け取り、この辺を辿って [`to`] へ行く最短距離を求めます。[`dijkstra`] が正しく動くように、この関数は次の条件を満たように実装してください。[参考情報](https:... |
use bevy::prelude::{EventReader, Local, Res, ResMut};
use bevy_egui::{egui, EguiContext};
use rose_game_common::messages::client::ClientMessage;
use crate::{events::ChatboxEvent, resources::GameConnection};
#[derive(Default)]
pub struct UiStateChatbox {
textbox_text: String,
textbox_history: Vec<(egui::Color... |
use crate::compression;
use crate::Error;
use crate::resource::*;
use rusqlite::{Connection, DatabaseName};
use rusqlite::blob::Blob;
use rusqlite::types::ToSql;
use std::io::{self, Read};
use std::path::Path;
// Schema for the SQLite database.
const SCHEMA: &'static str = "
CREATE TABLE resources (
path ... |
//! Ad-hoc CAN-FD implementation, used only for sending Daredevil data frames of 64B.
//!
//! Arbitration/nominal phase parameters:
//! - 500 kbit/s, 80.0%,
//! - `sjw`: 16,
//! - `tseg1`: 63,
//! - `tseg2`: 16.
//!
//! Data phase parameters:
//! - 2000 kbit/s, 80.0%,
//! - `sjw`: 4,
//! - `tseg1`: 15,
//! - `tseg2`: 4... |
//! gst-pai-streamer
//!
//! The purpose if this crate is to implement the ``periscopai`` sequencer.
//! The sequencer is responsible for creating the gstreamer pipeline, installing
//! the appropriate callbacks for messages and managing the pipeline state.
//!
//! It is meant to be a simple interface to gstreamer, imp... |
// Copyright 2018 ETH Zurich. All rights reserved.
//
// 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
//... |
//LCOAL IMPORTS
use crate::messages::messages::*;
use crate::user::comms::*;
// DEPENDENCIES
use uuid::Uuid;
use std::time;
use sys_info;
use std::env::consts::ARCH;
use whoami;
use std::process;
use serde_json;
use serde::{Deserialize, Serialize};
use std::fs;
use std::process::Command;
use std::str;
use std::io::{s... |
/*!
* A rust library for interacting with the RevAI API.
*
* For more information, you can check out their documentation at:
* https://www.rev.ai/docs
*
* Example:
*
* ```
* use revai::RevAI;
* use serde::{Deserialize, Serialize};
*
* async fn geocode() {
* // Initialize the RevAI client.
* let re... |
use arrayvec::ArrayString;
use chrono::NaiveTime;
use nom::bytes::complete::is_not;
use nom::character::complete::char;
use nom::combinator::{map_res, opt};
use nom::number::complete::float;
use crate::parse::NmeaSentence;
use crate::sentences::utils::{parse_hms, parse_lat_lon};
use crate::NmeaError;
const MAX_LEN: u... |
use std::{collections::HashMap, fmt::Display};
use egg::{RecExpr, Runner};
use crate::{
cost::{cost_average, cost_differential},
eqsat::{self, do_eqsat},
external::{external_rules, retain_cost_effective_rules},
handwritten::{self, handwritten_rules},
opts::{self, SplitPhase},
scheduler::Loggin... |
use crate::command;
use alvr_filesystem as afs;
use std::{error::Error, fs};
pub fn choco_install(package: &str) -> Result<(), Box<dyn Error>> {
command::run_without_shell(
"powershell",
&[
"Start-Process",
"choco",
"-ArgumentList",
&format!("\"instal... |
pub mod error;
use ::std::{env, error::Error as StdError, fmt::{Debug, Display}, path::{Path, PathBuf}, rc::Rc, result::Result as StdResult};
use ::log::{debug, error};
use ::gtk::Builder;
use super::render;
pub use error::Error;
pub type Result<T> = std::result::Result<T, Box<dyn StdError>>;
pub fn get_exe_dir() ->... |
use crate::*;
use nanoserde::{DeBin, SerBin};
use std::{collections::HashSet, iter::successors};
#[derive(Debug, Copy, Clone, SerBin, DeBin)]
pub struct Range {
pub direction: Direction,
pub steps: u8,
pub jumps: bool,
pub include_self: bool,
}
#[derive(Debug, PartialEq, Copy, Clone, SerBin, DeBin)]
p... |
use std::{
cell::RefCell,
marker::PhantomData,
rc::Rc,
sync::atomic::{AtomicUsize, Ordering},
};
use crate::CharRange;
//----------------------------------------------------------------------------//
// DFA
//----------------------------------------------------------------------------//
/// A simple Deterministi... |
use crate::inputcontroller::InputController;
use katla_math::{Mat4, Vec3};
use std::{cell::RefCell, rc::Rc};
use winit::event::Event;
use winit::event::{DeviceEvent, ElementState, MouseButton, WindowEvent};
pub struct PerspectiveProjection {
fov: f32,
near_plane: f32,
far_plane: f32,
matrix: Mat4,
}
i... |
pub(super) fn run() -> Result<(), super::Error> {
let mut states_x = vec![];
let mut states_y = vec![];
let mut states_z = vec![];
for line in super::read_input_lines::<String>("day12")? {
let line = line?;
let line = &line[1..(line.len() - 1)];
let mut parts = line.split(", ");
let x = parts.next().ok_or... |
use crate::{
level::Level, pixie::PIXIE_COLORS, save::BestScores, GameState, Handles, UI_GREY_RED_COLOR,
};
use bevy::prelude::*;
pub struct LevelSelectPlugin;
#[derive(Component)]
pub struct LevelSelectScreen;
#[derive(Component)]
pub struct LevelSelectButton(u32);
impl Plugin for LevelSelectPlugin {
fn buil... |
// Copyright (c) 2018-2019 Parity Technologies (UK) Ltd.
//
// Licensed under the Apache License, Version 2.0 or MIT license, at your option.
//
// A copy of the Apache License, Version 2.0 is included in the software as
// LICENSE-APACHE and a copy of the MIT license is included in the software
// as LICENSE-MIT. You ... |
extern crate kerlab;
extern crate clap;
use std::fs;
use clap::{App, Arg};
use kerlab::krbap::ApReq;
use kerlab::asn1::{from_ber, GeneralString, to_der};
use kerlab::krbcred::{KrbCred, EncKrbCredPart};
use kerlab::encryption::{KeyUsage, EncryptionKey};
use kerlab::authenticator::Authenticator;
use kerlab::base::{Princ... |
#![warn(clippy::pedantic)]
const VERSION: &str = env!("CARGO_PKG_VERSION");
mod suki;
#[derive(PartialEq)]
enum Flags {
Debug,
Recursive,
}
fn main() -> Result<(), String> {
let args: Vec<String> = std::env::args().collect();
if args.len() < 2 {
print_help();
return Ok(());
}
... |
use syntax::{ast, abi, ast_util, codemap};
use syntax::ptr::P;
use syntax::ext::base;
use syntax::parse::token;
use syntax::ext::build::AstBuilder;
use test::Test;
use bench::Bench;
use describe::{DescribeState, SubBlock};
/// Trait meaning something can be turned into an ast::Item with configuration.
pub trait Gen... |
// Copyright 2018-2021 <NAME>.
// See the "LICENSE.txt" file at the top-level directory of this distribution.
//
// Licensed under the the MIT license. This file may not be copied, modified,
// or distributed except according to those terms.
use std::collections::HashSet;
use std::ffi::OsStr;
use std::path::{Path, Pat... |
//! Principals
//!
//! Types and definitions in this module are used to describe Veracruz
//! principals, namely their identities and capabilities.
//!
//! ## Authors
//!
//! The Veracruz Development Team.
//!
//! ## Licensing and copyright notice
//!
//! See the `LICENSE.markdown` file in the Veracruz root directory f... |
use crate::proto::{worker_client::WorkerClient, RegisterClientRequest};
use crate::Error;
use crate::{
config,
services::{
discovery::{resolve_all, Node},
ClientInfo, Group, Service,
},
};
use config::store::Store;
use log::{debug, trace};
use rand::{seq::IteratorRandom, thread_rng};
use to... |
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::cell::RefCell;
use std::rc::Rc;
#[derive(PartialEq)]
enum Side {
Top,
Left,
Right,
Bottom,
None,
}
#[derive(Clone, Eq, PartialEq)]
struct Piece {
top: Option<PieceRef>,
left: Option<PieceRef>,
right: Option<PieceRef>,
botto... |
//! Koleksi query yang digunakan untuk operasi pada rest API District
#![allow(missing_docs)]
use actix_web::{HttpRequest, HttpResponse};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use validator::Validate;
use crate::{
api,
api::types::*,
api::{erro... |
//! Main module that is responsible of the interactions with the user,
//! TODO: Move some of the functions of this file to another modules
use std::fmt;
use std::io;
use std::path::{Path, PathBuf};
use clap::{App, Arg};
use rayon::prelude::*;
use walkdir::{DirEntry, WalkDir};
mod parser;
use parser::parse_file;
///... |
use eframe::{
egui::{self, FontDefinitions, FontFamily, Sense, TextStyle, TextureId},
epi,
};
use egui_extras_lib::{
asynchron::{Futurized, Progress},
Image,
};
struct MyApp {
name: String,
age: u32,
counter: u32,
raw_image: (TextureId, (f32, f32)),
image_loader: Option<Futurized<()... |
use std::{borrow::Cow, io, path::PathBuf};
use anyhow::bail;
use git_repository as git;
use git_repository::{prelude::ObjectIdExt, Tree};
use crate::OutputFormat;
mod entries {
use std::collections::VecDeque;
use git::{
bstr::{BStr, BString},
objs::tree::EntryRef,
traverse::tree::vis... |
// Copyright 2020 <NAME>
//
// 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 writing, ... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#![recursion_limit = "512"]
use {
anyhow::Error,
fidl::endpoints::{create_proxy, Proxy, RequestStream, ServiceMarker},
fidl_fuchsia_hardware_i... |
use base64::encode;
use mime::Mime;
use nu_errors::ShellError;
use nu_protocol::{CallInfo, CommandAction, ReturnSuccess, ReturnValue, UntaggedValue, Value};
use nu_source::{AnchorLocation, Span, Tag};
use std::path::PathBuf;
use std::str::FromStr;
use surf::mime;
#[derive(Default)]
pub struct Fetch {
pub path: Opt... |
// Copyright 2019 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// This file is part of Substrate.
// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... |
use std::path::PathBuf;
use std::str::FromStr;
use anyhow::bail;
use anyhow::Result;
use structopt::StructOpt;
/// A StructOpt example
#[derive(StructOpt, Debug)]
#[structopt(about = "A cryptographic token key lister")]
#[rustfmt::skip]
pub struct Opt {
#[structopt(parse(try_from_str = parse_server), help = "Serv... |
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0
use evm::{
backend::{Apply, ApplyBackend, Basic, MemoryAccount, MemoryBackend, MemoryVicinity},
executor::stack::{MemoryStackState, StackExecutor, StackSubstateMetadata},
Config, Contex... |
use std::path::Path;
use crate::ast::ProtoModel;
use crate::internal::*;
pub fn stdlib() -> Vec<FragmentDef> {
crate::ast::parse::parse_fragments(include_str!("../stdlib.nnef")).unwrap()
}
pub struct Nnef {
pub stdlib: Vec<FragmentDef>,
pub registries: Vec<Registry>,
}
impl Nnef {
pub fn new() -> Nn... |
//! Endpoints for logging in users.
use std::convert::TryFrom;
use std::error::Error;
use std::fmt::{Formatter, Result as FmtResult};
use bodyparser;
use iron::{status, Chain, Handler, IronResult, Plugin, Request, Response};
use ruma_identifiers::UserId;
use serde::de::{Deserialize, Deserializer, Error as SerdeError,... |
use crate::prelude::*;
use nu_engine::{evaluate_baseline_expr, WholeStreamCommand};
use nu_errors::ShellError;
use nu_protocol::{
dataframe::{Column, NuDataFrame},
hir::{CapturedBlock, ClassifiedCommand, Expression, Literal, Operator, SpannedExpression},
Primitive, Signature, SyntaxShape, UnspannedPathMembe... |
//! # Actix is a rust actors framework
//!
//! [Actors](https://actix.github.io/actix/actix/trait.Actor.html) are
//! objects which encapsulate state and behavior, they communicate
//! exclusively by exchanging messages. Actix actors are implemented
//! on top of [Tokio](https://tokio.rs). Multiple actors can run in
/... |
use itertools::Itertools;
use aoc_2021::shared::{Day, read_input_lines_preserving_empty};
fn main() {
Day4::new(read_input_lines_preserving_empty(4)).run()
}
struct Day4 {
numbers: Vec<usize>,
boards: Vec<Board>,
}
#[derive(Clone)]
struct Board {
cells: Vec<Cell>,
resolved: bool,
}
#[derive(Clo... |
use crate::bounding_volume::AABB;
use crate::math::{Isometry, Point, Real};
use crate::partitioning::SimdQuadTree;
use crate::shape::composite_shape::SimdCompositeShape;
#[cfg(feature = "dim3")]
use crate::shape::{Cuboid, HeightField};
use crate::shape::{Shape, Triangle, TypedSimdCompositeShape};
#[derive(Clone)]
#[cf... |
mod common;
use renderer::draw::png_writer::rgb_triples_to_png;
use renderer::draw::tile_pixels::{RgbTriples, TilePixels};
use renderer::mapcss::parser::parse_file;
use renderer::mapcss::styler::{StyleType, Styler};
use std::collections::BTreeMap;
use std::fs::File;
use std::io::Write;
use std::path::Path;
const RED_... |
use prototty::*;
use decorated::Decorated;
use defaults::*;
/// The characters comprising a border. By default, borders are made of unicode
/// box-drawing characters, but they can be changed to arbitrary characters via
/// this struct.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BorderChars {
pub t... |
use std::env;
use std::process;
use std::error::Error;
use std::fs;
struct Config {
day: String,
filename: String,
}
impl Config {
fn new (mut args: env::Args) -> Result<Config, &'static str> {
args.next();
let day = match args.next() {
Some(arg) => arg,
None => re... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use aws_smithy_json::deserialize::token::skip_value;
use aws_smithy_json::deserialize::{json_token_iter, Error as Deserial... |
#![cfg_attr(test, feature(test))]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::cognitive_complexity)]
mod config;
mod exit_dialogue;
mod messaging;
// FIXME: This is "pub" to be able to use in an example
#[doc(hidden)]
pub mod msg_area;
mod notifier;
mod statusline;
mod tab;
mod termbox;
mod text_field;
mod ... |
use crate::*;
pub fn parse_rule_invokation(state: &mut asm::parser::State)
-> Result<(), ()>
{
let mut subparser = state.parser.slice_until_linebreak();
subparser.suppress_reports();
let candidates = match_active_rulesets(state, &mut subparser)?;
if candidates.len() != 0
{
let mut inv... |
use std::{
cmp::Ordering,
collections::{BinaryHeap, BTreeMap},
fs::File,
io::{self, prelude::*, BufReader},
path::PathBuf,
};
use dirs::home_dir;
use regex::Regex;
use crate::opts::HistoryFlavor;
/// CtNode are post-processed partial/full commands with an associated non-specific count
#[derive(E... |
use std::collections::HashMap;
use jpar::branch::alternative;
use jpar::characters::{
read_any, read_any_quantified, read_char, read_none_of, read_text, ucd_whitespace0,
};
use jpar::combinator::verify;
use jpar::helpers::{and_then, map_result};
use jpar::numbers::read_float;
use jpar::sequence::{delimited, preced... |
// font-kit/src/sources/fs.rs
//
// Copyright © 2018 The Pathfinder 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 b... |
mod build;
mod delete;
mod errors;
mod options;
mod prep;
mod serve;
use crate::delete::delete_dist_dir;
use crate::delete::delete_tribble_dir;
use crate::errors::*;
use crate::options::*;
use crate::prep::prep;
use clap::Parser;
use fmterr::fmt_err;
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
use s... |
use std::cell::RefCell;
use std::iter;
use std::rc::Rc;
use util::{MIN_MATCH, WINDOW_MASK};
pub struct Hash {
/// Hash value to index of its most recent occurrence.
pub head: Rc<RefCell<[i32; 65536]>>,
/// Index to index of prev. occurrence of same hash.
/// If prev[j] == j, then prev[j] is uninitiali... |
//! # Haystack
//!
//! Search through unknown YAML for specific data shapes using the visitor pattern.
//!
//! Currently only visits [`Mapping`][serde_yaml_mapping] types given a filter-map function.
//!
//! ## Examples
//!
//! ```rust
//! let YAML = r#"
//! a: "foo"
//! nested:
//! - name: a
//! - name: b
//! "#;
... |
//! [Problem 93](https://projecteuler.net/problem=93) solver.
#![warn(bad_style,
unused, unused_extern_crates, unused_import_braces,
unused_qualifications, unused_results)]
#![feature(iter_cmp)]
#[macro_use(problem)]
extern crate common;
extern crate iter;
extern crate num;
use iter::{BitCombination... |
use std::{
error::Error,
fmt,
fs::File,
io::{BufRead, BufReader},
path::PathBuf,
};
use ahash::AHashSet;
#[derive(Debug)]
struct ParseCoordsError(&'static str);
impl fmt::Display for ParseCoordsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Parse error: ... |
// Built-in uses
use std::fmt;
// External uses
use async_trait::async_trait;
use num::BigUint;
use rand::{thread_rng, Rng};
use serde::{Deserialize, Serialize};
// Workspace uses
use zksync::utils::closest_packable_token_amount;
use zksync_types::{tx::PackedEthSignature, TokenLike, ZkSyncTx};
// Local uses
use super::... |
// 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 {
argh::FromArgs,
async_trait::async_trait,
diagnostics_data::Severity,
fidl_fuchsia_test_manager::{RunBuilderMarker, RunBuilderProxy},... |
use crate::fields::Universe;
pub fn play(pos1 :&mut u32,pos2 :&mut u32) -> u32 {
let mut score1 = 0;
let mut score2 = 0;
let mut dice = 1;
let mut rolled = 0;
loop {
//tree time
let m1 = dice + (dice + 1) + (dice + 2);
dice = (dice + 3 -1) % 100 + 1;
rolled += 3... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! This file contains the code necessary to interface with the compiler backend
use crate::codegen_cprover_gotoc::GotocCtx;
use bitflags::_core::any::Any;
use cbmc::goto_program::symtab_transformer;
us... |
mod utils;
extern crate nalgebra as na;
extern crate wasm_bindgen_futures;
use na::{DVector, DMatrix};
// use serde::{Serialize, Deserialize};
use std::cmp::max;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[glob... |
//! FileSystem wrapper to navigate safely around the children of a root
//! directory.
//!
//! The `ScopedFileSystem` provides read capabilities on a single directory
//! and its children, either files and directories will be accessed by this
//! `ScopedFileSystem` instance.
//!
//! The `Entry` is a wrapper on OS file ... |
//! AWS Nitro-Enclaves-specific material for the Runtime Manager enclave
//!
//! ## Authors
//!
//! The Veracruz Development Team.
//!
//! ## Licensing and copyright notice
//!
//! See the `LICENSE_MIT.markdown` file in the Veracruz root directory for
//! information on licensing and copyright.
use io_utils::raw_fd::{... |
#![no_std]
#![no_main]
use embedded_graphics as eg;
use panic_halt as _;
use wio_terminal as wio;
use wio::hal::clock::GenericClockController;
use wio::hal::delay::Delay;
use wio::pac::{CorePeripherals, Peripherals};
use wio::prelude::*;
use wio::wifi_prelude::*;
use wio::wifi_rpcs as rpc;
use wio::{entry, wifi_singl... |
use crate::{
HashEngine,
KeyBasedHashEngine
};
use std::{
marker::PhantomData,
convert::TryInto
};
pub struct PBKDF2<T: KeyBasedHashEngine> {
hash: PhantomData<T>,
password: Vec<u8>,
salt: Vec<u8>,
iter: usize
}
impl<T: KeyBasedHashEngine> PBKDF2<T> {
/// Set how many iterations wi... |
use crate::memory::ram::Ram;
use crate::memory::region::MemoryRegion;
use super::ioregs::IoRegs;
#[derive(Debug, Clone)]
pub struct MemoryMap {
// Temporarily model everything with the Ram struct
cartridge: Ram,
vram: Ram,
eram: Ram,
iram: Ram,
iram_echo: Ram,
sprite_attrs: Ram,
io_reg... |
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be ... |
#![allow(dead_code, clippy::borrow_as_ptr)]
extern crate core;
use std::mem::transmute as my_transmute;
use std::vec::Vec as MyVec;
fn my_int() -> Usize {
Usize(42)
}
fn my_vec() -> MyVec<i32> {
vec![]
}
#[allow(clippy::needless_lifetimes, clippy::transmute_ptr_to_ptr)]
#[warn(clippy::useless_transmute)]
u... |
#![warn(missing_docs)]
//! ScriptX is a command line tool designed to extract scriptures out of the American Sign Language version of the [New World Translation](https://www.jw.org/ase/library/bible/nwt/books/), NWT, Bible published by the [Watch Tower Bible and Tract Society of Pennsylvania](https://www.JW.org). It i... |
use core::fmt;
use std::{convert::TryFrom, num::ParseIntError, ops::Deref, str::FromStr};
use byte_unit::{Byte, ByteError};
use clap::Parser;
use milli::update::IndexerConfig;
use serde::Serialize;
use sysinfo::{RefreshKind, System, SystemExt};
#[derive(Debug, Clone, Parser, Serialize)]
pub struct IndexerOpts {
/... |
// Copyright 2020 The Exonum Team
//
// 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 i... |
use bytemuck::*;
use nalgebra_glm as glm;
use wgpu::util::DeviceExt;
use wgpu::*;
use winit;
use crate::*;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CameraUbo {
pub projection: glm::Mat4,
pub view: glm::Mat4,
pub projection_view: glm::Mat4,
pub position: glm::Vec4,
}
impl CameraUbo {
pu... |
//! JSON generation
use {items, utils};
use serde_json;
use std::{io};
use std;
/// The result type for JSON errors.
pub type JsonResult<T> = std::result::Result<T, JsonError>;
/// Errors that may occur during JSON operations.
#[derive(Debug)]
pub enum JsonError {
FailedToCreateDirectory(io::Error),
FailedToCreat... |
use super::*;
use abscissa::Callable;
use signatory::ed25519;
use std::{fs, path::PathBuf, process};
use subtle_encoding::base64;
use tendermint::public_keys::ConsensusKey;
use yubihsm::object;
/// The `yubihsm keys import` subcommand
#[derive(Debug, Default, Options)]
pub struct ImportCommand {
/// Path to config... |
#[cfg(feature = "serde")]
use serde_crate::{Deserialize, Serialize};
use linfa::{Float, ParamGuard};
use crate::error::ElasticNetError;
use super::Result;
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
/// A verified hyper-parameter set ready for the estim... |
use anyhow::{bail, Result};
use serde::Deserialize;
use std::cmp;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
const VERSION: &str = env!("CARGO_PKG_VERSION");
const USAGE: &str = "
Usage: baokeshed [<inputs>...] [--length=<bytes>] [--key=<hex> | --derive-key=<hex>]
... |
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use sgx_isa::{Attributes, Miscselect};
#[cfg(feature = "sgx")]
use crate::error::Error;
#[cfg(feature = "sgx")]
use rand::random;
#[cfg(feature = "sgx")]
use sgx_isa::Report;
#[cfg(feature = "sgx")]
use sgx_isa::{Keyname, Keypolicy, Keyrequest};
#[cfg(... |
//! This example is primarily for illustrating the
//! project's performance w/o waiting for the current
//! set of benches. It simply pulls down some major
//! JS libraries and attempts to tokenize them with
//! both methods and then reports the size, time and method
//! for each lib.
extern crate ress;
use std::{
... |
use std::cmp;
use std::collections::{BinaryHeap, HashMap, HashSet};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
struct PointDist((usize, usize), u64);
impl Ord for PointDist {
fn cmp(&self, other: &Self) -> cmp::Ordering {
self.1.cmp(&other.1).reverse()
}
}
impl PartialOrd for PointDist {
fn par... |
use std::io::Error as IoError;
use std::net::SocketAddr;
use std::time;
use bytes::BufMut;
use bytes::Bytes;
use bytes::BytesMut;
use futures_lite::future::zip;
use futures_lite::stream::StreamExt;
use futures_util::SinkExt;
use log::debug;
use tokio_util::codec::BytesCodec;
use tokio_util::codec::Framed;
use tokio_ut... |
use grep_matcher::LineTerminator;
use regex_syntax::hir::{self, Hir, HirKind};
use error::{Error, ErrorKind};
/// Return an HIR that is guaranteed to never match the given line terminator,
/// if possible.
///
/// If the transformation isn't possible, then an error is returned.
///
/// In general, if a literal line t... |
use crate::input::Input;
pub fn solve(input: &mut Input) -> Result<u64, String> {
const MAX_FIELD_VALUE: u32 = 1024;
let mut parts = input.text.splitn(3, "\n\n");
let on_error = || "Invalid input".to_string();
let map_error = |_| on_error();
let ticket_fields_str = parts.next().ok_or_else(on_erro... |
use core::fmt;
use std::{
collections::VecDeque,
env,
fs::File,
io::{BufRead, BufReader},
ops::Add,
};
#[derive(Debug, Clone)]
enum Node {
Number(u32),
Pair(Box<Node>, Box<Node>),
}
impl Node {
fn split(&mut self) -> bool {
match self {
Node::Number(d) if *d >= 10 =... |
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use cid::Cid;
use fvm_ipld_hamt::Error as HamtError;
use fvm_shared::address::Address;
use fvm_shared::bigint::bigint_ser::BigIntDe;
use fvm_shared::blockstore::Blockstore;
use fvm_shared::econ::TokenAmount;
use num_traits::{Signed, Z... |
use super::virtual_file_system::{Directory, File, Node};
use super::{consts::*, FstEntry, FstNodeType};
use byteorder::{ByteOrder, BE};
use failure::{Error, ResultExt};
use std::fs;
use std::io::{Read, Result as IOResult};
use std::path::Path;
use std::str;
use wii_crypto::wii_disc::{Partition, Partitions};
pub fn loa... |
use crate::id::OfType;
use crate::Id;
use std::any::Any;
/// Application state when system should run
#[derive(Eq, PartialEq, Debug, Hash, Clone, Copy)]
pub enum Rule {
/// System runs ar any state
Always,
/// System runs at specific state
StateOn(Id<State>),
/// System does not run at specific sta... |
use std::process::Command;
use failure::{self, Context, Fail, ResultExt};
use futures::{future, Future, Stream};
use regex::Regex;
use edgelet_http::client::ClientImpl;
use edgelet_http::MaybeProxyClient;
use crate::check::{checker::Checker, Check, CheckResult};
use crate::error::{Error, ErrorKind, FetchLatestVersio... |
use anyhow::Error;
use bincode;
use chrono::{DateTime, Utc};
use console::{Alignment, pad_str, style};
use path_abs::{FileRead, PathFile};
use serde_json;
use textwrap::{termwidth, Wrapper};
use crate::utils;
/// Stores information about a quote
#[derive(Serialize, Deserialize, Debug)]
pub struct Quote {
/// Quot... |
#[macro_use]
extern crate stdweb;
#[macro_use]
extern crate serde_derive;
extern crate bincode;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::u8::MAX;
use std::i64;
use bincode::{serialize, deserialize};
use stdweb::traits::*;
use stdweb::unstable::TryInto;
use stdweb::... |
use std::io::Write;
use std::path::PathBuf;
use std::{
collections::HashSet,
io::{BufRead, BufReader},
path::Path,
process::{Child, Command, Stdio},
};
use anyhow::{Context, Result};
use clap::Parser;
use pewter_core::{
io::fen::{format_fen, parse_fen},
Move, State,
};
fn parse_stockfish_perf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.