text stringlengths 8 4.13M |
|---|
use simple_pdf::{graphics, Page, PDF};
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut pdf = PDF::from_file(File::create("simple")?);
let mut page = Page::new(); // Page builder
page.add(
graphics::Path::from((10f64, 10f64))
.line_to((200f64, 200f64))
.rect((10... |
// Copyright 2022 Datafuse Labs.
//
// 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 ... |
use super::socket::UdpSocket;
use std::io;
use std::net::SocketAddr;
use futures::{Async, Future, Poll};
/// A future used to receive a datagram from a UDP socket.
///
/// This is created by the `UdpSocket::recv_dgram` method.
#[must_use = "futures do nothing unless polled"]
#[derive(Debug)]
pub struct RecvDgram<T> ... |
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license.
use super::{Context, LintRule, ProgramRef, DUMMY_NODE};
use derive_more::Display;
use once_cell::sync::Lazy;
use regex::{Matches, Regex};
use swc_common::{hygiene::SyntaxContext, BytePos, Span};
use swc_ecmascript::ast::Str;
use swc_ecmascript::... |
//! Contains starknet transaction related code and __not__ database transaction.
use anyhow::Context;
use pathfinder_common::{BlockHash, BlockNumber, TransactionHash};
use starknet_gateway_types::reply::transaction as gateway;
use crate::{prelude::*, BlockId};
pub enum TransactionStatus {
L1Accepted,
L2Accep... |
use crate::ast;
use crate::{Parse, Spanned, ToTokens};
/// A literal expression.
#[derive(Debug, Clone, PartialEq, Eq, Parse, ToTokens, Spanned)]
#[rune(parse = "meta_only")]
pub struct ExprLit {
/// Attributes associated with the literal expression.
#[rune(iter, meta)]
pub attributes: Vec<ast::Attribute>,... |
use crate::{
Result,
backend::Backend,
lifecycle::{Event, State, Window},
};
#[cfg(not(target_arch = "wasm32"))]
use std::{thread, time::{SystemTime, UNIX_EPOCH, Duration}};
#[cfg(target_arch = "wasm32")]
use stdweb::web::Date;
pub struct Application<T: State> {
pub state: T,
pub window: Window,
... |
use super::*;
pub use std::collections::BTreeMap;
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub enum TypeInclude {
Full,
Minimal,
None,
}
impl Default for TypeInclude {
fn default() -> Self {
Self::None
}
}
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Default)]
pub struct ... |
use std::io::prelude::*;
use std::str::FromStr;
fn ans(i:Vec<f64>) -> (f64,f64,f64) {
let x1 = i[0];
let y1 = i[1];
let x2 = i[2];
let y2 = i[3];
let x3 = i[4];
let y3 = i[5];
let a2 = x1.powf(2.0) - x2.powf(2.0);
let b2 = 2.0 * (x1-x2);
let c2 = y1.powf(2.0) - y2.powf... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
//! This module contains a timer object, bevy-systems for updating (using)
//! the timer, and run-criterias that uses this timer.
//!
pub mod scenario_intervals;
pub mod scenario_timer;
|
// This file is part of file-descriptors. 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/file-descriptors/master/COPYRIGHT. No part of file-descriptors, including this file, may be copied, modified, propag... |
use smart_pointer::ref_cell_demo::List::{Cons, Nil};
use std::cell::RefCell;
use std::rc::Rc;
pub fn hello_ref_cell() {
ref_cell_demo();
}
pub trait Messenger {
fn send(&self, msg: &str);
}
pub struct LimitTracker<'a, T: 'a + Messenger> {
messenger: &'a T,
value: usize,
max: usize,
}
impl<'a, T>... |
//! Parse the Linux vDSO.
//!
//! The following code is transliterated from
//! tools/testing/selftests/vDSO/parse_vdso.c in Linux 5.11, which is licensed
//! with Creative Commons Zero License, version 1.0,
//! available at <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
//!
//! # Safety
//!
//! Parsing ... |
use crate::row::{ColumnIndex, Row};
use crate::sqlite::statement::Statement;
use crate::sqlite::value::SqliteValue;
use crate::sqlite::{Sqlite, SqliteConnection};
use serde::de::DeserializeOwned;
#[derive(Debug)]
pub struct SqliteRow<'c> {
pub(super) values: usize,
pub(super) statement: Option<usize>,
pub(... |
extern crate multipart;
extern crate iron;
extern crate env_logger;
use std::io::{self, Write};
use multipart::mock::StdoutTee;
use multipart::server::{Multipart, Entries, SaveResult};
use iron::prelude::*;
use iron::status;
fn main() {
env_logger::init();
Iron::new(process_request).http("loca... |
mod result;
mod plugin;
use log::{debug};
use result::Result;
use plugin::Plugin;
use std::ffi::OsStr;
use std::path::Path;
/// The Quantum Core
#[derive(Debug)]
pub struct Quantum {
plugin_dir: String,
plugins: Vec<Plugin>,
}
impl Quantum {
/// Creates a new Quantum instance
pub fn new() -> Quantum... |
use super::Grip;
use super::Menu;
use super::Side;
use super::System;
use super::Touchpad;
use super::Trigger;
use super::Vive;
use button::Button;
use openvr_sys::TrackedDevicePose_t;
use openvr_sys::VRControllerState_t;
use std::f32;
use std::u32;
const INVALID_INDEX: u32 = u32::MAX;
const INVALID_POSITION: (f32, f3... |
use fake::Dummy;
use stark_hash::Felt;
use crate::{ToProtobuf, TryFromProtobuf};
use super::common::{BlockBody, BlockHeader};
use super::proto;
#[derive(Debug, Clone, PartialEq, Eq, Dummy)]
pub enum Request {
GetBlockHeaders(GetBlockHeaders),
GetBlockBodies(GetBlockBodies),
GetStateDiffs(GetStateDiffs),
... |
fn read_line() -> String {
let mut buf = String::new();
std::io::stdin().read_line(&mut buf).expect("failed to readline");
buf
}
fn create_num_vec() -> Vec<i64> {
let buf = read_line();
let iter = buf.split_whitespace().map(|x| x.parse().expect("unable to parse"));
let num_vec : Vec<i64> = it... |
use std::{io, i32};
use std::sync::atomic::{AtomicI32, Ordering};
use sys::{futex_wait, futex_wake};
pub struct RwFutex {
readers: AtomicI32,
writers_queued: AtomicI32,
writers_wakeup: AtomicI32,
}
//rconst WRITER_LOCKED: i32 = i32::MIN;
const WRITER_LOCKED_READERS_QUEUED: i32 = i32::MIN + 1;
impl RwFute... |
use std::collections::VecDeque;
use input_i_scanner::InputIScanner;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $... |
use crate::ast::{Tm, TmRef, Ty, TyRef};
use crate::tcm::{TCM, TCS};
pub fn infer(tcs: &mut TCS, tm: TmRef) -> TCM<TyRef> {
let ty_exh_size = tcs.ty_exh.size();
let rules = [var_rule, abs_rule, app_rule, gen_rule, inst_rule];
for rule in rules.iter() {
if let Ok(ty) = rule(tcs, tm) {
ret... |
use crate::split_whitespace_and_convert_to_i64;
fn number_increasing(last: impl Iterator<Item = i64>, cur: impl Iterator<Item = i64>) -> usize {
cur.zip(last).fold(0, |increasing_count, (cur, last)| {
if cur > last {
increasing_count + 1
} else {
increasing_count
}
... |
use std::env;
use std::fmt::{self, Debug, Formatter};
/// S3 credentials
#[derive(Clone, PartialEq, Eq)]
pub struct Credentials {
key: String,
secret: String,
}
impl Credentials {
/// Construct a new `Credentials` using the provided key and secret
#[inline]
pub fn new(key: String, secret: String) ... |
native "rust" mod rustrt {
fn task_sleep(time_in_us: uint);
fn task_yield();
fn task_join(t: task) -> int;
fn unsupervise();
fn pin_task();
fn unpin_task();
fn clone_chan(c: *rust_chan) -> *rust_chan;
type rust_chan;
fn set_min_stack(stack_size: uint);
}
/**
* Hints the scheduler... |
use allegro::{Color};
use allegro_font::{Font, FontAlign, FontDrawing};
use std::u8;
#[no_mangle]
pub struct Loading {
pub base_text: String,
/// The number of dots to display.
pub dot_count: i8,
/// The number of dots after which they will be reset to 0.
pub dot_max: i8,
/// Number of frames b... |
use procon_reader::ProconReader;
use union_find::UnionFind;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: usize = rd.get();
let a: Vec<usize> = rd.get_vec(n);
let mut uf = UnionFind::new(2_000_00 + 1);
let mut ans = 0;
for i in 0..(n / 2) {... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtGui/qpainterpath.h
// dst-file: /src/gui/qpainterpath.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>... |
/*!
Types implementing the [Mutator] trait.
This module provides the following mutators:
* mutators for basic types such as
* `bool` ([here](crate::mutators::bool::BoolMutator))
* `char` ([here](crate::mutators::char::CharWithinRangeMutator) and [here](crate::mutators::character_classes::CharacterMutator))
... |
pub struct Solution;
#[derive(Debug, PartialEq, Eq)]
pub struct TreeNode {
pub val: i32,
pub left: Tree,
pub right: Tree,
}
use std::cell::RefCell;
use std::rc::Rc;
type Tree = Option<Rc<RefCell<TreeNode>>>;
fn tree(left: Tree, val: i32, right: Tree) -> Tree {
Some(Rc::new(RefCell::new(TreeNode { va... |
#[doc = "Reader of register DATA"]
pub type R = crate::R<u32, super::DATA>;
#[doc = "Writer for register DATA"]
pub type W = crate::W<u32, super::DATA>;
#[doc = "Register DATA `reset()`'s with value 0"]
impl crate::ResetValue for super::DATA {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
use sourcerenderer_core::graphics::AccelerationStructure;
pub struct WebGLAccelerationStructureStub {}
impl AccelerationStructure for WebGLAccelerationStructureStub {}
|
use std::env;
use actix_web::{get, post, error, web, HttpServer, App, HttpResponse};
use mongodb::{Client, Collection, error::Result as MongoResult};
use serde::{Deserialize, Serialize};
use bson::{Bson, oid::ObjectId};
#[derive(Clone)]
struct Store {
client: Client,
db_name: String,
col_name: String,
}
... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use crate::intcode::IntCodeEmulator;
const INPUT: &str = include_str!("../input/2019/day5.txt");
pub fn part1() -> i64 {
let mut vm = IntCodeEmulator::from_input(INPUT);
vm.stdin().push_back(1);
vm.execute();
let result = vm
.stdout()
.iter()
.last()
.expect("Expected... |
use pnet_datalink::interfaces;
use std::time::Duration;
use tokio::time::sleep;
use wifi_rs::{
prelude::{Config, Connectivity},
WiFi,
};
use wifiscanner;
pub struct Network();
impl Network {
pub async fn connect(ssid: String) -> Result<(), anyhow::Error> {
let adapters = Network::list_adapters();
... |
test_stdout!(without_atom_errors_badarg, "{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n");... |
#![deny(warnings)]
#![feature(generic_associated_types)]
#![feature(iterator_try_collect)]
#![feature(map_first_last)]
#![feature(map_try_insert)]
#![feature(let_else)]
#![feature(box_patterns)]
#![feature(assert_matches)]
mod bimap;
mod ir;
pub mod macros;
pub mod passes;
mod printer;
pub use self::bimap::{BiMap, Na... |
// build.rs
fn main() {
cc::Build::new()
.file("src/udpx/recvmsg.c")
.compile("recvmsg");
}
|
// This sub-crate exists to make sure that everything works well with the `impl-style` flag enabled
use humansize::{FormatSize, FormatSizeI, DECIMAL};
#[test]
fn test_impl_style() {
assert_eq!(1000u64.format_size(DECIMAL), "1 kB");
assert_eq!((-1000).format_size_i(DECIMAL), "-1 kB");
} |
use super::system_prelude::*;
#[derive(Default)]
pub struct HandleSolidCollisionsSystem;
impl<'a> System<'a> for HandleSolidCollisionsSystem {
type SystemData = (
Entities<'a>,
ReadStorage<'a, Collision>,
ReadStorage<'a, Solid<SolidTag>>,
ReadStorage<'a, Loadable>,
ReadStor... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
#[doc = "Reader of register MPCBB1_VCTR35"]
pub type R = crate::R<u32, super::MPCBB1_VCTR35>;
#[doc = "Writer for register MPCBB1_VCTR35"]
pub type W = crate::W<u32, super::MPCBB1_VCTR35>;
#[doc = "Register MPCBB1_VCTR35 `reset()`'s with value 0xffff_ffff"]
impl crate::ResetValue for super::MPCBB1_VCTR35 {
type Typ... |
use diesel;
use diesel::delete;
use diesel::prelude::*;
use db::models::*;
use rand::{thread_rng, Rng};
use db::schema::*;
use diesel::result::Error as DieselError;
/// Creates a new quote and saves it into the database.
pub fn create_quote(conn: &PgConnection, quote: &NewQuote) -> Result<Quote, diesel::result::Error>... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub struct CommunicationBlockingAccessManager {}
impl CommunicationBlockingAccessManager {
pub fn IsBlockingActive() -> ::windows::core::Result<bool> {
Self::ICommunicationBlockin... |
#![allow(unused_imports, unreachable_code, unused_variables, dead_code)]
use apiw;
use apiw::shared::ManagedStrategy;
use apiw::Result;
use crate::Game;
use crate::THE_GAME;
use crate::controller::{self, ControllerInput};
use crate::model;
use crate::view;
use crate::view::ViewCommand;
use crate::view_assets;
use ap... |
use crate::messages::messages::Message;
#[derive(Debug, Clone, PartialEq)]
pub enum OpType {
OpMessage(Message),
OpDisconnect,
OpPiece(u32, Vec<u8>), // idx * payload
OpRequest(u32, u32, u32), // idx * offset * len
OpDownStop,
OpStop,
}
#[derive(Debug, Clone, PartialEq)]
pub struct Op {
... |
use crate::auth;
use crate::handlers::types::*;
use crate::Pool;
use actix_web::{web, Error, HttpResponse};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::controllers::channel_chat_controller::*;
use crate::diesel::QueryDsl;
use crate::diesel::RunQueryDsl;
use crate::helpers::socket::push_channel_... |
use std::cell::RefCell;
use ash::vk;
use gpu_allocator::{vulkan::AllocationCreateDesc, AllocatorDebugSettings};
use super::error::GraphicsResult;
pub struct Allocator {
alloc: RefCell<gpu_allocator::vulkan::Allocator>,
device: ash::Device,
}
impl Allocator {
pub fn new(
instance: ash::Instance,
... |
use crate::{
drawing::PyDrawing,
graph::{GraphType, PyGraphAdapter},
};
use petgraph::visit::EdgeRef;
use petgraph_layout_kamada_kawai::KamadaKawai;
use pyo3::prelude::*;
#[pyclass]
#[pyo3(name = "KamadaKawai")]
struct PyKamadaKawai {
kamada_kawai: KamadaKawai,
}
#[pymethods]
impl PyKamadaKawai {
#[ne... |
pub mod task1;
pub mod task2;
pub mod task3;
pub mod post_b1_task;
|
use std::path;
use crate::commands::{CommandLine, LllCommand, LllRunnable};
use crate::context::LllContext;
use crate::error::LllError;
use crate::window::LllView;
use rustyline::completion::{escape, Quote};
#[cfg(unix)]
static DEFAULT_BREAK_CHARS: [u8; 18] = [
b' ', b'\t', b'\n', b'"', b'\\', b'\'', b'`', b'@',... |
#[doc = "Reader of register PP"]
pub type R = crate::R<u32, super::PP>;
#[doc = "Reader of field `SC`"]
pub type SC_R = crate::R<bool, bool>;
#[doc = "Reader of field `NB`"]
pub type NB_R = crate::R<bool, bool>;
#[doc = "Reader of field `MS`"]
pub type MS_R = crate::R<bool, bool>;
#[doc = "Reader of field `MSE`"]
pub t... |
use std::collections::HashSet;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
fn read_lines<P>(filename: P) -> Vec<String>
where
P: AsRef<Path>,
{
let file = File::open(filename).expect("Error opening file!");
BufReader::new(file)
.lines()
.map(|line| line.expect... |
use std::borrow::Cow;
/// A classification of if a given request was successful
///
/// Note: the variant order defines the override order for classification
/// e.g. a request that encounters both a ClientErr and a ServerErr will
/// be recorded as a ServerErr
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialO... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::RXCSRH2 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'... |
use std::collections::HashMap;
use std::str::FromStr;
use crate::ast::*;
use crate::connection::Connection;
use crate::errors::PsqlpackErrorKind::*;
use crate::errors::{PsqlpackError, PsqlpackResult, PsqlpackResultExt};
use crate::model::Extension;
use crate::semver::Semver;
use crate::sql::lexer;
use crate::sql::pars... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
use super::*;
use std::ops::*;
impl BitAnd<BlackMask> for WhiteMask {
type Output = Mask;
fn bitand(self, rhs: BlackMask) -> Self::Output {
self.0 & rhs.0
}
}
impl BitAnd<WhiteMask> for BlackMask {
type Output = Mask;
fn bitand(self, rhs: WhiteMask) -> Self::Output {
self.0 & rhs.0
... |
mod systems;
mod components;
mod renderables;
mod state;
pub use crate::prelude::*;
pub mod prelude {
pub use crate::systems::*;
pub use crate::components::*;
pub use crate::renderables::*;
pub use crate::state::*;
pub use vermarine_engine::prelude::*;
} |
use input_i_scanner::{scan_with, InputIScanner};
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
let n = scan_with!(_i_i, usize);
let ab = scan_with!(_i_i, (f64, f64); n);
let f = |mut t: f64| -> f64 {
let mut res = 0.0;
for &(a, b) in &... |
//! A module for groups
/// A `Monoid` trait is implemented for types that is possible to have
/// a associative binary operation and an identity element.
///
/// So, in orther to implement this trait, a type should follow these rules:
/// 1. `a ⊗ b ⊗ c == (a ⊗ b) ⊗ c == a ⊗ (b ⊗ c)` where `a`, `b` and `c` of the
/// ... |
pub mod dto;
pub mod config;
#[macro_use]
pub mod utils;
pub mod fetcher;
pub mod display;
pub mod parser;
pub mod http;
pub mod viewer;
#[cfg(test)]
#[macro_use]
extern crate hamcrest;
|
use std::thread::current;
use rand::Rng;
use crate::cell::Cell;
use crate::grid::Grid;
use crate::row::Row;
use crate::automaton::Automaton;
use crate::renderer::Renderer;
pub struct BriansBrain {
grid: Grid,
}
impl BriansBrain {
pub fn new(n_rows: usize, n_cols: usize) -> BriansBrain {
let mut row... |
extern crate lisp;
use lisp::util::interner::Interner;
use lisp::syntax::codemap::Source;
use lisp::syntax::parse;
use lisp::syntax::pp;
fn eq(source: &str, expected_repr: &str, interner: &mut Interner) {
let source = Source::new(source);
let expr = parse::expr(source, interner).unwrap();
let repr = pp::e... |
use failure_derive::*;
use std::io;
#[derive(Fail, Debug)]
pub enum BlobError {
#[fail(display = "No Room")]
NoRoom,
#[fail(display = "Too Big {}", 0)]
TooBig(u64),
#[fail(display = "Not Found")]
NotFound,
#[fail(display = "Bincode {}", 0)]
Bincode(bincode::Error),
#[fail(display = ... |
use crate::PluginRegistrar;
use crate::{ ReporterFunction, ReporterInitFunction };
use crate::{ PublisherFunction, PublisherInitFunction };
use crate::PluginError;
use crate::FunctionType;
use std::collections::HashMap;
use std::sync::Arc;
use libloading::Library;
#[derive(Default)]
pub struct DefaultPluginRegistrar... |
use num::{BigUint, BigInt, ToPrimitive, FromPrimitive};
use num::traits::{One, Zero};
use crate::rand;
use crate::primes;
use crate::num::bigint::ToBigInt;
const KEY_SIZE: usize = 1024;
const BLOCK_SIZE: usize = 4; // Block size in increments of 8 bytes
/// Return greatest common divisor of elements a and b as a BigU... |
#![feature(llvm_asm)]
extern "C" fn foo() {}
fn main() {
unsafe {
llvm_asm!("mov x0, $0"
:: "r"(foo)
:: "volatile");
}
}
|
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
/*!
Keys相关的命令定义、解析
所有涉及到的命令参考[Redis Command Reference]
[Redis Command Reference]: https://redis.io/commands#generic
*/
use std::slice::Iter;
use crate::cmd::keys::ORDER::{ASC, DESC};
#[derive(Debug)]
pub struct DEL<'a> {
pub keys: Vec<&'a Vec<u8>>,
}
pub(crate) fn parse_del(iter: Iter<Vec<u8>>) -> DEL {
l... |
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ($crate::console::_print(format_args!($($arg)*)));
}
#[macro_export]
macro_rules! println {
() => (print!("\n"));
($fmt:expr) => (print!(concat!("[Info] ", $fmt, "\n")));
($fmt:expr, $($arg:tt)*) => (print!(concat!("[Info] ", $fmt, "\n"), $($arg)*))... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
/// Region Providers
pub mod region;
/// Credential Providers
pub mod credentials;
|
use game::factory::produce_refrigerators as a;
use game::factory::produce_washing_machine as b;
mod mod_a {
#[derive(Debug)]
pub struct A{
pub number: i32,
name: String
}
impl A {
pub fn new_a() -> A{
A{
number:1,
name:String::from("... |
// 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.
#![deny(warnings)]
#![feature(async_await, await_macro, futures_api)]
use {
failure::{format_err, Error, ResultExt},
fidl::endpoints::{RequestStre... |
use std::collections::BTreeSet;
use std::sync::Arc;
use druid::kurbo::{BezPath, Point, Rect, Shape, Size, Vec2};
use druid::{Data, Lens};
use norad::glyph::Outline;
use norad::{Glyph, GlyphName};
use crate::component::Component;
use crate::data::Workspace;
use crate::design_space::{DPoint, DVec2, ViewPort};
use crate... |
use serde::{
Deserialize,
Serialize,
};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct QaStatus {
has_issue: bool,
possible_contamination: bool,
incomplete_sequence: bool,
missing_rfam_match: bool,
}
|
/// Compute a + b + carry, returning the result and the new carry over.
#[inline(always)]
pub const fn adc(a: u64, b: u64, carry: u64) -> (u64, u64) {
let ret = (a as u128) + (b as u128) + (carry as u128);
(ret as u64, (ret >> 64) as u64)
}
/// Compute a - (b + borrow), returning the result and the new borrow.... |
#[cfg(all(not(target_arch = "wasm32"), test))]
mod test;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::Term;
use crate::runtime::integer_to_string::base_integer_to_string;
#[native_implemented::function(erlang:integer_to_list/2)]
pub fn resu... |
use libc::c_int;
use wasmer_runtime_core::Instance;
// NOTE: Not implemented by Emscripten
pub extern "C" fn ___lock(which: c_int, varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___lock {}, {}", which, varargs);
}
// NOTE: Not implemented by Emscripten
pub extern "C" fn ___unlock(which: c_int, va... |
#[doc = "Reader of register CIR"]
pub type R = crate::R<u32, super::CIR>;
#[doc = "Writer for register CIR"]
pub type W = crate::W<u32, super::CIR>;
#[doc = "Register CIR `reset()`'s with value 0"]
impl crate::ResetValue for super::CIR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use std::collections::HashMap;
use parser::types::{ExpressionType, MutPass, ProgramError, Statement, StatementType, Expression};
pub struct Changes<'a> {
changes: HashMap<usize, ExpressionType<'a>>,
statement_changes: HashMap<usize, StatementType<'a>>,
}
impl<'a> Changes<'a> {
pub(crate) fn new(changes: H... |
use crate::NumOfPages;
use core::fmt;
use core::ops::Add;
use core::ops::AddAssign;
use core::ops::Div;
use core::ops::DivAssign;
use core::ops::Mul;
use core::ops::MulAssign;
use core::ops::Sub;
use core::ops::SubAssign;
use x86_64::structures::paging::PageSize;
use x86_64::PhysAddr;
use x86_64::VirtAddr;
#[repr(tran... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtGui/qmatrix4x4.h
// dst-file: /src/gui/qmatrix4x4.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// ... |
use biofile::bed::paired_end_collator::PairedEndCollator;
use clap::{clap_app, Arg};
use program_flow::{
argparse::{
extract_boolean_flag, extract_numeric_arg,
extract_optional_numeric_arg, extract_str_arg,
},
debug_eprint_named_vars, eprint_named_vars, OrExit,
};
fn main() {
let mut ap... |
use std::{cmp::Reverse, collections::BTreeSet};
use proconio::input;
use segment_tree::SegmentTree;
fn main() {
input! {
n: usize,
a: [i64; n],
};
const INF: i64 = std::i64::MAX / 2;
// dp[i] := max(dp[i - 1], max(dp[j - 1] + a[i] - a[j]), max(dp[j - 1] + a[j] - a[i]))
let mut dp... |
//! JIT compilation.
use crate::instantiate::SetupError;
use crate::object::{build_object, ObjectUnwindInfo};
use cranelift_codegen::ir;
use object::write::Object;
use wasmtime_debug::{emit_dwarf, DebugInfoData, DwarfSection};
use wasmtime_environ::entity::{EntityRef, PrimaryMap};
use wasmtime_environ::isa::{unwind::U... |
pub type IRDPSRAPIApplication = *mut ::core::ffi::c_void;
pub type IRDPSRAPIApplicationFilter = *mut ::core::ffi::c_void;
pub type IRDPSRAPIApplicationList = *mut ::core::ffi::c_void;
pub type IRDPSRAPIAttendee = *mut ::core::ffi::c_void;
pub type IRDPSRAPIAttendeeDisconnectInfo = *mut ::core::ffi::c_void;
pub type IRD... |
pub trait DegreeTrigonomeric {
fn sin_degree(self) -> Self;
fn cos_degree(self) -> Self;
fn atan2_degree(self, other: Self) -> Self;
}
const SIN_N90_4: &[isize] = &[0, 1, 0, -1, 0, 1, 0, -1, 0, 1, 0];
fn sin_n90(n: isize) -> isize {
SIN_N90_4[(n + 4) as usize]
}
macro_rules! impl_degree_trigonomeric ... |
/// Selection sort
pub fn sort<T: Ord + Clone>(list: &Vec<T>) -> Vec<T> {
let mut sorted = list.clone();
for index in 0..list.len() {
let index_of_least = index_of_least_from(&sorted, index);
sorted.swap(index_of_least, index);
}
return sorted;
}
fn index_of_least_from<T: Ord + Clone>(l... |
// 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 carnelian::{
make_message, set_node_color, App, AppAssistant, Color, Label, Message, Paint, Point, Rect,
Size, ViewAssistant, ViewAssistantCont... |
use crate::messages::*;
use crate::orderbook::*;
use crate::types::*;
use chrono::Local;
use std::collections::HashMap;
#[allow(dead_code)]
pub struct Exchange {
books: HashMap<Symbol, OrderBook>,
users: HashMap<UserId, UserInfo>,
}
#[allow(dead_code)]
impl Exchange {
pub fn new(symbols: Option<Vec<Symbol... |
use std::env;
use std::fs::File;
use std::io::{self, BufRead, BufReader};
struct Program {
pc: i32,
acc: i32,
}
impl Program {
pub fn new() -> Program {
return Program { pc: 0, acc: 0 };
}
fn nop(&mut self) {
self.pc += 1;
}
fn acc(&mut self, arg: i32) {
self.acc ... |
use std::pin::Pin;
use async_std::io;
use async_std::io::prelude::*;
use async_std::task::{Context, Poll};
use futures_core::ready;
/// An encoder for chunked encoding.
#[derive(Debug)]
pub(crate) struct ChunkedEncoder<R> {
reader: R,
done: bool,
}
impl<R: Read + Unpin> ChunkedEncoder<R> {
/// Create a n... |
use std::collections::HashMap;
use std::fs;
use clap::ArgMatches;
use rand::{Rng, SeedableRng, prelude::StdRng};
use arrayref::array_ref;
use sha2::{Sha256, Digest};
const COMMON_CHARS: [char; 26] = [
'i', 't', 'a', 'o', 'e', 'n', 's',
'h', 'r', 'd', 'l', 'c', 'u', 'm',
'w', 'f', 'g', 'y', 'p', 'b', 'v',
'k'... |
/*
* Copyright 2019 André Cipriani Bandarra
*
* 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 o... |
use actix::Actor;
use actix_rt::System;
use bus::BusActor;
use chain::{ChainActor, ChainActorRef};
use config::{ConsensusStrategy, NodeConfig, PacemakerStrategy};
use consensus::dummy::{DummyConsensus, DummyHeader};
use logger::prelude::*;
use network::network::NetworkActor;
use starcoin_genesis::Genesis;
use starcoin_... |
pub mod codegen;
pub mod parser;
pub mod source;
use crate::codegen::*;
use crate::parser::*;
use crate::source::*;
use std::env;
use std::process;
use std::fs::File;
use std::io::Write;
use std::path::Path;
/**
* 1. Read file or directory
* 2. parse each vm files to VMCommand(s)
* 3. generate hack asm from VMCo... |
use ::amethyst::ecs::*;
use dirty::Dirty;
use serde::de::DeserializeOwned;
use serde::Serialize;
use std::fs::File;
use std::io::Read as IORead;
use std::io::Write as IOWrite;
use std::marker::PhantomData;
/// If the tracked resource changes, this will be checked to make sure it is a proper time to save.
pub trai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.