text
stringlengths
3.09k
13.9k
// Copyright (C) 2017-2018 Baidu, Inc. 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 // notice, this list of condit...
mod process; use process::{Process, ProcessError}; use crate::config::recorder_config::RecorderConfig; use crate::server::client::{Client, ClientResult, PidRecv, Productive, Running}; use tokio::task::JoinError; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::path::Path; use std::...
//! DC Blocker use crate::filter::Window; /// DC-Blocking Filter /// /// This filter removes DC offsets from the input signal /// while preserving the higher-frequency components. It /// uses `len` feedforward taps and `len` feedback taps /// to estimate the DC offset. /// /// This is the dual moving-average implemen...
/* * Copyright 2019 The Starlark in Rust Authors. * Copyright (c) Facebook, Inc. and its affiliates. * * 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/lic...
// 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...
use crate::blob::Blob; use crate::commit::{Commit, Identity}; use crate::error::Result; use crate::object::Object; use crate::oid::Oid; use crate::tree::{Mode, Name, Tree, TreeEntry}; use chrono::offset::FixedOffset; use chrono::TimeZone; use flate2::bufread::ZlibDecoder; use std::io::BufRead; use std::io::BufReader; ...
use na::{DVector, RealField}; use std::ops::Range; use crate::joint::JointConstraint; use crate::math::{AngularVector, Point, Rotation, ANGULAR_DIM}; use crate::object::{Body, BodyHandle, BodyPartHandle, BodySet}; use crate::solver::helper; use crate::solver::{ GenericNonlinearConstraint, IntegrationParameters, Li...
use super::super::Context; use crate::libraries::resources::ResourceManagerProvider; use crate::libraries::{ helpers::{keys, lua}, resources::ResourceManager, }; use crate::with_shared_redis_resource; use anyhow::Result; use async_trait::async_trait; use chrono::Utc; use jatsl::{Job, TaskManager}; use log::{deb...
use std::collections::HashMap; use async_std::{ fs::File, io::{self, prelude::WriteExt, Write}, task, }; use crate::{ consts, http::{ headers::Headers, request::{HttpVersion, Method, Request}, response::{Response, Status}, uri::Uri, }, util, }; // The body ...
#![deny(clippy::all)] #[macro_use] extern crate napi_derive; use napi::{ threadsafe_function::{ThreadSafeCallContext, ThreadsafeFunctionCallMode}, CallContext, Env, JsFunction, JsNumber, JsObject, JsUndefined, Property, Result, Task, }; use std::convert::TryInto; #[cfg(all( any(windows, unix), target_arch = ...
use super::{stats, utils::*, writer::*, AreaStore, DATA_FOLDER_NAME}; use crate::error::{AreaStoreError, Result}; use crate::store::file_index::FileIndex; use arrow_deps::arrow::record_batch::*; use arrow_deps::datafusion::parquet::arrow::async_reader::ParquetRecordBatchStreamBuilder; use arrow_deps::datafusion::{ ...
// Copyright Rivtower Technologies 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
use anyhow; use gdnative::api::Resource; use gdnative::prelude::*; use libchum::{self, archive}; use std::collections::HashMap; use std::fs::File; #[macro_use] pub mod macros; #[macro_use] pub mod util; pub mod bytedata; pub mod chumfile; pub mod names; pub mod reader; pub mod scenedata; pub mod views; #[derive(Nativ...
use anyhow::Result; use classic_crypto::lang::Lang; use directories::ProjectDirs; use log::{debug, trace}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, fs, io::Read, path::PathBuf}; use crate::error::CipherError; const QUALIFIER: &str = ""; const ORGANISATION: &str = ""; const APPLICATION: &st...
use c2::{prelude::*, Circle, Poly}; use opencv::{core::*, imgproc::*, types::*}; use rand::Rng; use crate::graphics::*; #[derive(Debug)] pub enum Player { Left, Right, } pub struct Game { size: Size, ball: Ball, score: Score, reset: bool, single_player: bool, graphics: Graphics, } im...
use rand::prelude::*; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::keyboard::Scancode; use sdl2::pixels::Color; use sdl2::rect::Point; use sdl2::render::WindowCanvas; use sdlgame::keyboard::KeyboardState; const TITLE: &str = "Stars Demo"; const MAX_WIDTH: u32 = 800; const MAX_HEIGHT: u32 = 600; con...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ chained_bft::{ block_storage::BlockStore, epoch_manager::EpochManager, network::{NetworkReceivers, NetworkTask}, network_interface::{ConsensusNetworkEvents, ConsensusNetworkSender}, ...
use std::cmp::Ordering; use std::iter::Peekable; use std::path::Path; use taplo::{ rowan::NodeOrToken, syntax::{SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken}, }; use crate::rowan_extensions::*; pub fn is_cargo_toml_file(file_path: &Path) -> bool { // don't need to worry about different casing because Carg...
use adventlib::grid::*; use std::cmp::Ordering; use std::collections::HashMap; use std::collections::HashSet; use std::f64; pub fn solve() { println!("Day 10"); let raw_map = adventlib::read_input_lines("day10input.txt"); let asteroid_locations = get_asteroid_locations(&raw_map); let mut max_visible ...
/** * Copyright © 2019 * <NAME> <<EMAIL>>, * <NAME> <<EMAIL>>, * <NAME> <<EMAIL>> * * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the LICENSE file for more details. * * This pro...
use clap::{clap_app, crate_version}; use duma::download::http_download; use reqwest::Url; use serde::Deserialize; use serde_json::Value; use std::fs::File; use std::io::BufReader; use std::path::Path; use std::path::PathBuf; use crate::modlist::Mod; use crate::version::Version; #[derive(Deserialize, Debug)] pub struc...
use crate::cli::nextalign_loop::NextalignRecord; use eyre::{Report, WrapErr}; use log::warn; use nextclade::io::errors_csv::ErrorsCsvWriter; use nextclade::io::fasta::{FastaPeptideWriter, FastaRecord, FastaWriter}; use nextclade::io::gene_map::GeneMap; use nextclade::io::insertions_csv::InsertionsCsvWriter; use nextcla...
//! This module contains all of the data/model for a test program, including all flows, //! test templates, test instances, etc. mod bin; mod flow; mod flow_id; mod limit; mod model; mod pattern; mod sub_test; mod template_loader; mod test; mod variable; pub use super::ResourcesType; use crate::Result as OrigenResult...
use crate::render::{ display::ContentProvider, scheduler::{ContentWrapper, CONTENT_PROVIDERS}, }; use anyhow::{anyhow, Result}; use apex_hardware::FrameBuffer; use async_rwlock::RwLock; use async_stream::try_stream; use config::Config; use embedded_graphics::{ geometry::{OriginDimensions, Point}, image:...
pub use smart_leds_trait::*; #[derive(Copy, Clone, Default)] pub struct Hsv { pub hue: u8, pub sat: u8, pub val: u8, } /// Converts a hsv value into RGB values. Because the hsv values are integers, the precision of the /// resulting RGB value is limited to +- 4 /// Example: /// ``` /// use smart_leds::hsv...
use crate::errors::CreateEncoderError; use crate::internal::graphics::SwapchainBundle; use core::mem::ManuallyDrop; use failure::Error; use gfx_hal::command::RenderPassInlineEncoder; use gfx_hal::window::Extent2D; use gfx_hal::Limits; use gfx_hal::{ adapter::{Adapter, PhysicalDevice}, device::Device, pool::...
// This example tests the functionality of sprite rendering. // In particular, it stress tests batched rendering by rendering 10,000 sprites with DrawArray. // Using DrawArray isn't necessary to leverage batched rendering, but it can greatly improve performance. use e2::{glam::*, image, wgpu}; use rand::Rng; use winit...
use crate::errors::*; use crate::{proto, base}; use crate::components::{Expandable, Report}; use crate::base::{IndexKey, NodeProperties, Value}; use crate::utilities::json::{JSONRelease, value_to_json, AlgorithmInfo, privacy_usage_to_json}; use std::convert::TryFrom; use crate::utilities::prepend; use indexmap::map:...
mod utils; extern crate fixedbitset; use fixedbitset::FixedBitSet; use wasm_bindgen::prelude::*; extern crate web_sys; use web_sys::console; // macro_rules! log { // ( $( $t:tt )* ) => { // web_sys::console::log_1(&format!( $( $t )* ).into()) // }; // } pub struct Timer<'a> { name: &'a str, } i...
#[macro_use] extern crate async_trait; #[macro_use] extern crate thiserror; #[macro_use] extern crate serde; use crate::actions::{register_default_actions, ActionPointer, InternalAction}; use crate::config::types::{FatigueTesterConfig, FatigueTesterRunInformation}; use crate::context::actions::register_default_context...
use std::io::{self, BufRead}; use std::collections::HashMap; #[derive(Debug,PartialEq)] enum Dir { North, East, South, West, } impl Dir { pub fn delta(&self) -> (i32, i32) { use Dir::*; match *self { North => ( 0, -1), South => ( 0, 1), West => ...
use crate::{ reports::{BlockData, BlockList, RegistryInfo, RegistryList, VersionData}, ReportDatabase, }; use std::fs::{self, File}; use std::io; use std::path::{Path, PathBuf}; use std::process::Command; use util::commands::{CommandNode, Commands}; use relative_path::RelativePathBuf; #[derive(Debug)] pub s...
#![allow(unused_imports)] use std::cell::RefCell; use std::convert::TryInto; use std::io; use std::io::ErrorKind; use std::marker::PhantomData; use std::mem; use std::ptr; use std::ptr::NonNull; use winapi::shared::minwindef::TRUE; use winapi::shared::windef::HMENU__; use winapi::um::winuser::{ CreatePopupMenu, ...
use crossbeam::{ channel::{self, RecvError}, thread, }; use rand::{seq::SliceRandom, thread_rng}; use std::{ collections::HashMap, iter::repeat_with, sync::{Condvar, Mutex, RwLock}, }; struct State { in_deficit: Vec<u64>, out_deficit: u64, parent: Option<usize>, is_terminated: bool,...
use crate::errors::ConfigError; use crate::ty::{get_all_types, InpType}; use crate::util::{add_line, skip_to_count}; use regex::Regex; use std::collections::HashMap; use std::error::Error; use std::str::{Lines, SplitAsciiWhitespace}; pub fn handle_plugin_options<'a>( options: &mut HashMap<&'a str, &'a str>, op...
use rayon::prelude::*; use shipyard::{ AllStoragesViewMut, EntitiesViewMut, IntoIter, NonSendSync, Shiperator, View, ViewMut, World, }; use std::time::Duration; use tetra::graphics::animation::Animation; use tetra::graphics::{self, Color, DrawParams, Drawable, Rectangle, Texture}; use tetra::input::{self, Key}; use...
//! Constants used throughout this crate. This is mainly to 'prettify' the //! output with color use clap::crate_description; use colored::Color::{ self, Blue, BrightBlue, BrightCyan, BrightGreen, BrightMagenta, BrightRed, BrightYellow, Cyan, Green, Magenta, Red, White, Yellow, }; use once_cell::sync::Lazy; us...
// Copyright (c) Facebook, Inc. and its affiliates // SPDX-License-Identifier: MIT OR Apache-2.0 #![allow(clippy::many_single_char_names)] use gad::prelude::*; #[test] fn test_gradient_simple() -> Result<()> { let mut g = Graph1::new(); let a = g.variable(3i32); let c = { let x = g.mul(&a, &a)?;...
use crate::utils::prev_power_of_two; use core::alloc::{AllocError, Layout}; use core::cmp::max; use core::ptr::NonNull; use core::sync::atomic::{AtomicUsize, Ordering}; use spin::Mutex; use super::linked_list::LinkedList; pub const MEMPOOL_MAX_BITSZ: usize = super::SLAB_ALLOC_BITSZ; pub const MEMPOOL_MIN_BITSZ: usize...
#![recursion_limit = "128"] //for a macro in vm.rs #![allow(non_upper_case_globals)] #![allow(non_snake_case)] macro_rules! last_unchecked { ($vec:expr) => { $vec[$vec.len() - 1] }; } #[macro_use] extern crate bitflags; extern crate rand; pub mod inner_common; pub use inner_common::*; pub mod rende...
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use cosmwasm_std::{Binary, CanonicalAddr, HumanAddr, StdResult, Storage}; use cosmwasm_storage::{ bucket, bucket_read, singleton, singleton_read, Bucket, ReadonlyBucket, ReadonlySingleton, Singleton, }; pub static CONFIG_KEY: &[u8] = b"config"; pu...
mod agent; mod associated; mod navigate; mod route_explorer; mod route_viewer; mod shortcuts; mod speed; mod time; mod trip_explorer; mod turn_cycler; mod warp; pub use self::agent::AgentTools; pub use self::route_explorer::RouteExplorer; pub use self::speed::SpeedControls; pub use self::time::time_controls; pub use s...
#[macro_use] extern crate log; extern crate rustysd; use rustysd::config; use rustysd::control; use rustysd::logging; use rustysd::notification_handler; use rustysd::platform; use rustysd::signal_handler; use rustysd::units; use rustysd::wait_for_socket_activation; use signal_hook::iterator::Signals; fn move_to_new_s...
use std::collections::HashMap; use crate::common::TeamSize; /// Additional fields for `Discipline` wrap. #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] pub struct AdditionalFields(pub HashMap<String, HashMap<String, String>>); /// A game discipline identity. #[derive( Clone, Debug, Defaul...
use cgmath::{vec2, EuclideanSpace}; use collision::dbvt::{DiscreteVisitor, DynamicBoundingVolumeTree, TreeValueWrapped}; use collision::ComputeBound; use legion::world::SubWorld; use legion::{Entity, EntityStore, IntoQuery}; use rand_pcg::Pcg32; use std::collections::HashMap; use crate::collision::{Aabb, Shape}; use c...
use log::{debug, error, info}; use rusoto_core::HttpClient; use rusoto_credential::ProfileProvider; use rusoto_sqs::{DeleteMessageRequest, Message, ReceiveMessageRequest, Sqs, SqsClient}; use settings::Settings; use std::collections::{HashSet, VecDeque}; use std::sync::{Arc, Mutex}; use tokio::sync::mpsc::{self, Sender...
use std::{ sync::{ mpsc::{Receiver, Sender}, Arc, }, thread::{spawn, JoinHandle}, time::Duration, }; use clashctl_interactive::Flags; use crossterm::event::Event as CrossTermEvent; use log::warn; use rayon::prelude::*; use crate::{ clashctl::Clash, event::{Event, UpdateEvent}, ...
//! //! Provides functionality for processing surfel data into substance density textures. //! use self::SubstanceFilter::*; use geom::Vertex; use image::{ImageBuffer, Pixel, Rgba}; use scene::Entity; use sim::SurfelData; use surf; use surfel_table::build_surfel_lookup_table; use std::f32::NEG_INFINITY; type Surface ...
use core::fmt; use std::sync::Arc; use protocol::{IceCandidate, ServerSenderMessage, SessionDescription}; use tokio::sync::Mutex; use webrtc::data::data_channel::RTCDataChannel; use webrtc::media::track::track_local::track_local_static_rtp::TrackLocalStaticRTP; use webrtc::peer::ice::ice_candidate::RTCIceCandidate; us...
//----------------------------------------------------- // Setup. use aoc::Day; use regex::Regex; use std::{collections::HashMap, str::FromStr, string::ToString}; static INPUT: &str = include_str!("data/q07.data"); #[derive(Clone, Debug)] struct Disc { name: String, weight: usize, sum: usize, holdin...
// 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...
use std::sync::Arc; use std::collections::HashMap; use std::time::{Instant, Duration}; use async_slot as slot; use tokio_core::reactor::Handle; use tokio_core::reactor::Interval; use futures::{self, Future, Stream, Async, AsyncSink}; use futures::sync::mpsc::{unbounded, UnboundedSender}; use futures::sync::oneshot::{c...
use crate::configs::KafkaProducerConfig; use crate::configs::{KafkaAuthConfig, KafkaConsumerConfig}; use crate::configs::{KafkaOffset, SecurityProtocol}; use crate::interface::KafkaConsumer; use crate::interface::KafkaInterface; use crate::interface::KafkaProducer; use crate::message::KafkaMessage; use crate::Result; u...
// Copyright (c) 2017-present PyO3 Project and Contributors // // based on <NAME>'s https://github.com/dgrunwald/rust-cpython //! Functionality for the code generated by the derive backend use crate::err::{PyErr, PyResult}; use crate::exceptions::TypeError; use crate::instance::PyNativeType; use crate::pyclass::{PyCl...
//! Definition of FRP Network – set of FRP nodes with a common lifetime. use crate::prelude::*; use crate::stream; use crate::stream::Stream; use crate::node::*; use crate::debug; // ========== // === Id === // ========== /// Globally unique identifier of an frp network. #[derive(Clone,CloneRef,Copy,Debug,Default,...
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
use std::collections::HashMap; #[cfg(feature = "bevy_renderer")] use bevy::{prelude::Handle, reflect::TypeUuid, render::texture::Image}; use crate::Sdf; #[cfg(feature = "bevy_renderer")] #[derive(Debug, Clone, TypeUuid)] #[uuid = "4fe4732c-6731-49bb-bafc-4690d636b848"] pub struct KayakFont { pub sdf: Sdf, pu...
// 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. use { crate::{reader::ReadableTree, Inspector}, failure::{Error, ResultExt}, fidl_fuchsia_inspect::{ TreeContent, TreeNameIteratorReque...
use std::collections::HashMap; use std::net; use std::sync::Arc; use crate::config::Config; use crate::error::Error; use crate::Connection; use log::{debug, error, trace, warn}; use mio::Interest; pub struct Server { cfg: Arc<Config>, clients: HashMap<quiche::ConnectionId<'static>, Connection>, } impl Serve...
//! RGB565 pixel type use crate::pixelcolor::PixelColor; const RED_MASK: u16 = 0b11111_000000_00000; const GREEN_MASK: u16 = 0b00000_111111_00000; const BLUE_MASK: u16 = 0b00000_000000_11111; /// A pixel type defining the commonly used RGB565 format /// /// Pixel values are stored in a single `u16` segmented as foll...
#![warn(rust_2018_idioms)] #![deny(elided_lifetimes_in_paths, unreachable_pub)] //! Safe Rust bindings to rlottie. use rgb::alt::BGRA8; use rlottie_sys::*; use std::{ ffi::CString, fmt::{self, Debug}, os::unix::ffi::OsStrExt, path::Path, ptr::NonNull }; fn path_to_cstr<P>(path: P) -> CString where P: AsRef<Pat...
//! Decorate content and apply alignment. use std::hash::Hash; use crate::event::{self, Event}; use crate::layout; use crate::overlay; use crate::{ Align, Clipboard, Element, Hasher, Layout, Length, Point, Rectangle, Widget, }; use std::u32; /// An element decorating some content. /// /// It is normally used for...
use crate::utils::TLDS; use matches::matches; use std::fmt::{Debug, Display, Formatter, Result as FmtResult}; use std::hash::{Hash, Hasher}; use std::str::FromStr; use thiserror::Error; fn is_invalid_domain_char(c: char) -> bool { matches!( c, '\0' | '\t' | '\n' | '\r' | ' ' | '#' | '%' | '/' | ':'...
use crate::core::panoc::*; use crate::core::*; use crate::mocks; use std::num::NonZeroUsize; const N_DIM: usize = 2; #[test] fn panoc_init() { let radius = 0.2; let ball = constraints::Ball2::new_at_origin_with_radius(radius); let problem = Problem::new(ball, mocks::my_gradient, mocks::my_cost); let mu...
use crate::distro_image::{ DefaultImageFetcher, DistroImage, DistroImageFetcher, DistroImageFile, DistroImageList, ListChooseFn, }; use anyhow::{anyhow, bail, Context, Result}; use async_trait::async_trait; use chrono::NaiveDateTime; static LINUX_CONTAINERS_ORG_BASE: &str = "https://images.linuxcontainers.org/...
//! We want to make sure that the struct that our caller passes us is in the //! right form. However, we don't want to clutter up our code generation //! logic with lots of error handling. So instead, we take in our `DeriveInput` //! and do all the error handling in one place, transforming it into an AST //! specific t...
#![allow(clippy::float_cmp)] mod camera; mod hit_record; mod hittable; mod lambertian; mod dielectric; mod metal; mod material; mod ray; mod scatter_record; mod scene; mod sphere; mod utils; mod vec3; use camera::Camera; pub use hit_record::HitRecord; pub use hittable::{Hittable, HittableList}; use image::{ImageBuffe...
// // SOS: the Stupid Operating System // by <NAME> (<EMAIL>) // // Copyright (c) 2015-2017 <NAME> // Released under the terms of the MIT license. See `LICENSE` in the root // directory of this repository for more information. // //! `x86_64` execution contexts. //! //! This is inteded to be general-purpose and co...
use std::{collections::HashMap, pin::Pin, sync::Arc, task::Poll}; use futures::{future::BoxFuture, AsyncWrite, FutureExt, Sink, TryFutureExt}; use parquet2::metadata::KeyValue; use parquet2::write::FileStreamer; use parquet2::write::WriteOptions as ParquetWriteOptions; use crate::{array::Array, chunk::Chunk, datatype...
//! Performance options use std::{convert::TryInto, ffi::OsString, ops::Add}; use crate::MultipleVariant; /// Only one Performance choice can be chosen #[allow(non_camel_case_types)] #[derive(Debug, PartialEq, Copy, Clone)] pub enum PerformanceChoice { Threads(u8), // max 128 InterPacketGap(usize), // todo m...
//// // rtcoin - Copyright (c) 2019 <NAME> (gbmor) // See LICENSE file for detailed license information. // use std::{path::Path, sync::mpsc}; use rusqlite::{Connection, OpenFlags, NO_PARAMS}; use zeroize::Zeroize; use crate::{err, query, user}; pub const PATH: &str = "/tmp/rtcoinserver.db"; // Wrapper for the da...
use flate2::{Decompress, DecompressError, FlushDecompress}; use std::{convert::TryInto, mem}; const ZLIB_SUFFIX: [u8; 4] = [0x00, 0x00, 0xff, 0xff]; const INTERNAL_BUFFER_SIZE: usize = 32 * 1024; #[derive(Debug)] pub struct Inflater { decompress: Decompress, compressed: Vec<u8>, internal_buffer: Vec<u8>, ...
use super::{Args, Cmd, Entry, EntryFlag, FindType, QueueItem, Retval}; use crate::{ffi, server}; use cstr::cstr; use std::{os::raw::c_char, ptr}; /// Swap two panes. #[no_mangle] static cmd_swap_pane_entry: Entry = Entry { name: cstr!("swap-pane").as_ptr(), alias: cstr!("swapp").as_ptr(), args: Args { ...
// https://rust-lang.github.io/rust-clippy/stable/index.html #![warn(clippy::pedantic)] // This lint is too noisy and enforces a style that reduces readability in many cases. #![allow(clippy::module_name_repetitions)] pub mod cross_compile; use cargo_metadata::{MetadataCommand, Target}; use libcnb_data::buildpack::Si...
use core::{ hash::Hash, sync::atomic::{AtomicUsize, Ordering}, }; use dashmap::DashMap; use std::collections::HashMap; /// Generation counter. /// /// Used for denoting the generation of a given handle, which is used to provide compare-and-swap /// deletion semantics i.e. if the generation used to request dele...
use cargo_lambda_remote::{ aws_sdk_lambda::{types::Blob, Client as LambdaClient}, RemoteConfig, }; use clap::{Args, ValueHint}; use miette::{IntoDiagnostic, Result, WrapErr}; use reqwest::{Client, StatusCode}; use serde_json::{from_str, to_string_pretty, value::Value}; use std::{ fs::{create_dir_all, read_t...
// * This file is part of the uutils coreutils package. // * // * (c) 2014 <NAME> <<EMAIL>> // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. // spell-checker:ignore (ToDO) execvp SIGHUP cproc vprocmgr cstrs homeout #[macro_us...
use self::req::{Json, Mode, Req}; use crate::{ cfg::{self, Config}, err::Error, plugins::chrome, }; use reqwest::{ header::{HeaderMap, HeaderName, HeaderValue}, Client, ClientBuilder, Response, }; use std::{collections::HashMap, str::FromStr, time::Duration}; /// LeetCode API set #[derive(Clone)] p...
use std::collections::HashMap; use std::convert::{TryFrom, TryInto}; use crate::CacheManager; use anyhow::{anyhow, Result}; use http::version::Version; use http_cache_semantics::CachePolicy; use reqwest::{ header::{HeaderName, HeaderValue}, Request, Response, ResponseBuilderExt, }; use serde::{Deserialize, Se...
#[cfg(feature = "stm32f4xx-hal")] use stm32f4xx_hal::stm32; #[cfg(feature = "stm32f7xx-hal")] use stm32f7xx_hal::device as stm32; use stm32::ethernet_mac::{MACMIIAR, MACMIIDR}; use core::option::Option; use crate::smi::SMI; #[allow(dead_code)] mod consts { pub const PHY_REG_BCR: u8 = 0x00; pub const PHY_REG...
/** * \file flow-rs/src/channel/receiver.rs * MegFlow is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2019-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS ...
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use num::{FromPrimitive, ToPrimitive}; use num_derive::{FromPrimitive, ToPrimitive}; use openthread_sys::*; /// Type returned by OpenThread calls. pub typ...
use std::rc::Rc; use rand::Rng; use crate::gl; pub struct Scene { /// Defines how we are looking at the scene camera: gl::Camera, view_size: glm::UVec2, /// The color to which the background is cleared at the start of the frame bg_color: gl::Color, /// The color of the triangle triangle_c...
#![no_std] //! This crate contains an implementation of an in-memory filesystem backed by MappedPages from the memory crate //! This crate allocates memory at page-size granularity, so it's inefficient with memory when creating small files //! Currently, the read and write operations of the RamFile follows the interfa...
mod account_checker; mod cache; mod config; mod customers_config; mod errors; mod flags; use { crate::{ account_checker::{AccountChecker, CheckAccountResult}, config::Config, customers_config::CustomerConfig, errors::Result, }, chrono::{DateTime, Datelike, Utc}, lettre::...
use num_traits::{One, Signed}; use std::fmt; use std::fmt::{Display, Write}; use super::util::is_minus_one; use super::{ConstKind, Node}; #[derive(PartialEq, Eq, PartialOrd, Ord)] enum NodePriority { AddOrSub, MulOrDiv, Exp, Value, } fn get_node_priority(node: &Node) -> NodePriority { match node ...
/// Monotonic Timer based on NRF Timer Instance /// /// The frequency is fixed at 1MHz use crate::hal; use core::sync::atomic::{compiler_fence, Ordering}; use hal::{pac::timer0::RegisterBlock as TimerRegister, timer::Instance}; use rtic_monotonic::Monotonic; pub const TIMER_HZ: u32 = 1_000_000; pub struct NrfMonotonic...
//! A "tiny database" and accompanying protocol //! //! This example shows the usage of shared state amongst all connected clients, //! namely a database of key/value pairs. Each connected client can send a //! series of GET/SET commands to query the current value of a key or set the //! value of a key. //! //! This ex...
// Copyright 2022 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. mod args; use { anyhow::{anyhow, Context, Error}, fidl_fuchsia_identity_account::{AccountManagerMarker, AccountManagerProxy, AccountMetadata}, ...
use crate::common::time::*; use crate::*; use linked_hash_map::LinkedHashMap; use std::cell::RefCell; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; use threadlanes::{LaneExecutor, ThreadLanes}; struct Batch { items: Vec<Insertion>, size: u64, flush_timestamp: u64, } enum Tas...
/*! # Harmonizer This _harmonizer_ offers the ability to invoke a bundled version of the JavaScript library, [`@apollo/federation`], which _composes_ multiple subgraphs into a supergraph. The bundled version of the federation library that is included is a JavaScript Immediately Invoked Function Expression ([IIFE]) th...
use crate::{ helpers::{is_fee_amount_packable, pack_fee_amount}, AccountId, Nonce, }; use crate::account::PubKeyHash; use anyhow::ensure; use num::BigUint; use serde::{Deserialize, Serialize}; use zksync_basic_types::{Address, TokenId}; use zksync_crypto::{ params::{max_account_id, max_token_id}, Priva...
// Algorithms to transform uniform variates to normal use crate::gen::RandomStream; use crate::gen::Rejectable; use crate::gen::Dimensionless; // adapted from https://www.doornik.com/research/ziggurat.pdf const NSTRIPS: usize = 128; // Marsaglia's Ziggurat method of sampling normals pub struct Ziggurat<R> { rng: R...
#![feature(with_options, proc_macro_span)] extern crate quote; #[macro_use] extern crate synstructure; use std::convert::TryFrom; use std::fs::File; use std::io::Write; use kg_diag::*; use proc_macro2::Span; decl_derive!([Detail, attributes(diag)] => detail_derive); struct DiagAttr { code: u32, severity: S...
#![allow(clippy::assign_op_pattern)] use std::fmt::Debug; use dataplane::core::{Encoder, Decoder}; use dataplane::api::Request; use fluvio_controlplane_metadata::derivedstream::DerivedStreamSpec; use fluvio_protocol::Version; use crate::topic::TopicSpec; use crate::customspu::CustomSpuSpec; use crate::smartmodule::Sm...
use libc::c_int; use std::ffi::CStr; use super::common::MKTAG; use crate::ffi; #[allow(non_snake_case)] pub const fn AVERROR(e: u32) -> c_int { -(e as c_int) } #[allow(non_snake_case)] pub const fn AVUNERROR(e: u32) -> c_int { -(e as c_int) } macro_rules! FFERRTAG { ($a:expr, $b:expr, $c:expr, $d:expr) => ...
#[cfg(feature = "alloc")] use crate::format_description::error::InvalidFormatDescription; use core::fmt; /// A unified error type for anything returned by a method in the time crate. /// /// This can be used when you either don't know or don't care about the exact /// error returned. `Result<_, time::Error>` will work...
use std::path::{Path, PathBuf}; use std::fs::{OpenOptions, File}; use log::LogLevelFilter; use simplelog::*; use Result; use serde; use serde_yaml; use std; #[derive(Serialize, Deserialize)] pub struct GenOptions { pub log_file: Option<PathBuf>, pub log_level: String, pub daemonize: bool } #[derive(Serial...
use triangle_rs::Builder; #[derive(Clone)] struct TrussVertices { x: Vec<f64>, y: Vec<f64>, } impl TrussVertices { fn zip(&self) -> std::iter::Zip<std::slice::Iter<'_, f64>, std::slice::Iter<'_, f64>> { self.x.iter().zip(self.y.iter()) } fn into_zip(self) -> std::iter::Zip<std::vec::IntoIte...
use pmutil::q; use pmutil::IdentExt; use pmutil::SpanExt; use proc_macro2::Span; use syn::parse; use syn::punctuated::Punctuated; use syn::spanned::Spanned; use syn::Arm; use syn::BinOp; use syn::Block; use syn::Data; use syn::DeriveInput; use syn::Expr; use syn::ExprBinary; use syn::ExprBlock; use syn::Field; use syn:...