text stringlengths 3.09k 13.9k |
|---|
/*
* Rust-FMOD - Copyright (c) 2014 <NAME>.
*
* The Original software, FMOD library, is provided by FIRELIGHT TECHNOLOGIES.
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permissio... |
// lib/input/joystick.rs
// Graphical Software Packager
// Copyright 2017 (c) <NAME>
// Copyright 2017 (c) <NAME>
// Licensed under the MIT LICENSE
use std::fmt;
use Input;
#[derive(PartialEq)]
#[derive(Copy, Clone)]
pub enum Button {
A,
B,
C,
D,
E(usize),
}
impl fmt::Display for Button {
fn fmt(&self, f: &mu... |
pub mod api;
use crate::album::{self, Album, AlbumItem, MediaType};
use crate::oauth::TokenService;
use api::{GPhotosApi, MediaItem, MediaItemsSearchRequest, RetryConfig};
use chrono::DateTime;
use failure::{self, Fail};
use log::debug;
use std::collections::VecDeque;
use std::io;
use std::path::Path;
use std::path::P... |
mod convert;
mod text_io;
use std::ffi::OsString;
use std::fs::File;
use std::io::{BufReader, BufWriter, Write as _};
use std::num::ParseIntError;
use std::path::Path;
use std::process;
use clap::Clap as _;
use wfc_core::{Features, Rng, World, WorldStatus};
// This is the same random seed wfc_gh will produce for its... |
use std::collections::HashMap;
use std::convert::TryInto;
use std::fmt::Display;
use std::str::FromStr;
use std::time::Duration;
use log::{debug, error, warn};
use reqwest::header::{HeaderMap, CONTENT_TYPE, USER_AGENT};
use reqwest::redirect::Policy;
use reqwest::{Client, Response as ReqwestResult, StatusCode};
use c... |
use crate::information_element::SbdHeader;
use crate::mo::session_status::SessionStatus;
use crate::{Imei, Result};
#[cfg(feature = "serde-derive")]
use serde::{Deserialize, Serialize};
use std::io::{Read, Write};
#[cfg(feature = "serde-derive")]
use time::format_description::well_known::Rfc3339;
use time::OffsetDateTi... |
/// Implementation of Glushkov's algorithm to build a
/// linearized language out of a regexp's HIR, and finaly convert this
/// expression to a variable NFA.
use std::collections::LinkedList;
use std::rc::Rc;
use super::super::automaton::Automaton;
use super::super::automaton::Label;
use super::parse::Hir;
#[derive(... |
use std::str::FromStr;
#[derive(Debug,PartialEq,Clone,Copy)]
pub enum LexToken<'a> {
Ident(&'a str),
Symbol(&'a str),
Number(i64),
KeyMod,
KeyOutput,
KeyLet,
KeyConst,
KeyMatch,
OpAdd,
OpSub,
OpMul,
OpDiv,
OpMod,
OpPower,
OpBitOr,
OpBitAnd,
OpB... |
#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! USB on the go full speed
//!
//! Used by: stm32f401, stm32f405, stm32f407, stm32f411, stm32f412, stm32f413, stm32f427, stm32f429, stm32f446, stm32f469
#[cfg(not(feature = "nosync"))]
pub use crate::stm32f4::peripherals::otg_fs_host::... |
// Copyright 2021, 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
// di... |
use crate::graph::properties::operations::{LeftOperand, Operator, RightOperand};
use crate::graph::properties::PropertyKeyId;
use crate::graph::stream_data::aggregation::AggregationOperation;
use crate::graph::GraphPointer;
use crate::graph::VertexOrEdgeId;
use hashbrown::HashMap;
use std::num::NonZeroU8;
use std::sync... |
//! Block watcher for efficient `get_latest_block`.
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
};
use futures::{prelude::*, stream::Fuse, try_ready};
use thiserror::Error;
use tokio::{spawn, sync::watch};
use super::snapshot::BlockSnapshot;
/// Block watcher error.
#[derive(Error, Debug)]
p... |
// 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.
//! This crate contains utility functions used in GIDL tests and benchmarks.
use {
fidl::{AsHandleRef, Handle, HandleBased, Rights},
fuchsia_zirco... |
/*
* Copyright (c) 2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* 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 ... |
use capnp::{message::ReaderOptions, serialize};
use divvun_schema::{
capnp_message,
interface::{self, ModuleRunParameters, PipelineInterface},
module_metadata,
string_capnp::string,
util,
};
use lazy_static::lazy_static;
use log::info;
use std::{ffi::CStr, io::Cursor, os::raw::c_char, str};
mod bind... |
//! A Rust version of the shbench heap microbenchmark
//!
//! The original version can be found on MicroQuill's website
//! http://www.microquill.com/smartheap/shbench/bench.zip
use alloc::{
vec::Vec,
string::String,
alloc::Layout,
};
#[cfg(not(direct_access_to_multiple_heaps))]
use alloc::alloc::GlobalAl... |
use rg3d::{
core::{algebra::Vector2, pool::Handle},
gui::{
brush::Brush,
define_constructor,
draw::{DrawingContext, SharedTexture},
grid::{Column, GridBuilder, Row},
image::ImageBuilder,
message::{MessageDirection, OsEvent, UiMessage},
text::{TextBuilder, ... |
use super::types::{Filestat, OpenFlags, Status, StatusResult};
use uptown_funk::StateMarker;
use wasi_common::{WasiCtx, WasiCtxBuilder};
use std::{
fs,
fs::{File, OpenOptions},
io::{IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
time::SystemTime,
u32,
};
type Fd = u3... |
use anyhow::Result;
use crossterm::{
event::DisableMouseCapture,
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use tui::{
backend::CrosstermBackend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style}... |
//! # Apollo
//!
//! A library for generative musical composition and synthesis. Each generated song is an instance
//! of the [Apollo](struct.Apollo.html) struct which is initialised with the following data:
//!
//! - A [Config](struct.Config.html)
//! - A [ConfigPreset](struct.ConfigPreset.html)
//! - A seed value f... |
use std::future::{ready, Ready};
use std::rc::Rc;
use std::time::Instant;
use actix_web::{
dev::{forward_ready, Service, ServiceRequest, ServiceResponse, Transform},
Error,
};
use actix_web::dev::{RequestHead, ResponseHead};
use actix_web::http::header::HeaderMap;
use clap::lazy_static::lazy_static;
use future... |
//! Boolean Logic Operations
use serde_json::Value;
use crate::error::Error;
use crate::value::{Evaluated, Parsed};
use crate::NULL;
/// Implement the "if" operator
///
/// The base case works like: [condition, true, false]
/// However, it can lso work like:
/// [condition, true, condition2, true2, false2]
/// ... |
#[derive(Default, Clone, PartialEq, Eq)]
pub struct TagSet(u32);
impl std::fmt::Debug for TagSet {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.tags().collect::<Vec<_>>())
}
}
impl TagSet {
pub fn of<'a, I>(from: I) -> Self
where
I: IntoIt... |
//! # Format 12: Segmented coverage
//!
//! Implementation of the `cmap` format 12 subtable.
//!
//! *Specification:*
//! [OpenType](https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-12-segmented-coverage),
//! [TrueType](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.htm... |
// Copyright (c) 2022 Espresso Systems (espressosys.com)
// This file is part of the Jellyfish library.
// You should have received a copy of the MIT License
// along with the Jellyfish library. If not, see <https://mit-license.org/>.
//! Lookup gates over variable tables.
use crate::{
circuit::{customized::gate... |
//! Uses `builder` and filesystem watch code to repeatedly
//! evaluate and build a given Nix file.
use crate::builder;
use crate::builder::RunStatus;
use crate::notify;
use crate::pathreduction::reduce_paths;
use crate::project::roots;
use crate::project::roots::Roots;
use crate::project::Project;
use crate::watch::{... |
//! Contains structs and functions for doing operations on wdl_hash records.
//!
//! A wdl_hash is a record of the location of a WDL and a hash of its contents. Represented in the
//! database by the WDL_HASH table.
use crate::schema::wdl_hash;
use crate::schema::wdl_hash::dsl::*;
use chrono::NaiveDateTime;
use diesel... |
#[macro_use]
extern crate log;
use actix_cors::Cors;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use futures::StreamExt;
use serde::Serialize;
use serde_json::json;
use std::fmt;
use std::path::PathBuf;
use structopt::StructOpt;
use vchain::acc;
use vchain::chain::*;
use vchain_simchain::SimChain;
... |
#![feature(custom_derive, plugin, type_ascription)]
#![plugin(serde_macros)]
extern crate discord;
extern crate regex;
extern crate serde;
extern crate serde_yaml;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use discord::{Discord, ChannelRef, State, Result};
use discord::model::{Event, Chann... |
use std::ops::Index;
use rand::Rng;
use rand::seq::SliceRandom;
use std::fmt::{Display, Formatter};
use std::fmt;
use serde::{Serialize, Deserialize};
use std::convert::TryFrom;
/// Enum encapsulating errors produced in the module.
#[derive(Debug, Clone)]
pub enum ErrorKind {
/// Error returned by the [`Derange::a... |
pub const ACC_PUBLIC: u16 = 0x0001; // X X X
pub const ACC_PRIVATE: u16 = 0x0002; // X X X (applicable to inner classes)
pub const ACC_PROTECTED: u16 = 0x0004; // X X X (applicable to inner classes)
pub const ACC_STATIC: u16 = 0x0008; // X X X (app... |
/// http://www.delorie.com/djgpp/doc/exe/
/// http://www.delorie.com/djgpp/doc/rbinter/id/51/29.html
use std::fmt;
use bincode::deserialize;
pub struct ExeFile {
pub header: ExeHeader,
pub relocs: Vec<ExeRelocation>,
pub program_data: Vec<u8>,
/// total .EXE file size
exe_size: usize,
}
pub enu... |
// Text-adventure game in rust
use std::collections::HashSet;
use std::io::stdin;
fn get_input() -> String {
let mut input = String::new();
stdin()
.read_line(&mut input)
.expect("Could not read input.");
input.to_lowercase()
}
fn print_inv(inventory: &mut Vec<Item>) {
for i in invento... |
extern crate oauthcli;
extern crate ureq;
extern crate url;
extern crate percent_encoding;
extern crate serde;
extern crate serde_json;
extern crate toml;
use std::fs;
use std::io::{Write, stdin};
use std::env;
use serde::{Deserialize, Serialize};
use oauthcli::*;
use percent_encoding::{utf8_percent_encode, AsciiSet, ... |
use w5500_hl::{io::Write, Error as HlError};
use crate::{properties::Properties, ClientId, CtrlPkt};
/// [Connect Reason Codes](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901079)
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(u8)]
pu... |
use std::collections::HashSet;
use std::sync::Arc;
use actix_web::dev::HttpServiceFactory;
use actix_web::web;
use actix_web::HttpRequest;
use actix_web::HttpResponse;
use actix_web::Responder;
use serde_json::json;
use serde_json::Value;
use slog::debug;
use slog::Logger;
use replicante_models_core::scope::Namespace... |
// Verify the correct error is returned when sending a text message.
//
use
{
ws_stream_tungstenite :: { * } ,
std :: { future::Future } ,
futures ... |
//! Routines for reading and writing files.
use std::io::{Read, Write};
use std::fs::File;
use tag::Tag;
use cycle::Cycle;
use std::path::Path;
use std;
use log::error;
use std::error::Error;
/// structure to hold measurements
#[derive(Debug, Clone)]
pub struct Measurement {
pub line: usize,
pub block: f64,
... |
//! Cargo redoc reloads your docs in a browser when they change
use futures_util::future;
use http::{header, response::Builder as ResponseBuilder, StatusCode};
use hyper::{
service::{make_service_fn, service_fn},
Body, Request, Response, Server,
};
use hyper_staticfile::Static;
use log::{debug, error, info};
us... |
mod ppm;
mod ray;
mod hittable;
mod world;
mod camera;
mod material;
use std::io::Write;
use std::path::Path;
use nalgebra::{Point3, Vector3};
use rand::Rng;
use crate::ray::Ray;
use crate::hittable::Object::Sphere;
use crate::hittable::Hittable;
use crate::world::World;
use crate::camera::{ASPECT_RATIO, Camera};
use... |
use super::CloudwatchError;
use futures::{future::BoxFuture, ready, FutureExt};
use rusoto_core::{RusotoError, RusotoResult};
use rusoto_logs::{
CloudWatchLogs, CloudWatchLogsClient, CreateLogGroupError, CreateLogGroupRequest,
CreateLogStreamError, CreateLogStreamRequest, DescribeLogStreamsError,
DescribeLo... |
// FIXME: Upstream bug (https://github.com/maciejhirsz/logos/issues/66)
#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]
use std::collections::HashMap;
use std::fmt;
use logos::Logos;
use yalr::extra::LogosSupport;
use yalr::*;
type JSONString = String;
type JSONNumber = f64;
type JSONObject = Hash... |
//! Human-readable time features.
use std::fmt;
use std::time::Duration;
#[cfg(feature="chrono")]
use chrono;
use crate::scalar;
const MIN_SECS: f64 = 60.0;
const HOUR_SECS: f64 = MIN_SECS * 60.0;
const DAY_SECS: f64 = HOUR_SECS * 24.0;
const WEEK_SECS: f64 = DAY_SECS * 7.0;
/// Human-displayable durations (from [Du... |
#[macro_use]
extern crate maplit;
use std::io::{self, Read};
use std::str::FromStr;
fn op(code: usize, r: [usize; 6], c: [usize; 4]) -> [usize; 6] {
let mut result = r;
match (code) {
0 => {
result[c[3]] = r[c[1]] + r[c[2]];
} // addr
1 => {
result[c[3]] = r[c[1... |
use crate::vex::*;
/// AES-256 round keys
pub(crate) type VexKeys256 = [u32; 60];
pub fn aes256_enc_key_schedule(user_key: &[u8]) -> VexKeys256 {
set_encrypt_key_inner_256(user_key, true)
}
fn set_encrypt_key_inner_256(user_key: &[u8], swap_final: bool) -> VexKeys256 {
let mut rk: VexKeys256 = [0; 60];
... |
mod puzzle_input;
use failure::Error;
use failure::err_msg;
use regex::Regex;
use regex::RegexSet;
use chrono::prelude::*;
use std::collections::BTreeMap;
use std::collections::HashMap;
// @returns the key of the entry with the highest value
fn hashmap_get_highest_value_entry(hash_map: &HashMap<u32, u32>) -> u32 {
... |
//! A platform agnostic driver to interface with the TSL256X (Lighting Intensity)
//!
//! This driver was built using [`embedded-hal`] traits.
//!
//! [`embedded-hal`]: https://docs.rs/embedded-hal
#![deny(missing_docs)]
#![deny(warnings)]
#![no_std]
extern crate embedded_hal as hal;
use hal::blocking::i2c;
use core... |
use std::{collections::BTreeMap, io::Read, result::Result};
// Bencoding spec
// https://wiki.theory.org/index.php/BitTorrentSpecification#Bencoding
#[derive(PartialEq, Ord, PartialOrd, Eq, Debug, Clone)]
pub enum Value {
ByteString(Vec<u8>),
Integer(i64),
List(Vec<Value>),
Dictionary(BTreeMap<Vec<u8>,... |
//! Rust wrapper around the BCrypt hashing algorithm implementation [written in C][src].
//!
//! The C implementation is embedded into this crate and compiled using build script.
//!
//! # Example
//!
//! ```
//! use bcrypt_bsd::{gen_salt, hash, to_str};
//!
//! let salt = gen_salt(12).unwrap();
//! let bcrypt_hash = ... |
use crate::{find_in_xml, utils, Error, Result};
use roxmltree::Node;
use std::{fmt, ops::RangeInclusive};
/// A `StateVariable` is the type of every [Argument](struct.Argument.html) in UPnP Actions.
/// It is either a single value, an enumeration of strings or an integer range: see
/// [StateVariableKind](enum.StateVa... |
use std::env::var;
use std::fs::{read_to_string, File, OpenOptions};
use std::io::Write;
use std::path::Path;
use std::process::Command;
use winreg::enums::*;
use winreg::RegKey;
const SETUP: &str = r#"
# Electric Tab Completion
Register-ArgumentCompleter -Native -CommandName electric -ScriptBlock {
param($wordToC... |
//! USB support, including for simulated COM ports. This module is a thin wrapper required to work with
//! the `usbd` crate.
//!
//! Requires the `usbotg_fs` or `usbotg_hs` features.
//! Used on F4, L4x5, L4x6, and H7. Others use the `usb` module.
// Based on `stm3h7xx-hal`
use crate::pac::{self, PWR, RCC};
pub use... |
use failure::Error;
use messages::Messages;
use rusqlite::Connection as SqlConnection;
use std::collections::HashMap;
use std::mem;
use std::net::SocketAddr;
use std::rc::Rc;
use std::sync::{Arc, Mutex, RwLock};
use std::thread::{self, JoinHandle};
use synac::common::{self, Packet};
use synac::{Listener, Session, State... |
mod support;
use cubik::glium::{glutin, Surface};
use cubik::draw::{ObjDrawInfo, EnvDrawInfo, basic_render, MAX_LIGHTS, Light};
use cubik::camera::perspective_matrix;
use cubik::input::{InputListener, process_input_event, center_cursor};
use cubik::skybox::Skybox;
use cubik::animation::ObjAnimation;
use cubik::player:... |
use std::{path::{PathBuf, Path}, fs, process};
use anyhow::Result;
use clap::Parser;
use json::Value;
macro_rules! download_if_not_exists {
($att:expr, $($url:tt),*) => {
$(
let path = $url.rsplitn(2, '/').nth(0).unwrap();
if fs::metadata(path).is_err() {
println!("[... |
/*
MIT License
Copyright (c) 2021 <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, copy, modify, merge, publish, distrib... |
use std::collections::VecDeque;
use std::future::Future;
use std::sync::{Arc, Mutex};
use std::task::Poll;
use bevy::prelude::*;
use bevy::tasks::IoTaskPool;
use log::info;
use log::warn;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{ErrorEvent, MessageEvent, WebSocket};
use crate::event_strea... |
//! Module `source_map` represents a [`Document`](super::Document)'s text source and provides
//! method to convert between offsets and positions in the source.
use parking_lot::RwLock;
use std::collections::HashMap;
use tower_lsp::lsp_types::Position;
/// Describes a source text, providing mappings between byte offs... |
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::io::Write;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
use std::thread::JoinHandle;
u... |
use std::fmt;
use serde_json;
use chrono::datetime::DateTime;
use chrono::UTC;
use client::Client;
use super::pricing::Pricing;
pub struct PricingQuery<'a> {
/// Name of the Instrument [required]
instrument: String,
/// The Price component(s) to get candlestick data for. Can contain any
/// combinat... |
use select::{
document::Document,
predicate::{Attr, Name, Predicate},
};
use serde::{Deserialize, Serialize};
use crate::subject::{Semester, Subject};
pub const CAGR_URL: &str = "https://cagr.sistemas.ufsc.br/modules/comunidade/cadastroTurmas/";
#[derive(Serialize)]
pub struct RequestForm {
#[serde(renam... |
use std::intrinsics::transmute;
use std::sync::Arc;
use ast::*;
use types::*;
pub mod name_sequence;
pub mod format;
pub mod expression_fold;
pub mod visitors;
pub mod sort;
#[cfg(test)]
macro_rules! assert_ok {
($r: expr, $tk: expr) => {
match &$r {
Ok((rem, item)) => {
assert_eq... |
use std::io::Stdout;
use anyhow::Result;
use tui::{
backend::CrosstermBackend,
layout::{Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
text::Text,
widgets::{Block, Borders, Clear, List, ListItem, Paragraph},
Frame as TuiFrame,
};
use super::state::{AppState, PromptType,... |
#![allow(unknown_lints)]
#![warn(clippy::all)]
#![allow(clippy::needless_return)]
use std::str::FromStr;
extern crate futures;
extern crate indicatif;
extern crate reqwest;
extern crate tokio;
use indicatif::{MultiProgress, ProgressBar, ProgressFinish, ProgressStyle};
use futures::stream::StreamExt;
use tokio::io::... |
// 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.
//! # The JSON message internationalization format
//!
//! This module contains the code used to turn a dictionary of localized messages into a
//! JSON-fo... |
use std::{collections::HashMap, convert::TryInto};
use anyhow::{ensure, Context, Error, Result};
use bytes::Buf;
use nom_derive::{nom, NomLE, Parse};
#[derive(Debug, NomLE)]
struct Header {
_magic: [u8; 4],
_record_count: u32,
_field_count: u32,
record_size: u32,
_string_table_size: u32,
_tabl... |
use std::collections::HashMap;
use std::fs;
use std::io::ErrorKind;
use chrono::NaiveDate;
use serde::{Deserialize, Deserializer};
use toml::de::Error as DeserializerError;
#[derive(Deserialize, PartialEq, Debug)]
pub struct Account {
#[serde(deserialize_with = "deserialize_date")]
pub start_date: NaiveDate,
#[ser... |
#![allow(dead_code)]
use crate::config::Config;
use crate::server::codec::*;
use crate::server::listener::IdentitySource;
use crate::server::UnixStream;
use failure::{bail, err_msg, format_err, Fallible};
use log::info;
use native_tls::TlsConnector;
use promise::{Future, Promise};
use std::collections::HashMap;
use std... |
//! Commonly found licenses listed [here](https://spdx.org/licenses).
use core::{
convert::{TryFrom, TryInto},
fmt,
};
use crate::ParseError;
mod decl;
mod serde;
#[doc(inline)]
pub use self::decl::SpdxLicense;
/// A fixed-size array for indexing with a [`SpdxLicense`] casted to [`usize`].
/// See also [`Sp... |
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use uuid::Uuid;
use super::errors::ApiErrors;
use crate::{errors::Errors, FromResponse};
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Hash, PartialEq, Eq)]
pub enum LanguageCode {
#[serde(rename = "ar")]
Arabic,
#[serde(rename = "bn")]
... |
/*
* Copyright 2019 <NAME> and 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
*
* Unless required by applicable law o... |
//! This module provides shims for the `embedded-hal` hardware corresponding to the SSD1322's
//! supported electrical/bus interfaces. It is a shim between `embedded-hal` implementations and
//! the display driver's command layer.
use nb;
/// An interface for the SSD1322 implements this trait, which provides the basi... |
/*****************************************************************************************[dimacs.rs]
Copyright (c) 2003-2006, <NAME>, <NAME> (MiniSat)
Copyright (c) 2007-2010, <NAME> (MiniSat)
Copyright (c) 2018-2018, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software... |
// Copyright 2022 Risc0, 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 parquet2::{
encoding::{hybrid_rle::encode_u32, Encoding},
metadata::ColumnDescriptor,
page::{CompressedDictPage, CompressedPage},
write::{DynIter, WriteOptions},
};
use super::binary::encode_plain as binary_encode_plain;
use super::primitive::encode_plain as primitive_encode_plain;
use super::utf8:... |
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::CompositeTemplate;
use std::rc::Rc;
use super::PlaylistDetailsModel;
use crate::app::components::{screen_add_css_provider, Component, EventListener, Playlist};
use crate::app::dispatch::Worker;
use crate::app::loader::ImageLoader;
use crate::app::{AppEvent,... |
use std::fs;
use std::time::SystemTime;
use std::collections::HashMap;
use std::process::{Command, Child};
use clap::{Arg, App};
use shellwords;
use std::fs::File;
use std::io::Read;
use json::{self, JsonValue};
fn main() -> std::io::Result<()> {
let cli = App::new("Hasty")
.version("0.1.0")
.author("Author... |
// Copyright 2019, 2020 Wingchain
//
// 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... |
#![no_std]
extern crate atsamd_hal as hal;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
#[cfg(feature = "rt")]
pub use cortex_m_rt::entry;
use hal::prelude::*;
use hal::*;
pub use hal::common::*;
pub use hal::samd21::*;
pub use hal::target_device as pac;
use gpio::{Floating, Input, PfC, Port};
use hal::clock::... |
use std::cmp::{max, min};
use std::collections::VecDeque;
#[derive(PartialEq, Eq, Debug, Clone, Hash)]
pub enum Bucket {
One,
Two,
}
/// A struct to hold your results in.
#[derive(PartialEq, Eq, Debug)]
pub struct BucketStats {
/// The total number of "moves" it should take to reach the desired number of ... |
#![cfg_attr(not(feature = "std"), no_std)]
/// Edit this file to define custom logic or remove it if it is not needed.
/// Learn more about FRAME and the core library of Substrate FRAME pallets:
/// https://substrate.dev/docs/en/knowledgebase/runtime/frame
use frame_support::{decl_module, decl_storage, decl_event, de... |
use ffi;
use libc::c_int;
use std::error;
use std::error::Error as StdError;
use std::fmt;
use std::io;
use error::ErrorStack;
use ssl::MidHandshakeSslStream;
use x509::X509VerifyResult;
/// An error code returned from SSL functions.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct ErrorCode(c_int);
impl Erro... |
#![feature(fs_walk)]
#![feature(slice_patterns)]
extern crate rustc_serialize;
extern crate time;
extern crate eve;
use std::env;
use std::fs::{OpenOptions, walk_dir};
use std::path::{Path, PathBuf};
use std::io::prelude::*;
use rustc_serialize::json::{ToJson, Json};
use eve::server::*;
use eve::flow::*;
use eve::co... |
use std::collections::HashMap;
use actix::prelude::*;
use failure::Error;
use log;
use serde::Deserialize;
use serde_json;
use tokio::io::AsyncReadExt;
#[cfg(test)]
use serde::Serialize;
use crate::command_util;
use crate::epg::*;
use crate::models::*;
use crate::tuner::*;
pub struct ClockSynchronizer<A: Actor> {
... |
use std::collections::VecDeque;
use std::io;
use fnv::{FnvHashMap, FnvHashSet};
use futures::{
sync::mpsc::{channel, Receiver, Sender},
Async, Poll, Stream,
};
use log::debug;
use p2p::multiaddr::ToMultiaddr;
use rand::seq::SliceRandom;
mod addr;
mod message;
mod substream;
pub use crate::{
addr::{AddrKn... |
use crate::direction::Direction;
use crate::event::{Event, EventResult, Key, MouseButton, MouseEvent};
use crate::theme::ColorStyle;
use crate::vec::Vec2;
use crate::view::View;
use crate::Cursive;
use crate::{Printer, With};
use std::cell::RefCell;
use std::rc::Rc;
struct SharedState<T> {
selection: usize,
va... |
/*
* 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... |
use std::io;
use std::path::Path;
use std::borrow::Cow;
use std::ops::Deref;
use memmap::{Mmap, Protection};
use owning_ref::OwningHandle;
use errors::Result;
enum ByteViewInner<'bytes> {
Buf(Cow<'bytes, [u8]>),
Mmap(Mmap),
}
/// A smart pointer for byte data.
///
/// This type can be used to uniformly acce... |
use serde::{de, ser};
use std::fmt;
pub trait UnvalidatedConfig {
type ValidCfg;
fn validate(
self,
id: crate::diag::FileId,
diagnostics: &mut Vec<crate::diag::Diagnostic>,
) -> Self::ValidCfg;
}
pub(crate) const NAME: &str = "$__toml_private_Spanned";
pub(crate) const START: &str... |
use std::io::Cursor;
use diesel::prelude::*;
use diesel::{delete, insert_into, update};
use rocket::http::{ContentType, Status};
use rocket::request::Form;
use rocket::response::{Redirect, Response};
use rocket_contrib::json::Json;
use crate::guards::*;
use crate::templates::FormError;
use crate::ObservDbConn;
use ... |
use super::{Codec, DecodeBuf, Decoder, Encoder};
use crate::codec::EncodeBuf;
use crate::{Code, Status};
use prost1::Message;
use std::marker::PhantomData;
/// A [`Codec`] that implements `application/grpc+proto` via the prost library..
#[derive(Debug, Clone)]
pub struct ProstCodec<T, U> {
_pd: PhantomData<(T, U)>... |
/*
* hurl (https://hurl.dev)
* Copyright (C) 2020 Orange
*
* 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 ... |
//! Run-time feature detection for Aarch64 on Linux.
use super::{auxvec, cpuinfo};
use crate::detect::{bit, cache, Feature};
/// Performs run-time feature detection.
#[inline]
pub fn check_for(x: Feature) -> bool {
cache::test(x as u32, detect_features)
}
/// Try to read the features from the auxiliary vector, a... |
use rustzx_core::{zx::keys::ZXKey};
use crate::zx_event::{Event};
/// returns ZX Spectum key form scancode of None if not found
pub fn ascii_code_to_zxkey(ascii_code: u8, pressed: bool) -> Option<Event> {
let zxkey_event = match ascii_code {
// Control keys
0x0A => Some(ZXKey::Enter),
// 0... |
use crate::{cluster_info::ClusterInfo, cluster_slots::ClusterSlots};
use solana_ledger::blockstore::{Blockstore, CompletedSlotsReceiver};
use solana_measure::measure::Measure;
use solana_runtime::bank_forks::BankForks;
use solana_sdk::{clock::Slot, pubkey::Pubkey};
use std::{
sync::{
atomic::{AtomicBool, Or... |
//!Decoder for the binary XML format used by Android.
//!
//!This library implements the minimal amount of parsing required obtain
//!useful information from a binary `AndroidManifest.xml`. It does not
//!support parsing generic binary XML documents and does not have
//!support for decoding resource identifiers. In ret... |
mod img;
mod text;
use super::element::Element;
use super::style::{AlignItems, JustifyContent, Margin, TextAlign};
use super::writer::OGImageWriter;
impl<'a> OGImageWriter<'a> {
pub(super) fn process(&mut self) {
let total_height = if self.content.height > self.window.height {
self.window.heig... |
use std::future::Future;
use std::io::{Error, ErrorKind, Result as IoResult};
use std::net::SocketAddr;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use http::uri::Scheme;
use hyper::{Body, Client, Request, upgrade, Uri};
use hyper::client::connect::{Connected, Connection};
use hyper::service... |
use std::{fmt::Display, path::PathBuf};
use futures::future::join_all;
use log::warn;
use lru::LruCache;
use serde::{Deserialize, Serialize};
use ssri::Integrity;
#[derive(PartialEq, Eq, Hash, Clone)]
pub struct CacheKey(pub String, pub String, pub bool);
impl Display for CacheKey {
fn fmt(&self, f: &mut std::fm... |
use crate::{
error::BaoError,
parsing::{BaoFunc, BaoStruct},
};
use clang::{Clang, Entity, EntityKind, Index};
use crate::{
matching::BaoConfiguration,
parsing::{BaoTU, BaoType},
pe::BaoPE,
};
use clang::diagnostic::Severity;
use clap::{App, Arg};
use log::{error, info, warn};
use simplelog::{Combi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.