text stringlengths 3.09k 13.9k |
|---|
#[macro_use]
extern crate failure;
#[macro_use]
extern crate lazy_static;
use regex::Regex;
lazy_static! {
static ref CLAIM_REGEX: Regex = Regex::new(r"#(\d+)\s*@\s*(\d+),(\d+):\s*(\d+)x(\d+)")
.expect("Claims regex does not compile");
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Claim {
pub ... |
use crate::codec::*;
use crate::endpoint::Endpoint;
use crate::error::ZmqResult;
use crate::message::*;
use crate::transport::AcceptStopHandle;
use crate::util::PeerIdentity;
use crate::{
MultiPeerBackend, Socket, SocketBackend, SocketEvent, SocketOptions, SocketRecv, SocketType,
};
use crate::backend::Peer;
use c... |
use amg_match::{
//mat_to_image,
partitioner::{modularity_matching, modularity_matching_no_copies},
preconditioner::{bgs, fgs, l1, multilevelgs, multilevell1, sgs},
solver::{pcg, stationary},
};
use nalgebra::DVector;
use nalgebra_sparse::CsrMatrix;
use rand::{distributions::Uniform, thread_rng};
use st... |
use std::f32::consts::PI;
use std::io;
use byteorder::BigEndian;
use byteorder::WriteBytesExt;
use crate::common::{linear_to_srgb, roundup4, srgb_to_linear};
#[inline(always)]
fn multiply_basis_function(
xc: usize,
yc: usize,
w: usize,
h: usize,
rgb: &[u8],
channels: usize,
) -> [f32; 3] {
... |
use crate::types::{ChatId, Update, UserId};
use serde::{Deserialize, Serialize};
/// Allows to decide should rule accept an update or not
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum Principal {
/// Accepts all updates
All,
/// Accepts updates only from a specified user
User(User... |
use crate::chain::id_tree::{
Digest, Digestible, IdTreeInternalId, IdTreeLeafNode, IdTreeNode, IdTreeNodeId,
IdTreeNodeLoader, IdTreeNonLeafNode, IdTreeRoot, ObjId,
};
use anyhow::{anyhow, Result};
use serde::{Deserialize, Serialize};
use std::{
borrow::Cow,
collections::{HashMap, HashSet},
};
#[derive... |
use std::{convert::TryFrom, sync::Arc};
use futures::FutureExt;
use indoc::indoc;
use serde::{Deserialize, Serialize};
use tower::ServiceBuilder;
use vector_core::config::proxy::ProxyConfig;
use super::{
service::LogApiRetry,
sink::{DatadogLogsJsonEncoding, LogSinkBuilder},
};
use crate::{
config::{Acknow... |
//! Database review models.
use github_scbot_database_macros::SCGetter;
use github_scbot_types::reviews::{GhReview, GhReviewState};
use serde::{Deserialize, Serialize};
use super::{PullRequestModel, RepositoryModel};
use crate::schema::review;
mod adapter;
mod builder;
pub use adapter::{DummyReviewDbAdapter, IReview... |
use rwinstructs::timestamp::{WinTimestamp};
use byteorder::{ByteOrder,LittleEndian};
use errors::RegError;
use utils;
#[derive(Serialize,Debug)]
pub struct BaseBlock {
#[serde(skip_serializing)]
_offset: u64,
signature: u32,
primary_seq_num: u32,
secondary_seq_num: u32,
last_written: Box<WinTim... |
extern crate lib_data;
use lib_data::*;
use core::CoreSender;
use pnet::packet::ethernet::{EtherTypes, EthernetPacket};
use pnet::packet::icmp::{
destination_unreachable::DestinationUnreachablePacket, echo_reply::EchoReplyPacket,
echo_request::EchoRequestPacket, time_exceeded::TimeExceededPacket, IcmpPacket, ... |
use std::borrow::Cow;
use std::cell::Ref;
use std::fmt;
use std::mem::ManuallyDrop;
use std::ops::{Deref, DerefMut};
use std::rc::{Rc, Weak};
use super::*;
use crate::backend::*;
use crate::context::Scheduler;
use crate::escape;
use crate::global_events::GlobalEvents;
/// A native node which has a single correspondin... |
// Advent of Code 2021, Day 3 (Rust version)
//
// Read a text file of binary digits, and make up a new number, consisting
// of the most frequent digit in each column. For Part 2, find the numbers
// that have the most/least frequent values in each successive bit, and
// multiply them to produce result.
//
// AK, 6/0... |
use std::io;
use std::io::Write;
use std::collections::HashMap;
extern crate bex;
use bex::*;
use bex::nid::NID;
use bex::ast::{ASTBase};
use bex::solve;
use bex::anf::ANFBase;
use bex::bdd::BDDBase;
// forth-like REPL for the BDD (helper routines)
fn readln()->String {
let mut buf = String::new();
print!("> ... |
//
// Copyright 2018-2019 <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... |
//! Types related to the LE advertising interval.
use byteorder::{ByteOrder, LittleEndian};
use core::time::Duration;
/// Define an advertising interval range.
///
/// The advertising interval min shall be less than or equal to the advertising interval
/// max. The advertising interval min and advertising interval ma... |
// This file is part of Sulis, a turn based RPG written in Rust.
// Copyright 2018 <NAME>
//
// Sulis 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 opt... |
extern crate docopt;
extern crate byteorder;
#[macro_use]
extern crate serde_derive;
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::string::String;
mod macros;
mod opcodes;
mod io_utils;
mod disassemble;
mod assemble;
mod nwscript {
include!(concat!(env... |
use std::fs;
use std::time::UNIX_EPOCH;
use chrono::{DateTime, TimeZone, Utc};
use diesel::sql_types::Integer;
use mediainfo::MediaInfo;
use uuid::Uuid;
use schema::{acoustid_last_checks, library};
#[derive(Clone, Debug, Insertable, AsChangeset)]
#[table_name="library"]
pub struct NewMediaFileInfo {
pub path: Stri... |
use std::f64::consts::PI;
use freq;
use wavetable::Wavetable;
#[derive(Clone, Debug)]
pub struct Oscillator {
is_enabled: bool,
wavetable: Wavetable,
is_free_phase: bool, // When true, the phase is not reset to the initial_phase, but continues from where it was
initial_phase: f64, // The init... |
// Copyright 2019, <NAME>
// License: see LICENSE file
use nalgebra::{DMatrix};
use std::fmt;
/// Defining types for Surface of Active Events (SAE), commonly used for Event Cameras (DVS &c.).
/// The SAE is a matrix of timestamps (one per pixel), indicating when a change event
/// (rising or falling above or below t... |
//! Types to represent text to be displayed by widgets.
//!
//! This module is light on documentation. See the existing widget
//! implementations for inspiration.
use anyhow::{anyhow, Result};
use cairo::{Context, Surface};
use pango::{EllipsizeMode, FontDescription};
use std::fmt;
#[derive(Clone, Debug, PartialEq)]... |
/// @copyright
/// Copyright (C) 2020 Assured Information Security, Inc.
///
/// @copyright
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limita... |
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
use rand::random;
use std::cell::RefCell;
use std::panic;
use std::rc::Rc;
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
use wasm_bindgen::{JsCast, JsValue};
use web_sys::{CanvasRenderingContext2d, Document, HtmlCanvasElement, KeyboardEvent, Window};
mod basic_renderer;
mod configuration;
mod distributions;
mod ... |
use mediacontainer::*;
use util::*;
use pms::PlexMediaServer;
use std::time::Duration;
use chrono::{DateTime, Utc};
use failure::Error;
use reqwest::{Client, ClientBuilder, header::Headers};
use serde_xml_rs;
#[derive(Debug, Clone)]
#[derive(Deserialize)]
struct PlexTVAuthResponse {
user: PlexTVUser,
}
#[derive... |
mod expr;
use std::collections::VecDeque;
use std::fmt;
use std::fs;
use std::path::PathBuf;
use std::str::FromStr;
use anyhow::{Context, Error};
use thiserror::Error;
use structopt::StructOpt;
use expr::{parse_pairs, Expr};
#[derive(StructOpt)]
#[structopt(name = "spacemod")]
struct Cli {
/// The pattern to s... |
use crate::features::internal::{ExampleFramePacket, ExampleSubmitPacket};
use crate::phases::OpaqueRenderPhase;
use rafx::api::{RafxBufferDef, RafxFormat, RafxPrimitiveTopology, RafxVertexBufferBinding};
use rafx::framework::render_features::RenderPhase;
use rafx::framework::{VertexDataLayout, VertexDataSetLayout};
use... |
use crate::errors::CircuitError;
use crate::rayon_helper::*;
use crate::unitary_decomposition::utils::gray_code;
pub(crate) struct BitPather {
n: u64,
reverse_lookup: Vec<u64>,
}
impl BitPather {
pub(crate) fn new(n: u64) -> Self {
let encoding = gray_code(n);
let mut reverse_lookup = vec!... |
//! Convinience types for calculating probabilities of independent events.
//!
//! This crate provides a simple type which represents a probability of an isolated event
//! happening.
//!
//! It intergrates nicely with the Rust syntax by overloading various operations.
//!
//! # Example
//!
//! ```rust
//! use prob::Pr... |
extern crate winrt_notification;
use chrono::Local;
use clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg};
use humantime::format_duration;
use indicatif::{HumanDuration, ProgressBar, ProgressStyle};
use log::{info, LevelFilter};
use serde::{Deserialize, Serialize};
use std::convert::TryFrom... |
use rand::prelude::*;
use crate::ray::Color;
use crate::vec3::Vec3;
#[derive(Debug,Clone,Copy)]
pub enum Material {
NormalView,
VantaBlack,
Metal{color: Color, fuzz: f32},
Lambertian{color: Color},
Dielectric{color: Color, eta: f32},
}
impl Material {
pub fn scatter(&self, incoming: Vec3, nor... |
#[doc = "Register `P4IV` reader"]
pub struct R(crate::R<P4IV_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<P4IV_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<P4IV_SPEC>> for R {
fn from(reader: crate::R<P4IV_SPEC>) ->... |
pub mod service;
use async_trait::async_trait;
use common::*;
use mbus_api::{v0::*, *};
use service::*;
use std::{convert::TryInto, marker::PhantomData};
use structopt::StructOpt;
use tracing::info;
#[derive(Debug, StructOpt)]
struct CliArgs {
/// The Nats Server URL to connect to
/// (supports the nats schem... |
//! Defines the configuration settings used to start and interact
//! with a node instance.
use std::{
fs,
io::{BufRead, BufReader, Read},
net::Ipv4Addr,
path::{Path, PathBuf},
process::{exit, Command, Stdio},
str::FromStr,
thread,
};
use axum::async_trait;
use serde::de::DeserializeOwned;... |
/*
MIT License
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distrib... |
use crate::internal::*;
use ndarray::prelude::*;
use num_traits::{AsPrimitive, Float};
use std::iter::Sum;
use crate::ops::cnn::pools::PoolSpec;
use crate::ops::cnn::Patch;
use crate::ops::nn::DataShape;
// TODO check why AvgPool need to be typed
#[derive(Debug, Clone, new, Default)]
pub struct AvgPool {
pool_sp... |
// Copyright 2015 Terminal.com
// Based on work by The Rust Project Developers.
//
// Copyright 2014 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
//... |
extern crate clap;
extern crate image;
mod error;
use crate::error::{AppResult, AppError};
use clap::{App, Arg};
use image::io::Reader;
use image::{GrayImage, RgbaImage, ImageBuffer, GenericImage};
use std::cmp::min;
fn main() -> AppResult<()> {
let matches =
App::new("rustic_eye")
.version("... |
use crate::errors;
use crate::errors::{YdbError, YdbResult, YdbStatusError};
use crate::grpc::proto_issues_to_ydb_issues;
use crate::types::Value;
use std::collections::HashMap;
use std::rc::Rc;
use std::vec::IntoIter;
use tracing::trace;
use ydb_grpc::ydb_proto::status_ids::StatusCode;
use ydb_grpc::ydb_proto::table::... |
use asyncgit::{
asyncjob::{AsyncJob, RunParams},
ProgressPercent,
};
use lazy_static::lazy_static;
use scopetime::scope_time;
use std::{
ffi::OsStr,
ops::Range,
path::{Path, PathBuf},
sync::{Arc, Mutex},
time::{Duration, Instant},
};
use syntect::{
highlighting::{
FontStyle, HighlightState, Highlighter,
Ran... |
use anyhow::Context;
use core_foundation::{
array::{CFArrayGetCount, CFArrayGetValues},
base::{CFRange, TCFType},
dictionary::CFDictionary,
string::CFString,
};
use std::mem;
mod ffi;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum DeviceConnectionType {
Usb,
Network,
}
#[derive(Debug, ... |
use substring::Substring;
use std::process;
// argument used in cli, an argument is the main branch to a function e.g. `app help`
pub struct Argument {
// name of the argument, used in the command
pub name: &'static str,
// description of the command in help
pub description: &'static str,
// does the argumen... |
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering, ATOMIC_BOOL_INIT, ATOMIC_USIZE_INIT};
use std::thread;
use std::ops::{Deref, DerefMut};
use std::cell::UnsafeCell;
fn main() {
// Atomics are primitive types suited for
// well defined concurrent behaviour
let some_number = Atom... |
/*
* Copyright (c) 2021. Aberic - 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
* Unless required by applicable law ... |
use crate::core::prelude::*;
use crate::hls::bus::{FIFOReadController, FIFOWriteController};
use crate::widgets::prelude::*;
#[derive(Clone, Debug, Default, LogicInterface)]
#[join = "BidiBusD"]
pub struct BidiBusM<T: Synth> {
pub sig_inout: Signal<InOut, T>,
pub sig_empty: Signal<In, Bit>,
pub sig_full: S... |
//! Extended dimension support
use num_traits::Zero;
use std::fmt;
use std::ops;
mod tree;
pub use self::tree::{Symbol, SymbolValues, TDim};
type TractError = anyhow::Error;
type TractResult<T> = anyhow::Result<T>;
/// A super-trait for value acting as tensor dimensions in tract.
///
/// Implemented by:
///
/// * `u... |
use std::{
io::{self, BufRead},
sync::Arc,
};
use actionable::{
Action, ActionNameList, Actionable, Dispatcher, Permissions, ResourceName, Statement,
};
use async_trait::async_trait;
use tokio::sync::Mutex;
/// This enum is what a "client" will send the "server" in our API.
// The derive(Actionable) macro... |
//! Due to Apple's ~fucking~ terrible documentation, these structures/code where
//! mainly copied from wasmtime's Mac traphandler (which themselves were
//! primarily copied from Spider Monkey) and Breakpad. I just wish Apple had
//! enough resources to properly document their own APIs OH WAIT. I was going
//! to clea... |
// Copyright 2020 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute... |
use super::reference::ReferenceOr;
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
/// The Schema Object allows the definition of input and output data types.
/// These types can be objects, but also primitives and arrays.
/// This object is an extended subset of the
/// [JSON Schema Specification... |
use chrono::Utc;
use clap::{App, AppSettings, Arg, SubCommand,
crate_authors, crate_description, crate_name, crate_version};
use failure::{Error, format_err};
use rusoto_core::Region;
use rusoto_dynamodb::{AttributeValue, DynamoDb, DynamoDbClient,
QueryInput, UpdateItemInput};
use std::collections::HashMap;
fn... |
use nalgebra::DMatrix;
use crate::math_utils::convolve::{convolve_1d, ConvType};
use tokio::runtime::{self};
use tokio::task::JoinHandle;
pub fn multiple_sav_golays(
y_input_ptr: *mut f64,
input_indices_ptr: *mut usize,
input_indices_size: usize,
output_ptr: *mut f64,
data_length: usize,
wind... |
use super::note::{Note, NOTE_1_2_DURATION, NOTE_1_4_DURATION};
use array::Array;
use beeper::tone::Tone;
/// Defines a predefined melody to play.
#[derive(Debug, Copy, Clone)]
pub enum Melody {
Alarm,
Beep,
Reset,
Setup,
Custom(Array<Tone>),
}
impl Into<Array<Tone>> for Melody {
fn into(self) ... |
pub use libeir_ir::binary::{BinaryEntrySpecifier, Endianness};
use libeir_ir::{
operation::binary_construct::{
BinaryConstructFinish, BinaryConstructPush, BinaryConstructStart,
},
Block as IrBlock, FunctionBuilder, Value as IrValue,
};
use libeir_util_binary::BitVec;
use crate::parser::binary::{Ty... |
use crate::{
commands::play::{Mode, QueryType},
sources::ffmpeg::ffmpeg,
};
use serde_json::Value;
use serenity::async_trait;
use songbird::input::{
error::{Error as SongbirdError, Result as SongbirdResult},
restartable::Restart,
Codec, Container, Input, Metadata, Restartable,
};
use std::{
io::... |
use std::str::FromStr;
use mysql_async::Value;
use nature_common::Executor;
use crate::{MetaCache, MetaDao, Relation, RelationSettings};
use crate::raw_models::RawRelation;
use super::*;
pub type Relations = Result<Vec<Relation>>;
lazy_static! {
pub static ref D_R: RelationDaoImpl = RelationDaoImpl {};
}
#[a... |
use crate::config::Secure;
use actix_web::dev::{HttpServiceFactory, RequestHead};
use actix_web::guard::Guard;
use actix_web::rt::time::sleep;
use actix_web::web::Data;
use actix_web::{web, HttpResponse};
use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation};
use log::error;
use serde::de::De... |
use alloc::borrow::Cow;
use alloc::collections::BTreeMap;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::convert::TryFrom;
use chrono::{NaiveDate, NaiveDateTime};
use serde::{Serialize, Serializer};
use crate::error::EtError;
/// For a given state struct, the metadata associated with that stru... |
use std::collections::hash_map::{Entry, HashMap};
use ty;
use ir::IdentifierId;
#[derive(Debug, Default)]
pub struct Tables {
pub globals: GlobalsTable,
pub locals: SymbolTable,
pub types: TypeTable,
}
impl Tables {
pub fn new_locals(&mut self) {
self.locals = SymbolTable::new();
}
}
#[d... |
#[doc = "CH_READ_ADDR register accessor: an alias for `Reg<CH_READ_ADDR_SPEC>`"]
pub type CH_READ_ADDR = crate::Reg<ch_read_addr::CH_READ_ADDR_SPEC>;
#[doc = "DMA Channel 0 Read Address pointer
This register updates automatically each time a read completes. The current value is the next address to be read by this ch... |
use crate::http::storage_client;
use crate::http::storage_client::StorageClient;
use google_cloud_auth::{create_token_source_from_project, Config, Project};
use std::ops::Deref;
use std::sync::Arc;
use crate::sign::{signed_url, SignBy, SignedURLError, SignedURLOptions};
#[derive(thiserror::Error, Debug)]
pub enum Er... |
use crate::oa::{OAConstructor, OAResult, OA};
use crate::utils::{poly_eval, to_base_fixed, Integer, OarsError, OarsResult};
use ndarray::Array2;
use num::pow::pow;
use oars_proc_macro::Checked;
use primes::is_prime;
use std::cmp::min;
#[cfg(feature = "parallel")]
use crate::oa::ParOAConstructor;
#[cfg(feature = "para... |
use anyhow::Result;
use gw_types::offchain::RunResult;
use gw_types::packed::{self, BlockInfo, L2Transaction, WithdrawalRequest};
use smol::channel::{Receiver, Sender, TryRecvError, TrySendError};
use smol::lock::Mutex;
use crate::pool::{Inner, MemPool};
use std::future::Future;
use std::sync::Arc;
use std::time::{Du... |
use super::common::*;
use gaiku_common::{prelude::*, Result};
use std::{convert::TryInto, marker::PhantomData};
/// Implementation of the marching cubes terrain generation.
pub struct MarchingCubesBaker;
impl MarchingCubesBaker {
// Kept public so that we can use it in the benches
pub fn bake_with_builder<C, T, M... |
// Implementation for a single tac-toe board
use crate::math::random_usize;
#[derive(Clone, Copy, PartialEq)]
pub enum CellValue {
O,
X,
Empty,
}
impl CellValue {
pub fn is_empty(value: CellValue) -> bool {
match value {
CellValue::Empty => true,
_ => false,
}
... |
use alpm::{Package, SigLevel};
use anyhow::{anyhow, Result};
use error::RebuildOrderError;
use petgraph::dot::{Config, Dot};
use petgraph::graph::DiGraph;
use petgraph::visit::DfsPostOrder;
use std::collections::{HashMap, HashSet, VecDeque};
use std::fs::File;
use std::io::{BufWriter, Write};
pub mod args;
pub mod err... |
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
const READ_ERR: &str = "something went wrong reading the file";
const WRITE_ERR: &str = "something went wrong writing the file";
const NOT_FOUND: &str = "file not found";
/// Reads a file, and returns a Vec-String- where each element is a line... |
use crate::pedersen::*;
use byteorder::{BigEndian, ByteOrder, LittleEndian};
use jubjub::{AffineNielsPoint, AffinePoint, ExtendedPoint, Fq, Fr};
use blake2s_simd::{blake2s, Hash as Blake2sHash, Params as Blake2sParams};
pub const PEDERSEN_RANDOMNESS_BASE: AffineNielsPoint = AffinePoint::from_raw_unchecked(
Fq::fr... |
/*
This source code file is distributed subject to the terms of the GNU Affero General Public License.
A copy of this exp: (), user_id: () exp: (), user_id: () exp: (), user_id: () exp: (), user_id: () license can be found in the `licenses` directory at the root of this project.
*/
use rocket::{outcome::IntoOutcome, r... |
use std::fs::File;
use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Read, Write};
use std::path::Path;
use std::str::FromStr;
use clap::{crate_authors, crate_name, crate_version, App as ClapApp, AppSettings, Arg};
use log::debug;
use syntect::dumps::from_binary;
use refmt::assets::HighlightAssets;
use refm... |
use crate::isl::isl_constraint::IslConstraint;
use crate::isl::isl_import::{IslImport, IslImportType};
use crate::isl::isl_type::IslTypeImpl;
use crate::result::{
invalid_schema_error, invalid_schema_error_raw, unresolvable_schema_error, IonSchemaResult,
};
use crate::system::{PendingTypes, TypeId, TypeStore};
use ... |
use layout21::raw::Layer;
use layout21::raw::LayerPurpose;
use layout21::raw::Layers;
use layout21::raw::LayoutResult;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::Path;
pub use layout21::raw::Int;
/// The type to use for nonnegative values.
/// Defaults to the same as [`Int`] fo... |
use crate::{app_ref, term_ref, TermRef};
pub fn u() -> TermRef {
term_ref!(universe 0)
}
pub fn z() -> TermRef {
term_ref!(axiom "ℤ" , u())
}
pub fn false_ty() -> TermRef {
term_ref!(axiom "False" , u())
}
pub fn true_ty() -> TermRef {
term_ref!(axiom "True" , u())
}
fn v0() -> TermRef {
term_ref!(... |
/*
* Copyright (c) 2016-2018 Boucher, Antoni <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, mod... |
use crate::{
error::{err, ok},
semantic_analysis::{
ast_node::expression::typed_expression::{
instantiate_struct_field_access, instantiate_tuple_index_access,
instantiate_unsafe_downcast,
},
namespace::Namespace,
IsConstant, TypedEnumVariant, TypedExpressi... |
use std::collections::{HashMap, HashSet, VecDeque};
use std::fmt;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Tile {
Wall,
Open,
Key(char),
Door(char),
Entrance(char),
}
impl Tile {
/// Numeric encodes the Tile... |
use super::{class::Category, class::Class, Character};
use crate::item::ring::Ring;
use crate::location;
use crate::log;
use crate::randomizer::{random, Randomizer};
use rand::prelude::SliceRandom;
use rand::Rng;
/// Randomly spawn an enemy character at the given location, based on the
/// current character stats.
///... |
// 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 writi... |
//! Defines the [PdfFont] struct, exposing functionality related to a single font used to
//! render text in a `PdfDocument`.
use crate::bindgen::{FPDF_FONT, FPDF_FONT_TRUETYPE, FPDF_FONT_TYPE1};
use crate::bindings::PdfiumLibraryBindings;
use crate::document::PdfDocument;
use crate::error::{PdfiumError, PdfiumInterna... |
//! With scripting, you can evaluate custom expressions in Elasticsearch. For example, you can use
//! a script to return a computed value as a field or evaluate a custom score for a query.
//!
//! The default scripting language is [Painless](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scrip... |
use bevy::{ecs::component::Component, prelude::*};
use crate::effect::*;
use std::marker::PhantomData;
use smolset::SmolSet;
pub trait EffectStack
where
Self: 'static + Sized + Send + Sync + Component,
{
type EffectComponent: Component;
type TargetEffectComponent: Component;
fn apply(&mut self, comp... |
#[macro_use]
extern crate clap;
use clap::App;
use crossbeam_channel::{unbounded, Receiver};
use enigo::{Enigo, MouseButton, MouseControllable};
use inputbot::{
handle_input_events,
MouseButton::{LeftButton, RightButton},
};
use rand::prelude::*;
use std::{
thread::{sleep, spawn},
time::{Duration, Syste... |
use anyhow::{Context, Error};
use cbindgen::{Config, Language};
use libloading_bindgen::BindingStrategy;
use quote::ToTokens;
use std::{
env,
fs::File,
path::{Path, PathBuf},
process::{Command, Stdio},
};
use syn::ForeignItemFn;
use tempfile::Builder;
macro_rules! integration_test {
($directory:ide... |
use jni::{
errors::Result,
objects::{AutoLocal, JMethodID, JObject},
signature::{JavaType, Primitive},
sys::jlong,
JNIEnv,
};
use uuid::Uuid;
/// Wrapper for [`JObject`]s that contain `java.util.UUID`. Provides methods
/// to convert to and from a [`Uuid`].
///
/// Looks up the class and method IDs... |
//! Manage lvm snapshots.
use chrono::{Datelike, Local};
use std::{
collections::{HashMap, HashSet},
io::{BufRead, BufReader},
process::{Command, Stdio},
};
use crate::checked::CheckedExt;
use crate::Result;
#[derive(Debug)]
pub struct Lvm {
vg: String,
lv: String,
snaps: Vec<String>,
}
impl... |
use super::Pool;
use serde::{Deserialize, Deserializer};
#[cfg(feature = "postguard")]
use std::str::FromStr;
use std::{
convert::TryFrom,
net::{IpAddr, Ipv4Addr, SocketAddr},
time::Duration,
};
use thiserror::Error;
#[cfg(feature = "ssl-native-tls")]
use native_tls::TlsConnector;
#[cfg(feature = "ssl-nati... |
use crate::generate::{FnSelfArg, Generator};
use crate::parse::{EnumVariant, Fields};
use crate::prelude::*;
use crate::Result;
const TUPLE_FIELD_PREFIX: &str = "field_";
pub struct DeriveEnum {
pub variants: Vec<EnumVariant>,
}
impl DeriveEnum {
pub fn generate_encode(self, generator: &mut Generator) -> Res... |
//! Returns *nix signal enum value from passed string
use anyhow::{bail, Context, Result};
use nix::sys::signal::Signal as NixSignal;
use std::convert::TryFrom;
/// POSIX Signal
#[derive(Debug)]
pub struct Signal(NixSignal);
impl TryFrom<&str> for Signal {
type Error = anyhow::Error;
fn try_from(s: &str) ->... |
use block::Block::{A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y};
use loc::Loc;
use point::Point;
use point_block::PointBlock;
use settings::Settings;
pub struct LocBlock {
pub loc: Loc,
pub settings: Settings,
}
impl LocBlock {
fn text_width(&self) -> f32 {
self.setti... |
use super::{handler, Opts};
use bytes::Bytes;
use futures::join;
use hyper::{Body, Client, Method, Request};
use serde_json::Value;
use std::{env, fs};
static NERDGRAPH_URL: &str = "https://api.newrelic.com/graphql";
pub static INTEGRATIONS_DIR_NIX: &str = "/etc/newrelic-infra/integrations.d";
pub static INTEGRATIONS_... |
use super::Input;
use crate::config::Compression;
use flate2::read::GzDecoder;
use std::boxed::Box;
use std::fs::File;
use std::io::{self, Read};
use std::path::Path;
use std::pin::Pin;
use zip::read::{ZipArchive, ZipFile};
use zip::result::ZipError;
/// Checks for a "magic number" at the start of the content, and ret... |
extern crate yaml_rust;
extern crate clap;
use std::io::prelude::*;
use std::io::{self};
use std::fs::File;
use std::path::Path;
use std::error::Error;
use yaml_rust::{YamlLoader, Yaml};
use clap::{App, SubCommand};
macro_rules! stderr {
($($arg:tt)*) => (
use std::io::Write;
match writeln!(&mut ... |
use super::{BeginMode, BufferMask, DataType, WebGlCommon, WebGlRenderer, DrawBuffer, Buffer};
use crate::errors::Error;
use web_sys::{WebGl2RenderingContext, WebGlRenderingContext};
use crate::data::{TypedData};
use js_sys::Array;
pub trait PartialWebGlDrawing {
fn awsm_clear(&self, bits: &[BufferMask]);
fn aw... |
use std::cell::RefCell;
use std::io::Read;
use torifune::numeric;
pub fn year_to_season(year: i64) -> i64 {
year
}
pub fn random_select<T>(mut i: std::slice::Iter<T>) -> Option<&T> {
i.nth(rand::random::<usize>() % i.len())
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DayOfWeek {
Sunday,
Monda... |
use super::expression::*;
use super::generator::*;
use super::types::*;
use super::util::value_type_from_mask;
use super::{CompilerExpression, VertexAttributeType, WgslValueType};
use crate::hash::*;
use crate::math::*;
use anyhow::{anyhow, bail, Result};
use mopa::mopafy;
use std::collections::{HashMap, HashSet};
use ... |
use bevy::render::camera::PerspectiveProjection;
use bevy::{prelude::*, render::camera::Camera};
use bevy_mod_picking::*; // Import all the picking goodies!
fn main() {
App::build()
.insert_resource(WindowDescriptor {
vsync: false, // Disabled for this demo to remove vsync as a source of input ... |
extern crate crossbeam;
extern crate num_cpus;
extern crate serde_json;
use std::collections::HashMap;
use std::sync::mpsc;
pub trait Hasher : Sync {
fn digest(&self, plaintext : &str) -> String;
}
pub trait Reducer : Sync {
fn reduce(&self, hash : &str) -> String;
}
pub struct RainbowTable<H, R> where H : ... |
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#![deny(missing_docs)]
//! Defines a generic interface for version tolerant serialization and
//! implements it for primitive data types using `bincode` as backend.
//!
//! The interface has two components... |
use std::fmt;
use tracing::debug;
use tracing::trace;
use tracing::error;
use tracing::instrument;
use fluvio_future::task::spawn;
use k8_types::core::service::LoadBalancerIngress;
use crate::core::SharedContext;
use crate::stores::{StoreContext, K8ChangeListener};
use crate::stores::spu::IngressAddr;
use crate::sto... |
use bevy::math;
use bevy::{prelude::*, render::camera::Camera};
use bevy_tiled_prototype::level;
use bevy_tiled_prototype::TiledMapCenter;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_plugin(bevy_tiled_prototype::TiledMapPlugin)
.add_startup_system(setup.system())
.add_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.