text stringlengths 3.09k 13.9k |
|---|
// COPYRIGHT (C) 2017 barreiro. All Rights Reserved.
// Rust solvers for Project Euler problems
use euler::algorithm::factor::sum_of_factors;
use euler::algorithm::long::{pentagonal, int_sqrt};
/// Method for calculation the combinations of a certain number of elements in a total number of places.
/// Uses iteration ... |
use std::{path::Path, sync::Arc};
use render::{LookAtCamera, Perspective, opengl_to_wgpu_matrix};
use wgpu::util::DeviceExt;
use crate::glm;
use crate::render::{
self, compile_shader_file, Buffer, BufferData, Camera, CubeMap, FrameContext, GPUScene,
RenderContext, RenderPass, Size, Texture, UniformViewProject... |
// Copyright 2020 <NAME>
// SPDX-License-Identifier: Apache-2.0
use crate::{
account::AccountHandle,
address::{AddressOutput, AddressWrapper},
client::ClientOptions,
message::{Message, MessageType},
};
use iota::{
bee_rest_api::handlers::{
message_metadata::{LedgerInclusionStateDto, Messag... |
// Copyright 2018 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... |
//! Container to store and set display properties
use crate::{
command::{Command, VcomhLevel},
displayrotation::DisplayRotation,
displaysize::DisplaySize,
interface::DisplayInterface,
};
/// Display properties struct
pub struct DisplayProperties<DI> {
iface: DI,
display_size: DisplaySize,
... |
use crate::api::error::ApiError;
use crate::api::models::DisplayGroup;
use crate::api::models::DisplayGroupDetails;
use crate::api::models::GroupInfo;
use crate::db::operations;
use crate::db::operations::models::GroupUpdate;
use crate::db::operations::models::NewGroup;
use crate::db::operations::models::SortGroupsBy;
... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs::{self, File};
use std::io::{BufReader, Read};
use std::path::Path;
use argh::FromArgs;
use csv::ReaderBuilder;
use libflate::gzip::Decoder;
use rayon::prelude::*;
use semver::Version;
use serde::de::DeserializeOwned;
use serde_derive::Deseriali... |
use std::{convert::TryInto, sync::Arc};
use arrow2::{
array::{Array, BooleanArray, NullArray, Offset, PrimitiveArray, Utf8Array},
datatypes::{DataType, IntervalUnit, TimeUnit},
types::{NativeType, NaturalDataType},
};
use avro_rs::{types::Value, Schema};
use num::{BigInt, NumCast, ToPrimitive};
fn read_ut... |
use crate::container;
use crate::event::{self, Event};
use crate::layout;
use crate::pane_grid;
use crate::{
Clipboard, Element, Hasher, Layout, Padding, Point, Rectangle, Size,
};
/// The title bar of a [`Pane`].
///
/// [`Pane`]: crate::widget::pane_grid::Pane
#[allow(missing_debug_implementations)]
pub struct T... |
//! A module containing the structure of the valgrind XML output.
//!
//! Only the memcheck tool is implemented in accordance to [this][link]
//! description].
//!
//! Note, that not all fields are implemented.
//!
//! [link]: https://github.com/fredericgermain/valgrind/blob/master/docs/internals/xml-output-protocol4.t... |
use std::{collections::HashMap, convert::TryFrom, fmt::Debug, time::SystemTime};
use chrono::{DateTime, Utc};
use ordered_float::NotNan;
use serde::{Deserialize, Serialize};
use super::NewRelicSinkError;
use crate::event::{Event, MetricValue, Value};
#[derive(Debug)]
pub enum NewRelicApiModel {
Metrics(MetricsAp... |
//! This module implements the Bourgouin Precip Type algorithm.
use crate::{
error::Result,
layers::{
cold_surface_temperature_layer, melting_freezing_energy_area,
warm_surface_temperature_layer, warm_temperature_layer_aloft, Layer,
},
precip_type::{is_drizzler, PrecipType},
soundin... |
use crate::client::{
mutation::Mutation,
query::Query,
};
use juniper::RootNode;
pub type Schema<'a, C, S> = RootNode<'a, Query<C, S>, Mutation<C, S>>;
#[cfg(test)]
mod tests {
use crate::{
client::{
mutation::Mutation,
query::Query,
Schema,
},
c... |
// 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... |
// 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::{Context as _, Error},
fidl_fuchsia_bluetooth_gatt::ClientProxy,
fuchsia_async as fasync,
fuchsia_bluetooth::error::Error as ... |
use core::ptr::{null, null_mut, NonNull};
use std::collections::HashMap;
use std::ffi::CStr;
use std::os::raw::c_int;
use libsqlite3_sys::{
sqlite3_bind_parameter_count, sqlite3_clear_bindings, sqlite3_column_count,
sqlite3_column_decltype, sqlite3_column_name, sqlite3_data_count, sqlite3_finalize,
sqlite... |
// Copyright 2020 - developers of the `grammers` project.
//
// 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. This file may not be copied, modified, or distr... |
// Copyright 2020 <NAME>.
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// 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 in the LICENSE file at the
// root of this rep... |
// Descriptor wallet library extending bitcoin & miniscript functionality
// by LNP/BP Association (https://lnp-bp.org)
// Written in 2020-2021 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// t... |
use std::{convert::TryFrom, str::FromStr, sync::Arc};
use lazy_static::lazy_static;
use graph::components::store::BlockStore;
use graph::{
blockchain::Block,
prelude::{
serde_json, web3::types::H256, BlockHash, BlockNumber, BlockPtr, EthereumBlock,
LightEthereumBlock,
},
};
lazy_static! {... |
use std::ops::Drop;
use std::os::raw::{c_int, c_void};
pub type LamePtr = *mut c_void;
#[link(name = "mp3lame")]
extern "C" {
pub fn lame_init() -> LamePtr;
pub fn lame_close(ptr: LamePtr) -> c_int;
pub fn lame_set_in_samplerate(ptr: LamePtr, in_samplerate: c_int) -> c_int;
pub fn lame_get_in_samplera... |
use crate::core::pbrt::{next_float_down, next_float_up, Float, MACHINE_EPSILON};
use std::{
mem::swap,
ops::{Add, Div, Mul, Neg, Sub},
};
#[derive(Copy, Clone, Default)]
pub struct EFloat {
pub v: Float,
low: Float,
high: Float,
}
impl EFloat {
pub fn new(v: Float, err: Float) -> EFloat {
... |
day!(
day21,
"https://adventofcode.com/2018/day/21/input",
part1,
part2
);
use crate::day19::{Instruction, Opcode, Program, ProgramState, Register};
use std::collections::HashSet;
fn parse_input(input: &str) -> Result<(Program, u64)> {
let program: Program = input.parse()?;
// Validate th... |
#![feature(link_args)]
#![feature(plugin)]
// #![plugin(rustler_codegen)]
#[cfg(target_os="macos")]
#[link_args = "-flat_namespace -undefined suppress"]
extern {}
#[macro_use]
extern crate rustler;
#[macro_use]
extern crate rustler_codegen;
#[macro_use]
extern crate lazy_static;
extern crate tendril;
extern crate scop... |
use crate::http;
use crate::settings::global_user::GlobalUser;
use crate::terminal::message::{Message, StdOut};
use crate::terminal::{emoji, styles};
use cloudflare::endpoints::account::{self, Account};
use cloudflare::endpoints::user::GetUserDetails;
use cloudflare::framework::apiclient::ApiClient;
use cloudflare::fra... |
use std::collections::BTreeMap;
use log::debug;
use syscall::error::Result;
use syscall::io::{Dma, Io, Mmio};
use super::Xhci;
use super::ring::Ring;
#[repr(packed)]
pub struct SlotContext {
pub a: Mmio<u32>,
pub b: Mmio<u32>,
pub c: Mmio<u32>,
pub d: Mmio<u32>,
_rsvd: [Mmio<u32>; 4],
}
pub cons... |
use futures::prelude::*;
use futures::sync::mpsc::{channel, Receiver, Sender};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::path::PathBuf;
use std::sync::Mutex;
use tokio_tungstenite::accept_hdr_async;
use tokio_tungstenite::tungstenite::{handshake::server::Request, Error as WsError};
use graph::prelude::{Su... |
/// Utility class to handle IPC endpoint exposed to sandbox process.
///
/// This implements the IPC interface exposed by the "replica controller
/// process" towards the "sandbox process": Whenever the sandbox process
/// issues an upwards call, it ends up here.
///
/// This is just a utility implementing the required... |
//! An API for working with well-known query parameters.
mod builder;
mod page;
mod sort;
use std::fmt::{self, Formatter};
use percent_encoding::percent_decode;
use serde::de::{Deserialize, Deserializer, MapAccess, Visitor};
use serde::ser::{Serialize, SerializeStruct, Serializer};
use serde_qs;
use crate::error::E... |
/*
Advent of Code 2020
<NAME>
Day 17 Solution
2020-12-17
Start time: 2:40pm
Solved part 1: 3:40pm (1hr)
Solved part 2: 3:58pm (18 min)
Code cleanup: 6:00-7:25pm
Time (--release): 0m0.374s
*/
use aoc2020::util::file_to_vec;
use std::collections::HashSet;
/*
Abstractions for 4D... |
use crate::utility::version::Version;
use crate::{Result, STATUS};
use dialoguer::{Input, Select};
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
const TITLE_ID: &str = "title";
const BODY_ID: &str = "body";
const DATETIME_ID: &str = "timestamp";
const HISTORY_FILE_... |
use fltk::{app, app::*, group::Pack, group::*, widget::Widget, button::*, draw, enums::*, frame::*, draw::*, prelude::*, widget::*, window::*};
use crate::{CustomEmmiter, traits::*, LayerDraggable, DraggableCb, DraggableEvent, DraggableInfo, DND_CHANNEL, enums::*, DragObject, cdbg};
use std::cell::RefCell;
use std::rc:... |
extern crate rustbox;
use self::rustbox::{Color, Style, RustBox};
use super::board::{Board, HEIGHT, WIDTH};
use super::tetromino::{Tetromino, TetrominoType};
use super::window::Window;
// Default scaling factor for the board
const SCALE: usize = 2;
// Default values for styling terminal output
const DEFAULT_STYLE: ... |
use crate::cartridge::Cartridge;
use crate::cartridge_header::RAM_BANK_SIZE;
use crate::utils::u8s_to_u16;
pub const ROM_BANK_SIZE: usize = 16000;
pub struct BankedMemory {
pub active_bank: usize,
pub banks: Vec<Vec<u8>>,
}
impl BankedMemory {
pub fn value_at(&self, location: usize) -> u8 {
self.... |
// Copyright 2014-2016 <NAME>, <NAME>.
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
//! One-way orf finder algorithm.
//!
//! Complexity: O(n).
//!
//! # Example
//!
//! ```
//! use bio::seq_analysis:... |
//! Handling for types that can be viewed as byte arrays.
use std::fmt;
use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Write;
use std::iter::Iterator;
use std::marker::PhantomData;
/// Types that can be constructed from a constant-length byte array.
pub trait Viewable: Sized {
/// Size of the byte ar... |
///! The Authentication header associated with Discv5 Packets.
use super::{AuthTag, Nonce, AUTH_TAG_LENGTH, ID_NONCE_LENGTH};
use enr::{CombinedKey, Enr};
use log::debug;
use rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream};
//TODO: Generalise the scheme and associated crypto library.
const AUTH_SCHEME_NAME: ... |
use proptest::*;
use super::*;
use crate::axis::Axis::{U, V, W, Y, Z};
use crate::prelude::*;
#[test]
fn test_rle_item() {
// Ensure that u8->string and string->u8 is reversible.
for i in 0..=255 {
let s = RleItem::Cell(i).to_string();
println!("{:?}", s);
assert_eq!(Ok(RleItem::Cell(i... |
// Representation.
use std::io::Write;
type TyIndex = usize;
type FuncIndex = usize;
type LocalIndex = usize;
#[derive(Clone, Copy, Debug)]
pub(crate) enum Instr {
Return,
I32Const(i32),
I32Add,
}
#[derive(Clone, Copy, Debug)]
pub(crate) enum ValTy {
I32,
I64,
U32,
U64,
}
#[derive(Clo... |
use {
super::Align,
crate::{
base::{self, Resizable},
draw,
geom::*,
ui,
},
indexmap::IndexMap,
reclutch::{
display::{self, DisplayCommand, Rect, Size},
event::{bidir_single::Queue as BidirSingleEventQueue, RcEventListener},
prelude::*,
},
... |
#![allow(missing_docs)]
/**
* 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... |
use std;
// -- envs
pub static DISABLE_CPU_BINDING_VAR: &str = "ANGORA_DISABLE_CPU_BINDING";
pub static ANGORA_BIN_DIR: &str = "ANGORA_BIN_DIR";
// executor.rs
pub static TRACK_FILE_PATH_VAR: &str = "ANGORA_TRACK_PATH";
pub static COND_STMT_ENV_VAR: &str = "ANGORA_COND_STMT_SHM_ID";
pub static LISTEN_SEM_ENV_VAR: &st... |
mod utils;
use bit_vec::BitVec;
use parsers::parsers::parse_rle_string;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
extern crate ... |
use bevy::prelude::{error, App, IntoExclusiveSystem, Plugin, ResMut};
use bevy::window::WindowId;
use bevy::winit::WinitWindows;
use winit::dpi::{PhysicalPosition, PhysicalSize};
use winit::window::Window;
pub struct WindowHandlingPlugin;
impl Plugin for WindowHandlingPlugin {
fn build(&self, app: &mut App) {
... |
//! Contains items that can be added to a plot.
use std::ops::RangeInclusive;
use super::transform::Bounds;
use crate::*;
/// A value in the value-space of the plot.
///
/// Uses f64 for improved accuracy to enable plotting
/// large values (e.g. unix time on x axis).
#[derive(Clone, Copy, Debug, PartialEq)]
pub str... |
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::{ParseLocation, RenderNodeType};
use glib::translate::*;
use glib::{StaticType, Type};
use std::fmt;
use std::path::Path;
use std::ptr;
// Can't use get_type here as this is not a boxed type but another fundamental type
glib::w... |
//! # Binary Agreement
//!
//! The Binary Agreement protocol allows each node to input one binary (`bool`) value, and will
//! output a binary value. The output is guaranteed to have been input by at least one correct
//! node, and all correct nodes will have the same output.
//!
//! ## How it works
//!
//! The algorit... |
use std::ops::Range;
use crate::Error;
use crate::internal::get_json;
use crate::jsons::AuditProof;
use std::convert::TryInto;
use crate::utils::{combine_tree_hash, u8_to_hex};
/// Returns an array of `Range<u64>`s. Each x..y denotes that this part
/// of the proof should be the hash of the subtree formed by leafs wit... |
use std::collections::HashMap;
use crossterm::event::Event;
use irust_api::{Command, GlobalVariables};
use super::Script;
pub struct ScriptManager4 {
sm: rscript::ScriptManager,
startup_cmds: Vec<Result<Option<Command>, rscript::Error>>,
}
macro_rules! mtry {
($e: expr) => {
(|| -> Result<_, Box... |
use hyper::{
header::{self, HeaderValue},
http::uri,
Body, Client, HeaderMap, Request, Response, StatusCode, Uri,
};
use lazy_static::lazy_static;
use std::{collections::HashMap, convert::TryInto, net::SocketAddr, sync::Arc};
use tracing::{error, info};
pub struct Handler {
servers_map: HashMap<String,... |
use pickledb::error::ErrorType;
use pickledb::{PickleDb, PickleDbDumpPolicy};
#[macro_use(matches)]
extern crate matches;
extern crate fs2;
use fs2::FileExt;
use std::fs::File;
mod common;
#[test]
fn load_serialization_error_test() {
set_test_rsc!("json_db.db");
// create a new DB with Json serialization
... |
use yew::prelude::*;
use super::new_project_dialog::ProjectConfig;
use super::socket_agent::{AgentInput,AgentOutput,SocketAgent,TransferData};
use serde::{Serialize,Deserialize};
use yew::services::{IntervalService};
use yew::services::interval::IntervalTask;
use super::new_file::NewFile;
pub struct FileManager {
... |
use std::{
convert::TryInto,
io::{self, Read, Write},
};
use tokio::{
io::{AsyncRead, AsyncWrite},
prelude::Async,
sync::lock::Lock,
};
use zmq::{Context, Message, Result, Socket, REQ};
use enclave_protocol::FLAGS;
macro_rules! lock {
($e:expr) => {
match $e.poll_lock() {
... |
/*
* Copyright 2019 The Starlark in Rust Authors.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/lic... |
use lua::{Index, ToLua, FromLua, State, MULTRET};
use types::{LuaStackable, LuaGeneric};
use context::Context;
use error;
/// Reperesents a callable function on the Lua stack
///
/// Functions that can be called may be defined in Lua, Rust, C, or any other language with Lua
/// bindings.
///
/// # Examples
///
/// ```... |
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::fs::File;
use std::marker::PhantomData;
use std::os::unix::io::AsRawFd;
use io_uring::{
operation::{Cqe, OpCode, Operation},
restriction::Restriction,
Error as IoUringError, IoUring,
... |
extern crate raytracer;
use raytracer::rendering::{render, Camera, RenderParams};
use raytracer::skyboxes::GradientSkybox;
use raytracer::textures::{SolidColor, Checker};
use raytracer::structures::{Color, Vec3, Point3, Quaternion, Transform};
use raytracer::hittables::{BVHNode, HittableList, Sphere, MovingInstance};
... |
pub const LCMS_VERSION: i32 = 2120;
// Types
pub type U8F8 = u16;
pub type S15F16 = i32;
pub type U16F16 = u32;
mod signature;
pub use signature::Signature;
pub const USE_BIG_ENDIAN: bool = if cfg!(BIG_ENDIAN = "true") {
true
} else {
false
};
/// D50 XYZ normalized to Y=1.0
pub mod d50 {
pub const X: ... |
#![feature(duration_as_u128)]
use std::io::{stdout, Write};
use std::thread;
use std::time::{Duration, Instant};
use std::process::Command;
use clap::{App, crate_authors, crate_description, crate_name, crate_version};
use termion::input::TermRead;
use termion::raw::IntoRawMode;
use termion::screen::AlternateScreen;
... |
// Copyright 2020 Two Sigma Investments, LP.
//
// 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... |
use std::str::FromStr;
use ::value::Value;
use vrl::{function::Error, prelude::*};
fn to_unix_timestamp(value: Value, unit: Unit) -> Resolved {
let ts = value.try_timestamp()?;
let time = match unit {
Unit::Seconds => ts.timestamp(),
Unit::Milliseconds => ts.timestamp_millis(),
Unit::N... |
use acm_sync_manager::{acm, manager};
use aws_sdk_acm::{
error::{self, GetCertificateErrorKind},
types,
};
use std::{collections::HashMap, time::Duration};
use tokio::time::Instant;
use k8s_openapi::api::networking::v1::{
HTTPIngressPath, HTTPIngressRuleValue, Ingress, IngressBackend, IngressRule,
Ingr... |
//! A dynamic buffer encapsulates memory storage that may be automatically resized
//! as required, where the memory is divided into two regions: readable bytes followed by writable
//! bytes. These memory regions are internal to the dynamic buffer, but direct access to the
//! elements is provided to permit them to be... |
mod complete;
pub use complete::CompleteInlineRelationWalker;
use schema_ast::ast;
use crate::{
relations::{OneToManyRelationFields, OneToOneRelationFields, Relation, RelationAttributes},
walkers::{ModelWalker, RelationFieldWalker, RelationName, ScalarFieldWalker},
};
use super::{camel_case, pascal_case, In... |
// Copyright 2018 Parity Technologies (UK) Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, mer... |
use std::fmt;
use std::path;
use serde;
use super::*;
#[derive(Debug, Eq, PartialEq, Default, Clone, serde::Serialize, serde::Deserialize)]
#[serde(deny_unknown_fields, default)]
pub struct Frontmatter {
#[serde(skip_serializing_if = "Option::is_none")]
pub permalink: Option<Permalink>,
#[serde(skip_seri... |
use crate::framebuffer::FrameBuffer;
use std::fs::File;
use std::io::Write;
use png::ColorType::RGB;
use std::{env};
use rayon::prelude::*;
use png::OutputInfo;
mod framebuffer;
mod color_utils;
mod ass_emitter;
fn convert_png(input: String, output: String, at: u64, size: u64) -> OutputInfo {
let decoder = png::D... |
//! `PathExplorer` that allows interactive exploration
use rune::explorer::explorer::PathExplorer;
use rune::explorer::interactive::Command;
use rune::context::rune_ctx::RuneContext;
use rune::context::context::{Context, Evaluate, MemoryRead, RegisterRead};
use rune::engine::rune::RuneControl;
use rune::memory::seg_me... |
//! If a service has defined an healthchecker, this module will spawn a worker to making sure that
//! the service is working as supposed to.
use crate::horust::bus::BusConnector;
use crate::horust::formats::{
Event, Healthiness, HealthinessStatus, Service, ServiceName, ServiceStatus,
};
use crossbeam::channel::{u... |
// 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, ... |
use random::*;
use ray::*;
use object::*;
use vec3::*;
use texture::*;
pub trait Material : Send + Sync {
fn scatter(&self, rng : &mut RngCore, r_in : &Ray, hit : &HitRecord)
-> Option<(Ray, Vec3)>;
fn emitted(&self, uv : (f32, f32), p : &Vec3) -> Vec3 {
ZERO3
}
}
pub struct Lambert... |
// Copyright (c) 2019, Arm Limited, All Rights Reserved
// 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.org/license... |
// Copyright (c) 2015-2021 <NAME>. 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 ... |
use std::ops::Neg;
use auto_ops::{impl_op_ex, impl_op_ex_commutative};
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[repr(C)]
pub struct Vec2 {
pub x: f32,
pub y: f32,
}
impl Default for Vec2 {
/// Creates a zero vector
fn defa... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// System tray is supported and availabled only if feature flag is enabled.
// Platform: Windows, Linux and macOS.
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
#[cfg(feature = "t... |
extern crate ansi_term;
#[macro_use]
extern crate clap;
extern crate mktemp;
extern crate ekiden_common;
extern crate ekiden_tools;
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::process::exit;
use ansi_term::Colour::Red;
use clap::{App, Arg, ArgMatches, SubCommand};
use ekiden_c... |
mod cartprod;
mod engine;
mod move_table;
mod small;
mod train;
mod types;
// use crate::{
// small::{SmallBattleSnake, Status::*},
// types::{Direction, State},
// };
// use engine::eval;
// use small::{SmallBoard, SmallMove};
// use types::Coordinate;
use dotenv::dotenv;
use serde_json::json;
use std::time::... |
use super::error::{Error, ErrorKind, Result};
use std::fmt;
/// A type which represents the various kinds of keys.
#[derive(Debug, PartialEq, Clone)]
pub enum KeyTypeKind {
/// Represents an RSA key type.
Rsa,
/// Represents an ED25519 key type.
Ed25519,
/// Represents an ECDSA key type.
Ecdsa... |
use super::{
data_components::{CameraMoveSpeed, CameraZoomLimit, CameraZoomSpeed},
events::MouseDragEvent,
marker_components::MainCamera,
resources::MouseWorldPosition,
};
use bevy::{input::mouse::MouseWheel, prelude::*};
///A function to get mouse position in world coords
///
///Credit to jamadazi's c... |
//! This module resolves `mod foo;` declaration to file.
use std::{borrow::Cow, sync::Arc};
use ra_db::{FileId, SourceRoot};
use ra_syntax::SmolStr;
use relative_path::RelativePathBuf;
use crate::{db::DefDatabase, HirFileId, Name};
#[derive(Clone, Copy)]
pub(super) struct ParentModule<'a> {
pub(super) name: &'a... |
//! Provides system which are an abstraction for anything that can be executed
//! against a [Context](crate::Context).
use std::{any::type_name, borrow::Cow};
use crate::{
borrow::{Borrows, ComponentBorrow, ContextBorrow, IntoBorrow},
Context, Result,
};
/// System name alias
pub type SystemName = Cow<'stati... |
//! Parser for extended key types (i.e. `xprv` and `xpub`)
pub(crate) mod attrs;
pub(crate) mod private_key;
pub(crate) mod public_key;
use crate::{ChildNumber, Error, ExtendedKeyAttrs, Prefix, Result, Version, KEY_SIZE};
use core::{
fmt::{self, Display},
str::{self, FromStr},
};
use zeroize::Zeroize;
/// Se... |
use assert_fs::fixture::PathChild;
use assert_fs::TempDir;
use chain_addr::Discrimination;
use iapyx::{PinReadMode, QrReader};
use jormungandr_integration_tests::common::jcli::JCli;
use jormungandr_lib::interfaces::Address;
use jormungandr_lib::interfaces::InitialUTxO;
use jortestkit::prelude::WaitBuilder;
use math::ro... |
use std::collections::HashMap;
use legion::{component, IntoQuery, World};
use quicksilver::geom::{Circle, Rectangle, Vector};
use quicksilver::graphics::{Color, FontRenderer};
use quicksilver::Graphics;
use uuid::Uuid;
use crate::components::Commodity::Hydrogen;
use crate::components::Commodity::Water;
use crate::com... |
use std::collections::VecDeque;
use std::ops::{Add, AddAssign, Neg, Sub, SubAssign};
// We assume that graph vertices are numbered from 1 to n.
/// Adjacency matrix
type Graph = Vec<Vec<usize>>;
/// We assume that T::default() gives "zero" flow and T supports negative values
pub struct FlowEdge<T> {
pub sink: us... |
use std::{
collections::HashMap, io::BufReader, path::PathBuf, str::FromStr, sync::Arc, time::Duration,
};
use anyhow::anyhow;
use ipnetwork::IpNetwork;
use log::{info, warn};
use rustls_pemfile::Item;
use serde::{Deserialize, Serialize};
use tokio::sync::RwLock;
use crate::{addresses::*, authority::*, server::*,... |
use crossterm::{
event::{read, Event, KeyCode, KeyEvent},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
// use std::{io, thread, time::Duration};
use std::io;
use tui::{
backend::Backend,
backend::CrosstermBackend,
layout::{Constraint, Dir... |
/// This is where event parsing is handled and conversion of things like ICCCM and EWMH
/// messages to penrose actions is done.
use crate::core::{
bindings::{KeyCode, MouseEvent},
data_types::{Point, Region},
hooks::HookName,
manager::{clients::Clients, WindowManager},
xconnection::{
Atom, ... |
use crate::client::Client;
use crate::pow::BlockSeed;
use crate::pow::BlockSeed::{FullBlock, PartialBlock};
use crate::proto::kaspad_message::Payload;
use crate::proto::rpc_client::RpcClient;
use crate::proto::{
GetBlockTemplateRequestMessage, GetInfoRequestMessage, KaspadMessage, NotifyBlockAddedRequestMessage,
... |
use crate::b2_collision::*;
use crate::b2_contact::*;
use crate::b2_fixture::*;
use crate::b2_joint::*;
use crate::b2_math::*;
use crate::b2_settings::*;
use std::cell::RefCell;
use std::rc::Rc;
use crate::private::dynamics::b2_world_callbacks as private;
pub type B2destructionListenerPtr<D> = Rc<RefCell<dyn B2destr... |
use crate::transform::bound_check::BoundCheckKind::{Slice, Vector};
use crate::transform::{MirPass, MirSource};
use rustc::hir::def_id::DefId;
use rustc::hir::map::DefPathData::TypeNs;
use rustc::hir::map::DefPathData::ValueNs;
use rustc::mir::interpret::PanicInfo::BoundsCheck;
use rustc::mir::Operand::Constant;
use ru... |
#![no_std]
#![no_main]
#![feature(abi_avr_interrupt)]
extern crate panic_halt;
use m48_robo_rust::{adc, delay_ms, hal::port::*, prelude::*};
static mut LEDS: Option<[Pin<mode::Output>; 8]> = None;
static mut DIGITS: Option<[Pin<mode::Output>; 3]> = None;
static mut BUFF: [u8; 3] = [0, 0, 0];
const SEG_A: u8 = 1u8 <... |
//! Slower generic encryption supporting an arbitrary generator.
use super::*;
/// Encryption key that may be shared publicly.
#[derive(Debug, Clone)]
pub struct EncryptionKey<I> {
pub n: I, // the modulus
pub nn: I, // the modulus squared
pub g: I, // the generator
}
impl<I> crate::traits::EncryptionK... |
use crate::data_source::IonDataSource;
use crate::result::{decoding_error, IonResult};
use std::mem;
// ion_rust does not currently support reading variable length integers of truly arbitrary size.
// These type aliases will simplify the process of changing the data types used to represent each
// VarUInt's magnitude ... |
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
use num_traits::FromPrimitive;
use ordered_float::OrderedFloat;
use rayon::prelude::*;
use crate::prelude::*;
use criteria::MetaMLScorer;
use criteria::PartitionCriterion;
/// A `HashMap` from `Cluster... |
#![allow(dead_code)]
use std::{io::Write, time::SystemTime};
use bench_logger::BenchmarkGroup;
use crate::bench_logger::{Bench, BenchmarkElement, BenchmarkReport};
mod bench_logger;
mod bench_random;
mod bench_rug;
mod bench_u128;
mod util;
macro_rules! benchibench {
($($b:ty),+ $(,)?) => {{
let mut rep... |
use log::{error, info, LevelFilter};
use log4rs::{
append::rolling_file::{
policy::compound::{
roll::delete::DeleteRoller, trigger::size::SizeTrigger, CompoundPolicy,
},
RollingFileAppender,
},
config::{Appender, Config, Root},
};
use reqwest::StatusCode;
use std::{
e... |
extern crate rand_distr;
extern crate voronoi;
use super::map::{Map, TileData};
use rand::distributions::{Distribution, Uniform};
use voronoi::{Point, voronoi, DCEL, make_line_segments};
use rand::{Rng};
use rand::rngs::{StdRng};
pub enum GenState{
Start,
Points(Vec<Point>),
Voronoi(DCEL, Vec<Point>),
... |
mod aggregate;
mod function;
use {
crate::ast::{Expr, Query},
std::iter::once,
};
#[derive(Debug, PartialEq)]
pub enum PlanExpr<'a> {
None,
Identifier(&'a str),
CompoundIdentifier(&'a [String]),
Expr(&'a Expr),
TwoExprs(&'a Expr, &'a Expr),
ThreeExprs(&'a Expr, &'a Expr, &'a Expr),
... |
extern crate glium;
use glium::*;
use std;
use camera;
#[path = "tuto-07-teapot.rs"]
pub mod teapot;
#[derive(Copy, Clone)]
struct Vertex {
position: [f32; 2],
tex_coords: [f32; 2],
}
implement_vertex!(Vertex, position, tex_coords);
static VERTEX_SHADER_SRC:&str = r#"
#version 140
in vec3 p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.