text
stringlengths
3.09k
13.9k
use crate::math::Point; use crate::Side; use crate::{FillGeometryBuilder, VertexId}; /// Helper class that generates a triangulation from a sequence of vertices describing a monotone /// polygon (used internally by the `FillTessellator`). pub(crate) struct MonotoneTessellator { stack: Vec<MonotoneVertex>, prev...
extern crate axgeom; extern crate broccoli; extern crate compt; use axgeom::*; use broccoli::node::*; use broccoli::prelude::*; use broccoli::query::*; use compt::*; ///Convenience function to create a `(Rect<N>,&mut T)` from a `T` and a Rect<N> generating function. fn create_bbox_mut<'a, N: Num, T>( bots: &'a mu...
use beserial::{Deserialize, Serialize}; use bls::bls12_381::PublicKey; use hash::{Blake2bHash, SerializeContent}; use hash_derive::SerializeContent; use primitives::slot::ValidatorSlots; use crate::ViewChangeProof; use super::MacroHeader; use super::signed; use super::signed::{AggregateProof, AggregateProofBuilder, A...
use heck::{ ToKebabCase, ToLowerCamelCase, ToShoutyKebabCase, ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase, }; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; #[derive(Serialize, Deserialize, Copy, Clone, Debug)] pub enum Case { #[serde(alias = "UpperCase")] #[serde(alias = "UP...
use der_parser::oid::Oid; use nom::HexDisplay; use std::cmp::min; use std::env; use std::io; use x509_parser::prelude::*; const PARSE_ERRORS_FATAL: bool = false; #[cfg(feature = "validate")] const VALIDATE_ERRORS_FATAL: bool = false; fn print_hex_dump(bytes: &[u8], max_len: usize) { let m = min(bytes.len(), max_l...
// Copyright 2017 The Spade Developers. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except acc...
use std::fmt::Debug; use std::fs::File; use std::io::{BufReader, Read, Seek}; use std::io::Result; use std::path::{Path, PathBuf}; use crate::*; use crate::ReadHelper; /// Metadata of a sg file. /// /// Contains metadata of the images retrieved from the sg file. /// Can be used to get information about the bitmaps an...
#[cfg(feature="ffi")] mod ffi; use std::ops::{Add, Mul, Sub}; use num::Float; use crate::core::{Domain, Transformation, Function, StabilityRelation}; use crate::dom::{AllDomain, InherentNullDomain, VectorDomain, OptionNullDomain}; use crate::error::Fallible; use crate::dom::InherentNull; use crate::samplers::SampleU...
mod rewritten; mod writer; pub use rewritten::{rewrite, Rewritten}; pub use writer::Writer; use crate::Matcher; use pulldown_cmark::{CodeBlockKind, CowStr, Event, Tag}; /// Something which can rewrite events. pub trait Rewriter<'src> { /// Process a single [`Event`]. /// /// This may mean ignoring it, mu...
//! Contains the code that opens a GGB file and parses it into a polytope. // This code is unfinished. #![allow(dead_code)] #![allow(clippy::collapsible_match)] use std::io::Result as IoResult; use crate::{conc::Concrete, float::Float, geometry::Point}; use nalgebra::dvector; use xml::{ attribute::OwnedAttribut...
use std::sync::Arc; use parking_lot::RwLock; use crate::contribution::AggregatableContribution; use crate::identity::WeightRegistry; use crate::partitioner::Partitioner; use crate::store::ContributionStore; pub trait Evaluator<C: AggregatableContribution>: Send + Sync { fn evaluate(&self, signature: &C, level: u...
use crate::{ shap::{compute_shap_values_for_example, ComputeShapValuesForExampleOutput}, train::{train, Task, TrainOutput}, train_tree::TrainTree, Progress, TrainOptions, Tree, }; use modelfox_table::prelude::*; use modelfox_zip::{pzip, zip}; use ndarray::prelude::*; use num::{clamp, ToPrimitive}; use rayon::prelud...
use crate::progress::ProgressBar; /// Wraps an iterator to display its progress. pub trait ProgressIterator where Self: Sized + Iterator, { /// Wrap an iterator with default styling. Attempt to guess iterator /// length using `Iterator::size_hint`. fn progress(self) -> ProgressBarIter<Self> { l...
use reqwest; use reqwest::header::CONTENT_TYPE; use serde_json::{self, Value}; use std::net::SocketAddr; use std::time::Duration; use std::{error, fmt}; pub struct RpcClient { pub client: reqwest::Client, pub addr: String, } impl RpcClient { pub fn new(addr: String) -> Self { RpcClient { ...
#![feature(entry_and_modify)] extern crate regex; use regex::Regex; use std::collections::HashSet; use std::collections::HashMap; use std::io; use std::io::prelude::*; use std::str::FromStr; #[derive(Debug)] enum WeightSearch<'a> { Subtree(usize, &'a Program), OffendingProgram(usize, usize, &'a Program), }...
use rand::Rng; use std::cmp::Ordering; use std::collections::HashMap; use std::fmt::Write; use std::io; fn main() { //let data = [3, 1, 1, 2, 1]; //dbg!(stats(&data)); //song(); //fibonacci(10); //degrees(); //guess_the_number(); } pub fn largest<T: PartialOrd>(list: &[T]) -> &T { let mut ...
//! //! The type statement parser. //! use std::cell::RefCell; use std::rc::Rc; use crate::error::Error; use crate::lexical::stream::TokenStream; use crate::lexical::token::lexeme::keyword::Keyword; use crate::lexical::token::lexeme::symbol::Symbol; use crate::lexical::token::lexeme::Lexeme; use crate::lexical::token...
use exonum::crypto::{CryptoHash, Hash}; use exonum::blockchain::Transaction; use exonum_testkit::{ApiKind, TestKit, TestKitApi}; use SERVICE_NAME; use schema::{ProposalList, Schema as BallotSchema}; use api::{BallotHashInfo, BallotResponse, VoteRequest, VoteResponse, VotesInfo}; use tests::common::*; use tests::tx_log...
/* Si supponga di disporre di una scacchiera NxN. Determinare il numero di modi in cui è possibile posizionare Nregine in modo tale che nessuna coppia di regine si possa attaccare a vicenda. Quindi, una soluzione richiede che due regine non condividano la stessa riga, colonna o...
// 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/...
//! # Data Streaming Iterators use std::error::Error; use std::cmp; use std::fmt; use std::hash::Hash; use std::io::{Read,Cursor}; use serde::{Serialize}; use std::sync::mpsc; use crate::data_elements::TimeSeriesDataPoint; pub struct TimeSeriesDataPointStreamer<'a, T: Read, TDate: Hash + Copy + cmp::Eq + cmp::Ord, TD...
use sfml::system::Vector2f; use sfml::graphics::FloatRect; use sfml::graphics::{RenderTarget, RenderWindow}; use animation::Animation; use util::{self, AngleHelper}; #[derive(Clone, Copy, PartialEq, Eq)] pub enum Facing { North = 0, East = 1, South = 2, West = 3, } pub use self::Facing::*; impl Facing { pub fn f...
extern crate termion; use termion::style; use std::{thread, io}; use std::sync::mpsc::{Sender, Receiver, channel}; use std::collections::{HashMap, BTreeMap}; use std::thread::JoinHandle; extern crate rand; use rand::Rng; use rand::prelude::ThreadRng; use crate::utils::extension::CheckedSend; use crate::model::mine...
use clap; use env_logger; use habitat_common as common; use habitat_core as hcore; use habitat_pkg_export_docker as export_docker; use habitat_pkg_export_kubernetes as export_k8s; #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate serde_json; use failure; #[macro_use] exte...
#![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows" )] mod drives; mod extensions; mod file_lib; mod files_api; mod storage; mod util; use clap::{App, Arg, ArgMatches}; mod tests; use font_loader::system_fonts; use lazy_static::lazy_static; use std::env; extern crate reqwe...
use std::hint::unreachable_unchecked; use base64::display::Base64Display; use bytes::{Buf, BytesMut}; use httparse::{self, Header, Request, Response}; use tokio_util::codec::{Decoder, Encoder}; use crate::{sha::digest, utf8::parse_str, Error}; const SWITCHING_PROTOCOLS: u16 = 101; fn header<'a, 'header: 'a>( he...
//! This module implements the entity //! metadata format. See <https://wiki.vg/Entity_metadata> //! for the specification. use crate::{Direction, ValidBlockPosition}; use bitflags::bitflags; use libcraft_items::InventorySlot; use std::collections::BTreeMap; use uuid::Uuid; pub type OptUuid = Option<Uuid>; pub type O...
use std::convert::TryInto; use candid::{candid_method, Nat}; use candid::{CandidType, Deserialize, Principal}; use dft_types::*; use dft_utils::decode_tx_id; use ic_cdk::{api, storage}; use ic_cdk_macros::*; use std::sync::RwLock; static mut DFT_ID: Principal = Principal::anonymous(); const MSG_OUT_OF_TX_INDEX_RANGE...
use crate::{Counter, Gauge, Histogram, Key, KeyName, Unit}; use core::fmt; use core::sync::atomic::{AtomicUsize, Ordering}; static mut RECORDER: &'static dyn Recorder = &NoopRecorder; static STATE: AtomicUsize = AtomicUsize::new(0); const UNINITIALIZED: usize = 0; const INITIALIZING: usize = 1; const INITIALIZED: usi...
use path_tracer::*; use std::convert::TryInto; pub type CCamera = camera::Camera<scene::Scene<'static>>; pub type CSceneBuilder = scene::Scene<'static>; pub type CScene = std::rc::Rc<CSceneBuilder>; pub type CVec3 = vec3::Vec3<f64>; pub type CMaterial = std::rc::Rc<dyn material::Material>; pub type CHit = std::rc::Rc...
use oasis_std::{ abi::*, collections::{map::Entry, Map, Set}, Address, Context, Event, }; pub type Result<T> = std::result::Result<T, Error>; #[derive(Debug, Eq, PartialEq, Serialize, Deserialize)] pub enum Error { Unknown, AdminPrivilegesRequired, InsufficientFunds { address: Address }, N...
use anyhow::Result; use ckb_indexer::store::{Batch, Error as StoreError, IteratorDirection, IteratorItem, Store}; use parking_lot::RwLock; use smallvec::SmallVec; use std::collections::BTreeMap; use std::sync::Arc; pub type DBKey = SmallVec<[u8; 64]>; pub type DBValue = Vec<u8>; #[derive(Clone)] pub struct DBTransac...
use command::{Command, CommandError, CommandExitCode, CommandParameter}; use config::{get_config_application, Config, ConfigApplication}; use docker::ContainerHelper; use io::{convert_path, InputOutputHelper}; /// /// Module to delete image. /// /// Release under MIT License. /// use std::path::Path; use users::{get_cu...
//! `cargo upgrade` #![warn(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces, unused_qualifications)] extern crate cargo_metadata; extern crate docopt; #[macro_use] extern crate error_ch...
mod diagnostics; use colored::*; use diagnostics::render_diagnostics; use std::{env, path::PathBuf, process, sync::Arc}; use std::{panic, sync::Mutex}; use structopt::StructOpt; use probe_rs_cli_util::common_options::{CargoOptions, FlashOptions, OperationError}; use probe_rs_cli_util::flash; #[cfg(feature = "sentry"...
/* Copyright 2021 The MiniModelarDB Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable l...
use image::GenericImageView; use quick_xml::Writer; use std::fs; use std::fs::File; use std::io::Cursor; use std::io::Read; use structs::drawing::spreadsheet::MarkerType; use structs::drawing::spreadsheet::OneCellAnchor; use structs::drawing::spreadsheet::Picture; use structs::drawing::spreadsheet::TwoCellAnchor; use s...
use super::EguiContextResource; use super::EguiDrawData; use egui::{CtxRef, FontDefinitions}; use std::sync::Arc; use std::sync::Mutex; // Inner state for EguiManager, which will be protected by a Mutex. Mutex protection required since // this object is Send but not Sync struct EguiManagerInner { context: egui::Ct...
use std::{ error, fmt, io::{BufRead, BufReader, Write}, marker::PhantomData, net::{SocketAddr, TcpStream, ToSocketAddrs}, }; use bytes::BytesMut; use fteepee_core::{ commands::{Command, Feat, List, Mlsd, Pass, Pasv, User}, expect_code, response::{ParsedResponseState, Response, ResponseExt},...
// Copyright 2022, 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 // di...
#![recursion_limit = "128"] extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, DeriveInput}; #[proc_macro_derive(Builder, attributes(builder))] pub fn derive(input: TokenStream) -> TokenStream { let ast = parse_macro_input!(input as DeriveInput); println!("{:...
//! Requires the 'framework' feature flag be enabled in your project's //! `Cargo.toml`. //! //! This can be enabled by specifying the feature in the dependency section: //! //! ```toml //! [dependencies.serenity] //! git = "https://github.com/serenity-rs/serenity.git" //! features = ["framework", "standard_framework"]...
use crate::context::{AnswerResult, AnswerStream, Context, ContextOps}; use crate::logic::RootSearchFail; use crate::table::AnswerIndex; use crate::tables::Tables; use crate::{TableIndex, TimeStamp}; use std::fmt::Display; pub struct Forest<C: Context> { context: C, pub(crate) tables: Tables<C>, /// This i...
use crate::{change_theme, config, ui, wiki}; use anyhow::{Context, Result}; use cursive::align::HAlign; use cursive::utils::markup; use cursive::view::{Nameable, Resizable, Scrollable}; use cursive::views::{Button, Dialog, EditView, LinearLayout, SelectView, TextView}; use cursive::Cursive; pub fn on_search(siv: &mut...
use gml::{self, vm}; use crate::{Context, motion, draw}; pub struct State { pub next_id: i32, pub instances: vm::EntityMap<Instance>, pub destroyed: Vec<vm::Entity>, } pub struct Instance { pub object_index: i32, pub id: i32, pub persistent: bool, } impl Default for State { fn default() -...
//! Convergence criteria. //! //! This module defines the convergence criteria used to stop iterative root //! finders. Users can supply custom criteria by implementing the `IsConverged` //! trait. //! //! This module also supplies two canned criteria: //! //! * DeltaX - stops when the steps along x-axis, |x_pre - x_c...
use std::collections::HashMap; use std::io::{BufRead, BufReader}; use std::env; use evalexpr; use duct::cmd; use crate::parser; use crate::pipeline; pub enum ExecutionResult { NoExecution, Success(Vec<StepResult>), Error(Vec<StepResult>), } pub enum StepResult { Success(String, String), Error(St...
#![allow(dead_code)] use crate::lib::*; extern "C" { static _end: usize; static init_stack_top: usize; static text_start: usize; static text_end: usize; static rodata_start: usize; static rodata_end: usize; static data_start: usize; static data_end: usize; static bss_start: usize; ...
use crate::kube_watch::{WatchKey}; use super::AbiConfig; use super::dispatcher::AsyncType; use std::cell::Cell; use tokio::sync::mpsc::UnboundedSender; mod http_data; mod watch_data; pub(crate) use http_data::{HttpRequest, HttpResponse}; use crate::abi::rust_v1alpha1::watch_data::WatchRequest; use wasmer_runtime::*...
use players::*; use std::path::Path; use std::time::*; use std::sync::mpsc::*; use std::thread::*; enum PonderingMessage { Prune(Board), PruneMove(Move), TrySolve(u64), SolverTimeout, SolverMove(Move), GetMove(Board), SendMove(Move), } pub struct PonderingMctsPlayer { b_queue_tx : S...
use crate::{camera::Camera, pipelines::Pipeline, Context}; use std::{ os::raw::c_ulong, sync::{Arc, Mutex}, }; use vulkano::{ device::{Device, Queue}, format::Format, swapchain::{ acquire_next_image, AcquireError, PresentMode, Surface as VkSurface, SurfaceCreationError, SurfaceTransform, Swapchain, SwapchainCr...
//! Bitstream filter. use std::{ ffi::CString, os::raw::{c_char, c_int, c_void}, ptr, }; use crate::{codec::CodecParameters, packet::Packet, time::TimeBase, Error}; extern "C" { fn ffw_bsf_new(name: *const c_char, context: *mut *mut c_void) -> c_int; fn ffw_bsf_set_input_codec_parameters(context:...
/// Advent of Code 2019, day 21 /// https://adventofcode.com/2019/day/21 use std::fmt::{Display, Formatter, Result as FmtResult, Write}; use std::str::{from_utf8, FromStr}; use std::u8; use super::intcode::Intcode; use std::convert::TryInto; fn setup_intcode() -> Intcode { let data = include_bytes!("input/d21.txt...
#[doc = "Reader of register rcr"] pub type R = crate::R<u32, super::RCR>; #[doc = "Writer for register rcr"] pub type W = crate::W<u32, super::RCR>; #[doc = "Register rcr `reset()`'s with value 0"] impl crate::ResetValue for super::RCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use crate::cipher_suite::*; use crate::crypto::*; use crate::error::*; use crate::extension::extension_use_srtp::SrtpProtectionProfile; use crate::handshaker::VerifyPeerCertificateFn; use crate::signature_hash_algorithm::SignatureScheme; use anyhow::Result; use std::sync::Arc; use tokio::time::Duration; /// Config is...
extern crate euclid; extern crate image; #[cfg(feature = "glium_backend")] extern crate glium; extern crate vitral; fn main() { feature::main(); } #[cfg(feature = "glium_backend")] mod feature { use euclid::{point2, vec2, Point2D, Rect, Size2D}; use glium::glutin; use image; use vitral::glium_backend...
//! Blinks an LED //! //! This assumes that a LED is connected to pc13 as is the case on the blue pill board. //! //! Note: Without additional hardware, PC13 should not be used to drive an LED, see page 5.1.2 of //! the reference manual for an explanation. This is not an issue on the blue pill. //#![deny(unsafe_code)]...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Data In/Out Register"] pub data: crate::Reg<data::DATA_SPEC>, #[doc = "0x04 - Enable Register"] pub enable: crate::Reg<enable::ENABLE_SPEC>, #[doc = "0x08 - Control Register"] pub ctrl: crate::Reg<ctrl::CTRL_SPEC>, ...
//! Advent of Code - Day 19 Solution use error::Result; use ndarray::Array2; use std::convert::TryFrom; use std::fmt; use std::io::{self, BufRead, Write}; /// Direction of Movement #[derive(Debug, PartialEq)] enum Direction { /// We are moving up. Up, /// We are moving down. Down, /// We are moving...
/* Copyright 2019 <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, software distribut...
use super::JsonResult; use crate::database::Database; use crate::primitives::{IdentityContext, JudgementStateBlanked, NotificationMessage}; use actix::prelude::*; use actix_broker::BrokerSubscribe; use actix_web_actors::ws; use serde::Serialize; use std::collections::HashMap; use std::sync::Arc; use tokio::sync::RwLock...
//! Helper methods for checking that a value is canonical, i.e. is less than `|F|`. //! //! See https://hackmd.io/NC-yRmmtRQSvToTHb96e8Q#Checking-element-validity use plonky2::field::extension_field::Extendable; use plonky2::field::field_types::Field; use plonky2::field::packed_field::PackedField; use plonky2::hash::h...
use super::object::GitObject; use chrono::naive::NaiveDateTime; use chrono::{DateTime, FixedOffset}; use nom::character::complete::{digit1, line_ending, newline, space0, space1}; use nom::combinator::rest; use std::str::from_utf8; use std::str::{self, FromStr}; #[derive(Debug, Clone)] pub struct Person<'a> { name:...
// Get cmd-line arguments use std::env; use std::collections::HashMap; use std::fmt::Debug; // File handling use std::fs; use std::io::Write; use std::path::PathBuf; // Exec commands, write/read stdin/stdout use std::process::Command; use menu::term; // JSON handling use serde::{Serialize, Deserialize}; use serde_jso...
const MIN: usize = 2; const MAX: usize = 5; fn main() -> Result<(), Box<dyn std::error::Error>> { use std::io::Write; let enabled_version = { let mut enabled_versions = (MIN..=MAX).filter(|v| std::env::var(format!("CARGO_FEATURE_V4_{}", v)).is_ok()); let v1 = enabled_versions.next(...
// 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 crate::{ executor::bind_to_cpu_set, sys::{InnerSource, SleepNotifier}, PoolPlacement, }; use ahash::AHashMap; use alloc::rc::Rc; use core::fmt::{Debug, Formatter}; use flume::{Receiver, Sender}; use std::{ cell::{Cell, RefCell}, convert::{TryFrom, TryInto}, ffi::CString, future::Future, ...
use super::{ data::{MqttOneBytesInt, MqttVariableBytesInt}, error::DataParseError, packet::Packet, parsable::*, props::{MqttPropValue, PropOwner, Properties, Property}, reason::ConnAckReasonCode, }; use bitflags::bitflags; use bytes::{Buf, BufMut}; bitflags! { pub struct ConnAckFlags: u8 { ...
//! Exposes the `Iron` type, the main entrance point of the //! `Iron` library. use hyper::net::{Fresh, HttpListener, HttpsListener, NetworkListener, SslServer}; use hyper::server::Server; use std::net::{SocketAddr, ToSocketAddrs}; use std::time::Duration; pub use hyper::server::Listening; use crate::error::HttpResu...
use std::convert::TryFrom; use thiserror::Error; use crate::models::Color; mod reducer; pub use reducer::*; pub trait Image: Sized { /// Get the width of the image, in pixels fn width(&self) -> u16; /// Get the height of the image, in pixels fn height(&self) -> u16; /// Get the color at the gi...
use fixed::Fixed; use fnv::FnvHashMap; use libc; use parking_lot::Mutex; use std::{cell::RefCell, collections::hash_map::Entry, slice, str}; use token::Token; #[cfg(not(feature = "genet-static"))] #[no_mangle] pub extern "C" fn genet_abi_version() -> u64 { let major: u64 = env!("CARGO_PKG_VERSION_MAJOR").parse().u...
// Copyright (C) 2022 Alibaba Cloud. All rights reserved. // SPDX-License-Identifier: Apache-2.0 //! Structs to manage guest memory for virtual machines. //! //! The `vm-memory` crate only provides traits and structs to access normal guest memory, //! it doesn't support special guest memory like virtio-fs/virtio-pmem ...
use log::info; use types::test_utils::{TestingBeaconBlockBuilder, TestingBeaconStateBuilder}; use types::*; pub struct BlockBenchingBuilder { pub state_builder: TestingBeaconStateBuilder, pub block_builder: TestingBeaconBlockBuilder, pub num_validators: usize, pub num_proposer_slashings: usize, pu...
use std::{collections::HashMap, str::FromStr}; #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] enum Char { A, B, } #[derive(Clone, Debug, PartialEq, Eq)] enum Expr { Or(Vec<Expr>), Concat(Vec<Expr>), Const(Char), Ref(usize), } impl Expr { fn matched_len(&self, msg: &[Char], exprs: &Has...
//! A ring buffer is a data structure which allows to implement a FIFO structure. //! //! The buffer works with a linear buffer and two cursors: //! - The read cursor, which reads data until it reaches the write cursor //! - The write cursor, which writes data until it reaches the read cursor //! //! When a cursor reac...
// Copyright (c) 2021 <NAME> // // This software is released under the MIT License. // https://opensource.org/licenses/MIT use std::ops::Index; #[macro_use] mod macros { /// Creates a new quad-double from another number or from a string. /// /// The argument can be any expression that evaluates to a type ...
// <NAME> // https://github.com/oberzs/duku use super::mixf; use super::Hsb; use super::Mix; use super::Rgbf; /// Color bytes in RGB with alpha. /// /// Makes it easier to handle/convert colors. /// /// # Examples /// /// ``` /// # use duku::Rgb; /// let red = Rgb::red(50); /// # assert_eq!(red.r, 50); /// # assert_e...
use lopdf::{Document, Object}; use std::collections::HashMap; use std::path::PathBuf; use std::process::Command; use std::{env, fs}; #[derive(Debug)] struct Section { title: String, start_pg: u32, end_pg: u32, } trait AsString { fn as_string(&self) -> Option<String>; } impl AsString for lopdf::Objec...
// Copyright 2018 <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 ...
use crate::screen_vertex::ScreenVertexShader; use crate::viewport::Viewport; use crate::GraphicsContext; use bytemuck::{Pod, Zeroable}; use glam::Vec3; use wgpu::util::DeviceExt; pub struct OutlineRenderer { gfx: GraphicsContext, screen_vertex_shader: &'static ScreenVertexShader, render_pipeline: wgpu::Ren...
use crate::linter::CheckSet; use lazy_static::lazy_static; use std::collections::HashMap; // Checks identifiers pub const ADOPTERS: &str = "adopters"; pub const ARTIFACTHUB_BADGE: &str = "artifacthub_badge"; pub const BINARY_ARTIFACTS: &str = "binary_artifacts"; pub const BRANCH_PROTECTION: &str = "branch_protection";...
/* Standard Bit Shifts for 32-bit words */ pub const BIT_0: u32 = 1 << 0; pub const BIT_1: u32 = 1 << 1; pub const BIT_2: u32 = 1 << 2; pub const BIT_3: u32 = 1 << 3; pub const BIT_4: u32 = 1 << 4; pub const BIT_5: u32 = 1 << 5; pub const BIT_6: u32 = 1 << 6; pub const ...
use crate::papers::{MergeSpec, Workspace}; use crate::prelude::*; use std::future::Future; use futures::compat::*; use futures::{FutureExt, StreamExt, TryFutureExt}; use slog::{debug, error, Logger}; use std::pin::Pin; use std::path::*; use std::process::Command; use tokio_process::CommandExt; pub struct Merger { ...
use lazy_static; use crate::Token; use crate::TokenType; use crate::Literal; use std::collections::HashMap; pub struct Scanner { source: String, tokens: Vec<Token>, start: usize, current: usize, line: usize } impl Scanner { pub fn new(s: String) -> Scanner { Scanner { sour...
use std::cell::RefCell; use fnv::{FnvHashMap as HashMap}; use rust_stemmers::Stemmer; use crate::utils::to_vec; use super::{CharClass, PartOfSpeech}; use super::normalize::Normalize; const BUFFER_CAPACITY: usize = 20; pub struct Lang { stemmer: Option<Stemmer>, char_map: HashMap<char, CharClass>, ...
// Copyright 2018-2022 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...
// Copyright (c) 2018-2022 Ministerio de Fomento // Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC) // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the ...
use std::{ fs, path::{Path, PathBuf}, thread, time::Duration, }; use headless_chrome::{Browser, FetcherOptions, LaunchOptions}; use rand::random; use scraper::{ElementRef, Html, Node, Selector}; use url::Url; use crate::Result; use super::types::{Category, Product, ProductInfo}; const BASE_URL: &str...
#[derive(Clone, Copy, PartialEq, Eq, Default, Debug)] pub struct BitDp(pub usize); impl BitDp { pub fn is_element(mask: usize, x: usize) -> bool { mask & 1 << x != 0 } pub fn elements(self, mask: usize) -> impl Iterator<Item = usize> { (0..self.0).filter(move |&x| Self::is_element(mask, x))...
//! Swap calculations use crate::{curve::math::PreciseNumber, error::SwapError}; use std::fmt::Debug; /// Initial amount of pool tokens for swap contract, hard-coded to something /// "sensible" given a maximum of u128. /// Note that on Ethereum, Uniswap uses the geometric mean of all provided /// input amounts, and B...
use errors::DataError; use models::*; use std::fs; use std::path::{Path, PathBuf}; use uuid::Uuid; pub struct FsFolder { pub folder_name: Option<String>, pub folder_path: PathBuf, } pub struct OwnedNewFile { pub file_id: String, pub folder_id: String, pub file_name: String, pub file_size: Opti...
use crate::platform::{CALLBACKS, RPC}; use crate::{Dispatcher, Result}; use std::{ collections::hash_map::DefaultHasher, ffi::{c_void, CStr, CString}, hash::{Hash, Hasher}, os::raw::c_char, ptr::null, }; use cocoa::appkit::{NSView, NSViewHeightSizable, NSViewWidthSizable}; use cocoa::base::id; use...
//! Defines an alternative trait to `std::ops::Try`, `Question` that is not as oriented towards tries and failures. //! //! The trait uses a more neutral `ExtractOrReturn` enum to express whether a certain expression `e` should result in some //! value being returned early, or in some other value being extracted from...
/******************************************************************************* * (c) 2022 Zondax GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/lic...
//! The WebAssembly possible errors use crate::ExternType; use std::io; use thiserror::Error; /// The Serialize error can occur when serializing a /// compiled Module into a binary. #[derive(Error, Debug)] pub enum SerializeError { /// An IO error #[error(transparent)] Io(#[from] io::Error), /// A gene...
#![feature(conservative_impl_trait)] #[macro_use] extern crate aoc2017; #[macro_use] extern crate lazy_static; use std::collections::*; #[derive(Debug,Clone, Eq, PartialEq)] struct TowerInfo { name: String, weight: usize, children: Vec<String>, } regex_parser!(parse_tinfo: TowerInfo { TOWER = r#"^\s*...
use base64::DecodeError; use ring::error; use serde_json::error::Error as JsonError; use std::string::FromUtf8Error; use std::time::{Duration, SystemTime}; use std::{convert::From, error::Error, fmt}; #[derive(PartialEq, Debug)] pub enum WebPushError { /// An unknown error happened encrypting the message, Unsp...
/*! This crate offers transparent rustic wrappers around the CUDA driver API. # What is this? This crate offers Rust versions of functions and types from the CUDA driver API. It assumes the user is aware of how the CUDA API looks like, but wants slightly more convenience when working with CUDA. The goal of this crate...
//! Custom derive support for the `der` crate #![crate_type = "proc-macro"] #![warn(rust_2018_idioms, trivial_casts, unused_qualifications)] use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use syn::{ DataStruct, Field, Generics, Ident, Lifetime, Lit, Meta, MetaList, MetaNameValue, NestedMeta, }; use s...
use std::{fs, collections::HashMap}; use self::cube::*; mod cube; pub fn part_1() { let instructions = parse_instructions("./input/day_22.txt"); let mut cubes = HashMap::new(); for instruction in instructions { apply_instruction_clamped(&mut cubes, instruction, 50); } let on_cubes = cubes ...