text stringlengths 7.05k 33.9k |
|---|
// Copyright © 2019 <NAME>, <NAME>
// [This program is licensed under the "MIT License"]
// Please see the file LICENSE in the source
// distribution of this software for license terms.
//
/// NOTE - the structure for this code was based in a example in the ggez repo.
/// Specifically, the design of 02_hello_world.rs (... |
use hash_hasher::{HashBuildHasher, HashedSet};
use crate::pieces::goban::*;
use crate::pieces::Nat;
use crate::pieces::stones::Color;
use crate::pieces::stones::Stone;
use crate::pieces::util::coord::{corner_points, is_coord_valid, one_to_2dim, Point, two_to_1dim};
use crate::rules::{EndGame, GobanSizes, IllegalRules,... |
//
// SOS: the Stupid Operating System
// by <NAME> (<EMAIL>)
//
// Copyright (c) 2016 <NAME>
// Released under the terms of the MIT license. See `LICENSE` in the root
// directory of this repository for more information.
//
//! Code for using the `x86` and `x86_64` segmentation hardware.
//!
//! For more informat... |
use std::{
cell::RefCell,
collections::hash_map::{Entry, HashMap},
io::Error as IoError,
fs::{File, OpenOptions},
rc::Rc,
os::unix::io::{AsRawFd, RawFd},
sync::{atomic::Ordering, Arc, Mutex},
time::Duration,
};
use image::ImageBuffer;
use slog::Logger;
#[cfg(feature = "egl")]
use smith... |
//! Contexts with frame information.
prelude! {}
use cxt::pre;
pub type Infos = idx::ExprMap<Info>;
#[derive(Debug, Clone)]
pub struct Info {
fp_e_deps: Set<idx::Expr>,
frames: VFrames,
}
#[derive(Debug, Clone)]
pub struct InfoBuilder {
fp_e_deps: Set<idx::Expr>,
own_frame_generics: rust::Generics,
... |
//! Clocks (CLOCKS)
//!
//!
//!
//! ## Usage simple
//! ```rust
//! let mut p = rp2040_pac::Peripherals::take().unwrap();
//! let mut watchdog = Watchdog::new(p.WATCHDOG);
//! const XOSC_CRYSTAL_FREQ: u32 = 12_000_000; // Typically found in BSP crates
//! let mut clocks = init_clocks_and_plls(XOSC_CRYSTAL_FREQ, p.XOSC,... |
#![cfg(feature = "db-redis")]
use crate::config::DbConfig;
use crate::error::Error;
use crate::models::{Entry, Metadata, Query, Search, User};
use argon2::{self, hash_encoded, verify_encoded};
use async_trait::async_trait;
use futures::TryFutureExt;
use redis::{AsyncCommands, Client};
use semver::Version;
use serde::d... |
use std::collections::HashMap;
use crossterm::event::{Event, KeyCode, KeyModifiers, MouseButton, MouseEvent};
use crossterm::terminal;
use solkit::card::{Card, Suit};
use solkit::engine::{Direction, Game, Pos};
use solkit::err::SolError;
use solkit::gconf::{self, FaceOrder, Playable, SuitOrder};
use crate::primitive... |
use std::{
collections::{BTreeMap, HashMap},
task::Poll,
};
use futures::{
future::{self, Ready},
task::Context,
};
use tower::Service;
use tracing::{debug, trace, warn};
use crate::services::messages::{multipart::buffer::MultipartMessageBuffer, ServiceError};
use xaynet_core::{
crypto::{PublicEnc... |
// Copyright (c) 2016 rust-threshold-secret-sharing developers
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. All files in the project carrying such notic... |
//! TODO Documentation
use libc::{self, c_double};
use std::{panic, ptr, cell::Cell, rc::{Rc, Weak}, time::Duration};
use wayland_sys::server::WAYLAND_SERVER_HANDLE;
use wayland_sys::server::signal::wl_signal_add;
use wlroots_sys::{timespec, wlr_subsurface, wlr_surface, wlr_surface_get_root_surface,
... |
/*
Day 23: Amphipod
Solve a logic puzzle for a group of amphipods.
A burrow is a hallway with 4 rooms, and different types of amphipods (A,B,C,D) in each room.
Move the amphipods so that all the As are in the first room, Bs in the second, etc.
Amphipods never stop in the hallway space immediately outside a room.
Amph... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
use core::convert::TryInto;
use hashbrown::HashMap;
use identity_core::common::Fragment;
use identity_core::common::Object;
use identity_core::common::UnixTimestamp;
use identity_core::common::Url;
use identity_core::crypto::JcsEd25519;
use identity_... |
// Copyright (c) 2019 Parity Technologies Limited
//
// 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... |
//
//
// This file is a part of Aleph
//
// https://github.com/nathanvoglsam/aleph
//
// MIT License
//
// Copyright (c) 2020 Aleph Engine
//
// 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 Softwar... |
#![no_std]
extern crate alloc;
use core::cmp::Reverse;
use alloc::{vec, vec::Vec};
use rand_core::RngCore;
use sample_consensus::{Consensus, Estimator, Model};
/// The ARRSAC algorithm for sample consensus.
///
/// Don't forget to shuffle your input data points to avoid bias before
/// using this consensus process. ... |
use std::pin::Pin;
use std::marker::Unpin;
use std::sync::Arc;
use std::future::Future;
use std::task::{Poll, Context};
use tab_organizer::{time, ease};
use tab_organizer::state::SortTabs;
use crate::constants::{DRAG_GAP_PX, TOOLBAR_TOTAL_HEIGHT, GROUP_BORDER_WIDTH, GROUP_PADDING_TOP, GROUP_HEADER_HEIGHT, GROUP_... |
use super::*;
use crate::raft::state_machine::callback::client::SubscriptionService;
use crate::raft::state_machine::callback::SubKey;
use crate::raft::state_machine::configs::commands::{
subscribe as conf_subscribe, unsubscribe as conf_unsubscribe,
};
use crate::raft::state_machine::master::ExecError;
use crate::r... |
//! Paragraph.
use super::layout_data::*;
use super::line_breaker::BreakLines;
use super::Direction;
use super::{builder_data::SpanData, font::Font, Paragraph, SpanId};
use core::iter::DoubleEndedIterator;
use core::ops::Range;
use swash::shape::{cluster::Glyph as ShapedGlyph, Shaper};
use swash::text::cluster::{Bound... |
use crate::number::Number;
use intel_dfp::Decimal;
use num_bigint::{BigInt, BigUint, Sign, ToBigUint};
#[cfg(feature = "std")]
use std::convert::TryInto;
#[cfg(not(feature = "std"))]
use alloc::string::{String, ToString};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[cfg(not(feature = "std"))]
use core::convert... |
use crate::code_graph::{BasicBlockFlags, CodeGraph, EdgeWeight};
use crossbeam::channel::Sender;
use log::{debug, error, trace};
use num_bigint::ToBigInt;
use petgraph::graph::NodeIndex;
use petgraph::visit::{Bfs, EdgeRef};
use petgraph::Direction;
use py27_marshal::{Code, Obj};
use pydis::opcode::py27::{self, Mnemo... |
//! # Parsing todos from an issue.
use nom::{bytes::complete as bytes, character::complete as character, combinator, multi, IResult};
use std::collections::HashMap;
use super::{take_to_eol, IssueBody};
/// Version 0 of the source location parser.
/// Parse the file and line location from an issue decription.
pub fn ... |
#![allow(non_camel_case_types)]
use std::fmt;
pub const LOWEST_PREC: usize = 0; // non-operators
pub const UNARY_PREC: usize = 6;
pub const HIGHEST_PREC: usize = 7;
#[derive(Hash, Eq, PartialEq, Clone)]
pub enum Token {
// Special tokens
NONE,
ILLEGAL(TokenData),
EOF,
COMMENT(TokenData),
// Identifiers and bas... |
use crate::block::on_block_update_notify_adjacent;
use crate::broadcasters::{
on_block_update_broadcast, on_chat_broadcast,
on_entity_client_remove_update_last_known_positions, on_entity_despawn_broadcast_despawn,
on_entity_send_send_equipment, on_entity_send_send_metadata,
on_entity_send_update_last_kn... |
#[macro_use] extern crate rsp2_assert_close;
#[macro_use] extern crate rsp2_integration_test;
#[macro_use] extern crate serde_derive;
type FailResult<T> = Result<T, ::failure::Error>;
use rsp2_integration_test::{resource, filetypes::Primitive};
use rsp2_dynmat::SuperForceConstants;
use rsp2_array_types::{M33, V3, U... |
use super::{output_film, Film, Renderer};
use crate::config::{Config, IntegratorKind, RenderSettings, Resolution};
// use crate::integrator::*;
use crate::integrator::{
CameraId, GenericIntegrator, Integrator, IntegratorType, Sample, SamplerIntegrator,
};
use crate::math::{RandomSampler, Sampler, StratifiedSampler... |
// Copyright 2012 Google Inc.
// Copyright 2020 <NAME>
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use super::Scalar64;
use super::point64::{Point64, SearchAxis};
use super::quad64;
pub const POINT_COUNT: usize = 4;
const PI: f64 = 3.141592653589793;
pu... |
use proc_macro2::Ident;
use proc_macro2::TokenStream;
use quote::format_ident;
use quote::quote;
use super::{generate_bare_typename, BaseType, DataItem, EnumItem, TaggedItem};
use crate::util::*;
// generate
// generate parser function implementations for the set of types of A2l
// A2ml does not use this code, since ... |
use argh::FromArgs;
use percent_encoding::percent_decode;
use regex::{Matches, Regex};
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufReader, Write};
use std::path::PathBuf;
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
use xml::attribute::OwnedAttribute;
use xml::reade... |
pub mod instructions {
// assembler directives
pub const CLASS: &'static str = "class";
pub const FIELD: &'static str = "field";
pub const METHOD: &'static str = "method";
pub const SUPER: &'static str = "super";
pub const IMPL: &'static str = "impl";
pub const VERSION: &'static str = "ve... |
use std::mem;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::collections::{HashSet, HashMap};
use crate::types::*;
use crate::data_types::*;
use crate::web::config::*;
use crate::web::vec_set::*;
use crate::web::util::*;
use pombase_rc_string::RcString;
pub fn make_cv_summaries<T: AnnotationContain... |
use descent::{loss::*, module::*, optimizer::*, prelude::*};
use flate2::bufread::GzDecoder;
use rand::{prelude::SliceRandom, RngCore, SeedableRng};
use std::{
convert::TryInto,
fs::File,
io::{self, prelude::*, BufReader, BufWriter},
path::{Path, PathBuf},
};
use structopt::StructOpt;
use strum::{EnumSt... |
use regex::Regex;
use std::env;
use std::fs;
use std::io::{self, stdout, Write};
use std::process;
use std::time::{Instant};
fn main() {
let start_time = Instant::now();
let args: Vec<String> = env::args().collect();
let mut config = get_config(&args); //Takes the args and returns a ConfigStruct with the p... |
extern crate base64;
extern crate clap;
extern crate fuse;
extern crate libc;
extern crate time;
#[macro_use]
extern crate log;
extern crate chrono;
extern crate config;
use clap::{App, Arg};
use env_logger::Env;
use fuse::{
FileAttr, FileType, Filesystem, ReplyAttr, ReplyData, ReplyDirectory, ReplyEntry, Request,... |
use crate::model::SeparableModel;
use crate::solvers::levmar::weights::Weights;
use crate::solvers::levmar::LevMarProblem;
use levenberg_marquardt::LeastSquaresProblem;
use nalgebra::{ComplexField, DVector, Scalar};
use num_traits::{Float, Zero};
use snafu::Snafu;
use std::ops::Mul;
/// Errors pertaining to use errors... |
use std::net::IpAddr;
use std::str::from_utf8;
use base64::decode;
use serde_derive::Deserialize;
use serde_json::json;
use serde_json::Value;
use url::Url;
use yaml_rust::Yaml;
use yaml_rust::YamlLoader;
use crate::client::Client;
use crate::client::Request;
use crate::error::AppError::ServiceError;
use crate::http:... |
#[allow(dead_code)]
mod cfr;
mod game_node;
mod game_preflop;
use bincode::deserialize;
use crossterm::{
cursor,
event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
execute, queue, style, terminal,
};
use game_node::PublicInfoSet;
use ordered_float::NotNan;
use regex::Regex;
use std::collections::{BTree... |
use crate::error::ContractError;
use crate::helpers::{
ensure_enough_native_funds, ensure_has_govec, ensure_is_admin, ensure_is_valid_migration_msg,
ensure_is_valid_threshold, ensure_is_wallet,
};
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg, WalletListResponse};
use crate::state::{
ADDR_PREFIX, AD... |
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use chrono_tz::Tz;
use google_youtube3::{
api::Scope,
api::{PlaylistItem, PlaylistItemListResponse, PlaylistItemSnippet, ResourceId},
client::Result,
YouTube,
};
use hyper::Response;
use log::debug;
use std::{cmp::Ordering, fmt};
#[derive(Defau... |
/*
This is the State Machine for a LoRaWan super-state "Session". The only way
to enter this state is for a device to be programmed in ABP mode (unimplemented)
or from a successul OTAA implemented in the NoSession module. The only way
to leave this state is to make a "Create Session" request which switches us
over to ... |
// Copyright 2016 Mozilla Foundation
//
// 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... |
#![cfg(feature = "hardware_buffer")]
use jni_sys::{jobject, JNIEnv};
use num_enum::{IntoPrimitive, TryFromPrimitive};
use std::{
convert::TryInto, mem::MaybeUninit, ops::Deref, os::raw::c_void, os::unix::io::RawFd,
ptr::NonNull,
};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct HardwareBufferUsage(pub... |
use std::{io, mem};
use bytes::{Bytes, BytesMut};
use futures::{Async, Poll};
use httparse;
use super::message::{MessageFlags, Request};
use super::settings::ServiceConfig;
use error::ParseError;
use http::header::{HeaderName, HeaderValue};
use http::{header, HttpTryFrom, Method, Uri, Version};
use uri::Url;
const M... |
use crate::rpc::{Clouds, MissionRpc, WeatherInfo};
use crate::tts::TextToSpeechProvider;
use crate::utils::{m_to_ft, m_to_nm, pronounce_number, round};
pub use srs::message::Position;
#[cfg(not(feature = "static-weather"))]
use anyhow::Context;
#[derive(Clone)]
pub struct Station {
pub name: String,
pub freq:... |
use std::cmp;
use std::error;
use std::fmt;
use std::io;
use std::mem;
use std::default::Default;
use crate::common::{AnyExtension, Block, DisposalMethod, Extension, Frame};
use crate::reader::DecodeOptions;
use weezl::{BitOrder, decode::Decoder as LzwDecoder, LzwStatus};
/// GIF palettes are RGB
pub const PLTE_CHAN... |
// Copyright 2019 CoreOS, 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... |
/* This is dvipdfmx, an eXtended version of dvipdfm by <NAME>.
Copyright (C) 2002-2016 by <NAME> and <NAME>,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Li... |
//! This module contains the main event loop for the linux operating system.
//!
//! This application, on linux, uses x11 for window management. This module includes basic
//! input event gathering, keyboard and mouse events. The primary functions of
//! interest are `make_window` and `update_screen`.
//! `make_win... |
use std::collections::BTreeMap as Map;
use std::collections::HashSet;
use crate::error::Error;
use crate::hash::sha256;
use crate::rdf::{BlankNodeLabel, DataSet, Predicate, Statement};
/// <https://json-ld.github.io/rdf-dataset-canonicalization/spec/#normalization-state>
#[derive(Debug, Clone)]
pub struct Normalizati... |
// use std::ops::Deref;
use std::char;
use std::collections::HashMap;
use std::io::{self, Write};
use super::compile;
use super::obj::objbool;
use super::obj::objiter;
use super::obj::objstr;
use super::obj::objtype;
use super::pyobject::{
AttributeProtocol, DictProtocol, IdProtocol, PyContext, PyFuncArgs, PyObjec... |
use std::{cmp::Reverse, fmt, marker::PhantomData, time::Instant};
use hashbrown::{HashMap, HashSet};
use log::{debug, info, log_enabled, warn, Level};
use crate::{
block::{Block, Color},
board::{Board, Point},
solver::{
line::LineSolver,
probing::{Impact, Priority, ProbeImpact, ProbeSolver... |
//! This mod implemented a ckb block reward calculator
use ckb_chain_spec::consensus::Consensus;
use ckb_dao::DaoCalculator;
use ckb_error::Error;
use ckb_logger::debug;
use ckb_store::ChainStore;
use ckb_types::{
core::{BlockReward, Capacity, HeaderView},
packed::{Byte32, CellbaseWitness, ProposalShortId, Scr... |
use std::cmp;
use std::collections::HashSet;
use std::iter;
use std::ops::{Add, AddAssign, Range};
use std::sync::Arc;
use super::tree::{self, Tree};
use notify_cell::NotifyCell;
pub type ReplicaId = usize;
type LocalTimestamp = usize;
type LamportTimestamp = usize;
#[derive(Debug)]
pub struct Buffer {
replica_id... |
// Copyright 2015 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, ... |
#![deny(unused_imports)]
use std::collections::HashMap;
use std::fs::OpenOptions;
use std::io::BufWriter;
use std::io::Write;
use std::iter::FromIterator;
use std::path::{Path, PathBuf};
use std::process::{Command, exit};
use std::str::from_utf8;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::{Instant};... |
//! This module defines the worker_config struct and related functions. It allows meshsim to
//! deserialize a configuration file into a worker_config object that eventually creates a worker object.
use crate::mobility::{Position, Velocity};
use crate::worker::listener::Listener;
use crate::worker::protocols::*;
use c... |
use self::{associations::SchemaAssociations, cache::Cache, ext::schema_ext_of, plugin::Plugin};
use crate::{environment::Environment, plugin, util::ArcHashValue, HashMap, LruCache};
use anyhow::{anyhow, Context};
use arc_swap::ArcSwap;
use async_recursion::async_recursion;
use futures::{stream::FuturesUnordered, Stream... |
use asset::obj;
use bencher::Bencher;
use files::create_file_recursively;
use geom::Vertex;
use runner::surfel_table_cache::SurfelTableCache;
use scene::{Entity, MaterialBuilder};
use sim::Simulation;
use sim::SurfelData;
use spec::{BenchSpec, Blend, EffectSpec, SimulationSpec, SurfelLookup};
use std::fmt;
use std::pat... |
#![deny(bare_trait_objects)]
use std::convert::identity;
use std::io;
use std::net::SocketAddr;
use futures::future::{self, Future};
use futures::sync::mpsc::channel;
use futures::{IntoFuture as _, Sink, Stream};
use log::{debug, error, info, warn};
use serde::{Deserialize, Serialize};
use thiserror::Error;
mod sqs;... |
use super::object::{ApiObject, ObjectField, OpRequirement, Parameter};
use super::state::EmitterState;
use super::RUST_KEYWORDS;
use crate::error::PaperClipError;
use crate::v2::{
models::{self, Api, DataType, DataTypeFormat, OperationMap},
Schema,
};
use failure::Error;
use heck::{CamelCase, SnekCase};
use st... |
//! Provides a Rust layer over the Windows IMMDevice API.
#![allow(unknown_lints)]
mod event;
use std::alloc;
use std::error::Error;
use std::ffi::{OsStr, OsString};
use std::fmt;
use std::isize;
use std::mem::MaybeUninit;
use std::os::windows::ffi::{OsStrExt, OsStringExt};
use std::ptr;
use std::slice;
use std::syn... |
use std::boxed::Box;
use std::fmt::Debug;
use std::sync::{Arc, Mutex};
use crate::features::Features;
use crate::port::Controls;
use crate::{
error::{InstantiateError, RunError},
event::LV2AtomSequence,
features::worker,
port::{DataType, IOType},
CommonUris, Port, PortConnections, PortCounts, PortI... |
use anyhow::Error;
use cargo_toml::Manifest;
use clap::ArgMatches;
use git2::{BranchType, Repository, Tree};
use std::cmp::Ordering;
use std::convert::TryInto;
use std::fs::read_to_string;
use std::fs::{remove_file, File};
use std::io::Write;
use std::path::PathBuf;
#[derive(Debug, Clone, Eq)]
pub struct Version {
... |
//! Okay, this immutable iterator doesn't use any `Access` types, and thus could not be used
//! on any element with possible mutable access at the same time (or could, but it's a subtle UB).
//! It could be used without UB only with unaliased memory, and due to this, `.iter()` should produce
//! a group of `(AliasedIt... |
use crate::{
event::{Event, EventChange},
util::*,
};
use anyhow::{format_err, Context as _, Result};
use derivative::Derivative;
use futures::prelude::*;
use serenity::{
builder::CreateEmbed,
collector::{EventCollector, EventCollectorBuilder},
model::{
channel::{Message, MessageFlags},
... |
//! Helper functions and structures needed to decode a FIT file using the defined profile.
use super::parser::FitDataMessage;
use crate::error::{ErrorKind, Result};
use crate::profile::{
get_field_variant_as_string, ComponentFieldInfo, FieldDataType, FieldInfo, MesgNum, MessageInfo,
};
use crate::{FitDataField, Fit... |
//! Showing UI:s for egui/epaint types.
use crate::*;
pub fn font_family_ui(ui: &mut Ui<'_>, font_family: &mut FontFamily) {
let families = ui.fonts().families();
ui.horizontal(|ui| {
for alternative in families {
let text = alternative.to_string();
ui.radio_value(font_family, a... |
use buffer::BufferSnapshot;
use cross_platform;
use futures::{Async, Future, Stream};
use notify_cell::NotifyCell;
use parking_lot::RwLock;
use rpc::{client, server};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[cfg(test)]
use serde_json;
use std::cell::RefCell;
use std::io;
use std::iter::Iterator;... |
use std::time::Instant;
use egui::FontDefinitions;
use egui_wgpu_backend::{RenderPass, ScreenDescriptor};
use egui_winit_platform::{Platform, PlatformDescriptor};
use futures_lite::future::block_on;
use mesh_shader::ShaderConstants;
use wgpu::util::DeviceExt;
use winit::event::Event::*;
use winit::event::WindowEvent::... |
// This file contains the schema that all Bonnie configuration files are deserialised with
// They will then be parsed into the schema defined in `schema.rs` using the logic in the methods on this schema
// The use of `#[serde(untagged)]` on all `enum`s simply ensures that Serde doesn't require them to be labelled as t... |
// T
// o
// w
// e
// r
// by Seldom, 2022
use std::{
env::args,
error::Error,
fmt::{self, Display, Formatter},
fs::read_to_string,
io::{stdin, stdout, Write},
process::exit,
};
#[derive(Debug)]
enum CommandError {
WrongNumOfArgs,
}
impl Display for CommandError {
fn fmt(&self, f: &m... |
//
// <NAME> <<EMAIL>>
//
// vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4:
//
use std::clone::Clone;
use serde::{Deserialize, Serialize};
use super::deck::Deck;
use super::card::Card;
use super::table::{Table, Declaration, PlayerTpos, TableEntry};
use super::actions::{PlayerAction, DeclAction, CaptureActi... |
use crate::store::{Event, EventOrData, EventType, HashHeight};
use crate::{LoggerOptions, Result, NAME};
use bitcoin::consensus::serialize;
use bitcoin::hashes::core::fmt::Formatter;
use bitcoin::hashes::Hash;
use bitcoin::{Block, BlockHash, Transaction, Txid};
use bitcoincore_rpc::{Client, RpcApi};
use flate2::write::... |
use super::{Target, Registers};
use crate::Result;
use std::{
cell::{Cell, RefCell},
fs,
io,
mem,
os::unix::ffi::OsStrExt,
};
use gdb_remote_protocol::{Error, StopReason};
use log::error;
use strace::{EventData, Flags, Tracer};
use syscall::flag::*;
pub struct Os {
pid: usize,
last_status... |
use std::env;
use std::fs;
use std::thread;
use std::time;
use chrono::{DateTime, Utc};
use chrono::offset::TimeZone;
use chrono::serde::ts_seconds;
use async_trait::async_trait;
const LOOP_INTERVAL: u64 = 3600;
#[derive(serde::Deserialize)]
struct TelegramChat {
id: i64,
#[serde(default)]
title: Option<S... |
use crate::utils::Error;
use futures::future;
use jfs::Store;
use link_preview;
use once_cell::sync::Lazy;
use regex::RegexBuilder;
use reqwest;
use serde::{Deserialize, Serialize};
use serde_json;
use std::collections::BTreeMap;
use std::ffi::OsStr;
use std::fs;
use std::fs::OpenOptions;
use std::io::BufReader;
use st... |
//! log_record 数据模型
#![allow(dead_code)]
use anyhow::Result;
use log::{error, info};
use serde_derive::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::env;
use std::fs::{create_dir_all, read_dir, File, OpenOptions};
use std::io::{BufReader, BufWriter, Read, Write};
use std::... |
/*!
A tool for implementing sound change algorithms.
This is strictly modeled after <NAME>'s [Sound Change Applier][sca],
with a necessary tweak for Rust's macro system.
[sca]: http://zompist.com/scahelp.html
Typical usage and the comparison with the original SCA rules:
```
#[macro_use] extern crate soundchange;
#[... |
use std::os::raw::{c_int, c_uchar, c_uint};
use crate::ModesMessage;
use std::convert::TryFrom;
// ===================== Mode A/C detection and decoding ===================
pub const MODEAC_MSG_SAMPLES: u32 = 25 * 2; // include up to the SPI bit
const MODES_ACFLAGS_SQUAWK_VALID: c_int = 1 << 5;
const MODEAC_MSG_SQU... |
//! Implementation of the GPIO controller.
use self::Pin::*;
use core::cell::Cell;
use core::ops::{Index, IndexMut};
use core::sync::atomic::{AtomicUsize, Ordering};
use kernel::common::VolatileCell;
use kernel::hil;
use sysctl;
const CLOCKS: [sysctl::RCGCGPIO; 15] = [
sysctl::RCGCGPIO::GPIOA,
sysctl::RCGCGPI... |
#![cfg_attr(
not(any(
feature = "vulkan",
feature = "dx11",
feature = "dx12",
feature = "metal",
feature = "gl",
)),
allow(dead_code, unused_extern_crates, unused_imports)
)]
#[cfg(feature = "dx11")]
extern crate gfx_backend_dx11 as back;
#[cfg(feature = "dx12")]
ext... |
use crate::{
command::LapceUICommand,
command::LAPCE_UI_COMMAND,
config::{Config, LapceTheme},
data::{LapceTabData, LapceTabLens, LapceWindowData},
editor::EditorUIState,
explorer::{FileExplorer, FileExplorerState},
menu::Menu,
panel::{LapcePanel, PanelPosition, PanelProperty},
state... |
//! Link-Layer connection management and LLCP implementation.
use {
crate::{
bytes::*,
config::Config,
link::{
advertising::ConnectRequestData,
channel_map::ChannelMap,
data::{self, Header, Llid, Pdu},
llcp::{ConnectionUpdateData, ControlPdu},... |
//! Util methods for [`rustc_middle::ty`]
#![allow(clippy::module_name_repetitions)]
use rustc_ast::ast::Mutability;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind, Res};
use rustc_hir::def_id::DefId;
use rustc_hir::{Expr, TyKind, Unsafety};
use rustc_infer::inf... |
use super::*;
use crate::{amount_ext::FromCliStr, betting::BetState, cmd, elog, item};
use bdk::{
bitcoin::{Address, OutPoint, Script, Transaction, Txid},
blockchain::EsploraBlockchain,
database::Database,
wallet::{coin_selection::CoinSelectionAlgorithm, tx_builder::TxBuilderContext, AddressIndex},
... |
use std::cell::RefCell;
use std::rc::Rc;
use crate::ast::parsed::*;
use crate::ast::verified::{RawFunction, RawOperator, VExpr, VExprTyped, VStatement};
use crate::symbols::SymbolFunc;
use crate::types::{verify_parsed_type, ParsedType, Type, VerifiedType};
use super::aggregate::ProgramAggregate;
use super::errors::{e... |
// 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.
//! Facilities for sending log message to syslog.
//!
//! Every function exported by this module is thread-safe. Each function will silently fail until... |
use anyhow::{anyhow, bail, Context, Result};
use cstr::cstr;
use rsmpeg::{
self,
avcodec::{AVCodec, AVCodecContext},
avfilter::{AVFilter, AVFilterContextMut, AVFilterGraph, AVFilterInOut},
avformat::{AVFormatContextInput, AVFormatContextOutput},
avutil::{
av_get_channel_layout_nb_channels, a... |
pub use stm32h7xx_hal as hal;
// - types --------------------------------------------------------------------
pub type A0 = hal::gpio::gpioa::PA3<hal::gpio::Analog>;
pub type A1 = hal::gpio::gpioc::PC0<hal::gpio::Analog>;
pub type A2 = hal::gpio::gpioc::PC3<hal::gpio::Analog>;
pub type A3 = hal::gpio::gpiob::PB1<hal... |
use crate::buckets::bucket_writer::BucketItem;
use rand::{thread_rng, RngCore};
use rayon::prelude::*;
use std::cell::UnsafeCell;
use std::cmp::min;
use std::cmp::Ordering;
use std::fmt::Debug;
use std::io::{Read, Write};
use std::slice::{from_raw_parts, from_raw_parts_mut};
use std::sync::atomic::AtomicUsize;
use unch... |
//
// ga_image - Image handling library
// Copyright (c) 2020 <NAME> <<EMAIL>>
//
// This project is licensed under the terms of the MIT license
// (see the LICENSE file for details).
//
//!
//! TIFF file format support.
//!
use super::{Image, ImageView, Palette, PixelFormat};
use std::fs::{File, OpenOptions};
use st... |
use crate::dataset::Dataset;
use crate::gdal_major_object::MajorObject;
use crate::metadata::Metadata;
use crate::raster::{GDALDataType, GdalType};
use crate::utils::{_last_cpl_err, _last_null_pointer_err, _string};
use gdal_sys::{
self, CPLErr, GDALColorInterp, GDALMajorObjectH, GDALRWFlag, GDALRasterBandH,
GD... |
#![feature(no_more_cas)]
#![allow(dead_code, unused_variables, unknown_lints)]
extern crate cme;
#[macro_use]
extern crate error_chain;
extern crate getopts;
extern crate lalrpop_util;
extern crate num_cpus;
#[macro_use]
extern crate log;
extern crate simplelog;
use getopts::{Matches, Options};
use simplelog::*;
use s... |
use crate::cross_compile::is_cross_compiling;
use crate::python_interpreter::InterpreterKind;
use crate::{PlatformTag, PythonInterpreter};
use anyhow::{anyhow, bail, format_err, Context, Result};
use platform_info::*;
use serde::Deserialize;
use std::env;
use std::fmt;
use std::path::Path;
use std::path::PathBuf;
use s... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2018, the Perspective Authors.
//
// This file is part of the Perspective library, distributed under the terms
// of the Apache License 2.0. The full license can be found in the LICENSE
// file.
use crate::utils::Weak... |
// Copyright (c) 2018-2021 The MobileCoin Foundation
use core::{cell::RefCell, convert::TryFrom};
use lazy_static::lazy_static;
use mc_account_keys::AccountKey;
use mc_attest_core::{Verifier, DEBUG_ENCLAVE};
use mc_common::{
logger::{create_app_logger, log, o, Logger},
HashMap, HashSet,
};
use mc_connection::{... |
//! # RedPacket Module
//!
//! A simple module for airdropping.
//!
//!
//! ## Overview
//!
//! RedPacket is an easy way for airdropping, called * 红包 * in chinese.
//! Someone can create a RedPacket that reserve some balances.
//! Others can claim balances from RedPacket until the RedPacket expired or finished.
//!... |
//! Code for talking directly (over a TLS connection) to a Tor client or relay.
//!
//! Channels form the basis of the rest of the Tor protocol: they are
//! the only way for two Tor instances to talk.
//!
//! Channels are not useful directly for application requests: after
//! making a channel, it needs to get used to... |
// Copyright 2018 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 ... |
use std::convert::TryFrom;
use crate::authorization::{Authorization, HeaderAuth, NoAuthorization};
use crate::cache::PublicKeyState;
use crate::consts::*;
use crate::dime::Dime;
use crate::domain::DimeProperties;
use crate::pb::{public_key::Key, PublicKeyRequest};
use crate::pb::public_key_request::Impl::HeaderAuth as... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.