text
stringlengths
3.09k
13.9k
use crate::{Transaction, ValidationError}; #[cfg(feature = "std")] use crate::StorageSlot; use fuel_crypto::Hasher; use fuel_types::{Bytes32, ContractId, Salt}; #[cfg(feature = "std")] use fuel_merkle::{binary, common::StorageMap, sparse}; #[cfg(feature = "std")] use fuel_types::Bytes8; use alloc::vec::Vec; #[cfg...
use std::str::FromStr; use solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint::ProgramResult, msg, program_error::ProgramError, pubkey::Pubkey, rent::Rent, system_program, sysvar::Sysvar, }; use borsh::{BorshDeserialize, BorshSerialize}; use crate::{ cpi:...
use std::sync::Arc; use std::time::Instant; use sdl2::mouse::MouseState; use sdl2::render::{Canvas, Texture}; use sdl2::video::{FullscreenType, GLContext, GLProfile, SwapInterval, Window, WindowPos}; use sdl2::{EventPump, VideoSubsystem}; use rustyboi_core::hardware::ppu::palette::RGB; use rustyboi_core::hardware::pp...
/// For setsockopt(3) pub const SOL_SOCKET: i32 = 1; pub const SO_DEBUG: i32 = 1; pub const SO_REUSEADDR: i32 = 2; pub const SO_TYPE: i32 = 3; pub const SO_ERROR: i32 = 4; pub const SO_DONTROUTE: i32 = 5; pub const SO_BROADCAST: i32 = 6; pub const SO_SNDBUF: i32 = 7; pub const SO_RCVBUF: i32 = 8; pub const SO_SNDBUFFO...
use crate::{kv::Event, Command, Error, Msg, Res, Result}; use bytes::{BufMut, Bytes, BytesMut}; use crossbeam::channel::Sender; use futures::{channel::mpsc, StreamExt}; use futures_timer::Delay; use slog::{debug, error, info, Logger}; use std::{ convert::TryInto, sync::{ atomic::{AtomicU64, Ordering}, ...
use std::{ collections::VecDeque, sync::{Arc, Condvar, Mutex, MutexGuard}, time::Duration, }; use derivative::Derivative; use crate::{ error::{ErrorKind, Result}, options::StreamAddress, }; /// The wait queue ensures that threads acquiring connections proceed in a first-come, first-serve /// orde...
use crate::middleware::weighted::WeightedBalance; use hyper::{Request, Response, Body}; use hyper::header::HeaderValue; use tokio::sync::mpsc; use std::time::Duration; use std::collections::HashMap; use tower::Service; use tower::steer::Steer; use tower::discover::ServiceList; use tower::load::{PeakEwmaDiscover, Pendin...
use std::{ fmt, ops::{Add, Sub}, }; use hashbrown::HashSet; use log::debug; use crate::{ block::base::{ color::{ColorId, ColorPalette}, Block, Color, }, utils::{from_two_powers, two_powers}, }; #[derive(Debug, PartialEq, Eq, Hash, Default, Copy, Clone)] pub struct MultiColor(pub C...
use crate::errors::{FlokiError, FlokiSubprocessExitStatus}; use failure::Error; use std::ffi::{OsStr, OsString}; use std::path; use std::process::{Command, Stdio}; use uuid; #[derive(Debug, Clone)] pub struct DockerCommandBuilder { name: String, volumes: Vec<OsString>, environment: Vec<OsString>, switc...
use std::collections::{HashMap, VecDeque}; enum Value<'a> { Number(i64), Register(&'a str), } impl<'a> Value<'a> { fn from(s: &str) -> Value { match s.parse::<i64>() { Ok(number) => Value::Number(number), Err(_) => Value::Register(s) } } fn get(&self, regis...
/* Copyright (c) 2018 <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, distribute...
use bracket_pathfinding::prelude::{Algorithm2D, SmallVec}; use criterion::{criterion_group, criterion_main, Criterion}; use tcod::Map as TcodMap; use torchbearer::{ bresenham::BresenhamLine, path::{astar_path, astar_path_fourwaygrid, FourWayGridGraph, PathMap}, Point, }; const WIDTH: i32 = 20; const HEIGHT...
//! `rust-mcp3008` is a rewrite of the excellent [Adafruit_Python_MCP3008](https://github.com/adafruit/Adafruit_Python_MCP3008) Python library in Rust. #[cfg(test)] mod tests { use super::Mcp3008; use std::path::Path; use std::env; #[test] fn mcp3008_read_adc() { let spi_dev_path = "/dev/s...
/// Read entries from an *.osrm file. use byteorder::{ByteOrder, LittleEndian}; use std::io::Read; use tar; /// Size of a node in bytes. const NODE_SIZE: usize = 16; /// Size of an edge in bytes. const EDGE_SIZE: usize = 32; /// A reader for *.osrm files that allows iterating over it's entries. pub struct OsrmRea...
// Public modules pub mod acosf; pub mod asinf; pub mod cbrtf; pub mod cosf; pub mod exp2f; pub mod floorf; pub mod hypotf; pub mod lgammaf; pub mod sinf; pub mod sincosf; pub mod tanf; // Public modules for f32 pub mod acoshf; pub mod asinhf; pub mod atan2f; pub mod atanf; pub mod atanhf; pub mod ceilf; pub mod copys...
use super::Source; use libm::j0; use rayon::prelude::*; use roots::find_root_brent; use std::f64; pub struct Fwhm { r: Vec<f64>, n_otf: usize, wavelength: f64, pub upper_bracket: f64, } impl Fwhm { pub fn new() -> Self { Fwhm { r: vec![], n_otf: 0, wavele...
use crate::authentication::AuthData; use crate::db::{DbConnection, DbResult}; use crate::errors; use crate::models::user::{AuthenticatedUser, Profile, User, UserUpdateData}; use crate::schema; use crate::schema::followings; use crate::schema::users; use ammonia; use errors::Error; use scrypt; use diesel::prelude::*; ...
//! Provides functions to validate SPIFFE socket endpoint paths. use std::env; use std::net::IpAddr; use std::str::FromStr; use thiserror::Error; use url::{ParseError, Url}; /// Name of the environment variable that holds the default socket endpoint path. pub const SOCKET_ENV: &str = "SPIFFE_ENDPOINT_SOCKET"; const...
pub mod decompress; pub mod ffmpeg; pub mod pandoc; pub mod pdfpages; pub mod poppler; pub mod spawning; pub mod sqlite; pub mod tar; pub mod tesseract; pub mod zip; use crate::matching::*; use crate::preproc::PreprocConfig; use failure::*; use log::*; use regex::Regex; use std::borrow::Cow; use std::collections::HashM...
use wasm_bindgen::JsCast; use web_sys::WebGlRenderingContext as GL; use web_sys::*; use js_sys::WebAssembly; use super::super::common_fns as cf; use super::super::entities::*; #[allow(dead_code)] pub struct Color2DGradient { program: WebGlProgram, color_buffer: WebGlBuffer, index_count: i32, rect_verti...
use crate::{ audio::AudioPlayer, control::{ ControlEvent, IdentifiedController, }, dimensions::{ Attack, OctoDirection, Reverse, time::{ DeltaTime, Microseconds, }, UpDownLeftRight, }, items::{ ItemCo...
// Copyright 2021 <NAME>. // // 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 distributed except according to those te...
//! Contains the certificate data structures. //! //! The certificate contains a lot of metadata for the game (such as the //! human-readable name of the title, which is useful for display purposes). use crate::error::Error; use crate::raw; use std::fmt; use std::time::{Duration, SystemTime, UNIX_EPOCH}; /// A certi...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 //! Interface between HealthChecker and Network layers. use crate::{ counters, error::NetworkError, peer_manager::{PeerManagerRequest, PeerManagerRequestSender}, proto::{HealthCheckerMsg, HealthCheckerMsg_oneof, Ping, ...
use super::{ Institution, InstitutionField, InstitutionHistory, InstitutionOrderBy, NewInstitution, NewInstitutionHistory, PatchInstitution, }; use crate::graphql::utils::Direction; use crate::model::{Crud, DbInsert, HistoryEntry}; use crate::schema::{institution, institution_history}; use crate::{crud_methods,...
use crate::command::Command; use crate::configuration::Configuration; use crate::input::Input; use crate::logger; use crate::output::Output; use crate::position::Position; use serde_json; use std::collections::HashMap; pub struct PlayerData { pub count: u32, pub my_id: u32, pub shipyards: HashMap<u32, Posi...
use crate::edge::{edge, Edge}; use crate::hull::{hull, Hull}; use crate::mesh::{mesh, Mesh}; use crate::vertex::Vertex2; pub fn quickhull(vertices: &Vec<Vertex2>) -> Result<Hull, ()> { if vertices.len() < 2 { return Err(()); } let mut hull_vertices = Vec::new(); let (left, right) = find_left_ri...
use crate::arena::{Arena, BadHandle, Handle, UniqueArena}; use std::{num::NonZeroU32, ops}; pub type Alignment = NonZeroU32; /// Size and alignment information for a type. #[derive(Clone, Copy, Debug, Hash, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize))] #[cfg_attr(feature = "deserialize", de...
use super::{Forest, Secrets, TreeTypes}; use crate::{ index::{CompactSeq, Index, NodeInfo}, query::Query, store::ReadOnlyStore, }; use anyhow::Result; use smallvec::{smallvec, SmallVec}; #[derive(PartialEq)] enum Mode { Forward, Backward, } pub(crate) struct IndexIter<T: TreeTypes, R, Q: Query<T>>...
use std::{path::Path, rc::Rc}; use g_code::{ emit::{format_gcode_fmt, FormatOptions}, parse::snippet_parser, }; use log::Level; use roxmltree::Document; use svg2gcode::{svg2program, ConversionOptions, Machine}; use yew::prelude::*; use yewdux::prelude::{Dispatch, Dispatcher}; mod forms; mod state; mod ui; mod...
use lilv::{node::Node, plugin::Plugin, port::FloatRanges, World}; struct Nodes { control_class: Node, event_class: Node, group_pred: Node, label_pred: Node, preset_class: Node, designation_pred: Node, supports_event_pred: Node, } fn print_port(p: &Plugin, index: usize, port_ranges: &FloatR...
// Copyright (c) 2019 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distri...
use std::{ cell::RefCell, collections::HashMap, io, net::{SocketAddr, UdpSocket}, sync::{ mpsc, Arc, Mutex, atomic::{Ordering, AtomicBool}, }, thread, }; use thiserror::Error; use vru_session::handshake::{SecretKey, PublicKey, Identity, xx}; use super::{ command::{Command...
/* examples/border_set-test.rs Copyright (c) 2019-2022 <NAME> All rights reserved. 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 limi...
use framebuffer::*; use random; use random::Source; use std::f64; use std::io; use std::time::{Duration, SystemTime}; /// Generates a seeded "random" value using the current process ID and time. fn new_rng() -> random::Default { let time = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) ....
use crate::logger; use anyhow::{anyhow, bail, ensure}; use indexmap::IndexMap; use itertools::Itertools as _; use log::info; use serde::Deserialize; use serde_json::json; use ureq::Response; use url::Url; use std::collections::btree_map; use std::path::Path; pub(crate) fn retrieve_rust_code(gist_id: &str) -> anyhow:...
#![feature(slice_group_by)] use rand::Rng; use sdl2::event::Event; use sdl2::pixels::Color; use sdl2::rect::Point; use std::mem::size_of; use std::time::Duration; mod grid; mod render; mod sim; #[macro_use] extern crate num_derive; static mut PARTICAL_TYPE_VALUE: u32 = 0; pub fn main() { let sdl_context = sdl2...
/* * Copyright 2019 balajijinnah and Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable...
use std::collections::HashMap; pub mod backend; pub mod builder; mod emit; pub mod ir; pub mod parse; pub use inkwell; pub mod opt; pub mod simplify; pub mod ssa; use ir::*; /* impl Node { pub fn mangle(self, m: &mut Module, map: &HashMap<Val, Val>) -> Self { match self { Node::Fun(mut f) => {...
use std::io; use std::time::{Duration, Instant}; use actix::io::SinkWrite; use actix::prelude::*; use actix_codec::Framed; use actix_http::ws::Codec; use actix_web_actors::ws; use awc::BoxedSocket; use futures::channel::mpsc; use futures::stream::SplitSink; use serde::{Deserialize, Serialize}; use url::Url; use ccx_a...
use futures::future::poll_fn; use input::{ event::pointer::{Axis, AxisSource, PointerEvent, PointerEventTrait}, event::Event, Libinput, LibinputInterface, }; use mio::unix::EventedFd; use mio::{event::Evented, Poll, PollOpt, Ready, Token}; use nix::{ fcntl::{open, OFlag}, sys::stat::Mode, unistd...
use crate::error::*; use crate::types::AndroidTarget; use std::path::{Path, PathBuf}; use std::process::Command; #[derive(Debug)] pub struct AndroidNdk { ndk_path: PathBuf, } impl AndroidNdk { pub fn from_env(sdk_path: Option<&Path>) -> Result<Self> { let ndk_path = { let ndk_path = std::e...
use crate::gallformersdb::GallformersDB; use crate::Res; use rusqlite::Connection; use serde_derive::Deserialize; use std::path::PathBuf; #[derive(Deserialize, Debug)] struct TaxonomicAssertion { #[serde(rename = "acceptedNameUsage")] accepted_name_usage: String, #[serde(rename = "acceptedNameUsageID")] ...
//! MIO bindings for Unix Domain Sockets #![cfg(unix)] #![doc(html_root_url = "https://docs.rs/tokio-utun")] extern crate futures; extern crate tokio_io; extern crate log; extern crate bytes; extern crate mio; extern crate mio_utun; extern crate tokio_codec; extern crate tokio_reactor; use std::io::{self, Read, Writ...
use homotopy_common::{declare_idx, graph::Node, idx::IdxVec}; use itertools::{interleave, Itertools}; use crate::{ common::DimensionError, graph::{explode_graph, SliceGraph}, DiagramN, }; declare_idx! { pub struct Element = usize; } pub type Orientation = usize; #[derive(Copy, Clone, Debug)] pub enu...
use std::rc::Rc; use std::cell::RefCell; use std::collections::HashMap; pub fn day23(_input_lines: &[String]) -> (u64, u64) { let input: [usize;9] = [1,8,6,5,2,4,9,7,3]; let part_1_cups = build_cups_array(&input, 9); play_game(&part_1_cups, input[0], 100); let part1 = get_cup_labels_after_1(&part_1_cup...
//! Various lexer utilities use rowan::{TextUnit}; use std::{ fmt, iter, ops::Sub, }; mod consumed; pub use self::consumed::Consumed; /// An error that can occur when lexing #[derive(Debug, Clone, Copy)] pub enum Error { /// An invalid token was detected UnexpectedInput, /// End of file was ...
#![cfg_attr(not(feature="unstable"), allow(dead_code))] use std::cmp::{min, max}; use std::convert::TryInto; use std::future::{Future}; use std::pin::Pin; use std::slice; use std::task::{Poll, Context}; use async_std::io::{self, Read as AsyncRead, ReadExt}; use async_std::stream::{Stream, StreamExt}; use bytes::{Byte...
use falcon_capstone::capstone; use falcon_capstone::capstone::cs_x86_op; use falcon_capstone::capstone_sys::{x86_op_type, x86_reg}; use error::*; use il::*; use il::Expression as Expr; use translator::x86::x86register::{get_register, X86Register}; /// Mode used by translators to pick the correct registers/operations ...
/* This is copied verbatim from https://github.com/armsnyder/aoc2021/. I figured it's better to copy and move on to the next one than abandon this year's edition. There's plenty I can learn from this code as well. Like how he implements From<&str> instead of creating a new() method. */ use std::io::BufR...
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use std::sync::Arc; use super::util::get_fastest_supported_compression_type; use super::{ ColumnFamilyOptions, DBCompressionType, DBIterator, Env, EnvOptions, ExternalSstFileInfo, DB, }; use crate::{CfName, CF_DEFAULT}; use rocksdb::{SstFileReader...
use crate::raw_task::{RawTaskInner, RawTaskInnerRef}; use crate::task_scheduler::{NewTaskStatus, TaskScheduler}; use crate::task_worker::{TaskWorker, WORKER}; use crate::TaskRuntime; use atomic::Atomic; use crossbeam_deque::{Injector, Stealer}; use fimo_tasks_interface::rust::{NotifyFn, RawTask, Result, TaskHandle, Tas...
//! This module provides a thread-safe wrapper class for the Hexchat //! `ListIterator`. The methods it provides can be invoked from threads other //! than the Hexchat main thread safely. use std::sync::Arc; //use std::sync::Mutex; use std::fmt; use crate::list_item::*; use crate::list_iterator::*; use crate::threa...
use crate::util::{self, BResult, Boom}; use std::collections::HashMap; fn is_big_cave(cave: &str) -> bool { cave.chars().nth(0).unwrap().is_uppercase() } type Input = MapGraph; type Map = HashMap<String, Vec<String>>; #[derive(Debug)] struct MapGraph { data: Map, } impl MapGraph { fn from_edges(rows: V...
use crate::assets::glTF::levels::GsglTFNodeEntity; use crate::assets::glTF::asset::{ GsglTFAssetLib, GsglTFPhyLimits }; use crate::assets::error::GltfError; use crate::assets::glTF::material::sampler::GsglTFSamplerData; use crate::assets::glTF::material::texture::GsglTFTextureData; use crate::assets::glTF::primitive...
use crate::Init; use common::{boot::offset, elf::ElfInfo}; use core::{slice, str}; use sys::{FrameBuffer, SyscallCode}; use uefi::proto::console::gop; use x86_64::{ registers::model_specific::LStar, structures::paging::{ FrameAllocator, FrameDeallocator, Mapper, Page, PageTableFlags, PhysFrame, Size4KiB...
pub mod board; use board::Board; use itertools::Itertools; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; #[pyfunction] fn minlex(sudoku_str: &str) -> PyResult<String> { let sudoku = sudoku_str.chars().map(parse_digit).collect::<Vec<u8>>(); if sudoku.len() != 81 { return Err(PyErr::new::<Py...
//! Abstract Human Interface Device Interfaces use core::marker::PhantomData; use frunk::{HCons, HNil, ToRef}; use packed_struct::prelude::*; use usb_device::bus::{InterfaceNumber, StringIndex, UsbBus, UsbBusAllocator}; use usb_device::class_prelude::DescriptorWriter; use crate::hid_class::descriptor::{ Descriptor...
/* * Copyright <NAME> and contributors (c) 2016-2017 * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * ...
// Copyright 2018-2020, Wayfair GmbH // // 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...
#![allow(non_camel_case_types)] #[derive(Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Uop { // Boolean ops Not_z, // Ops that eval to i32 Ctz_i32, Clz_i32, Popcount_i32, Eqz_i32, Complement_i32, // Ops that eval to i64 Ctz_i64, Clz_i64, ...
use itertools::Itertools; const PRIMES: [u64; 15] = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]; const MAX_DIVISOR: usize = 64; struct DivisorSeq { max_number_of_divisors: u64, index: u64, } impl DivisorSeq { fn new(max_number_of_divisors: u64) -> DivisorSeq { DivisorSeq { ...
use log::{error, info, log_enabled, trace, Level::Debug}; use sds_core::{ data_block::{csv_block_creator::CsvDataBlockCreator, data_block_creator::DataBlockCreator}, processing::{ aggregator::Aggregator, generator::{Generator, SynthesisMode}, }, utils::{reporting::LoggerProgressReporter,...
//! Defines [`AppendError`], [`AppendArgs`] and related types. use std::ops::RangeInclusive; use num_traits::Bounded; use num_traits::Zero; use thiserror::Error; use crate::error::ShutDownOr; use crate::invocation::AbstainOf; use crate::invocation::CommunicationErrorOf; use crate::invocation::Invocation; ...
use std::collections::HashMap; use chrono::Weekday; use diesel::result::DatabaseErrorKind; use diesel::result::Error::DatabaseError; use log::error; use num::traits::FromPrimitive; use regex::Regex; use serde::{Deserialize, Serialize}; use std::iter::FromIterator; use strum_macros::{Display, EnumString}; use crate::b...
use std::fmt::Display; use std::panic::{catch_unwind, UnwindSafe}; use crate::ic_manager::IcHandle; use crate::pot::FondueTestFn; use crate::prod_tests::ic::InternetComputer; use crate::prod_tests::test_env::TestEnv; use std::path::{Path, PathBuf}; use std::time::Duration; pub trait PotSetupFn: FnOnce(TestEnv) + Unwi...
pub const PRAGMA_WAL: &'static str = "PRAGMA journal_mode=WAL"; pub const PRAGMA_SYNCHRONOUS_OFF: &'static str = "PRAGMA synchronous=OFF"; /// Node and shard related queries /// Query to create the Nodes table pub const QUERY_CREATE_NODES_TABLE: &'static str = "CREATE TABLE IF NOT EXISTS nodes ( id ...
use std::{ fs::File, io::{self, BufRead, BufReader}, num::ParseIntError, ops::RangeInclusive, }; #[derive(Clone, Debug, Eq, PartialEq)] struct Target { target_x: RangeInclusive<u32>, target_y: RangeInclusive<i32>, } impl Target { fn read(input: &mut dyn BufRead) -> io::Result<Self> { ...
use std::cell::RefCell; use regex::Regex; use enum_as_inner::EnumAsInner; use validator::{Validate, ValidationError}; use std::collections::HashMap; use serde::{Deserialize, Serialize, Deserializer}; use serde::de::Error; use validator_derive::{Validate}; use lazy_static::lazy_static; lazy_static! { static ref RE_...
use crate::actions::Action; use crate::board::Position; use crate::board::piece::PieceKind; use crate::board::Direction; use regex::Regex; pub(crate) struct CLIParser {} pub(crate) type Result<T> = std::result::Result<T, CLIParserError<T>>; impl CLIParser { pub(crate) fn action(s: &str) -> Result<Action> { ...
use std::cmp::max; use crate::{ buffer, escape::{Escape, Terminal}, image, memory::{Block, Heaps}, }; /// Resource manager. /// It can be used to create and destroy resources such as buffers and images. #[derive(Debug, Derivative)] #[derivative(Default(bound = ""))] pub struct Resources<B: gfx_hal::Ba...
use rand::seq::IteratorRandom; use std::fs; use structopt::StructOpt; use text_io::read; use log::{debug, info, warn}; use tinytemplate::TinyTemplate; use common::{GameConfig, Level}; #[derive(Debug, StructOpt)] #[structopt(about = "A script to generate a new level.")] struct Cli { #[structopt(parse(from_os_str),...
pub mod spif { use std::collections::{HashMap}; use itertools::Itertools; use std::cmp::Ordering; use std::fmt::{Display, Formatter, Write, Error}; pub fn parse_pixels(pixels: Vec<u32>, width: u8, height: u8) -> u32 { let layers: HashMap<usize, Vec<u8>> = build_layers(pixels, width, height)...
extern crate sdl2sketch; extern crate rand; use sdl2sketch::*; use rand::Rng; const WIDTH: i32 = 640; const HEIGHT: i32 = 640; const BS: i32 = 2; const NCOLS: i32 = (WIDTH+1) / BS; const NROWS: i32 = (HEIGHT+1) / BS; const INIT_LIFE_PROB: f32 = 0.06; fn index(row: i32, col: i32) -> usize { (row * NCOLS + col) as u...
//! This module contains a UniCode Mapping (`.ucm`) file format parser and all of the data files //! available in the Unicode Consortium's `icu-data` repository. For a list, see [`KNOWN_CHARSETS`]. //! //! Most uses of this library should look like this: //! //! ``` //! use icu_data::ucm::{request_mapping_file, parser:...
use crate::{client::*, config::TargetState, StdResult}; use colored::*; use rusoto_core::Region; use std::fmt; use std::str::FromStr; use tracing::warn; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum ResourceState { Available, Deleted, Failed, Pending, Rebooting, Running, ShuttingDow...
use std::io::{BufRead, Read, Write}; use std::path::Path; use csv; use rusqlite; use csv_utils::string_to_csv_output; use db_utils::{escape_columns, escape_values, AllString}; use errors::{Result, ResultExt}; /// Main struct that parses the CSV and put the data into a SQLite pub struct Executor<W: Write> { conn:...
/* MIT License Copyright (c) 2021 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distrib...
use failure::err_msg; use redis::FromRedisValue; use redis::Value as RedisValue; use rlay_ontology::prelude::*; use serde_json::Value as JsonValue; type StdError = Box<dyn std::error::Error>; #[derive(Debug)] pub struct GetQueryRelationship { pub n_id: u64, n_value: JsonValue, relationship: String, m_...
use super::{ dot::{Arrow, Dot, DotElement, DotShape, Style}, shared::{ElementDetails, LabeledElement, NoteProps}, }; use itertools::Itertools; #[derive(Debug)] pub enum Element<'a> { Note(NoteProps<'a>), Class(&'a str), Connection(Connection<'a>), Inheritance, } impl<'a> LabeledElement for Ele...
use chrono::{NaiveDate, Utc}; use clap_verbosity_flag; use failure::ResultExt; use serde_json; use std::fs::read_to_string; use std::path::PathBuf; use structopt::StructOpt; use ynab_sync::error::{ErrorKind, Result}; use ynab_sync::logging::setup_logging; use ynab_sync::n26::{Cli as N26Cli, Transaction as N26Transactio...
/// use vcell::VolatileCell; #[repr(C)] #[allow(non_snake_case)] struct MibSpiRegisters { GCR0: VolatileCell<u32>, // Global Control 0 GCR1: VolatileCell<u32>, // Global Control 1 INT0: VolatileCell<u32>, // Interrupt Register LVL: VolatileCell<u32>, // Inte...
extern crate path_abs; use super::log; use crate::async_stream::AsyncStream; use crate::compressed_read::*; use crate::meta_info::*; use futures::{future, Future}; use hyper::header::HeaderValue; use hyper::{header, Body, HeaderMap, Method, Request, Response, StatusCode}; use path_abs::{PathDir, PathFile}; type Respo...
use serde::{ser::Error as SerializeError, Serialize, Serializer}; use time::{format_description::well_known::Rfc3339, OffsetDateTime}; /// Indicates the severity of the impact to the affected system. #[derive(Serialize)] #[serde(rename_all = "lowercase")] pub enum Severity { Info, Warning, Error, Criti...
/* Copyright 2019 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, ...
pub const TRUE: u32 = 1; pub const FALSE: u32 = 0; pub const NULL: crate::types::PVOID = core::ptr::null_mut(); pub const FILE_READ_EA: u32 = 0x8; pub const FILE_WRITE_EA: u32 = 0x10; pub const FILE_ATTRIBUTE_NORMAL: u32 = 0x80; pub const FILE_OPEN_IF: u32 = 0x3; pub const GENERIC_READ: u32 = 0x80000000; pub const...
mod completion_config; mod completion_item; mod completion_context; mod presentation; mod patterns; #[cfg(test)] mod test_utils; mod complete_attribute; mod complete_dot; mod complete_record; mod complete_pattern; mod complete_fn_param; mod complete_keyword; mod complete_snippet; mod complete_qualified_path; mod compl...
extern crate phf_codegen; use std::env; use std::fs::File; use std::io::{BufRead, BufReader, BufWriter, Write}; use std::path::Path; use std::collections::HashMap; // Taken from http://www-01.sil.org/iso639-3/download.asp static ISO_TABLE_PATH: &'static str = "iso-639-3.tab"; // Local names of languages from https:/...
use lazy_static::lazy_static; use crate::metrics::{ auto_flush_from, exponential_buckets, linear_buckets, make_auto_flush_static_metric, register_histogram_vec, register_int_counter, register_int_counter_vec, register_int_gauge, register_int_gauge_vec, HistogramVec, IntCounter, IntCounterVec, IntGauge, Int...
use std::{ ffi::c_void, ptr::null, sync::{ atomic::{AtomicPtr, Ordering}, Arc, Mutex, }, }; use anyhow::{anyhow, Result}; use log::*; use protobuf::Message; use std::sync::Once; use tokio::io::{self, AsyncReadExt, AsyncWriteExt}; use tokio::sync::mpsc::{unbounded_channel, UnboundedRecei...
//! Public key structures and algorithms //! //! Definition of public key structure and helpers use ark_ff::{BigInteger, PrimeField}; use bs58; use core::fmt; use sha2::{Digest, Sha256}; use std::ops::Neg; use thiserror::Error; use crate::{BaseField, CurvePoint}; use o1_utils::FieldHelpers; /// Public key errors #[d...
use std::{any::TypeId, array}; use cgmath::{ Point3, prelude::*, }; use crate::{ cast, handle::hsize, prop::Pos3Like, }; pub mod list; pub use list::{DynList, TriList, DiList}; /// An extension traits with useful methods for arrays of common sizes. /// /// Ideally, those methods would exist f...
//! Implements Fuse8 filters. use crate::{fuse_contains_impl, fuse_from_impl, Filter}; use alloc::{boxed::Box, vec::Vec}; use core::convert::TryFrom; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; /// Xor filter using 8-bit fingerprints in a [fuse graph]. Requires less space than an [`Xor8`]. /// ///...
use super::super::{Error, Register, RISCV_MAX_MEMORY, RISCV_PAGESIZE}; use super::{fill_page_data, round_page, Memory, Page}; use bytes::Bytes; use std::cmp::min; use std::marker::PhantomData; use std::ptr; const MAX_PAGES: usize = RISCV_MAX_MEMORY / RISCV_PAGESIZE; const INVALID_PAGE_INDEX: u16 = 0xFFFF; /// A spar...
use bootloader::bootinfo::{BootInfo, FrameRange, MemoryMap, MemoryRegion, MemoryRegionType}; use lazy_static::lazy_static; use spin::Mutex; use x86_64::{ structures::paging::{ FrameAllocator, Mapper, PageTable, PageTableFlags, PhysFrame, PhysFrameRange, RecursivePageTable, Size4KiB, }, PhysA...
use crate::bindings::{ vm_parameters_destroy, vm_parameters_parse, VMParameterVector as NativeVMParameterVector, VMParameters as NativeVMParameters, }; use crate::parameter_vector::{ImageParameters, VirtualMachineParameters}; use crate::prelude::{Handle, NativeAccess, NativeDrop}; use std::ffi::{CStr, CString};...
/// 块缓存层,用于 FAT32 的保留扇区和 FAT 表 use super::{BlockDevice, RunFileSystem, INFOSEC_CACHE_SZ, MAX_SEC_SZ}; use lazy_static::*; use spin::RwLock; use std::collections::VecDeque; use std::sync::{Arc, Weak}; // 在本系统设计中, BlockCache 块缓存被认为是硬件存储的最小分配单元,逻辑上来说不是文件系统读取的最小单位. pub struct BlockCache { cache: Vec<u8>, sector_id...
use crate::sequence::Sequence; use crate::mutator::Mutator; use std::collections::HashMap; struct NNode { children: Vec<NNode>, id: Option<String>, branch_length: f64, sequence: Option<Sequence> } impl NNode { fn new_empty() -> NNode { NNode { children: Vec::<NNode>::new(), ...
use super::{gl_error, TextureId}; use crate::console::log; use crate::prelude::embedding; use crate::Result; use bracket_color::prelude::RGB; use glow::HasContext; use image::GenericImageView; #[derive(PartialEq, Clone)] /// BTerm's representation of a font or tileset file. pub struct Font { pub bitmap_file: Strin...
// Copyright 2018 Parity Technologies (UK) Ltd. // // 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, mer...