text stringlengths 3.09k 13.9k |
|---|
use casper_dao_erc721::{
core::ERC721Token, BurnableERC721, MetadataERC721, MintableERC721, TokenId, TokenUri,
};
use casper_dao_modules::AccessControl;
use casper_dao_utils::{
casper_contract::unwrap_or_revert::UnwrapOrRevert,
casper_dao_macros::{casper_contract_interface, Instance},
casper_env::{self,... |
use winapi::ctypes::c_char;
use winapi::shared::minwindef::*;
use winapi::um::{sysinfoapi, winbase};
mod disk;
mod network_interfaces;
mod socket;
use super::common::*;
use data::*;
use std::ffi::CStr;
use std::slice::from_raw_parts;
use std::{io, mem, path};
fn u16_array_to_string(p: *const u16) -> String {
us... |
// 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 writi... |
use core::{convert::TryFrom, fmt::Display, fmt, fmt::Formatter};
/// A dynamically typed value that may be passed back and forth across the
/// runtime.
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd)]
#[non_exhaustive]
pub enum Value {
Byte(u8),
Short(i16),
Integer(i32),
Float(f32),
SignedByte... |
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
// This file is part of Open Ethereum.
// Open Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your o... |
// A demonstration of drawing to a very large texture, capturing the texture in its original size
// as a PNG and displaying a down-scaled version of the image within the window each frame.
use nannou::prelude::*;
fn main() {
nannou::app(model).update(update).exit(exit).run();
}
struct Model {
// The texture... |
use std::{fmt, collections::HashMap, ops::Sub};
use flume::{Sender, Receiver, TrySendError};
use futures::executor::block_on;
use indexmap::IndexMap;
use itertools::Itertools;
use rust_shared::time_since_epoch_ms;
use serde::Serialize;
use serde_json::json;
use tracing::{Level, error, Subscriber, Metadata, subscriber:... |
// Copyright 2015 The GeoRust 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... |
//! A wrapper around a Cairo image surface.
use std::{default::Default, fs::File, io::Write};
use cairo::{Format, ImageSurface};
use glib::translate::ToGlibPtr;
use rlua::{self, LightUserData, Lua, Table, UserData, UserDataMethods, Value};
use tempfile;
use wlroots::{Area, Origin, Size};
use common::{class::{self, C... |
// Copyright 2020 The Chromium OS 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 std::marker::PhantomData;
use std::process::exit;
use getopts::{self, Matches, Options};
use thiserror::Error as ThisError;
use crate::transport:... |
#![allow(dead_code)]
mod closable_tab {
use fltk::{
app, button,
enums::{Align, Color, FrameType},
group,
prelude::*,
};
#[derive(Copy, Clone)]
pub enum Message {
Foreground(i32),
Delete(i32),
InsertNew(i32),
}
fn create_tab_button(label... |
use super::mtl::Mtl;
use super::parse_vec2;
use super::parse_vec3;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::convert::TryInto;
use std::io::Read;
use vkm::Vec2f;
use vkm::Vec3f;
enum Token {
MtlLib(String),
Vert(Vec3f),
Norm(Vec3f),
UV(Vec2f),
Group(String),
Usemtl(String),
Smoot... |
use scraper::Html;
use scraper::Selector;
use serde::Deserialize;
use std::collections::HashMap;
use crate::saml::SAMLAssertion;
use crate::ui::UI;
pub struct MfaFactor {
pub provider: String,
pub factor_type: String,
pub link: String,
}
impl MfaFactor {
pub fn new(provider: &str, factor_type: &str,... |
#![feature(negative_impls)]
#![feature(future_poll_fn)]
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
#![deny(unused_must_use)]
use parking_lot::Mutex;
use parking_lot::MutexGuard;
use std::future::Future;
use core::mem;
use std::ptr::null;
use std::collections::VecDeque;
use std::task::{W... |
// Copyright 2015 The Rust-Windows Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// 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/MI... |
use super::MarkResult;
extern crate libc;
use std::collections::BTreeSet;
use std::ffi::*;
pub struct Process {
exe: CString,
args: Vec<CString>,
pid: Option<libc::pid_t>,
pub stdin: i32,
pub stdout: i32,
pub reason: MarkResult,
pub m_time: Option<libc::rlim_t>
}
impl... |
/*
Advent of Code 2020
<NAME>
Day 11 Solution
2020-12-11
*/
use aoc2020::util::file_to_vec;
use std::fmt;
const DIRECTIONS: &[(isize, isize)] =
&[(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)];
#[derive(Clone, Debug)]
struct SeatMap {
rows: usize,
cols: usize,
s... |
//! Maximized Minimal Distance Sampler.
use core::app::OPTIONS;
use core::geometry::*;
use core::low_discrepency::*;
use core::paramset::*;
use core::pbrt::*;
use core::sampler::*;
use std::sync::Arc;
/// Implements a sampler that can generate (0, 2)-sequences but also maximizes
/// the distance between samples.
pub ... |
use druid::piet::Color;
use druid::{
kurbo::Line,
piet::{
FontFamily, FontWeight, PietText, PietTextLayout, Text, TextAttribute,
TextLayout, TextLayoutBuilder,
},
Env, PaintCtx, Point, RenderContext,
};
use std::cmp::min;
const BACKGROUND: Color = Color::rgb8(0x28, 0x28, 0x28);
const FO... |
use std::{env, sync::Once, time::Duration};
use anyhow::{ensure, Result};
use obws::{
requests::SceneItem,
responses::{Output, Profile, Scene, SceneCollection, SourceListItem, Transition},
Client,
};
use tokio::time;
pub const TEST_OUTPUT: &str = "virtualcam_output";
pub const TEST_COLLECTION: &str = "OBW... |
use std::fmt;
use std::collections::HashSet;
use std::fs::File;
use std::io::{self, BufReader, BufRead};
use std::error::Error;
use std::{result, convert};
const MAX_KMER_LENGTH: usize = 32;
#[derive(Debug)]
pub enum KmerError {
InvalidBaseError(char),
LengthError(usize),
Io(io::Error),
BadKmerFile(us... |
//! UI elements showing file-related information
use eframe::egui;
use crate::{dfudev, DfuFileChecks, Message};
/// Show box with file selection
pub fn selection(
ui: &mut egui::Ui,
selected_file: &Option<dfufile::DfuFile>,
message_sender: &std::sync::mpsc::Sender<Message>,
) {
let file_path = select... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::client::Client,
crate::object::{ObjectRef, RequestReceiver},
anyhow::Error,
fidl_fuchsia_math::Size,
fidl_fuchsia_ui_compo... |
// 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 {
crate::{
action_match::query_text_match, mod_manager::ModManager, models::Suggestion,
story_context_store::ContextEntity,
},
... |
use super::halfedge::HalfEdgeMesh;
use crate::prelude::*;
/// Loads a wavefront obj file from a given path and returns a Rend3 mesh
/// @CopyPaste from wavefront_obj.rs
fn load_obj_mesh(path: &str) -> r3::Mesh {
use std::fs::File;
use std::io::BufReader;
use wavefront_rs::obj;
use wavefront_rs::obj::en... |
// TODO: Remove this when announces are implemented
#![allow(unused)]
use bip_bencode::{Bencode, BencodeConvert, Dictionary};
use bip_util::bt::{InfoHash, NodeId};
use crate::error::DhtResult;
use crate::message;
use crate::message::request::{self, RequestValidate};
const PORT_KEY: &str = "port";
const IMPLIED_PORT_... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
//! Generate third-party metadata corresponding to METADATA.bzl
use anyhow::Result;
use serde::{Serialize, Serializer};
use std:... |
use itertools::Itertools;
use lazy_static::lazy_static;
use crate::db::fetch::Fetch;
use super::*;
use std::collections::HashMap;
/// Get statistics on what the community uses.
#[command]
#[only_in(guilds)]
#[usage("top [field-name] [`regex`]")]
#[example("!top")]
#[example("!top Editor")]
#[example("!top Editor `n?... |
//! Creates and prints particle distribution functions
//! and other output
use std::fmt;
use std::str::FromStr;
#[cfg(feature = "with-mpi")]
use mpi::traits::*;
#[cfg(not(feature = "with-mpi"))]
use crate::no_mpi::*;
use crate::particle::*;
mod error;
use error::*;
mod hgram;
use hgram::*;
mod functions;
mod st... |
//! The [`Interpolate`] trait and associated symbols.
//!
//! The [`Interpolate`] trait is the central concept of the crate. It enables a spline to be
//! sampled at by interpolating in between control points.
//!
//! In order for a type to be used in [`Spline<K, V>`], some properties must be met about the `K`
//! type... |
use crate::LOOPS;
use crate::bench_fb::benchfb::get_root_as_foo_bar_container;
use crate::bench_fb::benchfb::FooBarContainerArgs as FooBarContainerArgsFB;
use crate::bench_fb::benchfb::FooBarContainer as FooBarContainerFB;
use crate::bench_fb::benchfb::FooBarArgs as FooBarArgsFB;
use crate::bench_fb::benchfb::FooBar as... |
use std::fs::File;
use std::fs;
use std::io::Read;
use std::path::{Path, PathBuf};
use crate::fighter::Fighter;
use crate::wii_memory::WiiMemory;
use crate::wiird::WiiRDBlock;
use crate::wiird;
use crate::wiird_runner;
use crate::arc;
use failure::Error;
use failure::bail;
use fancy_slice::FancySlice;
/// This is v... |
use algo::graph::directed::{
DepthFirstOrders, Digraph, DirectedCycle, DirectedDFS, KosarajuSCC, Topological,
TransitiveClosure,
};
use algo::graph::util::{BreadthFirstPaths, DepthFirstPaths, Paths, SymbolGraph};
use algo::graph::IGraph;
const TINY_DG: &'static str = include_str!("../res/graph/tinyDG.txt");
co... |
/*
Copyright <NAME>. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
use super::FeldmanVerifier;
use crate::{
util::{bytes_to_field, get_group_size},
Share,
};
use core::{fmt, marker::PhantomData};
use ff::PrimeField;
use group::{Group, GroupEncoding, ScalarMul};
use serde::{
de::{Error... |
use std::sync::{Arc, Mutex};
use anomaly::BoxError;
use crossbeam_channel as channel;
use futures::{stream::select_all, Stream};
use itertools::Itertools;
use tokio::runtime::Runtime as TokioRuntime;
use tokio::stream::StreamExt;
use tokio::task::JoinHandle;
use tracing::{debug, error, info};
use ibc::{events::IBCEv... |
use crate::config::Config;
use crate::system::{Result, FileNotFoundError};
use regex::Regex;
use std::collections::HashSet;
use std::process::Stdio;
use tokio::fs::File;
use tokio::io::{AsyncBufRead, AsyncBufReadExt, BufReader};
use tokio::process::Command;
const GET_DOMAIN_REGEX: &str =
"address /([a-zA-Z0-9][-a-... |
use crate::apple_photos::Fromable;
use rusqlite::Result;
use rusqlite::Row;
#[derive(Debug)]
pub struct Master {
pub model_id: i32,
pub uuid: String,
pub fingerprint: String,
pub orientation: i32,
pub name: String,
pub create_date: f64,
pub is_in_trash: i32,
pub in_trash_date: f64,
... |
#![warn(missing_docs)]
//!
//! Mid-level modular abstractions of common graphics concepts such as buffer, texture, program, render target and so on.
//! Can be combined with low-level calls in the `context` module as long as any graphics state changes are reset.
//!
use crate::context::GLContext;
use std::cell::RefCel... |
//
// Copyright (c) Dell Inc., or its subsidiaries. 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 at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
#![allow(dead... |
use super::{
cursor::CharCursor,
graphic_rendition::{self, Sgr},
};
fn cursor_skip_space(cursor: &mut CharCursor) {
// skip: !"#$%&'()*+,-./ (SPACE)
cursor.read_while(|c| matches!(c, '\u{0020}'..='\u{002f}'));
}
/// ANSI Escape Sequence.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enu... |
extern crate kernel32;
extern crate user32;
extern crate winapi;
extern crate libc;
extern crate gdi32;
use winapi::windef::HWND;
use winapi::windef::HMENU;
use winapi::windef::HBRUSH;
use winapi::minwindef::HINSTANCE;
use winapi::minwindef::UINT;
use winapi::minwindef::DWORD;
use winapi::minwindef::WPARAM;
use winap... |
fn hex2nibble(hex : u8) -> Result<u8, ()> {
match hex {
0x30u8 ... 0x39u8 => Ok(hex - 0x30u8),
0x41u8 ... 0x46u8 | 0x61u8 ... 0x66u8 => Ok((hex & !0x20u8) - 0x37),
_ => Err(()),
}
}
fn hex2octets(hex: Vec<u8>) -> Vec<u8> {
let mut octets : Vec<u8> = Vec::with_capacity(&hex.len() / 2... |
use crate::display::Display;
use crate::{audio, dma, idle, input, usb_logger};
use embedded_hal::adc::OneShot;
use embedded_hal::digital::v2::OutputPin;
use embedded_time::rate::*;
use rp2040_hal::gpio::dynpin::DynPin;
use rp2040_hal::gpio::pin::bank0::Gpio26;
use rp2040_hal::gpio::pin::{FloatingInput, Pin};
use rp2040... |
pub mod types;
use crate::opts::types::Opts;
use types::{Connection, ConnectionSet, ControlEvent};
use termion::{raw::IntoRawMode, screen::AlternateScreen};
use tui::{
backend::TermionBackend,
layout::{Constraint, Direction, Layout},
text::{Span, Spans},
widgets::{Block, Borders, List, ListItem},
... |
//! This module contains DataFusion utility functions and helpers
use arrow_deps::datafusion::{
logical_plan::Expr, logical_plan::LogicalPlan, logical_plan::Operator, optimizer::utils::inputs,
};
use std::io::Write;
/// Encode the traversal of an expression tree. When passed to
/// `visit_expression`, `ExpressionV... |
#[derive(Debug, Default)]
pub struct DateTime {
seconds: u8,
minutes: u8,
hours: u8,
day: u8,
weekday: u8,
month: u8,
year: u64,
timestamp: u64,
}
use std::time::SystemTime;
impl DateTime {
/// Create a new `DateTime` with the current date and time in UTC.
///
/// ```rust
... |
use std::cell::RefCell;
use std::collections::VecDeque;
use std::io;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use bytes::{BufMut, BytesMut};
use database::{Context as DbContext, Database, Token, WorkerMsg};
use futures::sync::mpsc as fmpsc;
use futures::{Future, Sink, Stream};
use tokio_codec as codec;
use tokio_... |
use crate::clients::{Parameters, ReadRequest, VoteClient, WriteRequest};
use mysql_async::prelude::*;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use tower_service::Service;
pub(crate) struct Conn {
pool: mysql_async::Pool,
next: Option<mysql_async::Conn>,
pending: Option<m... |
use std::collections::HashMap;
#[derive(Clone, Debug)]
enum Rule {
Literal(char),
And(Vec<usize>),
Or(Vec<Rule>),
}
impl Rule {
fn create_from(r: &[&str]) -> Rule {
if r.len() == 1 && r[0].starts_with('"') {
return Rule::Literal(r[0].chars().nth(1).unwrap());
}
if l... |
extern crate gl;
extern crate glfw;
extern crate cgmath;
#[macro_use]
mod engine;
mod lang;
use std::ptr;
use std::mem;
use std::os::raw::c_void;
use std::ffi::CStr;
use gl::types::*;
use cgmath::prelude::*;
use engine::camera::Camera;
use engine::window::Window;
use engine::shader::Shader;
use lang::{ObjectPar, Obj... |
// These tests mock out an organizational pattern that we hope to use in Deno.
// There we want to wrap v8::Isolate to provide extra functionality at multiple
// layers: v8::Isolate -> CoreIsolate -> EsIsolate
// This demonstrates how this can be done in a safe way.
use std::ops::Deref;
use std::ops::DerefMut;
use std... |
use crate::{ipc::cmif::sf, mem, result::*, util};
use crate::ipc::cmif::sf::{applet, mii};
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
#[repr(C)]
pub struct DeviceHandle {
pub npad_id: u32,
pub reserved: [u8; 4],
}
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[repr(u32)]
pub enum State {
NonIn... |
extern crate process_memory;
extern crate sysinfo;
/* For reading remote memory */
use process_memory::{Memory, DataMember, Pid, TryIntoProcessHandle};
/* For finding the fm.exe process */
use sysinfo::{ProcessExt, SystemExt};
/* For measuring execution time */
use std::time::Instant;
/* Interact with a running FM20 ... |
use super::err::CliError;
use std::{env, path::PathBuf};
/// Rudimentary argument parsing and user configuration.
///
/// This approach is not very general or particularly robust, but it has the
/// benefit of being lighter than crates such as *clap*.
///
/// Programs should make use of Config's default implementation... |
use rand::{thread_rng, Rng};
use std::ops::Index;
use std::io::stdout;
use crossterm::ExecutableCommand;
use crossterm::style::{SetAttribute, Attribute, Print, ResetColor, SetForegroundColor, Color, SetBackgroundColor};
use crate::component::{RefreshableComponent};
use crate::game::COIN_COUNT;
type GameFieldDataType =... |
// Copyright (c) 2016-2020 Chef Software Inc. and/or applicable contributors
//
// 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
//
// Unl... |
//! An embedded_hal driver for the Si446x family by Silicon Labs
//!
//! Currently only handles packet mode using the built-in FIFOs. Configuration is still generated by WDS,
//! eventually we probably want a macro to configure the radio. Also this is currently only usable for blocking IO,
//! futures and async/await o... |
//! helper methods to work with ipfs/ipld
use anyhow::{anyhow, Result};
use banyan::store::{BlockWriter, ReadOnlyStore};
use futures::prelude::*;
use libipld::Cid;
use serde::{de::IgnoredAny, de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
use std::{convert::TryInto, fmt, str::FromStr};
use crate::tags... |
//! ## rs-tiled demo with SFML
//! --------------------------
//! Displays a map, use WASD keys to move the camera around.
//! Only draws its tile layers and nothing else.
mod mesh;
mod tilesheet;
use mesh::QuadMesh;
use sfml::{
graphics::{BlendMode, Color, Drawable, RenderStates, RenderTarget, RenderWindow, Tran... |
// Implementation note: hyper's API is not adapted to async/await at all, and there's
// unfortunately a lot of boilerplate here that could be removed once/if it gets reworked.
//
// Additionally, despite the fact that hyper is capable of performing requests to multiple different
// servers through the same `hyper::Cli... |
use super::types::{Block, BlockMeta, Message, PeerReader, PeerWriter};
use async_trait::async_trait;
use bitvec::prelude::*;
use bytes::BytesMut;
use snafu::{ensure, Snafu};
use std::io;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt, BufReader, BufWriter},
net::{tcp, TcpStream},
};
pub async fn create_tcp_peer... |
#[macro_use]
extern crate log;
extern crate rand;
pub mod parser;
pub mod map;
use std::sync::mpsc::{Receiver, Sender, channel};
use parser::{Message, SettingsValue, SetupMapValue, OpponentMoveValue, parse};
use rand::{thread_rng, sample};
pub struct Bot {
settings: Option<Settings>,
setting_buffer: Vec<pars... |
#[macro_use]
extern crate lazy_static;
use error::{Error, TraceResult};
use std::{
io::{self, Write},
path::Path,
thread,
time::{Duration, Instant},
};
mod args;
mod commands;
mod error;
mod sip_parse;
mod ssh;
fn main() -> TraceResult<()> {
let matches = args::get_args();
let host = matches... |
use crate::{
algebra::abstr::Real,
statistics::{
distrib::{Continuous, Normal, T as TD},
test::Test,
},
special::gamma::Gamma,
special::beta::Beta,
special::error::Error,
};
use crate::special::hypergeometric::Hypergeometric;
use std::clone::Clone;
#[cfg(feature = "serde")]
use ... |
/*
WebServe (Rust port)
Copyright 2021 <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 w... |
use crate::{logging, mssql, mysql, postgres, Capabilities, Tags};
use enumflags2::BitFlags;
use once_cell::sync::Lazy;
use quaint::single::Quaint;
use std::{fmt::Display, io::Write as _};
#[derive(Debug)]
pub(crate) struct DbUnderTest {
capabilities: BitFlags<Capabilities>,
database_url: String,
shadow_dat... |
#![cfg(feature = "json-rpc-db")]
extern crate reqwest;
use std::{cell::RefCell, collections::HashMap, env};
use ptokens_core::{AppError as PTokensCoreError, Bytes, DatabaseInterface, Result as PTokensResult};
use reqwest::blocking::Client;
use serde_json::{json, Value as JsonValue};
use crate::{
types::{DataSensi... |
use std::convert::{TryFrom, TryInto};
use regex::Regex;
use serde::{Serialize, Deserialize};
use structopt::StructOpt;
use crate::{logging::*, prelude::*, types::*};
#[derive(StructOpt, Debug, Deserialize)]
pub struct Opts {
#[structopt(flatten)]
pub geo: GeoOpts,
#[serde(flatten)]
#[structopt(flatt... |
use std::collections::HashMap;
use std::convert::From;
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
use std::{
hash::Hash,
sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex, TryLockError,
},
time::Duration,
};
use log::trace;
#[derive(Debug)]
pub enum CacheError {
... |
// Copyright (C) 2019-2020 <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... |
//! Advent of Code - Day 22 Solution
use error::Result;
use ndarray::Array2;
use std::io::BufRead;
/// The direction the virus is facing.
#[derive(Debug, PartialEq)]
enum Direction {
/// Up
Up,
/// Down
Down,
/// Left
Left,
/// Right
Right,
}
/// The current state of the coord.
#[deriv... |
use std::ops::{Index, IndexMut};
use crate::{
f32s, f64s,
sparse::SparseVector,
svm::{DenseSVM, SparseSVM},
vectors::Triangular,
};
use simd_aligned::{MatrixD, Rows, VectorD};
/// Problems produced for [`DenseSVM`]s.
///
/// Also see [`Problem`] for more methods for this type.
pub type DenseProblem =... |
use std::convert::{Infallible, TryInto};
use std::io;
use env_var_helpers::env_vars;
use isocountry::CountryCode;
use onfido_openapi::apis::ResponseContent;
use crate::convert::ToApi;
use crate::exports::models::SdkToken;
use crate::exports::{api, models, ApiError, ApiKey, Configuration};
use crate::types::{CreatedAp... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Watchdog Control and Status Register 1"]
pub cs1: crate::Reg<cs1::CS1_SPEC>,
#[doc = "0x01 - Watchdog Control and Status Register 2"]
pub cs2: crate::Reg<cs2::CS2_SPEC>,
_reserved_2_cntl: [u8; 2usize],
_reserved_3_t... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - TimerAx Control Register"]
pub tax_ctl: TAXCTL,
#[doc = "0x02 - Timer_A Capture/Compare Control Register"]
pub tax_cctl: [TAXCCTL; 5],
_reserved2: [u8; 4usize],
#[doc = "0x10 - TimerA register"]
pub tax_r: TAXR,... |
extern crate hex;
extern crate crypto;
extern crate sabre_sdk;
use self::sabre_sdk::TransactionContext;
use self::sabre_sdk::ApplyError;
use self::sabre_sdk::TransactionHandler;
use self::sabre_sdk::TpProcessRequest;
use self::sabre_sdk::{WasmPtr, execute_entrypoint};
use self::crypto::sha2::Sha512;
use handler::cryp... |
use crate::{
dval,
dval::{Dval_::*, *},
errors::Error::*,
expr::Expr,
runtime::*,
};
use futures::future::{join_all, BoxFuture, FutureExt};
use itertools::Itertools;
use macros::stdlibfn;
use std::sync::Arc;
pub struct ExecState {
pub caller: Caller,
}
pub async fn run(state: &ExecState, body: Expr) -> Dv... |
use crate::solang_ext::*;
use itertools::Itertools;
use solang_parser::pt::*;
/// The type of a Comment
#[derive(Debug, Clone, Copy)]
pub enum CommentType {
/// A Line comment (e.g. `// ...`)
Line,
/// A Block comment (e.g. `/* ... */`)
Block,
}
/// The comment position
#[derive(Debug, Clone, Copy)]
p... |
use std::collections::HashMap;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone)]
pub struct GlobalEnv {
pub is_nvim: bool,
pub enable_icon: bool,
pub preview_config: PreviewConfig,
}
#[derive(Debug, Clone)]
pub enum PreviewConfig {
Number(u64),
... |
/*
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, software
distribu... |
use ros_message::{MessageValue, Time, Value};
use rosrust::{DynamicMsg, Message};
mod msg {
rosrust::rosmsg_include!(geometry_msgs / PoseArray);
}
fn make_message() -> DynamicMsg {
DynamicMsg::new(
"geometry_msgs/PoseArray",
&msg::geometry_msgs::PoseArray::msg_definition(),
)
.unwrap()... |
// Copyright (c) Facebook, Inc. and its affiliates
// SPDX-License-Identifier: MIT OR Apache-2.0
use crate::{core, graph, net, store, Check, Eval, Graph1, GraphN};
use arrayfire as af;
/// Generic trait for an algebra implementing all known operations over `af::Array<T>` (and `T`) for a
/// given float type `T`.
pub ... |
use crate::types::*;
use crate::Register;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Instruction {
// LUI
Lui(UType),
// Jal
Jal(JType),
// Jalr
Jalr(IType),
// Branch
Beq(BType),
// Load
Ld(IType),
// Store
Sd(SType),
// OP-imm
Addi(IType)... |
use std::time::Instant;
use sfml::graphics::{
RenderWindow, Font, Color, Text, Transformable, RenderTarget,
};
use crate::cell_grid::{CellGrid, Ant};
pub struct AppState<'s> {
pub delta_time: f64,
pub time_elapsed: f64,
pub fps: f32,
font: &'s Font,
pub window: &'s mut RenderWindow,
pub bg... |
pub mod error;
pub mod requests;
pub mod responses;
use std::sync::Arc;
use log::{debug, error, info};
use uuid::Uuid;
use crate::document::Document;
use crate::utils::sha256;
use crate::{
metrics,
moderation::{ModerationService, SupportedMimeTypes},
proxy::Context,
rpc::error::Errors,
};
use reques... |
//! Types for conveniently constructing TorClients.
#![allow(missing_docs, clippy::missing_docs_in_private_items)]
use crate::{err::ErrorDetail, BootstrapBehavior, Result, TorClient, TorClientConfig};
use fs_mistrust::Mistrust;
use std::sync::Arc;
use tor_dirmgr::DirMgrConfig;
use tor_rtcompat::Runtime;
/// An objec... |
use std::time::{Instant, SystemTime};
use rayon::prelude::*;
use crate::{individual::Individual, population::Population, statistics::Statistics, Neat};
pub use self::progress::Progress;
mod progress;
pub struct Runtime<'a> {
neat: &'a Neat,
population: Population,
statistics: Statistics,
}
impl<'a> Ru... |
use snafu::Snafu;
mod config;
mod service;
mod sink;
pub use config::VectorConfig;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub))]
pub enum VectorSinkError {
#[snafu(display("Request failed: {}", source))]
Request { source: tonic::Status },
#[snafu(display("Vector source unhealthy"))]
Health,
... |
mod messager;
use std::ops::Deref;
use std::rc::{Rc, Weak};
use std::cell::RefCell;
use crate::List::{Cons, Nil};
use crate::SList::{SCons, SNil};
use crate::SMList::{SMCons, SMNil};
use crate::AList::{ACons, ANil};
struct MyBox<T>(T);
impl<T> MyBox<T> {
fn new(x: T) -> MyBox<T> { MyBox(x) }
}
impl<T> Deref for ... |
use itertools::{iproduct, Itertools};
use rand::Rng;
use rayon_adaptive::Policy;
use rayon_adaptive::{
adaptive_sort_no_copy_with_policies, adaptive_sort_raw_cut_ceil_with_policies,
adaptive_sort_raw_cut_floor_with_policies, adaptive_sort_raw_cut_with_policies,
adaptive_sort_raw_with_policies, adaptive_sort... |
use diesel::prelude::*;
use diesel::query_dsl::methods::LoadQuery;
use diesel::query_builder::*;
use diesel::pg::Pg;
use diesel::sql_types::{BigInt, Integer};
use rocket::request::{FromForm, FormItems};
// An implementation of keyset paging against postgres. For more info, see
// https://www.citusdata.com/blog/2016/0... |
use crate::{list_crate, ConfigFile, CrateDetail};
use colored::*;
use std::{fs, path::Path};
// Stores .cargo/registry cache & src information
pub(crate) struct RegistryDir {
cache_dir: String,
src_dir: String,
index_cache_dir: Vec<String>,
installed_crate: Vec<String>,
dry_run: bool,
}
impl Regis... |
#![no_std]
#![no_main]
#![deny(warnings)]
extern crate cortex_m;
extern crate cortex_m_rt as rt;
extern crate panic_halt;
extern crate rtic;
extern crate stm32g0xx_hal as hal;
mod board;
mod game;
mod sprites;
mod wiring;
use hal::exti::Event;
use hal::gpio::*;
use hal::i2c::*;
use hal::prelude::*;
use hal::stm32;
u... |
use super::*;
use crate::reporters::TestReporter;
use rslint_parser::Syntax;
use std::fmt::Debug;
use std::panic::RefUnwindSafe;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;
use yastl::Pool;
#[derive(Debug)]
pub(crate) struct TestRunResult {
pub(crate) outcome: TestRunOutcome,
pub(crate) code: String,... |
use std::convert::TryFrom;
#[derive(Debug, Deserialize, Serialize)]
pub struct FlattenedJWS {
pub payload: String,
pub protected: String,
pub signature: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct JWSProtectedHeader {
pub alg: String,
#[serde(default, skip_serializing_if = "Optio... |
use strum::IntoEnumIterator;
use num_enum::{ IntoPrimitive, TryFromPrimitive };
use strum_macros::{ EnumString, Display, AsRefStr, IntoStaticStr };
/// LoL and TFT ranked tiers, such as gold, diamond, challenger, etc.
///
/// Sorts from lowest rank to highest rank.
///
/// Repr'd as arbitrary `u8` values.
///
/// Impl... |
/* ************************************************************************ **
** This file is part of rsp2, and is licensed under EITHER the MIT license **
** or the Apache 2.0 license, at your option. **
** **
** ... |
// LNP Node: node running lightning network protocol and generalized lightning
// channels.
// Written in 2020 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
// the public domain worldwide. This ... |
use bytes::BytesMut;
use chrono::{self, offset, DateTime, Utc};
use futures::Stream;
use futures::{future, Async, Future, Poll};
use std::collections::HashMap;
use std::convert::TryFrom;
use std::error::Error;
use std::net::SocketAddr;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use tokio_tcp::TcpListener;
us... |
//! A module defining error types specific to binance.
use std::fmt;
use hyper::StatusCode;
use failure_derive::Fail;
use serde_derive::Deserialize;
use crate::api;
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Deserialize)]
pub(super) struct BinanceRestError<'a> {
code: i32,
msg: &'a str,
}
#[derive(Clo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.