text stringlengths 3.35k 22.8k |
|---|
//! A basic model of the Linux Operating System.
use crate::error::*;
use crate::executor::Memory;
use crate::platform::linux::{Constants, FileSystem, Whence};
use falcon::il;
use falcon::loader::{ElfLinker, Loader};
use falcon::memory::MemoryPermissions;
use log::trace;
use std::path::PathBuf;
const BRK_MAX_SIZE: u6... |
use anyhow::{format_err, Error};
use bytes::BytesMut;
use lazy_static::lazy_static;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use stack_string::StackString;
use std::{collections::HashMap, convert::TryFrom, fmt, str::FromStr};
use tokio_postgres::types::{FromSql, IsNull, ToSql, Type};
lazy_static!... |
use fraction::ToPrimitive;
use crate::{io::*, gp::*};
//MIDI channels
pub const CHANNEL_DEFAULT_NAMES: [&str; 128] = ["Piano", "Bright Piano", "Electric Grand", "Honky Tonk Piano", "Electric Piano 1", "Electric Piano 2",
"Harpsichord", "Clavinet", "Celesta",
... |
use crate::instructions::Opcode;
use super::assembler::{
program_parser::*,
assembler_errors::AssemblerError,
instruction_parser::AssemblerInstruction,
symbols::*,
};
pub mod opcode_parser;
pub mod register_parsers;
pub mod operand_parser;
pub mod instruction_parser;
pub mod program_parser;
pub mod dir... |
//! Parsing, validation and generation of mathematical expressions.
mod codegen_jit;
mod lexer;
mod prec_parser;
pub use lexer::{Lexer, Token, TokenState};
pub use prec_parser::Parser;
use crate::{base::Function, Symbol, Tree};
use std::any;
use std::collections::HashMap;
use std::error;
use std::fmt;
/// An [`Ast... |
use std::collections::HashMap;
fn main() {
println!("Hello, collections!");
let mut v: Vec<i32> = Vec::new();
v.push(5);
println!("v: {:#?}", v);
let v_int = vec![1, 2, 3];
let mut v_uint: Vec<u8> = vec![4, 5, 6];
let nine = String::from("nine");
let mut v_str = Vec::from(["seven".to_st... |
//! Fill Apache Arrow arrays from ODBC data sources.
//!
//! ## Usage
//!
//! ```no_run
//! use arrow_odbc::{odbc_api::Environment, OdbcReader};
//!
//! const CONNECTION_STRING: &str = "\
//! Driver={ODBC Driver 17 for SQL Server};\
//! Server=localhost;\
//! UID=SA;\
//! PWD=<PASSWORD>;\
//! ";
//!
//!... |
// TODO: /cpu/procinfo quirks
// * Intel usually puts an @ with the frequency in `model name`
// * AMD usually puts something like "Eight-Core Processor" in `model name`
// (at least in the Ryzen series)
// * `model nome` is really vague in Raspberry Pis. Getting `Hardware` would
// be a better ... |
mod aarects;
pub mod bhv;
pub mod camera;
pub mod hittable;
pub mod image_texture;
pub mod materials;
pub mod raytrace;
pub mod rngator;
pub mod shapes;
pub mod textures;
pub mod transforms;
pub mod vec;
pub mod volumes;
pub mod worlds;
use camera::Camera;
use clap::{App, Arg, ArgMatches};
use raytrace::{RecursiveRayT... |
//! This crate provides an (optionally parallelizable)
//! marching squares algorithm to generate isolines from
//! a heightmap of `Vec<Vec<i16>>` values.
//!
//! Adapted from [https://github.com/d-dorazio/marching-squares](https://github.com/d-dorazio/marching-squares)
//!
//! # Warning
//!
//! - The returned lines ma... |
//! Encodes/decodes base58 encoded XRP Ledger identifiers
//!
//! Functions for encoding and decoding XRP Ledger addresses and seeds.
//!
//! # Examples
//!
//! See [Functions][crate#functions] section
#![deny(
warnings,
clippy::all,
missing_debug_implementations,
missing_copy_implementations,
miss... |
extern crate ctrlc;
#[macro_use]
extern crate clap;
extern crate nix;
use std::io::{self, Write};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::{thread, time};
use clap::{App, AppSettings, Arg};
use nix::unistd;
#[derive(Debug, PartialEq)]
enum LucidError {
DurationParseError,
... |
// This file is part of the uutils coreutils package.
//
// (c) <NAME> <<EMAIL>>
// (c) <NAME> <<EMAIL> AT <EMAIL>>
//
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.
// spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMD... |
//! Navigator backend for web
use js_sys::{Array, ArrayBuffer, Uint8Array};
use ruffle_core::backend::navigator::{
url_from_relative_url, NavigationMethod, NavigatorBackend, OwnedFuture, RequestOptions,
};
use ruffle_core::indexmap::IndexMap;
use ruffle_core::loader::Error;
use std::borrow::Cow;
use std::time::Dura... |
use futures::channel::mpsc;
use futures::executor::block_on;
use futures::future::Future;
use futures::sink::SinkExt;
use futures::stream::StreamExt;
use futures::task::{Context, Poll};
use std::pin::Pin;
use std::sync::{Arc, Weak};
use std::thread;
use std::time::{Duration, Instant};
#[test]
fn smoke() {
let (mut... |
pub use winit;
pub type LoopType = winit::event_loop::EventLoop<()>;
use winit::event::{VirtualKeyCode, MouseButton, Event};
use math::glm;
use crate::InputState::{Pressed, Released};
const MAX_MOUSE_BUTTONS: usize = 256;
const MAX_KEY_BUTTONS: usize = 512;
pub type Sensitivity = f32;
pub enum Gesture {
NoGest... |
//! This file was generated by "./scripts/generate-terminfo-structs.sh" on Tue Jul 24 20:26:48 EDT 2018.
//! Please do not modify it.
/// Number of booleans expected to be present in the file
pub const PREDEFINED_BOOLEANS_COUNT: usize = 44;
/// Number of numbers expected to be present in the file
pub const PREDEFINED... |
use crate::auth;
use crate::cancellation::{self, CancelMap};
use crate::config::{ProxyConfig, TlsConfig};
use crate::stream::{MetricsStream, PqStream, Stream};
use anyhow::{bail, Context};
use futures::TryFutureExt;
use lazy_static::lazy_static;
use std::sync::Arc;
use tokio::io::{AsyncRead, AsyncWrite};
use zenith_met... |
//! Implementation of the `wasm-pack test` command.
use super::build::BuildMode;
use bindgen;
use build;
use command::utils::set_crate_path;
use console::style;
use emoji;
use failure::Error;
use indicatif::HumanDuration;
use lockfile::Lockfile;
use manifest;
use progressbar::Step;
use slog::Logger;
use std::path::Pat... |
//! Expressions
//!
//! See: [6.4 Expressions](http://erlang.org/doc/apps/erts/absform.html#id87350)
use ast;
use ast::clause;
use ast::common;
use ast::literal;
use ast::pat;
pub type LocalCall = common::LocalCall<Expression>;
pub type RemoteCall = common::RemoteCall<Expression>;
pub type Match = common::Match<pat::P... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
use core::ops::RangeFrom;
use crypto::keys::slip10::Chain;
use futures::future;
use futures::stream;
use futures::stream::BoxStream;
use futures::StreamExt;
use futures::TryStreamExt;
use hashbrown::HashSet;
use identity_core::convert::FromJson;
use ... |
use crate::{access_token::AccessTokenProvider, error::CommonResponse};
use crate::{wechat::WxApiRequestBuilder, SdkResult, WxSdk};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
pub mod ad;
pub mod cloudbase;
pub mod content_security;
pub mod customer_message;
pub mod datacube;
pub mod img;
pub mod immedia... |
use log::{error, warn};
use std::cmp;
use std::convert::TryInto;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::sync::Mutex;
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
use rayon::prelude::*;
use super::parser;
use super::{Document, Object, ObjectId};
use crate::object... |
use redis::Commands;
use super::model;
use redis_context::RedisContext;
use redis_delta::REvent;
use serde_json;
use std::time::SystemTime;
use uuid::Uuid;
/// Updates redis so that the individual measurement is applied to the correct tank.
/// Also records the measurement to a record associated with the sensor itsel... |
/// Supervise a service.
///
/// The Supervisor is responsible for running any services we are asked to start. It handles
/// spawning the new process, watching for failure, and ensuring the service is either up or
/// down. If the process dies, the Supervisor will restart it.
use super::{terminator,
Proces... |
use crate::ade;
use crate::constants;
use crate::helper;
use crate::helper::read_link;
use crate::mount;
use crate::redhat;
use crate::suse;
use crate::ubuntu;
use cmd_lib;
use std::process;
#[derive(Debug)]
pub struct Distro {
pub boot_part: BootPartDetails,
pub rescue_root: RootPartDetails,
... |
//! Legalize instructions.
//!
//! A legal instruction is one that can be mapped directly to a machine code instruction for the
//! target ISA. The `legalize_function()` function takes as input any function and transforms it
//! into an equivalent function using only legal instructions.
//!
//! The characteristics of l... |
use crate::{
config::MajorChangeConfig,
github::{Event, Issue, IssuesAction, IssuesEvent, Label, ZulipGitHubReference},
handlers::Context,
interactions::ErrorComment,
};
use anyhow::Context as _;
use parser::command::second::SecondCommand;
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum Invocation {
... |
//! Implementation of the SAM4L External Interrupt Controller (EIC).
//!
//! Datasheet section "21. External Interrupt Controller (EIC)".
//!
//! The External Interrupt Controller (EIC) allows pins to be configured as external
//! interrupts. Each external interrupt has its own interrupt request and can be individually... |
use crate::fixt::AgentValidationPkgFixturator;
use crate::fixt::CloseChainFixturator;
use crate::fixt::CreateFixturator;
use crate::fixt::CreateLinkFixturator;
use crate::fixt::DeleteLinkFixturator;
use crate::fixt::DnaFixturator;
use crate::fixt::EntryFixturator;
use crate::fixt::EntryHashFixturator;
use crate::fixt::... |
//! ObjectId
use std::{
convert::TryInto,
error,
fmt,
result,
str::FromStr,
sync::atomic::{AtomicUsize, Ordering},
time::SystemTime,
};
use hex::{self, FromHexError};
use rand::{thread_rng, Rng};
use lazy_static::lazy_static;
const TIMESTAMP_SIZE: usize = 4;
const PROCESS_ID_SIZE: usize ... |
use std::collections::HashMap;
use yaml_rust::{Yaml, YamlEmitter, YamlLoader};
use crate::GeodesyError;
#[derive(Debug, Clone, Default, PartialEq)]
pub struct OperatorArgs {
pub name: String,
pub args: HashMap<String, String>,
pub used: HashMap<String, String>,
pub all_used: HashMap<String, String>,
}... |
//! This module defines a DOM management utilities.
use crate::display::object::traits::*;
use crate::prelude::*;
use web::traits::*;
use crate::display::camera::camera2d::Projection;
use crate::display::camera::Camera2d;
use crate::display::symbol::dom::eps;
use crate::display::symbol::dom::inverse_y_translation;
us... |
//! Area is a [`Ui`] that has no parent, it floats on the background.
//! It has no frame or own size. It is potentially movable.
//! It is the foundation for windows and popups.
use std::{fmt::Debug, hash::Hash};
use crate::*;
/// State that is persisted between frames.
// TODO(emilk): this is not currently stored ... |
use luckier_commit::{HashPrefix, HashSearchWorker, Sha1};
use std::collections::VecDeque;
use std::env;
use std::io::{prelude::*, stdin, BufReader};
use std::process::{Command, Stdio};
fn main() -> std::io::Result<()> {
let args = env::args().collect::<Vec<String>>();
let width = args
.get(1)
... |
use pom::parser::*;
use pom::Error;
use std::io::{stdin, Read};
use std::str;
#[derive(Debug, Clone, Copy)]
struct Bounds {
min_x: usize,
max_x: usize,
min_y: usize,
max_y: usize,
}
impl Bounds {
fn new() -> Bounds {
let min_x = usize::max_value();
let max_x = 0;
let min_y ... |
use crate::ast::{DatatypeTransparency, Field, Mode, Param, ParamX, Path, Typ, TypX};
use crate::ast_util::is_visible_to_of_owner;
use crate::context::Ctx;
use crate::def::{
prefix_box, prefix_type_id, prefix_unbox, suffix_local_stmt_id, variant_field_ident,
variant_ident, Spanned,
};
use crate::func_to_air::{fu... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
//! This file defines transaction store APIs that are related to committed signed transactions.
use crate::{
change_set::ChangeSet,
errors::AptosDbError,
schema::{
transaction::TransactionSchema, transaction_by_account::TransactionByAcc... |
// Copyright 2016 The Grin Developers
//
// 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... |
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::media_type::MediaType;
use deno_core::error::AnyError;
use deno_core::ModuleSpecifier;
use std::error::Error;
use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
use std::sync::RwLock;
use swc_common::chain;
use swc_common::commen... |
use crate::syntax::atom::Atom::{self, *};
use crate::syntax::{error, ident, Api, ExternFn, Lang, Ref, Slice, Struct, Ty1, Type, Types};
use proc_macro2::{Delimiter, Group, Ident, TokenStream};
use quote::{quote, ToTokens};
use std::fmt::Display;
use syn::{Error, Result};
struct Check<'a> {
apis: &'a [Api],
typ... |
//! `signature_checker` module provides a detached thread routine
//! dedicated for checking the signatures of incoming transactions.
//! Main routine of this module operates a multithreaded event loop,
//! which is used to spawn concurrent tasks to efficiently check the
//! transactions signatures.
// Built-in uses
u... |
use atomic_shim::AtomicU64;
use getopts::Options;
use hdrhistogram::Histogram as HdrHistogram;
use log::{error, info};
use metrics::{
gauge, histogram, increment_counter, register_counter, register_gauge, register_histogram,
Counter, Gauge, Histogram, Key, KeyName, Recorder, Unit,
};
use metrics_util::{Registry... |
use std::env;
fn defined(var: &str) -> bool {
env::var_os(var).is_some()
}
fn target_components() -> Vec<String> {
let target = env::var("TARGET").unwrap();
target.split("-").map(|s| s.to_string()).collect()
}
fn is_x86_64() -> bool {
target_components()[0] == "x86_64"
}
fn is_x86_32() -> bool {
... |
use imgui::*;
// dark theme from codz01 (https://github.com/ocornut/imgui/issues/707)
pub fn set_style_dark(style: &mut ImGuiStyle) {
style.frame_border_size = 1.0;
style.frame_padding = ImVec2::new(4.0,2.0);
style.item_spacing = ImVec2::new(8.0,2.0);
style.window_border_size = 1.0;
//style... |
use super::xkeysyms::keysym_to_keycode;
use super::Error;
use super::{KeyCode, KeyModifiers};
use failure::{ensure, format_err};
use libc;
use log::debug;
use std::cell::RefCell;
use std::ffi::CStr;
use xkb::compose::Status as ComposeStatus;
use xkbcommon::xkb;
pub struct Keyboard {
context: xkb::Context,
keym... |
use std::{
ops::{Add, Div, Mul, Sub},
time::Duration,
};
use anyhow::{bail, Result};
use chrono::naive::NaiveTime;
use crate::{
calculate::{Arithmetic, Calculateable},
compare::{Compareable, Operator},
};
/// Representation of different value types for use in comparisons.
/// Is [Compareable] and [Ca... |
use std::collections::VecDeque;
type Result<T> = std::result::Result<T, Error>;
mod error;
mod instruction;
mod operation;
mod program;
pub use self::error::{Error, ErrorKind};
pub use self::instruction::Instruction;
pub use self::program::Program;
use crate::parser;
use self::operation::Operation;
#[derive(Debug, ... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use common::{FileKey, Location};
use fnv::FnvHashMap;
use graphql_syntax::OperationKind;
use interner::StringKey;
use schema::{Type... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
failure::{Error, ResultExt},
fidl::endpoints::create_endpoints,
fidl_fuchsia_bluetooth_avdtp::*,
fuchsia_async as fasync,
fuchsia... |
use crate::border::BorderBuilder;
use crate::brush::Brush;
use crate::core::color::Color;
use crate::decorator::DecoratorBuilder;
use crate::{
button::ButtonBuilder,
core::pool::Handle,
grid::{Column, GridBuilder, Row},
message::{
ButtonMessage, KeyCode, MessageData, MessageDirection, NumericUpD... |
// Copyright 2014-2015 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-MI... |
use codec::Encode;
use sp_std::prelude::*;
pub fn addr_from_sig(msg: [u8; 32], sig: [u8; 65]) -> Result<[u8; 20], sp_io::EcdsaVerifyError> {
let pubkey = sp_io::crypto::secp256k1_ecdsa_recover(&sig, &msg)?;
let hashed_pk = sp_io::hashing::keccak_256(&pubkey);
let mut addr = [0u8; 20];
addr[..20].copy_from_slice(&... |
use legion::Entity;
use crate::core::components::maths::{coordinates::Coordinates, transform::Transform};
use crate::utils::maths::Vector;
struct RectangleColliderInfo<'a> {
width: &'a usize,
height: &'a usize,
transform: &'a Transform,
offset: &'a Vector
}
impl<'a> RectangleColliderInfo<'a> {
fn... |
use std::collections::{HashMap, HashSet};
use oso::{Oso, PolarClass, PolarValue};
use proctor::elements::{PolicySource, PolicySubscription, QueryPolicy, QueryResult, Telemetry, Timestamp};
use proctor::error::PolicyError;
use proctor::phases::collection::TelemetrySubscription;
use proctor::{ProctorContext, ProctorIdGe... |
use super::error::*;
use super::opengl::*;
use super::offscreen_trait::*;
use flo_render_gl_offscreen::wgl;
use flo_render_gl_offscreen::winapi::um::winuser::{CreateWindowExW, RegisterClassExW, GetDC, DefWindowProcW, DestroyWindow, WNDCLASSEXW, CS_OWNDC, WS_EX_APPWINDOW, WS_OVERLAPPEDWINDOW};
use flo_render_gl_offscre... |
// 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.
mod opts;
use crate::opts::Opt;
use {
anyhow::{bail, format_err, Context as _, Error},
fidl_fuchsia_wlan_device_service::{DeviceServiceMarker, De... |
use std::convert::From;
use std::mem;
use std::str::FromStr;
use gio::{
IOStream, IOStreamExt, InputStreamExtManual, OutputStreamExtManual, SocketClient,
SocketClientExt, SocketConnection, TlsCertificateFlags,
};
use glib::source::PRIORITY_DEFAULT;
use glib::Cast;
use lazy_static::lazy_static;
use relm::{conne... |
use std::collections::HashSet;
use graph::{
components::store::EntityType,
data::graphql::ObjectOrInterface,
prelude::{anyhow, q, r, s, ApiSchema, QueryExecutionError, ValueMap},
};
use graphql_parser::Pos;
use crate::schema::ast::ObjectType;
/// A selection set is a table that maps object types to the f... |
use std::fs;
use std::process::{Command, Stdio};
use crate::error::UptError;
use crate::subcommand::SubCommand;
use crate::task::Task;
mod apk;
mod apt;
mod brew;
mod choco;
mod dnf;
mod pacman;
mod pkgman;
mod scoop;
mod upt;
mod yum;
#[cfg(windows)]
const LINE_ENDING: &str = "\r\n";
#[cfg(not(windows))]
const LINE... |
// 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
// except according to those terms.
#![allow(dead_code)... |
use core::{fmt, result};
#[derive(PartialEq, Eq)]
pub struct Error {
pub err_num: i32,
}
pub type Result<T, E = Error> = result::Result<T, E>;
impl Error {
pub fn new(err: i32) -> Error {
Error { err_num: err }
}
pub fn mux(result: Result<usize>) -> usize {
match result {
O... |
mod create_table_sql_for_navi;
pub(in crate::sqlite::transaction::sqlite_tx::version_revision_resolver) mod navi;
mod navi_table_name;
use std::{cell::RefCell, rc::Rc};
use crate::sqlite::{
sqlite_rowid::SqliteRowid, sqlite_types::VrrEntries, to_sql_string::ToSqlString,
transaction::sqlite_tx::SqliteTx,
};
us... |
// This file is part of Webb.
// Copyright (C) 2021 Webb Technologies Inc.
// 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
//
// http://www.apache.o... |
use super::pool::Pool;
use super::{MetaData, duration_to_str, match_version, render_markdown, MatchVersion, redirect_base};
use super::error::Nope;
use super::page::Page;
use iron::prelude::*;
use iron::{Url, status};
use std::collections::BTreeMap;
use time;
use rustc_serialize::json::{Json, ToJson};
use router::Ro... |
use std::{collections::VecDeque, rc::Rc, str};
use crate::{
components::{
chat::message::{MessageData, UIMessage},
IPFSPubSubError,
},
utils::IpfsService,
};
use futures_util::future::AbortHandle;
use wasm_bindgen_futures::spawn_local;
use web_sys::Element;
use yew::{
prelude::{html... |
use alloc::borrow::Cow;
use core::convert::TryFrom;
use core::fmt;
use core::ops::Range;
use quick_protobuf::{errors::Result as ProtobufResult, Writer, WriterBackend};
pub(crate) mod merkledag;
pub use merkledag::PBLink;
pub use merkledag::PBNode;
pub(crate) mod unixfs;
pub use unixfs::mod_Data::DataType as UnixFsTyp... |
use crate::{
application::{App, AppProxy, InnerWebViewAttributes, InnerWindowAttributes},
ApplicationProxy, Attributes, Callback, CustomProtocol, Error, Icon, Message, Result, WebView,
WebViewBuilder, WindowMessage, WindowProxy, RpcHandler,
};
#[cfg(target_os = "macos")]
use winit::platform::macos::{Activat... |
#![deny(missing_docs)]
#![deny(unsafe_code)]
#![deny(broken_intra_doc_links)]
#![deny(non_upper_case_globals)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![deny(unused_variables)]
#![deny(unused_imports)]
//! This crate exposes functionality to rapidly sync gossip data, aimed primaril... |
// Copyright <NAME>, Inc. and contributors. 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 A... |
//! Demonstrates how to handle rotations using the `leafwing_2d::Orientation` methods
//!
//! This is a direct conversion of the [`bevy` example of the same name](https://github.com/bevyengine/bevy/blob/main/examples/2d/rotation.rs)
//! Used under the MIT License courtesy of Bevy contributors
use bevy::{core::Fix... |
use crate::csv::CsvEncoding;
use crate::csv_core::parser::next_line_position;
use lazy_static::lazy_static;
use polars_core::datatypes::PlHashSet;
use polars_core::prelude::*;
use regex::{Regex, RegexBuilder};
use std::borrow::Cow;
use std::io::{BufRead, BufReader, Read, Seek, SeekFrom};
pub(crate) fn init_csv_reader<... |
// Copyright (c) 2021 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use std::io;
use std::io::ErrorKind;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::sync::watch::Receiver;
// Size of I/O read buffer
const BUF_SIZE: usize = 8192;
// Interruptable I/O copy using readers and writers
// (an... |
// 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.
//! Type-safe bindings for Zircon status.
use failure;
use fuchsia_zircon_sys as sys;
use std::ffi::NulError;
use std::fmt;
use std::io;
/// Status type ... |
// 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... |
#![allow(non_snake_case, non_camel_case_types, dead_code)]
use libc::*;
use std::mem::{size_of, transmute}; use std::ptr::null_mut;
pub const UNITY_AUDIO_PLUGIN_API_VERSION: usize = 0x010401;
// from macro
pub type UnityAudioDSPResult = c_int;
pub const UNITY_AUDIODSP_OK: UnityAudioDSPResult = 0;
pub const... |
use ggez::{audio::Source, audio::SoundSource,
Context,
event,
event::EventHandler,
graphics, graphics::Color, graphics::DrawMode,
graphics::DrawParam, graphics::Text, graphics::Font,
graphics::Scale,
input::keyboard,
timer};
use ra... |
use std::fs;
use std::path::Path;
use clap::{App, AppSettings, ArgGroup, ArgMatches};
use serde_json::{Number, Value};
use crate::completion;
use crate::config::Config;
use crate::error::*;
use crate::index;
use crate::library::Library;
const QEDA_YML: &str = ".qeda.yml";
const QEDA_EXAMPLES: &str = r"EXAMPLES:
... |
use std::cell::Cell;
use std::fmt::{self, Display, Formatter,};
use crush::soc::bdd::differential::PruneRecord;
use crush::soc::bdd::differential::StyledProgressBar;
use crush::soc::Id;
use super::simple_solver::Depth;
const LIVE_PRINT: bool = false; // OBS, should be left at false as long as live reporting is as it... |
extern crate sdl2;
extern crate rand;
use std::path::Path;
use std::collections::HashMap;
use std::time::Instant;
use self::sdl2::rect::Rect;
use self::sdl2::pixels::Color;
use self::sdl2::event::Event;
use self::sdl2::render::Texture;
use self::sdl2::image::LoadTexture;
use self::sdl2::keyboard::Keycode;
use self::s... |
// This file is part of toy_xcb and is released under the terms
// of the MIT license. See included LICENSE.txt file.
use super::atom::Atom;
use super::event::Event;
use super::geometry::IPoint;
use super::key;
use super::keyboard::Keyboard;
use super::mouse;
use super::{Result};
use xcb::{self, Xid};
use xcb::x;
use... |
extern crate avr_mcu;
use std::path::Path;
fn main() {
let crate_root = Path::new(env!("CARGO_MANIFEST_DIR"));
let mcus = if cfg!(feature = "all_mcus") {
avr_mcu::microcontrollers().to_owned()
} else {
// By default, when compiling for AVR we should hard error if
// microcontrolle... |
use crate::common::{Id, Node};
use crate::dht::DHT;
use crate::errors::RustyDHTError;
use crate::packets;
use crate::packets::MessageBuilder;
use crate::storage::buckets::Buckets;
use crate::storage::node_wrapper::NodeWrapper;
use futures::StreamExt;
use log::{debug, error, info, trace, warn};
use std::collections::Has... |
use amethyst::ecs::{Entities, Entity, Join, ReadExpect, ReadStorage, WriteStorage};
use gv_core::{
actions::{
mob::{MobAction, MobAttackAction, MobAttackType},
Action,
},
ecs::{
components::{
damage_history::{DamageHistory, DamageHistoryEntry},
ClientPlayerAc... |
use crate::{AttributeTypeAndValue, AttributeTypeAndValueParameters, DirectoryString};
use picky_asn1::{
tag::{Tag, TagPeeker},
wrapper::{
ApplicationTag1, ApplicationTag2, ApplicationTag4, ApplicationTag5, ApplicationTag6, ApplicationTag7,
ApplicationTag8, Asn1SequenceOf, Asn1SetOf, ContextTag0,... |
use std::str::FromStr;
use std::sync::Arc;
use anyhow::Result;
use tide::{Body, ParamError, Request, Response, Result as TideResult, Server, StatusCode};
use crate::{
daemon::{
DeleteCollectionRequest, DeleteNamespaceRequest, DeleteNamespaceRequestBody,
DeleteOverrideRequest, DeleteOverrideRequest... |
use super::{FileInfo, HeadInfo, MabiError, HEADER_SIZE};
use byteorder::{LittleEndian, WriteBytesExt};
use libflate::zlib;
use mersenne_twister::MT19937;
use rand::{Rng, SeedableRng};
use std::fs::{metadata, File, OpenOptions};
use std::io::{BufWriter, Read, Seek, SeekFrom, Write};
use std::path::{Path, MAIN_SEP... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - System Version Register"]
pub sys_version: SYS_VERSION,
#[doc = "0x04 - System Hardware Configuration register"]
pub sys_config: SYS_CONFIG,
_reserved2: [u8; 4040usize],
#[doc = "0xfd0 - Peripheral ID 4"]
pub pi... |
//! helper functions for conversion between internal structures and Protobuf
use super::schema;
use crate::datalog::*;
use crate::error;
use crate::token::{authorizer::AuthorizerPolicies, Block};
pub fn token_block_to_proto_block(input: &Block) -> schema::Block {
schema::Block {
symbols: input.symbols.sym... |
use rusqlite::types::ToSql;
use rusqlite::{Connection, Row};
use log::{info, error};
use serde_derive::{Deserialize, Serialize};
use chrono::prelude::*;
use uuid::Uuid;
use ilert::ilert_builders::{ILertEventType};
const DB_MIGRATION_VAL: &str = "1";
const DB_MIGRATION_V1: &str = "mig_1";
const DB_MIGRATION_V2: &str =... |
use crate::copy_in_place;
use crate::encode::{encode_chunk, encode_full_chunks_without_padding, encode_partial_chunk};
use crate::Config;
use std::{fmt, fmt::Debug, io};
/// Encode base64 data to a std::io::Write.
///
/// Base64 encoding requires some amount of buffering. EncodeWriter behaves a lot
/// like BufWriter.... |
//! [Prometheus][prometheus] metrics.
//!
//! [prometheus]: https://prometheus.io/
use crate::{Error, HandleRequest, Req, Res, Status};
use atomic_immut::AtomicImmut;
use bytecodec::bytes::Utf8Encoder;
use bytecodec::marker::Never;
use bytecodec::null::NullDecoder;
use fibers::sync::oneshot;
use futures::{Async, Future... |
use std::convert::TryFrom;
use std::fs;
fn main() {
let input = fs::read_to_string("input").expect("couldn't read input file");
let codes = parse_codes(&input);
let max_thruster = find_max(&codes, 0);
println!("Part one: {}", max_thruster);
let max_thruster = find_max(&codes, 5);
println!("Pa... |
//! This module defines some affine-related utilities.
use nalgebra::{Matrix3, Matrix4, Quaternion, RowVector4, Scalar, SymmetricEigen, Vector3};
/// 3x3 affine transformation matrix.
pub type Affine3 = Matrix3<f32>;
/// 4x4 affine transformation matrix.
pub type Affine4 = Matrix4<f32>;
const QUARTERNION_THRESHOLD: ... |
#[test]
fn overflow_truncating_integer_array_test() {
for (slice, expected) in [
(&[][..], "[]"),
(&[3u8], "[3]"),
(&[3u8, 5], "[3, 5]"),
(&[3u8, 5, 8], "[3, 5, 8]"),
(&[3u8, 5, 8, 13], "[3, 5, 8, 13]"),
(&[3u8, 5, 8, 13, 21], "[3, 5, 8, 13, 21]"),
] {
ass... |
use util::*;
use super::Ppu;
#[derive(Clone, Copy)]
pub struct Background {
pub bgcnt: u16, // Raw background control register
pub priority: u32, // Lower priority takes precedence
pub tile_b: u32, // Determine base address of tile data
pub map_b: u32, // Determine base address of tile... |
#[cfg(feature = "timely-next")]
use crate::dataflow::reachability::TrackerEvent;
use crate::dataflow::{operators::CrossbeamPusher, PROGRAM_NS_GRANULARITY};
use anyhow::{Context, Result};
use crossbeam_channel::Sender;
use ddshow_sink::{EventWriter, DIFFERENTIAL_ARRANGEMENT_LOG_FILE, TIMELY_LOG_FILE};
use ddshow_types::... |
//! Mesh triangle list ↔ triangle strip conversion
use crate::INVALID_INDEX;
fn find_strip_first(buffer: &[[u32; 3]], valence: &[u32]) -> usize {
let mut index = 0;
let mut iv = INVALID_INDEX;
for (i, b) in buffer.iter().enumerate() {
let va = valence[b[0] as usize];
let vb = valence[b[1] as usize... |
use crate::quorum::joint::JointConfig;
use crate::quorum::majority::MajorityConfig;
use crate::quorum::quorum::VoteResult::VoteWon;
use crate::quorum::quorum::{AckedIndexer, Index, VoteResult};
use crate::raftpb::raft::ConfState;
use crate::tracker::progress::{Progress, ProgressMap};
use std::collections::{HashMap, Ha... |
// 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.
use {
crate::constants::{self, SOCKET},
crate::ssh::build_ssh_command,
crate::target::{TargetAddr, TargetAddrFetcher},
anyhow::{anyhow, Con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.