text
stringlengths
3.09k
13.9k
use crate::link_extractors; use crate::link_validator::LinkCheckResult; use crate::markup::Content; use crate::markup_type; use crate::AnchorTargets; use crate::MarkupAnchorTarget; use crate::MarkupFile; use crate::State; use std::collections::HashMap; use reqwest::header::ACCEPT; use reqwest::header::USER_AGENT; use ...
// The MIT License (MIT) // Copyright (c) 2019 <NAME> // Demo websocket client connecting to localhost port 1337. // This will initiate a websocket connection to path /chat. The demo sends a simple "Hello, World!" // message and expects an echo of the same message as a reply. // It will then initiate a close handshake...
use std::fs::File; use std::ffi::OsString; use std::io::Read; use std::io::stdin; use std::io::Write; use std::process::exit; use std::thread::sleep; use std::thread::spawn; use std::time::Duration; use async_compat::CompatExt; use chrono::Local; use clap::Arg; use clap::Command; use futures::executor::block_on; use se...
use serde::Serialize; use twilight_model::{ id::{ marker::{ChannelMarker, GuildMarker, UserMarker}, Id, }, util::Timestamp, voice::VoiceState, }; /// Represents a cached [`VoiceState`]. /// /// [`VoiceState`]: twilight_model::voice::VoiceState #[derive(Clone, Debug, Eq, PartialEq, Seria...
use crate::fork_service::ForkService; use crate::validator_directory::{ValidatorDirectory, ValidatorDirectoryBuilder}; use parking_lot::RwLock; use rayon::prelude::*; use slog::{error, Logger}; use slot_clock::SlotClock; use std::collections::HashMap; use std::fs::read_dir; use std::iter::FromIterator; use std::marker:...
use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::net::SocketAddr; use chrono::Duration; use uuid::Uuid; use super::member::{ArtilleryMember, ArtilleryMemberState, ArtilleryStateChange}; use crate::epidemic::member; use bastion_utils::math; use kaos::flunk; pub struct Artille...
use std::collections::HashMap; use std::fs::{remove_file, DirBuilder}; use std::path::PathBuf; use std::process::Command; use std::sync::atomic::{AtomicU64, Ordering}; use actix_web::web::{Data, Path}; use actix_web::{web, Error, HttpResponse}; use rlink::api::cluster::{ExecuteRequest, ResponseCode, StdResponse}; use...
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use super::ValidationMessage; use common::{Diagnostic, DiagnosticsResult, Location, NamedItem, WithLocation}; use graphql_ir::{ ...
//! Provides an implementation of WebSocket frames as specified in [RFC 6455 Section 5](https://datatracker.ietf.org/doc/html/rfc6455#section-5). use humphrey::stream::Stream; use crate::error::WebsocketError; use crate::util::restion::Restion; use std::convert::TryFrom; use std::io::Read; /// Represents a frame of...
use crate::{config::AppContext, prelude::*, util::get_pri_name}; use serde::Deserialize; use std::cmp::max; use termcolor::{Color, ColorSpec}; #[derive(Debug, Deserialize)] /// Color settings for terminal output pub struct Style { pub name: String, pub color_fg: Option<u8>, pub color_bg: Option<u8>,...
use crate::data::{ sheet::{Index, Interval, Pitch}, Frame2, Point, Sheet, }; use crate::state::{sheet_editor::Message, Message as RootMessage}; use crate::util::coord::Coord; use iced_graphics::{backend, Backend, Defaults, Primitive, Renderer}; use iced_native::widget::*; use iced_native::{ event, layout as iced_lay...
use super::quadratic_extension::*; use std::marker::PhantomData; use crate::{ bits::{FromBits, FromCompressedBits, ToBits, ToCompressedBits}, fields::{Field, Fp2, Fp2Parameters, SquareRootField}, BitSerializationError, Error, }; /// Model for quadratic extension field F4 as towered extension /// // F4...
#[macro_use] extern crate lazy_static; use aoc2019::*; use num::Integer; use regex::Regex; use std::convert::TryFrom; use std::ops::{Add, Div, Mul, Sub}; lazy_static! { static ref CUT_RE: Regex = Regex::new(r"cut (-?\d+)").unwrap(); static ref DEAL_RE: Regex = Regex::new(r"deal with increment (\d+)").unwrap()...
/* * Copyright 2015-2019 the original author or 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 ap...
use futures::executor::block_on; use imgui::*; use imgui_wgpu::RendererConfig; use std::time::Instant; use winit::{ dpi::LogicalSize, event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, window::Window, }; // the actual imnodes samples are in there mod color_editor; mod hello_world; mod m...
//! Generic constructors. use core::iter::FromIterator; use core::mem::{self, MaybeUninit}; use core::{hint, ptr}; use crate::Matrix; /// A macro for composing matrices. /// /// This macro allows one to write such a matrix in the natural order. For /// example: /// /// ```rust /// # use vectrix::matrix; /// # /// le...
use std::cmp::Ordering; use crate::document::Document; use super::*; use helpers::extract_categories; use paginator::Paginator; #[derive(Debug)] struct Category<'a> { cat_path: liquid::model::Array, posts: Vec<&'a liquid::model::Value>, sub_cats: Vec<Category<'a>>, } impl<'a> Category<'a> { fn new()...
use super::FeroxFilter; use super::SimilarityFilter; use crate::event_handlers::Handles; use crate::response::FeroxResponse; use crate::utils::logged_request; use crate::{DEFAULT_METHOD, SIMILARITY_THRESHOLD}; use anyhow::Result; use fuzzyhash::FuzzyHash; use regex::Regex; use reqwest::Url; use std::sync::Arc; /// wra...
use crate::bits; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng}; use std::time::{Duration, SystemTime}; const LOWER_MASK: u32 = (1 << R) - 1; const UPPER_MASK: u32 = !LOWER_MASK; const W: u32 = 32; const N: usize = 624; const M: usize = 397; const R: u32 = 31; pub struct MersenneRng { index: usize, s...
// Copyright (c) 2018-2020 MobileCoin Inc. use lazy_static; use metrics::{Histogram, IntCounter, IntGauge, OpMetrics}; use prometheus::{ core::{Collector, Desc}, histogram_opts, proto::MetricFamily, register_histogram, IntCounterVec, Opts, }; lazy_static::lazy_static! { pub static ref OP_COUNTERS:...
// Copyright 2018-2020 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...
extern crate fs_extra; extern crate log; extern crate serde; extern crate serde_json; use std::env; use std::fs::canonicalize; use std::fs::create_dir_all; use std::fs::read_to_string; use std::fs::File; use std::io::Write; use std::path::{Path, PathBuf}; use anyhow::Result; use fs_extra::copy_items; use fs_extra::di...
use clap::{App, Arg}; use crossbeam_channel::unbounded; use druid::theme; use druid::{AppLauncher, Color, Key}; use std::io::Write; mod app_delegate; mod app_state; mod audio; mod autosave; mod cmd; mod config; mod cursor; mod data; mod encode; mod menus; mod snippet_layout; mod undo; mod widgets; pub use data::{ ...
use std::cell::RefCell; use std::ffi::CStr; use std::mem; use std::os::raw::c_char; use std::panic; use std::ptr; use std::slice; use std::str; use std::thread; use crate::errors::SourmashErrorCode; use failure::{Error, Fail}; thread_local! { pub static LAST_ERROR: RefCell<Option<Error>> = RefCell::new(None); } ...
use snark_utils::{ElementType, UseCompression}; use std::marker::PhantomData; use zexe_algebra::{ConstantSerializedSize, PairingEngine}; /// The sizes of the group elements of a curve #[derive(Clone, PartialEq, Eq, Default, Debug)] pub struct CurveParams<E> { /// Size of a G1 Element pub g1: usize, /// Siz...
use fuzzcheck_common::arg::*; use std::cmp::Ordering; use std::path::{Path, PathBuf}; use std::process; use std::process::{Command, Stdio}; const TARGET: &str = env!("TARGET"); const BUILD_FOLDER: &str = "target/fuzzcheck"; pub enum CompiledTarget { Lib, Bin(String), Test(String), } impl CompiledTarget { ...
use crate::arch::asid::Asid; use crate::arch::paging::{ cpu_page_mapping_switch_to, get_cpu_page_mapping, ActiveMapping, CpuPageMapping, EntryFlags, PAGE_SIZE, }; use crate::arch::{get_per_cpu_data, preempt_disable, preempt_enable}; use crate::mm::mapper::{MemoryError, MemoryMapper}; use crate::mm::vma_allocato...
use crate::*; use squote::{quote, Literal, TokenStream}; #[derive(Clone, Default, PartialEq)] pub struct TypeGuid(pub [GuidConstant; 11]); #[derive(Clone, PartialEq)] pub enum GuidConstant { U32(u32), U16(u16), U8(u8), } impl std::fmt::Debug for GuidConstant { fn fmt(&self, f: &mut std::fmt::Formatte...
use std::io::{Error, ErrorKind, Read, Result, Seek, SeekFrom}; use byteorder::{LittleEndian, ReadBytesExt}; use shallow_tees::ShallowTees; use takes::Ext; use typed_builder::TypedBuilder; use super::util::read_find_bstr; use super::{index, Entry, FileIndex, Section}; use crate::signature::{self, Signature}; use crate...
extern crate utils; use std::env; use std::collections::HashSet; use std::ops::RangeInclusive; use std::str::FromStr; use std::num::ParseIntError; use std::io::{self, BufReader}; use std::io::prelude::*; use std::fs::File; use utils::*; #[derive(Debug)] struct Input { rules: Vec<TicketRule>, tickets: Vec<Tick...
use kube::api::{Api, DeleteParams, ListParams, Meta, PostParams}; use kube_derive::CustomResource; use rest_client::versions::v0::*; use serde::{Deserialize, Serialize}; use std::convert::TryFrom; use structopt::StructOpt; use tracing::{debug, error, info, instrument}; #[derive(Debug, StructOpt)] struct CliArgs { ...
//! # Controller //! The controller is in charge of opening the game ports and handling client connections to games. //! It opens threads per client. //! Each client has a receiver and a sender thread. use std::io::{BufRead, BufReader, Error, Write}; use std::net::{TcpListener, TcpStream}; use std::str; use std::sync:...
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2018, the Perspective Authors. // // This file is part of the Perspective library, distributed under the terms // of the Apache License 2.0. The full license can be found in the LICENSE // file. use crate::exprtk::*; ...
use std::{collections::HashMap, convert::TryFrom, error, fmt, str::FromStr}; use bevy_ecs::prelude::*; use crate::world::types::{Contents, Description, Id, Named}; #[derive(Bundle)] pub struct RoomBundle { pub id: Id, pub room: Room, pub name: Named, pub description: Description, pub regions: Reg...
//! Conversions of types into Direct2D use direct2d::math::{ColorF, Matrix3x2F, Point2F, RectF}; use piet::kurbo::{Affine, Point, Rect, Vec2}; use piet::{Color, Error, GradientStop, LineCap, LineJoin, RoundFrom, RoundInto, StrokeStyle}; use crate::error::WrapError; /// This is wrapped for coherence reasons. /// //...
pub mod favourites; pub mod movies; use std::{fs, io}; use crate::settings; use crate::tmdb; use crate::tmdb::tmdb::SearchResult; use diesel::prelude::*; use glob::glob; use lazy_static::lazy_static; use mpv_webrpc::models::*; use regex::Regex; use std::path::Path; pub fn scan_movies(mut results: Vec<SearchResult>) -...
use ruscii::app::{App, State}; use ruscii::terminal::{Window, Color, Style}; use ruscii::drawing::{Pencil, RectCharset}; use ruscii::keyboard::{KeyEvent, Key}; use ruscii::spatial::{Vec2}; use ruscii::gui::{FPSCounter}; use rand::{self, prelude::*}; const PAD_HEIGHT: i32 = 3; struct PlayerState { pub position: V...
use proxy_wasm::traits::{Context, HttpContext}; use proxy_wasm::types::FilterHeadersStatus; use threescalers::application::Application; use crate::configuration::Configuration; use crate::log::IdentLogger; use super::authrep; use super::request_headers::RequestHeaders; pub struct HttpAuthThreescale { pub configu...
//! Lua thread test. //! Spawns a lua thread! use rlua::{self, Lua}; use super::*; #[test] fn activate_thread() { super::init(); } #[test] fn thread_exec_okay() { let hello_receiver = send(LuaQuery::Execute( "hello = 'hello world'".to_string())) .expect("Unable to send hello world"); let...
/* * Copyright 2022. gudaoxuri * * 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 i...
use crate::client::EsClient; use rettle::{ Ingredient, Argument, Fill, Brewery, make_tea, }; use std::sync::{Arc, RwLock}; use std::any::Any; use serde::Deserialize; use std::fmt::Debug; use serde_json::{Value, json}; use elastic::error::Error; /// /// Ingredient params for FillEsTea. pub struc...
use std::io::{BufRead, BufReader}; use std::io; // use std::io::prelude::*; use std::path::Path; use std::fs::File; use std::iter::Enumerate; use std::slice::Iter; use std::collections::VecDeque; pub const INF: u64 = 1e9 as u64; pub type Peso = u64; pub type Vertice = usize; // pub type Grafo = Vec<Vec<Peso>>; pub ty...
use std::i32; use std::cmp::{min, max}; fn find_median_sorted_arrays(nums1: Vec<i32>, nums2: Vec<i32>) -> f64 { let mut nums1_iter = 0; let mut nums2_iter = 0; let len = nums1.len() + nums2.len(); let mut num_half = 0.0; let mut num_half_pre = 0.0; // find the k-st, here the middle item let...
use std::error::Error; use std::fmt; use std::str; #[derive(Debug, Clone)] pub enum AccessTokenProviderError { /// An invalid request was sent which contains further information. /// No retry necessary. BadAuthorizationRequest(AuthorizationRequestError), /// An error from the client side which does not...
/*! One-line description. More detailed description, with # Example */ use crate::error::{Error, ErrorKind}; use crate::eval::callable::Callable; use crate::eval::{Environment, Evaluate, Expression}; use crate::read::datum::Datum; use crate::read::syntax_str::{ PSEUDO_SYNTAX_COLON_CHAR, PSEUDO_SYNTAX_LEFT_PROC...
use std::str::FromStr; use std::collections::{HashMap, HashSet}; use crossterm::style::Stylize; pub fn main(input: &str) -> Result<(usize, usize), String> { let map: Map = input.parse()?; let mut path = build_path(&map); let goal = Point { x: map.side - 1, y: map.side - 1}; let mut part1 = map.score...
use std::{fmt, io}; use std::borrow::Cow; use std::fmt::{Display, Formatter}; use std::net::SocketAddr; use chrono::Duration; use rand::prelude::{SliceRandom, ThreadRng}; use tokio::net::{ToSocketAddrs, UdpSocket}; use crate::{common, output}; use crate::cache::{Cache, SocketId}; use crate::common::{Format, IpMode, r...
#[macro_use] extern crate reflex; use std::io; use std::io::Read; use std::fmt; use std::env; use std::collections::HashMap; use std::collections::VecDeque; fn main() { let ruleset = init_ruleset(); let mut program = env::args().nth(1).unwrap(); let use_stdin_p; if program == "-c" { program = ...
use crate::text; use crate::{command_loop, input_loop}; use std::fmt; use std::fs; use std::io; use std::path::PathBuf; use std::str::FromStr; use crate::playerdata::PlayerData; use crate::character::Character; use crate::player::Player; use crate::stage::Stage; use serde::{Deserialize, Serialize}; #[derive(Debug, S...
use rand::Rng; use std::io::Write; use std::process::Command; use std::process::Stdio; use texlang_core::prelude::*; use texlang_stdlib::execwhitespace; use texlang_stdlib::StdLibState; pub fn run_in_texcraft(input: &str) { let mut state = StdLibState::new(); state.set_command("par", execwhitespace::get_par())...
use bitcoind::bitcoincore_rpc::Client; use bitcoind::BitcoinD; use std::ffi::OsStr; use std::fmt; pub use bitcoind; pub use bitcoind::bitcoincore_rpc; mod versions; pub struct ElementsD(BitcoinD); #[non_exhaustive] pub struct Conf<'a>(bitcoind::Conf<'a>); /// All the possible error in this crate pub enum Error { ...
//! This module contains Google Dialogflow Session client //! that can be used for streaming_detec_intent operation. This //! involves streaming. As a result //! this client is not cloneable. #![allow(clippy::manual_map)] use crate::api::grpc::google::cloud::dialogflow::v2beta1::{ sessions_client::SessionsClient as...
use gl::types::*; use image::{DynamicImage, GenericImageView}; use std::{convert::From, ffi::c_void, path::Path}; gen_tex_builder!(TextureBuilder2D { (format, GLenum), (internal, GLenum), (width, i32), (height, i32), (mipmap, GLsizei), (min_filter, GLint), (mag_filter, GLint), (wrap_s,...
// Copyright 2020 Two Sigma Investments, LP. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
use std::ops::Range; use bytes::{Buf, BytesMut}; use crate::range_set::RangeSet; /// Buffer of outgoing retransmittable stream data #[derive(Default, Debug)] pub struct SendBuffer { /// Data queued by the application but not yet acknowledged. May or may not have been sent. unacked: BytesMut, /// The firs...
// Copyright 2021 <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,...
#![forbid(unsafe_code)] #![deny(unsafe_code)] #![allow(unreachable_code)] #![allow(irrefutable_let_patterns)] #![allow(clippy::range_plus_one)] use ena::*; use crate::sql::*; // use serde::{self, Deserialize, Deserializer, Serialize}; // use serde_json::json; // use std::collections::HashSet; use tokio::{ runtim...
// Copyright 2020 The Chromium OS 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 std::ops::{Deref, DerefMut}; use std::os::unix::io::AsRawFd; use std::pin::Pin; use std::rc::Rc; use std::task::{Context, Poll}; use crate::io_sou...
#![feature(generic_associated_types)] pub mod error; #[cfg(feature = "cab")] pub mod cab; #[cfg(feature = "tar")] pub mod tar; #[cfg(feature = "zip")] pub mod zip; use std::borrow::Cow; use std::io::{Read, Seek}; use std::path::Path; use crate::error::Error; pub trait LendingIterator { type Item<'a> where Self...
use crate::actors::led::matrix::LedMatrixActor as MatrixActor; use crate::bsp::Board; use crate::drivers::{button::Button, led::matrix::LedMatrix as LedMatrixDriver, ActiveLow}; use crate::{ domain::temperature::Celsius, domain::{temperature::Temperature, SensorAcquisition}, traits::sensors::temperature::Te...
// Remove console on Windows if not in debug build #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(debug_assertions, allow(dead_code))] //#![feature(option_expect_none)] #[macro_use] extern crate bitflags; extern crate imgui; extern crate imgui_opengl_renderer; #[macro_use] mod app; //...
use anyhow::*; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::term::prelude::*; #[native_implemented::function(erlang:system_info/1)] pub fn result(item: Term) -> exception::Result<Term> { match item.decode().unwrap() { TypedTerm::Atom(atom) => match atom.name() { "alloc_util_a...
#![feature(never_type)] #![no_main] #![no_std] mod boot; mod layout; use boot::BootButton; use hal::{ gpio::{self, Input, Output, PullUp, PushPull}, prelude::*, }; use stm32f0xx_hal as hal; use panic_halt as _; use rtic::app; use keyberon::{ debounced_matrix::DebouncedMatrix, key_code::KbHidReport, ...
use crate::fees::TxFee; use crate::web3sync::{batch_fragment, RpcBatchRequest, RpcBatchResponse, RpcSingleRequest}; use airnode_events::AirnodeEvent; use chrono::NaiveDateTime; use jsonrpc_core::types::params::Params; use serde::{Deserialize, Serialize}; use structopt::StructOpt; use web3::types::Log; use web3::types::...
use std::collections::HashMap; use std::fs; use std::path::{Path, PathBuf}; use serde_json::{json, Map, Value}; use crate::object_definitions::{ObjectDefinition, parse_definitions}; #[derive(Debug)] pub struct Schema { pub definitions: HashMap<String, ObjectDefinition>, pub all_of: Option<Vec<String>>, ...
use std::collections::HashSet; use crate::errors::Error; use chrono::{DateTime, Datelike, Timelike, Utc}; use cid::Cid; use ipfs_api::{responses::Codec, IpfsService}; use linked_data::{indexes::date_time::*, types::IPLDLink}; pub(crate) async fn insert( ipfs: &IpfsService, date_time: DateTime<Utc>, in...
// Copyright (c) 2020 Ant Financial // // SPDX-License-Identifier: Apache-2.0 // //! Common functions and macros. #![allow(unused_macros)] use crate::error::{Error, Result}; use nix::fcntl::{fcntl, FcntlArg, FdFlag, OFlag}; use nix::sys::socket::*; use std::os::unix::io::RawFd; #[derive(Debug)] pub enum Domain { ...
use crate::{ block::Block, droplet::{Droplet, RxDroplet}, robust_encoder::get_sample_from_rng_by_seed, types::{CatchResult, DropType}, }; use rand::distributions::Uniform; /// Decoder for the Luby transform pub struct Decoder { total_length: usize, blocksize: usize, unknown_chunks: usize, ...
use crate::context::Context; use crate::errors::{ArgumentError, ShellError}; use crate::parser::registry::{NamedType, PositionalType, Signature}; use crate::parser::{baseline_parse_tokens, CallNode}; use crate::parser::{ hir::{self, NamedArguments}, Flag, RawToken, TokenNode, }; use crate::traits::ToDebug; use ...
extern crate postgres; extern crate chrono; extern crate serde; use postgres::Transaction; use serde::Serialize; use chrono::{DateTime, Utc}; use crate::s3::{s3_url_opt}; #[derive(Debug,Serialize)] pub struct Job { pub id: i32, pub benchmark_name: String, pub spec_name: String, pub kprove: String, ...
#![allow(non_camel_case_types)] use bitflags::bitflags; pub const API_MAJOR: u64 = 2; pub const API_MINOR: u64 = 0; pub const VERSION_MAJOR: u64 = 2; pub const VERSION_MINOR: u64 = 0; pub const VERSION_EXTRA: u64 = 0; pub const SECOND_SCALE: u64 = 1_000_000; pub const MILISECOND_SCALE: u64 = 1_000; #[repr(C)] #[deriv...
use crate::context::Context; use crate::error::Diagnostic; use crate::query::Key; use crate::span::{S, Span}; use super::{FunctionPath, Identifier, Symbol}; pub type Address = usize; pub type SymbolSize = usize; pub fn load(context: &Context, parent: Option<Key>, symbol: &Symbol, span: Option<Span>) -> crate::Res...
use eth_spv_lib::eth_types::{hash256, H128, H256, H512}; use hex::FromHex; use serde::{Deserialize, Deserializer}; #[derive(Debug)] pub struct Hex(pub Vec<u8>); impl<'de> Deserialize<'de> for Hex { fn deserialize<D>(deserializer: D) -> Result<Self, <D as Deserializer<'de>>::Error> where D: Deserialize...
use anyhow::{Context, Result}; use std::io::BufRead; use uom::fmt::DisplayStyle::Abbreviation; use uom::si::{angle, u16::Angle}; use uom::si::{energy, f32::Energy}; use uom::si::{f32::Length, length}; use uom::si::{f32::ThermodynamicTemperature, thermodynamic_temperature}; use uom::si::{time, u32::Time}; use uom::si::...
// Copyright 2018 The immense 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law...
use std::env; use logos::Logos; use std::io::prelude::*; use crate::ast::Token; mod ast; fn main() { ast::lex("dovid(5+8,1,d,dsdf(gh()))") // let args: Vec<String> = env::args().collect(); // if args.len() < 3 { // panic!("Not enough arguments"); // } // let program = [Op::PUSH(5), ...
extern crate byteorder; #[macro_use] extern crate lazy_static; extern crate mtklogo; // These integration tests do as little as checking: // - whether the external crates (zlib/png) are fitted for the purpose of this program. // - if I'm not too bad with image formats... use byteorder::{ByteOrder, LittleEndian, BigEn...
use DbInterface; use Error; use chrono::{DateTime, Duration, NaiveDateTime, Utc}; use id::{decode_id, encode_id}; use iron::{status, Handler, Url}; use iron::headers::ContentType; use iron::method::Method; use iron::modifiers::Redirect; use iron::prelude::*; use iron::response::BodyReader; use mime; use read::load_data...
use std::env; use std::ffi::OsStr; use std::io::Write; use std::process::{Command, Stdio, Child}; use std::str::from_utf8; use std::sync::Arc; use std::path::PathBuf; use super::cmdresult::CmdResult; use super::fixtures::read_scenario_fixture; use super::common::log_info; use super::settings::SceneSettings; static AL...
// 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicabl...
// EndBASIC // Copyright 2021 <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 agre...
use std::os::unix::fs::PermissionsExt; use std::path::Path; use std::{fs, io}; use anyhow::anyhow; pub enum UnpackOption { /// name the unpacked file after the zip archive entry UseEntryName(String), /// name the unpacked file after the zip archive (without the extension) UseArchiveName(String), } pu...
use diesel::prelude::*; use diesel::result::Error; use diesel::PgConnection; use armadillo_core::DbAccess; use armadillo_core::{Bike, Oven, Solar, Trailer}; use armadillo_core::{BikeData, OvenData, SolarData}; use armadillo_core::{Id, Timestamp}; use crate::schema; pub struct Db<'a>(pub &'a PgConnection); macro_rul...
use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::error; use std::error::Error; use std::fmt; use std::io; use std::iter::FromIterator; use crate::disk::chain::ChainIterator; use crate::disk::error::DiskError; use crate::disk::file::FileOps; use crate::disk::format::DiskFormat; ...
use chrono::{Datelike, NaiveDate, TimeZone, Utc}; use std::convert::TryInto; mod constants; mod utils; use constants::{ BS_EPOCH_TIMESTAMP, BS_YEAR_ZERO, FORMAT_CORRECTLY_ERROR_MESSAGE, INTERNAL_PROGRAM_ERROR_MESSAGE, MONTH_LENGTHS_ENCODED, MS_PER_DAY, }; /// Takes in the input as Config struct and displays conv...
use core::marker::PhantomData; use vek::*; use crate::{ Interpolate, Pipeline, Target, }; use self::super::*; /// A rasterizer that produces filled triangles from groups of 3 consecutive vertices. /// /// Use the BackfaceCullingEnabled type parameter to enable backface culling. /// Use the BackfaceCullingD...
use super::{authority_hosts, TokenCredential}; use azure_core::auth::{AccessToken, TokenResponse}; use azure_core::error::{ErrorKind, ResultExt}; use base64::{CharacterSet, Config}; use chrono::Utc; use openssl::{ error::ErrorStack, hash::{hash, DigestBytes, MessageDigest}, pkcs12::Pkcs12, pkey::{PKey, ...
use crate::dbuffer::DBuffer; use crate::http::MimeType; use crate::http::{body::*, header::*, request::*, response::*, StatusCode}; use crate::log; use crate::resource::ResourceLoader; use crate::route::*; use crate::ThreadPool; use crate::RSWEB_SERVER_STR; use crate::RSWEB_VERSION; use std::io::Write; use std::net::Ip...
use data_encoding::HEXLOWER; use reqwest::blocking::{Client, ClientBuilder}; use ring::digest::{Algorithm, Context, SHA256, SHA512}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::Path; use std::time::{SystemTime, UNIX_EPOCH}; const PASSWORD_SALT: &str = "<PASSWORD>"; const TOKEN_SA...
extern crate proc_macro; use std::{collections::HashMap, ffi::OsStr}; use ignore::{DirEntry, WalkBuilder}; use proc_macro2::{Ident, Span, TokenStream}; use quote::ToTokens; use syn::{ parse::{Parse, ParseStream, Result}, parse_macro_input, LitBool, LitStr, Token, }; use tokenstream2_tmpl::{interpolate, Interpo...
#![allow(unused)] use std::mem::transmute; use std::iter::Iterator; use super::opcodes::OpMode; use super::opcodes::mask_1; pub type Usize = u32; /// jump label pub type Label = i32; pub const LFIELDS_PER_FLUSH: u32 = 50; pub const MIN_STACK_SIZE: Usize = 2; #[derive(Debug, PartialEq, Clone)] pub enum ConstType { ...
/* The following is an in-progress adaptation of the Beginner's Guide to PID Controllers algorithm from <NAME>, in a straight-line conversion to Rust. As of 4-20-19 it is not complete. references: https://github.com/japaric/zen/ -- embedded TWIP with PID on stm32 board https://github.com/johsnick/rust_pid/blob/mas...
use std::fmt::Formatter; use std::str::FromStr; use http::Method; use hyper::client::HttpConnector; use hyper::{Uri}; use hyper_rustls::HttpsConnector; use once_cell::sync::OnceCell; use crate::request::RequestBuilder; use crate::middleware::Middleware; use crate::response::Response; use crate::middleware::Next; use cr...
use std::{ fs::File, io::{self, BufReader}, path::PathBuf, }; use failure::{self, format_err}; use formatter::{FormatMap, FormatString}; use serde_derive::{Deserialize, Serialize}; use crate::{ output::{Color, Output}, widget, }; pub struct Widget { fmt_map: FormatMap, bat_path: PathBuf, ...
//! Write an exr image to a file. //! //! First, call `my_image.write()`. The resulting value can be customized, like this: //! ```no_run //! use exr::prelude::*; //! # let my_image: FlatImage = unimplemented!(); //! //! my_image.write() //! .on_progress(|progress| println!("progress: {:.1}", prog...
/// Query or Response flag. #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub(crate) enum Qr { Query, Response, } /// DNS response code. /// /// # References /// /// * [RFC 1035 Section 4.1.1](https://www.rfc-editor.org/rfc/rfc1035#section-4.1.1) #[derive(De...
use std::collections::HashSet; use std::path::{Component, Path}; pub fn check_dir_is_project(patterns: &[Pattern], dir: &Path) -> bool { let mut state = patterns.iter().map(|o| o.base.clone()).collect(); drop(recursive(&mut state, dir, patterns)); // When a pattern is matched successfully it will be remov...
use cortexm4::{ disable_specific_nvic, generic_isr, hard_fault_handler, nvic, set_privileged_thread, stash_process_state, svc_handler, systick_handler, }; use events::set_event_flag_from_isr; extern "C" { // Symbols defined in the linker file static mut _erelocate: u32; static mut _etext: u32; ...
mod common; use once_cell::sync::Lazy; use parking_lot::Mutex; use rand::{rngs::SmallRng, seq::IteratorRandom, Rng, SeedableRng}; use serde::{Deserialize, Serialize}; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, time::sleep, }; use tracing::*; use tracing_subscriber::filter::LevelFilter; use pea2pea::{ ...
// Copyright 2020-2021 <NAME> under the terms of the MIT License as detailed // in the accompanying file README.md or <https://opensource.org/licenses/MIT>. //! Runs the software raytracer and writes the results into a texture. // TODO: This is not yet used. Finish hooking it up or delete it. #![allow(dead_code)] us...