text stringlengths 3.09k 13.9k |
|---|
#![allow(dead_code)]
extern crate oysterpack_near_stake_token;
extern crate staking_pool_mock;
use near_sdk_sim::*;
use crate::account_management_client::AccountManagementClient;
use crate::financials_client::FinancialsClient;
use crate::operator_client::OperatorClient;
use crate::staking_pool_client::StakingPoolCli... |
pub mod fighter_data;
pub mod fighter_data_common;
pub mod item_data;
use crate::script;
use crate::script::Script;
use crate::wii_memory::WiiMemory;
use fighter_data::ArcFighterData;
use fighter_data_common::ArcFighterDataCommon;
use item_data::ArcItemData;
use fancy_slice::FancySlice;
pub(crate) fn arc_sakurai(da... |
// 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 anyhow::Error;
use carnelian::{
make_app_assistant, make_message, AnimationMode, App, AppAssistant, Canvas, Color, Coord,
MappingPixelSink, Poi... |
use std::env;
use std::fs::{self, File};
use std::io::Write;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::mpsc;
use ctrlc;
use log::{debug, info};
use systemd_rs::login::monitor::{Category, Monitor};
use systemd_rs::login::session as login_session;
use crate::controller::{ControllerInterf... |
use std::{
fs,
io::Write,
path::PathBuf,
};
use crate::{
CONF,
ENV,
ENV_EX,
Error,
Result,
};
const CONF_TEMPLATE: &str = r#"# jrny config
# Project-level configuration options that should not change across environments
# or contain any sensitive information.
#
# This file MUST BE INC... |
const IDX: usize = 200007;
const ADDEND: f32 = 10.0;
/// Expanded version with explanations.
///
/// This function is identical to the following two in all but looks :) It
/// only differs from the first function in that it prints an 'original' value
/// (this was cut from the first just for simplicity).
///
/// Cont... |
use std::{borrow::Cow, collections::HashMap};
use rustc_hash::FxHashSet;
use swc_atoms::JsWord;
use swc_common::collections::AHashMap;
use swc_ecma_ast::*;
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith, VisitWith};
use self::{
analyzer::Analyzer,
collector::{collect_decls, ... |
use crate::errors::YdbError;
use crate::types::{Bytes, Value, ValueOptional};
use crate::{ValueList, ValueStruct};
use itertools::Itertools;
use std::any::type_name;
use std::collections::HashMap;
use std::time::Duration;
macro_rules! simple_convert {
($native_type:ty, $ydb_value_kind_first:path $(,$ydb_value_kind... |
extern crate wasmdome_domain as domain;
extern crate wasmdome_protocol as protocol;
use crossbeam_channel::unbounded;
use protocol::commands::{ArenaControlCommand::*, CreateMatch, MechQueryResponse};
use protocol::events::ArenaEvent;
use protocol::scheduler::StoredMatch;
use std::{error::Error, path::PathBuf};
use str... |
//! Blocks management endpoint.
use iron::prelude::*;
use persistence::prelude::*;
use blockchain::peer::*;
use blockchain::network::*;
use blockchain::identity::*;
use blockchain::block::*;
pub fn preflight(_: &mut Request) -> IronResult<Response> {
let mut res = Response::with((::iron::status::Ok,... |
mod akt_api;
mod canvas_api;
mod kopps_api;
use chrono::NaiveDate;
use csv::Writer;
use dialoguer::{theme::ColorfulTheme, Input, Select};
use dotenv::dotenv;
use serde::Serialize;
use std::env;
#[derive(Serialize)]
struct Row<'a> {
name: &'a str,
course: &'a str,
role: &'a str,
section: &'a str,
ma... |
use amethyst::prelude::WorldExt;
use amethyst::ui::UiCreator;
use amethyst::ui::UiLoader;
use dsf_core::resources::{
load_audio_settings, load_debug_settings, Assets, AudioSettings, MovementConfig, Music,
UiHandles, UserCache,
};
use amethyst::{
assets::{AssetStorage, Completion, Loader, PrefabLoader, Prog... |
use std::sync::{Arc, Mutex};
use std::thread;
use gstreamer::prelude::*;
use gstreamer::{self, MessageView};
use log::debug;
use crate::stream::stream_backend::StreamBackend;
use super::pipeline_builder::Pipeline;
#[derive(Debug, Default)]
pub struct PipelineRunnerState {
// move run kill restart logic to enum... |
use super::*;
use crate::{bitmap::SpaceBitmap, utils::mmap::Mmap};
pub struct ImmixSpace {
map: Mmap,
pub free_blocks: BlockList,
pub reusable_blocks: BlockList,
pub n_chunks: usize,
pub chunk_map: ChunkMap,
pub target_footprint: AtomicUsize,
pub num_bytes_allocated: AtomicUsize,
pub ini... |
use std::str::FromStr;
use bevy_app::EventReader;
use bevy_ecs::prelude::*;
use itertools::Itertools;
use crate::world::action::targeting::{Params, Target, TargetFinder};
use crate::{
text::{sorted_word_list, Tokenizer},
world::{
action::{get_room_std, into_action, Action},
types::{
... |
pub mod r#loop;
pub mod process;
pub mod process_dictionary;
// wasm32 proptest cannot be compiled at the same time as non-wasm32 proptest,
// so disable property-based tests and associated helpers completely for wasm32
//
// See https://github.com/rust-lang/cargo/issues/4866
#[cfg(all(not(target_arch = "wasm32"), tes... |
// We re-write message encryption logic here from rage by @str4d
// https://github.com/str4d/rage
use hkdf::Hkdf;
use rand::rngs::OsRng;
use rand::RngCore;
use secrecy::{ExposeSecret, Secret};
use sha2::Sha256;
use x25519_dalek::{EphemeralSecret, PublicKey};
use crate::{
aead, error::CoreError, message::recipient... |
extern crate proc_macro;
use darling::{FromDeriveInput, FromVariant};
use once_cell::sync::Lazy;
use proc_macro::TokenStream;
use proc_macro2::{Ident, Span};
use quote::quote;
use regex::Regex;
use std::collections::BTreeSet;
use syn::DeriveInput;
#[proc_macro_derive(UserFacingError, attributes(user_facing))]
pub fn ... |
use std::collections::HashSet;
use std::hash::Hash;
use crate::core::{Function, Measurement, PrivacyRelation};
use crate::dist::{MaxDivergence, SymmetricDistance, IntDistance};
use crate::dom::AllDomain;
use crate::error::Fallible;
use crate::samplers::{SampleBernoulli, SampleUniformInt};
use crate::traits::{ExactIntC... |
use crate::{self as stake, Config, CollatorPoints, TotalPoints};
use frame_support::{
construct_runtime, parameter_types,
traits::{GenesisBuild, OnFinalize, OnInitialize},
};
use sp_io;
use sp_runtime::{
Perbill,
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
};
use sp_std::convert::{From};
use sp_core::H... |
use crate::prometheus_metric_builder::PrometheusMetricBuilder;
use crate::{MetricType, No, RenderToPrometheus};
#[derive(Debug)]
pub struct PrometheusMetric<'a> {
pub(crate) counter_name: &'a str,
pub(crate) counter_type: MetricType,
pub(crate) counter_help: &'a str,
pub(crate) rendered_instances: Vec<... |
// Copyright (c) Microsoft. All rights reserved.
use std::fmt::{self, Display};
use std::net::SocketAddr;
use std::str;
use failure::{Backtrace, Compat, Context, Fail};
use hyper::header::{CONTENT_LENGTH, CONTENT_TYPE};
use hyper::{Body, Response, StatusCode, Uri};
use serde_json::json;
use systemd::Fd;
use url::Url;... |
//! This crate provides the ability to annotate structs with a `#[derive(Inspectable)]`,
//! which opens a web interface (by default on port 5676) where you can visually edit the values of your struct live.
//!
//! Your struct will then be available to you as a bevy resource.
//!
//! ## Example
//! ```rust
//! use bevy... |
// Copyright 2017-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 wr... |
use std::{fmt::Write, time::Duration};
use serde::Deserialize;
use sha1::{Digest, Sha1};
use crate::{
error::{Error, Result},
query,
row::Row,
sql::{Bind, SqlBuilder},
Client, Compression,
};
#[must_use]
pub struct Watch<V = Rows> {
client: Client,
sql: SqlBuilder,
refresh: Option<Dur... |
use crate::crtc;
use crate::memory;
use crate::screen;
use std::cell::RefCell;
use std::rc::Rc;
pub type GateArrayShared = Rc<RefCell<GateArray>>;
pub struct GateArray {
memory: memory::MemoryShared,
crtc: crtc::CRTControllerShared,
screen: screen::ScreenShared,
current_screen_mode: u8,
requested... |
//! A mutable graph representation.
//!
//! While cheap to update, this representation should not be used in any algorithms.
//! It does not implement any of the more interesting feature traits like `NavigableGraph`.
//!
//! The `SimpleGraphs` main use is to aid construction of static graph representations.
//!
//! * E... |
use crate::backend::{Backend, BackendSyncPoint, Modification};
use std::path::{Path, PathBuf};
use std::{fs, io};
use std::collections::VecDeque;
use crate::{Error, ResourcePath};
use std::sync::Mutex;
#[cfg(feature = "backend_filesystem_watch")]
mod watch_impl {
use std::collections::VecDeque;
use s... |
//! Pkmnapi email module
//!
//! # Example
//!
//! ```
//! use pkmnapi_email::*;
//!
//! let email = PkmnapiEmail::new(
//! &"<EMAIL>".to_owned(),
//! PkmnapiEmailTemplate::AccessToken("baz".to_owned()),
//! );
//! ```
extern crate dotenv;
extern crate lettre;
extern crate lettre_email;
extern crate tera;
use... |
// 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.
// https://datatrac... |
use crate::BlenderMesh;
use failure::Fail;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
pub type MeshesByFilename = HashMap<String, MeshesByMeshName>;
pub type MeshesByMeshName = HashMap<String, BlenderMesh>;
/// Given a buffer of standard output from Blender we parse all of the mesh JSON tha... |
use std::{fs::File, thread::sleep, time::Duration};
use crate::config::config::Config;
use crate::operations::floyd_dither::floyd_dither;
use crate::utils::*;
use image::{gif::GifDecoder, AnimationDecoder, DynamicImage, GenericImageView, RgbaImage};
pub fn img_to_braille(config: Config) {
// checking if its anima... |
// 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.
use super::super::{... |
// Copyright 2017-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 wr... |
use std::borrow::*;
use std::iter::*;
use std::vec::Vec;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::fmt::{Debug, Display};
use std::string::String;
use num::*;
use crate::expression::*;
use crate::term::*;
use crate::type_system::*;
use crate::rule::*;
use crate::constraint::Constraint;
use crat... |
use std::{collections, fs, str};
use crate::{mms, pdr};
impl mms::PkColumns {
fn _get_sql(&self) -> String {
use heck::SnakeCase;
let cols = self
.cols
.iter()
.map(|c| c.to_snake_case())
.collect::<Vec<_>>();
//format!("primary key ({})", co... |
use structopt::StructOpt;
use std::process::Command;
use std::io::{self, Write, Read};
use std::env::{current_dir, set_current_dir};
use std::fs::File;
use colored::*;
#[derive(StructOpt, Debug)]
#[structopt(bin_name = "cargo")]
struct Opt {
/// Create crate as a library
#[structopt(long)]
lib: bool,
/// Create ... |
use std::io;
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
use std::time::{Duration};
use crate::util::*;
use crate::config::*;
struct Request<'a> {
// http_version: &'a str,
method: &'a str,
path: &'a str,
}
struct Response {
// content: Option<&'a [u8]>,
// header: &'a str,
sta... |
use std::{cmp::Reverse, fmt::Write, sync::Arc};
use eyre::Report;
use futures::stream::{FuturesOrdered, StreamExt};
use hashbrown::{HashMap, HashSet};
use rosu_v2::prelude::{GameMode, OsuError};
use smallvec::SmallVec;
use crate::{
commands::osu::UserArgs,
embeds::{EmbedData, MostPlayedCommonEmbed},
pagin... |
/*
* Copyright © 2019-2020 <NAME> <EMAIL>
*
* 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 agre... |
//! The host kernel, responsible for dispatching requests to the local host
use std::convert::{TryFrom, TryInto};
use std::pin::Pin;
use bytes::Bytes;
use futures::Future;
use log::debug;
use safecast::{TryCastFrom, TryCastInto};
use tc_error::*;
use tc_transact::{Transact, Transaction};
use tcgeneric::*;
use crate... |
// Copyright 2012-2017 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... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control Register"]
pub ctrl: CTRL,
#[doc = "0x04 - Interrupt Duration"]
pub periodsel: PERIODSEL,
#[doc = "0x08 - Counter Value"]
pub cnt: CNT,
#[doc = "0x0c - Wake Up Enable"]
pub em4wuen: EM4WUEN,
#[do... |
use crate::Node;
use ckb_types::core::{BlockEconomicState, BlockNumber, BlockReward, Capacity, MinerReward};
use ckb_types::packed::{Byte32, OutPoint};
use ckb_types::prelude::*;
use std::collections::HashMap;
// Check the proposed-rewards and committed-rewards is correct
pub fn assert_chain_rewards(node: &Node) {
... |
use core::{ops::Deref, borrow::Borrow, marker::PhantomData};
use crate::{
Datum, Combiner,
parser::{OperatorBindings, DatumAllocator},
combiner::{OpFn, ApFn},
};
/// An [`OperatorBindings`] that associates generic `Datum`s with generic
/// `Combiner`s, using a slice of pairs (2-tuples) of them.
///
/// T... |
extern crate config;
#[macro_use]
extern crate clap;
use reqwest;
use serde::Deserialize;
/// Data class that models the fields in the "passage_meta" field
/// contained in a JSON response from the ESV API.
///
/// Note that the variable names are identical to the field names in
/// the JSON.
#[derive(Deserialize, D... |
use tiny_skia::{Paint, PathBuilder, Pixmap, PixmapRef, Transform};
use imgui::internal::RawWrapper;
use imgui::{DrawCmd, DrawCmdParams};
/// Transform which takes three corners of a 0..1 cube and maps them
/// to the specified coordinates.
fn cornerpin(ul: (f32, f32), ur: (f32, f32), ll: (f32, f32)) -> Transform {
... |
use std::str::FromStr;
use num_bigint::BigUint;
use num_traits::FromPrimitive;
use ton_abi::TokenValue;
use ton_abi::{Token, Uint};
use ton_block::{MsgAddress, MsgAddressInt};
use ton_types::UInt256;
use nekoton_abi::{uint256_bytes, PackAbi, UnpackAbi};
#[derive(PackAbi, UnpackAbi, Clone)]
struct PendingTransaction ... |
use core::fmt;
use std::time::{Duration, Instant};
use anyhow::{anyhow, Context};
use clap::Parser;
use probe_rs::{Core, DebugProbeInfo, MemoryInterface, Probe, Session, Target};
const FLASH_KEYR_ADDR: u32 = 0x5800_4008;
const FLASH_OPTKEYR_ADDR: u32 = 0x5800_400C;
const FLASH_SR_ADDR: u32 = 0x5800_4010;
const FLASH_... |
pub mod header;
pub mod reader;
pub mod writer;
pub mod utils;
pub mod resample;
pub mod splitter;
pub mod tone;
#[derive(Debug,Clone,PartialEq)]
pub struct CommandOpt {
pub is_debug: bool,
pub command: String,
pub filename: Option<String>,
pub arg1: Option<String>,
pub arg2: Option<String>,
}
fn ... |
#[macro_use] extern crate conrod_core;
extern crate conrod_glium;
extern crate conrod_winit;
extern crate find_folder;
extern crate glium;
extern crate image;
use glium::Surface;
mod support;
mod board;
mod piece;
fn main() {
const WIDTH: u32 = 600;
const HEIGHT: u32 = 600;
let mut chess_board = board::... |
//! Contains abstractions around StarkNet's Memory Page Ethereum contract.
//!
//! This includes the Mempage log events emitted by the contract.
use std::{convert::TryFrom, str::FromStr};
use anyhow::{Context, Result};
use web3::{
contract::Contract,
ethabi::{Event, Function, RawLog},
transports::WebSocket... |
use std::{
sync::{Arc},
};
use atomic::Ordering;
use crate::{TransitiveClosure, policy::{marksweepspace::{block::{Block, BlockState}, chunk::Chunk, metadata::{is_marked, set_mark_bit}}, space::SpaceOptions}, scheduler::{GCWorkScheduler, WorkBucketStage}, util::{ ObjectReference, alloc_bit::{ALLOC_SIDE_METADATA_SP... |
use std::fmt;
use std::fs::File;
use std::env;
use std::path::Path;
use std::io::{self, Write, Read, BufReader, BufRead, BufWriter};
extern crate time;
const ROW_SIZE: usize = 9;
#[derive(Debug)]
pub struct Sudoku([[u32; ROW_SIZE]; ROW_SIZE]);
impl Sudoku {
fn new(sudoku: &str) -> Self {
let mut board =... |
use super::db_id_format;
use chrono::NaiveDateTime;
use diesel;
use diesel::pg::PgConnection;
use diesel::prelude::*;
use diesel::result::QueryResult;
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
use crate::models::channel::{Channel, CreateChannel};
use crate::models::package::PackageVisibility;
use crate:... |
use friday_vendor::Vendor;
use friday_vendor::DispatchResponse;
use friday_error::{FridayError, propagate, frierr};
use friday_storage;
use friday_logging;
use std::collections::HashMap;
use std::sync::{Arc, RwLock};
use std::process;
use serde_derive::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
pub ... |
use crate::{guid::*, span::Span};
use nom::{
bytes::streaming::take,
error::ParseError,
number::streaming::{le_u16, le_u32, le_u64},
IResult,
};
use std::{convert::TryInto, io::Write};
use uuid::Uuid;
#[derive(Debug, PartialEq)]
pub struct StreamPropertiesData<'a> {
pub stream_type: Uuid,
pub e... |
use crate::prelude::runtime::RuntimeStrategy;
use std::time::Duration;
use std::net::IpAddr;
use nom::*;
use structopt::StructOpt;
#[derive(StructOpt, Debug, Clone)]
#[structopt(name = "twitchd", about = "Twitch API daemon")]
pub struct Options {
#[structopt(short = "h", long = "host", default_value = "0.0.0.0",... |
mod octave;
use rand::{Rng, SeedableRng};
use std::fmt;
pub use self::octave::PerlinOctave;
/// Averages a0 and a1, weighting a1 by a value.
/// Useful for linear interpolation (hence the name)
fn linear_interpolate(a0: f64, a1: f64, a1_weight: f64) -> f64 {
(1.0 - a1_weight) * a0 + a1_weight * a1
}
/// Interpo... |
use serde_json::Value;
use std::fmt;
use std::fs;
//use std::io::Error;
use std::error::Error;
pub struct ConfigFile {
pub alias: String,
pub path: String,
}
impl fmt::Display for ConfigFile {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "\nFile:\n\tAlias: {}\n\tPath: {}", self... |
use crate::prelude::*;
use serenity::{
client::Context,
framework::standard::{macros::help, Args, Command, CommandGroup, CommandResult, HelpOptions, OnlyIn},
model::prelude::*,
};
use std::collections::HashSet;
#[help]
async fn help(
ctx: &Context,
msg: &Message,
args: Args,
_help_options: ... |
use std::{cell::RefCell, sync::Arc};
use crate::{
graph::{
DataHandle, GraphResource, PassthroughDataContainer, PassthroughDataRef, PassthroughDataRefMut, ReadyData,
RenderGraph, RenderGraphDataStore, RenderGraphEncoderOrPass, RenderPassHandle, RenderPassTargets,
RenderTargetHandle, RpassTe... |
use crate::app::P4app;
use async_trait::async_trait;
use crate::core::DefaultContext;
use crate::event::{PacketReceived, NorthboundRequest, Event};
use failure::_core::marker::PhantomData;
use crate::app::common::CommonState;
use futures::{StreamExt, Future, SinkExt};
use crate::service::{Service};
use std::collections... |
use super::transaction::Transaction;
use super::utils;
use super::utils::{BinEncoding, Keccak256};
/// A Block that contains multiple [Transactions](crate::transaction::Transaction).
#[derive(Debug, Clone, PartialEq)]
pub struct Block {
/// Id which uniquely identifies the Block.
pub id: Keccak256,
/// Lis... |
use clap::Clap;
use gre::*;
use noise::*;
use std::f64::consts::PI;
use svg::node::element::path::Data;
use svg::node::element::*;
fn art(opts: Opts) -> Vec<Group> {
let width = 210f64;
let height = 297f64;
let perlin = Perlin::new();
let samples = 100000;
let f1 = (opts.f1x, opts.f1y);
let f2... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
#![allow(warnings)]
extern crate proc_macro;
use if_chain::*;
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::*;
use std::cmp::Ord;
use std::cmp::{max, min};
use syn;
use syn::visit::Visit;
use syn::{parse_macro_input, parse_quote};
use syn::{Attribute, Lit, Meta, NestedMeta, Visi... |
use crate::core::transform::Transform;
use crate::core::paramset::ParamSet;
use bumpalo::core_alloc::sync::Arc;
use std::collections::HashMap;
use crate::core::texture::TextureFloat;
use crate::core::shape::Shapes;
use std::fs::File;
use std::io::BufReader;
use ply_rs::{ parser, ply };
use crate::core::geometry::point:... |
// Copyright 2015-2019 <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... |
#[macro_use]
use crate::common::*;
use crate::engine::Scene;
use crate::obj::Obj;
fn is_not_back_faced(vert1: &Vertex, vert2: &Vertex, vert3: &Vertex) -> bool {
dot_product(&Vec3::new(0.0, 0.0, 1.0), &vert1.normal) > 0.0
|| dot_product(&Vec3::new(0.0, 0.0, 1.0), &vert2.normal) > 0.0
|| dot_product(&Vec3::ne... |
// Copyright (c) 2016-2021 <NAME>
//! A name table that internalizes all names presented to it and allows for them
//! to be referred to by a lightweight tag. This structure is heavily inspired
//! by the interner used in the Rust compiler.
use std::borrow::Borrow;
use std::cell::RefCell;
use std::cmp::Ordering;
use ... |
use crate::prelude::{Collider, Friction, GameState, GravityScale, PhysicsBody, Velocity};
use bevy::prelude::*;
// The player constants
const PLAYER_WALK_ACCEL: f32 = 12.0;
const PLAYER_RUN_ACCEL: f32 = 17.0;
const PLAYER_JUMP_FORCE: f32 = 135.0;
/// A bundle holding the components for the player
#[derive(Debug, Clon... |
use super::*;
use std::cell::RefCell;
use std::marker::PhantomData;
use std::rc::Rc;
use wasm_bindgen::{closure::Closure, JsCast, JsValue};
use web_sys::{BinaryType, CloseEvent, Event, MessageEvent, WebSocket};
pub struct WsClient<State, MessageCB, CloseCB, ErrorCB>
where
State: 'static,
{
client_state: Rc<Ref... |
//! Abstraction over token storage using keyring or in plaintext configuration file.
//! When saved to keyring, the token is identified by a string in the form
//! "<CUBEUsername>@<CUBEAddress>"
use anyhow::{Context, Error, Ok, Result};
use chris::common_types::{CUBEApiUrl, Username};
use chris::ChrisClient;
use conso... |
/*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... |
use std::{
fmt, io,
sync::atomic::{AtomicBool, Ordering},
};
use crate::{client::Client, Headers};
/// A message received on a subject.
pub struct Message {
/// The subject this message came from.
pub subject: String,
/// Optional reply subject that may be used for sending a response to this
... |
extern crate gl;
extern crate glfw;
use glfw::{Context};
use gl::types::{GLubyte, GLfloat, GLuint, GLsizei, GLsizeiptr, GLchar, GLvoid};
use std::string::String;
use std::ffi::CStr;
use std::mem;
use std::ptr;
fn glubyte_ptr_to_string(cstr: *const GLubyte) -> String {
unsafe {
CStr::from_ptr(cstr as *con... |
#![deny(unsafe_code)]
//#![deny(warnings)]
#![no_std]
#![no_main]
extern crate cortex_m;
#[macro_use]
extern crate cortex_m_rt as rt;
extern crate nb;
extern crate panic_semihosting;
extern crate stm32f103xx_hal as hal;
use hal::prelude::*;
use hal::stm32f103xx;
use rt::ExceptionFrame;
extern crate cortex_m_semihost... |
use std::any::Any;
use std::future::Future;
use std::sync::Arc;
use futures::channel::mpsc;
use futures::channel::oneshot;
use futures::future::BoxFuture;
use futures::future::FutureExt;
use futures::sink::SinkExt;
use futures::TryFutureExt;
use crate::append::AppendArgs;
use crate::append::AppendError;
... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
use std::marker::PhantomData;
use super::datagram::{
Icmpv4Header,
Icmpv4Type2,
};
use crate::{
fail::Fail,
protocols::{
arp,
ethernet2::frame::{
EtherType2,
Ethernet2Header,
},
... |
use ark_ff::{UniformRand, Zero};
use ark_poly::{univariate::DensePolynomial, UVPolynomial};
use colored::Colorize;
use commitment_dlog::{
commitment::{CommitmentCurve, OpeningProof, PolyComm},
srs::SRS,
};
use groupmap::GroupMap;
use mina_curves::pasta::{
vesta::{Affine, VestaParameters},
Fp,
};
use o1_... |
use crate::chip8::PROGRAM_START;
use crate::chip8::{Address, Register};
/// This struct holds all CPU registers
struct Registers {
/// General purpose register V0 to VF
/// VF is normally used as a flag
vx: [Register; 0x10],
/// Stores memory addresses
i: Address,
/// Special purpose registers.... |
use ic_protobuf::registry::crypto::v1::X509PublicKeyCert;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::{convert::TryFrom, net::SocketAddr};
const DEFAULT_IP_ADDR: &str = "0.0.0.0";
const DEFAULT_PORT: u16 = 8080u16;
#[derive(Debug, Clone, Serialize, PartialEq, Eq, Deserialize)]
#[serde(renam... |
extern crate clap;
extern crate nom_sql;
extern crate regex;
extern crate noria;
#[macro_use]
extern crate slog;
use std::path::{Path, PathBuf};
fn traverse(path: &Path) -> Vec<PathBuf> {
use std::fs;
let mut files = Vec::new();
for entry in fs::read_dir(path).unwrap() {
let entry = entry.unwrap... |
extern crate clingcon_sys;
extern crate clingo;
extern crate clingo_sys;
use clingo::ast;
use clingo::theory::{Theory, TheoryValue};
use clingo::{
FunctionHandler, GenericControl, GroundProgramObserver, Id, Logger, Model, Options, Propagator,
Statistics, Symbol,
};
use clingo_sys::clingo_ast;
use clingo_sys::cl... |
use errors::*;
use ex::{self, ExCapLints, ExCrateSelect, ExMode};
use server::db::{Database, QueryUtils};
use server::experiments::Status;
use server::github::Issue;
use server::messages::{Label, Message};
use server::routes::webhooks::args::{AbortArgs, EditArgs, RetryReportArgs, RunArgs};
use server::Data;
pub fn pin... |
use super::*;
use parser::RawExpr;
use rnix::value::{self, ValueError};
use codemap::File;
use directories::BaseDirs;
use hashbrown::hash_map::Entry;
use hashbrown::HashMap;
use rnix::parser::Types;
use rnix::value::Anchor;
use rowan::TreeRoot;
use std::path::Path;
use tendril::StrTendril;
/// The AST builder builds ... |
// MIT/Apache2 License
// This file is largely inspired by x11rb
#![cfg(all(feature = "std", unix))]
use crate::{log_debug, log_trace, util::convert_nix_error, Fd};
use alloc::{vec, vec::Vec};
use nix::sys::{
socket::{recvmsg, sendmsg, ControlMessage, ControlMessageOwned, MsgFlags},
uio::IoVec,
};
use std::{i... |
use rocket::response::content;
use rocket::State;
use serde::Deserialize;
use std::collections::HashMap;
use openidconnect::core::{
CoreClaimName, CoreJwsSigningAlgorithm, CoreProviderMetadata, CoreResponseType,
CoreSubjectIdentifierType,
};
use openidconnect::{
AuthUrl, EmptyAdditionalProviderMetadata, Is... |
//! Tests that read/viewed data match the original written data.
use crate::MaybeAlignedBytes;
use ndarray::array;
use ndarray::prelude::*;
use ndarray_npy::{
ReadNpyExt, ReadableElement, ViewElement, ViewMutElement, ViewMutNpyExt, ViewNpyExt,
WritableElement, WriteNpyExt,
};
use std::fmt::Debug;
use std::mem;... |
use core::{
fmt::{self, Debug, Formatter},
mem::{self, MaybeUninit},
ptr,
};
/// An automation sequence which will either be polled to completion or abort
/// early with a fault.
pub trait AutomationSequence<Input, Output> {
/// Extra info attached to a fault.
type FaultInfo;
fn poll(
... |
//! LiteX led controller (`LedChaser` core)
//!
//! Hardware source and documentation available at
//! [`litex/soc/cores/led.py`](https://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/led.py).
use core::cell::Cell;
use core::mem;
use kernel::common::StaticRef;
use kernel::hil;
use crate::litex_registers:... |
// This file is part of simple-http-server. 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/simple-http-server/master/COPYRIGHT. No part of simple-http-server, including this file, may be copied, modified, ... |
// We allow dead code because some of the things we're testing are meant to ensure that the macros do the right thing
// for codegen i.e. not doing codegen for fields that `serde` is going to skip, etc.
#![allow(dead_code)]
#![allow(clippy::print_stdout)] // tests
#![allow(clippy::print_stderr)] // tests
use std::{
... |
// Copyright 2022 RisingLight Project Authors. Licensed under Apache-2.0.
use futures::Future;
use risinglight_proto::rowset::block_index::BlockType;
use risinglight_proto::rowset::BlockIndex;
use super::super::{Block, BlockIterator};
use super::{Column, ColumnIterator, ColumnSeekPosition};
use crate::array::{Array, ... |
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use log::debug;
use tantivy::collector::TopDocs;
use tantivy::query::{AllQuery, QueryParser};
use tantivy::schema::*;
use tantivy::{DocAddress, Document, Index, IndexWriter, Term};
use crate::handlers::index::{AddDocument, DeleteDoc, DocsAff... |
use super::*;
use crate::code::{
parse_crates_in_file, validate_static_file_path, AddingStaticFileError, ModsMap, SourceCode,
};
impl<Data> Default for ReplData<Data> {
fn default() -> Self {
let lib_path = PathBuf::from("lib");
let mut map = ModsMap::new();
map.insert(lib_path... |
use super::UserInput;
use async_trait::async_trait;
use cursive::traits::*;
use cursive::views::Dialog;
use std::collections::HashSet;
use std::result::Result;
use std::ops::Deref;
pub struct UIBackend<'a> {
shell_trust: &'a super::ShellTrust,
}
impl<'a> UIBackend<'a> {
pub fn new(shell_trust: &'a super::Shel... |
// This file is part of Substrate.
// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
//! Defines the [PdfBookmark] struct, exposing functionality related to a single bookmark
//! in a `PdfBookmarks` collection.
use crate::action::PdfAction;
use crate::bindgen::FPDF_BOOKMARK;
use crate::bindings::PdfiumLibraryBindings;
use crate::bookmarks::PdfBookmarksIterator;
use crate::document::PdfDocument;
use cr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.