text
stringlengths
3.09k
13.9k
use std::collections::BTreeMap; use ed25519_compact::{PublicKey, Signature}; use serde::{Deserialize, Serialize}; use sha2::Digest; use crate::{ matrix_types::{Event, Id, Key, ServerName}, state::{ServerKeyPair, State, TimeStamp}, }; #[derive(Serialize, Deserialize)] pub(crate) struct ServerKeys { #[serd...
/* * Copyright 2020 Fluence Labs Limited * * 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 a...
use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Mutex; use crate::task::{Header, Task}; use std::marker::PhantomData; use std::ptr::{self, NonNull}; use std::sync::atomic::Ordering::{Acquire, Release}; use std::usize; pub(super) struct Queue<T: 'static> { /// Pointers to the head and tail of th...
extern crate env_logger; extern crate image; extern crate libmzx; use image::{RgbImage, DynamicImage, ImageFormat}; use libmzx::{ load_world, World, Robot, Command, Counters, Resolve, WorldState, Board, Color, Renderer, Size, Coordinate, }; use std::env; use std::fs::File; use std::io::Read; use std::path::Pat...
// Copyright 2022 <NAME>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
use core::fmt; use num_bigint::{BigUint, ParseBigIntError}; use num_traits::Num as _; #[derive(Clone)] pub struct PublicKey { pub x: BigUint, pub y: BigUint, } impl fmt::Debug for PublicKey { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("PublicKey") .field(...
use futures::{Future, future::ok}; use std::{ collections::HashMap, sync::RwLock, }; use common::{ events::{ application::{ Application, ConnectionEndpoint::{ Production, Sandbox }, IosCertificate, IosToken...
use std::{ io::{self, Read, Seek}, ops::{Bound, RangeBounds}, }; use noodles_bgzf::{self as bgzf, VirtualPosition}; use noodles_core::Position; use noodles_csi::index::reference_sequence::bin::Chunk; use noodles_sam::AlignmentRecord; use crate::Record; use super::Reader; enum State { Seek, Read(Virt...
use super::super::common::Vec2; use super::super::common::math::{min_vec, max_vec, abs_vec}; use super::ray_cast_input::RayCastInput; use super::ray_cast_output::RayCastOutput; use std::f32; pub struct AABB { /// The lower vertex pub lower_bound: Vec2, /// The upper vertex pub upper_bound: Vec2 } impl...
#[derive(Copy, Clone)] pub struct Color { r: f64, g: f64, b: f64, } impl Color { pub fn rgb(r: f64, g: f64, b: f64) -> Color { Color { r: r / 255.0, g: g / 255.0, b: b / 255.0, } } // TODO: hex // Palettes TODO mother function palette ...
//! This module allows you to use rusttype to provide the font operations that harfbuzz needs. use crate::common::Tag; pub use rusttype::Error; use rusttype::Font as RTFont; use rusttype::{Codepoint, GlyphId, Scale}; use crate::face; use crate::font; use crate::font::{Font, FontFuncs, Glyph as GlyphIndex, GlyphExtent...
use crate::feature_generated::*; use crate::header_generated::*; use crate::http_client::BufferedHttpRangeClient; use crate::packed_r_tree::{self, PackedRTree}; use crate::properties_reader::FgbFeature; use crate::{check_magic_bytes, NodeItem, HEADER_MAX_BUFFER_SIZE}; use byteorder::{ByteOrder, LittleEndian}; use bytes...
use crate::basics::{EvalConfig, OutputHandler, Time}; use crate::coordination::Event; use crate::evaluator::{Evaluator, EvaluatorData}; use crate::storage::Value; use rtlola_frontend::mir::{Deadline, InputReference, OutputReference, RtLolaMir, Task, Type}; use std::sync::Arc; use std::time::Duration; pub type StateSli...
use std::{mem, sync::Arc, time::Duration}; use crossbeam_queue::SegQueue; use futures_channel::mpsc::UnboundedReceiver; use futures_util::{Future, Stream, StreamExt}; use log::{debug, error, trace}; use sm::{sm, Event}; use crate::{ channel::command::Command, channel::retry::Retry, channel::state::worker:...
//! Code for converting a `Builder` into a debug-able SVG string use crate::{ image::{ ConcreteFillStyle, ConcreteStrokeStyle, ConcreteTextStyle, LoweredElem, LoweredImage, LoweredStyle, TextAnchor, }, utils::CircularArc, V2, }; use super::{Builder, EdgeLinkStyle, RotateDirection}; us...
use reed_solomon_erasure; use reed_solomon_erasure::{ReedSolomon, option_shards_into_shards}; #[derive(Debug, Ord, PartialOrd, Eq, PartialEq)] pub struct DataShare { pub input: u8, pub data: Vec<u8>, } #[derive(Debug)] pub enum SplitDataError { NumBlocksIsZero, NumBlocksTooLarge, ReedSolomonIni...
use color_eyre::*; use crossbeam_channel::{Receiver, Sender}; use std::{ error::Error, fmt::{self, Display, Formatter}, io::{self, BufWriter, Write}, path::Path, process::{Child, Command, Stdio}, time::{Duration, Instant}, }; #[cfg(windows)] use std::os::windows::process::CommandExt; use pilka...
// Copyright 2021. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
use std::sync::Arc; use bit_vec::BitVec; use bit_set::BitSet; use sudoku::{Sudoku, SudokuMaxNumber}; #[derive(Debug)] pub enum Solve { Sudoku(Sudoku), Next {prev: Arc<Solve>, step: Step}, } #[derive(Debug)] pub struct Step { v: usize, x: usize, y: usize, horizontals: Vec<BitSet>, vertica...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use std::collections::{BTreeMap, HashSet}; use std::{ sync::{Arc, Mutex}, time::{Duration, Instant}, }; use futures::e...
use std::fmt; use borsh::{BorshDeserialize, BorshSerialize}; use once_cell::unsync::OnceCell; use crate::utils::StableMap; use crate::{env, CacheEntry, EntryState, IntoStorageKey}; const ERR_ELEMENT_DESERIALIZATION: &str = "Cannot deserialize element"; const ERR_ELEMENT_SERIALIZATION: &str = "Cannot serialize elemen...
use std::time::Duration; use crate::{ glottis::Glottis, noise::NoiseSource, tract::Tract, tract_shaper::TractShaper, turbulence::TurbulencePoint, }; pub struct PinkTrombone { shaper: TractShaper, sample_rate: u32, } impl PinkTrombone { pub fn new(sample_rate: u32, rng: &mut dyn NoiseSource<f64>, ...
use num::{One, Zero}; use std::ops::{Neg, Not}; use crate::{ effect::Delay, value::{CacheValue, Value, ValueNode}, Env, }; #[derive(Copy, Clone, Default, Debug)] pub struct MultiSample<T>(pub T, pub T); impl<T: Zero + Default + Clone> Zero for MultiSample<T> { fn zero() -> Self { MultiSample(T...
//! Payload stream use std::cell::RefCell; use std::collections::VecDeque; use std::rc::{Rc, Weak}; use bytes::Bytes; use futures::task::current as current_task; use futures::task::Task; use futures::{Async, Poll, Stream}; use crate::error::PayloadError; /// max buffer size 32k pub(crate) const MAX_BUFFER_SIZE: usiz...
/* * 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 ...
use chrono::{ serde::{ts_milliseconds, ts_milliseconds_option}, DateTime, Utc, }; use serde_with::{rust::StringWithSeparator, skip_serializing_none, CommaSeparator}; use sqlx::PgPool; use std::default::Default; use tracing::field::{debug, Empty}; use warp::Rejection; use crate::error::Error; #[derive(serde::D...
use advent_lib::{ cases::{GenericPuzzleCase, Puzzle, PuzzleCase, PuzzleRunner}, helpers::{Grid, Point, StringAdventExt}, }; use indoc::indoc; use std::{ cmp, collections::{HashMap, HashSet}, iter::Iterator, }; pub fn get_puzzles() -> Vec<Box<dyn Puzzle>> { vec![Box::new(Part1), Box::new(Part2)]...
use piston::input::*; const VELOCITY: f64 = 10.0; #[derive(Debug, PartialEq, Eq)] enum Direction { N, NE, E, SE, S, SW, W, NW, None } /// This controls the movements of the character #[derive(Debug)] pub struct Controller { pub horizontal: f64, pub vertical: f64, min_h...
extern crate brakets; #[derive(Debug)] enum Symbol { One, Zero, Up, Down, Inward, Outward, Left, Right, Plus, Minus} impl From<char> for Symbol { fn from(c: char) -> Symbol { match c { 'u' => Symbol::Up, 'd' => Symbol::Down, '1' => Symbol::One, '0' => Symbol...
use tui::buffer::Buffer; use tui::layout::Rect; use tui::symbols::Marker; use tui::widgets::{Axis, Block, Borders, Chart, Dataset, GraphType, StatefulWidget, Widget}; use crate::common::{ cast_as_dataset, cast_historical_as_price, zeros_as_pre, DecimalFormat, Price, TimeFrame, TradingPeriod, }; use crate::them...
use super::{ec::Field, poly::Poly}; use std::convert::TryInto; use std::{ fmt::Display, ops::{Add, Index, IndexMut, Mul}, }; #[derive(Debug, PartialEq, Clone)] pub struct Matrix<F: Field> { m: usize, // rows n: usize, // cols v: Vec<F>, } impl<F: Field> Matrix<F> { pub fn zero(m: usize, n: usi...
#[macro_use] extern crate lazy_static; use std::collections::HashMap; use std::fmt::Display; use std::time::Instant; use aoc_2020::get_input; #[derive(Debug, Copy, Clone, PartialOrd, PartialEq)] enum Seat { Floor, Empty, Taken, } lazy_static! { static ref DIRECTION_VECTORS: Vec<(i32, i32)> = vec![ ...
use std::collections::VecDeque; pub type Word = i64; #[derive(Clone)] pub struct Program { memory: Vec<Word>, instruction_pointer: usize, output_values: Vec<Word>, input_values: VecDeque<Word>, halted: bool, requires_input_to: Option<usize>, relative_base: Word, } enum Parameter { Val...
use driver::dtb; use lib::math; use lib::memory; use lib::log; use driver::mmu; extern "C" { fn memset(addr: u64, c: i8, size: u64); } const PHYS_PAGE_SIZE: u64 = 4096; // TODO: Don't change this w/o changing the algorithm below const BITS_PER_PAGE: u64 = 1; struct PmmData { /* Address to a bitmap */ bitmap: ...
use std::path::{Path, PathBuf}; use anyhow::Context; use indexmap::IndexMap; use rdf_utils::models::arc::{ArcIri, ArcLiteral, IndexedArcDataset}; use serde::Serialize; use sophia_api::term::SimpleIri; use sophia_term::ArcTerm; use crate::{ gen_features::{feature_dataset_for, feature_ns_for}, helpers::{ ...
use cairo; use gtk::DrawingArea; use pango; use gtk::prelude::*; use crate::ui::color::{Color, Highlight}; use crate::ui::font::Font; use crate::ui::grid::render; use crate::ui::grid::row::Row; /// Context is manipulated by Grid. pub struct Context { /// Our cairo context, that is evetually drawn to the screen. ...
use std::env; use std::fs; use std::fs::File; use std::io::prelude::*; use std::io::{self, Write}; use std::path::{Path, PathBuf}; use std::cell::RefCell; extern crate colored; use colored::Colorize; extern crate toml; use toml::Value; extern crate git2; use git2::build::{RepoBuilder, CheckoutBuilder}; use git2::{...
//! Clipboard implementation for X11 //! Clipboard API on X11 is pretty weird https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html //! so use this with caution. use crate::x::*; use crate::{_sapp_x11_display, _sapp_x11_window}; const CurrentTime: libc::c_long = 0 as libc::c_long; pub(crate) const S...
use std::{ path::Path, sync::{Arc, Mutex}, }; use ffmpeg_sys as ffmpeg; use rayon; use ringbuf::{Producer, RingBuffer}; use crate::{ daemon_reader::{DaemonCommand, DaemonReader}, stream_reader::{stream_reader_new, StreamEntry, StreamInfo, StreamReader}, Movie, }; static FFMPEG_INIT: std::sync::On...
use std::mem; use anyhow::{anyhow, Context as _}; use wasmtime::{AsContextMut, Global, Linker, Memory, Val}; use crate::call_manager::backtrace; use crate::gas::Gas; use crate::Kernel; pub(crate) mod error; mod actor; mod bind; mod context; mod crypto; mod debug; mod gas; mod ipld; mod network; mod rand; mod send; ...
use crate::hash::hash32; #[derive(Debug, Clone)] pub struct BloomFilterPolicy { hash_fn_num: u8, bits_per_key: usize, } fn bloom_hash(key: &[u8]) -> u32 { hash32(key, key.len(), 0xbc9f1d34) } impl BloomFilterPolicy { pub fn new(bits_per_key: usize) -> Self { let mut hash_fn_num = bits_per_key...
use std::str::FromStr; use parse_display::{Display, FromStr}; use polars::prelude::*; use crate::parsers::value::{BPqlValue, PqlValue, TomlValue}; #[derive(Display, FromStr, PartialEq, Clone, Debug)] #[display(style = "snake_case")] pub enum LangType { Json, Yaml, Toml, Xml, // Csv, } impl D...
use std::fs; #[derive(Debug, PartialEq)] struct Packet { v: u8, t: u8, literal: Option<usize>, sub: Box<[Packet]>, } impl Packet { fn add_versions(&self) -> usize { let mut total = self.v as usize; for sub in self.sub.iter() { total += sub.add_versions(); } ...
pub fn pixel_rgb_to_hsv(r: f32, g: f32, b: f32) -> (f32, f32, f32) { let value = r.max(g.max(b)); let x_min = r.min(g.min(b)); let chroma = value - x_min; let hue = if chroma == 0.0 { 0.0 } else if value == r { 60.0 * ((g - b) / chroma) } else if value == g { 60.0 * (2.0...
use cairo::{Context, Format, ImageSurface, ImageSurfaceData}; use gdk_pixbuf::*; use gtk::prelude::*; use rand::Rng; use std::cell::RefCell; use std::rc::Rc; use gdk::WindowState; const FPS: u32 = 60; pub struct GameWindow { pub width: f64, pub height: f64, } pub struct Input { pub x: f64, pub y: f64...
// 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 image::{ImageBuffer, Rgba, RgbaImage}; use rayon::prelude::*; pub mod camera; pub mod color; pub mod hittable; pub mod math; pub mod ray; use math::{Vec3, INFINITY, PI, R}; use color::Color; use hittable::{ materials::Material, objects::{Sphere, World}, Hittable, }; use ray::Ray; fn main() { // ...
//! Interrupt types. use core::ops; #[allow(unused_imports)] // for intra-doc links only use crate::{FdCan, Rx}; macro_rules! declare_interrupts { ($([$name:ident, $index:literal, $doc:expr],)*) => { /// FdCAN interrupt sources. /// /// These can be individually enabled and disabled in th...
use std::fmt; use crate::parsing::Prop as PropAst; #[derive(Debug, Clone, Copy, PartialEq, Eq)] enum Precedence { Primary, Neg, Conj, Disj, Equiv, Impl, } impl<'a> From<&'a PropAst> for Precedence { fn from(prop: &'a PropAst) -> Self { use Precedence::*; match *prop { ...
use std::collections::BTreeMap; use std::io::Write; use opentracingrust::MapCarrier; use opentracingrust::Result; use opentracingrust::SpanContext; use thrift::protocol::TBinaryOutputProtocol; use thrift::protocol::TOutputProtocol; use thrift::transport::TBufferedWriteTransport; use super::context::ZipkinContext; us...
use crate as ui; use pinwheel::prelude::*; #[derive(builder, Default, new)] #[new(default)] pub struct Topbar { #[builder] pub background_color: Option<String>, #[builder] pub dropdown_background_color: Option<String>, #[builder] pub items: Option<Vec<TopbarItem>>, #[builder] pub logo_href: Option<String>, #[...
//! Family module docs. use crate::{ buffer::{Reset, Submittable}, capability::{Capability, Supports}, pool::CommandPool, }; /// Command queue submission. #[derive(Debug)] pub struct Submission<W, C, S> { /// Iterator over semaphores with stage flag to wait on. pub waits: W, /// Iterator over...
use aoc::PuzzleInput; use fxhash::{FxBuildHasher, FxHashSet}; type Input = TrenchMap; type Output = usize; register!( "input/day20.txt"; (input: input!(verbatim Input)) -> Output { part1(&input.map, &input.algo); part2(&input.map, &input.algo); } ); fn part1(map: &FxHashSet<(isize, isize)...
const USAGE: &str = " URL munching IRC bot, web page title fetching tool. Retrieve the title or some content from web addresses, primarily a debugging tool for `url-bot-rs`. Usage: url-bot-get [options] [-v...] [<url>] Options: -h --help Show this help message. --version ...
//! Quadrature rules constructed by subdividing the reference domain. use crate::element::{FiniteElement, Tri3d2Element}; use crate::integrate::volume_form; use crate::quadrature::{ BorrowedQuadratureParts, Quadrature, Quadrature1d, Quadrature2d, QuadraturePair1d, QuadraturePair2d, }; use itertools::izip; use nalge...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Clock Control Register"] pub clc: crate::Reg<clc::CLC_SPEC>, _reserved1: [u8; 0x04], #[doc = "0x08 - Module Identification Register"] pub id: crate::Reg<id::ID_SPEC>, _reserved2: [u8; 0x1c], #[doc = "0x28 - OCDS...
use crate::tilemap::GMTileMap; use crate::sprite::GMSprite; use macroquad::camera::{Camera2D, set_camera, set_default_camera}; use macroquad::texture::{RenderTarget, render_target, draw_texture}; use macroquad::math::vec2; use macroquad::color::colors; // TODO: // - add shake() method // - add border() method for wi...
#![feature(test)] extern crate tera; extern crate test; use tera::escape_html; const NO_HTML_SHORT: &'static str = "A paragraph without HTML characters that need to be escaped."; const NO_HTML_LONG: &'static str = "Another paragraph without characters that need to be escaped. This paragraph is a bit longer, as someti...
use rand; use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address}; use std::env; use std::fs; use std::io::prelude::*; use std::process::Command; use std::str::{self, FromStr}; // util functions for Linux pub fn get_default_interface() -> String { let coutput = Command::new("ip") .args(&["rou...
//! Killer Sudoku. //! //! https://en.wikipedia.org/wiki/Killer_sudoku extern crate puzzle_solver; use puzzle_solver::{LinExpr, Puzzle, Solution, Val, VarToken}; const SQRT_SIZE: usize = 3; const SIZE: usize = 9; type Board = [[Val; SIZE]; SIZE]; type Point = (usize, usize); fn make_killer_sudoku(board: &[(Val, Vec...
use crate::{ base64::{DecodeUrlSafeBase64, ToUrlSafeBase64}, http::HeaderName, jws::JwsHeader, openssl, sign::build_v2_signing_payload, Error, }; use anyhow::anyhow; use indexmap::{IndexMap, IndexSet}; use std::fmt; /// Builder to verify a request against a `Tl-Signature` header. /// /// See [`...
// 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. //! Custom error types for the network manager. use core::fmt::{self, Display}; use failure::{Context, Fail}; pub type Result<T> = std::result::Result<T,...
use anchor_lang::prelude::*; use anchor_lang::solana_program::{ account_info::AccountInfo, entrypoint::ProgramResult, msg, program::invoke, program_error::ProgramError, pubkey::Pubkey, system_instruction, system_program, }; use candy_machine; declare_id!("HARm9wjX7iJ1eqQCckXdd1imRFXE6PsVChVdV4PbfLc"); pub ...
use super::config::Config; use anyhow::{Result}; use k8s_openapi::api::core::v1::{PersistentVolume, Volume, VolumeMount, HostPathVolumeSource, Pod}; use std::collections::HashSet; use std::iter; use kube::Client; use kube::api::{Api, Meta, ListParams, PostParams, DeleteParams}; use rand::{Rng, thread_rng}; use rand::di...
use std::collections::VecDeque; use std::future::Future; use std::sync::Arc; use std::sync::Mutex; use std::task::Context; use lazy_static::lazy_static; use crate::runtime::executor::task_waker::TaskWaker; use crate::runtime::task::Task; lazy_static! { static ref EXECUTOR: Arc<Mutex<Executor>> = Default::default...
//! This module contains the definition of the `Camera`s. //! //! A `Camera` defines how a player's entity reacts to that player's inputs. use super::BlockContainer; use crate::{debug::send_debug_info, physics::player::PhysicsPlayer, player::PlayerInput}; use nalgebra::Vector3; // Unit vector in the `angle` direction...
use std::{arch::x86_64::{_rdrand16_step}, collections::LinkedList, fmt::{Display, Error, write}, io::Empty, ops::{Add, AddAssign}, u16::MAX}; #[derive(Clone)] pub enum Cell { Empty, Food, Snake, } impl Display for Cell { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { matc...
mod get; mod get_in_memory; mod list; mod nlst; mod put; mod put_in_memory; use crate::utils::pckg; use duckscript::types::command::{CommandResult, Commands}; use duckscript::types::error::ScriptError; use ftp::types::{FileType, FormatControl}; use ftp::FtpStream; static PACKAGE: &str = "ftp"; pub(crate) fn load(com...
use crate::error::Error; use crate::lex::Tok; use crate::mem::{Mem, idx_incr}; use std::io::{ Write, Read }; use std::fs::{ File, OpenOptions }; use std::os::unix::io::{ FromRawFd, IntoRawFd }; use super::*; const MAX_INPUT: usize = 1024; // exit: exit_code(Value) pub fn exit(v: &[Tok], m: &mut Mem) -> Result<Si...
// 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. use { anyhow::{anyhow, Context as _, Error}, cm_rust, component_events::events::Event, component_events::{events::*, matcher::*}, fidl_f...
use gtk; use gtk::prelude::*; use gdk; use gdk::WindowExt; use cairo::Context; use std::cell::RefCell; use std::rc::Rc; use io::Wire; use gui::Gui; const OFFX: f64 = 5.0; const OFFY: f64 = 5.0; const LX: f64 = 20.0; const LY: f64 = 20.0; const LSPACE: f64 = 16.0; struct Seg7Data { drawing_area: gtk::DrawingArea, ...
extern crate getopts; extern crate simple_error; extern crate clap; use clap::{Arg, App}; use getopts::Options; use simple_error::require_with; use std::cmp::min; use std::env; use std::error::Error; use std::process; use std::cell::RefCell; use nix::sys::wait::WaitStatus; mod runtime; mod cgroup; mod filesystem; mod...
use std::collections::HashMap; use std::net::SocketAddr; use std::sync::Arc; use async_trait::async_trait; use destream::de::FromStream; use futures::{future, stream, StreamExt, TryFutureExt, TryStreamExt}; use hyper::service::{make_service_fn, service_fn}; use hyper::{Body, Response}; use log::debug; use serde::de::D...
use std::fmt; use std::ops::{Deref, DerefMut}; use crate::body::EmptyBody; use crate::head::ResponseHead; use crate::{Header, HeaderName, Headers, StatusCode, Version}; /// HTTP response. pub struct Response<B> { head: ResponseHead, body: B, } impl<B> Response<B> { /// Create a new HTTP response. pub...
use clap::Clap; use gre::*; use noise::*; use svg::node::element::path::Data; use svg::node::element::*; use std::f64::consts::PI; #[derive(Clap)] #[clap()] struct Opts { #[clap(short, long, default_value = "35.0")] seed: f64, #[clap(short, long, default_value = "0.25")] amp: f64, #[clap(short, lon...
use crate::Error; use std::{self, io}; // todo use `!`. /// A helper to facilitate paring line by line while reusing a string buffer. pub struct LineParser<R> { reader: io::BufReader<R>, buffer: String, } impl<R> LineParser<R> where R: io::Read, { pub fn new(reader: R) -> LineParser<R> { LineP...
//! This module is responsible for collecting metrics profiling information for the current build //! and dumping it to disk as JSON, to aid investigations on build and CI performance. //! //! As this module requires additional dependencies not present during local builds, it's cfg'd //! away whenever the `build.metric...
use lazy_static::lazy_static; use regex::Regex; use std::collections::{BTreeMap, BTreeSet, HashSet}; use std::str::FromStr; use std::io; use std::io::prelude::*; lazy_static! { static ref PREREQ_RE: Regex = Regex::new( r"^Step (?P<prereq_ch>[A-Z]) must be finished before step (?P<curr_ch>[A-Z]) can begi...
// Copyright (c) 2017-present PyO3 Project and Contributors // // based on <NAME>'s https://github.com/dgrunwald/rust-cpython use conversion::{IntoPyTuple, ToPyObject}; use err::{PyErr, PyResult}; use ffi; use instance::PyObjectWithToken; use object::PyObject; use objectprotocol::ObjectProtocol; use python::{Python, T...
use crate::utilities; use regex::Regex; use std::path::Path; #[derive(Default, Debug, Clone, PartialEq, Eq)] pub struct IncludeReference { pub include_path: String, pub range_start: usize, pub range_end: usize, pub relative_path: bool, } pub fn parse_includes(input: &str) -> Vec<IncludeReference> { ...
// In this example, we show the structure of a reasonably complex slime volleyball game // Some of the details around handling graphics are omitted for brevity use bevy::app::startup_stage; use bevy::input::keyboard::KeyboardInput; use bevy::prelude::*; fn main() { App::build() .add_plugins(DefaultPlugins...
use anyhow::anyhow; use postgres::types::{FromSql, ToSql}; use serde::{Deserialize, Serialize}; use crate::db::Conn; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Column { pub name: String, #[serde(rename = "type")] pub data_type: String, #[serde(default = "nullable_default")] pub nul...
// SPDX-License-Identifier: Apache-2.0 //! Host <-> Shim Communication use crate::addr::{HostVirtAddr, ShimPhysUnencryptedAddr}; use crate::asm::_enarx_asm_triple_fault; use crate::hostlib::{MemInfo, SYSCALL_TRIGGER_PORT, SYS_ENARX_BALLOON_MEMORY, SYS_ENARX_MEM_INFO}; use crate::lazy::Lazy; use crate::SHIM_HOSTCALL_V...
use crate::{math::*, style::Style}; // ---------------------------------------------------------------------------- /// `Layout` direction (horizontal or vertical). #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", serde...
use crate::{ handle::{hsize, Handle, HSizeExt, EdgeHandle, FaceHandle, VertexHandle}, traits::{EdgeMesh, Mesh}, refs::ElementRef, }; /// An iterator over the handles of the elements of a mesh. Yields handles with /// increasing index value. /// /// Instances of this type are returned by: /// - [`Mesh::ver...
use crate::parsing::ParsingContext; use amq_protocol::frame::{BackToTheBuffer, GenError, GenResult, WriteContext}; use std::{ cmp, io::{self, IoSlice, IoSliceMut}, }; #[derive(Debug, PartialEq, Clone)] pub(crate) struct Buffer { memory: Vec<u8>, capacity: usize, position: usize, end: usize, ...
use bevy::ecs::prelude::*; use bevy::transform::prelude::*; use fnv::FnvHashMap; use heron_core::{PhysicMaterial, RigidBody, RotationConstraints, Velocity}; use crate::convert::{IntoBevy, IntoRapier}; use crate::rapier::dynamics::{ BodyStatus, JointSet, RigidBodyBuilder, RigidBodyHandle, RigidBodySet, }; use crat...
use git2::{ErrorCode, Repository}; use bindgen; use cc; use std::env; use std::path::PathBuf; use std::process::Command; fn main() { let v8_dir = match env::var("CUSTOM_V8") { Ok(custom_v8_dir) => { let custom_v8_dir = PathBuf::from(custom_v8_dir); assert!(custom_v8_dir.exists());...
use std::fs::{remove_dir_all, remove_file}; use std::path::Path; /// If the tests are being run on windows, then the target for the build tests /// should be "windows". #[cfg(target_os = "windows")] #[allow(dead_code)] pub const TARGET: &str = "windows"; /// If the tests are being run on linux, then the target for th...
use vulkan_tutorial_rust::{ utility, // the mod define some fixed functions that have been learned before. utility::constants::*, utility::debug::*, utility::share, }; use ash::version::DeviceV1_0; use ash::version::InstanceV1_0; use ash::vk; use winit::event::{ ElementState, Event, Keyboar...
use std::{io, path::Path}; use handlebars::{no_escape, Handlebars}; use serde::Serialize; use time::Date; use super::config::Config; use crate::Error; const TEMPLATE: &str = include_str!("changelog/template.hbs"); const HEADER: &str = include_str!("changelog/header.hbs"); const FOOTER: &str = include_str!("changelog...
use na::{DVectorSliceMut, Isometry3, Real, Unit, Vector3}; use joint::{Joint, PrismaticJoint, RevoluteJoint}; use math::{JacobianSliceMut, Velocity}; use object::MultibodyLinkRef; use solver::{ConstraintSet, GenericNonlinearConstraint, IntegrationParameters}; /// A joint that allows 1 rotational and 2 translational d...
// Zinc, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <<EMAIL>> // // 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/...
// Copyright 2021-2022 <NAME> <<EMAIL>> // SPDX-License-Identifier: MIT OR Apache-2.0 use binread::io::{Read, Seek}; use byteorder::{ByteOrder, LittleEndian}; use core::ops::Range; use memoffset::offset_of; use crate::attribute_value::NtfsAttributeValue; use crate::error::{NtfsError, Result}; use crate::index_entry::...
use std::{collections::HashMap, fmt::Debug}; use toposort_scc::IndexGraph; use crate::{ frontend::{ assign_op_to_assign, parse, Arg, Binop, Cmp, CodeRef, Declaration, Expr, Function, InlineKind, }, jit, sarus_std_lib, validator::{ArraySizedExpr, ExprType}, }; #[derive(Debug, Clone)] p...
// Copyright 2016 The Grin Developers // // 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 agree...
extern crate bytes; extern crate env_logger; extern crate futures; extern crate futures_cpupool; extern crate grpc; extern crate protobuf; #[macro_use] extern crate log; extern crate grpc_interop; use grpc_interop::*; use std::thread; use bytes::Bytes; use futures::stream; use futures::stream::Stream; use grpc::*;...
use std::sync::atomic::{AtomicUsize, Ordering}; use anyhow::anyhow; use futures::{ future::{abortable, AbortHandle}, Future, }; use futures_signals::signal::{self, Mutable, Signal}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::spawn_local; use web_sys::{Document, History, HtmlElement, Storage, Windo...
use std::sync::{Arc, RwLock}; use lewton::inside_ogg::OggStreamReader; use num_traits::clamp; use crate::framework::filesystem::File; use crate::sound::stuff::cubic_interp; use crate::sound::wav::WavFormat; pub(crate) struct OggPlaybackEngine { intro_music: Option<Arc<RwLock<Box<OggStreamReader<File>>>>>, lo...
use crate::source::internal::report_full_telemetry; use std::fs; use std::io; use std::io::BufRead; use std::io::Seek; use std::os::unix::fs::MetadataExt; use std::path::PathBuf; /// The `FileWatcher` struct defines the polling based state machine which reads /// from a file path, transparently updating the underlying...