text stringlengths 3.09k 13.9k |
|---|
use crate::models::*;
use crate::schema::*;
use crate::web::user::UserId;
use crate::web::DbConn;
use chrono::{DateTime, Utc};
use diesel::prelude::*;
use regex::Regex;
use rocket_contrib::databases::diesel;
use rocket_contrib::json::Json;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
... |
extern crate mm_arl;
extern crate clap;
extern crate rand;
extern crate rsrl;
#[macro_use]
extern crate slog;
extern crate csv;
extern crate serde;
#[macro_use]
extern crate serde_derive;
use mm_arl::{
AdversaryDomain,
utils::Estimate,
};
use clap::{App, Arg};
use rand::thread_rng;
use rsrl::{
OnlineLearne... |
use crate::raft::{self, Raft};
use rand::{thread_rng, Rng};
use std::marker::PhantomData;
use std::sync::{Arc, Mutex};
use wasm_bindgen_futures::spawn_local;
use web_sys::{Storage, Window};
use yew::prelude::*;
use yew::Properties;
const CLUSTER_SIZE: usize = 3;
pub struct RaftWrapper<S: raft::State>(Arc<Mutex<Option... |
// Starting code credited to:
// University of Virginia - cs4414 Spring 2014
// <NAME>, <NAME>
// Version 0.4
extern crate shell;
extern crate nix;
extern crate rand;
use nix::libc::c_int;
use nix::sys::signal::{kill, Signal, SigHandler};
use nix::sys::signal;
use nix::sys::wait::waitpid;
use nix::unistd::{fork, Fork... |
// Generated from definition com.github.openshift.api.build.v1.SourceBuildStrategy
/// SourceBuildStrategy defines input parameters specific to an Source build.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SourceBuildStrategy {
/// env contains additional environment variables you want to pass into a bui... |
//! A radio station in rradio
use std::path::Path;
use rradio_messages::{ArcStr, StationType};
pub use rradio_messages::{StationError as Error, Track};
mod parse_custom;
mod parse_m3u;
mod parse_pls;
#[cfg(not(feature = "cd"))]
mod cd {
pub fn tracks(_device: &str) -> Result<Vec<super::Track>, rradio_messages::... |
mod brute_force;
use lorenz::*;
use clap::{App, Arg, ArgGroup};
use rpassword;
use sodiumoxide;
use std::env;
use std::error::Error;
use std::path::{Path, PathBuf};
use std::process::exit;
const FILE_EXTENSION: &str = ".lorenz";
fn main() {
let msg = match do_it() {
Ok((output_filename, mode)) => {
... |
#![no_std]
use aoc2020::*;
use core::ops::RangeBounds;
use core::str::FromStr;
use heapless::{consts::U8, LinearMap};
use itertools::Itertools;
struct Iter(core::str::Split<'static, &'static str>);
impl Iter {
fn new(s: &'static str) -> Iter {
Iter(s.split("\n\n"))
}
}
impl Iterator for Iter {
t... |
use async_trait::async_trait;
use log::{debug, error, info, warn};
use std::convert::TryFrom;
use tokio::sync::mpsc::UnboundedSender;
use tokio::time::{self, Duration, Instant};
use crate::error::{ProtocolError, TaskError, TraceError};
use crate::protocol::Message;
use crate::task::{Request, Task, TaskEvent, TaskOptio... |
//! Navigator backend for web
use crate::custom_event::RuffleEvent;
use isahc::{config::RedirectPolicy, prelude::*, AsyncReadResponseExt, HttpClient, Request};
use ruffle_core::backend::navigator::{
NavigationMethod, NavigatorBackend, OwnedFuture, RequestOptions, Response,
};
use ruffle_core::indexmap::IndexMap;
u... |
mod branch;
mod cursor;
mod leaf;
mod node;
use std::{
io::{self, Read, Write},
marker::PhantomData,
ops::{Deref, DerefMut},
};
use bytemuck::Pod;
use crate::{
lock::Lock,
page::{PageNr, NULL_PAGE_NR},
reference::DatabaseRef,
};
use self::{cursor::Cursor, node::NodeRef};
pub struct Tree<K: ... |
//-
// Copyright 2017, 2018 The proptest developers
//
// 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
/... |
use crate::config::diff_ignore_whitespace_setting::DiffIgnoreWhitespaceSetting;
use crate::config::diff_show_whitespace_setting::DiffShowWhitespaceSetting;
use crate::display::color::Color;
use git2::Config;
use std::convert::{TryFrom, TryInto};
use std::env;
pub(super) fn get_input(config: &Config, name: &str, defaul... |
//! An ellipse arc.
use crate::{PathEl, Point, Rect, Shape, Vec2};
use std::{
f64::consts::{FRAC_PI_2, PI},
iter,
};
/// A single arc segment.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Arc {
/// The arc's centre point.
... |
use super::attr;
use super::{ForceCollect, Parser, TokenCursor, TrailingToken};
use rustc_ast::token::{self, Token, TokenKind};
use rustc_ast::tokenstream::{CreateTokenStream, TokenStream, TokenTree, TreeAndSpacing};
use rustc_ast::tokenstream::{DelimSpan, LazyTokenStream, Spacing};
use rustc_ast::AstLike;
use rustc_as... |
#[cfg(before_1_32)]
use crate::v1_32::{u32_v1_32, u64_v1_32};
use crate::Sealed;
use core::ops::DerefMut;
#[cfg(std)]
use core::ptr;
pub trait Option_v1_40<T: DerefMut>: Sealed<Option<T>> {
fn as_deref_mut(&mut self) -> Option<&mut T::Target>;
fn as_deref(&self) -> Option<&T::Target>;
}
impl<T: DerefMut> Opt... |
use cosmwasm_std::{
log, to_binary, Api, CanonicalAddr, Env, Extern, HandleResponse, HandleResult, HumanAddr,
InitResponse, InitResult, Querier, QueryResult, StdError, Storage
};
use std::collections::HashSet;
//use cosmwasm_storage::{PrefixedStorage};
//use schemars::_serde_json::value;
use crate::{msg::{Count... |
//! Configuration of git-global.
//!
//! Exports the `Config` struct, which defines the base path for finding git
//! repos on the machine, path patterns to ignore when scanning for repos, the
//! location of a cache file, and other config options for running git-global.
use std::fs::{remove_file, File};
use std::io::... |
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree
use proc_macro::TokenStream;
use quote::{format_ident, quote, quote_spanned, ToTokens};
use syn::{
spanned::Spanned, Attribute, Data,... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use super::crash_report::*;
use crate::tasks::{
config::CommonConfig,
generic::input_poller::*,
heartbeat::{HeartbeatSender, TaskHeartbeatClient},
utils::default_bool_true,
};
use anyhow::{Context, Result};
use async_trait::asyn... |
use ron::de::from_bytes as from_ron_bytes;
use serde::{Deserialize, Serialize};
use amethyst_assets::{AssetStorage, Handle, Loader, PrefabData, ProgressCounter, SimpleFormat};
use amethyst_core::ecs::prelude::{Entity, Read, ReadExpect, WriteStorage};
use amethyst_error::Error;
use crate::{error, Sprite, SpriteRender,... |
use std::{
collections::{HashMap, VecDeque},
sync::{Arc, Mutex},
};
use tokio::sync::oneshot::{channel, Receiver, Sender};
use misc_utils::abort_on_poison;
type LocksDB = Arc<Mutex<HashMap<String, LockQueue>>>;
pub struct ParallelTaskQueue {
locks: LocksDB,
}
impl ParallelTaskQueue {
pub async fn a... |
use crate::backend::DNSBackend;
use crate::config;
use crate::config::constants::AARDVARK_PID_FILE;
use crate::dns::coredns::CoreDns;
use log::{debug, error, info};
use signal_hook::consts::signal::SIGHUP;
use signal_hook::iterator::Signals;
use std::fs;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::sync::{Arc... |
use std::cell::Cell;
use std::fmt;
use std::io;
use std::io::{BufRead, BufReader};
use std::fs::File;
const ALIVE: &str = "██";
const DEAD: &str = " ";
const GROWING: &str = "░░";
const DYING: &str = "▓▓";
const READ_ALIVE: u8 = b'=';
const READ_DEAD: u8 = b'-';
#[derive(Clone, Copy, PartialEq)]
pub enum CellState ... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::cmp;
use std::f64;
#[derive(Debug, RustcEncodable, RustcDecodable)]
pub struct Position {
pub lat: f64,
pub lon: f64,
}
impl Position {
pub fn distance(&self, other: &Position) -> f64 {
let lat1 = self.lat;
let lat2 = other.lat;
let lng1 ... |
use crate::eth::{
receipt::TypedReceipt,
transaction::{TransactionInfo, TypedTransaction},
trie,
};
use ethers_core::{
types::{Address, Bloom, Bytes, H256, U256, U64},
utils::{
keccak256, rlp,
rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream},
},
};
use serde::{Deserializ... |
use glam::{Mat4, Vec3, Vec3A};
use winit::event::VirtualKeyCode;
const MIN_DISTANCE: f32 = 5.0;
const MAX_DISTANCE: f32 = 15.0;
const DISTANCE: f32 = 12.0;
const HEIGHT: f32 = 0.75;
#[derive(Copy, Clone, Debug)]
pub enum CameraType {
Watch(Vec3A),
Directional(Vec3A),
Chase(Vec3A),
TPS(Vec3A, f32),
... |
use crate::env::{StringWrapper, VariableEnvironment};
use crate::IFS_DEFAULT;
use std::borrow::Borrow;
use std::vec;
lazy_static::lazy_static! {
static ref IFS: String = String::from("IFS");
}
/// Represents the types of fields that may result from evaluating a word.
/// It is important to maintain such distincti... |
// Take a look at the license at the top of the repository in the LICENSE file.
use anyhow::{bail, Result};
use proc_macro2::Span;
use syn::parse::Error;
use syn::spanned::Spanned;
use syn::{
Attribute, DeriveInput, Field, Fields, Ident, Lit, Meta, MetaList, MetaNameValue, NestedMeta,
Type,
};
pub enum Templa... |
//! Defines a composable Instruction type and a memory-efficient CompiledInstruction.
use crate::{pubkey::Pubkey, short_vec, system_instruction::SystemError};
use bincode::serialize;
use serde::Serialize;
/// Reasons the runtime might have rejected an instruction.
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq... |
//! Implement a wrapper around setup and tear-down of Direnv-based test
//! cases.
use direnv::DirenvEnv;
use std::collections::HashMap;
use std::ffi::{OsStr, OsString};
use std::fmt::Display;
use std::fs::{create_dir, File};
use std::io::BufWriter;
use std::io::Write;
use std::os::unix::ffi::OsStrExt;
use std::path::... |
use std::{
collections::VecDeque,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};
use git_features::{parallel, progress::Progress};
use super::{Error, SafetyCheck};
use crate::{
index::{self, util::index_entries_sorted_by_offset_ascending},
tree::traverse::Context,
};
/// Trave... |
mod observation;
mod knn;
use observation::Observation;
use knn::KNN;
use std::fs::File;
use std::io::BufReader;
use std::io::Read; // trait required for read functions on file
fn check_if_magic_matches(bytes: &[u8;4], magic_number: i32) -> Result<(),String> {
let read_number: i32 = i32::from_be_bytes(*bytes);
... |
use crate::internal::{consts, MiniAllocator};
use std::io::{self, Read, Seek, SeekFrom, Write};
//===========================================================================//
pub struct MiniChain<'a, F: 'a> {
minialloc: &'a mut MiniAllocator<F>,
sector_ids: Vec<u32>,
offset_from_start: u64,
}
impl<'a, F... |
use super::loader::{DriverLoader};
#[cfg(feature = "tcp")]
use crate::adapters::tcp::{TcpAdapter};
#[cfg(feature = "tcp")]
use crate::adapters::framed_tcp::{FramedTcpAdapter};
#[cfg(feature = "udp")]
use crate::adapters::udp::{self, UdpAdapter};
#[cfg(feature = "websocket")]
use crate::adapters::ws::{self, WsAdapter};... |
// Author: <NAME>, Copyright 2021
//! A CLI applet to monitor the status of a VM, and restart them in the event of a crash.
mod structs;
use chrono::prelude::*;
use std::{thread, time};
use std::process::Command;
use structs::*;
use dirs;
const CONFIG_NAME: &str = "virtual-machine-mangement";
fn virtual_machine_onl... |
use wasm_bindgen::prelude::*;
use wasm_bindgen::convert::{OptionIntoWasmAbi, IntoWasmAbi, FromWasmAbi};
use algebra::biginteger::{BigInteger, BigInteger256};
use algebra::CanonicalSerialize as _;
use algebra::CanonicalDeserialize as _;
use algebra::{ToBytes, FromBytes};
use num_bigint::BigUint;
use std::cmp::Ordering::... |
use std::collections::HashMap;
use std::path::PathBuf;
use structopt::StructOpt;
use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
mod indexer;
#[derive(StructOpt, Debug)]
pub struct Opt {
#[structopt(long = "query", name = "query")]
query: Option<String>,
#[structopt(long = "import_url")]
... |
use std::env;
fn defined(var: &str) -> bool {
env::var_os(var).is_some()
}
fn target_components() -> Vec<String> {
let target = env::var("TARGET").unwrap();
target.split("-").map(|s| s.to_string()).collect()
}
fn is_x86_64() -> bool {
target_components()[0] == "x86_64"
}
fn is_x86_32() -> bool {
... |
use crate::components::player_selection_dialog;
use maud::{html, Markup, PreEscaped};
use pointercrate_core::{error::PointercrateError, permission::PermissionsManager};
use pointercrate_core_pages::{
error::ErrorFragment,
util::{filtered_paginator, paginator},
PageFragment, Script,
};
use pointercrate_demon... |
use hashbrown::HashSet;
use itertools::Itertools;
use once_cell::sync::Lazy;
use rand::{distributions::Alphanumeric, rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
use std::{env, iter, str::FromStr};
pub mod alloc {
use backtrace::Backtrace;
use hashbrown::HashMap;
use once_cell::sync::Lazy;
use st... |
// Copyright 2021 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 std::io::{Error, Write};
use vte::{Parser, Perform};
/// A wrapper around a `Write` that filters out ANSI escape sequences before writing to the
/// w... |
extern crate orbtk;
extern crate chrono;
extern crate orbclient;
use orbtk::{Rect, Window, WindowBuilder, Grid, Label, Button, Style};
use orbtk::traits::{Place, Text, Click};
use orbtk::theme::Theme;
use chrono::prelude::*;
use chrono::Duration;
use std::ops::{Sub, Add};
use std::sync::Arc;
use std::sync::mpsc::{chan... |
use glfw::{WindowEvent, Action};
use cgmath::{Matrix3, Transform, Matrix4};
use crate::rendering::prelude::{Position, Rectangle};
use crate::{editor, content};
use crate::command_buffer::{Command, CommandBuffer};
use crate::editor::tools::{Tool, get_transformed_mouse_position, EditorWindow, get_valid_rectangle_as_int}... |
use crate::{
eth::{backend::notifications::NewBlockNotifications, error::to_rpc_result},
StorageInfo, U256,
};
use anvil_core::eth::{
block::Block,
filter::FilteredParams,
receipt::{EIP658Receipt, Log, TypedReceipt},
subscription::{SubscriptionId, SubscriptionResult},
};
use anvil_rpc::{request:... |
use snafu::{ensure, Snafu};
const MAX_JUMP_INSTRUCTIONS: i32 = 5;
#[derive(Debug, Snafu)]
pub enum BufferError {
#[snafu(display("unexpected end of buffer"))]
EndOfBuffer,
#[snafu(display("limit of {} jumps exceeded", limit))]
TooManyJumps { limit: i32 },
#[snafu(display("single label exceeds 63... |
use std::collections::HashMap;
use gooey_core::{
figures::{Figure, Point, Rectlike, Size, SizedRect, Vector},
styles::{Style, TextColor},
Scaled, Transmogrifier, TransmogrifierContext, WidgetRegistration,
};
use gooey_rasterizer::{ContentArea, Rasterizer, Renderer, WidgetRasterizer};
use gooey_text::{prepa... |
use proc_macro2::TokenStream;
use devise::{*, ext::SpanDiagnosticExt};
use crate::exports::*;
use crate::derive::form_field::{FieldExt, VariantExt};
use crate::syn_ext::{GenericsExt as _, TypeExt as _};
use crate::http::uri::fmt;
const NO_EMPTY_FIELDS: &str = "fieldless structs are not supported";
const NO_NULLARY: &... |
use std::error::Error;
use std::io::{self, Write};
use std::fs;
use std::fmt;
use serde::{Deserialize, Serialize};
use serde_json::{to_string, from_str};
use base64::encode;
use litcrypt::lc;
use crate::env_check::EnvCheck;
// Config consts
pub const URL_BASE: &str = "https://api.notion.com/v1";
pub const DEFAULT_API_... |
use common::MapIterator;
use format::ItemView;
use std::ops;
#[derive(Clone, Copy, Debug)]
struct ItemType {
type_id: u16,
start: usize,
num: usize,
}
#[derive(Clone, Debug)]
struct Item {
type_id: u16,
id: u16,
data: Vec<i32>,
}
#[derive(Clone, Debug, Default)]
pub struct Buffer {
item_t... |
#![forbid(unsafe_code, future_incompatible)]
#![deny(
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
nonstandard_style,
unused_qualifications,
unused_import_braces,
unused_extern_crates,
trivial_casts,
trivial_numeric_casts
)]
#![cfg_attr(docsrs, feature(d... |
// Copyright 2020 Red Hat, Inc.
//
// 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 i... |
// Take a look at the license at the top of the repository in the LICENSE file.
use proc_macro2::TokenStream;
use proc_macro_error::{emit_call_site_error, emit_error};
use quote::quote;
use syn::Data;
use std::collections::HashMap;
use std::string::ToString;
use crate::attribute_parser::*;
use crate::util::*;
fn ge... |
use nalgebra::{Vector3, UnitQuaternion, Quaternion, Vector4, Vector6, Point3};
use crate::utils::utils_se3::implicit_dual_quaternion::ImplicitDualQuaternion;
pub fn quaternion_log(q: UnitQuaternion<f64>) -> Vector3<f64> {
let mut out_vec: Vector3<f64> = Vector3::new(q.i, q.j, q.k);
if q.w.abs() < 1.0 {
... |
// Copyright (c) 2015 macro-attr contributors.
// Copyright (c) 2021 Warlock <<EMAIL>>
//
// Licensed under the MIT license (see LICENSE or <http://opensource.org
// /licenses/MIT>) or the Apache License, Version 2.0 (see LICENSE of
// <http://www.apache.org/licenses/LICENSE-2.0>), at your option. All
// files in the p... |
use super::{
hitbox,
input::{InputSource, PlayerInput},
physics,
};
use crate::character::{frame_data::*, state::*};
use bevy::prelude::*;
use bevy_backroll::backroll;
use serde::{Deserialize, Serialize};
const PLAYER_COLORS: &[Color] = &[Color::RED, Color::BLUE, Color::YELLOW, Color::GREEN];
pub type Pla... |
use std::{env, fs, io};
use serde::{Deserialize, Serialize};
use std::process::Command;
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct RemakeRule {
pub target: String,
pub dependencies: Vec<String>,
pub build_commands: Vec<String>,
pub is_phony: bool,
}
impl RemakeRule {
pub fn new()... |
//!
//! Multiboot Information
//!
//! This manager contains the multiboot2 information.
//! <https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html>
//!
mod elf;
mod frame_buffer;
mod memory;
pub use self::elf::{ElfInfo, ElfSection};
pub use self::frame_buffer::FrameBufferInfo;
pub use self::memory::{EfiM... |
use cgmath::Vector2;
use super::renderer::{Renderer, Vertex};
type Ratio = (u32, u32);
macro_rules! rgb {
($r:expr, $g:expr, $b:expr) => {
[
$r as f32 / 255.0,
$g as f32 / 255.0,
$b as f32 / 255.0,
1.0
]
}
}
fn ratio_f32(ratio: Ratio) -> f32 {
... |
use std::{
sync::{Arc, Weak},
time::Duration,
};
use async_tungstenite::tungstenite::error::Error as WsError;
use futures::{SinkExt, StreamExt};
use tokio::{
sync::{mpsc, oneshot},
time::{interval_at, Instant},
};
use super::{closed, open, state::*};
use crate::{
connection::{
message::{Co... |
///! Crate for discovering Holochain peers over MDNS
///! Works by broadcasting a service named `HC_SERVICE_NAME`
///! and adding base64 encoded data in a TXT record
///!
///! Uses libmdns crate for broadcasting
///! Uses mdns crate for discovery
use err_derive::Error;
use mdns::RecordKind;
use std::time::Duration;
use... |
use std::sync::Arc;
use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType};
use vulkano::device::DeviceExtensions;
use vulkano::device::Features;
use vulkano::device::{Device, Queue};
use vulkano::format::Format;
use vulkano::image::view::ImageView;
use vulkano::image::{AttachmentImage, ImageAccess, ImageU... |
use solana_program::pubkey::Pubkey;
pub mod account;
mod entrypoint;
pub mod error;
pub mod instruction;
pub mod processor;
pub const ZERO_KEY: Pubkey = Pubkey::new_from_array([0; 32]);
/// The minimum amount of ZEE a staker needs to stake.
/// It is not allowed to withdraw to an amount below the minimum,
/// unless... |
// PNG Pong
//
// Copyright © 2019-2021 <NAME>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// https://apache.org/licenses/LICENSE-2.0>, or the Zlib License, <LICENSE-ZLIB
// or http://opensource.org/licenses/Zlib>, at your option. This file may not be
// copied, modified, or distributed exc... |
//! Node attributes.
use parser::binary::Warnings;
use parser::binary::error::{Result, Error, Warning};
use parser::binary::event::NodeHeader;
use parser::binary::reader::{ParserSource, ReadLittleEndian};
use parser::binary::utils::{AttributeValues, AttributeValue};
use self::array::read_array_attribute;
pub use self:... |
use super::Tag::{Inline, Shared, Static};
use super::{InlineString, SharedString, String, Union};
use crate::capacity::{DefaultPolicy, Policy};
use crate::io::{PeekableSource, Sink, Source};
use crate::scan::{is_whitespace, Consumer};
use crate::utils::unwrap;
use alloc::alloc::{Alloc, Global};
use core::marker::Phanto... |
// Copyright (C) 2017-2019 Baidu, Inc. All Rights Reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of condit... |
use bevy_tweening::{lens::*, *};
use std::time::Duration;
use crate::game_state::GameState;
use bevy::{prelude::*, ui::FocusPolicy};
#[derive(Default)]
pub struct StartMenuPlugin {
desired_state: Option<GameState>,
}
impl StartMenuPlugin {
pub fn new() -> Self {
Self {
desired_state: None... |
use crate::editor::{component, component::components, entity::Entity, property, wire};
use crate::{dom, simulation};
#[derive(PartialEq)]
pub struct Connection {
connector_idx: usize,
component_idx: usize,
}
pub struct Circuit {
wires: Vec<wire::Wire>,
components: Vec<component::Component>,
}
impl Ci... |
use std::fmt;
use actix_web::http::StatusCode;
use actix_web::HttpResponse;
use actix_web::ResponseError;
use failure::Backtrace;
use failure::Context;
use failure::Fail;
use replicante_models_core::api::validate::ErrorsCollection;
use replicante_util_failure::SerializableFail;
/// Error information returned by func... |
use std::collections::{HashMap, HashSet};
use std::num::NonZeroU32;
use std::{cmp, str};
use grenad::CompressionType;
use heed::types::ByteSlice;
use heed::{BytesDecode, BytesEncode};
use log::debug;
use crate::error::SerializationError;
use crate::heed_codec::StrBEU32Codec;
use crate::index::main_key::WORDS_PREFIXES... |
use crate::make_progress_bar;
use anyhow::{anyhow, Result};
use fs3::FileExt;
use lazy_static::lazy_static;
use progress_streams::ProgressReader;
use reqwest::blocking::{Client, Response};
use serde::Deserialize;
use std::{env::consts::ARCH, path::Path};
use std::{
sync::{
atomic::{AtomicUsize, Ordering},
... |
//! Read/Write types for buffering.
//!
//! Both the [`Ring`](struct.Ring.html) and
//! [`InfiniteRing`](struct.InfiniteRing.html) are fixed size anonymous allocations
//! utilizing circular address mappinng. The circular mapping ensures that
//! the entire readable or writable slice may always be addressed as a single... |
use std::collections::HashMap;
use std::u8;
use preprocessor::Preprocessor;
use binary_object::BinaryObject;
pub struct FiletypePrepreprocessor;
/// Standard filetypes are paired by their magic number and typical file extension.
/// See https://en.wikipedia.org/wiki/List_of_file_signatures for more information.
/// ... |
//! An asynchronous implementation of [STUN][RFC 5389] server and client.
//!
//! # Examples
//!
//! An example that issues a `BINDING` request:
//!
//! ```
//! # extern crate fibers_global;
//! # extern crate fibers_transport;
//! # extern crate futures;
//! # extern crate rustun;
//! # extern crate stun_codec;
//! # ... |
use crate::syn_helpers::expr_bool_lit;
use lazy_static::lazy_static;
use proc_macro2::Span;
use regex::Regex;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{AttrStyle, Attribute, Expr, Ident, Lit};
/// Struct representing attribute `#[reformation(...)]`
#[derive(Clone)]
pub struct Ref... |
/* generated by rust_qt_binding_generator */
use libc::{c_char, c_ushort, c_int};
use std::slice;
use std::char::decode_utf16;
use std::sync::Arc;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::ptr::null;
use crate::implementation::*;
pub enum QString {}
fn set_string_from_utf16(s: &mut String, str: *const... |
use std::collections::HashMap;
use std::convert::TryFrom;
use failure::ensure;
use failure::err_msg;
use failure::Error;
use insideout::InsideOut;
use rusqlite::types::ToSql;
use rusqlite::OptionalExtension;
use crate::nexus::AttachmentStatus;
use crate::nexus::Doc;
type Cache = (&'static str, HashMap<String, i64>);... |
use std::str::FromStr;
use std::{sync::Arc, collections::HashSet};
use mediawiki::api::NamespaceID;
use mediawiki::hashmap;
use tokio::{task::JoinHandle, sync::RwLock};
use tracing::{event, Level, Instrument, span};
use crate::API_SERVICE;
use super::types::{TaskInfo, TaskConfig};
use super::{pagewriter::PageWriter,... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::compiler_state::{ProjectName, SourceSetName};
use crate::config::{Config, SchemaLocation};
use std::cmp::Reverse;
use st... |
//! [Prometheus] metrics.
//!
//! [Prometheus]: https://prometheus.io/
use prometrics::metrics::{Counter, Gauge, MetricBuilder};
/// [`ConnectionPool`] metrics.
///
/// [`ConnectionPool`]: ../connection/struct.ConnectionPool.html
#[derive(Debug, Clone)]
pub struct ConnectionPoolMetrics {
pub(crate) max_pool_size: ... |
use iso7816::{
Command as ApduCommand,
Instruction,
};
use crate::{Bytes, consts};
pub const NO_ERROR: u16 = 0x9000;
pub use iso7816::Status as Error;
#[repr(u8)]
#[derive(Copy,Clone,Debug, Eq,PartialEq)]
pub enum ControlByte {
// Conor:
// I think U2F check-only maps to FIDO2 MakeCredential with the c... |
use crate::{
config::app::App,
util::{self, cli::Report},
};
use serde::{Deserialize, Serialize};
use std::{
fmt::{self, Display},
path::PathBuf,
};
const DEFAULT_MIN_SDK_VERSION: u32 = 24;
const DEFAULT_VULKAN_VALIDATION: bool = true;
static DEFAULT_PROJECT_DIR: &str = "gen/android";
const fn default... |
#[cfg(feature = "reverse-proxy")]
use kvarn_testing::prelude::*;
#[tokio::test]
#[cfg(feature = "reverse-proxy")]
async fn basic() {
let servers_dir = "/port/";
let path = Arc::new(servers_dir.to_owned());
let get_port = |req: &Request<_>, path: &str| {
let req_path = req.uri().path();
req... |
use std::convert::TryFrom;
use std::fmt;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum IntRegister {
Zero = 0,
RA,
SP,
GP,
TP,
T0,
T1,
T2,
S0,
S1,
A0,
A1,
A2,
A3,
A4,
A5,
A6,
A7,
S2,
S3,
S4,
S5,
S6,
S7,
S8,
... |
use std::str;
use nom::{
branch::alt,
bytes::complete::take_while1,
character::complete::{
alpha1,
char,
},
combinator::map,
error::ErrorKind as NomErrorKind,
multi::{
count,
many1,
},
sequence::{
delimited,
preceded,
},
Err as... |
//! Data port connection and events stream
//!
use std::convert::{From, Into};
use std::io;
use std::pin::Pin;
use std::string::String;
use futures::future::{select, Either, Future};
use futures::sink::Sink;
use futures::stream::{Stream, StreamExt};
use futures::task::{Context, Poll};
use super::connevent::ConnEvent... |
//! Example to show the usage of `CandlSurface` and `CandlManager` with
//! luminance as OpenGL backend. 'ESC' to close a window.
use candelabre_windowing::{
CandlCurrentWrapper, CandlDimension, CandlElement, CandlError,
CandlManager, CandlOptions, CandlWindow
};
use candelabre_windowing::glutin::event::{
... |
use std::thread;
use std::sync::mpsc;
use std::collections::HashMap;
use std::net::{UdpSocket, SocketAddr};
use std::io::Result as IOResult;
use sodiumoxide::crypto::secretbox as crypto_secretbox;
use keys::*;
use boxes::*;
use nonces::*;
use packet::*;
use identity::*;
pub struct Server {
accept_chan_rx: mpsc::... |
use std::sync::Arc;
use crate::{application::viewport_3d::Viewport3dSettings, prelude::r3};
use glam::Vec3;
use rend3::{
managers::TextureManager,
types::{Texture, TextureHandle},
};
use rend3_routine::base::{BaseRenderGraph, BaseRenderGraphIntermediateState};
use wgpu::{
util::{BufferInitDescriptor, Devi... |
use crate::{oapic_VECTOR3, Vector3};
use crate::{Planet, Star, SurfaceBase, Vessel};
use std::ffi::{CStr, CString};
use std::os::raw::{c_char, c_int};
use winapi::shared::minwindef::DWORD;
#[doc(hidden)]
pub enum _OBJHANDLE {}
pub type OBJHANDLE = *mut _OBJHANDLE;
/// Common methods for all objects
pub trait ObjectTr... |
use std::cmp;
use std::iter;
use std::num;
use std::ops;
#[derive(thiserror::Error)]
#[derive(Clone, Debug)]
pub enum Error {
#[error("invalid integer: {}", _0)]
InvalidInt(#[from] num::ParseIntError),
#[error("invalid year: {}", _0)]
InvalidYear(String),
#[error("invalid day: {}", _0)]
Inval... |
#![no_std]
#![allow(clippy::missing_safety_doc)]
#![feature(allocator_api)]
#![feature(const_option_ext)]
#![feature(const_ptr_offset)]
#![feature(const_convert)]
#![feature(const_try)]
#![feature(const_mut_refs)]
#![feature(const_slice_from_raw_parts)]
#![feature(alloc_layout_extra)]
#![feature(nonnull_slice_from_raw_... |
//! Label encoders.
use std::borrow::{Borrow, Cow};
use std::hash::Hash;
use conllx::graph::Sentence;
use failure::Error;
use crate::Numberer;
pub mod deprel;
pub mod layer;
/// An encoding with its probability.
pub struct EncodingProb<'a, E>
where
E: ToOwned,
{
encoding: Cow<'a, E>,
prob: f32,
}
imp... |
mod util;
mod register;
pub mod squeue;
pub mod cqueue;
pub mod opcode;
pub mod concurrent;
use std::{ io, ptr, cmp, mem };
use std::convert::TryInto;
use std::os::unix::io::{ AsRawFd, RawFd };
use std::mem::ManuallyDrop;
use bitflags::bitflags;
use linux_io_uring_sys as sys;
use util::{ Fd, Mmap };
use squeue::Submis... |
use crate::{
config::Config,
gui::{
common::OngoingOperation,
common::{make_status_row, BrowseSubject, EditAction, Message, Screen},
game_list::GameList,
icon::Icon,
redirect_editor::{RedirectEditor, RedirectEditorRow},
style,
},
lang::Translator,
mani... |
const LCDC_REGISTER: u16 = 0xFF40;
const PIXEL_WIDTH: u32 = 128;
const PIXEL_HEIGHT: u32 = 128;
use crate::mem::memory::MapsMemory;
use image::{ImageBuffer, Rgba};
pub(crate) trait VramDebugger {
fn render_all_background_tiles(&self, fetcher: VRAMFetcher) -> ImageBuffer<Rgba<u8>, Vec<u8>>;
fn render_backgroun... |
use crate::*;
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub struct TileLayerId {
// global layer id and local layer id
// global layer id is set by tiled, local layer id is generated sequentially in the order
// that the layers are parsed
pub glid: u32,
pub llid: u32,
}
#[derive(Debug, Cl... |
use crate::graphql::execute_query;
use crate::install::install_package;
use crate::lock::get_package_namespace_and_name;
use crate::manifest::{Manifest, PACKAGES_DIR_NAME};
use graphql_client::*;
use std::collections::BTreeMap;
use std::env;
use std::path::PathBuf;
#[derive(GraphQLQuery)]
#[graphql(
schema_path = ... |
use crate::config::{CameraControl, ImageConfig};
use crate::{ThreadId, ThreadResult};
use flume::{Receiver, Sender};
use image::{DynamicImage, GenericImageView, ImageBuffer, Rgb};
use nokhwa::{CameraFormat, FrameFormat, Resolution, ThreadedCamera};
use std::sync::{Arc, Mutex};
#[cfg(target_os = "linux")]
use v4l::Cont... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.