text
stringlengths
3.09k
13.9k
use crate::{ data::{PathData, RelativePath, Time}, db::{self, RootData, RootId}, }; use futures_util::stream::{Stream, StreamExt}; use sqlx::SqlitePool; use std::{convert::TryFrom, path::PathBuf, sync::Arc, time::Instant}; use tokio::{ sync::{ mpsc::{self, error::TrySendError}, oneshot, ...
use std::{collections::HashMap, pin::Pin}; use rpc::{ server::{parse_query_string, MethodHandler}, RpcServiceEnvironmentRef, }; use serde::{de::DeserializeOwned, Deserialize}; use serde_json::Value; #[derive(Clone, Debug, Deserialize)] #[serde(untagged)] pub enum Params { Array(Vec<Value>), Object(Val...
mod core; mod cpu; mod display; mod input; mod memory; mod opcodes; mod registers; mod timers; use crate::core::{Address, Error, ResultChip8, VoidResultChip8, Word}; use crate::cpu::CPU; use crate::display::{TerminalVideoListener, VideoMemory}; use crate::input::{InputManager, KEY_NUM}; use crate::memory::{ByteArrayMe...
use crate::error::BitResult; use crate::obj::Oid; use crate::pack::{PackIndexer, PackWriter, PACK_EXT, PACK_IDX_EXT}; use crate::refs::SymbolicRef; use crate::repo::BitRepo; use async_trait::async_trait; use parse_display::{Display, FromStr}; use std::collections::HashSet; use tokio::io::{self, AsyncBufRead, AsyncReadE...
use super::*; use super::paging::*; use core::ops::{Deref, DerefMut}; //pub use self::fifo::FifoSwapManager; pub use self::enhanced_clock::EnhancedClockSwapManager; mod fifo; mod enhanced_clock; #[cfg(test)] mod mock_swapper; /// Manage all swappable pages, decide which to swap out pub trait SwapManager { /// Ca...
use super::image::*; use super::widget::*; use super::basic_widget::*; use super::flo_layout::*; use super::widget_data::*; use super::super::gtk_thread::*; use super::super::gtk_action::*; use flo_ui::*; use gtk; use gtk::prelude::*; use std::rc::*; use std::cell::*; /// /// Represents the behaviour of a widget th...
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR MIT /// We can improve verification performance by conveying semantic information /// about function pointer calls down to the underlying solver. In particular, /// method calls through Rust dynamic trait ob...
/*! # Spectral Distribution Representations A spectral distribution represents the composition of electromagnetic radiation – called light when visible – for a domain of wavelengths (waves) or a domain of photon energies (photons), and is probably most familiar for you in form spectral plot, such as the spectral dist...
use std::fs::File; use std::io::{BufRead, BufReader}; use std::collections::HashMap; const DEBUG : bool = false; // For simplification instead of creating non-needed struct, set types type Cup = u64; // ---------------- Game ---------------- struct Game { // Some game consts pickup_next : u32, // State G...
use std::{ fs::File, io::Write, path::{Path, PathBuf}, }; use anyhow::{Context, Error, Result}; use bincode::{config, encode_to_vec}; use bzip2::{read::BzDecoder, write::BzEncoder, Compression}; use chrono::{DateTime, Local, Utc}; use git2::{Repository, Status}; use tar::{Archive, Builder}; use crate::{ ...
use std::convert::{Infallible, TryFrom, TryInto}; use std::fmt::Formatter; use std::net::{IpAddr, SocketAddr}; use rand::{RngCore, thread_rng}; use serde::{Serialize, Deserialize, Serializer, Deserializer}; use sha1::Digest; use sha1::digest::Update; use thiserror::Error; pub const KAD_ID_LEN: usize = 160; pub cons...
#![feature(backtrace)] mod camera; mod highlighter; mod screenshot; mod zoomer; mod console; mod ffi; mod gl; mod imgui_impl; mod interpolation; mod monitors; use std::{ptr, time::Instant}; use winapi::{ shared::{ minwindef::{DWORD, HIWORD, LOWORD, LPARAM, LRESULT, WPARAM}, windef::{HWND, POINT,...
//! 同步请求。qps = 1。默认英译中。 //! ```console //! DEBUG=1 cargo run --example baidu -- -a xx -k xx -q hello\ world hi China //! ``` //! //! 正常返回: //! ```text //! Cmd { //! appid: "xx", //! key: "xx", //! from: "en", //! to: "zh", //! query: "hello world", //! multiquery: [ //! "hi", //! ...
use std::cmp::Ordering; use amethyst::{ ecs::{Entities, Read, ReadStorage, System, World, Write, WriteStorage}, shred::{ResourceId, SystemData}, }; use asset_model::loaded::ItemId; use derivative::Derivative; use derive_new::new; use kinematic_model::{ config::Position, play::{PositionInitOffset, Posit...
use crate::{ component::{Component, ComponentHasher, ComponentHasherExt, ComponentUuid}, error::GracefulExit, events::{Event, Events}, exit_error, lang::Lang, probes::Probes, }; use core::num::NonZeroU32; use id_gen::{IdGen, NonZeroIdRange}; use invocations::{Config, Invocations}; use std::fs; u...
#![warn(bad_style)] #![warn(missing_copy_implementations)] #![warn(missing_debug_implementations)] // #![warn(missing_docs)] #![warn(trivial_casts)] #![warn(trivial_numeric_casts)] #![warn(unused)] #![warn(unused_extern_crates)] #![warn(unused_import_braces)] #![warn(unused_qualifications)] #![warn(unused_results)] #![...
use std::io::Cursor; use std::net::SocketAddr; use bytes::{Buf, BytesMut}; use crossbeam::channel::Sender; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpStream; use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender}; use falcon_core::network::buffer::{ByteLimitCheck, PacketBufferRead, PacketBu...
//! JSON clients. use std::{io, thread}; use std::convert::TryFrom; use std::fs::File; use std::str::FromStr; use std::time::Duration; use log::{debug, warn}; use reqwest::Url; use rpki::rtr::Serial; use serde::Deserialize; use tokio::sync::oneshot; use tokio::time::{Instant, timeout_at}; use crate::payload; use crate...
//! Module contianing the core functionality for OAuth2 Authentication. use crate::error::Error; use crate::service_account::{ServiceAccountFlow, ServiceAccountFlowOpts, ServiceAccountKey}; use crate::storage::{self, Storage}; use crate::types::AccessToken; use actix_web::client as awc; use futures::lock::Mutex; use st...
use std::error; use std::fmt::{Display, Formatter}; use std::io; use std::result; use arrow::error::ArrowError; use arrow_parquet::errors::ParquetError; use datafusion::error::DataFusionError; use deltalake::DeltaTableError; /// Result type for operations that could result in an [BuzzError] pub type Result<T> = resul...
use chrono::TimeZone; use anyhow::Result; use thiserror::Error; use uom::si::{energy, f32::Energy}; #[derive(Error, Debug)] pub(crate) enum MeasurementError { #[error("Record root not dictionary")] NotDictionary, #[error("Record missing timestamp")] MissingTimestamp, #[error("Failed while parsing...
use lcd_hd44780; use lcd_hd44780::commands::{Direction, TextDirection}; use piston_window::*; use std::io::Cursor; use std::sync::{Arc, Mutex}; use std::thread; #[derive(Clone, Copy, Debug, Default)] pub struct Point { pub x: usize, pub y: usize, } pub enum AddressCounter { Ddram { line: u8, addr: u8 }, ...
use crate::*; #[cfg(feature = "crossterm")] use crossterm::style::Color as CC; /// Color type, may be Ansi, Hsl or Rgb #[derive(Clone, Copy, Debug)] pub enum Color { Ansi(AnsiColor), Hsl(Hsl), Rgb(Rgb), } impl Color { pub fn ansi(self) -> AnsiColor { match self { Self::Ansi(ansi) ...
use std::sync::Arc; use futures::lock::Mutex; use crate::error::Error; use crate::session::Session; use chrono::{DateTime, FixedOffset}; use hyper::body::Buf; use hyper::{Body, Method, StatusCode}; use serde_json::json; use serde_json::value::Value; // A file stored in iCloud Drive. #[derive(Clone)] pub struct File {...
use regex::Regex; use android_localization_utilities::DevExpt; use crate::android_string::AndroidString; use crate::ops::sort; use crate::util::two_pointer_traversal; lazy_static::lazy_static! { static ref FORMAT_STRING: Regex = Regex::new(r"(%\d+\$[ds])").expt("Invalid regex!"); } pub fn validate( default_...
#[derive(Debug, PartialEq)] pub enum LaunchType { Man, // 直接人間が起動させた場合 Daemon, // cron処理でpcが起動させた場合 Stop, // PortSnippetを停止する Restart, // PortSnippetを再起動する Help, // help } struct Params { man: String, daemon: String, stop: String, restart: String, help: String, } con...
use common::*; use arch::{KERNEL_BASE}; use arch::init::{KERNEL_PDPT}; use arch::paging::{BASE_PAGE_LENGTH, PML4, PML4Entry, pml4_index}; use util::{MemoryObject, UniqueReadGuard, UniqueWriteGuard, RwLock}; use super::{PML4Descriptor, PML4Cap, PDPTCap, PDCap, PTCap, PageCap}; use cap::{self, UntypedDescriptor, CPoolDes...
use hyper::Body; use hyper_usse::EventBuilder; use std::mem; use super::sse; /// The `Content` of a page is either `Dynamic` or `Static`. If it's dynamic, it /// has a title, body, and a set of SSE event listeners who are waiting for /// updates to the page. If it's static, it just has a fixed content type and a /// ...
use log::debug; use nalgebra_glm as glm; use vk_tracer::{ ash::vk::ShaderStageFlags, prelude::*, shaderc::{OptimizationLevel, ShaderKind}, utils::{Camera, FpsLimiter, ShaderCompiler}, }; use winit::{ event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent}, event_loop::{ControlFl...
use glium; use super::vertex::ColorVertex; pub struct ColorTriangleBatch<'a> { display: &'a glium::backend::glutin_backend::GlutinFacade, perspective: bool, program: glium::Program, vertices: Vec<ColorVertex>, indices: Vec<u32>, vertex_buffer: Option<glium::VertexBuffer<ColorVertex>>, index...
use imgui as imgui_rs; use imgui_rs::{Context, DrawData, TextureId}; use skia_safe::{AlphaType, Matrix, Paint}; use std::collections::HashMap; pub struct Renderer { // this holds the skia formatted font atlas images: HashMap<usize, skia_safe::Paint>, img_idx: usize // this is incremented each time an image...
#![crate_name="mml"] #![crate_type= "lib"] #![doc(html_root_url = "https://docs.rs/mml/0.1.41")] #![cfg_attr(feature = "nightly", feature(plugin))] #![cfg_attr(feature = "lints", plugin(clippy))] #![cfg_attr(feature = "lints", deny(warnings))] #![cfg_attr(not(any(feature = "lints", feature = "nightly")), deny())] #!...
#![doc="Quick sort algorithms "] // std imports use std::ptr; use std::fmt; /// Quick sort algorithm on a slice of data pub fn quick_sort_slice<T: PartialOrd>(xs: &mut [T]){ if xs.len() <= 1 { return; } // Compute the pivot as median between left-right and center. let pivot = { let (l...
use crate::error::{Error, ErrorKind, Result}; use crate::query::works::{WorksCombiner, WorksFilter, WorksIdentQuery, WorksQuery}; use crate::query::{Component, CrossrefQuery, CrossrefRoute, ResourceComponent}; use serde::{Deserialize, Serialize}; use std::str::FromStr; /// all possible types of a `Work` #[derive(Debug...
use chrono::{DateTime, Utc}; use youmubot_db_sql::{models::osu as models, models::osu_user as model, Pool}; use crate::models::{Beatmap, Mode, Score}; use serde::{Deserialize, Serialize}; use serenity::model::id::{ChannelId, UserId}; use youmubot_prelude::*; /// Save the user IDs. pub struct OsuSavedUsers { pool:...
use crate::{ nginx_utils::*, ngx_string, script::{EvalContext, ScriptEngine}, }; use nginx::*; use rhai::{Dynamic, ImmutableString}; use std::{ borrow::Borrow, collections::HashMap, os::raw::{c_char, c_void}, ptr, }; pub const NGX_RS_MODULE_SIGNATURE: &'static [u8; 41usize] = b"8,4,8,000...
//! This example demonstrates differences between a *static dispatch* and //! *dynamic dispatch* of method calls. //! //! Second point this example makes is that polymorphism without inheritance (i.e. other forms of //! polymorphism other than subclass polymorphism) is not a matter of static or dynamic dispatch. //! //...
// pathfinder/renderer/src/scene.rs // // Copyright © 2019 The Pathfinder Project Developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may...
#[macro_use] extern crate serde_derive; extern crate checksums; extern crate clap; extern crate colored; extern crate glob; extern crate globwalk; extern crate ignore; extern crate rayon; extern crate serde_yaml; extern crate subprocess; use clap::{App, Arg}; pub mod roomservice; pub mod util; use std::collections::...
use super::{settings::*, *}; use bitflags::bitflags; use nalgebra::{Point3, UnitQuaternion, Vector3}; use semver::Version; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, time::Duration}; #[derive(Serialize, Deserialize)] pub struct HandshakePacket { pub alvr_name: String, pub version: Ver...
use std::{env, str}; use std::path::PathBuf; use image::RgbaImage; use rand::Rng; // debug messages const USAGE: &'static str = "Usage: camoufler <input_image> <output_folder> [<arguments>]"; fn main() { /* ** Process arguments */ // initialise argument values let mut input_path_raw = String::n...
/*! Codes for the representation of currencies. Currencies can be represented in the code in two ways: a three-letter alphabetic code and a three-digit numeric code. The most recent edition is ISO 4217:2015. The purpose of ISO 4217:2015 is to establish internationally recognised codes for the representation of currenc...
//! An implementation of disjoint set forests for union find. /// Data structure for efficient union find. pub struct DisjointSetForest { /// Number of forest elements. count: usize, /// parent[i] is the index of the parent /// of the element with index i. If parent[i] == i /// then i is a root. ...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ epoch_change::Verifier, epoch_state::EpochState, ledger_info::{LedgerInfo, LedgerInfoWithSignatures}, transaction::Version, }; use anyhow::{ensure, format_err, Error, Result}; use aptos_crypto::hash::{Crypto...
use std::collections::HashSet; use std::error::Error; use std::net::SocketAddr; use std::sync::Arc; use chrono::Utc; use futures::future::FutureExt; use futures::select; use futures::sink::SinkExt; use futures::stream::StreamExt; use log::{debug, error, info, warn}; use rand::Rng; use tokio::net; use tokio::net::UdpSo...
use crate::{elements::ElementValue, errors, Hypergraph}; /// # Find /// /// Find elements. impl<N, E, H, L, Ty> Hypergraph<N, E, H, L, Ty> { /// Returns the id of the link that belongs to hypergraph `location` linking `source` and `target`. /// /// An empty `location` means the main hypergraph. /// ...
extern crate time; use sovrin::api::ErrorCode; use sovrin::api::pool::{sovrin_create_pool_ledger_config}; #[cfg(feature = "local_nodes_pool")] use sovrin::api::pool::sovrin_open_pool_ledger; use sovrin::api::ledger::sovrin_submit_request; use utils::callback::CallbackUtils; use utils::environment::EnvironmentUtils; u...
use std::io; use std::process::ExitStatus; use std::sync::Mutex; /// An interface for waiting on a process to exit. pub(crate) trait Wait { /// Get the identifier for this process or diagnostics. fn id(&self) -> u32; /// Try waiting for a process to exit in a non-blocking manner. fn try_wait(&mut self)...
use ggez::{ event::MouseButton, graphics::{self, Color}, nalgebra::Point2, Context, GameError, GameResult, }; use graphics::{DrawMode, Mesh, Rect}; use std::fs; pub type Nonogram = Vec<Vec<Block>>; pub const BLOCK_CHAR: char = '#'; const BLOCK_SIZE: f32 = 35.0; const BLOCK_COLOR: graphics::Color = gra...
use chrono::prelude::Utc; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::ops::Deref; use crate::qaaccount::account::QA_Account; use crate::qaaccount::order::{QAOrder, TradeOrder}; use crate::qaprotocol::mifi::market::BAR; use crate::qadata::datafunc::{dhhv, dllv, max, min, Que}; pub tra...
use timens::Span; fn test_str(s: Span, str: &str) { assert_eq!(s.to_string(), str); let v: Span = str.parse().unwrap(); assert_eq!(s, v); } #[test] fn to_string() { test_str(Span::ZERO, "0s"); test_str(Span::SEC, "1s"); test_str(Span::MS * 1., "1ms"); test_str(Span::MS * 2., "2ms"); te...
#![feature(test)] // compiletest_rs requires this attribute use compiletest_rs as compiletest; use compiletest_rs::common::Mode as TestMode; use std::env::{self, set_var}; use std::ffi::OsStr; use std::fs; use std::io; use std::path::{Path, PathBuf}; mod cargo; fn host_lib() -> PathBuf { if let Some(path) = opt...
// use std::fmt; #[derive(Eq, PartialEq, Debug, Clone)] pub struct Octopuses { energy_level: Vec<Vec<u8>>, flashed: Vec<Vec<bool>>, } impl Octopuses { fn parse(input: &str) -> Octopuses { let mut r = Octopuses { energy_level: vec![], flashed: vec![], }; for...
//! //! Utility functions to help build numbers that implement [`PlotNum`] and [`DiscNum`]. //! use crate::tick_fmt; use crate::DiscNum; use crate::PlotNum; use crate::Tick; use crate::TickInfo; use core::fmt; pub use self::f64::compute_ticks as compute_ticks_f64; pub use self::i128::compute_ticks as compute_ticks_i12...
use crate::extractor::FirebaseId; use chrono_tz::Tz; use shared::{ domain::{ auth::RegisterRequest, meta::AffiliationId, meta::AgeRangeId, meta::SubjectId, user::{OtherUser, UserProfile, UserScope}, }, error::auth::RegisterError, }; use sqlx::{postgres::PgDatabaseErro...
use std::collections::HashMap; use std::hash::BuildHasher; use base64::{decode, encode}; use config::Config; use rendering::{render_content, RenderContext}; use tera::{to_value, try_get_value, Filter as TeraFilter, Result as TeraResult, Value}; #[derive(Debug)] pub struct MarkdownFilter { config: Config, } impl ...
#![allow(dead_code)] use std::any::Any; use std::rc::Rc; use std::cell::RefCell; use std::sync::Arc; use std::sync::Mutex; /// Represents the user data that is provided to callbacks when they're invoked. /// A `UserData` object is registered with the callback using one of the /// hook commands. The user data can be v...
// Copyright 2019 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or d...
#[cfg(feature = "rtu")] pub mod rtu; #[cfg(feature = "tcp")] pub mod tcp; use std::{error, fmt}; /// A Modbus function code is represented by an unsigned 8 bit integer. pub(crate) type FunctionCode = u8; /// A Modbus protocol address is represented by 16 bit from `0` to `65535`. /// /// This *protocol address* uses...
use common::prelude::*; use nom::{ bytes::complete::tag, character::complete::alpha1, combinator::map, multi::{separated_list0, separated_list1}, sequence::{delimited, separated_pair}, IResult, }; use std::collections::{HashMap, HashSet}; pub fn run() -> AdventOfCodeResult { let input = in...
//!Parsing JSONs, and retrieving values at specific rows/columns. //! //!* **Baseline**: Simple json with just one entry. //!* **Serial**: Opposite of nested. 100 entries listed in a "flat" format, one by one, without any tree structure. //!* **Nested**: 100 nested entries, each inside of the other. #[macro_use] exter...
use anyhow::{ensure, Result}; use approx::abs_diff_eq; pub use cv_convert::{FromCv, TryIntoCv}; use darknet_config::{torch::LayerOutput, DarknetModel, TchModel}; use darknet_test::{ config::{Config, InputConfig}, darknet::network::Network, }; use itertools::Itertools; use log::info; use ndarray::Array3; use std...
/*! Language interpreters and their support data. See the [crate level documentation](super) for an overview of the usage of the builtin languages. # How to add support for a new language The idea behind the decoding of numbers in natural language, is to consider that numbers represents a subset of the language that...
use crate::config::TextStyle; use crate::font::units::*; use crate::font::{FontConfiguration, GlyphInfo}; use ::window::bitmaps::atlas::{Atlas, Sprite}; use ::window::bitmaps::{Image, ImageTexture, Texture2d}; use ::window::glium::backend::Context as GliumContext; use ::window::glium::texture::SrgbTexture2d; use ::wind...
#![allow(non_upper_case_globals)] #![allow(non_snake_case)] use std::ptr; use std::mem; use std::os::raw::c_void; extern crate glfw; use self::glfw::Context; extern crate gl; use self::gl::types::*; use cgmath::Vector2; extern crate num; use self::num::range_step; use shader::Shader; // settings const SCR_WID...
// "Tifflin" Kernel // - By <NAME> (thePowersGang) // // arch/amd64/cpu_faults.rs //! Fault handlers //use prelude::*; use super::{puts,puth}; use super::log::puth64; #[repr(C)] //#[derive(Copy,Clone)] /// Register state as saved by the error ISR handler pub struct InterruptRegs { //fs: u64, //gs: u64, rax: u64, r...
#![allow(unused_imports)] #![allow(unused_variables)] use std::vec; use cosmwasm_std::{ entry_point, to_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Reply, ReplyOn, Response, StdError, StdResult, SubMsg, WasmMsg, }; use cw_storage_plus::Map; use protobuf::Message; use cw20::{Cw20ExecuteMsg, Cw20Rece...
use aoc_runner_derive::{aoc, aoc_generator}; use std::collections::{hash_map::Entry, HashMap}; #[aoc_generator(day8)] pub fn input_generator(input: &str) -> (Vec<Vec<String>>, Vec<Vec<String>>) { let mut wires = Vec::new(); let mut digits = Vec::new(); for line in input.lines() { let mut parts = li...
use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; use self::util::case_insensitive_btreemap_get; use super::{FileWriter, IoResult}; use inflector::Inflector; use util; use Service; const BOTOCORE_ERROR_RESPONSE_TESTS_DIR: &'static str = concat!( env!("CARGO_MANIFEST_DIR"), "/botocore/tests/unit...
//! Manage LLVM/Clang builds use glob::glob; use log::*; use regex::Regex; use semver::Version; use std::{ env, fs, io::{self, Read, Write}, path::{Path, PathBuf}, process::Command, }; use crate::config::*; use crate::error::*; const LLVMENV_FN: &str = ".llvmenv"; #[derive(Debug)] pub struct Build {...
pub trait Painter { fn clear(&mut self); /// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/beginPath fn begin_path(&mut self); /// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/closePath fn close_path(&mut self); /// https://developer.mo...
use crate::{vec3::Vec3, Mat4, Vec4}; use core::ops::Index; use std::ops::Mul; const QUAT_NORMALIZED_THRESHOLD: f32 = 0.001; #[derive(Debug, Clone, Copy)] #[allow(dead_code)] pub struct Quat { x: f32, y: f32, z: f32, w: f32, } impl Index<usize> for Quat { type Output = f32; fn index(&self, ind...
use std::ffi::CString; use x11::xlib; static mut WM_PROTOCOLS: xlib::Atom = 0; pub fn wm_protocols() -> xlib::Atom { unsafe { WM_PROTOCOLS } } static mut WM_DELETE: xlib::Atom = 0; pub fn wm_delete() -> xlib::Atom { unsafe { WM_DELETE } } static mut WM_STATE: xlib::Atom = 0; pub fn wm_state() -> xlib::Atom {...
// Copyright 2019 The Grin Develope; // // 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...
// Copyright 2015-2020 Parity Technologies (UK) Ltd. // This file is part of Open Ethereum. // Open Ethereum 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 o...
use phi::Phi; use phi::data::Rectangle; use std::cell::RefCell; use std::path::Path; use std::rc::Rc; use sdl2::render::{Renderer, Texture}; use sdl2_image::LoadTexture; /// Common interface for rendering a graphical component to some given region /// of the window. pub trait Renderable { fn render(&self, renderer...
#![forbid(unsafe_code)] #![deny(missing_docs)] //! TuringDB-Server is a key-value database written using async code and backed by `sled.rs` embedded key/value store. //! This is the server version, the library can be found by searching crates-io for `turingdb` //! or checking under the Github repository https://githu...
extern crate nalgebra as na; use na::Vector2; pub type Vector2D = Vector2<f64>; #[derive(Clone, Copy)] pub enum BlockType { NONE = 0, WALL = 1, } pub struct BlockMap { blocks: Vec<BlockType>, pub width: usize, pub height: usize, } pub struct BlockData { pub hit: Vector2D, pub light: f64 ...
#[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult}; use cw2::set_contract_version; use crate::error::ContractError; use crate::msg::{CountResponse, ExecuteMsg, InstantiateMsg, QueryMsg, MemberResponse}; use crate::s...
#[macro_use] extern crate tera; #[macro_use] extern crate lazy_static; extern crate iron; extern crate router; extern crate hyper; extern crate regex; use std::env; use std::io::prelude::*; use std::fs::File; use tera::Tera; use tera::Context; use regex::Regex; use iron::prelude::*; use iron::{BeforeMiddleware,...
use crate::{ImgMut, Img, ImgRange, ImageMapping, Range}; use std::{cmp::min}; use super::plan::{create_filter_plan, FilterIteration}; pub fn vertical_filter<T: Copy, F>( input: &dyn Img<T>, output: &mut dyn ImgMut<T>, kernel: &[T], operator: F ) where F: Fn(&[T], &mut [T], T) { let output_range =...
// // Copyright (c) 2019 Stegos AG // // 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 std::fs::OpenOptions; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::time::{Duration, SystemTime, UNIX_EPOCH}; use extcap::*; use log::{debug, LevelFilter}; use pcap_file::{pcap::PcapHeader, DataLink, PcapWriter}; use rand::Rng; use simplelog::{Config, Simple...
use { opencv::{ prelude::*, core, objdetect, videoio, types, }, std::thread, crossbeam_channel::{bounded, TryRecvError}, std::collections::BTreeMap, }; #[path = "common.rs"] mod common; struct StreamData { order: u64, frame: Mat, equalized: Option<M...
#![cfg(target_arch = "x86_64")] use std::arch::x86_64::*; use super::sse::{hi_dp, hi_dp_ss}; // Partition memory layouts // LSB --> MSB // p0: (e0, e1, e2, e3) // p1: (1, e23, e31, e12) // p2: (e0123, e01, e02, e03) // p3: (e123, e032, e013, e021) #[inline] pub fn dot00(a: __m128, b: __m128) -> __m128 { // a...
// Copyright (c) 2012-2022 Supercolony // // 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, publis...
// Bitcoin secp256k1 bindings // Written in 2014 by // <NAME> // <NAME> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This software is distributed without // any warranty. // // You should ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Control Register0."] pub ctrl: crate::Reg<ctrl::CTRL_SPEC>, #[doc = "0x04 - Status Register."] pub status: crate::Reg<status::STATUS_SPEC>, #[doc = "0x08 - Interrupt Status Register."] pub int_fl0: crate::Reg<int_fl...
//! Line Parser use crate::{Parser, Value}; use crate::datetime::*; use std::collections::HashMap; #[derive(Clone, Debug, PartialEq, Eq)] pub struct LineParser { root: String, delimiter: String, equal: String, } impl Default for LineParser { fn default() -> Self { Self { root: "$"...
// This is a simple macro named `say_hello`. macro_rules! say_hello { // `()` indicates that the macro takes no argument. () => { // The macro will expand into the contents of this block. println!("Hello!"); }; } pub fn basic() { // This call will expand into `println!("Hello");` say_hello!() } macr...
// Copyright 2020, The rdxl Project Developers. // Dual Licensed under the MIT license and the Apache 2.0 license, // see the LICENSE file or <http://opensource.org/licenses/MIT> // also see LICENSE2 file or <https://www.apache.org/licenses/LICENSE-2.0> use quote::{quote_spanned, ToTokens}; use syn::parse::{Parse, Par...
// Copyright 2018 tuxzz and lazy-static.rs Developers // // Licensed under the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, // at your option. This file may not be copied, modified, // or distributed except according to those terms. /*! A macro for declaring thread-local `static`s like using both o...
/*********************************************************************************************************************** * Copyright (c) 2019 by the authors * * Author: <NAME> * License: Apache License 2.0 *************************************************************************************************************...
use crate::{errors::to_py_err, wasmer_inner::wasmer}; use pyo3::{ class::PyMappingProtocol, exceptions::{PyIndexError, PyValueError}, prelude::*, types::{PyAny, PySequence, PySlice}, }; use std::{convert::TryInto, iter::StepBy, ops::Range, os::raw::c_long}; enum ViewIndex { Slice(StepBy<Range<usize...
pub mod ast; use std::iter; use chumsky::prelude::*; use logos::{Lexer, Logos}; use calypso_base::{ span, symbol::{special::EMPTY, Ident, Symbol}, }; use ast::{Decl, DeclKind, Expr, ExprKind, Ty, TyKind}; pub type SyntaxError = Simple<Token, Span>; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Or...
// Memory Block Manager use std; use std::collections::LinkedList; type BlockIndexRange = std::ops::Range<u32>; enum FreeOperation { ConcatenateBlock(usize), AppendBack(usize), AppendFront(usize), InsertNew(usize), AppendNew } pub struct MemoryBlockManager { block_count: u32, freelist: LinkedList<BlockIndexRange...
//! Assets loader use std::{ fs::File, path::PathBuf, sync::{Arc, mpsc, Mutex}, thread, }; use log::error; use super::{ animation::Animation, mesh::Mesh, skin::Skin, shader::Shader, texture::Texture, load_gltf::load_gltf, }; /// Asset loading task pub struct Task { /// Ass...
//! dead-simple module to write svg. It's not efficient nor pretty, but it gets the job done. use std::fmt::{Display, Formatter}; use std::collections::BTreeMap; #[derive(Debug, Clone)] pub struct Document { children: Vec<Element>, viewbox: (f64, f64, f64, f64), } #[derive(Debug, Clone)] pub struct Element ...
use std::fs::read_to_string; use crate::error; pub struct Fasta { pub title_list : Vec<String>, pub seq_list : Vec<String>, pub site_list : Vec<String>, } impl Fasta { pub fn new() -> Fasta { let title_list : Vec<String> = Vec::new(); let seq_list : Vec<String> = Vec::new(); let site_list : Vec<Str...
// RustyNet components & topology. use std::fs::read_to_string; use std::error::Error; use std::fmt; use tuple::tuple; use log::{error, info, debug}; use yaml_rust::YamlLoader; use crate::docker::DockerManager; // Topology of the network. #[derive(Debug)] pub struct Topology { pub hosts: Vec<Node>, pub sw...