text
stringlengths
3.09k
13.9k
use actix_service::Service; use actix_web::{ get, middleware::Logger, web::{self}, App, HttpResponse, HttpServer, Responder, }; use env_logger::Env; use rand::Rng; use serde_json::json; use std::{env, sync::Arc, time::Duration}; use std::{thread, time}; use handlebars::{Handlebars, JsonValue}; use act...
use std::env; use std::fs::File; use std::sync::Arc; use async_trait::async_trait; use libcli_rs::progress::ProgressBar; use libcli_rs::progress::ProgressTrait; use log::{debug, info}; use rayon::prelude::*; use regex::Regex; use simpledi_rs::di::{DIContainer, DIContainerExtTrait, DependencyInjectTrait}; use huber_co...
//---------------------------------------------------------------------------// // Copyright (c) 2017-2020 <NAME>. All rights reserved. // // This file is part of the Rusted PackFile Manager (RPFM) project, // which can be found here: https://github.com/Frodo45127/rpfm. // // This file is licensed under the MIT license...
use egui::NumExt; use itertools::Itertools; use std::hash::Hash; use strum::IntoEnumIterator; const EXPLANATION_TOOLTIP_WIDTH: f32 = 200.0; pub(super) struct BasicComboBox<'a, T> { combo_box: egui::ComboBox, selected: &'a mut T, options: Vec<T>, } impl<'a, T: IntoEnumIterator> BasicComboBox<'a, T> { p...
use crate::{graph::*, ram, wire, Bus, Wire, WordInput}; fn mkname(name: String) -> String { format!("IOBUF:{}", name) } /// Data structure used to represent a piece of [RAM](https://en.wikipedia.org/wiki/Random-access_memory) /// that can be easily read and written to from Rust. /// /// It is a naive implementatio...
use xcb; use std::cmp::max; /// Tracks the start of a mouse drag struct DragStart { /// x coordinate of button press that started the drag root_x: i16, /// y coordinate of button press that started the drag root_y: i16, /// child window that's the target of the drag child: xcb::Window, /// ...
// Copyright 2018 Google 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...
// Copyright (c) Microsoft. All rights reserved. //! This subcommand takes the super-config file, converts it into the individual services' config files, //! writes those files, and restarts the services. //! //! Note: //! //! Inline provisioning symmetric keys are saved to `/var/secrets/aziot/keyd/device-id` in order...
use std::collections::BTreeSet; use std::io; use std::io::BufRead; struct SpookyMap { map: Vec<u8>, width: usize, height: usize, } const PUMPKIN: u8 = 120; const CAULDRON: u8 = 111; const ROCK: u8 = 35; const BLANK: u8 = 46; impl SpookyMap { fn unambiguously_fill_in_map(&mut self) -> &SpookyMap { ...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ release_flow::{ get_commit_hash, hash_for_modules, load_latest_artifact, save_release_artifact, verify::verify_payload_change, ReleaseArtifact, }, writeset_builder::build_changeset, }; use anyhow:...
use std::sync::RwLock; use std::time::{Duration, SystemTime}; use serde::{Deserialize, Serialize}; use serde_xml_rs::from_str; use log::trace; #[derive(Debug)] pub struct NginxMonitor { endpoint: String, last_result: RwLock<Option<(SystemTime, NginxStat)>>, } impl NginxMonitor { pub fn new(endpoint: &st...
//! Update and reboot strategies. use crate::config::inputs; use crate::identity::Identity; use anyhow::Result; use fn_error_context::context; use futures::prelude::*; use log::error; use prometheus::{IntCounterVec, IntGauge, IntGaugeVec}; use serde::Serialize; mod fleet_lock; pub(crate) use fleet_lock::StrategyFleet...
// Let's begin with a review of ordinary, classical state. struct OrdinaryVariable<T: Clone> { // A variable stores a value and keeps it over time. value: T, } // Okay... impl<T: Clone> OrdinaryVariable<T> { // You can allocate a new variable to hold things... fn new(initial_value: T) -> OrdinaryVariable<T> { ...
use crate::{ types::top_block_descr::{TopBlockDescrStuff, TopBlockDescrId}, engine_traits::EngineOperations, shard_state::ShardStateStuff, }; use ton_block::{BlockIdExt, TopBlockDescr, Deserializable, BlockSignatures}; use ton_types::{fail, Result, deserialize_tree_of_cells}; use std::{ io::Cursor, ...
use std::io::Read; use std::{fs, io}; use anyhow::{anyhow, Context, Result}; use oauth2::basic::{BasicClient, BasicTokenResponse}; use oauth2::reqwest::http_client; use oauth2::{ AccessToken, AuthUrl, ClientId, ResourceOwnerPassword, ResourceOwnerUsername, TokenResponse, TokenUrl, }; use reqwest::blocking::Res...
/// The CESU-8 module handle the __Compatibility Encoding Scheme for /// UTF-16: 8-Bit__. use crate::unicode_encoding::UnicodeEncodingError::*; use crate::unicode_encoding::UnicodeEncodingError; use crate::unicode_encoding::UnicodeEncoding; use crate::utf_32::Utf32; use crate::utf_16::*; use crate::utf_8::Utf8; /// A...
//! This crate provides high-level bindings for the [ENet](http://enet.bespin.org/) networking library. //! //! ENet provides features that are most typically used by games, such as //! unreliable but sequenced data transfer over UDP. ENet also provides optional //! reliability, and provides multiple channels over a si...
// EndBASIC // Copyright 2021 <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 agre...
use std::{error, fmt}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_json::Value; /// JSON-RPC Error Code. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum ErrorCode { /// Invalid JSON was received by the server. /// An error occurred on the server while parsing the JSON text. ...
///! Enum-based static dispatch for `MetaObject` use crate::language::{IntType, FloatType}; use crate::runtime::Variant; use crate::runtime::gc::Gc; use crate::runtime::function::{Call, Function, NativeFunction}; use crate::runtime::strings::StringValue; use crate::runtime::iter::IterState; use crate::runtime::types::...
use clap::*; arg_enum! { #[derive(PartialEq, Debug)] pub enum BuildTarget { Win, Linux, Wasm32, } } arg_enum! { #[derive(PartialEq, Debug)] pub enum OptimisationType { Debug, ReleaseFast, ReleaseSafe, ReleaseSmall, } } ...
// 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, ...
use std::cell::{Cell, Ref, RefCell, RefMut}; use std::collections::VecDeque; use std::fmt; use std::net::SocketAddr; use std::rc::Rc; use http::{header, HeaderMap, Method, Uri, Version}; use extensions::Extensions; use httpmessage::HttpMessage; use info::ConnectionInfo; use payload::Payload; use server::ServerSetting...
#[macro_use] extern crate log; use std::fs::File; use actix_web::body::{Body, ResponseBody}; use actix_web::http::header::ContentType; use actix_web::middleware::errhandlers::{ErrorHandlerResponse, ErrorHandlers}; use actix_web::web::Bytes; use actix_web::{delete, dev, get, http, post, HttpRequest, HttpResponse, Resp...
//! Constants, error types, and functions for validating [`Message`] fields. //! //! [`Message`]: twilight_model::channel::Message use crate::{ component::{ComponentValidationErrorType, COMPONENT_COUNT}, embed::EmbedValidationErrorType, }; use std::{ error::Error, fmt::{Display, Formatter, Result as Fm...
// Copyright 2022 <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 i...
/// Native Rust implementation of scrypt. pub use self::native::Scrypt; /// Native Rust implementation of scrypt. mod native { use primitives::Primitive; use serde_mcf::Hashes; use sod::Sod; use std::fmt; /// Struct holding `scrypt` parameters. /// /// This implementation is backed by `ri...
// Copyright 2022, The Tremor Team // // 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...
use std::collections::{HashMap, VecDeque}; // 5885. Minimum Number of Moves to Seat Everyone, Easy // https://leetcode.com/problems/minimum-number-of-moves-to-seat-everyone/ impl Solution1 { pub fn min_moves_to_seat(mut seats: Vec<i32>, mut students: Vec<i32>) -> i32 { seats.sort_unstable(); studen...
mod allocator; mod cli; mod config; mod error; mod init; mod registry; mod registry_store; use crate::cli::{Cli, Config as ConfigSubcommand, InitShell}; use crate::config::Config; use crate::error::ApplicationError; use crate::init::init_fish; use crate::registry::PortRegistry; use crate::registry_store::RegistryFileS...
// Copyright 2021 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 fuchsia_criterion::{ criterion::{self, Criterion}, FuchsiaCriterion, }; use archivist_lib::logs::buffer::{ArcList, LazyItem}; use fidl_fuchsia...
/* This is a ELF prepender written in Rust by TMZ (2019). I like writting prependers on languages that I'm learning and find interesting. Linux.Fe2O3 (September 2019) - Simple binary infector written in Rust. This version encrypts the host code with a simple XOR and decrypts it at runtime. It's almost a direct po...
use seed::{prelude::*, *}; use rand::prelude::*; use std::iter; static ADJECTIVES: &[&'static str] = &[ "pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", ...
use super::DescriptorSetAllocator; use crossbeam_channel::{Receiver, Sender}; use rafx_api::{RafxDeviceContext, RafxResult}; use std::collections::VecDeque; use std::ops::{Deref, DerefMut}; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{Arc, Mutex}; // This holds the allocator and the frame on which it ...
//! The address type and decode/encode functions. use std::fmt; use std::str::FromStr; use base58::{FromBase58, ToBase58}; use digest::Digest; use hex::FromHex; use sha2::Sha256; use sha3::Keccak256; use std::convert::TryFrom; use crate::error::Error; use crate::private::Private; use crate::public::Public; /// The m...
use super::limit_stream::LimitStream; use super::HttpStore; use bytes::BytesMut; use futures::{ future::{err, Either}, Future, Stream, }; use hyper::{ body::Body, header::AUTHORIZATION, service::Service as HttpService, Error, Request, Response, }; use interledger_packet::{Fulfill, Prepare, Reject}; use inte...
use std::slice::Iter; use std::str::FromStr; static INPUT: &str = include_str!("input"); fn main() -> Result<(), String> { let waiting_area = INPUT.parse::<WaitingArea>()?; let end_state_1 = common::time_execution("Part 1", || { find_end_state(&waiting_area, 4, |current_state, x, y, direction| { ...
// Copyright 2016 <NAME>, <NAME> and <NAME>. // See the README.md file at the top-level directory of this // distribution. // // Licensed under the MIT license <LICENSE or // http://opensource.org/licenses/MIT>, at your option. // This file may not be copied, modified, or distributed // except according to those terms....
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use super::{Message, UnsignedMessage}; use address::Address; use crypto::{Error as CryptoError, Signature, SignatureType, Signer}; use encoding::tuple::*; use encoding::{to_vec, Cbor, Error}; use vm::{MethodNum, Serialized, TokenAmount}; ...
// TODO List // * Do better text layout and more easily track metrics? (helpful for hit-testing) // * Text selections // * Support mouse up/down/move in editor/buffer // * Add layout functionality mod rectangle_brush; use rectangle_brush::*; mod camera2d; use camera2d::*; use winit::{ dpi::PhysicalPosition, ...
//! Web applications commonly need a way of authenticating users. This crate provides an easy and secure way to do this, integrating with Humphrey using the `AuthApp` trait and allowing complete control over the database users are stored in. Humphrey Auth does not come with a database, but the `AuthDatabase` trait is i...
// MIT/Apache2 License use super::{ Connection, Display, DisplayBase, PendingReply, PendingRequest, PendingRequestFlags, RequestWorkaround, }; use crate::{event::Event, log_debug, log_trace, Fd}; use alloc::{vec, vec::Vec}; use core::iter; use tinyvec::TinyVec; const TYPE_ERROR: u8 = 0; const TYPE_REPLY: u8 =...
use crate::event::*; use crate::node::{Node, NodeInfo}; use crate::protos::message::{EcNack_, EcNewEpoch_, Message, Message_Type}; use log::trace; use std::sync::Arc; use uuid::Uuid; const N: u32 = 10; const ABSTRACTION_ID: &str = "ec"; /// The epoch-change algorithmis quite simple. Every process p maintains two time...
use ash::vk; use crate::renderer::RenderContext; use dust_core::CameraProjection; use dust_core::SunLight; use glam::{Mat3, TransformRT, Vec3}; use std::mem::size_of; use std::sync::Arc; use vk_mem as vma; struct StagingState { buffer: vk::Buffer, allocation: vma::Allocation, allocation_info: vma::Allocat...
use crate::args::RemoteSend; use crate::place::here; use crate::place::Place; use crate::network; use crate::network::CollectiveOperator; use crate::serialization::deserialize_from; use crate::serialization::serialize_into; use futures::future::BoxFuture; use futures::future::FutureExt; use futures::Future; use parking...
//! Extended dimension support use std::fmt; use std::ops; mod tree; pub use self::tree::TDim; use crate::{TractError, TractResult}; /// A super-trait for value acting as tensor dimensions in tract. /// /// Implemented by: /// /// * `usize` for regular dimensions /// * `TDim` supporting regular and streaming dimensi...
use std::collections::HashMap; use std::marker::PhantomData; use std::time::Duration; use tokio::net::TcpStream; //dmr use tokio::net::tcp::WriteHalf; use tokio::io::{AsyncRead, WriteHalf}; //dmr use tokio::sync::oneshot; //dmr use tokio_util::codec::FramedRead; use tokio::codec::FramedRead; //dmr use actix::prelude...
#![forbid(unsafe_code)] use std::collections::BTreeMap; use std::convert::TryFrom; pub use yaml_rust; use yaml_rust::Yaml; mod error; mod types; mod utils; use types::*; use error::{add_path_name, optional}; pub use error::{SchemaError, SchemaErrorKind}; use utils::YamlUtils; /// Validation trait implemented by al...
use super::*; use crate::errors; use http::{Request, StatusCode, Uri}; use hyper::Body; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; pub struct GitHubService {} impl Default for GitHubService { fn default() -> Self { Self {} } } #[async_trait] impl<C: Core> OnlineService<C> f...
//! This crate provides a `no_std` version of std's [`is_x86_feature_detected!`] //! macro. //! //! This is possible because x86 chips can just use the `cpuid` instruction to //! detect CPU features, whereas most other architectures require either reading //! files or querying the OS. //! //! # Usage //! //! ``` //! # ...
use actix_files as fs; use actix_web::{web,HttpRequest,HttpResponse}; use actix_multipart::Multipart; use async_std::prelude::*; use futures::{StreamExt, TryStreamExt}; use bytes::{BytesMut,BufMut}; use serde::{Serialize,Deserialize}; use uuid::Uuid; use std::path::Path; use handlebars::Handlebars; use crate::db::DbPo...
// <NAME> // https://github.com/oberzs/duku #![cfg(feature = "png")] use png_dep::BitDepth; use png_dep::ColorType; use png_dep::Decoder; use png_dep::Encoder; use std::fs; use std::fs::File; use std::io::BufWriter; use std::path::Path; use crate::duku::Duku; use crate::error::Error; use crate::error::Result; use cr...
use aoc2019::*; use std::convert::TryFrom; mod address { //! Abstraction for dealing with addresses. //! //! This makes sure that functions which only expect to receive address //! clearly communicate it, and we can limit how it can be used by limiting //! the various implementations it provide. ...
use std::str::FromStr; const FILE_PATH: &str = "input.txt"; macro_rules! substr { ($binary:expr, $range:expr) => { $binary.get($range).ok_or(format!( "Can't get sub string {:?} from packet {}", $range, $binary ))? }; } enum SubPacketLength { Bits(usize), Count(...
#![allow(non_snake_case)] use crate::native::{new_fn, JNIEnv, JNINativeMethod, JNIResult}; use crate::oop::{self, Oop, TypeArrayDesc}; use crate::runtime::{self, require_class3, JavaThread}; use crate::util; use classfile::consts as cls_consts; pub fn get_native_methods() -> Vec<JNINativeMethod> { vec![ ne...
//! Renderer module. Provides infrastructure to render the game scene to the canvas. //! //! Uses the Canvas2D drawing API, an operates directly on the 2d drawing context from the DOM API. //! //! The renderer is based on a *Pipeline State Object* design. You create a PSO for different drawing //! styles (contains stuf...
use rltk::{ BaseMap, Algorithm2D, Point }; use serde::{Serialize, Deserialize}; use std::collections::HashSet; mod tiletype; pub use tiletype::{TileType, tile_walkable, tile_opaque, tile_cost}; mod themes; pub use themes::*; pub mod dungeon; pub use dungeon::*; #[derive(Default, Serialize, Deserialize, Clone)] pub st...
use std::net::SocketAddr; use std::str::FromStr; use hyper::header; use hyper::method::Method; use url::Host; use url::SchemeData; use urlencoded; use unicase::UniCase; use iron; use iron::prelude::*; use models; pub struct XForwardedMiddleware; fn get_one_raw(r: &mut Request, key: &str) -> Option<String> { ...
extern crate nimiq_account as account; extern crate nimiq_block_base as block_base; extern crate nimiq_database as database; extern crate nimiq_hash as hash; extern crate nimiq_keys as keys; extern crate nimiq_primitives as primitives; extern crate nimiq_transaction as transaction; extern crate nimiq_tree_primitives as...
use super::{are_equal, EvaluationResult, TraceState, UserOps, SPONGE_WIDTH}; use crate::{ math::field::{self, add, mul, sub}, utils::sponge::{apply_inv_mds, apply_mds, apply_sbox}, }; // CONSTRAINT EVALUATOR // ================================================================================================ pub fn e...
// "Tifflin" Kernel // - By <NAME> (thePowersGang) // // Core/arch/armv8/mod.rs // - ARMv8 (AArch64) interface use ::core::sync::atomic::{AtomicUsize}; pub mod memory; pub mod sync; pub mod threads; pub mod boot; pub mod interrupts; module_define!{arch, [], init} fn init() { // Start the FDT bus enumeration, informi...
use std::collections::HashMap; use std::{fmt, io, net}; use actix_server_config::{Io, ServerConfig}; use actix_service::{IntoNewService, NewService}; use futures::future::{join_all, Future}; use log::error; use tokio_tcp::TcpStream; use crate::counter::CounterGuard; use super::builder::bind_addr; use super::services...
// Copyright 2021 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. // TODO(csuter): Make this secure. For now these are just some stubs that need to be filled out // with real implementations. use { crate::trace_dura...
use std::path::Path; use rollcage_file_parser::file_formats::{ self, btp::{parse_btp_header, parse_textures}, gt::decompress, identify_format, idx::{parse_records, IdxRecord}, }; extern crate clap; use clap::{crate_version, App, Arg}; #[derive(Debug)] struct ImgEntry<'a> { record_id: usize, ...
mod processors; use std::thread::{self, JoinHandle}; use std::sync::mpsc::{self, Receiver}; use std::sync::{Arc, Mutex, Condvar, Barrier}; use std::sync::atomic::{AtomicUsize, Ordering}; type Coordinate = usize; type WorkItem = PixelRange; type WorkCallback<C, P, L> = dyn Fn(&C, &mut L, Coordi...
use std::rc::{Rc, Weak}; use std::cell::RefCell; use std::sync::Arc; // trait Foo {} // struct Bar<'a> { // x: &'a i32, // } // impl<'a> Foo for Bar<'a> {} trait Foo<'a> {} struct FooImpl<'a> { s: &'a [u32], } impl<'a> Foo<'a> for FooImpl<'a> {} fn foo<'a>(s: &'a [u32]) -> Box<dyn Foo<'a> + 'a> { Box::ne...
/*! * Implementation of "BitBay" module. * * This module is able to download data in JSON format from [BitBay](https://bitbay.net) service and save in file. * List of supported APIs is as described in sub-modules list. */ use std::any::Any; use actix::prelude::*; use anyhow::Result; use super::common::{ConfigT...
use std::fmt::Debug; use num_traits::{one, zero, NumCast, PrimInt}; /// GCD pub fn gcd<T: PrimInt>(a: T, b: T) -> T { if b == zero() { a } else { gcd(b, a % b) } } /// LCM pub fn lcm<T: PrimInt>(a: T, b: T) -> T { a / gcd(a, b) * b } /// GCD of vec pub fn gcd_list<T: PrimInt>(vec: &[...
use std::{num::ParseFloatError, string::ParseError, time::Duration}; use clap::{value_t, App, Arg}; use thiserror::Error; #[derive(Debug, Clone)] pub struct Config { pub update_period: Duration, pub prom_config: PromConfig, pub otel_config: OTelConfig, } #[derive(Debug, Clone)] pub struct OTelConfig { ...
use ds1307::{Error, NaiveDate, NaiveDateTime, NaiveTime, Rtcc}; use embedded_hal_mock::i2c::Transaction as I2cTrans; mod common; use crate::common::{destroy, new, Register, ADDR}; fn get_valid_datetime() -> NaiveDateTime { NaiveDate::from_ymd(2018, 8, 13).and_hms(23, 59, 58) } #[test] fn get_datetime() { let ...
use crate::block_store::StateVector; use crate::store::Store; use crate::transaction::Transaction; use crate::updates::decoder::DecoderV1; use crate::updates::encoder::Encoder; use crate::*; use rand::Rng; use std::cell::RefCell; /// A Y.Doc instance. pub struct Doc { pub client_id: u64, store: RefCell<Store>,...
#![allow(dead_code)] #![allow(non_snake_case)] use chrono::{DateTime, Local, NaiveDateTime, TimeZone, Utc}; use std::mem; use std::ffi::OsString; use std::io::Error; use winapi::shared::minwindef::{BOOL, LPARAM, LRESULT, UINT, WPARAM}; use winapi::shared::windef::HWND; #[allow(unused_imports)] use winapi::um::winuser...
use helper::Input; use std::collections::HashSet; #[allow(dead_code)] fn part1(input: Input) -> usize { let (algorithm, img) = transform(&input); (0..2) .fold((&algorithm, img), |(algo, img), i| { (algo, img.expanse(algo, i)) }) .1 .lpixels() } #[allow(dead_code)] ...
extern crate openssl; use crate::sha1::Sha1; use num_bigint::{BigInt, BigUint, RandBigInt, ToBigInt, ToBigUint}; pub struct DSA { pub p: BigInt, pub q: BigInt, pub g: BigInt, pub pubkey: BigInt, pub privkey: BigInt, } const DEFAULT_P: &[u8] = b"800000000000000089e1855218a0e7dac38136ffafa72eda7\ ...
// Copyright (C) 2019-2020 <NAME> <<EMAIL>> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, ...
//! Structures and tools to parse, navigate and validate [OpenAPI v3.1] specifications. //! //! # Example //! //! ```no_run //! match oas3::from_path("path/to/openapi.yaml") { //! Ok(spec) => println!("spec: {:?}", spec), //! Err(err) => println!("error: {}", err) //! } //! ``` //! //! [OpenAPI v3.1]: https://githu...
use serde::{Serialize, Deserialize}; use serde_json::Value; #[derive(Serialize, Deserialize, Debug)] pub struct Annotations { list: Vec<Value>, } #[derive(Serialize, Deserialize, Debug)] pub struct Dashboard { pub annotations: Option<Annotations>, pub editable: bool, #[serde(rename = "gnetId")] pu...
use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use fibers::sync::mpsc; use futures::{Async, Future, Poll, Stream}; use {Error, ErrorKind, Result, WatchMask, Watcher, WatcherEvent}; use internal_inotify::{Inotify, WatchDecriptor}; use w...
#![feature(plugin, proc_macro_hygiene, decl_macro)] #[macro_use] extern crate error_chain; #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; #[macro_use] extern crate lazy_static; extern crate brotli; extern crate byteorder; extern crate chrono; extern crate c...
//! In a top-down 2d game, there are times where components may //! rotate to any point, say rotating some number of degrees to //! face the player. This is not the module for those times. This //! module is for the possible directions you might choose when //! firing a laser or moving the player, such as moving right,...
use std::os::raw::c_void; use super::{Platform, Settings}; use fate::math::Extent2; use event::Event; use mouse_cursor::MouseCursor; use dmc; use sdl2::{self, Sdl, EventPump}; use sdl2::event::{Event as Sdl2Event, WindowEvent}; use sdl2::video::{Window, GLContext}; use sdl2::mouse::{Cursor as Sdl2Cursor, SystemCursor a...
use crate::token::{Token, TokenStream, TokenType}; use alloc::{format, sync::Arc, vec::Vec}; use core::mem; use crunch_shared::{ config::BuildOptions, context::Context, error::{Error, ErrorHandler, Locatable, Location, ParseResult, SyntaxError}, files::CurrentFile, tracing, trees::ast::Item, }; ...
// Copyright 2020 - developers of the `grammers` project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distr...
extern crate pest; #[macro_use] extern crate pest_derive; use pest::Parser; use std::fs::File; use std::io::{self, BufRead}; use std::collections::{HashMap, HashSet}; use std::hash::{Hash, Hasher}; #[derive(Parser)] #[grammar = "bag.pest"] pub struct BagParser; #[derive(Debug, Eq)] pub struct Bag { name: String,...
use std::io::{Error, ErrorKind, Result, Write}; const ESCAPE_CODE: &[u8] = "\x1b[L".as_bytes(); const GENERATOR_MAX_CHAR_INDEX: u8 = 7; macro_rules! write_char { ($writer:ident, $char:expr) => { $writer.write(&[$char as u8]) }; } macro_rules! write_digit { ($writer:ident, $num:expr) => { ...
//! This module handles the database; //! loading, parsing, writing, etc. etc. use std::fs::{File, OpenOptions}; use std::io::prelude::*; use std::io::SeekFrom; use std::time::{UNIX_EPOCH, SystemTime, Duration}; use std::path::PathBuf; use crate::rng::Rng; /// 24 hours in seconds const DAY: u64 = 86400; /// The word...
use std::io; use std::fmt; use database::{FromDatabaseValue, IntoDatabaseValue}; use beserial::{Deserialize, Serialize, DeserializeWithLength, SerializeWithLength, SerializingError, ReadBytesExt, WriteBytesExt}; /// Keeps track of the number of superblocks at each level #[derive(Clone)] pub struct SuperBlockCounts {...
use super::solution::{Error, Solution}; use itertools::Itertools; use std::str::FromStr; type Ticket = Vec<i32>; struct Rule { name: String, intervals: Vec<(i32, i32)>, } impl FromStr for Rule { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { let mut parts = s.split(": "...
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::Error as FailureError, bt_avctp::AvcPeer, fidl_fuchsia_bluetooth_avrcp::{ AbsoluteVolumeHandlerProxy, AvcPanelCommand, Ta...
extern crate alloc; extern crate lazy_static; extern crate log; extern crate smoltcp; extern crate spin; use crate::mm; use alloc::{collections::BTreeSet, vec, vec::Vec}; use lazy_static::lazy_static; use smoltcp::socket::SocketSet; use smoltcp::wire::{IpAddress, IpEndpoint, Ipv4Address}; use spin::Mutex; const MAX_...
// Copyright 2020 Parity Technologies (UK) Ltd. // This file is part of Tetcoin. // Tetcoin is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later ...
//! Hit testing. use super::*; /// Represents a position within a layout. #[derive(Copy, Clone, Default, Debug)] pub struct Cursor { path: CursorPath, baseline: f32, offset: f32, advance: f32, text_start: usize, text_end: usize, is_rtl: bool, is_leading: bool, is_inside: bool, } i...
use super::Point; use super::*; /// LineSegment defined by a start and an endpoint, evaluatable /// anywhere inbetween using interpolation parameter t: [0,1] in eval() /// A LineSegment is equal to a linear Bezier curve, which is why there is no /// specialized type for that case. #[derive(Copy, Clone, Debug, PartialE...
use std::path::Path; use tokio::io::AsyncReadExt; use tokio::io; use crate::image::ImageFormat; use super::free_functions; use crate::{ImageError, ImageResult}; use crate::dynimage::DynamicImage; use crate::error::{ImageFormatHint, UnsupportedError, UnsupportedErrorKind}; pub struct AsyncReader<R: AsyncReadExt> { ...
//! Contains models and functions used to manage a Z80 processor's internal storage, //! including single registers, register pairs, and status flags. use std::fmt; use strum_macros::Display; macro_rules! impl_display_register { ($( $ident: ident ),*) => ( $( impl fmt::Display for $ident { fn ...
use crate::lcd::Lcd; pub struct Ppu { lcd: Lcd, vram: Vec<u8>, frame: Vec<u32>, cycles: usize, pub lcdc_control: u8, lcdc_status: u8, pub scy: u8, // SCX: u8, pub ly: u8, // LYC: u8, // WY: u8, // WX: u8, pub bg_colorpalette: u8, } #[derive(PartialEq)] pub enum LC...
use std::usize; use crate::ff_uint::{Num, PrimeField}; use linked_list::{Cursor, LinkedList}; #[cfg(feature="borsh_support")] use crate::borsh::{BorshSerialize, BorshDeserialize}; pub trait AbstractLC<Fr:PrimeField> : Clone + std::fmt::Debug{ fn add_assign(&mut self, other: &Self); fn sub_assign(&mut self, ...
// Copyright (c) 2017 <NAME> <<EMAIL>> // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish...
use crate::annotate; use crate::compile; use crate::ArgSpec; use crate::Behavior; use crate::Class; use crate::ConstVal; use crate::DocStr; use crate::Error; use crate::Handle; use crate::HandleBehaviorBuilder; use crate::Key; use crate::LexErrorKind; use crate::Lexer; use crate::List; use crate::Map; use crate::Mark; ...
use std::borrow::Cow; use std::collections::HashMap; use std::fmt::Debug; use std::fs::read; use std::io; use std::path::{Path, PathBuf}; use anyhow::Context; macro_rules! read_dir { ($path:expr) => { ::std::fs::read_dir($path) .with_context(|| format!("Failed to read directory: {:?}", $path))...