text stringlengths 3.09k 13.9k |
|---|
use std::cmp;
use std::iter;
use std::mem;
use std::usize;
use rustc::hir::def_id::DefId;
use rustc_data_structures::indexed_vec::IndexVec;
use super::constraint::ConstraintSet;
use super::context::{Ctxt, Instantiation, VariantSumm};
use super::{ConcretePerm, Perm, Var};
pub struct InstCtxt<'lty, 'a: 'lty, 'tcx: 'a>... |
use std::collections::BTreeMap;
use std::fs;
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use std::time::Instant;
use bincode::deserialize;
use std::str::FromStr;
use log::info;
use filecoin_hashers::{HashFunction, Hasher};
use blstrs::Scalar as Fr;
use fil_proofs_tooling::measure;
use ... |
// Copyright (c) 2021-present, Cruise LLC
//
// This source code is licensed under the Apache License, Version 2.0,
// found in the LICENSE-APACHE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
use wrflib::*;
use wrflib_components::*;
#[derive(Defau... |
mod network;
use ndarray::Array1;
use network::Network;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use rand;
use rand::prelude::*;
#[derive(PartialEq)]
enum CommandName {
Run,
Train,
Debug,
Test,
}
// #[derive(Deserialize)]
// struct Tweet {
// count: i32,
// h... |
//! Boyer–Moore string search algorithm
/*
Good suffix rule:
- Case 1: Complete match of suffix
s: ............b[ u ]............
p: ..[ u ]...a[ u ]
p': ..[ u ]...a[ u ]
- Case 2: Partial match of suffix
s: .............b[ u1 ][ u2 ]....................
p: [ u2 ]...a[ u1 ][ u2... |
use failure::{format_err, Error};
use utils::{result, ParseResult, RetTypes};
const EYE_COLOR: &[&str] = &["amb", "blu", "brn", "gry", "grn", "hzl", "oth"];
#[derive(Default)]
struct Passport {
byr: Option<usize>, // (Birth Year)
iyr: Option<usize>, // (Issue Year)
eyr: Option<usize>, // (Expiration Ye... |
//! This crate provides functionality for decoding & encoding (Open)NoteBlockStudio buffers.
//!
//! It supports the original NBS format, aswell as version 1-4 of the unofficial new format introduced in [OpenNoteBlockStudio](https://github.com/HielkeMinecraft/OpenNoteBlockStudio).
//! Documentation on the NBS format ca... |
use std::slice;
use std::mem::size_of;
use std::os::raw::c_char;
use std::fmt::{self as fmt, Debug};
pub const FMR_MAGIC_NUMBER: u8 = 0xFE;
pub const FMR_PACKET_SIZE: usize = 64;
pub const FMR_PAYLOAD_SIZE: usize = FMR_PACKET_SIZE - size_of::<FmrHeader>();
#[derive(Copy, Clone)]
#[repr(C, packed)]
pub struct FmrPaylo... |
use std::sync::{mpsc, Mutex, Arc};
use std::sync::mpsc::{Sender, Receiver};
use tonic::{transport::Server, Request, Response, Status};
use redis_module::{Context, RedisError, RedisResult, ThreadSafeContext, DetachedFromClient};
use funcloc::func_loc_server::{FuncLoc, FuncLocServer};
use funcloc::{InvokeRequest, Invo... |
extern crate futures;
extern crate sysfs_gpio;
use futures::prelude::*;
use std::error::Error;
use std::fmt;
use std::thread::sleep;
use std::time::{Duration, Instant};
use sysfs_gpio::{Direction, Edge, Pin, PinValueStream};
use tokio::timer::Delay;
pub struct FanSHIM {
fan: Pin,
data: Pin,
clock: Pin,
button: Pi... |
extern crate diesel;
extern crate diesel_migrations;
extern crate nom;
extern crate dasp;
extern crate enum_primitive_derive;
extern crate find_folder; // For easily finding the assets folder.
extern crate harmony_explorer;
extern crate num_traits;
extern crate pitch_calc as pitch; // To work with musical notes.
exter... |
use crate::solana_blocks::{
EncodedTransaction, EncodedTransactionWithStatusMeta, TransactionError, UiMessage,
UiRawMessage, UiTokenAmount, UiTransaction, UiTransactionStatusMeta, UiTransactionTokenBalance,
};
use crate::{Rewards, SolProbeError, SolProbeResult, StringAmount, StringDecimals};
use serde::{Deseria... |
use crate::discord::snowflake::Snowflake;
use bitflags::bitflags;
use serde::{Deserialize, Deserializer, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
/**
* Channel Types
* @docs <https://discord.com/developers/docs/resources/channel#channel-object-channel-types>
*/
#[derive(Serialize_repr, Deseri... |
use geo::bounding_rect::BoundingRect;
use std::borrow::Cow;
use crate::geometry::point::IntoPoint;
use crate::geometry::{
check_dimensions_match, min_distance_point_region, min_distance_region, LineSegment, Point,
Shape, Shapelike, ShapelikeError,
};
#[derive(Debug, Clone, PartialEq)]
pub struct Region {
... |
//! ITM protocol.
use crate::{
output::{Output, Stream},
PORTS_COUNT,
};
use anyhow::Result;
use log::{debug, warn};
use smallvec::SmallVec;
use std::{
cell::{Cell, RefCell},
ops::{Generator, GeneratorState},
pin::Pin,
rc::Rc,
};
/// ITM protocol parser.
pub struct Parser<'cli> {
pipe: Rc<... |
use clap::{App, Arg, ArgMatches};
use crossterm::{terminal::size, Result};
use grid::Grid;
mod frontend;
use frontend::{FrontEnd, Heuristic};
use std::fs::File;
use std::io::{BufRead, BufReader};
fn main() -> Result<()> {
let matches = get_args_matches();
let grid = get_grid(&matches)?;
let wall_percentage... |
// Copyright 2021. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// di... |
use lvgl_sys::{lv_coord_t, lv_obj_t};
use core::{
ops::{Deref, DerefMut},
ptr,
};
use crate::{
style::{Align, Flag, State},
core::Event,
core::event::add_event_cb,
};
/// Base LVGL object. C is the application context that we provide to the
/// callbacks The lifetime of the object depends on the ... |
use crate::cuda::CudaRendererBuffers;
use anyhow::Result;
use cust::{
memory::{DeviceBox, DeviceBuffer},
prelude::Stream,
};
use optix::{
acceleration::{
Aabb, Accel, AccelBuildOptions, BuildFlags, CustomPrimitiveArray, GeometryFlags,
Traversable,
},
context::DeviceContext,
prelu... |
// Copyright 2020 Tetrate
//
// 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 writ... |
// 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 terms.
// Management of th... |
use actix_web::web;
use chrono::NaiveDateTime;
use chrono::Utc;
use diesel::insert_into;
use diesel::pg::PgConnection;
use diesel::r2d2::{ConnectionManager, Pool};
use diesel::QueryDsl;
use diesel::RunQueryDsl;
use diesel::{BelongingToDsl, ExpressionMethods};
use rand::seq::SliceRandom;
use rand::Rng;
use std::convert:... |
use std::path;
use xmltree;
use crate::anchor::Anchor;
use crate::component::GlifComponents;
use crate::error::GlifParserError;
use crate::guideline::Guideline;
use crate::image::GlifImage;
use crate::point::PointData;
use crate::outline::{Outline, OutlineType};
mod read;
mod write;
#[cfg(feature = "mfek")]
pub mod m... |
use crate::{
error::NettuError,
event::{self, subscribers::UpdateSyncedEventsOnEventUpdated},
shared::auth::protect_route,
shared::{
auth::{
account_can_modify_event, account_can_modify_user, protect_account_route, Permission,
},
usecase::{execute, execute_with_policy... |
// Copyright 2021 Sony Group Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use anyhow::{anyhow, Result};
use libseccomp::*;
use oci::{LinuxSeccomp, LinuxSeccompArg};
use std::str::FromStr;
fn get_filter_attr_from_flag(flag: &str) -> Result<ScmpFilterAttr> {
match flag {
"SECCOMP_FILTER_FLAG_TSY... |
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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 option) any lat... |
use crate::{
core::{
container::State,
hooker::{Hook, HookType},
reporter::Report,
tester::{Closure, Test},
timer::TimeUnitType,
},
exports::export::{Export, ExportConfig},
};
use std::{
collections::HashMap,
sync::{Arc, Mutex, MutexGuard},
};
use miniserde::Serialize;
#[derive(Debug... |
use crate::color::reset_display;
use crate::git::{Git, GitStatus, GitStatusItem, GitStatusType};
use crate::Config;
use crate::TermBuffer;
use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
style::{style, Color},
};
use std::iter;
#[derive(Debug)]
pub struct FilesPrompt<'a> {
config: &... |
// TODO many routines should be "generic" enough to be refactored
use std::fmt;
use std::collections::{HashSet, HashMap};
use std::collections::hash_map::Entry;
use vec_map::{self, VecMap};
use parking_lot::RwLock;
use kailua_env::{Span, Spanned};
use kailua_diag::{self, Report, Reporter};
use kailua_syntax::Name;
us... |
use crate::core::DateLike;
use chrono::prelude::*;
use numpy::PyArray1;
use pyo3::{exceptions, prelude::*, types::*};
const SECONDS_IN_DAY: i64 = 24 * 60 * 60;
impl From<&PyDate> for DateLike {
fn from(value: &PyDate) -> Self {
let date =
NaiveDate::from_ymd(value.get_year(), value.get_month()... |
// Copyright (c) 2021 Quark Container 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 ... |
use amethyst::core::ecs::{Entities, LazyUpdate};
use amethyst::{
core::math::Vector2,
core::transform::Transform,
ecs::prelude::{Join, Read, ReadStorage, System, Write, WriteStorage},
input::{InputHandler, StringBindings},
};
use crate::components::*;
use crate::levels::*;
use crate::resources::*;
use ... |
use crate::{AsRawMut, ContextHandle, ContextHandling, Geom};
use context_handle::PtrWrap;
use enums::*;
use error::{Error, GResult, PredicateType};
use geometry::Geometry;
use geos_sys::*;
use std::convert::TryFrom;
use std::ffi::CStr;
use std::os::raw::c_char;
use std::str;
use std::sync::Arc;
// We need to cleanup o... |
pub mod context;
pub mod mesh;
pub mod texture;
use std::io;
use std::io::Read;
use std::fs::File;
use std::path::Path;
use glium::Surface;
use glium::texture::RawImage2d;
use glium::texture::Texture2d;
use glium::texture::Texture2dArray;
use glium::program::Program;
use glium::draw_parameters::DrawParameters;
use g... |
extern crate cgmath;
#[macro_use]
extern crate gfx;
extern crate gfx_window_glutin;
extern crate glutin;
extern crate time;
use cgmath::{perspective, Deg, Matrix4, Point3, Rad, vec3};
use gfx::Device;
use gfx::traits::FactoryExt;
use glutin::GlContext;
use time::precise_time_s;
pub type ColorFormat = gfx::format::Rgb... |
use rusqlite::{params, Connection};
use std::error::Error;
use std::fmt;
use serde::{Deserialize, Serialize};
use std::os::unix::fs::PermissionsExt;
#[derive(Serialize, Deserialize, Debug)]
pub struct BoostRecord {
pub index: u64,
pub time: i64,
pub value_msat: i64,
pub value_msat_total: i64,
pub ... |
// 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 terms.
use crate::connecti... |
/*
* Copyright (c) 2020, 2021, 2022 Valve Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* l... |
use crate::config::{Icinga2ClientConfig, Stream};
use crate::error::Icinga2CollectorError;
use futures::stream::TryStreamExt;
use log::*;
use reqwest::{header, Client};
use std::time;
use tokio::io::AsyncBufReadExt;
use tokio_util::compat::FuturesAsyncReadCompatExt;
use tornado_collector_common::Collector;
use tornado_... |
//! Contains definitions from `lauxlib.h`.
use std::os::raw::{c_char, c_int, c_void};
use std::ptr;
use super::lua::{self, lua_CFunction, lua_Integer, lua_Number, lua_State};
// Extra error code for 'luaL_load'
pub const LUA_ERRFILE: c_int = lua::LUA_ERRERR + 1;
#[repr(C)]
pub struct luaL_Reg {
pub name: *const... |
use std::str::FromStr;
use crate::{
args::read_repo_from_file,
list::StateFilter,
project::Project,
sort::{Order, Property, Sorting},
target::Target,
user::Username,
AppErr,
};
use structopt::StructOpt;
use termcolor::ColorChoice;
#[derive(StructOpt, Debug)]
#[structopt(name = "giss", auth... |
use crate::engine::*;
use std::{path::Path, rc::Rc, sync::Mutex};
use winit::{event::*, window::Window};
pub struct Engine {
pub instance: wgpu::Instance,
pub surface: wgpu::Surface,
pub adapter: wgpu::Adapter,
pub device: wgpu::Device,
pub queue: wgpu::Queue,
pub swap_chain_descriptor: wgpu::S... |
use super::graph::{Node, NodeResult, SignalRef};
use super::program::{Function, Parameters, State};
use std::f64;
use std::slice::from_ref;
// =================================================================================================
/// The mode for a state-variable filter.
#[derive(Debug, Clone, Copy, Partia... |
use actix_web::{get, post, web, HttpResponse, Responder};
use std::collections::HashMap;
use sqlx::PgPool;
use crate::tools::datamodels::{Changelog, ScoreParams, CoopMap, CoopBanned, CoopPreviews, CoopRanked};
use crate::tools::calc::score;
/// Endpoint to handle the preview page showing all coop maps.
#[get("/coop")... |
//! Writer task that posts data to the api
use crate::error::Error::ChannelError;
use crate::error::{log_error, Error};
use crate::DataDogConfig;
use chrono::{DateTime, Duration, Utc};
use flume::RecvTimeoutError;
use itertools::Itertools;
use log::debug;
use reqwest::header::CONTENT_TYPE;
use reqwest::Client;
use std... |
use std::iter::*;
use std::io::{BufReader, Read};
use crate::utils::*;
pub static HELLO_MSG_ID: &str = "HELO";
// HELLO
#[derive(Debug, PartialEq)]
pub struct HelloCommand {
pub id: String,
pub user: String,
pub msg: String
}
impl HelloCommand {
/**
* Creates a HelloCommand from a buffer.
*... |
use std::arch::x86_64::*; // Intel SIMD intrinsic mappings
#[allow(non_camel_case_types)]
pub type f32x8 = __m256;
#[allow(non_upper_case_globals)]
pub const f32x8_LENGTH: usize = 8;
/// Return a 256-bit vector containing 8 infinity values of f32
#[inline]
pub fn f32x8_infty() -> f32x8 {
unsafe { _mm256_set1_ps(s... |
pub fn run(part: u8) -> u64 {
let input_line = include_str!("../inputs/day16.txt");
match part {
1 => part1(input_line),
2 => part2(input_line),
_ => panic!("no such part")
}
}
#[derive(Debug, PartialEq)]
struct Packet {
version: u8,
value: Value,
}
#[derive(Debug, PartialEq)]
enum Value {
Lit... |
use std::collections::HashMap;
use naia_server::{
shared::Random, Event, RoomKey, Server as NaiaServer, ServerAddrs, ServerConfig, UserKey,
};
use naia_demo_world::{Entity, World as DemoWorld};
use naia_macroquad_demo_shared::{
behavior as shared_behavior,
protocol::{Color, EntityAssignment, KeyCommand, ... |
use crate::fields::ValidationFn;
use plaster::prelude::*;
/// An autocompleting search select field
pub struct Select {
label: String,
search: String,
searching: bool,
selected_option: i32,
value: Option<String>,
value_label: String,
validate: ValidationFn<Option<String>>,
validation_er... |
//! Conversions between integer types that check for overflow and underflow
//!
//! The functions that this module exposes attempt to cast from one primitive
//! integer type to another, returning `None` on overflow or underflow.
//!
//! # Examples
//! ```
//! use checked_int_cast::CheckedIntCast;
//!
//! // Returns No... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::io;
use std::io::prelude::*;
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
enum Tile {
Bug,
Empty,
}
type State = Vec<Vec<Tile>>;
fn adjacent_bugs(x: usize, y: usize, state: &State) -> usize {
[(0, -1), (1, 0), (0, 1), (-1, 0)]
... |
use std::collections::HashMap;
use std::sync::mpsc::{Sender, Receiver};
use std::sync::mpsc::TryRecvError;
use std::sync::{Arc, Mutex};
use std::old_io::timer;
use std::time::Duration;
use messages::{MarketMessages, MarketHistory, ActorMessages, TransactionRequest};
use messages::ActorMessages::{StockRequest, MoneyReq... |
use crate::{Array1, Array2};
use anyhow::{anyhow, Error, Result};
use std::{
fs::File,
io::{BufRead, BufReader},
path::PathBuf,
};
/// Compute the arithmetic mean of an array.
pub(in crate) fn mean(arr: &[f64]) -> Result<f64, Error> {
if arr.is_empty() {
return Err(anyhow!("Can't take mean of e... |
use crate::error::*;
use finch::executor::Driver;
use std::collections::HashMap;
const MAX_DRIVERS: usize = 256;
pub struct Debugger {
breakpoints: Vec<u64>,
breaked_drivers: Vec<Driver>,
drivers: Vec<Driver>,
killpoints: Vec<u64>,
merge_points: Vec<u64>,
merged_drivers: HashMap<u64, Driver>,
... |
use std::cmp::PartialOrd;
use std::collections::HashMap;
use std::str::FromStr;
#[derive(Clone)]
struct Range<A>(A, A);
impl<A: PartialOrd> Range<A> {
fn contains(&self, x: &A) -> bool {
self.0 <= *x && *x <= self.1
}
}
impl<A: FromStr> FromStr for Range<A> {
type Err = String;
fn from_str(r... |
//! Table elements within a wasm module.
use crate::emit::{Emit, EmitContext, Section};
use crate::ir::Value;
use crate::parse::IndicesToIds;
use crate::tombstone_arena::{Id, Tombstone, TombstoneArena};
use crate::{FunctionId, InitExpr, Module, Result, TableKind, ValType};
use anyhow::{bail, Context};
/// A passive e... |
use std::collections::{HashSet, VecDeque};
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
struct State {
coords: (usize, usize),
keys: Vec<char>,
}
fn find_entrance(maze: &[Vec<char>]) -> (usize, usize) {
for (y, line) in maze.iter().enumerate() {
for (x, &c) in line.iter().enumerate() {
... |
use std::rc::Rc;
use convert_case::{Case, Casing};
use handlebars::{
Context, Handlebars, Helper, HelperDef, JsonValue, PathAndJson, RenderContext, RenderError,
ScopedJson,
};
use regex::Regex;
use crate::template::{ConcatHelper, DefaultHelper, RegexReplaceHelper, SetHelper, TimeHelper};
macro_rules! add_cas... |
//! # Utility methods and types
use super::CaptivePortalError;
use futures_util::future::Either;
use futures_util::future::try_select;
use pin_utils::pin_mut;
use std::future::Future;
use std::net::SocketAddr;
use std::pin::Pin;
use std::task::{self, Poll};
use std::time::Duration;
use tokio::net::UdpSocket;
use tokio... |
use super::config::get_input;
use super::Result;
use helium_console::NewDevice;
use oauth2::{
basic::BasicClient,
prelude::{NewType, SecretNewType},
AccessToken, AuthUrl, AuthorizationCode, ClientId, ClientSecret, TokenResponse, TokenUrl,
};
use reqwest::Client as ReqwestClient;
use serde_derive::{Deseriali... |
use crate::ce::types::Error;
use std::collections::HashMap;
#[derive(Eq, PartialEq, Clone)]
pub enum Token {
INTEGER(i128),
PLUS,
STAR,
COLON,
COMMA,
MINUS,
LBRACKET,
RBRACKET,
MOV,
MOVZX,
ADD,
CALL,
CMP,
CQO,
IDIV,
IMUL,
JZ,
JMP,
LEA,
NE... |
use arret_runtime::boxed;
use arret_runtime::boxed::prelude::*;
use arret_runtime::boxed::refs::Gc;
use arret_runtime::boxed::TypeTag;
use arret_runtime::class_map;
use arret_runtime::intern::InternedSym;
use crate::mir::eval_hir::{EvalHirCtx, EvaledRecordClass};
use crate::mir::value::Value;
use crate::ty::record;
f... |
//! ## Event
//!
//! event adapter for crossterm
/**
* MIT License
*
* tui-realm - Copyright (C) 2021 <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, inc... |
use std::cell::RefCell;
use strum_macros::{Display};
use super::{ *};
use super::super::second_layer::{*};
use super::super::physical_layer::{*};
use super::super::protocol_layers::{ProtocolStack};
use super::super::line::*;
struct SendCommandHandle {
profile: SocketProfile,
notify_transmit_tx: UnboundedSender<Sch... |
use std::path::Path;
use chrono::{Datelike, Duration, Local, TimeZone};
use clap::Clap;
use crate::{
error::Error,
parser::get_date,
schedule::Schedule,
task::{Task, TaskTime},
};
#[derive(Clap, Debug, Clone)]
#[clap(version = "0.1")]
pub struct Opts {
#[clap(subcommand)]
pub subcmd: Option<S... |
use crate::faker::category::Category;
use crate::helper::{not_string_formatted, string_formatted};
#[derive(Eq, PartialEq, Debug, Clone)]
pub enum FakeOption {
// with other FakeOptions
Join(String, Vec<Box<FakeOption>>),
// Fixed Value
FixedString(String),
FixedNotString(String),
// Random s... |
use super::*;
macro_rules! var {
($x:expr) => {
Expr::Var($x)
};
}
macro_rules! app {
($x:expr, $y:expr) => {
Expr::App(Box::new($x), Box::new($y))
};
}
macro_rules! abs {
($x:expr) => {
Expr::Abs(Box::new($x))
};
}
macro_rules! ann {
($x:expr, $t:expr) => {
... |
use std::{
fmt,
future::Future,
io,
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
};
use bytes::Bytes;
use futures_core::{ready, Stream};
use pin_project_lite::pin_project;
pin_project! {
/// A coder type that can be used for either encode or decode which determined by De type.
... |
//! A module for issues creation.
use crate::visualization;
use geojson::FeatureCollection;
use gtfs_structures::Gtfs;
use serde::Serialize;
/// Represents the severity of an [`Issue`].
///
/// [`Issue`]: struct.Issue.html
#[derive(Serialize, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Copy, Clone)]
pub enum Severity... |
use log::*;
use regex::Regex;
use std::io::{BufRead, BufReader, Lines};
use std::process::{ChildStdout, Command, Stdio};
/*-------------------------------------*/
/* ProcessState */
#[derive(PartialEq)]
enum ProcessState {
Ready,
Started,
Completed,
}
/*-------------------------------------*/
/* Backup... |
use std::{
mem,
ops::{Index, Range},
slice,
vec::Vec,
};
#[derive(Clone, PartialEq)]
pub struct ArraySequence<T> {
pub offsets: Vec<usize>,
pub data: Vec<T>,
}
impl<'a, T> IntoIterator for &'a ArraySequence<T> {
type Item = &'a [T];
type IntoIter = ArraySequenceIterator<'a, T>;
fn... |
//! Shared memory & Copy-on-write extension for page table
//!
//! To use the CowExt, make a wrapper over the original apge table
//! Like: CowExt::new(origin_page_table)
//! Invoke page_fault_handler() on the CowExt to run the COW process
//! If the method above returns true, the COW process is executed, else do your ... |
use super::{
file_manager::{AssetCache, AssetError, AssetHandle},
image::ImageRon,
texture::Texture,
Image,
};
use futures::executor::{ThreadPool, ThreadPoolBuilder};
use std::{convert::TryFrom, path::PathBuf, sync::Arc};
use dashmap::DashSet;
pub struct TextureManager {
device: Arc<wgpu::Device>,
... |
use bevy_app::prelude::*;
use bevy_ecs::prelude::*;
use bevy_math::prelude::*;
use bevy_render::prelude::*;
use bevy_text::prelude::*;
use bevy_transform::prelude::*;
use bevy_ui::{prelude::*, FocusPolicy};
use bevy_utils::prelude::*;
mod builder;
mod tooltip;
pub use builder::*;
use tooltip::*;
use crate::{componen... |
use super::{super::Config, watchers::Watchers};
use crossbeam::channel::{bounded, Sender as ChannelSender};
use threadpool::ThreadPool;
use crate::{Error, Result};
use std::{
future::Future,
pin::Pin,
sync::{Arc, Mutex},
};
use super::{DatabaseEngine, Tree};
type TupleOfBytes = (Vec<u8>, Vec<u8>);
pub s... |
use {
super::Sort,
crate::{
conf::Conf,
display::{Cols, DEFAULT_COLS},
errors::ConfError,
pattern::*,
},
clap::ArgMatches,
std::convert::TryFrom,
};
/// Options defining how the tree should be build and|or displayed
#[derive(Debug, Clone)]
pub struct TreeOptions {
... |
use crate::reified::{MethodName, Modifier, Parameter, ReturnType};
use proc_macro2::{TokenStream, TokenTree};
use Modifier::{Async, Pub};
use TokenTree::{Ident, Punct};
#[derive(Debug)]
pub struct MethodSignature {
modifiers: Vec<Modifier>,
method_name: MethodName,
parameters: Vec<Parameter>,
return_ty... |
use crate::float::Float;
use crate::generics::{Bool, False, True};
use crate::pwl::{clip, Event, EPS};
use graphidx::weights::Weighted;
use std::ops::Range;
pub struct LineDP<F: Float> {
lb: Vec<F>,
ub: Vec<F>,
event: Vec<Event<F>>,
pq: Range<usize>,
startx: Option<F>,
}
type Forward = True;
type ... |
use std::ops::RangeInclusive;
use crate::util::range_values_count;
#[derive(Debug, Clone, Default)]
pub struct IntNiches {
// TODO: use Vec to support multiple disjoint niche ranges
range: Option<Range>,
}
type Range = RangeInclusive<u64>;
impl IntNiches {
pub fn none() -> Self {
Self { range: N... |
use core::str;
use nom::bytes::complete::{take, take_until};
use nom::character::complete::char;
use nom::combinator::map_res;
use nom::sequence::preceded;
use nom::IResult;
pub use crate::sentences::*;
use crate::SentenceType;
pub const SENTENCE_MAX_LEN: usize = 102;
pub struct NmeaSentence<'a> {
pub talker_i... |
use std::ffi::CString;
use std::os::raw::c_void;
use std::path::Path;
use super::*;
struct WrappedSlice<'a> {
offset: usize,
buf: &'a [u8],
}
impl<'a> WrappedSlice<'a> {
fn new(buf: &'a [u8]) -> Box<Self> {
Box::new(Self { offset: 0, buf })
}
fn remaining(&self) -> usize {
self.buf.len() - self.o... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! Interface between Admission Control and Network layers.
use crate::{
interface::NetworkRequest,
protocols::rpc::error::RpcError,
validator_network::{NetworkEvents, NetworkSender},
ProtocolId,
};
use admission_contr... |
//! Structures and methods for calculating filter coefficients from design parameters.
use nalgebra::{convert as _c, Matrix3, RealField as Real, Vector3 as Vec3};
use std::convert::From;
use std::str::FromStr;
#[derive(Copy, Clone, Debug)]
pub enum Curve {
Lowpass,
Highpass,
Bandpass,
Notch,
Peak... |
use elan::Notification;
use elan_dist::Notification as In;
use elan_utils::tty;
use elan_utils::Notification as Un;
use std::collections::VecDeque;
use std::fmt;
use term;
use time::OffsetDateTime;
/// Keep track of this many past download amounts
const DOWNLOAD_TRACK_COUNT: usize = 5;
/// Tracks download progress an... |
use std::{
collections::HashMap,
convert::{From, TryFrom},
path::Path,
};
use nvmeadm::{
error::NvmeError,
nvmf_discovery::{disconnect, ConnectArgsBuilder},
};
use glob::glob;
use regex::Regex;
use udev::{Device, Enumerator};
use url::Url;
use uuid::Uuid;
use crate::{dev::util::extract_uuid, matc... |
//! X86_64-bit Instruction Set Architecture.
use self::inst::EmitInfo;
use super::TargetIsa;
use crate::ir::{condcodes::IntCC, Function};
use crate::isa::x64::{inst::regs::create_reg_universe_systemv, settings as x64_settings};
use crate::isa::Builder as IsaBuilder;
use crate::machinst::{compile, MachBackend, MachCom... |
use crate::igrepper::types::{Line, LineWithMatches, MatchPosition};
use regex::Regex;
use std::cmp;
use std::collections::HashMap;
#[derive(Debug)]
pub enum Len {
Is(u32),
AtLeast(u32),
}
/// Struct representing the result of a regex search.
/// It generates the output lazily.
#[derive(Debug)]
pub struct Outp... |
// Copyright (c) 2017-2021 <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, d... |
//! Implementation of Event Manager for Kakfka
use rdkafka::config::ClientConfig;
use rdkafka::consumer::Consumer as KafkaConsumer;
use rdkafka::consumer::{CommitMode, StreamConsumer};
use rdkafka::message::{Message, OwnedHeaders};
use rdkafka::producer::{FutureProducer, FutureRecord};
use rdkafka::util::Timeout;
use ... |
use select::document::Document;
use select::predicate::{Name};
use regex::Regex;
pub fn find_internal_assets_from_html(document: &Document) -> (Vec<String>, Vec<String>) {
let script_tags = document.find(Name("script")).fold(Vec::new(), |mut result, node| {
let src = node.attr("src").unwrap_or("");
... |
// Build script.
//
// This program is run by Cargo when building lib/codegen. It is used to generate Rust code from
// the language definitions in the lib/codegen/meta directory.
//
// Environment:
//
// OUT_DIR
// Directory where generated files should be placed.
//
// TARGET
// Target triple provided by Carg... |
// Copyright 2012 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 ::serde::{Deserialize, Serialize};
use std::fmt;
use crate::basics::*;
// typedef Sha1CheckSum RsFileHash ;
// typedef RsFileHash TurtleFileHash ;
type TurtleFileHash = Sha1CheckSum;
// class RsTurtleOpenTunnelItem: public RsTurtleItem
// {
// public:
// RsTurtleOpenTunnelItem() : RsTurtleItem(RS_TURT... |
pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta;
use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference;
use std::{borrow::Cow, collections::BTreeMap};
/// An accessor trait for a kubernetes Resource.
///
/// This is for a subset of Kubernetes type that do not end in `List`.
/// These ty... |
use crate::block::*;
use crate::hitbox::*;
use crate::level::*;
use crate::physics::*;
use crate::utility::*;
use vector2d::Vector2D;
const CHECK_DISTANCE: usize = 4;
#[derive(Debug)]
pub struct Surroundings {
from_x: usize,
from_y: usize,
to_x: usize,
to_y: usize,
}
impl Physi... |
use super::env;
use async_std::sync::RwLock;
use crossbeam::channel::{unbounded, Sender};
use futures::{executor::block_on, SinkExt, StreamExt};
use lazy_static::lazy_static;
use migrations::{pg, sqlx};
use shared::{Installation, ServerRequest, ServerResponse, UserProfile};
use std::{
collections::{HashMap, HashSet... |
// Copyright 2016 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 tracing::{
callsite,
callsite::Callsite,
field::{self, Field, Value, Visit},
metadata::Kind,
};
use std::{collections::HashMap, fmt};
use std::prelude::v1::*;
#[derive(Default, Debug, Eq, PartialEq)]
pub struct Expect {
fields: HashMap<String, MockValue>,
only: bool,
}
#[derive(Debug)]
pub... |
// 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 writ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.