text
stringlengths
3.09k
13.9k
use cpu_v1::fluid_object::{DensColor, FluidCube}; use nannou::prelude::*; use nannou_egui::{self, egui, Egui}; fn main() { nannou::app(model).update(update).run(); } struct Settings { scale: f32, dens_opt: DensOpt, vel_opt: VelOpt, dt: f32, iter: usize, } struct Model { fluid: FluidCube, ...
/* * Copyright 2021 Code Dx, 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...
use std::fmt; use std::path::{Path, PathBuf}; use std::pin::Pin; use async_trait::async_trait; use bytes::Bytes; use futures::{Stream, StreamExt}; use dap2::dds::DdsVariableDetails; use hidefix::idx; mod das; pub(crate) mod dds; /// HDF5 dataset source. pub struct Hdf5Dataset { path: PathBuf, idxkey: String...
use std::ffi::OsStr; use std::io::Error as IoError; use std::io::ErrorKind; use std::mem::size_of; use std::ops::Deref; use std::path::Path; use std::path::PathBuf; use std::slice; use std::sync::Arc; use libc::c_void; use tracing::debug; use tracing::trace; use pin_utils::unsafe_unpinned; use fluvio_future::fs::mmap...
use std::{ borrow::Cow, io::{self, Write as _}, }; use std::{ ffi::OsString, process::{Child, ExitStatus}, sync::{Arc, Mutex}, }; use std::{path::PathBuf, process::Command}; use std::{process::Stdio, str::FromStr}; use clap::{AppSettings, Parser}; use crossterm::{ style::{Attribute, SetAttribut...
use async_trait::async_trait; use opentelemetry::{ propagation::TextMapPropagator, sdk::{ export::trace::{SpanData, SpanExporter}, propagation::{BaggagePropagator, TextMapCompositePropagator, TraceContextPropagator}, trace::{Tracer, TracerProvider}, }, trace::{SpanContext, TraceC...
use std::vec::Vec; #[derive(Debug)] pub struct Edge { source: i64, destination: i64, cost: i64, } impl PartialEq for Edge { fn eq(&self, other: &Self) -> bool { self.source == other.source && self.destination == other.destination && self.cost == other.cost } } impl...
use std::fmt::{Display, Formatter, Result as FmtResult}; use thiserror::Error as ErrorTrait; use tonic::Status; use crate::data::{BobKey, VDiskId}; #[derive(Debug, Clone, ErrorTrait)] pub struct Error { ctx: Kind, } impl Error { fn new(ctx: Kind) -> Self { Self { ctx } } pub fn kind(&self) -...
//! The `BeaconProposer` cache stores the proposer indices for some epoch. //! //! This cache is keyed by `(epoch, block_root)` where `block_root` is the block root at //! `end_slot(epoch - 1)`. We make the assertion that the proposer shuffling is identical for all //! blocks in `epoch` which share the common ancestor ...
use crate::exporters::Exporter; use crate::sensors::{utils::ProcessRecord, Sensor, Topology}; use std::collections::HashMap; use std::{fs, io, thread, time}; /// An Exporter that extracts power consumption data of running /// Qemu/KVM virtual machines on the host and store those data /// as folders and files that are ...
use ash::vk::TRUE; use ash::{ extensions::khr::{Surface, Swapchain}, version::{InstanceV1_0, InstanceV1_1}, vk::{ PhysicalDeviceDescriptorIndexingFeatures, PhysicalDeviceFeatures2, PhysicalDeviceProperties, PhysicalDeviceType, QueueFlags, SurfaceKHR, }, Instance, }; use std::collecti...
use std::{ ffi::OsStr, fs::read_to_string, path::{Path, PathBuf}, }; use assert_cmd::Command; use insta::assert_snapshot; use tempfile::{tempdir, TempDir}; struct TestContext { command: Command, home_directory: TempDir, home_directory_display: String, working_directory: TempDir, workin...
use crate::project::Project; /// Enum used for the `demangling` option in `Config`. #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum Demangling { /// Don't try to demangle NoDemangling, /// Try to demangle using the C++ demangler (suitable for `Project`s containing C++ code). /// Names that fail t...
/*! Creates lifecycle # Example ```no_run use { anf::engine::time::GameClock, sdl2::EventPump, }; fn tick_one_frame( clock: &mut GameClock, events: &mut EventPump, ) { for ev in events.poll_iter() { // handle events } for dt in clock.tick() { // update your game } ...
// Copyright 2019 Cargill Incorporated // // 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 crate::messaging::HandlerFnRef; use crate::messaging::Message; use crate::actor::Actor; use crate::type_registry::ShortTypeId; use crate::actor_system::{World, MAX_MESSAGE_TYPES}; use crate::id::{broadcast_instance_id, RawID, TypedID}; use crate::messaging::{Fate, Packet}; use crate::tuning::Tuning; use compact::Co...
use macros::{fmt_display}; use proptest::prelude::*; use proptest::collection; const FUNCTION_SIZE_ESTIMATE: usize = 128 + PARAM_SIZE_ESTIMATE; const PARAM_SIZE_ESTIMATE: usize = 64; prop_compose! { /// This should be produce Strings which are syntactically valid rust code /// but which will likely produce wa...
use auto_ops::*; use std::{f32, fmt}; /// A vector in ℝ³. #[derive(Debug, Default, Clone, Copy, PartialEq)] pub struct Vect3(pub f32, pub f32, pub f32); impl Vect3 { /// Return the zero-length vector. pub fn zero() -> Vect3 { Vect3::default() } /// The x coordinate of the vector. pub fn x...
use boolua_common::{Span, Spanned, WithSpan}; use logos::Logos; use std::iter::{self, Once}; use std::slice; // Original code by kestrer! :) pub fn normalize_newlines(bytes: &mut Vec<u8>) { let len = bytes.len(); let mut del = 0; for i in 0..len { if bytes[i..].starts_with(b"\r\n") || bytes[i..]...
use std::{ffi::c_void, mem}; use cgmath::Point3; use gl::types::{GLfloat, GLsizei, GLsizeiptr}; use crate::{ define_gl_primitive, draw, model::register_primitive, shader::{image_shader::ImageShader, point_shader::PointShader}, }; use super::GLPrimitive; const DEFAULT_POINTS_SHADER_KEY: &str = "points"; ...
/* * Copyright 2018 ProximaX Limited. All rights reserved. * Use of this source code is governed by the Apache 2.0 * license that can be found in the LICENSE file. */ use { crypto::{Keypair, SecretKey}, rand::{rngs::ThreadRng, thread_rng}, std::fmt, }; use crate::{ helpers::{hex_decode, hex_encode...
#![allow( clippy::unreadable_literal, clippy::upper_case_acronyms, dead_code, non_camel_case_types, non_snake_case, non_upper_case_globals, overflowing_literals, unused_variables, unused_assignments )] use crate::bcossdk::commonhash::{CommonHash, HashType}; use crate::bcossdk::kisserror::{KissErrKind, KissError}; use ...
use std::collections::HashMap; use std::fs; use std::fs::File; use std::io::Write; use std::path::Path; use std::sync::{Arc, Mutex, MutexGuard}; use std::thread; use anyhow::{anyhow, bail, Error, Result}; use regex::Regex; use serde::{Deserialize, Serialize}; use tera::{to_value, try_get_value, Context, Tera, Value}; ...
mod items; mod langs_strs; use std::{convert::Infallible, env, net::SocketAddr}; use teloxide::dispatching::update_listeners; use teloxide::prelude::*; use teloxide::types::ParseMode; use teloxide::utils::command::{BotCommand, ParseError}; use teloxide::utils::markdown::{code_inline, escape}; use teloxide::BotBuilder...
use clap::{App, Arg, SubCommand}; use colored::*; use std::ffi::OsStr; use std::fs::File; use std::io::Write; use std::path::Path; use std::process::exit; use std::process::Command; use tempfile::tempdir; use which::which; fn generate_manifest() -> String { return String::from( r#"<?xml version="1.0" encod...
use serde; use plugin::*; use errors::*; use std::sync::Arc; use std::cell::RefCell; use std::rc::Rc; use std::fs; use std::io::Read; use toml; use num_cpus; use futures_cpupool::*; use tokio_core; use std::time::Duration; pub struct Config { /// Number of threads to configure in thread pool. threads: usize, ...
mod perlin; pub fn make_perlin_image( random: Perlin, width: u32, height: u32, grid_width: u32, grid_height: u32, ) -> image::GrayImage { let mut raw = Vec::new(); raw.reserve(width as usize * height as usize); for y in 0..height { for x in 0..width { raw.push( ...
use std::collections::HashMap; use matching::Match; use parsing::Occurrences; use scoring::Scoring; use crate::{ parsing::{build_occurrences, process_query, Occurrence, QueryChar, QueryChars}, scoring::DEFAULT_SCORING, }; /// Describes a fuzzy search. Alternative to [`best_match`](crate::best_match) which al...
#![feature(unsafe_block_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)] // SPDX-FileCopyrightText: 2021 <NAME> // // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT use std::io::{stdout, Write}; //use basic_timing_cache_channel::{naive::NaiveTimingChannel, TopologyAwareTimingChannel}; use basic_t...
use backend::obj; use backend::obj::*; use backend::world::agent; use core::clock::Seconds; use core::geometry::Transform; use core::geometry::*; use core::math; use core::math::ExponentialFilter; use num::Zero; #[derive(Clone)] pub enum PilotRotation { None, Orientation(Position), LookAt(Position), Turn(Angle), ...
use crate::autodiff::var::Var; use crate::layers::activations::{LeakyRelu, Relu, Sigmoid, Tanh}; use crate::layers::base::Sequential; use crate::layers::convolutional::{Conv2d, TransposedConv2d}; use crate::layers::normalization::BatchNorm2d; use crate::layers::{gather_params, Parameter, Stackable}; #[derive(Clone, Co...
// Copyright 2019 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. //! Overnet daemon for Fuchsia #![deny(missing_docs)] mod mdns; mod serial; use anyhow::Error; use argh::FromArgs; use fidl_fuchsia_overnet::{ MeshC...
use std::collections::{BTreeMap, HashMap}; use std::sync::{Arc, Mutex}; use rand::{Rng, SeedableRng}; use rand::rngs::StdRng; use crate::fsm::Card; use crate::game::{ALL_CARDS, Settings}; use crate::run::{ALL_BOT_TYPES, BotType, run_game_with_bots}; #[derive(Default, Clone)] pub struct Stats { games: usize, ...
use syn; use options::{OptionsBuilder, OptionsBuilderMode, FieldOptions}; use derive_builder_core::{DeprecationNotes, Bindings}; #[derive(Clone, Debug)] pub struct FieldMode { field_ident: syn::Ident, field_type: syn::Ty, setter_attrs: Option<Vec<syn::Attribute>>, deprecation_notes: DeprecationNotes, ...
//! This library provides data types for [zuul-ci](https://zuul-ci.org). //! //! # Installation //! //! Add this to your `Cargo.toml`: //! //! ```toml //! [dependencies] //! zuul-build = "0.1" //! ``` //! use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use url::Url; /// A Build result. #[derive(Seria...
use super::common::read_file; use std::borrow::Borrow; use std::cell::RefCell; use std::cmp::Ordering; use std::collections::{BinaryHeap, HashMap, HashSet}; use std::rc::Rc; pub fn part1() -> u32 { let path = "test_files/15.txt".to_string(); let lines = read_file(path); let (graph, max_x, max_y) = create_g...
mod cli; #[macro_use] extern crate serde_json; use itertools::Itertools; use regex::Regex; use std::collections::HashMap; use std::fs::File; use std::io; use structopt::StructOpt; fn main() { let args = cli::CommandLineArgs::from_args(); let mut role_definition = match File::open(args.base_definition_filepath) ...
use super::{percent_text, ProgressWindow, WindowConfig, UPDATE_INTERVAL}; use crate::Progress; use crossbeam_channel::{unbounded, Receiver, Sender}; use log::error; use nwg::NativeUi; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; type CommType = Box<dyn Fn(&ProgressApp) + Send + 'static>; #[deriv...
use crate::database::DatabaseClient; use std::env; use std::fmt::Debug; use std::marker::Send; use async_trait::async_trait; use reqwest::{self, header}; use serde::Serialize; pub static ENV_VAR_SUPABASE_HOST: &str = "OGK_SUPABASE_HOST"; pub static ENV_VAR_SUPABASE_API_KEY: &str = "OGK_SUPABASE_API_KEY"; #[derive(D...
pub use crate::backend::{Buffer, BufferView, MappableBuffer}; use crate::{ access::AccessFlags, align_up, encode::Encoder, queue::{Ownership, QueueId}, stage::PipelineStageFlags, Format, }; bitflags::bitflags! { /// Flags to specify allowed usages for buffer. #[cfg_attr(feature = "serde...
use std::{collections::HashSet, error::Error}; use rewind_cli::{cli::Rewind, fuzz, mem, mutation, trace}; #[derive(Default)] struct AllocatedBuffer { address: u64, size: u64, location: u64 } struct ExAllocatePoolWithTag { address: u64, allocs: Vec<AllocatedBuffer>, return_addresses: HashSet<...
const ALL_SERVICES: [&str; 9] = [ "chat", "auth", "profile", "emote", "harmonytypes", "voice", "sync", "mediaproxy", "batch", ]; fn main() { #[allow(unused_mut)] let mut builder = hrpc_build::configure(); let mut protos = Vec::with_capacity(12); #[cfg(feature = "ge...
use std::{future::Future, thread}; use ::tokio::{ runtime::{Builder, Handle, Runtime}, task, }; use futures::future::pending; use once_cell::sync::OnceCell; use pyo3::prelude::*; use crate::generic; /// <span class="module-item stab portability" style="display: inline; border-radius: 3px; padding: 2px; font-...
use std::collections::HashMap; use crate::{ response::list::{List, Namespaces, Querypage}, Client, Error, }; type Result<T, E = Error> = core::result::Result<T, E>; pub async fn allcategories(client: &Client) -> Result<Vec<String>> { get_from_api(client, "allcategories", "ac", None).await } pub async fn...
// Copyright 2020 The Chubao Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to...
use std::borrow::Cow; use super::{html, lib, GlobalArgs, Output, PageArgs, PageConfig, RenderOnce}; use crate::{CategoryId, ChannelId, EmojiId, GuildId, UserId}; pub fn render<'t, Cat, ICatChan>( global: &'t GlobalArgs, page: PageArgs<'t, impl PageConfig>, guild: Guild<'t>, groups: Cat, current_gr...
//! # 工具模块 //! //! 工具模块中包含一些简单的函数。 #![allow(deprecated)] use std::{ env, ffi::OsStr, fmt::Display, fs::read_to_string, io, path::{Path, PathBuf}, process::{self, Command, Output, Stdio}, sync::mpsc, thread, time::{Duration, SystemTime}, }; use crate::constants::{CARGO_CONFIG_P...
#[cfg(test)] mod tests; use std::{ error::Error, fs, path::{ Path, PathBuf, }, }; use once_cell::unsync::OnceCell; use crate::{ app, engine, }; struct Renamee<'a> { path: &'a Path, old: String, indices: Vec<(usize, usize)>, new: OnceCell<String>, new_path:...
#[allow(unused, dead_code)] use chrono::*; use datamodel::Schema; use migration_connector::*; use prisma_query::{ast::*, visitor::*}; use rusqlite::{Connection, Row}; use serde_json; pub struct SqlMigrationPersistence { connection: Connection, } impl SqlMigrationPersistence { pub fn new(conn: Connection) -> S...
//! Rsync-like library/program. //! //! syncfast is intended to provide the functionality of rsync ("live" transfer //! of files/directories over SSH), rdiff (creation of binary patches between //! files, for later application), and zsync (efficient synchronization of //! files or file trees from a central "dumb" HTTP ...
use std::hash::Hasher; use byteorder::{LittleEndian, ByteOrder}; use std::io::Read; use std::error::Error; pub struct MurmurHasher{ h1: u64, h2: u64, buf: [u8; 16], index: usize, processed: usize } impl Default for MurmurHasher { fn default() -> Self{ MurmurHasher{ h1: 0, ...
use bevy::prelude::*; use core::convert::From; use core::ops::{Add, AddAssign, Sub, SubAssign}; use std::{ cmp::{Ordering, PartialEq, PartialOrd}, marker::PhantomData, }; use crate::abilities::{usability::Usable, Abilities, Ability, AbilityLabel, AbilityState}; pub trait ResourcePoolExt { fn add_resource_...
mod check; mod database_inspection_results; mod destructive_change_checker_flavour; mod destructive_check_plan; mod unexecutable_step_check; mod warning_check; pub(crate) use destructive_change_checker_flavour::DestructiveChangeCheckerFlavour; use crate::{ sql_schema_differ::{ColumnDiffer, DiffingOptions}, sq...
extern crate proc_macro; use std::collections::HashMap; use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, Expr, ExprLit, Fields, ItemEnum, ItemStruct, Lit}; #[proc_macro_derive(MCPEPacketDataAuto)] pub fn derive_answer_fn(stream: TokenStream) -> TokenStream { let parsed = parse_macro_inp...
// Copyright 2018 Google LLC // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
use crate::{ForwardTransformExt, InverseTransformExt}; use ndarray::{prelude::*, s}; use num_traits::{cast::NumCast, Num, NumAssignOps}; use rustfft::num_complex::Complex; use rustfft::{FFTplanner, FFT}; use std::sync::Arc; pub trait FftShiftExt { fn fftshift_inplace(&mut self); fn fftshift(&self) -> Sel...
use std::collections::HashMap; use crate::token; use crate::token::Token; use crate::error_reporter::ERROR_REPORTER; lazy_static! { static ref KEYWORDS: HashMap<&'static str, token::Type> = { let mut m = HashMap::new(); m.insert("and", token::Type::And); m.insert("class", token::Type::Clas...
//! Operations on a Pids subsystem. //! //! [`Subsystem`] implements [`Cgroup`] trait and subsystem-specific operations. //! //! For more information about this subsystem, see the kernel's documentation //! [Documentation/cgroup-v1/pids.txt]. //! //! # Examples //! //! ```no_run //! # fn main() -> controlgroup::Result<...
// TODO: Remove this allow #![allow(dead_code)] use std::alloc::{alloc, dealloc, Layout}; use std::mem::{align_of, size_of, transmute}; use std::ops::Deref; use std::ptr::{self, NonNull}; use std::slice; const SIZE: usize = 2 * 64 * 1024; const ALIGN: usize = 64; const LAYOUT: Layout = unsafe { Layout::from_size_align...
use render::*; #[derive(Clone)] pub struct TabClose{ pub bg: Quad, pub text: Text, pub animator:Animator, pub anim_over:Anim, pub anim_down:Anim, pub margin:Margin, pub _hit_state:HitState, pub _is_down:bool, pub _bg_area:Area, } impl ElementLife for TabClose{ fn construct(&mu...
use std::collections::HashMap; use proc_macro2::TokenStream; use crate::{meta::{ FinnyEvent, FinnyFsm, FinnyRegion, FinnyState, FinnyStateKind, FinnyTimer, FinnyTransition, FinnyTransitionKind, FinnyTransitionNormal, }, parse::{FsmFnInput, FsmState, FsmStateKind, FsmTransitionState}, utils::{strip...
use super::*; use crate::helpers::construction::constraints::create_constraint_pipeline_with_module; use crate::helpers::models::domain::create_empty_solution_context; use crate::helpers::models::problem::*; use crate::helpers::models::solution::*; use crate::models::common::ValueDimension; use crate::models::problem::...
use std::cmp::Ordering; use std::collections::{HashSet, VecDeque}; use std::hash::{Hash, Hasher}; use indexmap::IndexSet; use crate::grammar::{Grammar, Symbol}; use crate::util::{self, AsString}; use super::item::Item; use super::transition::ItemTransition; use super::Automaton; /// The `State` struct describes a s...
#![cfg_attr(target_os = "none", no_std)] #![cfg_attr(not(target_os = "none"), allow(dead_code))] #![cfg_attr(not(target_os = "none"), allow(unused_imports))] #![cfg_attr(not(target_os = "none"), allow(unused_variables))] pub mod api; pub use api::*; use xous::{send_message, CID, Message, msg_scalar_unpack}; use xous_...
use super::super::prelude::*; use super::util::*; use super::VWS; use crate::user_interface::Interface; use crate::user_interface::util::imgui_decimal_text_field; use crate::user_interface::util::imgui_decimal_text_field_f64; use glifparser::glif::{CapType, ContourOperations, JoinType}; fn join_type_to_idx(jt: JoinTyp...
use std::error::Error; use std::fs::File; //use std::io::prelude::*; use crate::game::{Boost, Game, Producer, Upgrade}; pub fn game_from_csv(csv_file: &str) -> Result<Game, Box<dyn Error>> { let file = File::open(csv_file)?; let mut rdr = csv::ReaderBuilder::new() .has_headers(false) .from_rea...
#![allow(non_camel_case_types)] #![allow(dead_code)] #![allow(missing_copy_implementations)] use crate::cassandra::data_type::ConstDataType; use crate::cassandra::error::*; use crate::cassandra::row::Row; use crate::cassandra::util::Protected; use crate::cassandra::value::ValueType; use crate::cassandra_sys::cass_fal...
use proc_macro2::TokenStream as TokenStream2; use quote::quote_spanned; use syn::spanned::Spanned as _; pub fn generate(input: TokenStream2) -> TokenStream2 { match generate_or_error(input) { Ok(output) => output, Err(err) => err.to_compile_error(), } } fn generate_or_error(input: TokenStream2...
//! this module manages reading and translating //! the arguments passed on launch of the application. pub mod clap_args; mod app_launch_args; mod install_launch_args; pub use { app_launch_args::*, install_launch_args::*, }; use { crate::{ app::{App, AppContext}, conf::Conf, displ...
#[derive(Debug)] struct GridCell { mined: bool, flagged: bool, hidden: bool, neighbors: u8, i: u16, j: u16, } impl GridCell { fn new(mined: bool, i: u16, j: u16) -> GridCell { GridCell { mined, flagged: false, hidden: true, neighbors:...
use crate::application::APP; use abscissa_core::{clap::Parser, status_err, Application, Command, Runnable}; use clarity::Uint256; use cosmos_gravity::send::{send_request_batch_tx, send_to_eth}; use deep_space::coin::Coin; use ethers::types::Address as EthAddress; use gravity_proto::gravity::DenomToErc20Request; use gra...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
//! calculate and collect rent from Accounts use solana_sdk::{ account::{AccountSharedData, ReadableAccount, WritableAccount}, clock::Epoch, epoch_schedule::EpochSchedule, genesis_config::GenesisConfig, incinerator, pubkey::Pubkey, rent::Rent, sysvar, }; #[derive(Serialize, Deserialize,...
//! Streams which keep a running CRC32 digest of the data that passes through them. use crc32c::crc32c_append; use futures::TryStream; use std::{pin::Pin, task::Poll}; use tokio::sync::oneshot; use crate::common::*; /// A GCloud-compatible CRC32C hasher. /// /// This uses a popular Rust `Hasher`-style API to wrap a ...
use crate::types::{ AppState, Body, BrowseResponse, DidlLite, Envelope, ListItemWrapper, CONTENT_DIRECTORY_XMLNS, ENVELOPE_ENCODING_STYLE, ENVELOPE_XMLNS, ENVELOPE_XMLNS_S, XMLNS_DC, XMLNS_DIDL, XMLNS_UPNP, }; use crate::util::read_directory; use actix_files::NamedFile; use actix_web::{ get, post, web::...
use crate::error::Error; use crate::msgs::alert::AlertMessagePayload; use crate::msgs::base::Payload; use crate::msgs::ccs::ChangeCipherSpecPayload; use crate::msgs::codec::{Codec, Reader}; use crate::msgs::enums::HandshakeType; use crate::msgs::enums::{AlertDescription, AlertLevel}; use crate::msgs::enums::{ContentTyp...
use crate::deps::{ log::{ debug, error, info, warn, }, nix::sys::mman::{ mmap, munmap, MapFlags, ProtFlags, }, }; use std::{ borrow::Cow, fs::{ File, OpenOptions, }, mem::ManuallyDrop, os::unix::io::AsRaw...
// Copyright 2019 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. #![feature(async_await, await_macro, futures_api)] use failure::{format_err, Error, ResultExt}; use fdio; use fidl_fuchsia_hardware_ethernet as zx_eth; us...
use graphql_parser::{query as q, schema as s}; use std::collections::HashMap; use std::iter; use std::result::Result; use std::time::{Duration, Instant}; use graph::prelude::*; use tokio::sync::Semaphore; use crate::execution::*; use crate::schema::ast as sast; use lazy_static::lazy_static; lazy_static! { stati...
// Copyright 2020 <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 writi...
/* Copyright 2017 <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 crate::{ cmd::{self, Result}, input, log, models::{self, CMD_LIST_CREATE, CMD_LIST_DELETE, CMD_LIST_UPDATE}, sqlite, utils, Context, }; pub fn create(ctx: &mut Context) -> Result<()> { let mut title: Option<String> = None; let mut description: Option<String> = None; if let Some(value) ...
//! # aHash //! //! This hashing algorithm is intended to be a high performance, (hardware specific), keyed hash function. //! This can be seen as a DOS resistant alternative to `FxHash`, or a fast equivalent to `SipHash`. //! It provides a high speed hash algorithm, but where the result is not predictable without know...
use crate::storage_contract::{ProofStatus, STORAGE_ACCOUNT_SPACE}; use crate::{id, rewards_pools}; use serde_derive::{Deserialize, Serialize}; use solana_sdk::hash::Hash; use solana_sdk::instruction::{AccountMeta, Instruction}; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Signature; use solana_sdk::system...
extern crate intcode_computer_lib; use std::fs::{File}; use std::io::{Read}; use std::thread; use intcode_computer_lib::IntcodeComputer::*; fn main() { let mut file_contents = read_file("input.txt"); //let mut noun = 0; //let mut verb = 0; let mut working_input_chars = file_contents.clone().trim()...
extern crate hyper; extern crate rustc_serialize; use std::io::Read; use std::io::BufReader; use std::io::Write; use std::io::BufWriter; use std::path::Path; use std::fs::OpenOptions; use hyper::Client; use hyper::header::Connection; use rustc_serialize::json; use std::string::String; use std::collections::HashMap; ...
use termion::event::Key; use std::collections::HashMap; use crate::coordinates::Coordinates; use crate::fail::{ErrorLog, HError, HResult}; use crate::term; use crate::widget::{Widget, WidgetCore}; #[derive(PartialEq, Eq, Clone, Debug)] pub struct Bookmarks { mapping: HashMap<char, String>, } impl Bookmarks { ...
use std::fmt; use crate::{Interpolator}; /// Describes a color #[derive(Copy, Clone)] #[repr(packed)] pub struct Color { pub data: u32, } impl Color { // Create a new color from RGB pub const fn rgb(r: u8, g: u8, b: u8) -> Self { Color { data: 0xFF00_0000 | ((r as u32) << 16) | ((g as...
extern crate hyper; extern crate futures; use hyper::{Get, StatusCode, Body, Headers}; use futures::{future, Future, Stream}; use hyper::header::ContentLength; use std::rc::Rc; use hyper::server::{Request, Response, Service}; use db::Database; use error::Error; use types::*; const MOVIES: &str = "/api/movies"; const...
#![no_std] #![feature(generic_associated_types)] #![feature(asm)] #![feature(min_type_alias_impl_trait)] #![feature(impl_trait_in_bindings)] #![feature(type_alias_impl_trait)] #![allow(incomplete_features)] #[cfg(not(any( feature = "nrf51", feature = "nrf52805", feature = "nrf52810", feature = "nrf5281...
use crate::lang::Language; use crate::StdErr; use ini::{Ini, Properties, SectionSetter}; use platform_dirs::AppDirs; use std::fs; use std::io; use std::path::PathBuf; /// A configuration interaction layer. /// /// The associated methods wrap the Ini struct from [rust-ini], and construct /// errors and return values th...
use crate::cnf::*; use crate::legend::*; use crate::loader::*; use crate::prover::*; use crate::skolem::*; use rand::seq::SliceRandom; use std::collections::HashMap; use std::env; use std::fs; use std::time::Instant; pub struct ProblemSet { loader: Loader, skolemizer: Skolemizer, legend: Legend, // St...
use acfunliveapi::{ client::ApiClientBuilder, response::{Gift, GiftList}, }; use acfunlivedanmaku::{client::*, danmaku::*, Result}; use futures::StreamExt; use std::{collections::HashMap, convert::TryInto, env, time::Duration}; use tokio::time::timeout; #[tokio::main] async fn main() -> Result<()> { env_lo...
/// Implementation of the test service. use crate::db::{ObserverType, SettingsDb}; use crate::generated::common::*; use crate::generated::service::*; use common::core::BaseMessage; use common::threadpool_status; use common::traits::{ CommonResponder, DispatcherId, EmptyConfig, OriginAttributes, Service, SessionSupp...
use indexmap::set::IndexSet; use std::collections::HashMap; /// Returns a list of simple-type enumeration values that are mapped to something different in the /// generated code. pub fn enum_member_substitutions() -> HashMap<String, String> { let mut substitutions = HashMap::new(); // for better or worse, i ch...
use brotli2::{CompressMode as BrotliCompressMode, CompressParams as BrotliCompressParams}; use flate2::write::{DeflateEncoder, GzEncoder}; use flate2::Compression as Flate2Compression; use iron::headers::{QualityItem, Encoding}; use bzip2::Compression as BzCompression; use brotli2::write::BrotliEncoder; use std::collec...
//! @dev This implements an optional extension of {ERC721} defined in the EIP that adds //! enumerability of all the token ids in the contract as well as all token ids owned by each //! account. use crate::{ Impl as ERC721, Result, TokenId, }; use metis_lang::{ Env, Storage, }; #[cfg(not(feature ...
use ckb_jsonrpc_types::Script; use ckb_types::H256; use gw_jsonrpc_types::{ ckb_jsonrpc_types::{JsonBytes, Uint128, Uint32}, godwoken::{RunResult, TxReceipt}, }; use std::{u128, u32}; type AccountID = Uint32; pub struct GodwokenRpcClient { url: reqwest::Url, client: reqwest::blocking::Client, id: ...
//! A strict query engine implementation. It always expects a strict match of query terms use std::collections::BTreeMap; use std::ops::RangeInclusive; use std::sync::Arc; use tokio::sync::RwLock; use tracing::{debug, instrument, trace}; use crate::search::{Matches, Search, SearchOptions}; /// Implements strict que...
#![allow(dead_code)] #![deny(unused_must_use)] use std::format; use std::{env, fs, path::PathBuf}; use std::path::Path; use walkdir::WalkDir; use xshell::{cmd, Cmd}; use yaml_rust::YamlLoader; extern crate yaml_rust; fn main() -> Result<(), anyhow::Error> { let args = env::args().skip(1).collect::<Vec<_>>(); ...