text stringlengths 3.09k 13.9k |
|---|
// Copyright © 2019 Intel Corporation
//
// 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... |
use minecraft_assets::{
api::ResourceIdentifier,
schemas::models::{BlockFace, Textures},
};
use smallvec::SmallVec;
use tracing::*;
use crate::bakery::{
models::{BakedCuboid, BakedQuad, Cuboid, CuboidRotation, UnbakedCuboid, UnbakedQuad},
textures::TextureTable,
};
/// Bakes a single cuboid for a mode... |
use std::{
cell::RefCell,
collections::{HashMap, VecDeque},
rc::Rc,
};
use femtovg::{FontId, TextContext};
// use fluent_bundle::{FluentBundle, FluentResource};
// use unic_langid::LanguageIdentifier;
use crate::{
CachedData, Entity, Enviroment, Event, FontOrId, IdManager, Message, Modifiers,
Mous... |
extern crate self as ftd;
#[cfg(test)]
#[macro_use]
pub(crate) mod test;
mod component;
mod condition;
mod dnode;
mod event;
mod execute_doc;
mod html;
pub mod main;
mod or_type;
pub mod p1;
pub mod p2;
pub mod render;
mod rt;
mod ui;
mod value_with_default;
pub(crate) mod variable;
mod youtube_id;
pub use component... |
// Copyright 2018 The xi-editor 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 required by applicable law or ag... |
//! Authorize using the device authorization grant flow
//!
//! This flow allows users to sign in to input-constrained devices such as a smart TV, IoT device, or printer.
//!
//! You can learn more about this authorization flow [here](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code).
mod... |
//! Example program for testing rendering with skribo.
use std::fs::File;
use std::io::Write;
use euclid::{Point2D, Size2D};
use font_kit::canvas::{Canvas, Format, RasterizationOptions};
use font_kit::family_name::FamilyName;
use font_kit::hinting::HintingOptions;
use font_kit::properties::Properties;
use font_kit::s... |
use syn::spanned::Spanned;
impl super::Enumeration {
pub(crate) fn parse(item: proc_macro2::TokenStream) -> syn::Result<Self> {
let input: syn::DeriveInput = syn::parse2(item)?;
// Get the primitive type of the `repr` attribute.
let repr = match input.attrs.iter()
.find(|attr| ... |
use std::path::{Path, PathBuf};
use inox_log::debug_log;
use inox_messenger::MessageHubRc;
use inox_resources::{
DataTypeResource, Handle, Resource, ResourceId, ResourceTrait, SerializableResource,
SharedData, SharedDataRc,
};
use inox_serialize::{inox_serializable::SerializableRegistryRc, read_from_file, Seri... |
//! The IBCMC lexer.
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::io::Result as IoResult;
use itertools::{self, PutBack};
use ibcmc::errors::*;
/// A token.
#[derive(Clone,Debug,PartialEq,Eq)]
pub enum Token {
/// `+`
Add,
/// `-`
Sub,
/// `=`
Assign,
/// `+=`
Ad... |
use super::banner::BANNER;
use anyhow::{anyhow, Error, Result};
use serde::{Deserialize, Serialize};
use std::{
fs,
io::{stdin, Write},
path::{Path, PathBuf},
};
const DEFAULT_PORT: u16 = 8888;
const FILE_NAME: &str = "client.yml";
const CONFIG_DIR: &str = ".config";
const APP_CONFIG_DIR: &str = "spotiflake";
co... |
use crate::{ConstValue, FromValue, Mut, Ref, Value, Vm, VmError};
use std::fmt;
use std::ops;
use std::slice;
/// Struct representing a dynamic anonymous object.
#[derive(Clone)]
#[repr(transparent)]
pub struct Tuple {
inner: Box<[Value]>,
}
impl Tuple {
fn empty() -> Self {
Self {
inner: ... |
//! The `cargo audit` subcommand
#[cfg(feature = "fix")]
mod fix;
use super::CargoAuditCommand;
use crate::{
auditor::Auditor,
config::{AuditConfig, DenyOption, OutputFormat},
prelude::*,
};
use abscissa_core::{config::Override, terminal::ColorChoice, FrameworkError};
use gumdrop::Options;
use rustsec::da... |
use std::fmt;
use actix_http::ResponseBuilder;
use actix_web as aweb;
use actix_web::http::StatusCode;
use serde_json::json;
#[derive(Debug)]
pub enum ResponseError {
BadParameter(String, String),
BadRequest(String),
CreateIndex(String),
DocumentNotFound(String),
IndexNotFound(String),
Interna... |
use crate as payment;
use crate::PaymentDetail;
use frame_support::{
parameter_types,
traits::{Contains, Everything, GenesisBuild, Hooks, OnFinalize},
weights::DispatchClass,
};
use frame_system as system;
use orml_traits::parameter_type_with_key;
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{Blak... |
// Copyright 2020 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.
//! Typesafe wrappers around reading the version file.
use {
::version::Version as SemanticVersion,
fidl_fuchsia_io::DirectoryProxy,
serde::{
... |
use std::{
ffi::OsString,
path::{Path, PathBuf},
process::Command,
};
use crate::{build::Object, error::*};
/// Find an avaible tool on the system
/// TODO: On windows try to put mscv on the environment first
fn find_tool() -> Result<(PathBuf, ToolFamily)> {
// Macro that checks if command exists
... |
use crate::hittable::HitRecord;
use crate::pdf::*;
use crate::ray::*;
use crate::shared_tools::*;
use crate::texture::*;
use crate::vec3::*;
use std::convert::From;
use std::f64::consts::PI;
use std::sync::Arc;
pub struct ScatterRecord {
pub specular_ray: Option<Ray>, // TODO: enum
pub attenuation: Vec3,
p... |
use proc_macro2::TokenStream;
use syn::{self};
use crate::bound;
use crate::internals::ast::{Container, Data, Field, Style};
use crate::internals::{attr, replace_receiver, Ctxt, Derive};
pub fn expand_derive_deserialize(
input: &mut syn::DeriveInput,
) -> Result<TokenStream, Vec<syn::Error>> {
replace_receiv... |
use super::*;
use frame_support::dispatch::DispatchError;
use pallet_permissions::SpacePermissionsContext;
impl<T: Config> Module<T> {
/// Check that there is a `Role` with such `role_id` in the storage
/// or return`RoleNotFound` error.
pub fn ensure_role_exists(role_id: RoleId) -> DispatchResult {
ensu... |
use crate::ram;
use core::intrinsics::transmute;
use xtensa_lx_rt::exception::Context;
use xtensa_lx_rt::interrupt;
#[repr(u8)]
pub enum InterruptType {
SLC = 1,
SPI = 2,
GPIO = 4,
UART = 5,
CCOMPARE = 6,
SOFT = 7,
WDT = 8,
TIMER1 = 9,
}
impl InterruptType {
const fn mask(self) -> ... |
//! Structures for pasing Cargo.toml
use serde_derive::{Deserialize, Serialize};
use std::{collections::BTreeMap, path::PathBuf};
use toml::Value;
#[derive(Deserialize, Debug, Serialize, Clone)]
#[serde(untagged)]
pub enum StringOrBool {
String(String),
Bool(bool),
}
type DependencyT = BTreeMap<String, Depend... |
// Copyright 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 to those... |
#![no_std]
#![feature(asm)]
#![feature(intrinsics)]
#![feature(lang_items)]
#![feature(compiler_builtins_lib)]
extern crate uefi;
extern crate rlibc;
extern crate compiler_builtins;
use uefi::SimpleTextOutput;
use uefi::graphics::{PixelFormat,Pixel};
use core::mem;
use core::fmt::Write;
struct RGB{
r:u8,
g:u... |
use std::io::Cursor;
use byteorder::{BigEndian, ByteOrder, LittleEndian, ReadBytesExt};
use enumflags2::BitFlags;
use super::cache_change::ChangeKind;
use crate::{
messages::submessages::submessage_elements::RepresentationIdentifier,
serialization::{
CDRDeserializerAdapter, DeserializerAdapter,
cdr_seriali... |
// Std
use std::{fmt::Write as _, io::Write};
// Internal
use crate::utils;
use crate::Generator;
use clap::*;
/// Generate bash completion file
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Bash;
impl Generator for Bash {
fn file_name(&self, name: &str) -> String {
format!("{}.bash", name)
... |
use crate::{
schema::users,
models::Email,
web::{
DbConnection,
api::{
PasswordRequirements,
ApiContext
}
}
};
use argon2::{self, Config};
use actix_web::web::block;
use juniper::{FieldResult, FieldError, Value};
use uuid::Uuid;
/// A telescope user.
#[... |
use std::fs::File;
use std::io::prelude::*;
use std::io::{self};
use std::collections::HashMap;
use std::env;
enum Part {
Part1,
Part2
}
#[derive(Debug)]
enum Instruction {
Mask(String),
Write((u64, u64)),
}
type Memory = HashMap<u64, u64>;
fn main() -> io::Result<()> {
let args: Vec<String> = e... |
use ::rawloader;
use ::image;
use ::histogram::Histogram;
fn correct_gamma(c:f32) -> f32 {
let c2;
if c<=0.0031308*255.0 {
c2 = 12.92*c;
} else {
c2 = (1.055*(c/255.0).powf(1.0/2.4)-0.055)*255.0;
}
return c2.max(0.0).min(255.0) as f32
}
pub fn main_logic(input: &str) {
let ra... |
use crate::{Error, Result};
use tokio_tungstenite::{WebSocketStream, MaybeTlsStream};
use tokio::net::TcpStream;
use tokio_stream::Stream;
use crate::entities::event::Event;
use std::pin::Pin;
use std::task::Poll;
use tokio_tungstenite::tungstenite::Message;
use crate::entities::notification::Notification;
use crate::e... |
//! Plugin delegation.
//!
//! This module is only available when either of the **with-smol** (for smol and
//! async-std async runtimes) or **with-tokio** features are enabled. If both
//! are provided, the crate won't compile.
use std::{
env,
io::Cursor,
path::Path,
process::{ExitStatus, Stdio},
};
use log::{de... |
use std::collections::HashMap;
use crate::bolt::{BoltStream, BoltSummary};
use log::info;
use packstream::{parameters, Data, Value};
const USER_AGENT: &str = "rusty-bolt/0.1.0";
pub struct CypherStream {
bolt: BoltStream,
server_version: Option<String>,
bookmark: Option<String>,
}
impl CypherStream {
... |
use rollo::{
error::Error,
flatbuffers_helpers::flatbuffers,
packet::Packet,
server::{ListenerSecurity, SocketTools, World, WorldSession, WorldSocketMgr},
tokio,
};
use std::{sync::Arc, time::Duration};
#[tokio::main]
async fn main() {
let world = Box::leak(Box::new(MyWorld {}));
// Get bu... |
use crate::error::{ConnectorError, ErrorKind};
use chrono::Utc;
use indexmap::{map::Keys, IndexMap};
use prisma_models::{ModelProjection, ModelRef, PrismaValue, ScalarFieldRef, SelectionResult};
use std::{borrow::Borrow, convert::TryInto, ops::Deref};
/// WriteArgs represent data to be written to an underlying data so... |
/// A version number for a specific component of an OpenGL implementation
#[derive(Clone, Eq, Ord, PartialEq, PartialOrd)]
pub(crate) struct Version {
pub major: u32,
pub minor: u32,
pub is_embedded: bool,
pub revision: Option<u32>,
pub vendor_info: String,
}
impl Version {
/// Create a new Ope... |
mod codec;
mod errors;
pub use codec::*;
pub use errors::*;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
#[cfg(test)]
use tls_codec::Serialize as TlsSerializeTrait;
use tls_codec::{Size, TlsByteVecU16, TlsDeserialize, TlsSerialize, TlsSize};
use crate::ciphersuite::*;
/// Enum for Credential Types... |
//! Provides functionality for
//! [Google oauth](https://developers.google.com/identity/protocols/oauth2)
use crate::{error::Error, jwt};
mod end_user;
mod metadata_server;
mod service_account;
use end_user as eu;
use metadata_server as ms;
use service_account as sa;
pub use crate::token::{Token, TokenOrRequest, T... |
//! Contains versioning information and self-update functionality.
use {
std::{
env::current_exe,
fmt,
process::{
Command,
Stdio
}
},
directories::BaseDirs,
lazy_static::lazy_static,
regex::Regex,
reqwest::blocking::Client,
semver::Ver... |
use std::result::Result;
use crate::device::{response::state::compile::{CompileOption, ExtendedCompileOption, get_extended_compile_option, get_compile_option}, util::axis::MAX_AXES};
const COMPILE_OPTION_SUFFIX: &str = "]";
const COMPILE_OPTION_PREFIX: &str = "[OPT:";
const EXTENDED_COMPILE_OPTION_SUFFIX: &str = "]"... |
use crate::{FromInner, Inner, IntoInner};
use std::ffi::CString;
use uv::{addrinfo, uv_freeaddrinfo, uv_getaddrinfo, uv_getaddrinfo_t};
callbacks! {
pub GetAddrInfoCB(
req: GetAddrInfoReq,
status: crate::Result<u32>,
res: Vec<crate::AddrInfo>
);
}
/// Additional data stored on the requ... |
#![allow(non_camel_case_types)]
/// Implements additional integer traits (Eq, Ord, Hash) on the specified vector `$name`, holding multiple `$lanes` of `$type`.
macro_rules! impl_unsigned_vector {
{ $name:ident, $type:ty } => {
impl_vector! { $name, $type }
impl_integer_reductions! { $name, $type }
... |
// use super::fightclub::FIGHT_QUANTITY;
use super::fightclub::FightClub;
use super::soldiers::SoldierBase;
use yew::prelude::*;
/////////////////////
// Results to view //
/////////////////////
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Datum {
Nil,
// Num(i32),
Stat((f32, f32)),
Percent(f32),
}
... |
use super::*;
#[derive(Debug, PartialEq)]
pub struct Keyboard {
pub name: String,
}
impl Keyboard {
// Parses a Keyboard object from a block read from INPUT_DEVICE_LIST file
//
// Example block:
// I: Bus=0003 Vendor=046d Product=c33a Version=0111
// N: Name="Logitech G413 Carbon Mechanical Gam... |
//! Traits for the Launchpad Crowdsales Pallet.
use crate::Change;
use codec::FullCodec;
use codec::{Decode, Encode};
use sp_runtime::{
traits::{AtLeast32Bit, Bounded, MaybeSerializeDeserialize},
DispatchError, DispatchResult, RuntimeDebug,
};
use orml_traits::Change;
use sp_std::{
cmp::{Eq, PartialEq},
fmt::Debug... |
pub struct BytePacketBuffer {
pub buf: [u8; 512],
pos: usize,
}
impl BytePacketBuffer {
pub fn new() -> Self {
BytePacketBuffer {
buf: [0; 512],
pos: 0,
}
}
pub fn read(&mut self) -> Result<u8, String> {
if self.pos >= 512 {
return Err("m... |
mod button;
mod checkbox;
mod column;
//mod debugger;
mod image;
mod radio;
mod row;
mod scrollable;
mod slider;
mod space;
mod text;
//mod text_input;
use crate::colors::{ColorRegistry, PancursesColor};
use crate::primitive::Primitive;
use iced_native::input::{
keyboard, keyboard::KeyCode, mouse::Button, mouse::E... |
use crate::common::*;
pub(crate) struct Env {
args: Vec<OsString>,
dir: PathBuf,
input: Box<dyn InputStream>,
err: OutputStream,
out: OutputStream,
}
impl Env {
pub(crate) fn main() -> Result<Self> {
let dir = env::current_dir().context(error::CurrentDirectoryGet)?;
let style = env::var_os("NO_CO... |
// Copyright 2022 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, Result},
std::{env, ffi::OsStr, fs::read_dir, path::PathBuf},
};
/// The default configs paths used if 0 paths are given.
... |
use time::PreciseTime;
use geometry::*;
use math::*;
use bvh::BVH;
/// Represent vertex indices in triangles; 2^32 vertices should be enough
pub type Index = u32;
#[derive(Serialize, Deserialize)]
pub struct Triangle {
pub idxs: [Index; 3],
}
// N.B. There is a 1-1 correspondence between vertices and normals.
// T... |
#[macro_use]
extern crate rustler;
// #[macro_use]
extern crate rustler_codegen;
// #[macro_use]
extern crate blake2;
extern crate ed25519_dalek;
extern crate lazy_static;
use blake2::digest::{Input, VariableOutput};
use blake2::Blake2b;
use blake2::VarBlake2b;
use ed25519_dalek::{verify_batch, Keypair, PublicKey, Sec... |
use aoc_utils;
use std::collections::HashSet;
type Value = i64;
type Digit = Value;
type Z = Value;
type ID = (Digit, Z);
type IDSet = HashSet<ID>;
const DIGIT_COUNT: Value = 14;
const DIGIT_VALID: Value = 0;
const MODEL_START: Value = 1;
const MODEL_END: Value = 9;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
enu... |
use legion::prelude::*;
use winit::{
dpi::LogicalSize,
event::{Event, WindowEvent},
event_loop::ControlFlow,
};
use harmony::{
graphics::{
pipeline_manager::{PipelineDesc, PipelineManager},
resources::{BindGroup, GPUResourceManager},
CommandBufferQueue, CommandQueueItem,
},
... |
extern crate base64;
extern crate md5;
use std::io::Write;
use attohttpc::header::HeaderName;
use super::bucket::Bucket;
use super::command::Command;
use chrono::{DateTime, Utc};
use crate::command::HttpMethod;
use crate::request_trait::Request;
use crate::{Result, S3Error};
// static CLIENT: Lazy<Client> = Lazy::... |
use std::cmp::Ordering;
#[derive(Debug)]
pub struct Permutations<A> {
items: Vec<A>,
index_permutations: Option<Box<Permutations<usize>>>,
current_index_permutation: Option<Vec<usize>>,
current_insert_index: usize,
}
impl<A, I> From<I> for Permutations<A>
where
A: Copy,
I: IntoIterator<Item = ... |
use std::{
fs::create_dir_all,
path::{Path, PathBuf},
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
thread::{self, JoinHandle},
};
use inox_core::{ContextRc, System, SystemId, SystemUID};
use inox_messenger::MessageHubRc;
use inox_platform::PlatformType;
use inox_resources::{Conf... |
//! The uploading logic was mostly reverse engineered; I wrote it down as
//! documentation at https://warehouse.readthedocs.io/api-reference/legacy/#upload-api
use crate::Registry;
use fs_err::File;
use regex::Regex;
use reqwest::{self, blocking::multipart::Form, blocking::Client, StatusCode};
use sha2::{Digest, Sha2... |
mod commands;
mod configuration;
mod kurama;
mod link;
mod navigation_item;
mod metadata;
mod page;
mod section;
mod save_string;
use crate::{
commands::Commands,
configuration::Configuration,
kurama::Kurama,
link::Link,
section::Section,
navigation_item::NavigationItem,
page::Page,
... |
use ggez::{nalgebra::Point2, Context, GameResult};
use rand::{distributions::Standard, prelude::Distribution, Rng};
use crate::{
draw_system::DrawSystem, draw_system::GameObjectDrawSystem, game_object::GameObject,
game_object_type::GameObjectType, life_system::FireLifeSystem, life_system::HeartLifeSystem,
... |
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this f... |
// Copyright 2018, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
// Author: <NAME> <<EMAIL>>
use self::RangedId::*;
use bytes::Bytes;
use crate::{
determine_id_range, BaseTypeSafeId, Error, IntoId, LocalId, RangedId, RemoteId, Result,
SenderId, TypeId, TypeSafeId,
};
#[derive(Debug, Clone, Hash, Eq, Par... |
use std::io::{self, BufRead};
use std::collections::HashMap;
const PREF_LENGTH: usize = 2;
const SUFF_LENGTH: usize = 2;
const PAD_LENGTH: i64 = PREF_LENGTH as i64 + SUFF_LENGTH as i64 + 1;
const POT_PLANT: char = '#';
const POT_EMPTY: char = '.';
#[derive(Debug)]
struct Rule {
pattern: Vec<char>,
outcome: ch... |
use crate::cfg::CFG;
use crate::context::Context;
use crate::dom_tree::DomTree;
use crate::isa::ISA;
use crate::valueref::{BasicBlockRef, FunctionRef, InstructionRef, ValueRef, ValueRefEnum};
use std::collections::HashSet;
use std::hash::Hash;
struct ScopedSet<T: Eq + Hash> {
stack: Vec<HashSet<T>>,
}
impl<T> Sc... |
//! Setting up and responding to user defined key/mouse bindings
use crate::{
core::{
data_types::{Point, WinId},
manager::WindowManager,
},
PenroseError, Result,
};
#[cfg(feature = "keysyms")]
use penrose_keysyms::XKeySym;
use std::{collections::HashMap, convert::TryFrom};
use strum::Enu... |
extern crate termion;
use crate::buffer_file::*;
use crate::container::*;
use crate::layout::*;
use crate::pty::*;
use crate::size_utilis::*;
use crate::split::*;
use std::fs::File;
use std::io::{self, Read, Write};
use std::str;
use std::sync::mpsc::{self, Sender};
use std::sync::{Arc, RwLock};
use std::thread::{self... |
use crate::managed::WrappedComposite;
use crate::render::MIN_ZOOM_FOR_DETAIL;
use crate::ui::UI;
use ezgui::{
Color, Composite, Drawable, EventCtx, GeomBatch, GfxCtx, HorizontalAlignment, Line,
ManagedWidget, Outcome, Text, VerticalAlignment,
};
use geom::{Circle, Distance, Pt2D};
use map_model::{BuildingID, Bu... |
//! PDF page management
use lopdf;
use std::rc::Weak;
use std::cell::RefCell;
use indices::{PdfPageIndex, PdfLayerIndex};
use {
PdfResources, PdfLayer, PdfDocument, ExtendedGraphicsState, ExtendedGraphicsStateRef, Pattern, XObject, XObjectRef,
PdfLayerReference, PatternRef, Mm, Pt
};
/// PDF page
#[derive(De... |
use crate::error::{LowPolyError, LowPolyResult};
use image::ImageFormat;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::num::ParseFloatError;
use std::path::PathBuf;
use structopt::StructOpt;
use thiserror::Error;
/// An error for parsing floats from the command line. Aside from the default parsing ... |
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity 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 yo... |
use crate::util::{RawJsonRead, Sequence};
use cqrs_core::{reactor::Reaction, CqrsError, EventNumber, RawEvent, Since};
use num_traits::ToPrimitive;
use postgres::{Row, Socket, tls::{MakeTlsConnect, TlsConnect}, types::ToSql};
use r2d2::{ManageConnection, Pool, PooledConnection};
use r2d2_postgres::PostgresConnectionMan... |
use proc_macro::TokenStream;
use syn::Token;
struct SeqParser{
variable_ident: syn::Ident,
start:i64,
end:i64,
body:proc_macro2::TokenStream,
}
impl syn::parse::Parse for SeqParser{
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self>{
let variable_ident: syn::Ident = input.parse()... |
use crate::*;
use near_sdk::{ext_contract, Gas};
// Mainnet config
const REF_FINANCE_ACCOUNT_ID: &str = "v2.ref-finance.near";
const WRAP_NEAR_TOKEN_ID: &str = "wrap.near";
// Testnet config
// const REF_FINANCE_ACCOUNT_ID: &str = "ref-finance-101.testnet";
// const WRAP_NEAR_TOKEN_ID: &str = "wrap.testnet";
const G... |
// #![deny(warnings, missing_docs)]
extern crate nom;
#[macro_use] extern crate log;
// #[macro_use] extern crate text_io;
// #[macro_use] extern crate serde_derive;
extern crate chrono;
extern crate mio;
extern crate mio_more;
extern crate slab;
extern crate bytes;
extern crate fix;
extern crate iovec;
use std::{i... |
use chrono::NaiveDate;
use serde::Deserialize;
use serde_with::{serde_as, DisplayFromStr};
use crate::{Epoch, Genre, OpenOpusError, OpenOpusResult, Status, Work, ID};
#[derive(Debug, Deserialize)]
struct Composers {
status: Status,
composers: Option<Vec<Composer>>,
}
#[serde_as]
#[derive(Debug, Clone, Partia... |
use crate::entity::ContentEntity;
use crate::infrastructure::*;
use crate::template::{DefaultRenderer, Renderer};
use regex::Regex;
use std::fs;
use std::io::Write;
use std::path::Path;
type Result<T> = std::result::Result<T, Error>;
pub trait ContentRepository {
fn load_all(&self) -> Result<Vec<ContentEntity>>;
... |
use vulkano::buffer::{BufferUsage, CpuBufferPool};
use vulkano::command_buffer::{
AutoCommandBuffer, AutoCommandBufferBuilder, BuildError, CommandBufferExecError,
CommandBufferExecFuture, DispatchError,
};
use vulkano::descriptor::descriptor_set::{
FixedSizeDescriptorSetsPool, PersistentDescriptorSetBuildEr... |
use std::{sync::Arc, thread::JoinHandle};
use clap::ArgMatches;
use config::{Config, ConfigError, Environment, File};
use log::debug;
use serde::Deserialize;
use oura::{
pipelining::{
BootstrapResult, FilterProvider, PartialBootstrapResult, SinkProvider, SourceProvider,
StageReceiver,
},
u... |
use crate::CliOptions;
use crate::{
assert::AssertionResultData,
workflow::{Request, RequestData, WorkflowConfig},
};
use chrono::DateTime;
use chrono::Utc;
use serde::Serialize;
use serde_json::json;
use std::{env, time::Instant};
/// The result of a workflow is saved in to this struct.
/// It can be serializ... |
use crate::{cache::ImageKey, utils::Timer, GlobalState};
use bytes::{Bytes, BytesMut};
use futures::stream::Stream;
use std::error::Error;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
enum BytesAgg {
Stable(BytesMut),
Taken,
Poisoned,
}
impl BytesAgg {
/// Create a new stable... |
// Copyright (c) 2018-2020 <NAME> <<EMAIL>>
// Distributed under the MIT License
// (See acoompanying LICENSE file or a copy at http://opensource.org/licenses/MIT)
//! Parser del Building Description Language (BDL) de DOE
//!
//! Elementos WINDOW de la envolvente térmica
use std::convert::TryFrom;
use anyhow::{bail,... |
use crate::modules::{Neuron, NetworkInfo, Gene, NeatParams};
use rand::{thread_rng, Rng};
use rand::rngs::ThreadRng;
pub use bincode::{deserialize, serialize};
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Network {
neurons: Vec<Neuron>,
}
impl Network {
pub fn new(num_inputs: usize, num_outputs: usi... |
use crate::UsbIpError;
use std::{
convert::TryInto,
io::{Error, ErrorKind, Read},
net::TcpStream,
};
#[repr(C)]
#[derive(Debug, Clone)]
pub struct OpHeader {
pub version: u16,
pub command: u16,
pub status: u32,
}
impl OpHeader {
fn to_array(&self) -> [u8; 8] {
let mut result = [0; 8];
... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::PeerId;
use admission_control_proto::proto::admission_control::{
admission_control_msg::Message as AdmissionControlMsg_oneof, AdmissionControlClient,
AdmissionControlMsg, SubmitTransactionRequest, SubmitTransactionRe... |
// 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 byteorder::{ByteOrder, NetworkEndian};
use rodio::Sink;
use rodio::{Sample, Source, source::UniformSourceIterator};
use std::net::UdpSocket;
use std::sync::Arc;
use std::time::Duration;
use cpal::SampleFormat;
use getopts;
use crossbeam_queue::{SegQueue};
use cpal::traits::DeviceTrait;
type SampleType = f32;
const... |
#![no_std]
#![crate_name = "elfloader"]
#![crate_type = "lib"]
#[cfg(test)]
#[macro_use]
extern crate std;
#[cfg(test)]
extern crate env_logger;
mod binary;
pub use binary::ElfBinary;
pub mod arch;
pub use arch::RelocationType;
#[cfg(test)]
mod test;
use core::fmt;
use core::iter::Filter;
use bitflags::bitflags;
... |
use std::collections::HashSet;
type TParsed = (Vec<DoubleRange>, Vec<u32>, Vec<Vec<u32>>);
pub fn day(input: String) -> (u32, u64) {
let parsed_input = parse(&input);
let (p1_result, p1_output) = part_1(&parsed_input);
(
p1_result,
part_2(&(parsed_input.0, parsed_input.1, p1_output)),
... |
use std::borrow::Cow;
use bytemuck::{Pod, Zeroable};
use nalgebra_glm as glm;
use glm::{Vec4, Mat4};
use wgpu::util::DeviceExt;
use triangulate::mesh::{Vertex, Triangle};
use crate::camera::Camera;
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
struct GPUVertex {
pos: [f32; 4],
norm: [f32; 4],
... |
use futures_util::StreamExt;
use ntex::web::{HttpRequest, HttpResponse};
use ntex_multipart::{Field, Multipart};
use psn_api_rs::models::MessageThreadResponse;
use psn_api_rs::psn::PSN;
use psn_api_rs::traits::PSNRequest;
use psn_api_rs::types::PSNInner;
use serde::Serialize;
use crate::captcha_solver::CaptchaSolver;
... |
//! Rust flavor.
use crate::{SCOPE_SEP, TYPE_SEP};
use core::errors::Result;
use core::{
CoreFlavor, Diagnostics, Flavor, FlavorTranslator, PackageTranslator, RpNumberKind,
RpNumberType, RpStringType, Spanned, Translate, Translator,
};
use genco::prelude::*;
use genco::tokens;
use std::ops::Deref;
use std::rc:... |
use error::*;
use rogue_gym_core::dungeon::{Coord, X, Y};
use rogue_gym_uilib::Screen;
use std::collections::VecDeque;
use std::io::{self, Stdout, Write};
use termion::raw::{IntoRawMode, RawTerminal};
use termion::{clear, cursor, terminal_size};
use tuple_map::TupleMap2;
pub type RawTerm = RawTerminal<Stdout>;
/// wr... |
use {
Backend,
Color,
Colorable,
Point,
Positionable,
Range,
Rect,
Scalar,
Sizeable,
Widget,
};
use utils::{vec2_add, vec2_sub};
use widget;
pub use super::line::Pattern;
pub use super::line::Style;
/// A simple, non-interactive widget for drawing a series of lines and/or poin... |
use std::fs;
pub fn run() {
let (grid, carts) = setup("inputs/13.txt");
println!("Part 1: {:?}", part1(&grid, &carts));
println!("Part 2: {:?}", part2(&grid, &carts));
}
fn part1(grid: &[Vec<TrackType>], initial_carts: &[Cart]) -> (usize, usize) {
let num_carts = initial_carts.len();
let mut carts... |
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
extern crate rocket_contrib;
extern crate wopi;
use rocket_contrib::Json;
use wopi::*;
use wopi::models::*;
use wopi::errors::Result;
#[get("/wopi*/files/<id>")]
fn check_file_info(id: String) -> Option<Json<CheckFileInfoResponse>> {
// TODO: ... |
#![allow(clippy::wildcard_imports)]
use seed::{prelude::*, *};
mod booking;
mod handling;
mod tracking;
const BOOKING: &str = "booking";
const TRACKING: &str = "tracking";
const HANDLING: &str = "handling";
pub(crate) const BOOKING_API_URL: &str = "http://localhost:8080/booking/v1/cargos/";
pub(crate) const TRACKIN... |
// 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)]
use std::borrow::Cow;
use std::fs;
use std::net::IpAddr;
use std::os::unix::io::AsRawFd;
use std:... |
// Copyright 2020 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::*,
errors::ffx_bail,
fuchsia_async::TimeoutExt,
serde_json::Value,
std::process::Stdio,
std::time::Instant,
std::... |
use std::collections::BTreeMap;
use std::marker::PhantomData;
use std::sync::{RwLock, atomic::{AtomicU32, Ordering}};
use std::pin::Pin;
use futures::prelude::*;
use serde::{Deserialize,Serialize};
use futures::io::{AsyncRead,AsyncWrite};
use super::{Error, ErrorKind,Result};
use super::codec::{BincodeCodec,Decoder,F... |
use crate::{
kubelet::{Phase, Provider, Status},
pod::{pod_status, KubePod},
};
use kube::client::APIClient;
use log::info;
use wasmtime::*;
use wasmtime_wasi::*;
type EnvVars = std::collections::HashMap<String, String>;
/// WasmRuntime provides a Kubelet runtime implementation that executes WASM binaries.
#[... |
use llrl::prelude::*;
use std::env;
use std::io;
use std::path;
use std::process::{exit, ExitStatus};
fn main() {
match run_pipeline() {
Ok(status) => {
if let Some(code) = status.and_then(|s| s.code()) {
exit(code);
}
}
Err(e) => {
eprint... |
use crate::console_log;
use crate::services::api_service::api_service;
use crate::services::api_service::Res;
use once_cell::sync::Lazy;
use regex::Regex;
use serde::Deserialize;
use yew::format::Json;
use yew::services::fetch::FetchTask;
use yew::services::fetch::Response;
use yew::services::FetchService;
use yew::Cal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.