text
stringlengths
3.09k
13.9k
use datamodel::{Datamodel, FieldArity, FieldType, RelationInfo}; use introspection_connector::Warning; use serde::Serialize; #[derive(Serialize, Debug)] struct Model { model: String, } #[derive(Serialize, Debug)] pub struct ModelAndField { pub model: String, pub field: String, } #[derive(Serialize, Debug...
use std::borrow::Cow; use cluFlock::{ExclusiveSliceLock, Flock}; use std::fs::{self, File}; use std::io; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use failure::*; use crate::config::*; use crate::log; mod state; use self::state::{PluginState, StateFile}; #[derive(Debug)] pub struct Storag...
use std::time::Duration; use async_trait::async_trait; use regex::Regex; use reqwest::header::{HeaderMap, FROM, USER_AGENT}; use serde::Deserialize; use tokio::{ sync::mpsc::UnboundedReceiver, time::{sleep, timeout}, }; use tracing::{debug, info, instrument, trace}; use twitch_irc::{ login::StaticLoginCred...
//! A parser for programs represented as s-expressions. use std::{ convert::TryFrom, fmt::{self, Debug, Display, Formatter}, }; /// S-expressions #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Sexp<'a> { /// An atomic s-expression Atom(&'a str), /// A list starting with an atomic ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 // replace with the official when it becomes public. use std::iter::Peekable; use functional_tests::errors::*; use libra_types::account_address::AccountAddress; use move_core_types::{ identifier::Identifier, language_storage:...
use std::default::Default; use druid::widget::prelude::*; use druid::widget::{Align, Flex, Label, Container, Split, List, Scroll, Controller, Button, Checkbox}; use druid::{AppLauncher, Color, Data, MenuDesc, MenuItem, WindowDesc, WidgetExt, WindowState, Lens, UnitPoint, Selector, Target}; // use log::{debug, info}; ...
use core::cmp::Ordering; /// Search a given byte slice for a given byte. /// /// This is a simple wrapper around the system's `memchr()` function. For more advanced uses, /// investigate the `memchr` crate. #[inline] pub fn memchr(s: &[u8], c: u8) -> Option<usize> { unsafe { let ptr = libc::memchr(s.as_ptr...
use eyre::{eyre, Result}; use itertools::Itertools; use std::fmt; #[derive(Debug, PartialEq, Clone, Copy)] enum Pixel { Light, Dark, } #[derive(Debug, PartialEq, Clone)] pub struct Image { data: Vec<Vec<Pixel>>, outer_pixel_state: Pixel, rows: i32, columns: i32, } #[derive(Debug, PartialEq)] ...
use super::traits::*; use super::releasable::*; use super::binding_context::*; use futures::prelude::*; use ::desync::*; use std::sync::*; /// /// Uses a stream to update a binding /// pub fn bind_stream<S, Value, UpdateFn>(stream: S, initial_value: Value, update: UpdateFn) -> StreamBinding<Value> where S: ...
use crate::model::span; use opentelemetry::api; use opentelemetry::exporter::trace; use opentelemetry::sdk::trace::evicted_hash_map::EvictedHashMap; use std::any::Any; use std::collections::HashMap; use std::net::SocketAddr; use std::sync::Arc; use std::time; use tracing::{info, trace, error}; pub mod model; pub mod p...
mod transform; pub use image::ImageOutputFormat; use image::{ guess_format, load_from_memory, DynamicImage, imageops::FilterType, GenericImage, GenericImageView, ImageFormat, }; pub use transform::{PixelCoords, PixelSize, Transform, TransformMode}; pub fn input_to_output_format( input_format: ImageForma...
use std::fmt; use std::ptr; use std::ffi::OsStr; use std::io::Result; use std::ops::Deref; use std::os::unix::io::{AsRawFd, RawFd}; #[cfg(feature = "mio")] use mio::{event::Evented, unix::EventedFd, Poll, PollOpt, Ready, Token}; use {ffi, util}; use {AsRaw, Device, FromRaw}; /// Monitors for device events. /// ///...
use std::collections::HashMap; use std::env::{self, VarError}; use std::iter::Iterator; use std::path::{Path, PathBuf}; use std::str::FromStr; use promptly::prompt; use serde::{Deserialize, Serialize}; pub use profile_variable::ProfileVariable; use crate::{Config, ResponseStore}; use crate::errors::{FhttpError, Resu...
//! Home of RuntimeArgs for calling contracts use alloc::{collections::BTreeMap, string::String, vec::Vec}; use crate::{ bytesrepr::{self, Error, FromBytes, ToBytes}, CLTyped, CLValue, }; /// Named arguments to a contract #[derive(PartialEq, Eq, Clone, Debug)] pub struct NamedArg(String, CLValue); impl Name...
//! Read in files at compile time, making them available no matter what // Licenses pub const BSD3: &str = include_str!("includes/licenses/BSD3"); pub const BSD: &str = include_str!("includes/licenses/BSD"); pub const GPL3: &str = include_str!("includes/licenses/GPL3"); pub const MIT: &str = include_str!("includes/lic...
//! Module to process WordStar dot commands use crate::uni_chars; use crate::ws_chars; // PRIVATE HELPER FUNCTIONS /// Returns `Some(tuple)` if text slice contains a dot followed by a two character /// command (an alphabetic then an alphanumeric character), otherwise `None` /// /// The text slice is scanned from lef...
use crate::{ error::Error::{Undefined, Unimplemented}, Result, }; use num::{BigInt, Signed, ToPrimitive}; use std::{collections::BTreeMap, str::FromStr}; // https://oeis.org/A006880 // ```wl // data=Import["https://oeis.org/A006880/b006880.txt","Table"] // T="table.insert(BigInt::from_str(\"``\").unwrap(),BigI...
use std::future::Future; use std::time::Duration; use tokio::time::sleep; use crate::api::Api; use crate::context::Context; use crate::event_listener::{EventListener, EventType}; use crate::message::{ChatroomType, MessageChain, ReceivedMessage}; use crate::utils::BotConfig; use crate::Result; pub struct Bot { qq:...
mod system_hardware; mod system_info; mod system_role; mod system_state; use adc::ADC; use bare_metal::CriticalSection; use beeper::PWMBeeper; use buttons::{Buttons, ButtonsPoll}; use flash::{storage_slot::StorageSlot, Flash}; use radio::Radio; use rtc::RTC; use systick::{SysTick, SysTickHardware}; use timer::Timer; u...
//! A simple 32 band audio equalizer //! //! Usage: //! //! ```rust //! use simple_eq::Equalizer; //! use simple_eq::design::Curve; //! //! fn main() { //! // create an input signal, in our case a unit impulse. //! let mut h = vec![0.0; 128]; //! h[0] = 1.0; //! //! // create the equalizer instance...
use crate::{ common::{Conditionals, Projection, StandardQueryParameters}, error::Error, response::ApiResponse, types::ObjectIdentifier, }; use std::convert::TryFrom; #[derive(Default, Serialize)] #[serde(rename_all = "camelCase")] pub struct RewriteObjectOptional<'a> { #[serde(flatten)] pub sta...
pub mod callable; pub mod result; pub mod scope; use std::{collections::HashMap, convert::identity, fmt::Display, sync::{Arc, RwLock}}; use callable::Callable; use sexpr_ir::gast::{symbol::Symbol, Handle}; #[derive(Debug, Clone, PartialEq)] pub enum Value { Nil, Bool(bool), Char(char), Uint(u64), ...
// use crate::Interpolator; use std::ops::{Index, IndexMut}; use crate::{Context, Entity, Tree}; /// A 2D transform matrix. #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] pub struct Transform2D(pub [f32; 6]); impl Transform2D { pub fn new(a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) -> Self { S...
use emd_c::{SignatureT, DistFeaturesT, emd_call}; pub fn emd(doc_bow1: &[f32], doc_bow2: &[f32], distance_matrix: &[f32]) -> f32 { let (features1, weights1) = bow_to_features_weights(doc_bow1); let (features2, weights2) = bow_to_features_weights(doc_bow2); unsafe { emd_call( &mut Signa...
use crate::operations::instruction::Instruction; use crate::cpu::{cpu::CPU, cpu::THUMB_PC}; use crate::memory::memory_bus::MemoryBus; use std::fmt; pub struct MultipleLoadStore { pub opcode: u8, pub rb: u8, pub register_list: Vec<u8>, pub load: bool } impl From<u16> for MultipleLoadStore { fn fro...
//! Serves an HTTP/1.1. admin server. //! //! * `/metrics` -- reports prometheus-formatted metrics. //! * `/ready` -- returns 200 when the proxy is ready to participate in meshed traffic. use crate::{ svc, trace, transport::{io, tls}, }; use futures::{future, TryFutureExt}; use http::StatusCode; use hyper::{Bo...
use std::collections::{HashMap, HashSet}; use crate::support::*; const EXAMPLE_1: &str = "class: 1-3 or 5-7\nrow: 6-11 or 33-44\nseat: 13-40 or 45-50\n\nyour ticket:\n7,1,14\n\nnearby tickets:\n7,3,47\n40,4,50\n55,2,20\n38,6,12"; const INPUT: &str = include_str!("input.txt"); #[derive(Debug)] struct Class { name:...
use std::collections::HashSet; use std::str::FromStr; use itertools::Itertools; use lazy_static::*; use crate::util::Vector3D; #[derive(Debug, Clone)] pub struct Report { scanner_id: u8, beacons: Vec<Vector3D>, } impl FromStr for Report { type Err = (); fn from_str(s: &str) -> Result<Self, Self::Er...
use super::{normalization, NormalizationMethod, ResidualsValues}; use std::fmt; /// Single residual configuration /// /// A residual is constituded of two elements: /// - the way of computing the `stopping_critera` from the left and right part of a residual /// - the way of computing the error for the update (`update_...
use std::env; use bevy::prelude::*; use bevy::render::camera::PerspectiveProjection; mod asteroids; use crate::asteroids::*; mod audio; use crate::audio::*; mod bullets; mod collision; mod cooldown; use crate::collision::*; mod debug; mod enemies; use crate::enemies::*; mod gravity; use crate::gravity::*; mod input; ...
use serde_json; use crate::config::Config; use crate::gist_file::GistFile; use anyhow::Result; use response::Response; use std::collections::BTreeMap; use std::env; use ureq; const GIST_API: &'static str = "https://api.github.com"; const GITHUB_TOKEN: &'static str = "GITHUB_TOKEN"; const GITHUB_GIST_TOKEN: &'static s...
use crate::ecs::{ Entity, Read, ReadExpect, ReadStorage, System, SystemData, WorldExt, WriteStorage, }; use crate::prelude::{Builder, GameData, SimpleState, SimpleTrans, StateData, StateEvent, Trans}; use crate::Error; /// Used to store our scenes use amethyst_assets::{ AssetStorage, //AssetLoaderSystemData...
use reqwest::header::{HeaderMap, HeaderValue, COOKIE}; use std::io::{BufRead, Write}; use itertools::Itertools; pub use crate::parser::AtCoderParser; pub struct AtCoder { client: reqwest::Client, //for request cookie_headers: HeaderMap, //from response html: Option<String>, } impl AtCoder { p...
#![doc(html_root_url = "https://docs.rs/phonetic/")] //! # Phonetic //! Phonetic is a crate with two functions, **nato_spell** and **morse** //! where, given an input string, they return either the NATO spelling or //! morse code equivalent for the input. //! /// ASCII value for 'a' const LCASE_A: usize = 97; ///...
use std::collections::HashSet; fn input_data() -> Vec<&'static str> { // Replace these height map values with a different set of numbers vec![ "2199943210", "3987894921", "9856789892", "8767896789", "9899965678", ] } fn parse_input(input: Vec<&str>) -> Vec<Vec<i32>>...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ //! Provides functions for calculating Sigv4 signing keys, signatures, and //! optional utilities for signing HTTP requests and Event Stream messages. #![warn( missing_docs, missing_crate_level...
use crate::NodeId; use bytes::Bytes; use std::{collections::HashMap, fmt, ops::Index}; #[derive(Default, Clone, Debug, Eq, PartialEq)] /// Opaque, applicaiton specific metadata for nodes in the system pub struct NodeMetadata(pub Bytes); impl From<Bytes> for NodeMetadata { fn from(v: Bytes) -> NodeMetadata { ...
use std::{ collections::HashMap, io::{self, Write}, fmt::Write as FmtWrite, }; use failure::Fail; use xml::writer::{self, EventWriter, EmitterConfig}; use rbx_dom_weak::{RbxTree, RbxValue, RbxId}; use crate::{ reflection::CANONICAL_TO_XML_NAME, types::{write_value_xml, write_ref}, }; pub use xml:...
//! Representation of the block in the mockchain. use crate::key::{make_signature, make_signature_update, Hash}; use crate::leadership::{bft, genesis::GenesisPraosLeader, Leader}; use chain_core::property::{self, Header as _, Serialize}; use chain_crypto::Verification; mod builder; //mod cstruct; mod header; pub mod m...
use crate::config::Tls; use crate::file_manager::FileManager; use crate::log::{log_request, log_response}; use crate::request::Request; use crate::response::Response; use rustls::{Certificate, PrivateKey}; use rustls::{ServerConfig, ServerConnection, Stream as TlsStream}; use rustls_pemfile::Item::{PKCS8Key, RSAKey}; u...
use super::clientworker::{ClientWorker, Connection}; use crate::{ cfg::NOISE_PATTERN, config::MqttServerConfig, error::ServerError, packetinfo::PacketInfo, }; use apiformes_packet::prelude::*; use bytes::{Buf, Bytes, BytesMut}; use snow::{HandshakeState, TransportState}; use std::{fmt, net::SocketAddr, sync::Arc}; ...
use windows::Win32::System::Com::*; struct Application { back_buffer: Vec<mltg::d2d::RenderTarget>, context: mltg::Context<mltg::Direct2D>, factory: mltg::Factory, white_brush: mltg::Brush, grad: mltg::GradientStopCollection, text: mltg::TextLayout, text2: mltg::TextLayout, stroke_style...
use crate::game; use crate::sound; pub const GAME_TITLE: &str = "Tetris Bane"; const LABEL_LENGTH: usize = 22; pub enum Item { Play { label: String }, Mode { label: String }, Quit { label: String }, Resume { label: String }, EndGame { label: String }, Music { label: String }, MusicVolume ...
use std::collections::VecDeque; use std::mem; use std::path::Path; use btmgmt::packet::{IdentityResolvingKey, LongTermKey}; use tokio::fs::{File, OpenOptions}; use tokio::io::{self, AsyncSeekExt, AsyncWriteExt, BufStream, SeekFrom}; use crate::serde::Wrapper; #[derive(Debug, serde::Serialize, serde::Deserialize)] pu...
use std::cmp::Ordering; use std::collections::VecDeque; use std::convert::TryFrom; use std::io; use std::iter::Iterator; use std::path::Path; use std::path::PathBuf; use crate::io::utf8_percent_encode_path; /// Compares paths, so that: /// - paths with a smaller number of components are smaller /// - paths with ...
///! Packet definitions. use bytes::{BufMut, Bytes, BytesMut}; use num_derive::FromPrimitive; use std::convert::From; use std::io; use std::str; use crate::error::Result; use crate::parse::*; pub(crate) const PACKET_DATA_HEADER_LEN: usize = 4; #[derive(Debug, Clone, Copy, PartialEq, FromPrimitive)] #[repr(u16)] pub(...
use chrono::{Datelike, FixedOffset, NaiveDate, TimeZone, Utc}; use html2text::from_read; use regex::Regex; use reqwest::blocking::Client; use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE, COOKIE}; use reqwest::redirect::Policy; use std::fs::OpenOptions; use std::io::Write; pub type PuzzleYear = i32; pub type...
use crusty_chip::{decode, VirtualMachine, DISPLAY_HEIGHT, DISPLAY_WIDTH}; use getopts::Options; use sfml::graphics::{RenderTarget, RenderWindow, Sprite, Texture, Transformable}; use sfml::system::Clock; use sfml::window::{ContextSettings, Event, Key, Style, VideoMode}; use std::fs::File; use std::io::Read; fn sfml_key...
extern crate byteorder; extern crate quick_protobuf; extern crate ureq; pub mod message; use message::{SubMessage, ChannelRowMessage}; use byteorder::{WriteBytesExt, LittleEndian}; use quick_protobuf::{deserialize_from_slice, serialize_into_vec}; use std::collections::HashMap; use std::io::{Read, Write}; use std::net...
use std::sync::mpsc; use std::thread; use intcode::{Computer, Io, ValueType}; struct ChainedIo { input: mpsc::Receiver<ValueType>, outputs: Vec<mpsc::Sender<ValueType>>, } impl ChainedIo { fn new() -> (Self, mpsc::Sender<ValueType>) { let (sender, input) = mpsc::channel(); ( ...
use super::cmds::character::*; use super::cmds::clipboard::*; use super::cmds::control::*; use super::cmds::insert::*; use super::cmds::kill::*; use super::cmds::line::*; use super::cmds::navigation::*; use super::cmds::region::*; use super::cmds::search::*; use super::cmds::word::*; use std::cmp; use std::collections:...
//! Implementations of built-in global functions that are always available. use super::modules; use super::prelude::*; use super::scope::Scope; pub fn get() -> Table { table! { "require" => Value::ForeignFn(modules::require.into()), "backtrace" => Value::ForeignFn(backtrace.into()), "call"...
//! **Provides undo-redo functionality with static dispatch.** //! //! It is an implementation of the command pattern, where all modifications are done //! by creating objects of commands that applies the modifications. All commands knows //! how to undo the changes it applies, and by using the provided data structures...
use crate::cfg; use crate::cmtp::{Ai, PlayerAction, PlayerState, Symbol}; use crate::engine; use crate::engine::game; use rand::Rng as _; pub fn update(world: &mut game::World) { if world.player.state != PlayerState::MakingTurn { return; } // let monsters take their turn if world.player_is_aliv...
use std::fmt::{Debug, Formatter, Result as FmtResult}; use std::future::Future; use std::pin::Pin; use std::task::{Poll, Waker}; use deck_core::{Manifest, ManifestId}; use futures_preview::future::{self, FutureExt, TryFutureExt}; use futures_preview::sink::SinkExt; use futures_preview::stream::{self, Stream, StreamExt...
use std::collections::{HashMap, HashSet}; use super::FactionId; use engine::components::Color; use scaii_defs::protos::{Action, State, Viz}; use specs::prelude::*; pub mod collision; mod unit_type; pub use self::{collision::*, unit_type::*}; pub use engine::systems::lua::userdata::DataStore; // Recommended by nco...
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license OR Apache 2.0 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum NextExpected { LengthSpecifier, Content { length: usize }, } #[derive(thiserror::Error, Debug)] pub enum ReadError { #[error("Frame length exceeded expectation of {...
//! The actual VFS structures #[cfg(test)] mod test; use std::collections::HashMap; use std::convert::TryFrom; use std::path::{Component, Path, PathBuf, Prefix}; use toc_span::FileId; use crate::{ intern::{PathInterner, PathResolution}, BuiltinPrefix, }; // TODO: Unify path slashes to the platform preferre...
use std::collections::HashMap; use std::fmt; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::time::Instant; use tokio::sync::{mpsc::unbounded_channel, Semaphore}; use super::file_manager::{Download, FileCache, FileManager}; use super::{CacheStats, DownloadStat}; use super::{Downl...
use std::fmt; use std::usize; static OFFSETS: [(i32, i32); 8] = [ (-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1), ]; #[derive(Debug, Clone)] enum Cell { Floor, EmptySeat, OccupiedSeat, } impl Cell { fn from_char(c: &char) -> Cell { match c...
use std::slice::Iter; use std::iter::FromIterator; use geometry::{BBox, PartialBoundingBox}; use raytracer::Ray; use vec3::Vec3; // pub struct Octree<T> where T: PartialBoundingBox { prims: Vec<T>, infinites: Vec<T>, // for infinite prims (planes) root: OctreeNode, } impl<T> FromIterator<T> for Octree<T>...
use crate::{ canister_http::{ CanisterHttpReject, CanisterHttpRequestId, CanisterHttpResponse, CanisterHttpResponseContent, CanisterHttpResponseMetadata, CanisterHttpResponseWithConsensus, }, crypto::{CombinedMultiSig, CombinedMultiSigOf, CryptoHash, CryptoHashOf, Signed}, signat...
use icarus::color; use icarus::input::{InputState, KeyId}; use icarus::math::{Rect, Vec2}; use icarus::platform::{Config, Platform}; use icarus::vk_util::{self, RenderCommand, VkContext}; use std::mem; use std::time::Instant; const WIDTH: f32 = 1600.0; const HEIGHT: f32 = 900.0; const MAX_ENTITIES: usize = 1000; con...
use std::collections::HashMap; use std::sync::Arc; use mc_packet_protocol::packet::{PacketReadWriteLocker, ResolvedPacket}; use crate::authenticated_client::PlayerInfo; use crate::config::Server; use anyhow::Context; use flume::Sender; use futures_lite::FutureExt; use mc_packet_protocol::protocol_version::{MCProtocol...
//! User-facing slide diagnostics. //! //! The diagnostics module translates [libslide diagnostics](libslide::diagnostics) into a form //! pleasant for standard output. use libslide::diagnostics::{AssociatedDiagnostic, Autofix, Diagnostic, DiagnosticKind, Edit}; use annotate_snippets::{ display_list::{DisplayList...
use core::arch::wasm32::*; macro_rules! const_u32x4 { ($ux4:expr) => { unsafe { $crate::cast::UVec4Cast { ux4: $ux4 }.v128 } }; } const PS_NEGATIVE_ZERO: v128 = const_u32x4!([0x8000_0000; 4]); const PS_PI: v128 = const_f32x4!([core::f32::consts::PI; 4]); const PS_HALF_PI: v128 = const_f32x4!([core::f3...
/** * Author: <NAME> * Description: An introduction to the Rust datatypes and variables */ //In rust the struct concept is pretty much the same of the other languages... //@! Define rectangle struct struct Rectangle { width: u32, height: u32, } //But in Rust they can have methods //@! Implementing struct ...
use std::f32; use std::time::{Duration, Instant}; use pyo3::prelude::*; use stats; use itertools::{Itertools, Either}; use rayon::prelude::*; use crate::cost_funcs; pub type Group = Vec<Sample>; pub type Groups = Vec<Group>; pub type Number = f32; // Splits a dataset into two groups, given a feature and the value ...
#![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] #![allow(clippy::string_lit_as_bytes)] use frame_system::ensure_signed; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, StorageMap, StorageValue, ensure, Parameter, traits::{Time, Get}, dispatch::Vec, }; use sp_runtime::{...
use std::fs::File; use std::io::{prelude::*, BufReader}; use std::{env, fs, io}; use std::error::Error; //An Intcode program is a list of integers separated by commas (like 1,0,0,3,99). // To run one, start by looking at the first integer (called position 0). // Here, you will find an opcode - either 1, 2, or 99. The...
use std::{env, fs, path::Path}; #[derive(Debug, Clone)] struct Heatmap(Vec<Vec<(u8, bool)>>); fn main() { let args: Vec<String> = env::args().collect(); let file = args.get(1).expect("Missing file parameter"); if !Path::new(file).exists() { panic!("No such file {}", file); } let data = fs...
// Copyright 2021 <NAME> <<EMAIL>> // // 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 t...
//! A system test: //! (i) Sets up test configuration, //! (ii) interacts with the Internet Computer under test //! (iii) makes assertions about the test results. //! //! The SystemTest encodes the test configuration (including the initial network //! topology, i.e. number of subnetworks and nodes). When the test...
use rand::{RngCore, SeedableRng}; use size::Size; use std::env; use std::fs::OpenOptions; use std::io::{Read, Seek, SeekFrom, Write}; use std::path::Path; use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::time::{Duration, Instant}; const ENOSPC: i32 = 28; fn main() { let arg...
use crate::attribute_info::Attribute::SourceFile; use crate::attribute_info::{read_attributes, Attribute, AttributeInfo}; use crate::class_reader::ClassReader; use crate::constant_pool::ConstantPool; use crate::member_info::MemberInfo; use crate::source_file_attribute::SourceFileAttribute; use std::cell::RefCell; use s...
use crate::formatter::HtmlFormatter; use crate::parser::Haml; #[derive(Debug)] pub struct Arena { items: Vec<ArenaItem>, } #[derive(Debug)] pub struct ArenaItem { pub value: Haml, pub parent: usize, pub children: Vec<usize>, } impl ArenaItem { pub fn new(value: Haml, parent: usize) -> ArenaItem {...
// Copyright (c) 2020 kprotty // // 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 wri...
use anyhow::Context; use display_error_chain::DisplayErrorChain; use log::LevelFilter; use nix::unistd::{getuid, setegid, seteuid, Gid, Uid}; use structopt::StructOpt; use usbctl::actions::{Action, Filter}; /// USB devices management. #[derive(StructOpt)] struct Options { /// Suppress a warning when running as roo...
use std::sync::{Arc, Weak}; use crossbeam_queue::SegQueue; use druid::{ widget::{prelude::*, Controller}, Command, ExtEventSink, Handled, Selector, }; use crate::{ app::{ body::{RequestState, TabState}, command, }, grpc, json::JsonText, }; type UpdateQueue = SegQueue<Box<dyn F...
use std::env; use std::fs; use std::path::Path; include!("src/board/display_board_placement_info.rs"); fn get_pieces() -> Vec<Vec<(i8, i8)>> { // They all have (0, 0), (1, 0), (2, 0) let yellow_a: Vec<(i8, i8)> = vec![(0, 1), (3, 0)]; let yellow_b: Vec<(i8, i8)> = vec![(0, 1), (1, 1), (3, 0)]; let ora...
use std::collections::HashMap; use std::fmt::Display; use std::ops::Add; use std::rc::Rc; use cssparser::{Parser, ParserInput, RuleListParser, SourceLocation}; use selectors::context::QuirksMode; use super::css_rule::{CssRule, CssRuleType}; use super::origin::Origin; use super::rule_parser::{State, TopLevelRuleParser...
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] use eframe::{ egui::{ self, emath::RectTransform, epaint::Mesh, pos2, vec2, Color32, Pos2, Rect, Sense, Shape, Ui, }, epi, Frame, }; use test_egui::frame_history::FrameHistory; fn main() { let native_options = eframe::NativeOpt...
use log::*; use nanomsg::endpoint::Endpoint; use nanomsg::result::Error as NanoError; use nanomsg::{Protocol, Socket as NanoSocket}; use futures::{Async, AsyncSink, Poll, Sink, StartSend, Stream}; use std::fmt::{Debug, Formatter, Result as FmtResult}; use std::ops::{Deref, DerefMut}; use tokio_core::reactor::Handle;...
#![feature(unwind_attributes, used)] #![allow(unused)] extern crate crossbeam; extern crate ecap; extern crate ecap_common_link; extern crate ecap_sys as ffi; extern crate erased_ecap; extern crate libc; #[macro_use] extern crate lazy_static; macro_rules! foreign_ref { (pub struct $name:ident($cname:path)) => { ...
//! Low level functionality for writing DWARF debugging information. use std::error; use std::fmt; use std::ops::DerefMut; use std::result; mod endian_vec; pub use self::endian_vec::*; mod writer; pub use self::writer::*; mod abbrev; pub use self::abbrev::*; mod line; pub use self::line::*; mod str; pub use self:...
//! PEM encoder. use crate::{ grammar::{self, CHAR_CR, CHAR_LF}, Error, Result, BASE64_WRAP_WIDTH, ENCAPSULATION_BOUNDARY_DELIMITER, POST_ENCAPSULATION_BOUNDARY, PRE_ENCAPSULATION_BOUNDARY, }; use base64ct::{Base64, Encoding}; #[cfg(feature = "alloc")] use alloc::string::String; /// Encode a PEM document...
extern crate cfg_if; extern crate wasm_bindgen; mod utils; use cfg_if::cfg_if; use js_sys::Promise; use serde_json::value::Value; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; use roctogen::api::{self, apps, repos, issues}; use roctogen::auth::Auth; use roctogen::models;...
// mod interface; use crate::interface::DisplayInterface; // use interface::DisplayInterface; /// SSD1362 Commands /// Based on the command table from the OEL9M1020-O-E datasheet /// /// Commands #[derive(Debug)] #[allow(dead_code)] pub enum Command { /// Setup column start and end address /// values range ...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use super::{Assertion, ConstraintDivisor}; use crypto::RandomElementGenerator; use math::{ fft, field::{FieldElement, StarkField},...
#![unstable(issue = "0", feature = "windows_handle")] use crate::cmp; use crate::io::{self, ErrorKind, Read, IoVec, IoVecMut}; use crate::mem; use crate::ops::Deref; use crate::ptr; use crate::sys::c; use crate::sys::cvt; /// An owned container for `HANDLE` object, closing them on Drop. /// /// All methods are inheri...
/* Copyright The containerd Authors. 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...
use std::fs::File; use std::io::ErrorKind; use std::io::prelude::*; use std::io::SeekFrom; // GLOBALS pub const NUM_PAGES: u32 = 256; pub const NUM_FRAMES: u32 = 128; pub const PAGE_SIZE: u32 = 256; pub struct PageTableInfo { page_table: [i32; NUM_PAGES as usize], // -1 means page not in memory access_time: [...
//! Contains Zip-specific building and unpacking functions use std::{ env, io::{self, prelude::*}, path::{Path, PathBuf}, }; use fs_err as fs; use walkdir::WalkDir; use zip::{self, read::ZipFile, ZipArchive}; use crate::{ error::FinalError, info, list::FileInArchive, utils::{ cd_i...
use crate::{ commands::TEMPLATES, util::{ create_from_template, last_segment_in_path, print_failure, print_running, print_success, }, }; use atty::Stream; use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; use colored::Colorize; use regex::Regex; use serde_json::{json, Value}; use std::{ ...
// Copyright 2018 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::client::QmiClient, crate::errors::QmuxError, crate::transport::QmiTransport, failure::Error, fidl::endpoints::{ClientEnd, ...
//! Types to apply filter to input types use crate::{ artifacts::{output_selection::OutputSelection, Settings}, Source, Sources, }; use std::{ collections::BTreeMap, fmt, fmt::Formatter, path::{Path, PathBuf}, }; /// A predicate property that determines whether a file satisfies a certain condi...
use alloc::{sync::Arc, vec::Vec}; use rcore_fs::vfs::*; use rcore_fs_devfs::{special::*, DevFS}; use rcore_fs_mountfs::MountFS; use rcore_fs_ramfs::RamFS; pub use self::device::*; pub use self::file::*; pub use self::pseudo::*; pub use self::random::*; pub use self::stdio::*; pub use rcore_fs::vfs; use crate::error:...
//! This module provides the `SpellingBeeGame` struct, which stores previously-entered words, checks //! words for validity, and scores them appropriately. use std::collections::BTreeSet; use lexi::{Lexicon, VecLexicon, wordlist}; use wasm_bindgen::prelude::*; use crate::utils::set_panic_hook; use web_sys; // A macr...
// The Computer Language Benchmarks Game // https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ // // Contributed by <NAME>, translated from <NAME>'s C program. // // The C program was based on the Ada program by <NAME> and Georg // Bauhaus which in turn was based on code by <NAME>, <NAME>, // <NAME>, <NAME>, ...
use bellperson::{ bls::{Bls12, Fr}, gadgets::num::AllocatedNum, Circuit, ConstraintSystem, SynthesisError, }; use ff::Field; use filecoin_hashers::{HashFunction, Hasher}; use rayon::prelude::*; use rayon::prelude::{ParallelIterator, ParallelSlice}; use storage_proofs_core::{ compound_proof::CircuitCompo...