text stringlengths 3.09k 13.9k |
|---|
// This file is part auf the greetly package.
//
// (c) 2020 <NAME>
//
// For the full copyright and license information, please view the README.md file
// that was distributed with this source code.
//
use greetd_ipc as greetd;
use std::env;
use std::io;
use std::os::unix::net::UnixStream;
use greetd::codec::SyncCod... |
use std::collections::HashMap;
use xml::attribute::OwnedAttribute;
use crate::{
error::TiledError,
properties::{parse_properties, Properties},
util::{get_attrs, parse_tag, XmlEventResult},
LayerTile, LayerTileData, MapTilesetGid, MapWrapper,
};
#[derive(Debug, PartialEq, Clone)]
pub enum ObjectShape ... |
// Copyright 2017 <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/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordi... |
use std::fmt;
use common;
use ast;
use super::token;
use ast::NodeVisitor;
pub fn dump_node<'a>(node: &'a ast::Node<'a>) -> String {
let mut dumper = NodeDumper::new();
node.accept(&mut dumper);
dumper.status().result.clone()
}
pub fn dump_bare_node<'a>(node: &'a ast::Node<'a>) -> String {
let he... |
use bigdecimal::{BigDecimal, ToPrimitive};
use serde::{Deserialize, Serialize};
/// The monetary value that is scaled to an integer based on its currency.
///
/// See [Calculating the value](https://docs.checkout.com/resources/calculating-the-value)
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
#[serde(transpa... |
use crate::transfer_types::RustAllocatedString;
use crate::CResult;
use num_enum::{IntoPrimitive, TryFromPrimitive};
use std::cell::{Cell, RefCell};
use std::convert::TryFrom;
use std::io::{self, Write};
use std::panic::UnwindSafe;
use std::sync::atomic::{AtomicBool, Ordering};
#[repr(u8)]
#[derive(Clone, Copy, IntoPr... |
use support::*;
use self::futures::sync::{mpsc, oneshot};
use self::tokio_core::net::TcpStream;
type Request = http::Request<()>;
type Response = http::Response<BodyStream>;
type BodyStream = Box<Stream<Item=Bytes, Error=String> + Send>;
type Sender = mpsc::UnboundedSender<(Request, oneshot::Sender<Result<Response, S... |
//! This module defines glyphs and glyphs systems. All glyphs in a glyph system share the same font,
//! but can differ in all other aspects.
use crate::prelude::*;
use super::font;
use font::Font;
use font::GlyphRenderInfo;
use ensogl_core::data::color::Rgba;
use ensogl_core::display;
use ensogl_core::display::layo... |
extern crate quicksilver;
extern crate rand;
use quicksilver::{
geom::{Vector, Shape, Circle, Rectangle, Transform},
graphics::{Color, Font, FontStyle, Image, Background},
lifecycle::{run, Asset, Settings, State, Window, Event},
input::{ButtonState, Key},
Future, Result,
};
use rand::{RngCore, thr... |
use std::{
collections::HashMap,
ffi::OsStr,
path::{Path, PathBuf},
str::FromStr,
sync::{Arc, Mutex},
};
use crate::{
fornjot_v1::{FornjotV1, LogLevel},
model_v1::{Metadata, ModelV1},
};
use anyhow::{Context as _, Error};
use structopt::StructOpt;
use tracing_subscriber::EnvFilter;
use wasm... |
//! Config used by the language server.
//!
//! We currently get this config from `initialize` LSP request, which is not the
//! best way to do it, but was the simplest thing we could implement.
//!
//! Of particular interest is the `feature_flags` hash map: while other fields
//! configure the server itself, feature f... |
#![feature(crate_visibility_modifier)]
#![feature(proc_macro_diagnostic, proc_macro_span)]
#![recursion_limit="256"]
extern crate proc_macro;
extern crate proc_macro2;
extern crate syn;
#[macro_use] extern crate quote;
mod spanned;
mod parser;
use parser::*;
use spanned::Spanned;
use syn::*;
use proc_macro2::TokenS... |
use crate::{
body::Body, config::Backend, error::Error, headers::filter_outgoing_headers,
wiggle_abi::types::PendingRequestHandle,
};
use futures::Future;
use http::{uri, HeaderValue};
use hyper::{client::HttpConnector, Client, HeaderMap, Request, Response, Uri};
use hyper_rustls::{HttpsConnector, MaybeHttpsStr... |
extern crate gl;
use crate::gl_vertices::*;
use crate::{ExplainObject, ZoomTransform, TypedExplainObject, Shaders};
use crate::util::*;
use sdl2::event::Event;
use serde_json::{from_str, Map, Value};
extern crate image;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct SavedText {
... |
mod fzf;
mod skim;
pub use fzf::FzfFinder;
pub use skim::SkimFinder;
use crate::structures::cheat::VariableMap;
use crate::structures::finder::Opts;
use crate::structures::finder::SuggestionType;
use anyhow::Context;
use anyhow::Error;
use std::process::{self, Output};
use std::process::{Command, Stdio};
#[derive(De... |
#![recursion_limit = "512"]
use api::login::LoginRequest;
use overview::OverviewRoute;
use shared::UserAuth;
use web_sys::MouseEvent;
use yew::{html, Component, ComponentLink, Html, ShouldRender};
use yew::{services::ConsoleService, InputData};
use yew_router::agent::{RouteAgentDispatcher, RouteRequest};
use yew_route... |
// Constructs a graph from a space-colonization simulation
extern crate space_colonization;
extern crate nalgebra as na;
extern crate kiss3d;
extern crate rand;
extern crate num;
extern crate clap;
extern crate dot;
use kiss3d::window::Window;
use na::{Pnt2, Pnt3, Vec2, Vec3, FloatPnt, FloatVec};
use num::Zero;
use s... |
use crate::utils::{Markdown, Utils};
use anyhow::Context;
use serde::{Deserialize, Serialize};
#[allow(dead_code, unused_imports)]
#[path = "../target/flatbuffers/achievements_generated.rs"]
mod achievements_generated;
pub use achievements_generated::ds3c as fb;
#[derive(Debug, Deserialize, Serialize, Clone)]
pub str... |
use std::collections::HashMap;
use ichiran::{kanji::Kanji, romanize::*, JmDictData};
use imgui::*;
use crate::backend::renderer::Env;
use super::kanji::KanjiView;
use super::mixins::*;
use super::settings::SettingsView;
pub struct TermView<'a> {
jmdict_data: &'a JmDictData,
kanji_info: &'a HashMap<char, Kan... |
use regex::Regex;
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::multispace0,
combinator::map,
sequence::{delimited, tuple},
};
use super::{Expression, ExpressionParseResult};
use crate::{
context::MutableContext,
function::Functions,
printable::Printable,
value... |
use std::collections::HashMap;
use futures::{Stream, Future};
use rtnetlink::new_connection;
use tokio_core::reactor::Core;
use rtnetlink::packet::{LinkInfo, LinkInfoKind, LinkNla};
use super::containers::Container;
use super::containers::containers;
#[derive(Debug, Clone)]
pub struct Links {
ns_name: String,
... |
use std::io::prelude::*;
use std::fs::File;
use std::rc::Rc;
use std::cell::RefCell;
use std::path::PathBuf;
use gtk;
use gdk;
use gtk::prelude::*;
use gtk::{Builder, DrawingArea, Label, MenuItem, Window};
use gdk::Gravity;
use gdk_pixbuf::Pixbuf;
use config::Config;
use tileset::Tileset;
use maparea::Maparea;
use po... |
use byte_struct::*;
bitfields!(
#[derive(PartialEq, Debug)]
TestBitfield: u16 {
x: 4,
pub y: 8,
z: 4,
}
);
#[derive(ByteStruct, PartialEq, Debug)]
#[byte_struct_be]
struct TestSubStruct1 {
b: u16,
c: [TestBitfield; 2],
}
#[derive(ByteStruct, PartialEq, Debug)]
struct TestS... |
//! Dynamic library facilities.
//!
//! A simple wrapper over the platform's dynamic library facilities
use std::ffi::CString;
use std::path::Path;
pub struct DynamicLibrary {
handle: *mut u8,
}
impl Drop for DynamicLibrary {
fn drop(&mut self) {
unsafe { dl::close(self.handle) }
}
}
impl Dynami... |
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{to_binary, Binary, Empty, Env, MessageInfo, Reply, StdResult, WasmMsg};
use cw2::set_contract_version;
use cw_utils::parse_reply_instantiate_data;
use crate::error::ContractError;
use crate::helpers::get_config;
use crate::msg::{Execute... |
use std::{
future::Future,
io::Write,
pin::Pin,
task::{Context, Poll},
};
use pin_project::pin_project;
use futures_core::Stream;
use futures_timer::Delay;
use futures_util::{
stream::{self, StreamExt},
FutureExt,
};
use std::time::Duration;
use bitcoins::prelude::TXID;
use coins_core::prelud... |
extern crate sdl2;
use sdl_mod::sdl2::keyboard::Keycode;
use sdl_mod::sdl2::video::Window;
use sdl_mod::sdl2::render::Canvas;
use sdl_mod::sdl2::EventPump;
use sdl_mod::sdl2::pixels::Color;
use sdl_mod::sdl2::rect::Rect;
use sdl_mod::sdl2::event::Event;
use sdl_mod::sdl2::audio::{AudioDevice, AudioSpecDesired, AudioSpe... |
use franklin_crypto::bellman::{Engine, Field, PrimeField};
use crate::common::matrix::{compute_optimized_matrixes, mmul_assign, try_inverse};
use crate::common::params::InnerHashParameters;
use crate::traits::{CustomGate, HashFamily, HashParams, Sbox};
#[derive(Clone, Debug)]
pub struct PoseidonParams<E: Engine, cons... |
use super::test_utils::must_panic;
use constmuck::{
contiguous::{self, FromInteger},
infer, Contiguous, IsContiguous,
};
#[repr(i8)]
#[derive(Debug, PartialEq, Copy, Clone)]
enum Tiny {
N1 = -1,
Z = 0,
P1 = 1,
P2 = 2,
}
unsafe impl Contiguous for Tiny {
type Int = i8;
const MIN_VALUE... |
/// Butcher Tableau for both implicit and Explicit RK methods
///
/// For an s-stage RK method the Butcher Tableau contains:
/// c = [c_1, c_2, ..., c_s]^T
/// b = [b_1, b_2, ..., c_s]
/// A = [a_ik] (s x s matrix)
///
/// Typically the Tableau is represented in the following form
///
/// c_1 | a_11 a_12 ... |
use std::hash::{Hasher, Hash};
use std::io::Cursor;
use byteorder::{LittleEndian, ReadBytesExt};
const C1: u32 = 0xcc9e2d51;
const C2: u32 = 0x1b873593;
const R1: u32 = 15;
const R2: u32 = 13;
const M: u32 = 5;
const N: u32 = 0xe6546b64;
pub struct Murmur3Hasher {
hash: u32,
len: usize,
carry: Vec<u8>,
... |
use log::trace;
use std::io;
// Empty response that sends nothing back to the client
pub(crate) const EMPTY_RESPONSE: Response = Response::empty();
// Start TLS handshake
pub(crate) const START_TLS: Response =
Response::fixed_action(220, "Ready to start TLS", Action::UpgradeTls);
/// Response to indicate that the ... |
use error::JwtError;
use frank_jwt::{
decode,
encode,
Algorithm,
};
use serde_json;
use wire::user::Jwt;
use Secret;
#[cfg(feature = "rocket_support")]
pub use self::rocket_support::user_authorization;
/// Because the JWT struct lives in the wire crate,
/// this NewType is used to define other functions o... |
use proc_macro::TokenStream;
use proc_macro2;
use quote::quote;
use std::collections::hash_set::*;
use syn::spanned::Spanned;
use syn::{parse_macro_input, parse_quote};
fn fail(span: proc_macro2::Span, msg: &str) -> TokenStream {
syn::Error::new(span, msg).into_compile_error().into()
}
#[proc_macro_derive(CustomD... |
/*
reader.rs: Holds the parser for S-Expressions, that is used to build up the Syntax-Tree(RLType)
Data_structure from a given input(String).
The resulting Data_structure is later used by eval.
*/
// load needed Rust-Functionality
use regex::Regex;
// load needed sibling-modules
use super::ty... |
extern crate junit_report;
extern crate serde;
use junit_report::*;
use serde::{Deserialize, Serialize};
use std;
use std::collections::BTreeSet;
use std::io::*;
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
struct SuiteResults {
passed: usize,
failed: usize,
}
#[derive(Serialize, Deserialize, Debu... |
use gba::io::background::BackgroundControlSetting;
use gba::io::background::{BGSize, BG0CNT};
use gba::vram::text::TextScreenblockEntry;
use gba::vram::SCREEN_BASE_BLOCKS;
use voladdress::VolAddress;
use flowergal_proj_assets::{UI_IMG, UI_PAL};
use flowergal_runtime::Driver;
use flowergal_proj_config::resources::{TEX... |
/// Exposes selected adjtimex(2) system call stats.
use super::{Error, ErrorContext};
use event::Metric;
// The system clock is not synchronized to a reliable
// server (TIME_ERROR)
const TIME_ERROR: i32 = 5;
// The timex.Status time resolution bit (STA_NANO),
// 0 = microsecond, 1 = nanoseconds
const STA_NANO: i32 =... |
use cairo;
use std::collections::HashMap;
use std::fmt;
#[derive(Clone, Copy)]
pub struct Color {
red: f64,
green: f64,
blue: f64,
alpha: f64,
}
#[derive(Debug, Deserialize, PartialEq, Eq, Hash, Clone, Copy)]
pub enum Layer {
Background,
Grid,
Axes,
#[serde(rename = "F.Cu")]
FCu,
... |
use std::path::PathBuf;
use clap::{AppSettings, ArgGroup, Parser};
use clap_complete as complete;
use url::Url;
use crate::cli::color_choice::ColorChoice;
use crate::config::{GistRepository, GitHubRepository, GitProtocol, Shell};
use crate::util::build;
#[derive(Debug, PartialEq, Parser)]
#[clap(
author,
abo... |
// layer.rs
//
// Copyright (c) 2019-2020 Minnesota Department of Transportation
//
use crate::config::LayerGroupCfg;
use crate::Error;
const ZOOM_MAX: u32 = 30;
/// Tag pattern specification to require matching tag
#[derive(Copy, Clone, Debug, PartialEq)]
enum MustMatch {
/// Pattern does not require match
... |
use std::sync::mpsc::{Sender, Receiver};
use std::sync::mpsc;
use std::thread;
use crate::lib::Solver;
use crate::lib::intcode_computer;
pub(crate) struct Day7Solver {}
fn valid(a: i128, b: i128, c: i128, d: i128, e: i128) -> bool {
a != b && a != c && a != d && a != e &&
b != c && b != d && b != e &&
... |
use tonality::Accidental;
use yew::{html, Html};
use crate::chord;
// With font-size 16
const STAFF_SPACE: f32 = 4.;
const STAFF_LINE_THICKNESS: f32 = 0.13 * STAFF_SPACE;
const LEGER_LINE_THICKNESS: f32 = 0.16 * STAFF_SPACE;
const THIN_BARLINE_THICKNESS: f32 = 0.16 * STAFF_SPACE;
const BARLINE_SEPARATION: f32 = 0.4 *... |
use anyhow::anyhow;
use regex::Regex;
use std::{cmp::Ordering, ops::RangeInclusive, collections::{HashMap, HashSet}};
pub fn parse_number(value: &str, range: RangeInclusive<u32>) -> anyhow::Result<u32> {
let x = value.parse::<u32>().map_err(|_| anyhow!("Failed to parse"))?;
if !range.contains(&x) {
ret... |
// Copyright 2021 The Simlin Authors. All rights reserved.
// Use of this source code is governed by the Apache License,
// Version 2.0, that can be found in the LICENSE file.
use std::fmt;
/// Loc describes a location in an equation by the starting point and ending point.
/// Equations are strings typed by humans fo... |
/*!
Cross-platform abstractions for the `sendfile()` system call.
Natively supported are Linux, android, MacOS, iOS, FreeBSD and DragonFlyBSD,
and every other `std`-platform using a fallback.
# Implementations
All native implementation support a maximum file length of [`off_t::max_value()`].
All implementations hand... |
#![allow(non_upper_case_globals, non_camel_case_types)]
extern crate libc;
use std::ffi::CString;
pub type UInt32 = libc::c_uint;
pub type SInt16 = libc::c_short;
pub type SInt32 = libc::c_int;
pub type FourCharCode = UInt32;
pub type OSType = FourCharCode;
pub type OSErr = SInt16;
pub const gestaltSystemVersion: ... |
use std::convert::Infallible;
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use std::vec::Vec;
/// Locale. A country code (`cc`) and an optional
/// language code (`lc`).
///
/// * Country codes must be lowercase ISO 3166-1 codes
/// or the special value "world".
/// * Language codes must be lower... |
use crate::error::error_exit;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Token {
pub string: String,
pub ty: TokenType,
pub line: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum TokenType {
Simbol,
Ident,
NumLiteral(i32),
StrLiteral,
}
pub fn dump_token(t... |
/// A temperature measurement.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Temperature(i32);
/// A humidity measurement.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Humidity(i32);
/// A combined temperature / humidity measurement.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Measure... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use super::behaviour::{MyBehaviour, MyBehaviourEvent};
use super::config::Libp2pConfig;
use futures::{Async, Stream};
use libp2p::{
core,
core::muxing::StreamMuxerBox,
core::nodes::Substream,
core::transport::boxed::Boxed,
... |
use std::mem;
use syscall::error::Result;
use syscall::io::Dma;
use super::Xhci;
use super::trb::Trb;
pub struct Ring {
pub link: bool,
pub trbs: Dma<[Trb]>,
pub i: usize,
pub cycle: bool,
}
impl Ring {
pub fn new(ac64: bool, length: usize, link: bool) -> Result<Ring> {
Ok(Ring {
... |
// Rust Bitcoin Library
// Written in 2014 by
// <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have r... |
// Copyright 2020 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 {
crate::{
align, name::validate_name, DirectoryEntry, Error, Index, IndexEntry, CONTENT_ALIGNMENT,
DIRECTORY_ENTRY_LEN, DIR_CHUNK_... |
//! Utility functions
use crate::rdsys;
use std::ffi::CStr;
use std::os::raw::c_char;
use std::os::raw::c_void;
use std::ptr;
use std::slice;
use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
/// Return a tuple representing the version of `librdkafka` in
/// hexadecimal and string format.
pub fn ... |
use libvmm::msr::Msr;
use x86::{segmentation, segmentation::SegmentSelector, task};
use x86_64::registers::control::{Cr0, Cr0Flags, Cr3, Cr3Flags, Cr4, Cr4Flags};
use x86_64::{addr::PhysAddr, structures::paging::PhysFrame, structures::DescriptorTablePointer};
use super::segmentation::Segment;
use super::tables::{GDTSt... |
//! Provides validations for unsafe code. Currently checks if unsafe functions are missing
//! unsafe blocks.
use std::sync::Arc;
use hir_def::{
body::Body,
expr::{Expr, ExprId, UnaryOp},
resolver::{resolver_for_expr, ResolveValueResult, ValueNs},
DefWithBodyId,
};
use crate::{
db::HirDatabase, d... |
use crate::themes::types::FileStyle;
use crate::themes::{Color, Line, ParserError, VecConvert};
#[derive(Debug, PartialEq, Eq)]
pub struct Language<'a> {
extensions: Vec<String>,
extensions_str: Vec<&'a str>,
color: Color,
icon: String,
}
impl<'a> Language<'a> {
pub const fn new(extensions: Vec<String>, col... |
use std::ffi::OsString;
use std::fmt;
use std::mem;
use std::os::windows::ffi::OsStringExt;
use ntapi::ntrtl;
use winapi::shared::{minwindef, ntstatus};
use winapi::um::{sysinfoapi, winbase, winnt};
use heim_common::prelude::{Error, Result};
use crate::Arch;
// TODO: Is not declared in `winapi` crate
// See https:/... |
mod wayland;
use snui::*;
use std::time;
use std::thread;
use snui::widgets::*;
use snui::wayland::app;
use std::sync::mpsc::Sender;
use wayland_client::{Display, Proxy};
use crate::wayland::river_status_unstable_v1::zriver_output_status_v1;
use crate::wayland::river_status_unstable_v1::zriver_status_manager_v1::Zrive... |
//! Sciter interop with native code and vice versa.
#![allow(unused_variables)]
#![allow(non_snake_case)]
#[macro_use]
extern crate sciter;
use sciter::{HELEMENT, Element, Value};
struct EventHandler {
root: Option<Element>,
}
impl Drop for EventHandler {
fn drop(&mut self) {
println!("interop::EventHandler: B... |
// The range_plus_one lint can't see when the LHS is not compatible with
// and inclusive range
#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))]
use crate::mux::renderable::Renderable;
use std::ops::Range;
use term::StableRowIndex;
use termwiz::surface::line::DoubleClickRange;
#[derive(Debug, Defa... |
// TODO: find better name for this submodule which contains helper
// functions/structs for the input format, but also just general utility
// code for implementing mutators
/// a field description
pub struct FormatField {
pub name: String,
pub pos : u32,
pub bits: u32,
}
pub struct InputFormat {
/// size of one... |
use crate::arch::address::VirtAddr;
use crate::arch::paging::PAGE_SIZE;
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::mem::size_of;
/// Test one allocation.
#[cfg(feature = "test-heap-one-alloc")]
pub fn test_main() {
Box::new(42);
}
/// Test big allocation and freeing.
#[cfg(feature = "test-heap-big-allo... |
use crate::chain::Block;
use rayon::prelude::*;
use tapyrus::BlockHash;
use tapyrus::consensus::encode::{deserialize, Decodable};
use std::collections::HashMap;
use std::fs;
use std::io::{Cursor, Seek, SeekFrom};
use std::path::PathBuf;
use std::sync::mpsc::Receiver;
use std::thread;
use crate::daemon::Daemon;
use ... |
// Copyright 2020-2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use core::fmt::Display;
use core::fmt::Formatter;
use core::mem;
use serde;
use serde::Deserialize;
use serde::Serialize;
use identity_core::convert::FmtJson;
use crate::chain::milestone::sort_by_milestone;
use crate::did::IotaDID;
use cra... |
// Copyright 2019 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
// disclaim... |
#[macro_use]
extern crate clap;
extern crate shelper;
use clap::{App, Arg};
use shelper::api;
use shelper::jobs;
use shelper::tunnels;
use shelper::users;
mod input_stripper;
fn main() {
let cmds = App::new("shelper")
.version(env!("CARGO_PKG_VERSION"))
.author(crate_authors!())
.about(r#"G... |
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use anyhow::anyhow;
use fil_actors_runtime::runtime::Policy;
use super::{Deadline, SectorOnChainInfo};
fn div_rounding_up(dividend: u64, divisor: u64) -> u64 {
dividend... |
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later ... |
use crate::sync::{Condvar,Mutex};
/// A barrier enables multiple tasks to synchronize the beginning
/// of some computation.
///
/// # Examples
///
/// ```
/// # async_std::task::block_on(async {
/// #
/// use async_std::sync::{Arc, Barrier};
/// use async_std::task;
///
/// let mut handles = Vec::with_capacity(10);
/... |
use nu_engine::CallExt;
use nu_protocol::{
ast::{Call, CellPath},
engine::{Command, EngineState, Stack},
Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
SyntaxShape, Value,
};
// TODO num_format::SystemLocale once platform-specific dependencies are stable (see Ca... |
// Copyright 2021 The Matrix.org Foundation C.I.C.
//
// 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... |
extern crate powersoftau;
extern crate bellman;
extern crate memmap;
extern crate rand;
extern crate blake2;
extern crate byteorder;
extern crate crypto;
// use powersoftau::bls12_381::{Bls12CeremonyParameters};
use powersoftau::small_bls12_381::{Bls12CeremonyParameters};
use powersoftau::batched_accumulator... |
// Copyright 2018 foundationdb-rs developers, https://github.com/bluejekyll/foundationdb-rs/graphs/contributors
// Copyright 2013-2018 Apple, Inc and the FoundationDB project authors.
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <... |
// Copyright 2018-2019 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://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... |
/**
* Defines a bucket which is a special kind of base for a particular app entry.
*
* Buckets have an id which must be deterministicly derivable from an entry.
* This way it is always possible to figure out which bucket an entry must belong to.
*/
use std::boxed::Box;
use hdk::{
entry_definition::ValidatingEntr... |
use crate::errors::Error;
use crate::message::Message;
use blpapi_sys::*;
use std::os::raw::c_int;
use std::marker::PhantomData;
use std::fmt::{Debug, Formatter};
use std::ptr;
/// An event
pub struct Event(pub(crate) *mut blpapi_Event_t);
impl Event {
/// Get event type
pub fn event_type(&self) -> EventType ... |
extern crate libm;
use hal;
use command::{BufCommand, Command, DeepSleepMode};
use config::Config;
use interface::DisplayInterface;
// Max display resolution is 160x296
/// The maximum number of rows supported by the controller
pub const MAX_GATE_OUTPUTS: u16 = 300;
/// The maximum number of columns supported by the... |
use clap::{App, Arg};
use solana_rbpf::{
assembler::assemble,
ebpf,
memory_region::{MemoryMapping, MemoryRegion},
static_analysis::Analysis,
syscalls::Result,
user_error::UserError,
verifier::check,
vm::{Config, DynamicAnalysis, EbpfVm, Executable, SyscallObject, SyscallRegistry},
};
use... |
//! # jokeapi_rs
//!
//! Rust wrapper for [JokeAPI](https://v2.jokeapi.dev/)
//!
//! ## Get a joke
//!
//! ```rust
//! use jokeapi_rs::Joke;
//!
//! fn main() {
//! println!("{}", Joke::new().fetch().joke());
//! }
//! ```
//!
//! ## Get a joke of a certain type
//!
//! Type can either be "single" or "twopart"
//!
... |
use crate::error::MemoryCreationError;
use crate::error::MemoryProtectionError;
use page_size;
use std::ops::{Bound, RangeBounds};
use std::{ptr, slice};
use winapi::um::memoryapi::{VirtualAlloc, VirtualFree};
use winapi::um::winnt::{
MEM_COMMIT, MEM_DECOMMIT, MEM_RESERVE, PAGE_EXECUTE_READ, PAGE_NOACCESS, PAGE_REA... |
/*
cargo run -p async-ssh2-lite-demo-smol --bin proxy_jump intranet.com:22 intranet_user bastion.com:22 bastion_user
*/
#![recursion_limit = "256"]
use std::env;
use std::io;
use std::net::{TcpStream, ToSocketAddrs};
use std::sync::Arc;
use async_executor::{Executor, LocalExecutor, Task};
use async_io::Async;
use ea... |
use crate::db::error::DBError;
use crate::db::internal;
use crate::db::logs::log_comment_body;
use crate::db::logs::LogContext;
use crate::db::model::*;
use crate::db::operations::models::DisplayRequest;
use crate::db::operations::models::DisplayRequestForUser;
use crate::db::operations::models::NewPendingRequest;
use ... |
use std::collections::HashMap;
use std::str::FromStr;
use Instruction::*;
use Operand::*;
use Variable::*;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Variable {
W,
X,
Y,
Z,
}
#[derive(Clone, Copy, Debug)]
pub enum Operand {
Var(Variable),
Num(i64),
}
#[derive(Debug)]
pub enum... |
use min_max_macros::max;
use rand::{rngs::SmallRng, Rng, SeedableRng};
use rl_utils::{Area, Coord};
use crate::{
dungeons::{Dungeon, DungeonBuilder, DungeonConfigurer, DungeonParams},
utils::{flood_fill::flood_fill, Tile},
};
/// This generates a single room [Dungeon](../dungeon/struct.Dungeon.html) by creat... |
use crate::{InputValue, Type_};
use std::fmt::{self, Display};
/// The __Field type represents each field in an Object or Interface type.
///
/// *FieldDefinition*:
/// Description<sub>opt</sub> Name ArgumentsDefinition<sub>opt</sub> **:** TypeDirectives<sub>\[Const\] opt</sub>
///
/// Detailed documentation can be... |
//! # Clock
//!
//! An interface for clocks that poll time and output HLC/NTP timestamps.
use crate::{
serialization::{Deserialize, Serialize},
time::timestamp::Timestamp,
};
use std::{
ops::Add,
time::{Duration, SystemTime, UNIX_EPOCH},
};
//#region Constants
/// ## Maximum time offset
///
/// Maximum... |
use ic_types::PrincipalId;
use openssl::pkey;
use std::{
env,
fs::File,
io,
io::Read,
path::{Path, PathBuf},
str::FromStr,
string::ToString,
};
use structopt::StructOpt;
#[derive(Debug)]
enum PemOrDer {
Pem,
Der,
}
#[derive(Debug)]
struct PemOrDerParseError(());
impl ToString for ... |
pub struct PlayHeadOptions {
pub sample_rate: Option<f32>,
pub tempo: Option<u32>,
pub ticks_per_quarter_note: Option<u32>,
}
pub struct PlayHead {
options: PlayHeadOptions,
// micro-second position ; might be better to use double.
position_us: u64,
position_samples: u32,
position_ticks... |
// TODO:
// 1. specificity is simple, but deps on selector parser. All needs to be realized.
pub type Specificity = (usize, usize, usize);
#[derive(Debug)]
pub struct StyleSheet {
pub rules: Vec<Rule>,
}
#[derive(Debug)]
pub struct Rule {
pub selectors: Vec<Selector>,
pub declarations: Vec<Declaration>,
... |
use super::super::super::{
create_where_predicates_from_generic_parameters, create_where_predicates_from_lit_str,
};
use crate::panic;
use crate::Trait;
use quote::{quote, ToTokens};
use syn::{
punctuated::Punctuated, token::Comma, Attribute, GenericParam, Lit, Meta, NestedMeta,
WherePredicate,
};
#[deri... |
use std::io;
use std::cmp;
use std::hash;
use std::path::PathBuf;
use std::ffi::CStr;
use std::convert::TryFrom;
use futures::future::BoxFuture;
use heim_common::prelude::*;
use heim_common::units::Time;
use heim_common::sys::IntoTime;
use super::{bindings, pids, utils::catch_zombie};
use crate::{Pid, ProcessResult,... |
use nannou::prelude::*;
struct Model {
bind_group: wgpu::BindGroup,
render_pipeline: wgpu::RenderPipeline,
vertex_buffer: wgpu::Buffer,
}
// The vertex type that we will use to represent a point on our triangle.
#[repr(C)]
#[derive(Clone, Copy)]
struct Vertex {
position: [f32; 2],
}
// The vertices t... |
#![feature(string_remove_matches)]
use anyhow::{anyhow, Context};
use clap::{Args, Parser, Subcommand, ValueHint};
use clap_num::si_number;
use cli_errors::{CliExitAnyhowWrapper, CliResult};
use memmap2::Mmap;
use rand::{
distributions::{Distribution, Uniform},
SeedableRng,
};
use rand_distr::LogNormal;
use ra... |
// Copyright 2018 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.
#![recursion_limit = "128"]
extern crate proc_macro;
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use syn::{parse_macro_input, Data, Deri... |
use std::time::Duration;
use chrono::Utc;
use rand::{RngCore, SeedableRng};
use rand_xoshiro::Xoshiro256StarStar;
use tokio_stream::StreamExt;
use crate::{
ipfs::{self, IpfsClient},
utils::*,
Result, BOOTSTRAP_STATE, GOSSIPSUB_TOPIC, INIT_STATE, NET_STATE, REDIS_TOPIC, STOP_STATE,
};
use tokio::time;
us... |
// Copyright 2016 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.
//! Type-safe bindings for Zircon sockets.
use bitflags::bitflags;
use crate::{AsHandleRef, HandleBased, Handle, HandleRef, Peered};
use crate::{Status, o... |
use std::io;
use std::io::prelude::*;
use std::collections::HashMap;
use std::fmt;
#[derive(Copy,Debug)]
enum Tile {
Open,
Trees,
Lumberyard,
Unknown,
}
impl Clone for Tile {
fn clone(&self) -> Tile { *self }
}
impl PartialEq for Tile {
fn eq(&self, other: &Tile) -> bool {
match (&self, other) {
(Tile::Op... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.