text stringlengths 3.09k 13.9k |
|---|
use crate::{Vertex, level::Tile};
use glium_glyph::{GlyphBrush, glyph_brush::Section};
use super::{Vec2,Vec4};
use super::tile_batcher::TileBatcher;
use super::config::Config;
use super::page_manager::PageAction;
#[derive(Debug, Eq, PartialEq)]
pub enum ButtonState{
Up,
PressedDown,
Down,
Release... |
mod common;
use common::Plane;
use image::{DynamicImage, ImageBuffer, Rgba};
use std::sync::Arc;
use truck_meshalgo::prelude::obj;
use truck_modeling::*;
use truck_platform::*;
use truck_rendimpl::*;
use wgpu::*;
const CUBE_OBJ: &[u8] = include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../resources/obj/cub... |
use bytes::Bytes;
use futures::Stream;
use md5::digest::Output;
use md5::{Digest, Md5};
use std::cmp;
use std::mem;
use std::ops::RangeInclusive;
use std::pin::Pin;
use std::task::{Context, Poll};
#[derive(Debug, PartialEq)]
pub struct Part {
pub body: Vec<Bytes>,
pub content_length: usize,
pub content_md5... |
//! A module defining the trait `InformationResult`.
use wrapper::ffi;
use errors::*;
use std::{mem, ptr};
/// A trait for retrieving information through OpenCL functions.
/// A value of a high-level type implementing this trait can be retrieved through an appropriate
/// OpenCL function, using the more primitive typ... |
//
// Copyright (c) Dell Inc., or its subsidiaries. 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
//
use crate::cl... |
// A version of pstree targetting linux written in rust!
//
// This is based on the following exercise from the excellent
// book "The Linux Programming Interface" by <NAME>.
//
//----------------------------------------------------------------------
//
// Write a program that draws a tree showing the hierarchical
// p... |
use crate::comment::comment;
use crate::comment::Comment;
use crate::coord::coord;
use crate::coord::Coord;
use crate::cutter_compensation::cutter_compensation;
use crate::cutter_compensation::CutterCompensation;
use crate::distance_mode::distance_mode;
use crate::distance_mode::DistanceMode;
use crate::motion::motion;... |
use css_in_rust::Style;
use yew::{
html, Component, ShouldRender, Html, ComponentLink,
Properties, Children, Callback, MouseEvent,
Classes,
};
use yew::virtual_dom::{VNode, VList};
use crate::theme::{Theme, fade};
pub enum Msg {
Click(MouseEvent),
}
#[derive(Clone, PartialEq, Debug)]
#[allow(dead_code)]
pub e... |
use std::collections::hash_map::DefaultHasher;
use std::collections::VecDeque;
use std::{
hash::{Hash, Hasher},
time::{Duration, Instant},
};
use cuckoofilter::CuckooFilter;
use rand::rngs::OsRng;
use scalable_cuckoo_filter::{ScalableCuckooFilter, ScalableCuckooFilterBuilder};
pub const BUCKET_PERCENTAGES: [u... |
mod utils;
use std::f64;
use std::fmt::{Display, Formatter, Result, Write};
use utils::set_panic_hook;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use js_sys::Math::random;
use web_sys::CanvasRenderingContext2d;
const STEP: usize = 20;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = cons... |
extern crate proc_macro;
extern crate proc_macro2;
use syn;
use quote::quote;
enum MacroAttribute {
Each,
}
enum FieldType {
Regular,
Repeated,
Optional,
}
#[proc_macro_derive(Builder, attributes(builder))]
pub fn builder_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let source: syn:... |
use crate::prelude::encrypted::{EncryptedStream, Keys};
use crate::prelude::{IPCError, IPCResult};
use crate::protocol::AsyncProtocolStream;
use bytes::Bytes;
use chacha20poly1305::aead::{Aead, NewAead};
use chacha20poly1305::{ChaCha20Poly1305, Key, Nonce};
use rand::thread_rng;
use rand_core::RngCore;
use sha2::{Diges... |
#![warn(clippy::all)]
#[macro_use]
extern crate log;
extern crate clap;
use clap::{crate_version, App, Arg};
extern crate flate2;
extern crate lz4;
extern crate xz2;
use std::fs::{File, OpenOptions};
use std::io;
use std::io::{Error, ErrorKind};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use flate2::read:... |
#![deny(missing_docs)]
//! This module could be used to encrypt/decrypt tokens
use crypto::aead::{AeadDecryptor, AeadEncryptor};
use crypto::aes;
use crypto::aes_gcm::AesGcm;
use crypto::digest::Digest;
use crypto::sha2::Sha256;
use rand::RngCore;
use std::error;
use std::fmt;
const NONCE_LEN: usize = 12;
const TAG_L... |
/**
* --- Day 15: Rambunctious Recitation ---
*
* You catch the airport shuttle and try to book a new flight to your vacation island. Due to the storm, all direct flights have been cancelled, but a route is available to get around the storm. You take it.
* While you wait for your flight, you decide to check in wit... |
use crate::address::Address;
use bech32::{self, ToBase32};
use failure::Error;
use ripemd160::Ripemd160;
use serde::{ser::SerializeMap, Serialize, Serializer};
use sha2::{Digest, Sha256};
use std::fmt::{self, Debug};
/// Represents a public key of a given private key in the Cosmos Network.
///
/// Can be created from ... |
use crate::leema::code::Code;
use crate::leema::failure::Lresult;
use crate::leema::frame::Event;
use crate::leema::list;
use crate::leema::lmap::{Lmap, LmapNode};
use crate::leema::lstr::Lstr;
use crate::leema::module::ModKey;
use crate::leema::struple::StrupleItem;
use crate::leema::val::{Fref, Type, Val};
use crate:... |
use crate::{
functions::FunctionList,
types::{CargoDependency, Type, TypeIdent, TypeMap},
};
use std::{
collections::{BTreeMap, BTreeSet},
fmt::Display,
fs,
};
pub mod rust_plugin;
pub mod rust_wasmer_runtime;
pub mod ts_runtime;
#[non_exhaustive]
#[derive(Debug, Clone)]
pub enum BindingsType<'a> ... |
//! Early exception handlers that do nothing but print an error and hang.
#![no_std]
#![feature(abi_x86_interrupt)]
#[macro_use] extern crate vga_buffer; // for println_raw!()
extern crate x86_64;
extern crate mod_mgmt;
extern crate memory;
use x86_64::structures::idt::{LockedIdt, ExceptionStackFrame, PageFaultErr... |
use std::convert::TryFrom;
use std::fmt;
use std::num::ParseIntError;
use snafu::{ensure, ResultExt, Snafu};
use crate::constants::BOARD_DIMENSION;
#[derive(Debug, Snafu, PartialEq)]
pub enum Error {
ParseError,
InvalidColumn,
InvalidRow { source: ParseIntError },
RowTooBig,
}
#[derive(Copy, Clone, ... |
use crate::intcode::AsyncIO;
use crate::{
intcode::{parse_program, IntCodeComputer},
solver::Solver,
};
use std::{
collections::HashMap,
error::Error,
io::Read,
iter::repeat,
sync::mpsc::{Receiver, Sender},
thread::{self, JoinHandle},
};
pub struct Problem;
impl Solver for Problem {
... |
use log::*;
use seccomp_sys::*;
use std::os::unix::io::AsRawFd;
// workaround until we can assume libseccomp >= 2.4.0 is always present
include!(concat!(env!("OUT_DIR"), "/const.rs"));
mod rule;
pub use rule::{Cmp, Comparator};
mod error;
pub use error::{Error, Result};
mod syscalls;
pub use syscalls::Syscall;
#[d... |
use crate::{
cache::Cache,
net_util::{tcp_check, SocketData},
};
use std::fmt;
use crate::Result;
#[derive(Debug, Default, PartialEq)]
pub struct RepoStatus {
pub uncommited_changes: bool,
pub untracked_files: bool,
pub new_files: bool,
pub local_ahead: bool,
pub local_behind: bool,
pu... |
use renderers::input::{Input as KeyInput, KeyboardCommand};
use std::{thread};
use linux_raw_input_rs::{InputReader, get_input_devices};
use linux_raw_input_rs::keys::Keys;
use linux_raw_input_rs::input::{Input, EventType};
use std::sync::{Arc, Mutex};
fn set_keyboard_state(input: Input, keyboard_state: u32) -> u32 {
... |
use super::{CallError, FactoryError, Notification, Service, ServiceFactory};
use crate::k8s::secrets::get_secret;
use async_trait::async_trait;
use parking_lot::Mutex;
use reqwest::header;
use serde::Deserialize;
use std::collections::HashMap;
use std::sync::Arc;
#[derive(Deserialize)]
struct ServiceConfig {
token... |
use super::*;
use indicatif::ProgressIterator;
use std::{fs::File, fs::OpenOptions, io::prelude::*, io::BufWriter};
/// Structure that saves the common parameters for reading csv files.
///
/// # Attributes
/// * path: String - The path where to save the file. E.g. "/tmp/test.csv"
/// * `verbose`: bool - If the progre... |
use wasm_bindgen::prelude::*;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Pos(pub u32, pub u32);
#[wasm_bindgen]
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tile {
A = 0,
B = 1,
C = 2,
D = 3,
E = 4,
F = 5,
G = 6,
H = 7,
I = 8,
J = 9,
K = 10... |
/*!
[](https://travis-ci.org/jaemk/cached)
[](https://crates.io/crates/cached)
[](https://docs.rs/cached)
> Caching structures and simplified function me... |
use std::cmp;
use std::io::prelude::*;
use std::convert::TryInto;
use unicode_width::UnicodeWidthStr;
// use rustbox::{Style, Color, RustBox};
use crossterm::{KeyEvent, TerminalCursor, Attribute, Color, Colored, Colorize, Crossterm};
use crate::editor::ALL_COMMANDS;
use crate::command::BuilderEvent;
use crate::keymap... |
use crate::error;
use crate::coding::{Encodable, Decodable, CodedObject};
use crate::key::{Key, PubKey};
use crate::csrng::fill_random;
use std::fmt;
use crypto::curve25519::{ge_scalarmult_base, sc_reduce, sc_muladd, GeP3, GeP2};
use crypto::sha2::Sha512;
use crypto::digest::Digest;
use crypto::util::fixed_time_eq;
... |
//! Errors from validating the content of a story that was successfully parsed.
//!
//! Validation is done in a separate step, after a story has been successfully parsed.
//! This pass will check for errors in expressions, conditions, naming and assignments
//! throughout the entire story. Any invalid types or names wi... |
#![allow(non_camel_case_types,non_snake_case,non_upper_case_globals)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
// NOTE: Bindgen doesn't import these properly use to them using a macro
macro_rules! scan_error { ($code:expr) => {(0x80000000 /*ERROR_BIT*/ | 0x20000000 /*USER_BIT*/ | $code )} }
pub const E_SCN... |
use std::io::BufReader;
use std::fs::File;
use std::io::prelude::*;
use std::convert::TryInto;
use json;
use regex::{Regex};
#[allow(dead_code)]
pub fn load_dictionary(dir: bool, path: &str) -> Vec<String> {
let mut filelist: Vec<String> = vec![];
if dir {
// ==== Extract the directory ====
// ... |
use itertools::Itertools;
use regex::Regex;
type Triplet = (i64, i64, i64);
pub struct Moon {
position: Triplet,
velocity: Triplet,
}
impl Moon {
pub fn new(x: i64, y: i64, z: i64) -> Moon {
Moon {
position: (x, y, z),
velocity: (0, 0, 0),
}
}
pub fn update... |
// Copyright 2012-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
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_repr::*;
use serde_with::rust::string_empty_as_none;
/// User details returned by [`Client::users`](crate::Client::users)
#[derive(Debug, Serialize, Deserialize)]
pub struct User {
/// Unique id of a user.
pub user_id: String,
///... |
mod ai;
mod animator;
mod components;
mod enemy_collider_purger;
mod enemy_oob_purger;
mod enemy_spawner;
mod keyboard;
mod physics;
mod renderer;
mod sprite;
use rand::prelude::*;
use std::time::{Duration, Instant};
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use sdl2::rect::{Point,... |
extern crate proc_macro;
use syn;
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use super::method::Method;
use super::utils::*;
pub struct Service<'a> {
pub ast: &'a mut syn::ItemImpl,
pub methods: Vec<Method>,
pub meta: Attributes,
}
impl<'a> Service<'... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
/// This is a simple implementation of support for Windows Dark Mode,
/// which is inspired by the solution in https://github.com/ysc3839/win32-darkmode
use winapi::{
shared::{
basetsd::SIZE_T,
minwin... |
use std::ops::Mul;
// Decks always will have 60 cards in them.
const DECK_SIZE: u128 = 60;
// `Fraction` is used to store division operation whose quotient can be lazily evaluated, which
// allows for use in subsequent mathematical operations without losing precision due to conversion
// to floating point values.
#[d... |
use super::aabb::AABB;
use super::hit::{Hit, Hittable};
use super::material::{Lambertian, MaterialWritable};
use super::ray::Ray;
use super::texture::SolidColor;
use super::vec3::Vec3;
use std::f64::consts::PI;
use std::rc::Rc;
#[derive(Debug)]
pub struct Sphere {
pub center: Vec3,
pub radius: f64,
pub mat... |
// Copyright (c) 2018-2020 MobileCoin Inc.
//! The fundamental pattern names defined in noise framework rev. 34
use alloc::vec;
use alloc::vec::Vec;
use core::fmt::{Display, Formatter, Result as FmtResult};
/// An enumeration of message tokens used in a message.
///
/// These tokens are described in
/// [section 7.... |
// Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0.
use std::time::Duration;
use super::config::{ReadableDuration, ReadableSize};
use super::time::Limiter;
use super::timer::GLOBAL_TIMER_HANDLE;
use cpu_time::ThreadTime;
use futures::compat::Future01CompatExt;
// TODO: This value is fixed based on ex... |
//! An example application working with the diesel middleware.
#[macro_use]
extern crate diesel;
#[cfg(test)]
#[macro_use]
extern crate diesel_migrations;
use diesel::prelude::*;
use diesel::sqlite::SqliteConnection;
use futures_util::FutureExt;
use gotham::handler::{HandlerError, HandlerFuture};
use gotham::helpers... |
// Copyright 2017 The Chromium OS 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::{
mem,
ops::Deref,
os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd},
ptr,
time::Duration,
};
use libc::{c_void, event... |
use crate::{NanoSecond, Reader, Record, Result, Scope, Stream};
use std::collections::HashMap;
/// An record of several sibling (or cousin) scopes.
///
/// For instance, if one scope has a hundred children of the same ID
/// the UI may want to merge them into one child before display.
#[derive(Clone, Debug, PartialEq)... |
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::io;
use std::usize;
use config::Config;
use mio::net::{TcpListener, TcpStream};
use mio::unix::UnixReady;
use mio::{Events, Poll, PollOpt, Ready, Token};
use pump::Pump;
use slab::Slab;
const MAX_PUMPS: usize = 256 * 1024;
const ROOT_TOKEN: To... |
use wgpu::*;
use futures::executor::block_on;
use winit::{
window::Window,
dpi::PhysicalSize
};
pub struct Renderer {
surface: Surface,
device: Device,
queue: Queue,
swap_chain_descriptor: SwapChainDescriptor,
swap_chain: SwapChain,
render_pipeline: RenderPipeline,
texture_size: Ex... |
/*
Copyright (C) 2018-2019 <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, modify, merge, publish,
distribute, su... |
use chrono::prelude::*;
use crate::generator::ast::*;
use crate::generator::processor::*;
use crate::{app, STATUS};
/// Flattens nested text, textlines, text sections, etc. into 'text' types.
/// Also evaluates text placeholder or shorthand nodes, such User, Timestamp, etc.
pub struct FlattenText {
current_line: ... |
use rapier3d::prelude::*;
use rapier_testbed3d::Testbed;
fn create_wall(
testbed: &mut Testbed,
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
offset: Vector<f32>,
stack_height: usize,
half_extents: Vector<f32>,
) {
let shift = half_extents * 2.0;
let mut k = 0;
for i in 0u... |
//! Contains `ParseSess` which holds state living beyond what one `Parser` might.
//! It also serves as an input to the parser itself.
use crate::ast::{CrateConfig, NodeId};
use crate::early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId};
use crate::source_map::{SourceMap, FilePathMapping};
use crate::featur... |
//! Advent of Code 2020 Day 10
//! https://adventofcode.com/2020/day/10
//!
//! Challenge part 2
//!
//! Determine the number of combinations of integers that meet the challenge criteria.
use std::fs;
const INPUT_FILENAME: &str = "2020_day10_input.txt";
const DIVIDE_CONQUER_LENGTH: usize = 10;
const MAX_ALLOWED_DIFF:... |
use crate::util::TranscriptProtocol;
use std::io::{Read, Write};
use ark_ec::group::Group;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_std::{
rand::{CryptoRng, Rng},
UniformRand,
};
use merlin::Transcript;
const HWW_DOMAIN_STR: &[u8] = b"HWW";
/// Hidden Wire W... |
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::higher;
use clippy_utils::{in_macro, SpanlessEq};
use if_chain::if_chain;
use rustc_ast::ast::LitKind;
use rustc_errors::Applicability;
use rustc_hir::{lang_items::LangItem, BinOpKind, Expr, ExprKind, QPath, StmtKind};
use rustc_lint::{LateContext, La... |
use anyhow::{ensure, Result};
use std::fs::File;
use std::io::prelude::*;
fn main() -> Result<()> {
let mut content = String::new();
let mut file = File::open("input.txt")?;
file.read_to_string(&mut content)?;
let (asteroid_map, xsize, ysize) = parse_map(content)?;
// dump_map(&asteroid_map, xsiz... |
/*
Copyright (c) 2020 <NAME> <<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, modify, merge, publish, distribute... |
use super::super::machine::register::*;
use crate::codegen::arch::dag::node::*;
use crate::codegen::common::dag::{
function::{DAGFunction, DAGHeap},
module::DAGModule,
};
use crate::{ir::types::*, traits::pass::ModulePassTrait, util::allocator::*};
use defs::isel_pat;
use rustc_hash::FxHashMap;
impl ModulePass... |
use crate::components;
use crate::game;
use crate::map;
use specs;
use specs::prelude::*;
pub struct ItemCollectionSystem {}
impl<'a> System<'a> for ItemCollectionSystem {
#[allow(clippy::type_complexity)]
type SystemData = (
ReadExpect<'a, Entity>,
WriteExpect<'a, game::log::GameLog>,
... |
//! Types related to passport elements.
use serde::de::{
self, Deserialize, Deserializer, IgnoredAny, MapAccess, Visitor,
};
use std::fmt::{self, Formatter};
pub mod error;
mod kind;
pub use {error::Error, kind::Kind};
/// Represents an [`EncryptedPassportElement`][docs].
///
/// [docs]: https://core.telegram.o... |
use std::{
ffi::CString,
sync::{Once, ONCE_INIT},
};
use objc::{
class,
declare::ClassDecl,
msg_send,
runtime::{Class, Object, Protocol, Sel, NO, YES},
sel, sel_impl,
};
use objc_foundation::{
INSArray, INSData, INSDictionary, INSString, NSArray, NSData, NSDictionary, NSObject, NSString... |
#[cfg(feature = "hdr")]
mod hdr_texture_loader;
mod image_texture_loader;
mod sampler_descriptor;
#[allow(clippy::module_inception)]
mod texture;
mod texture_cache;
mod texture_descriptor;
mod texture_dimension;
pub(crate) mod image_texture_conversion;
#[cfg(feature = "hdr")]
pub use hdr_texture_loader::*;
pub use im... |
use std::collections::HashSet;
use std::io::net::ip::Port;
use std::io::net::tcp::{TcpListener,TcpStream};
use std::io::timer;
use std::io::{Acceptor, Listener};
use std::iter::repeat;
use std::str;
use std::sync::mpsc::{channel, Sender, Receiver};
use std::thread::Thread;
use std::time::Duration;
use self::Op::{SendB... |
use serde::{Deserialize, Serialize};
use crate::constraints::Commitment;
use crate::encoding::{self, Encodable, SliceReader};
use crate::errors::VMError;
use crate::merkle::MerkleItem;
use crate::predicate::Predicate;
use crate::program::ProgramItem;
use crate::types::{String, Value};
use merlin::Transcript;
/// Pref... |
use fxhash::FxHashMap;
use snafu::Snafu;
use std::alloc::{GlobalAlloc, Layout, System};
#[cfg(feature = "metrics")]
use metrics::{gauge, increment_counter, register_counter, register_gauge};
/// Type alias for a unique Alloc identifier
pub type AllocId = (u32, u64);
/// Type alias for alloc pointers
pub type AllocPtr... |
#[cfg(feature = "dim3")]
use crate::approx::AbsDiffEq;
use crate::math::{Isometry, Real, Vector};
#[cfg(feature = "dim3")]
use crate::query::sat;
#[cfg(feature = "dim2")]
use crate::query::sat::support_map_support_map_compute_separation;
use crate::shape::{Cuboid, SupportMap, Triangle};
/// Finds the best separating e... |
#![cfg_attr(test, allow(dead_code))]
extern crate dirs;
use std::path::Path;
use std::io::{self, Write};
use std::process::{self, Command};
use std::env;
use file_conflict::{
ConflictType,
Wuala,
Dropbox
};
use user_reply::UserReply::{
TakeFile,
MoveToTrash,
ShowDiff,
ShowDiffWith,
ShowDiffB... |
use std::env::args;
use std::time::Instant;
fn main() {
let now = Instant::now();
let output = run(&args().nth(1).expect("Please provide an input"));
let elapsed = now.elapsed();
println!("_duration:{}", elapsed.as_secs_f64() * 1000.);
println!("{}", output);
}
fn run(input: &str) -> usize {
l... |
use std::path::{Path, PathBuf};
#[derive(Clone, Debug)]
pub struct Config {
pub delimiter: char,
pub escape: bool,
pub rm_whitespace: bool,
pub template_dirs: Vec<PathBuf>,
#[doc(hidden)]
pub cache_dir: PathBuf,
#[doc(hidden)]
pub _non_exhaustive: (),
}
impl Default for Config {
fn... |
//-
// Copyright 2017 <NAME>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to t... |
#[derive(
Debug,
Clone,
Copy,
strum::Display,
strum::EnumString,
serde::Serialize,
serde::Deserialize,
zvariant_derive::Type,
)]
#[strum(serialize_all = "lowercase")]
pub enum MediaItemType {
Video,
Audio,
Folder,
}
crate::impl_tryfrom_zvariant!(MediaItemType);
crate::impl_e... |
//! A wide assortment of graphics meant to show off many different uses of piet
use crate::kurbo::{Affine, BezPath, Line, Point, Rect, RoundedRect, Size, Vec2};
use crate::{
Color, Error, FontFamily, ImageFormat, InterpolationMode, RenderContext, Text, TextAttribute,
TextLayout, TextLayoutBuilder,
};
const BL... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
//! Trait and macros that may be used in the firewall rule [`Rule::Restricted`] to restrict request
//! enums based on the variant.
//!
//! A [`PermissionValue`] value is a u32 integer value that is some power of 2, e.g. 1, 2, 4, 8, ..etc.
//! Follow... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - WDT Module ID Register"]
pub id: ID,
#[doc = "0x04 - WDT Control Register"]
pub ctr: CTR,
#[doc = "0x08 - WDT Service Register"]
pub srv: SRV,
#[doc = "0x0c - WDT Timer Register"]
pub tim: TIM,
#[doc = "... |
#[cfg(test)]
mod block_builder;
mod block_details;
mod change_block;
mod open_block;
mod receive_block;
mod send_block;
mod state_block;
use std::{
ops::Deref,
sync::{Arc, RwLock},
};
use anyhow::Result;
#[cfg(test)]
pub use block_builder::*;
pub use block_details::*;
pub use change_block::*;
use num::FromPri... |
use std::fmt;
use error::Error;
type DeriveInputShape = String;
type FieldName = String;
type MetaFormat = String;
#[derive(Debug)]
// Don't want to publicly commit to ErrorKind supporting equality yet, but
// not having it makes testing very difficult.
#[cfg_attr(test, derive(Clone, PartialEq, Eq))]
pub(in error) e... |
//! Optimized float parser for radixes powers of 2.
//!
//! Note: this does not require the mantissa radix and the
//! exponent base to be the same.
#![cfg(feature = "power-of-two")]
#![doc(hidden)]
use crate::float::{ExtendedFloat80, RawFloat};
use crate::mask::lower_n_halfway;
use crate::number::Number;
use crate::... |
use crate::prelude::*;
use std::sync::{Arc, Mutex};
use std::time::Duration;
/// Emits a value from the source Observable, then ignores subsequent source
/// values for duration milliseconds, then repeats this process.
///
/// #Example
/// ```
/// use rxrust::{ prelude::*, ops::{ ThrottleTime, ThrottleEdge }};
/// use... |
use super::api::Api;
use super::data;
use super::error::Error;
use super::queries;
use super::traits::*;
use anyhow;
use reqwest::Url;
use tokio;
fn _is_send<T: Send>(_: T) {}
fn _is_sync<T: Sync>(_: T) {}
#[tokio::test]
async fn is_send() {
let api = Api::new(true, "", "", Url::parse("").unwrap()).await;
_is... |
use command::{BufCommand, Command, DataEntryMode, IncrementAxis};
use display::{self, Dimensions, Rotation, DisplayColor};
use color::Color;
/// Builder for constructing a display Config.
///
/// Dimensions must supplied, all other settings will use a default value if not supplied. However
/// it's likely that LUT val... |
//! # Parallel Writing Benchmarks
//!
//! Provides parallel writing benchmarks. For parity with Java Zarr's
//! `ZarrBenchmark`, the benchmark array is `i16`, with a 5x5x5 grid of chunks
//! of 64x64x64. The chunks are loaded with data from this file, which
//! must be manually downloaded and extracted to the `benches`... |
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
#![allow(clippy::missing_errors_doc)]
use std::collections::HashMap;
use std::env;
use std::error;
use std::fs;
use std::io;
use std::time;
use croaring::bitmap::Bitmap;
use quick_xml::de::from_reader;
use rust_stemmers::{Algorithm, Stemmer};
use serde::Deseria... |
use super::error::TransactionBuildError;
use super::field::Field;
use crate::transaction::Transaction;
use crate::wasm::{WasmArgType, WasmArgValue, WasmIntType};
use svm_common::Address;
use byteorder::{BigEndian, ReadBytesExt};
use std::convert::TryFrom;
use std::io::{Cursor, Read};
macro_rules! ensure_enough_byte... |
use libc;
use td_clua::{self, lua_State};
use LuaPush;
use LuaRead;
use std::marker::PhantomData;
use std::mem;
use std::ptr;
macro_rules! impl_function {
($name:ident, $($p:ident),*) => (
/// Wraps a type that implements `FnMut` so that it can be used by hlua.
///
/// This is only needed because of a limitation ... |
use crate::{
errors::{HandleType, Result, VkTracerError},
present::Surface,
setup::{Adapter, AdapterRequirements},
SwapchainHandle, VkTracerApp,
};
use ash::{version::DeviceV1_0, vk};
use log::debug;
impl VkTracerApp {
pub fn create_swapchain_with_surface(&mut self) -> Result<SwapchainHandle> {
... |
mod utils;
use wasm_bindgen::prelude::*;
use std::mem;
extern crate web_sys;
#[macro_export]
// A macro to provide `println!(..)`-style syntax for `console.log` logging.
macro_rules! log {
( $( $t:tt )* ) => {
web_sys::console::log_1(&format!( $( $t )* ).into());
}
}
use std::collections::BTreeMap... |
use jemalloc_ctl::{epoch, epoch_mib, stats, thread};
use jemallocator::Jemalloc;
use std::alloc::{GlobalAlloc, Layout};
use std::sync::atomic::{AtomicU64, Ordering};
#[global_allocator]
static ALLOC: FlowAllocator = FlowAllocator;
/// Statistics related to memory allocations for the entire (rust portion) of the appli... |
use serde::{Deserialize, Serialize};
use std::collections::{BTreeSet, HashMap};
use std::sync::Arc;
use super::terms::*;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Parameter {
pub parameter: Term,
pub specializer: Option<Term>,
}
impl Parameter {
pub fn is_ground(&self) -> bool... |
use std::fmt;
use super::{builtins::MacroCall, context::ExprPos, Span};
use crate::{
AddressSpace, BinaryOperator, Binding, Constant, Expression, Function, GlobalVariable, Handle,
Interpolation, Sampling, StorageAccess, Type, UnaryOperator,
};
#[derive(Debug, Clone, Copy)]
pub enum GlobalLookupKind {
Vari... |
//! Global kernel/system CPU statistics
//!
//! This implementation needs at least Linux-2.6.33
//!
//! See: fs/proc/stat.c
use std::num::ParseIntError;
pub use std::str::FromStr;
/// Struct used to store cpu stat information gathered
///
/// # Examples
///
/// ```text
/// cpu 10132153 290696 3084719 46828483 16683 0... |
use clap::{App, Arg, SubCommand};
use colored::*;
use std::fs;
use std::path::Path;
use std::process::Command;
mod template;
mod config;
fn print_into(command: &ColoredString) {
let message = format!("{} Command Execution - Cargo Docker @ {}", command, "<NAME>".bright_blue());
println!("{}", message);
pri... |
day!(
day19,
"https://adventofcode.com/2015/day/19/input",
part1,
part2
);
use std::cmp::Ordering;
use std::collections::{HashMap, HashSet, VecDeque};
use std::fmt;
use std::mem::drop;
fn parse_input<'s>(input: &'s str) -> Result<(Vec<(&'s str, &'s str)>, &'s str)> {
let mut iter = input.lines();
... |
use grant_common::Detection;
use opencv::{
core::{self, Mat},
highgui,
prelude::*,
videoio,
};
use nalgebra as na;
fn draw_pred(frame: &mut Mat, det: &Detection) -> opencv::Result<()> {
let rect = core::Rect::new(
(det.x - 2.0) as i32,
(det.y - 2.0) as i32,
4 as i32,
... |
use super::RawOutcome;
use crate::core::{FilterList, LowercaseText};
use crate::utils::is_stop_char;
use crate::{Lang, Script};
const AFR: &str = "abcdefghijklmnopqrstuvwxyzáèéêëíîïóôúû";
const AKA: &str = "abdefghiklmnoprstuwyɔɛ";
const AZE: &str = "abcdefghijklmnopqrstuvxyzçöüğışə̇";
const CAT: &str = "abcdefghijklm... |
use super::*;
#[derive(Debug, Serialize, Deserialize, Clone, Hash, PartialEq, Eq, Copy)]
pub struct Id(usize);
impl Id {
pub fn raw(&self) -> usize {
self.0
}
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct IdGen {
next_id: usize,
}
impl IdGen {
pub fn new() -> Self {
Se... |
use super::state::{ApplicationState, CursorMovement, LogMessage, MessageType, ScrollMovement};
use super::terminal_events::TerminalEventCollector;
use super::ui::{self};
use crate::util::{Error, Result};
use crossterm::event::{Event as TermEvent, KeyCode, KeyEvent, KeyModifiers};
use crossterm::{
terminal::{self},... |
extern crate reqwest;
extern crate hyper;
extern crate xdr_codec;
#[derive(Debug)]
pub enum Error {
Unauthorized,
InvalidCredentials,
ChannelNotFound,
InvalidParameters,
UnknownStatus(reqwest::StatusCode),
HTTPError(reqwest::Error),
}
type SCResult<T> = Result<T, Error>;
pub struct Point {
... |
use itertools::Itertools;
use std::collections::HashSet;
use std::iter::FromIterator;
use std::str::FromStr;
pub(crate) fn solve_day8() -> usize {
let input = include_str!("../puzzles/day8.txt");
input
.lines()
.map(|i| i.split('|').collect_vec().pop().unwrap())
.map(|s| s.split_whitesp... |
//! Utilities for handling activation requests with the `xdg_activation` protocol
//!
//!
//! ### Example
//! ```no_run
//! # extern crate wayland_server;
//! #
//! use smithay::wayland::xdg_activation::{init_xdg_activation_global, XdgActivationEvent};
//!
//! # let mut display = wayland_server::Display::new();
//! let... |
//! Platform requirements
use crate::error::Error;
use crate::platform::Platform;
use std::{fmt, str::FromStr, string::String, vec::Vec};
#[cfg(feature = "serde")]
use serde::{de, ser, Deserialize, Serialize};
/// Platform requirements: glob-like expressions for matching Rust platforms
/// as identified by a "target... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.