text stringlengths 3.09k 13.9k |
|---|
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors
//
// 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
//
// Unl... |
use std::str::FromStr;
use simple_lexer_bootstrap::{
Token,
Lexer,
};
use simple_parser_bootstrap::Parser as ParserBootstrap;
use crate::{
grammar::{
LEXER_PRODUCTIONS,
PARSER_PRODUCTIONS,
Nonterminal,
as_productions
},
ParseTree,
};
type Result<T> = std::result::Res... |
extern crate pretty_env_logger;
use chrono::prelude::*;
use hmac::{Hmac, Mac, NewMac};
use log::debug;
use reqwest::StatusCode;
use serde_json::Value;
use sha2::Sha256;
use std::collections::BTreeMap;
use std::error::Error;
type HmacSha256 = Hmac<Sha256>;
pub struct KylinNetworkAPI {
api_key: String,
api_sec... |
/*
* Copyright 2021 <NAME>
* https://github.com/mikechambers/dcli
*
* 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... |
use aoc21::{run_day, set_verbosity, test_day, Part, Verbosity};
use clap::{App, AppSettings, Arg, SubCommand};
use colored::*;
use reqwest::blocking::Client;
use reqwest::cookie::Jar;
use std::env;
use std::fs;
use std::path::Path;
use std::sync::Arc;
fn main() {
let matches = App::new("Advent Of Code 2021")
... |
use preamble::*;
use std::collections::HashSet;
use std::hash::Hash;
use std::result;
pub struct Clusterizer {
clusters: DisjointSet<Address>,
}
/// Tarjan's Union-Find data structure.
pub struct DisjointSet<T: Clone + Hash + Eq> {
set_size: usize,
parent: Vec<usize>,
rank: Vec<usize>,
map: HashMa... |
use ggez::graphics::Rect;
use ggez::input::keyboard::KeyCode;
use ggez::nalgebra::Point2;
use ggez::Context;
use std::time::Duration;
use rand::{thread_rng, Rng, RngCore};
use super::gameoverstate::{GameOverState, Winner};
use super::shapes::{Ball, GameObject, Paddle};
use super::utils;
use crate::constants::{FONT... |
//! Contains all cryptographic algorithms we need.
//!
//! This is pretty messy code since we still need openssl to parse PEM-encoded
//! keys. Once there's a good Rust crate for that, we should switch to it.
use crate::utils::Blob;
use crate::{AesKey, Error, ErrorKind, P256KeyPair, P256PublicKey};
use openssl::bn::{... |
use super::{
actors::{bullet::Bullet, explosion::Explosion, missile::Missile},
game_item::GameItem,
spawner::main::Spawner,
ui::game_over_alert::GameOverAlert,
};
use crate::{
app::command::{Command, NO_COMMANDS},
clock::ticker::Ticker,
view::{coordinates::Coordinates, viewport::Viewport},
}... |
use log::debug;
use regex::Regex;
use std::collections::HashMap;
use crate::utils;
pub struct Youtube {}
impl Youtube {
pub fn new() -> Self {
Youtube {}
}
pub async fn get_live(&self, room_url: &str) -> Result<HashMap<String, String>, Box<dyn std::error::Error>> {
let client = reqwest::... |
use std::collections::{HashMap, HashSet};
pub fn part_1() {
let highest_velocity = find_velocity((150, -86), (193, -136));
let sum = sum_of_numbers(highest_velocity.1);
print!("highest point reached at {} with velocity {:?} in {} steps", sum.0, highest_velocity, sum.1);
}
pub fn part_2() {
le... |
//! Module containing the `EncodingError`.
use std::fmt::{self, Display};
use failure::{Context, Fail, Backtrace};
use ::MailType;
pub const UNKNOWN: &str = "<unknown>";
pub const UTF_8: &str = "utf-8";
pub const US_ASCII: &str = "us-ascii";
/// A general error appearing when encoding failed in some way.
#[derive(Co... |
use super::KernelInterface;
use failure::Error;
use regex::Regex;
pub struct IfaceCounter {
pub bytes: u64,
pub packets: u64,
}
impl IfaceCounter {
pub fn new(bytes: u64, packets: u64) -> IfaceCounter {
IfaceCounter { bytes, packets }
}
/// Return sum of bytes and packet times the overh... |
use super::background::WallpaperItem;
use super::configs::DesktopConf;
use super::desktop_item::DesktopItem;
use super::errors::DesktopError;
use crate::configs::{desktop_item_conf::Sorting, PersistentData};
use lazy_static::lazy_static;
use std::fs;
use std::path::{Path, PathBuf};
const WALLPAPERS_DIR: &str = "wallpa... |
use chrono::{DateTime, Datelike, Duration, NaiveDateTime, Timelike, Utc};
use chrono_tz::Tz;
use clap::{App, Values};
use prettytable::{format, Cell, Row, Table};
use std::cmp::Ordering;
use std::collections::HashMap;
#[derive(Debug, Eq)]
struct TimezoneHours<'a> {
name: &'a str,
hours: Vec<String>,
tz: Tz... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
#![forbid(unsafe_code)]
#![cfg_attr(feature = "fuzzing", feature(no_coverage))]
//! This crate provides definitions of tezos messages.
use getset::Getters;
use p2p::encoding::fitness::Fitness;
use serde::{Deserializ... |
/// Check if two intervals intersect. Intervals are given by a tuple with
/// the values `(start, end, inclusive)`.
pub fn check<T: PartialOrd>(a: &(T, T, bool), b: &(T, T, bool)) -> bool {
// special check for empty ranges
if (!a.2 && a.0 == a.1) || (!b.2 && b.0 == b.1) {
return false;
}
/*
To check for range... |
use derive_more::{BitAnd, BitAndAssign, BitOr, Not};
use once_cell::sync::Lazy;
#[derive(Debug, Clone, Copy, Default, BitAnd, BitOr, BitAndAssign, Not, PartialEq, Eq)]
pub struct Mask81(u128);
impl Mask81 {
pub const ALL: Mask81 = Mask81((1u128 << 81) - 1);
#[inline]
fn count_ones(&self) -> u32 {
... |
#![allow(clippy::must_use_candidate)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::cognitive_complexity)]
#![allow(c... |
use std::cmp;
use cursive::{
Printer, XY,
direction::Direction,
event::{AnyCb, Event, MouseButton, EventResult, Key, MouseEvent},
theme::{ColorStyle, Effect, Color, BaseColor, Style},
view::{View, Selector},
vec::Vec2,
};
use unicode_width::UnicodeWidthStr;
pub struct TabView {
tabs: Vec... |
// Copyright 2019 Stichting Organism
//
// 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... |
// Copyright 2019 Baidu, 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 in ... |
use crate::unboxed_size_constants::*;
use crate::{JikesRVM, SINGLETON};
use entrypoint::*;
use java_size_constants::*;
use mmtk::memory_manager;
use mmtk::scheduler::*;
use mmtk::util::conversions;
use mmtk::util::Address;
use mmtk::util::OpaquePointer;
use mmtk::MMTK;
use std::marker::PhantomData;
use std::mem;
use st... |
use byteorder::ByteOrder;
use byteorder::LE;
use scheduler::GeneratorTask;
use scheduler::Task;
use std::cell::Cell;
use std::rc::Rc;
use system::AccessWidth;
use system::Bus;
use system::OperationType;
/// Loose bits of memory not stored in other units
struct Memory {
bios: Box<[u8; 16 * 1024]>,
bios_unlocked... |
use std::ffi::OsString;
use std::path::PathBuf;
use clap::{self, App, Arg, ArgMatches};
use clap::{crate_authors, crate_version, crate_name, crate_description};
/// The output mode.
#[derive(Debug)]
pub enum Output {
FileName,
Bytes,
Offset
}
impl Default for Output {
fn default() -> Output { Output::FileNa... |
use euclid::num::{One, Zero};
use euclid::{size2, vec2, Point2D, TypedPoint2D, TypedRect, TypedSize2D, TypedVector2D};
use std::ops::{Add, Div, Mul, Neg, Sub};
/// Point anchoring, for snapping the origin point of a rectangle to different corners.
///
/// # Examples
///
/// ```
/// # extern crate euclid;
/// # extern ... |
use rlua;
use rlua::{Context, FromLua, Function, Lua, Value};
use lightoros_plugin_base::input::{CreateInputPluginResult, PluginInputTrait};
use lightoros_plugin_base::*;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use std::sync::mpsc;
use std::{thread, time};
use serde::Deserialize;
const NAME: ... |
#![no_std]
extern crate byteorder;
mod ops;
use byteorder::{ ByteOrder, LittleEndian };
pub use ops::Hc256Rng;
#[derive(Clone)]
pub struct HC256 {
inner: Hc256Rng,
buff: u32,
count: usize
}
impl HC256 {
pub fn new(key: &[u8], iv: &[u8]) -> HC256 {
let mut w = [0; 2560];
for i in 0... |
//! Internal procedural macros for [`tower-lsp`](https://docs.rs/tower-lsp).
//!
//! This crate should not be used directly.
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::quote;
use syn::{
parse_macro_input, AttributeArgs, FnArg, ItemTrait, Lit, Meta, MetaNameValue, NestedMeta,
ReturnType, ... |
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate clap;
mod parse_arguments;
mod selector;
mod program_message;
mod app;
mod scraping;
mod index_html;
mod path_name;
mod select_languages_from_list;
mod select_bound;
mod select_topic;
mod select_headless_mode;
use parse_arguments::parse_arg;
use program... |
//! An observation filter with stacking observations (frames).
use crate::PyGymEnvObsFilter;
use border_core::Shape;
use border_core::{record::Record, Obs};
use ndarray::{stack, ArrayD, Axis, IxDyn, SliceInfo, SliceOrIndex};
use num_traits::cast::AsPrimitive;
use numpy::{Element, PyArrayDyn};
use pyo3::{types::PyList, ... |
#![allow(non_camel_case_types)]
use std::mem;
use std::str::FromStr;
use std::time::Duration;
use time::Timespec;
use errors::{Error, ErrorKind, Result};
mod api_key;
mod code;
mod encode;
#[macro_use]
mod parse;
mod api_versions;
mod fetch;
mod group;
mod header;
mod list_offset;
mod message;
mod metadata;
mod off... |
use crate::error::{ErrorKind, Item};
use crate::pat_match::Pat;
use crate::st::St;
use crate::types::{Cx, Env, Sym, SymsMarker, Ty, ValEnv};
use crate::unify::unify;
use crate::util::{apply, get_env, get_scon, instantiate, record};
use crate::{dec, pat, ty};
use std::rc::Rc;
pub(crate) fn get(st: &mut St, cx: &Cx, ars... |
#[cfg(feature = "example_has_gui")]
use bevy::diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin};
use bevy::{prelude::*, window::WindowId};
#[cfg(feature = "example_has_gui")]
use bevy_vulkano::egui_winit_vulkano::egui;
use bevy_vulkano::{PipelineSyncData, VulkanoWindows};
use vulkano::{image::ImageAccess, sync::Gpu... |
use std::{
collections::{HashMap, HashSet},
sync::Arc,
};
use crate::cluster::{metadata::Metadata, ClusterInner};
use kafka_connector_protocol::{
api::produce::{ProduceRequest, ProduceRequestTopicData0, ProduceRequestTopicDataData0},
custom_types::{
nullable_string::NullableString,
reco... |
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use std::task::Poll;
use std::time::Duration;
use futures_util::future::FusedFuture;
use futures_util::{future, poll, stream, StreamExt};
use tokio::{task, time};
use tokio_tasker::*;
async fn stopable_future(mut stopper: Stopper) -> Result<(), Stoppe... |
pub mod parser;
use std::fmt::{Debug, Error as FmtError, Formatter};
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct GUID(pub u32, pub u16, pub u16, pub u64);
impl GUID {
pub const EMPTY: Self = Self(0, 0, 0, 0);
/// {0BE35203-8F91-11CE-9DE3-00AA004BB851}
pub const STD_FONT: Self = Self(0x0352E30B, 0x91... |
use std::mem;
#[cfg(all(target_feature = "avx2", target_arch = "x86_64"))]
use core::arch::x86_64::*;
#[derive(Clone)]
pub struct Xoshiro128PlusPlusAvx2 {
state: [[u64; Self::UNROLL]; 2]
}
impl Xoshiro128PlusPlusAvx2 {
const UNROLL: usize = 4;
#[inline]
pub fn new(state: [u8; 8 * Self::UNROLL * 2]) -... |
mod dijkstra;
mod intervals;
mod lines;
mod parse;
mod positions;
mod style;
mod syntax;
use clap::{App, Arg};
use std::ffi::OsStr;
use std::path::Path;
use typed_arena::Arena;
use crate::dijkstra::mark_syntax;
use crate::lines::{
apply_groups, enforce_length, format_line_num, join_overlapping, lhs_printable_width... |
extern crate gluon_base;
extern crate itertools;
extern crate walkdir;
use std::env;
use std::fs::File;
use std::io::{Read, Write};
use std::path::Path;
use itertools::Itertools;
use walkdir::WalkDir;
use gluon_base::filename_to_module;
#[cfg(feature = "test")]
mod gen_skeptic {
extern crate little_skeptic as ... |
use std::cmp::Ordering;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use common::Solution;
type Coordinate = (usize, usize);
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
enum Direction {
North,
South,
West,
East,
}
impl Direction {
pub fn from_char(c: char) -> Self {
... |
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::HashSet;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use deno_ast::ModuleSpecifier;
use deno_core::anyhow::anyhow;
use deno_core::anyhow::bail;
u... |
// Import from `core` instead of from `std` since we are in no-std mode
use core::result::Result;
// Import heap related library from `alloc`
// https://doc.rust-lang.org/alloc/index.html
use alloc::vec;
use validator_utils::{
ckb_std::{
ckb_constants::Source,
ckb_types::{bytes::Bytes, prelude::Unp... |
use std::collections::HashMap;
use std::ops::Deref;
use rand::{CryptoRng, Rng};
use signal_common::error::Result;
use signal_common::keys::{
ChainKey,
RatchetKeyPair,
MessageKey,
RatchetKeyPublic,
};
use crate::encrypt::AeadCipher;
use crate::ratchet::DoubleRatchet;
const MAX_SKIP: u32 = 777;
/// A... |
use crate::errors::*;
use goblin::elf::Elf;
use goblin::mach::{self, Mach, MachO};
use goblin::Object;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
#[derive(Clone, Debug, Default)]
pub struct ExtractedSymbol {
pub name: String,
pub offset: usize,
pub size: Option<u... |
//#![feature(plugin)]
//#![plugin(plex)]
#![feature(inclusive_range_syntax)]
#![feature(box_patterns)]
#![feature(splice)]
#![feature(const_fn)]
#![feature(integer_atomics)]
//extern crate regex;
#[macro_use]
extern crate lazy_static;
extern crate rush_parser;
#[macro_use]
extern crate rush_pat;
extern crate rush_... |
use chrono::{DateTime, Duration, NaiveDateTime, Utc};
use rcgen::{
BasicConstraints, Certificate, CertificateParams, CustomExtension, DistinguishedName, DnType,
ExtendedKeyUsagePurpose::*, IsCa, KeyIdMethod, KeyPair, SanType, PKCS_ED25519,
};
use std::net::IpAddr;
use super::CA;
use crate::CertifyError;
#[der... |
// Copyright 2018 The Vault713 Developers
// Modifications Copyright 2019 The Gotts Developers
//
// 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/LIC... |
// Copyright 2017 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 ... |
// Replace declare-var and assign with declare-const and assume
use crate::ast::{
BinaryOp, Decl, DeclX, Expr, ExprX, Ident, Query, QueryX, Snapshots, Stmt, StmtX, Typ,
};
use crate::ast_util::string_var;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
fn find_version(versions: &HashMap<Ident, u32>, ... |
//! Simple wrapper for the [ffprobe](https://ffmpeg.org/ffprobe.html) CLI utility,
//! which is part of the ffmpeg tool suite.
//!
//! This crate allows retrieving typed information about media files (images and videos)
//! by invoking `ffprobe` with JSON output options and deserializing the data
//! into convenient Ru... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
use std::os::raw::c_int;
use backtrace::Frame;
use nix::sys::signal;
use crate::collector::Collector;
use crate::frames::UnresolvedFrames;
use crate::timer::Timer;
use crate::Result;
use crate::{Error, MAX_DEPTH};
use crate::{ReportBuilder, MAX_THREA... |
//! The `timing` module provides std::time utility functions.
use crate::unchecked_div_by_const;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
pub fn duration_as_ns(d: &Duration) -> u64 {
d.as_secs()
.saturating_mul(1_000_000_000)
.saturating_add(u... |
// Colour difference computation implementations.
// Copyright (c) 2021 <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 limitatio... |
use std::io::{Read, Write};
use std::path::Path;
use std::ptr;
use dynasm::dynasm;
use dynasmrt::{DynasmApi, DynasmLabelApi};
use crate::bf::compile::{compile, optimize};
use crate::bf::error::{Result, RuntimeError, VMError};
use crate::bf::ir::BfIR;
const MEMORY_SIZE: usize = 4 * 1024 * 1024;
pub struct BfVM<'io> ... |
use color_eyre::eyre::Result;
use crossbeam_channel::{Receiver, Sender};
use std::{
fs::File,
io::{BufWriter, Write},
path::Path,
process::{Child, Command, Stdio},
time::Instant,
};
#[cfg(windows)]
use std::os::windows::process::CommandExt;
use super::ImageDimentions;
use crate::{utils::create_fo... |
//! Proc macro which builds the Symbol table
//!
//! # Debugging
//!
//! Since this proc-macro does some non-trivial work, debugging it is important.
//! This proc-macro can be invoked as an ordinary unit test, like so:
//!
//! ```bash
//! cd compiler/rustc_macros
//! cargo test symbols::test_symbols -- --nocapture
//!... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use std::sync::Arc;
use aws_sdk_sts::operation::AssumeRole;
use aws_sdk_sts::{Config, Credentials};
use aws_types::region::Region;
use super::repr::{self, BaseProvider};
use crate::profile::credentia... |
// SPDX-License-Identifier: MIT
// Copyright (C) 2018-present iced project and contributors
use crate::block_enc::instr::*;
use crate::block_enc::*;
use crate::iced_error::IcedError;
use core::cell::RefCell;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
enum InstrKind {
Unchanged,
Rip,
Eip,
Long,
... |
use anyhow::{anyhow, bail, Result as AResult};
use libcommon::{Reader, SharedStream, vfs::{VirtualFile, VirtualFileSystem}};
use rc_zip::{Archive, EntryReader, ReadZip, EntryContents, StoredEntry};
use std::{convert::TryFrom, fmt, fs::File, io::{Read, Seek, SeekFrom, self}, path::{Path, PathBuf}};
use tempfile::Spooled... |
use super::proto;
use crate::data::{
block::{self, Block, BlockEvent, BlockId, ChainPullRequest, Header},
fragment::Fragment,
gossip::{Gossip, Node},
};
use crate::error::{self, Error};
use tonic::{Code, Status};
use std::convert::TryFrom;
pub(super) fn error_into_grpc(err: Error) -> Status {
use erro... |
#[macro_use]
extern crate actix_web;
#[macro_use]
extern crate log;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate serde;
#[macro_use]
extern crate diesel;
mod env;
use crate::env::{Config, CONFIG};
mod web;
use web::*;
mod templates;
mod schema;
mod models;
use crate::{
templates::{
... |
use amethyst_core::specs::{Entity, WriteStorage};
use amethyst_core::{GlobalTransform, Named, Transform};
use {PrefabData, PrefabError, ProgressCounter};
impl<'a, T> PrefabData<'a> for Option<T>
where
T: PrefabData<'a>,
{
type SystemData = <T as PrefabData<'a>>::SystemData;
type Result = Option<<T as Prefa... |
/*
* Copyright 2018 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... |
//! REST server
//!
//! The REST server provides clients with a simple RESTful HTTP API. This component is (currently)
//! intended for basic informational / GET endpoints only; more complex operations should be handled
//! via the RPC server.
//!
//! The actual server is run in backgrounded tasks. HTTP requests are tr... |
//! The ondisk corpus stores unused testcases to disk.
use alloc::vec::Vec;
use core::{cell::RefCell, time::Duration};
use serde::{Deserialize, Serialize};
use std::{
fs::OpenOptions,
path::{Path, PathBuf},
};
#[cfg(feature = "std")]
use std::{fs, fs::File, io::Write};
use crate::{
bolts::serdeany::Serde... |
use serde::ser::Error;
use serde::{Deserialize, Serialize, Serializer};
use super::player::InventorySlot;
/// A block entity loaded or saved to the Anvil format.
/// Should be serialized using NBT.
///
/// <https://minecraft.gamepedia.com/Chunk_format#Block_entity_format>
#[derive(Debug, Clone, Serialize, Deserialize... |
use anyhow::Result;
use async_mutex::Mutex;
use lru::LruCache;
use rand::{distributions, Rng};
use std::sync::Arc;
use tokio::fs;
use super::{Module, ModuleKind};
use crate::{
bot::Bot,
message::MessageSettings,
services::{Channel, ChannelId, Message, MessageId, Server, ServerId, Service, User},
settin... |
// Copyright (c) 2018-2022 <NAME> <<EMAIL>>,
// <NAME> <<EMAIL>>,
// <NAME> <<EMAIL>>
//
// 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/lice... |
//! A library for encoding/decoding Unix archive files.
//!
//! This library provides utilities necessary to manage [Unix archive
//! files](https://en.wikipedia.org/wiki/Ar_(Unix)) (as generated by the
//! standard `ar` command line utility) abstracted over a reader or writer.
//! This library provides a streaming int... |
use std::collections::VecDeque;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use futures::ready;
use protocol::{Error, Protocol, Request, Result};
use tokio::io::{AsyncRead, AsyncWrite, BufWriter};
use tokio::sync::mpsc::Receiver;
use crate::buffer::StreamGuard;
use metrics::Metric;
p... |
//! Constants, error types, and functions for validating [`Sticker`] fields.
//!
//! [`Sticker`]: twilight_model::channel::message::Sticker
use std::{
error::Error,
fmt::{Display, Formatter, Result as FmtResult},
};
/// Maximum length of a sticker description.
pub const STICKER_DESCRIPTION_LENGTH_MAX: usize =... |
// Copyright 2020, 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
// disclai... |
use std::io::{self, Read, Write};
use std::error::Error;
use std::result;
use std::fmt;
use std::str::FromStr;
use std::collections::BTreeMap;
macro_rules! err {
($($tt:tt)*) => { Err(Box::<dyn Error>::from(format!($($tt)*))) };
}
type Result<T> = result::Result<T, Box<dyn Error>>;
fn main() -> Result<()>{
l... |
//! Get a list of your EventSub subscriptions.
use super::*;
use crate::eventsub;
use helix::RequestGet;
/// Query Parameters for [Get EventSub Subscriptions](super::get_eventsub_subscriptions)
///
/// [`get-eventsub-subscriptions`](https://dev.twitch.tv/docs/api/reference#get-eventsub-subscriptions)
#[derive(Partial... |
use std::borrow::Cow;
use deunicode::deunicode_char;
use slice_group_by::StrGroupBy;
use crate::Token;
use crate::token::SeparatorKind;
use crate::TokenKind;
use crate::processors::ProcessedText;
use super::TokenStream;
use super::Tokenizer;
pub struct LegacyMeilisearch;
impl Tokenizer for LegacyMeilisearch {
f... |
use {
crate::{
quic_client::QuicTpuConnection, tpu_connection::TpuConnection, udp_client::UdpTpuConnection,
},
lazy_static::lazy_static,
lru::LruCache,
solana_net_utils::VALIDATOR_PORT_RANGE,
solana_sdk::{transaction::VersionedTransaction, transport::TransportError},
std::{
n... |
use crate::array_buffer;
use crate::array_buffer::Allocator as ArrayBufferAllocator;
use crate::support::char;
use crate::support::int;
use crate::support::intptr_t;
use crate::support::Allocated;
use crate::support::Allocation;
use crate::support::Opaque;
use crate::support::SharedPtr;
use std::any::Any;
use std::con... |
use crate::util::Buf;
use libgssapi_sys::{
gss_OID_desc, gss_display_status, OM_uint32, GSS_C_CALLING_ERROR_OFFSET,
GSS_C_GSS_CODE, GSS_C_ROUTINE_ERROR_OFFSET, GSS_S_COMPLETE,
_GSS_C_CALLING_ERROR_MASK, _GSS_C_ROUTINE_ERROR_MASK, _GSS_S_BAD_BINDINGS,
_GSS_S_BAD_MECH, _GSS_S_BAD_MECH_ATTR, _GSS_S_BAD_MIC... |
use libc::{open, ioctl, write, read};
use std::os::raw::{c_char, c_short};
use std::sync::{Arc, Mutex};
use std::ffi::CString;
use std::{io, mem, thread, env};
use std::net::{SocketAddr, UdpSocket};
const TUNSETIFF: u64 = 0x400454ca;
const SIOCGIFFLAGS: u64 = 0x8913;
const SIOCSIFFLAGS: u64 = 0x8914;
const SIOCSIFADDR:... |
#![no_std]
#![no_main]
// Define necessary functions for flash loader
//
// These are taken from the [ARM CMSIS-Pack documentation]
//
// [ARM CMSIS-Pack documentation]: https://arm-software.github.io/CMSIS_5/Pack/html/algorithmFunc.html
use panic_never as _;
use core::slice;
use e310x::{qspi0, QSPI0};
fn transfer_b... |
// File: day_4.rs
// Author: <NAME>
// Date: December 2020
/*
Copyright 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to... |
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::source::{indent_of, reindent_multiline, snippet_opt};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::{self as hir, Block, Expr, ExprKind, MatchSource, Node, StmtKind};
use rustc_lint::LateContext;
use super::{utils, UNIT_ARG}... |
/*
* File: transducer.rs
* Project: src
* Created Date: 17/09/2021
* Author: <NAME>
* -----
* Last Modified: 19/09/2021
* Modified By: <NAME> (<EMAIL>)
* -----
* Copyright (c) 2021 Hapis Lab. All rights reserved.
*
*/
use std::collections::VecDeque;
#[derive(Clone)]
pub struct Transducer {
r_d: f64,
... |
use rand::RngCore;
use rand::SeedableRng;
pub use streaming_iterator::StreamingIterator;
use super::mem::*;
use std::fmt::{Display, Formatter};
const RANDOM_SEED_SIZE: usize = 32;
type RandomGenerator = rand_chacha::ChaCha8Rng;
#[derive(Debug, Clone)]
pub enum Stage {
Fill { value: u8 },
Random { seed: [u8; ... |
use std::io;
use stack::Stack;
const GREATER_THAN_SET:u8 = 0x80;
const LESS_THAN_SET:u8 = 0x40;
const ZERO_SET:u8 = 0x20;
const NON_ZERO_SET:u8 = 0x10;
const OVERFLOW_SET:u8 = 0x08;
const UNDERFLOW_SET:u8 = 0x04;
const SIGNING_SET:u8 = 0x02;
const HALT_SET:u8 = 0x01;
const GREATER_THAN_RESET:u8 = 0x7F;
const LESS_TH... |
#![allow(unused_variables)]
#![allow(unused_mut)]
extern crate sfml;
extern crate nalgebra as na;
extern crate ncollide;
use sfml::system::Vector2f;
use sfml::window::{ContextSettings, VideoMode};
use sfml::window::window_style;
use sfml::graphics::{Shape, Transformable, RenderWindow, RenderTarget, ConvexShape, Color... |
pub fn readline() -> String {
let mut buf: String = String::new();
std::io::stdin().read_line(&mut buf).unwrap();
buf
}
pub fn read_int() -> i64 {
readline().trim().parse::<i64>().unwrap()
}
#[derive(Default)]
pub struct Scanner {
buffer: Vec<String>,
}
/// ```
/// let mut sc: S... |
//! Parse SQL queries as text to [IndexMap] (`tag` => `query`).
//!
//! Inspired by [github.com/krisajenkins/yesql](https://github.com/krisajenkins/yesql). This is Rust port with additional features.
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate quick_error;
use std::borrow::Cow;
pub use indexmap;... |
use actix_web::HttpResponse;
use actix_web::{HttpRequest, Json, Path};
use althea_types::ContactType;
use althea_types::InstallationDetails;
use althea_types::{BillingDetails, MailingAddress};
use settings::FileWrite;
/// This is a utility type that is used by the front end when sending us
/// installation details. Th... |
use opentelemetry::{
global,
trace::{FutureExt, SpanKind, TraceContextExt, Tracer},
KeyValue,
};
use opentelemetry_http::HeaderInjector;
use opentelemetry_semantic_conventions::trace::{HTTP_STATUS_CODE, RPC_GRPC_STATUS_CODE};
use std::{future::Future, pin::Pin};
use tonic::{
codegen::http::{Request, Res... |
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate 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) a... |
use crate::error::NettuError;
use crate::shared::{
auth::protect_account_route,
usecase::{execute, UseCase},
};
use actix_web::{web, HttpRequest, HttpResponse};
use nettu_scheduler_api_structs::add_user_to_service::*;
use nettu_scheduler_domain::{Account, ServiceResource, TimePlan, ID};
use nettu_scheduler_infr... |
#[allow(unused_imports)]
use fluvio_command::CommandExt;
use crate::test_meta::TestCase;
use crate::test_meta::test_result::TestResult;
use crate::test_meta::environment::{EnvDetail, EnvironmentSetup};
use crate::test_meta::derive_attr::TestRequirements;
use fluvio::{Fluvio, FluvioError};
use std::sync::Arc;
use fluvio... |
use crate::{
package::{self, retriever},
semver::{Range, Strictness, Version},
solver,
};
use petgraph::{self, visit::IntoNodeReferences};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::{BTreeMap, HashSet};
pub use crate::package::Package;
#[derive(Debug, Serialize, Dese... |
use crate::core::{
registry::Registry,
scheduling::{
resources::ChildItem, ChildInfoFilters, ChildItemSorters, ReplicaFilters, ResourceFilter,
},
};
use common::errors::SvcError;
use common_lib::types::v0::{
message_bus::{ChildUri, NexusId, NodeId},
store::{nexus::NexusSpec, nexus_persistenc... |
use bytecode_verifier::verifier::VerifiedModule;
use canonical_serialization::SimpleDeserializer;
use failure::prelude::*;
use indexmap::IndexMap;
use log::*;
use state_view::StateView;
use types::{
access_path::AccessPath,
account_address::AccountAddress,
account_config::{self, AccountResource},
write_... |
// This is a heavily stripped down and slightly modified version of the libhermit-rs x86-64 paging code written by <NAME>
#![allow(dead_code)]
/// Number of Offset bits of a virtual address for a 4 KiB page, which are shifted away to get its Page Frame Number (PFN).
pub const PAGE_BITS: usize = 12;
/// Number of bit... |
/*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... |
use std::{sync::Arc, thread};
use rsnano::{
Account, Amount, Block, BlockHash, KeyPair, Link, PublicKey, Signature, SignatureCheckSet,
SignatureChecker, StateBlock,
};
// original test: signature_checker.bulk_single_thread
#[test]
fn bulk_single_thread() {
let key = KeyPair::new();
let block = test_st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.