text stringlengths 8 4.13M |
|---|
mod fs;
mod misc;
mod sock;
pub use self::fs::*;
pub use self::misc::*;
pub use self::sock::*;
fn return_enc_errno(errno: super::host::__wasi_errno_t) -> super::wasm32::__wasi_errno_t {
let errno = super::memory::enc_errno(errno);
log::trace!(" -> errno={}", super::wasm32::strerror(errno));
errno
}
|
extern crate shuteye;
extern crate time;
use shuteye::sleep;
use std::time::Duration;
use time::precise_time_ns;
fn duration_from_ns(duration_ns: u64) -> Duration {
Duration::new(
duration_ns / 1_000_000_000,
(duration_ns % 1_000_000_000) as u32,
)
}
fn measure_sleep(sleep_duration: Duration... |
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
pub mod error;
pub mod gen_types;
pub mod gen_settings;
mod base;
mod cdsl;
mod srcgen;
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Win32_Security_Authorization_UI")]
pub mod UI;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: de... |
use proc_macro::TokenStream;
use syn::parse::Parser;
use syn::{parse_quote, Block, ExprMatch, Signature};
pub fn export_native(tokens: TokenStream) -> TokenStream {
if cfg!(test) {
return tokens;
}
let mut stmts: Vec<syn::Stmt> = Block::parse_within.parse(tokens.clone()).unwrap();
let mut match... |
pub const TIMESTEP_RATE: f64 = 1.0 / 60.0; // fixed frame rate
pub const SERVER_PORT: u16 = 12351;
pub const DEFAULT_MAP: &str = "ctf_Ash";
pub(crate) const GRAV: f32 = 0.06;
pub(crate) const PHYSICS_SCALE: f32 = 16.;
|
extern crate fudd;
extern crate lazy_static;
use std::io::stdin;
use fudd::get_fudd;
fn main() {
println!("Hello please type something in");
let mut input = String::new();
stdin().read_line(&mut input).unwrap();
/* lazy_static! {
static ref FUDD_REGEX: Regex = Regex::new(hm.keys().collect()... |
//! Digest algorithms: SHA-1, SHA-256, SHA-384, SHA-512
use core::{fmt, mem};
use digest::{
core_api::BlockSizeUser,
generic_array::{typenum::*, GenericArray},
FixedOutput, FixedOutputReset, OutputSizeUser, Reset, Update,
};
use ring::digest::Context;
macro_rules! impl_digest {
(
$(#[doc = $do... |
use std::collections::HashMap;
pub struct AsnModule<'a> {
pub name: &'a str,
pub sequences: HashMap<&'a str, AsnSequence<'a>>,
pub type_aliases: HashMap<&'a str, AsnType<'a>>,
}
pub struct AsnSequence<'a> {
// Needs to be a vec to maintain field order
pub fields: Vec<AsnField<'a>>,
}
pub struct A... |
extern crate quicksilver;
use boids::boids::*;
use quicksilver::{
geom::Vector,
graphics::{Color, Image},
input::{Event, Key},
run, Graphics, Input, Result, Settings, Window,
};
const WINDOW_SIZE: Vector = Vector { x: 800.0, y: 500.0 };
async fn app(window: Window, mut gfx: Graphics, mut input: Input... |
use std::{
char, convert::From, fmt, marker::PhantomData, ops::Deref, rc::Rc, thread::JoinHandle, u32,
};
use serde::{Deserialize, Serialize};
use crate::{
ast::{InputValue, Selection, ToInputValue},
executor::{ExecutionResult, Executor, Registry},
graphql_scalar,
macros::reflect,
parser::{Lex... |
// 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 ... |
use chromiumoxide_cdp::cdp::browser_protocol::fetch::{EventAuthRequired, EventRequestPaused};
use chromiumoxide_cdp::cdp::browser_protocol::network::{
EventLoadingFailed, EventLoadingFinished, EventRequestServedFromCache, EventRequestWillBeSent,
EventResponseReceived,
};
use chromiumoxide_cdp::cdp::browser_prot... |
// time.rs
//
// Copyright (c) 2019, Univerisity of Minnesota
//
// Author: Bridger Herman (herma582@umn.edu)
//! Tracks timing information about the GLFW window
use std::time::Duration;
// Replaced std::time::Instant with instant crate because it panics in wasm
use instant::Instant;
use crate::traits::Update;
#[d... |
use std::collections::HashMap;
use proconio::input;
fn main() {
input! {
n: usize,
points: [(usize, usize, u64); n],
};
let mut row = HashMap::new();
let mut col = HashMap::new();
for &(r, c, x) in &points {
*row.entry(r).or_insert(0) += x;
*col.entry(c).or_insert(... |
pub use self::syscalls::*;
#[cfg(target_arch = "x86_64")]
#[path = "x86_64.rs"]
mod syscalls;
|
use std::io::Error;
pub type HtResult<T> = std::result::Result<T, HtError>;
#[derive(Debug)]
pub enum HtError {
Io(std::io::Error),
Misc(String),
}
impl HtError {
pub fn misc(msg: &str) -> HtError {
HtError::Misc(msg.to_string())
}
}
impl From<std::io::Error> for HtError {
fn from(e: Erro... |
use image::{Pixel, Rgb, RgbImage};
use std::io::Write;
use rusttype::{Font, Scale};
use thiserror::Error;
#[derive(Error, Debug)]
pub enum TextWriteError {
// TODO add an ImageResult.
#[error("error while writing an image")]
Image(#[from] image::error::ImageError),
#[error("std::io error")]
StdIo(... |
#![allow(unused_attributes)]
#![feature(no_coverage)]
// #![feature(trivial_bounds)]
use std::fmt::Debug;
use fuzzcheck::mutators::option::OptionMutator;
use fuzzcheck::mutators::recursive::RecurToMutator;
use fuzzcheck::mutators::testing_utilities::test_mutator;
use fuzzcheck::mutators::vector::VecMutator;
use fuzzc... |
extern crate byteorder;
extern crate yahtzeevalue;
use std::{io, fs};
use byteorder::{LittleEndian, ReadBytesExt};
use yahtzeevalue::*;
fn read_state_value() -> io::Result<Vec<f64>> {
let file = fs::File::open("state_value.bin")?;
let size = file.metadata()?.len() as usize;
let mut reader = io::BufReader... |
use crate::collections::HashMap;
use crate::ir::eval::prelude::*;
impl IrEval for ir::IrObject {
type Output = IrValue;
fn eval(
&self,
interp: &mut IrInterpreter<'_>,
used: Used,
) -> Result<Self::Output, IrEvalOutcome> {
let mut object = HashMap::with_capacity(self.assign... |
//! Input capture
use nb;
/// Input capture
///
/// # Examples
///
/// You can use this interface to measure the period of (quasi) periodic signals
/// / events
///
/// ```
/// extern crate embedded_hal as hal;
/// #[macro_use(block)]
/// extern crate nb;
///
/// use hal::prelude::*;
///
/// fn main() {
/// let m... |
use rustviz_lib::data::{ExternalEvent, LifetimeTrait, ResourceAccessPoint, Owner, Function, Visualizable, VisualizationData};
use rustviz_lib::svg_frontend::svg_generation;
use std::collections::BTreeMap;
fn main() {
// Variables
let x = ResourceAccessPoint::Owner(Owner {
hash: 1,
name: String:... |
// 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 ... |
#![allow(non_camel_case_types)]
pub type c_void = core::ffi::c_void;
pub type c_char = i8;
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c... |
//! Implements building a CMake-based C++ library.
use errors::Result;
use file_utils::{create_dir_all, path_to_str};
use utils::run_command;
use utils::MapIfOk;
use string_utils::JoinWithSeparator;
use std::process::Command;
use std::path::{Path, PathBuf};
use log;
use target;
/// A CMake variable with a name and a ... |
pub fn say_hi(name: &str) {
println!("Hi, {}", name);
hi(name);
hello(name);
say_what(name, hello);
closured()
}
fn hi(name: &str) -> () {
println!("Hi, {}.", name);
}
fn hello(name: &str) {
println!("Hello, {}.", name);
}
fn say_what(name: &str, func: fn(&str)) {
func(name)
}
// 闭... |
use super::*;
#[doc(hidden)]
pub unsafe trait Abi: Sized {
type Abi;
/// # Safety
unsafe fn from_abi(abi: Self::Abi) -> Result<Self> {
Ok(core::mem::transmute_copy(&abi))
}
/// # Safety
unsafe fn drop_param(_: &mut Param<Self>) {}
}
unsafe impl<T> Abi for *mut T {
type Abi = Self... |
use std::{
any::{Any, TypeId},
collections::HashMap,
hash::BuildHasherDefault,
marker::PhantomData,
};
use actix::prelude::*;
use ahash::AHasher;
use log::trace;
use crate::msgs::*;
type TypeMap<A> = HashMap<TypeId, A, BuildHasherDefault<AHasher>>;
#[derive(Default)]
pub struct Broker<T> {
sub_m... |
mod dynamic;
use std::ffi::c_void;
use std::lazy::SyncOnceCell;
use std::mem;
use hashbrown::{HashMap, HashSet};
use liblumen_arena::DroplessArena;
use liblumen_core::symbols::FunctionSymbol;
use crate::erts::process::ffi::ErlangResult;
use crate::erts::term::prelude::Atom;
use crate::erts::term::prelude::Term;
use... |
use crate::{builtins::PyModule, PyRef, VirtualMachine};
pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
let module = _signal::make_module(vm);
_signal::init_signal_handlers(&module, vm);
module
}
#[pymodule]
pub(crate) mod _signal {
use crate::{
builtins::PyModule,
... |
#![feature(test)]
extern crate num;
extern crate netpbm;
#[cfg(test)]
extern crate test;
pub const BOX_WIDTH_SHL: usize = 7;
pub const BOX_WIDTH: usize = 1 << 7;
pub const BOX_HEIGHT_SHL: usize = 3;
pub const BOX_HEIGHT: usize = 1 << 3;
pub use self::colorspace::{Channel, Colorspace};
pub use self::colorspace::{
... |
use anyhow::Result;
use reqwest::Client;
use serde::{Deserialize, Serialize};
use crate::url_builder::URLBuilder;
use crate::vacant_info::{Hotel, RoomInfo, VacantInfo};
// static HOTEL_SEARCH_URL: &'static str =
// "https://app.rakuten.co.jp/services/api/Travel/SimpleHotelSearch/20170426";
// pub async fn get_ho... |
// 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 std::fs;
use std::sync::Arc;
use mime_guess::get_mime_extensions_str;
use urlencoding::{decode};
use crate::path_utils::{get_path, is_filepath, random_string, sanitise};
use crate::request::{Request, RequestHandler, ResponseResult};
use crate::{multipart, Opts, Response};
pub struct Post;
impl RequestHandler fo... |
use actix_web::{get, web, App, HttpResponse, HttpServer, Responder};
use askama::Template;
#[derive(Template)]
#[template(path = "index.html")]
struct IndexTemplate {
envs: Vec<Env>,
}
#[derive(Debug, Clone, Template)]
#[template(source = "{{ key }} = {{ value }}", ext = "txt")]
struct Env {
key: String,
... |
use dlal_component_base::{component, err, json, serde_json, Body, CmdResult, View};
use rustfft::{num_complex::Complex, Fft, FftPlanner};
use std::f32::consts::PI;
use std::sync::Arc;
component!(
{"in": ["audio"], "out": ["cmd"]},
[
"audio",
{
"name": "connect_info",
"... |
//! api about wallet defined in here
use crate::broadcast_queue::{NamedQueue, global_q};
use crate::constructor::Constructor;
use crate::db::{balance_helper, GlobalRB, GLOBAL_RB};
use crate::kit::hex_to_tx;
use crate::path::{BTC_HAMMER_PATH, PATH};
use crate::{db, kit, Error};
use bitcoin::hashes::hex::FromHex;
use bi... |
use btrfs;
use output::Output;
use arguments::*;
pub fn print_extents_command (
output: & Output,
arguments: & Arguments,
) -> Result <(), String> {
for path in arguments.root_paths.iter () {
output.message_format (
format_args! (
"Extents for {}",
path.to_string_lossy ()));
let file_extents =
... |
pub type ICorProfilerAssemblyReferenceProvider = *mut ::core::ffi::c_void;
pub type ICorProfilerCallback = *mut ::core::ffi::c_void;
pub type ICorProfilerCallback2 = *mut ::core::ffi::c_void;
pub type ICorProfilerCallback3 = *mut ::core::ffi::c_void;
pub type ICorProfilerCallback4 = *mut ::core::ffi::c_void;
pub type I... |
pub mod winner;
|
bitflags! {
/// Pipeline stages flags.
/// See Vulkan docs for detailed info:
/// <https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#synchronization-pipeline-stages>
/// Man page: <https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkPipelineStageFlagBits.html>
#[... |
#[macro_use]
extern crate lazy_static;
extern crate serde;
extern crate pest;
#[macro_use]
extern crate pest_derive;
extern crate dlopen;
#[macro_use]
extern crate dlopen_derive;
pub mod app;
pub mod coco_error;
pub mod domain;
pub mod infrastructure;
|
/* Some known bugs:
* https://github.com/npgsql/npgsql/issues/818
*/
extern crate postgres;
extern crate postgres_array;
extern crate chrono;
use self::postgres::Connection as PgConnection;
use self::postgres::Error as PgError;
use self::postgres::TlsMode;
use self::postgres::params::{Builder, Host};
use self::postg... |
//! Clock configuration
use e310x::{AONCLK, prci, PRCI};
use clint::Clint;
/// Aon Clock interface
pub struct AonClock<'a>(pub &'a AONCLK);
impl<'a> Clone for AonClock<'a> {
fn clone(&self) -> Self {
*self
}
}
impl<'a> Copy for AonClock<'a> {}
impl<'a> AonClock<'a> {
/// Use external real time o... |
extern crate libc;
use self::libc::{c_char, c_int, c_uint};
use std::rc::Rc;
use std::ptr;
use git2::repository::{Repository};
use git2::repository;
use git2::oid::{OID, GitOid, ToOID};
use git2::error::{GitError, get_last_error};
// opaque pointerr classes
pub mod opaque {
pub enum Commit {}
}
extern {
... |
use color_eyre::eyre::{eyre, Result};
use crate::prompt::select;
use crate::state::{Initial, IssueSelected, State};
use std::fmt;
mod github;
mod jira;
#[derive(Debug, PartialEq)]
pub(crate) struct Issue {
pub(crate) key: String,
pub(crate) summary: String,
}
impl fmt::Display for Issue {
fn fmt(&self, ... |
#[doc = "Reader of register PCSEL"]
pub type R = crate::R<u32, super::PCSEL>;
#[doc = "Writer for register PCSEL"]
pub type W = crate::W<u32, super::PCSEL>;
#[doc = "Register PCSEL `reset()`'s with value 0"]
impl crate::ResetValue for super::PCSEL {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
use crate::core::transform::Transform;
use crate::gameplay::physics::DynamicBody;
use crate::render::particle::ParticleEmitter;
use hecs::World;
#[derive(Debug)]
pub struct Trail {
pub should_display: bool,
pub offset: f32,
}
pub fn update_trails(world: &mut World) {
for (_, (trail, transform, emitter, _b... |
extern crate serde;
mod test_utils;
use flexi_logger::LoggerHandle;
use hdbconnect::{Connection, HdbResult};
use std::thread;
use std::time::Duration;
#[test] // cargo test --test test_016_selectforupdate -- --nocapture
pub fn test_016_selectforupdate() -> HdbResult<()> {
let mut log_handle = test_utils::init_lo... |
//! NEC Infrared transmission protocol
//! ```
//! ________________ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ____... |
#[macro_use]
extern crate log;
mod types;
use bollard::container::{InspectContainerOptions, ListContainersOptions};
use bollard::models::ContainerSummary;
use bollard::Docker;
use env_logger;
use std::collections::HashMap;
use std::default::Default;
use std::fs;
use std::fs::File;
use std::path::Path;
use std::time:... |
use super::super::thread_future::ThreadFuture;
use super::super::utils::init_com;
use super::dialog_ffi::IDialog;
use winapi::shared::winerror::HRESULT;
use crate::file_handle::FileHandle;
pub fn single_return_future<F: FnOnce() -> Result<IDialog, HRESULT> + Send + 'static>(
build: F,
) -> ThreadFuture<Option<Fi... |
use std::mem::size_of;
use std::ptr;
use crossfont::RasterizedGlyph;
use log::info;
use alacritty_terminal::term::cell::Flags;
use crate::display::content::RenderableCell;
use crate::display::SizeInfo;
use crate::gl;
use crate::gl::types::*;
use crate::renderer::shader::{ShaderProgram, ShaderVersion};
use crate::ren... |
/*
// Ex 2-2: Random Byte
use qpu::QuantumComputer;
fn main() {
let mut qc = QuantumComputer::reset(8);
qc.had(0xff);
println!("{:#010b}", qc.read(0xff));
}
*/
fn main() {}
|
use serde::Serialize;
#[derive(Clone, Copy, Debug, Serialize, Eq, PartialEq, Hash)]
pub struct UserId(i32);
impl UserId {
pub fn new(id: i32) -> Self {
UserId(id)
}
pub fn get(&self) -> i32 {
self.0
}
}
|
use P31::Primes;
pub fn prime_factors(n: u32) -> Vec<u32> {
let piter = PrimeIterator::new();
let mut factors = vec![];
let mut r = n;
for prime in piter {
if r == 1 {
break;
}
while r % prime == 0 {
factors.push(prime);
r = r / prime;
... |
use smithay::backend::session::Session;
use smithay::input::keyboard::ModifiersState;
use std::process::Command;
use crate::backend::UdevData;
use crate::state::{Backend, Corrosion};
// code to convert emacs style keybindings to xkb keysyms
pub fn get_mod_key_and_compare(state: &ModifiersState) -> bool {
let mod_... |
// Copyright 2018-2020 Parity Technologies (UK) Ltd.
// This file is part of cargo-contract.
//
// cargo-contract 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 yo... |
use crate::events::AttributeName;
use crate::onAttribute;
use crate::processor::SegmentObject;
use core::mem;
use std::borrow::Cow;
/// Trait implemented for values that can be "reported" as an attribute to the
/// JS-side.
///
/// Reportable values can be sent to JavaScript as an attribute's value, through
/// the `r... |
use lexer::Lexer;
pub struct Parser<'a> {
lex: Lexer<'a>
}
impl<'a> Parser<'a> {
pub fn new(&self, lexer: Lexer) -> Parser {
Parser { lex: lexer }
}
} |
use anyhow::Result;
use std::fs::{self, File};
use std::io::Write;
pub fn write_file(content: String, path: String) -> Result<()> {
let mut file = File::create(path)?;
write!(file, "{}", content)?;
file.flush()?;
Ok(())
}
pub fn do_mkdir(file_name: &str) -> Result<()> {
fs::create_dir(file_name)?;... |
use crate::Result;
use crossterm::cursor::*;
use crossterm::queue;
use std::{cell::RefCell, rc::Rc};
#[derive(Debug, Clone)]
pub struct Raw<W: std::io::Write> {
pub raw: Rc<RefCell<W>>,
}
impl<W: std::io::Write> std::io::Write for Raw<W> {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
sel... |
use cw::{Crosswords, Dir, Range, Point};
/// An iterator over all ranges that correspond to a word in the crosswords grid.
pub struct RangesIter<'a> {
point: Point,
dir: Dir,
ended: bool,
cw: &'a Crosswords,
}
impl<'a> RangesIter<'a> {
/// Creates an iterator over all ranges corresponding to a wor... |
use std::collections::HashMap;
const INPUT: &str = include_str!("./input");
fn parse_line(line: &str) -> (&str, &str) {
let mut iter = line.split(" bags contain ");
(iter.next().unwrap(), iter.next().unwrap())
}
fn part_1(input: &str) -> usize {
let mut bags = input
.trim_end()
.lines()
... |
use crate::utils::*;
pub(crate) const NAME: &[&str] = &["futures::Sink"];
pub(crate) fn derive(data: &Data, items: &mut Vec<ItemImpl>) -> Result<()> {
derive_trait!(
data,
parse_quote!(::futures::sink::Sink)?,
parse_quote! {
trait Sink<Item> {
type Error;
... |
// xfail-stage0
use std;
fn main() {
auto x = std.option.some[int](10);
}
|
use std::collections::HashMap;
fn main() {
let mut source : Vec<&str> = include_str!("./input.txt").lines().collect();
let mut robot = include_str!("./robot.txt");
//let source : Vec<&str> = include_str!("./input_test.txt").lines().collect();
let mut a_program = Program::new(source[0], 99999999);
... |
impl Solution {
pub fn max_area(height: Vec<i32>) -> i32 {
let(mut left,mut right,mut ans) = (0 as usize,height.len() - 1,-1);
while left < right {
ans = ans.max(height[left].min(height[right])*(right as i32 - left as i32));
if height[left] < height[right] { left += 1;}
... |
pub struct Solution;
impl Solution {
pub fn max_profit(prices: Vec<i32>) -> i32 {
let mut a = std::i32::MIN; // after buy
let mut b = 0; // after sell
let mut c = 0; // after cooldown
for p in prices {
let a2 = a.max(c - p);
let b2 = b.max(a + p);
... |
#[doc = "Reader of register EXTICR1"]
pub type R = crate::R<u32, super::EXTICR1>;
#[doc = "Writer for register EXTICR1"]
pub type W = crate::W<u32, super::EXTICR1>;
#[doc = "Register EXTICR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::EXTICR1 {
type Type = u32;
#[inline(always)]
fn reset_va... |
use ash::{
self,
version::{DeviceV1_0, FunctionPointers},
};
use device::Device;
use error::*;
use smallvec::SmallVec;
use std::{
ops::Range,
ptr::{null, null_mut, NonNull},
};
impl From<ash::vk::Result> for OutOfMemoryError {
fn from(result: ash::vk::Result) -> OutOfMemoryError {
match res... |
pub mod datetime;
pub mod monotonic;
pub mod system;
use core::convert::{TryFrom, TryInto};
use num_bigint::BigInt;
use num_traits::Zero;
use liblumen_alloc::erts::exception::{AllocResult, Exception};
use liblumen_alloc::erts::term::prelude::*;
use liblumen_alloc::{badarg, Process};
// Must be at least a `u64` beca... |
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput, Data, Fields};
#[proc_macro_derive(Sample)]
pub fn sample_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
//let ast: DeriveInput = syn::parse(input).unwrap();
let name ... |
use warp::ws::{Message, WebSocket};
use warp::{Filter, http::Response};
use tokio::sync::broadcast::{Sender, Receiver};
use std::sync::{
Arc, RwLock
};
use sqlx::Sqlite;
use sqlx::Pool;
use sqlx::Executor;
static index: &'static str = include_str!("../mock-frontend/index.html");
static js: &'static str = includ... |
use std::path::PathBuf;
pub fn launcher_dir(project_name: &str) -> Option<PathBuf> {
if cfg!(target_os = "windows") {
dirs::data_dir().map(|dir| dir.join(project_name))
} else if cfg!(target_os = "linux") {
dirs::home_dir().map(|dir| dir.join(".minecraftlauncher").join(project_name))
} else... |
use thiserror::Error;
use bitvec::prelude::*;
#[derive(Debug)]
pub enum Keyish {
/// Strictly speaking, this is for prefix searches
///
/// .0 will be a value for which all keys that match the prefix will be lexographically ordered
/// afterwards. For display, an encoded form of .0 should be used.
... |
use amethyst::{
core::Transform,
derive::SystemDesc,
ecs::{Join, Read, ReadStorage, System, SystemData, WriteStorage},
input::{InputHandler, StringBindings},
};
use crate::{
entities::{Paddle, Side},
settings::{ARENA_HEIGHT, PADDLE_HEIGHT},
};
#[derive(SystemDesc)]
pub struct PaddleSystem;
im... |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate argparse;
#[macro_use]
extern crate js;
extern crate libc;
extern crate linenoise;
use std::cell::Re... |
//! https://github.com/lumen/otp/tree/lumen/lib/odbc/src
use super::*;
test_compiles_lumen_otp!(odbc);
test_compiles_lumen_otp!(odbc_app imports "lib/stdlib/src/supervisor");
test_compiles_lumen_otp!(odbc_debug);
test_compiles_lumen_otp!(odbc_sup);
fn includes() -> Vec<&'static str> {
let mut includes = super::i... |
use std::cmp::{Eq, Ordering, PartialEq, PartialOrd};
/// An Option-like type which only compares equal if it contains a value(the `Just` variant).
///
/// # Example
///
/// ```
/// use abi_stable::sabi_types::MaybeCmp;
///
/// assert_eq!(MaybeCmp::Just(10), MaybeCmp::Just(10));
///
/// assert_ne!(MaybeCmp::Just(0), Ma... |
///! Data structures and function that allow for the recreation of a
///! candidate tree from a log file
use crate::explorer::choice::ActionEx as Action;
use crate::explorer::mcts::{EdgeIndex, NodeId};
use crate::model::Bound;
use fxhash::FxHashMap;
use std::borrow::Cow;
use std::cell::{Ref, RefCell};
use std::rc::{Rc,... |
//! Implements the `Lattice` struct which as the name suggests contains
//! information about and grid coordinates of lattices. It comes
//! with easy-to-use constructors for different lattice types.
use coord::Coord;
use surface::points::Points;
pub struct Lattice;
impl Lattice {
/// Constructor for a hexagonal... |
use rusoto_core::Region::UsEast1;
use rusoto_ec2::{Ec2, Ec2Client, Instance, Reservation, DescribeInstancesRequest, DescribeInstancesResult};
use std::vec::Vec;
fn handle_instances(instances: Vec<Instance>) {
for instance in instances {
println!("Instance ID: {}", instance.instance_id.expect("Missing insta... |
use crate::{args::Args, cmd::*, Error, ErrorCode, NsmResponse};
use serde::Deserialize;
use std::io::Write;
use std::os::unix::net::UnixListener;
pub fn run(fd: i32, socket: &str) -> Result<(), String> {
println!("Binding on {}", socket);
let listener = UnixListener::bind(socket).map_err(|e| e.to_string())?;
... |
extern crate dotenv;
extern crate env_logger;
extern crate futures;
extern crate r2d2_redis;
extern crate serde;
extern crate serde_json;
extern crate thruster;
extern crate tokio;
extern crate tokio_proto;
extern crate tokio_service;
extern crate uuid;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate... |
/*!
An application that runs in the system tray.
Requires the following features: `cargo run --example system_tray --features "tray-notification message-window menu cursor"`
*/
extern crate native_windows_gui as nwg;
use nwg::NativeUi;
#[derive(Default)]
pub struct SystemTray {
window: nwg::MessageWindow... |
mod custom_de;
mod custom_ser;
pub mod de;
mod error;
mod eth;
pub mod ser;
mod serde_tests;
pub use ser::{to_string, to_vec, to_writer};
pub use de::{from_reader, from_str};
|
use std::collections::BTreeMap;
use common::aoc::{load_input, run_many, print_time, print_result};
fn main() {
let input = load_input("day06");
let (set, dur_parse) = run_many(1000, || OrbiterSet::parse(&input));
let (res_part1, dur_part1) = run_many(1000, || set.checksum());
let (res_part2, dur_part2... |
use crate::auth;
use crate::graphql::Context;
use juniper::{FieldError, FieldResult, ID};
pub struct MutationUsers;
#[juniper::graphql_object(Context = Context)]
impl MutationUsers {
async fn login(
auth: auth::AuthenticationData,
context: &Context,
) -> FieldResult<auth::Session> {
aut... |
//we need this types for stuff like reading files,creating a tcp listener,
//multithreading and handling streams.
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
use std::fs;
use std::time::Duration;
use std::thread;
fn main() {
//this listener is going to bind to local host on port 7... |
mod code_writer;
mod parser;
pub mod vm_translator;
// initialize stack ?
|
use crate::spirv;
/// Grammar for a SPIR-V instruction.
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Instruction<'a> {
/// Opname.
pub opname: &'a str,
/// Opcode.
pub opcode: spirv::Op,
/// Capabilities required for this instruction.
pub capabilities: &'a [spirv::Capability],
/// Exten... |
use std::collections::BTreeMap;
use oasis_runtime_sdk::{
module::AuthHandler as _,
modules::{core, core::Module as Core},
testing::mock,
types::{token, transaction},
Context as _, Module as _,
};
#[test]
fn test_impl_for_tuple() {
let mut mock = mock::Mock::default();
let mut ctx = mock.cr... |
// Copyright 2014 The Servo 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/MIT>, at ... |
#[doc = "Reader of register GISR0"]
pub type R = crate::R<u32, super::GISR0>;
#[doc = "Reader of field `GIF0`"]
pub type GIF0_R = crate::R<bool, bool>;
#[doc = "Reader of field `GIF1`"]
pub type GIF1_R = crate::R<bool, bool>;
#[doc = "Reader of field `GIF2`"]
pub type GIF2_R = crate::R<bool, bool>;
#[doc = "Reader of f... |
#![feature(asm,associated_consts,box_syntax,lang_items,libc,start,std_misc,thread_local,no_std,core,unsafe_no_drop_flag,static_assert,/*rustc_private,*/zero_one,step_trait,optin_builtin_traits,scoped,simd)]
extern crate core;
extern crate libc;
extern crate num_cpus;
extern crate rand;
pub use self::map::CuckooHashMa... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[doc(hidden)]
pub struct IPaymentAppCanMakePaymentTriggerDetails(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IPaymentAppCanMakePayment... |
use moongbc::cpu::CPU;
use moongbc::debug::Debugger;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut cpu = CPU::new();
cpu.set_cartridge("pkmn_yellow.gbc");
let mut debugger = Debugger::new(cpu);
debugger.run()?;
Ok(())
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.