text
stringlengths
3.09k
13.9k
//! Update agent. mod actor; use crate::cincinnati::Cincinnati; use crate::config::Settings; use crate::identity::Identity; use crate::rpm_ostree::{Release, RpmOstreeClient}; use crate::strategy::UpdateStrategy; use actix::Addr; use chrono::prelude::*; use prometheus::IntGauge; use std::time::Duration; /// Default t...
#![allow(non_snake_case)] extern crate bulletproofs; extern crate curve25519_dalek; extern crate merlin; extern crate rand; use bulletproofs::r1cs::*; use bulletproofs::{BulletproofGens, PedersenGens}; use curve25519_dalek::ristretto::CompressedRistretto; use curve25519_dalek::scalar::Scalar; use merlin::Transcript; u...
extern crate anyhow; extern crate lazy_static; extern crate log; use anyhow::*; use core::panic; use cursive::align::HAlign; use cursive::theme::*; use cursive::traits::*; use cursive::view::Resizable; use cursive::views::*; use cursive::Cursive; use std::fs; use std::io::Write; pub mod cli; pub mod config; pub mod e...
extern crate dirs_sys; use std::env; use std::path::PathBuf; use BaseDirs; use UserDirs; use ProjectDirs; pub fn base_dirs() -> Option<BaseDirs> { if let Some(home_dir) = dirs_sys::home_dir() { let cache_dir = env::var_os("XDG_CACHE_HOME") .and_then(dirs_sys::is_absolute_path).unwrap_or_else(|| hom...
use crate::color::{COLOR_HEX_BLUE_3, COLOR_HEX_BLUE_4}; use crate::render::svg::*; use crate::shape::point::Point; use crate::{Color, Error, LinearScale, PointLabelPosition, PointType, Scale, View}; use svg::Node; const DEFAULT_LABEL_VISIBLE: bool = true; const DEFAULT_LABEL_POSITION: PointLabelPosition = PointLabelPo...
// Copyright 2019 The Druid Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
#![no_main] #![no_std] // Exemple to look at the different module states use panic_rtt_target as _; use rtt_target::{rprintln, rtt_init_print}; use cortex_m_rt::entry; use stm32f1xx_hal::{ delay::Delay, pac, prelude::*, spi::{Mode, Phase, Polarity, Spi}, }; use embedded_hal::{blocking::spi, digital::v2::OutputPi...
//! Filters that can be applied to elements. //! //! Filters implement the [`Filter`] trait. You can apply a filter to an element by creating a //! [`Filtered`] using the [`filter`](super::ElementExt::filter) method or more specific shortcut //! methods such as [`on`](super::ElementExt::on). use std::fmt; use std::mar...
//! # Memory Size Type //! //! This crate implements several data types for strongly typed memory size indications. //! //! There is support for memory units with a base of 10 (as recommended by the International //! Electrotechnical Commission). A support for memory units with the base of 2 (as standardized //! by IEC...
//! FIXME: write short doc here use std::{ collections::BTreeMap, fmt, }; use {TomlDoc, CstNode, ast, visitor::{visitor, process_children}}; pub enum Item { Map(Map), Array(Vec<Item>), Integer(i64), Float(f64), Bool(bool), DateTime, String(String), } pub struct Map { map: BTre...
use rustc_serialize::json::{Object, Json, ToJson, encode}; use base::config::Config; use base::db::MyPool; use iron::prelude::*; use persistent::Read; use hbsi::Template; use iron::status; use mysql as my; use iron_login::User; use iron::Url; use iron::modifiers::Redirect; use iron::Handler; use iron::modifiers::Header...
// Copyright 2020 Mimir (mimirmim) // // 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 disclaim...
#[doc = "Register `BREQUEST` reader"] pub struct R(crate::R<BREQUEST_SPEC>); impl core::ops::Deref for R { type Target = crate::R<BREQUEST_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<BREQUEST_SPEC>> for R { #[inline(always)] fn from(reader: ...
// parse.rs pub mod error; use serde::{Deserialize, Deserializer, de}; use serde_json::Value; use std::str::FromStr; use crate::model::{signal::{Wave, Level, Clock, SignalGenerator}, Signal, Diagram, Lane, utils::Color, marker::{Marker, Label}}; use self::error::{ParseWaveError, ParseError}; fn default_to_1() -> ...
use sgx_rand::{Rng, os::SgxRng}; use sgx_tcrypto as tcrypto; use sgx_types::*; use std::io::{self}; use std::ptr; use std::vec::Vec; use tse; extern "C" { pub fn ocall_sgx_init_quote ( ret_val : *mut sgx_status_t, ret_ti : *mut sgx_target_info_t, ret_gid : *mut sgx_epid_group_i...
// Copyright 2018-2020, Wayfair 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/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
use anyhow::{Context as _, Result}; use rayon::{ iter::{IntoParallelRefIterator, ParallelBridge, ParallelExtend, ParallelIterator}, slice::ParallelSliceMut, }; use serde::{Deserialize, Serialize}; use std::{ collections::{BTreeMap, HashMap}, fs, path::Path, }; use tera::Context; use walkdir::WalkDir...
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0. use crate::proto::{Health, HealthCheckRequest, HealthCheckResponse, ServingStatus}; use futures::{FutureExt, SinkExt, Stream, StreamExt}; use grpcio::{RpcContext, RpcStatus, RpcStatusCode, ServerStreamingSink, UnarySink, WriteFlags}; use log::info; use...
// Copyright 2015 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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 ...
use windows::Windows::Win32::Foundation::{HINSTANCE, HWND, LPARAM, LRESULT, WPARAM}; use windows::Windows::Win32::UI::WindowsAndMessaging::{ CallNextHookEx, DispatchMessageW, PeekMessageW, SetWindowsHookExA, TranslateMessage, UnhookWindowsHookEx, HHOOK, KBDLLHOOKSTRUCT, MSG, PM_REMOVE, WH_KEYBOARD_LL, WM_KEYDOW...
//! Partition a list of integers into two equal-sum sublists. //! //! # Example //! //! ``` //! use equibipartite::get_equi_partition; //! //! let collection = vec![1, 4, 7, 35, 2, 1, 18, 6]; //! let partition = get_equi_partition(&collection); //! println!("{:#?}", partition); //! //! let collection = vec![1, 2, 3,...
use crate::accel::*; use crate::analog::*; use crate::app::*; use crate::control::*; use crate::counter::*; use crate::led::*; use cfg_if::cfg_if; use drogue_device::{actors::led::Led, firmware::*, flash::*, shared::*, ActorContext, Address}; use embassy::executor::Spawner; use embassy::util::Forever; use embassy_nrf::...
use crate::imp::structs::qv::{Qv, QvType}; use crate::imp::structs::rust_string::{RustString }; use crate::imp::structs::rust_value::RustMemberType; use crate::imp::structs::rust_array::{RustArray, RustIntArray, RustFloatArray, RustBinary}; use crate::imp::structs::array_type::ArrayType; use crate::imp::structs::util::...
/* Copyright 2021 Integritee AG and Supercomputing Systems AG 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 super::Scheme; use crate::{ archive::{self, FileContents}, resource::ResourceMagic, }; use anyhow::Context; use bytes::BytesMut; use positioned_io::{RandomAccessFile, ReadAt}; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use scroll::{ctx, Pread, LE}; use std::path::{Path, PathBuf}; #[deriv...
use std::vec::Vec; use num::complex::Complex64; #[derive(Copy, Clone)] pub struct FieldValue { // Complex amplitude pub value: Complex64, // Next complex amplitude, used as a temporary storage in order not to corrupt the current iteration data pub next_value: Complex64, // Potential pub potential: f64, } ...
use crate::editor::{entity, entity::Entity, property, shape, styles}; use crate::intrinsics::*; use std::collections::BTreeMap; use wasm_bindgen::JsValue; /// Color to draw a wire by default, when it is hovered and when it's selected pub mod color { use crate::intrinsics::Color; pub fn default() -> Color { ...
use crate::*; use crevice::std430::{AsStd430, Std430}; use std::{num::NonZeroU64, sync::Arc}; /// [MeshRenderer] is a simplified interface to drawing a mesh and texture /// with a specified "draw configuration" ([Draw]). #[derive(Debug)] pub struct MeshRenderer { uniforms: GrowingBufferArena, uniform_layout: ...
use cpu::Context; use std::time::Duration; mod utils; use base::charset::{Colour, DescribedChar, LincolnChar, LincolnState, Script}; use base::Unsigned6Bit; use cpu::*; use float_next_after::NextAfter; use tracing::{event, Level}; use wasm_bindgen::prelude::*; use web_sys::{Document, Window}; #[wasm_bindgen] extern ...
/******************************************************************************* * (c) 2020 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...
extern crate gullery; #[macro_use] extern crate gullery_macros; extern crate glutin; extern crate png; mod helper; use gullery::{ buffer::*, framebuffer::{render_state::*, *}, geometry::D2, geometry::{GLVec2, Normalized}, image_format::*, program::*, texture::{sample_parameters::*, *}, ...
//! Application Domains use crate::avm2::activation::Activation; use crate::avm2::names::{Multiname, QName}; use crate::avm2::object::{ByteArrayObject, TObject}; use crate::avm2::script::Script; use crate::avm2::value::Value; use crate::avm2::Error; use gc_arena::{Collect, GcCell, MutationContext}; use std::collection...
#![allow(non_camel_case_types, dead_code)] use log::debug; use std::ffi::CString; #[derive(Clone, Copy, Debug, PartialEq)] #[repr(transparent)] pub struct VALUE(libc::uintptr_t); #[derive(Clone, Copy)] #[repr(transparent)] pub struct ID(libc::uintptr_t); #[repr(C)] #[derive(Debug, Clone, Copy)] pub enum ruby_value_t...
use iref::{Iri, IriBuf}; use std::collections::HashMap; use std::fmt; use std::ops::{Deref, Range}; use std::path::{Path, PathBuf}; #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] pub struct FileId(usize); pub struct File { source: PathBuf, base_iri: Option<IriBuf>, buffer: Buffer, mime_type: ...
/** * Copyright (c) Visly Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use core; use json::JsonValue; use std::any::Any; use std::f32; use stretch::geometry::Rect; use stretch::geometry::Size; use stretch::number::*; use jni...
use engine::asset::loader::{Loadable, Loader}; use engine::asset::{AssetError, AssetResult, AssetSystem, File, FileFuture}; use engine::render::{PreprocessedShaderCode, Shader, ShaderKind, ShaderKindFs, ShaderKindProvider, ShaderKindVs}; use std::str; use std::marker::PhantomData; use futur...
#[cfg(feature = "use_std")] use crate::max_encoding_length; /// The [`CobsEncoder`] type is used to encode a stream of bytes to a /// given mutable output slice. This is often useful when heap data /// structures are not available, or when not all message bytes are /// received at a single point in time. #[derive(Debu...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use crate::{node::Link, nodes_for_height, BitMap, Error, Node, Root, MAX_INDEX, WIDTH}; use cid::{multihash::Blake2b256, Cid}; use encoding::{de::DeserializeOwned, ser::Serialize}; use ipld_blockstore::BlockStore; /// Array Mapped Trie al...
use std::fs::File; use std::path::PathBuf; use fs2::FileExt; use crate::Error; use tracing::debug; // The path to were the shared_mem file-link would be stored const SCHEDULER_LOCK: &str = "scheduler.lock"; #[cfg(test)] const IPC_PATH: &str = "ipc_buffer"; pub struct GlobalMutex(File); impl GlobalMutex { fn tm...
// Copyright (c) 2021-2022 Toposware, Inc. // // 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 ...
use std::{str::FromStr, sync::Arc}; use anchor_lang::prelude::Pubkey; use mpl_token_metadata::state::Collection; use solana_program_test::ProgramTest; use solana_sdk::{signer::Signer, transport::TransportError}; use crate::program_test::program_test_bench::{MintCookie, ProgramTestBench, WalletCookie}; pub struct Nft...
//! Source Text //! //! This module contains a a structure to represent the source text of //! the program. It is used to hold the source code in memory for //! iteration by the lexer. Indexing in to the source is possible //! using `Location`s, and `Location`s can be turned into `(line, //! col)` position pairs for di...
use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; use std::net::SocketAddr; use std::time::{Duration, Instant}; use failure::{bail, Error}; use futures::prelude::*; use log::{info, warn}; use crate::connected::Connected; use crate::packet::{ ControlPacket, ControlTypes, HandshakeContro...
use std::ptr; use std::fs; use std::io::{BufWriter, Write}; // Import the module generated by bin2src mod lorem; #[allow(dead_code)] const AUTHOR:&'static str = "<NAME>"; #[allow(dead_code)] const REPO:&'static str = "https://github.com/gomiero/bin2src"; // Output buffer size const BUFFER_OUT_SIZE: usize = 524_28...
pub mod activations; pub mod conv; pub mod core; pub mod linalg; pub mod loss; pub mod math; pub mod stats; use crate::autodiff::var::WeakVar; use crate::autodiff::Var; use crate::paper_experiments::f32_to_mibs; use crate::profile::Profiler; use crate::tensor::shape::{Shape, ToIndex, ToShape}; use crate::tensor::Tenso...
#![allow(non_upper_case_globals)] #![feature(libc, test)] extern crate test; extern crate seccomp; extern crate libc; extern crate parking_lot; use std::sync::mpsc::{channel, Sender}; use std::thread; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use seccomp::*; use parking_lot::{Mutex, Condvar}...
/*! Provides structs and traits that provide company information. The majority of the data provided here is information published by the company itself usually in regulatory filings. */ use crate::prelude::*; // ------------------------------------------------------------------------------------------------ // Publi...
use super::{make_call, Error, SassFunction}; use crate::css::{CallArgs, Value}; use crate::value::{Number, Quotes, Unit}; use crate::variablescope::Scope; use num_rational::Rational; use num_traits::{One, Zero}; use std::collections::BTreeMap; fn do_rgba(fn_name: &str, s: &dyn Scope) -> Result<Value, Error> { let ...
extern crate serde_json; extern crate ureq; use super::Candle; use crate::{client::Client, helpers::make_params, with_param}; use chrono::{Duration, NaiveDate, Utc}; use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, fs::create_dir_all, io::{self, Error, ErrorKind} }; static LOG_DIR_AGGS: &st...
use std::fs::{self, File}; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use anyhow::bail; use filetime::{set_file_times, FileTime}; const ABOUT: &'static str = " szip compresses and decompresses data in the Snappy format. szip works similarly to gzip. It takes files as parameters, compresses the...
use graph::{Tools, Coord, HTML}; use entry::Entry; use scale::Scale; pub struct Axes2d { pub x: Axis, pub y: Axis, } impl Axes2d { pub fn new((width, height): (f32, f32), x_opt: AxisOption, y_opt: AxisOption) -> Axes2d { let label_height = 30.0; // TODO: calculate dynamical...
// Copyright (c) 2021 <NAME> // // 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. All files in the project carrying such notice may not be copied, // modified, ...
///! # Robin-CLI ///! ///! This module defines the CLI for Robin #[macro_use] extern crate clap; extern crate rustyline; extern crate robin_core; extern crate itertools; use std::process::{Command, Child, Stdio}; use std::io::{Read, Write}; use std::fs::File; use rustyline::Editor; use itertools::join; use clap::{A...
use sentry_core::protocol::{Breadcrumb, Event, Level, Map, Value}; use slog::{Key, OwnedKVList, Record, Serializer, KV}; use std::fmt; /// Converts a [`slog::Level`] to a Sentry [`Level`] pub fn convert_log_level(level: slog::Level) -> Level { match level { slog::Level::Trace | slog::Level::Debug => Level:...
use web_sys::WebGl2RenderingContext as WebGL; use super::super::super::assets::prelude::*; impl From<MeshHint> for u32 { fn from(hint: MeshHint) -> Self { match hint { MeshHint::Immutable => WebGL::STATIC_DRAW, MeshHint::Stream => WebGL::STREAM_DRAW, MeshHint::Dynamic =...
//! This module provides an API for grouping multiple flexer rules. use crate::automata::pattern::Pattern; use crate::automata::nfa::NFA; use crate::group::rule::Rule; use itertools::Itertools; pub mod rule; // =========== // == Group == // =========== /// A group is a structure for associating multiple rules wi...
// 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 implode::symbol::{Symbol, CodeTable, DEFAULT_CODE_TABLE, decode_bits, BitDecodeError, END}; // For the lit_* tests, pass a value of 0xFFFF_FFFF as dict_bits, // so interpretation as a Pair would certainly cause a failed test. #[test] fn test_lit() { let mut iterations: u32 = 0; for b in 0..256 { ...
use cosmwasm_std::{Uint128, Addr, Coin}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::staking::{CardType}; //------------Config--------------------------------------- #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct Config { pub owner: Addr, pub wef...
// SPDX-License-Identifier: MIT OR BlueOak-1.0.0 use crate::unicode; use crate::value::Value; use std::collections::HashMap; use std::option::Option; use std::str::Chars; fn is_ws(c: char) -> bool { c == ' ' || c == '\t' || c == '\n' || c == '\r' } fn peek(chars: &Chars) -> Option<char> { chars.clone().next(...
// 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 writi...
use crate::models::host_name::{HostName, IpLiteral}; use oni_comb_parser_rs::prelude::*; use std::iter::FromIterator; use crate::parsers::basic_parsers::{pct_encoded, sub_delims, unreserved}; use crate::parsers::ip_v4_address_parsers::ip_v4_address; use crate::parsers::ip_v6_address_parsers::ip_v6_address; // host ...
use crate::exec::{Trap, PAGE_SIZE}; use crate::{ExecError, Result}; use std::ops::{Index, IndexMut}; use wiggle::{BorrowHandle, GuestError, GuestMemory, Region}; use wiggle_borrow::BorrowChecker; pub struct Mem { mem: Vec<u8>, limit: Option<u32>, bc: BorrowChecker, } impl Index<u32> for Mem { type O...
//! Error variants. use std::{ convert::{Infallible, TryFrom}, error, fmt, result, }; use log::SetLoggerError; /// Result type with [`Error`] variants. /// /// [`Error`]: ./enum.Error.html pub type Result<T> = result::Result<T, Error>; pub trait WrapError<T> { /// Wrap something into a standard Result ...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use crate::BoxError; use http::Request; use hyper::client::ResponseFuture; use hyper::Response; use smithy_http::body::SdkBody; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}...
use crate::context::Context; use crate::geometry::{SimpleMesh, ToSimpleMesh, ToSimpleMeshWithMaterial}; use clap::{App, Arg, ArgMatches, SubCommand}; use std::error::Error; use std::fs::OpenOptions; use std::path::Path; pub fn cli_matches<'a>() -> ArgMatches<'a> { commands_for_subcommands( App::new("Sloth"...
use std::io::Write; use liquid_core::error::ResultLiquidExt; use liquid_core::model::{ValueView, ValueViewCmp}; use liquid_core::parser::BlockElement; use liquid_core::parser::TryMatchToken; use liquid_core::Expression; use liquid_core::Language; use liquid_core::Renderable; use liquid_core::Result; use liquid_core::R...
use core::cell::Cell; pub use cortex_a::{enable_irq, wfi}; pub use heapless::{consts, i::Queue as iQueue, spsc::Queue}; use pac::{gicc::GICC, gicd::GICD}; pub use usbarmory_rt::Interrupt; pub type FQ<N> = Queue<u8, N, u8>; pub type RQ<T, N> = Queue<(T, u8), N, u8>; /// (hard-coded) priority bits const PRIO_BITS: u8 ...
use std::{collections::HashMap, time::Instant}; use clashctl_interactive::{Noop, RuleSort}; use smart_default::SmartDefault; use crate::{ clashctl::model::{ConnectionWithSpeed, Log, Rule, Traffic, Version}, components::{MovableListManage, MovableListManager, MovableListState, ProxyTree}, Action, ConfigSta...
use core::mem::transmute; use crate::console::uart::uart_intr; use crate::driver::DISK; use crate::memory::layout::{TRAMPOLINE, TRAPFRAME, UART0_IRQ, VIRTIO0_IRQ}; use crate::memory::make_satp; use crate::plic::{plic_claim, plic_complete}; use crate::process::{cpu_id, CPU_MANAGER, PROCESS_MANAGER}; use crate::process:...
// Modified version of interop.rs from here: // https://github.com/kawamuray/wasmtime-java use std::{ sync::atomic::{AtomicU64, Ordering}, sync::Mutex, }; use jni::{ errors::Result as JniResult, JNIEnv, objects::{JFieldID, JObject}, signature::{JavaType, Primitive}, sys::jlong...
use iced::keyboard::KeyCode; use lazy_static::lazy_static; use nes_core::controller::ControllerState; use std::collections::{hash_map::Entry, HashMap}; use std::sync::{Arc, RwLock}; use crate::emulator::Message; const INPUTS_LIST: &[Input] = { use Input::*; &[ ButtonA, ButtonB, ButtonS...
//! //! use crate::units::{Acceleration, Distance, GravitationalFieldStrength, Length, Mass, Moment}; use crate::{Direction, Magnitude}; /// Any interaction that, when unopposed, will change the motion of an object, /// measured in `N` (newtons). /// /// See also: /// - [Weight] /// /// # External links /// - <https:...
use { std::hash::Hash, batsmt_core::{ast_u32::AST, backtrack::{Backtrackable, HashMap as BHMap}}, crate::{ cc::{self, MicroTheory, MicroTheoryArg, NodeID, }, theories::{SVec,Injectivity}, Ctx, pp_t, InjectiveView, SelectorView, HasInjectivity, HasSelector, }, }; /// Theory...
use crate::material::Material; use crate::vec_math::{Color, Point3, Vec3}; use rand::prelude::ThreadRng; pub struct Ray { pub origin: Point3, pub direction: Vec3, } pub trait Hittable { fn hit(&self, ray: &Ray, t_bounds: (f64, f64)) -> Option<HitRecord>; } //#[derive(Clone, Copy)] pub struct HitRecord { ...
use cortex_m::interrupt::CriticalSection; use stm32f439x::RCC; use rcc::Clock; // TODO: support bitbanding macro_rules! special { ($( $name:ident = $val:expr ),*) => { #[allow(non_camel_case_types)] #[derive(Copy, Clone)] pub enum Special { $( $name ),* } impl S...
//! //! N-Queens //! //! https://leetcode.com/problems/n-queens/ //! //! The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. //! //! ![](https://assets.leetcode.com/uploads/2018/10/12/8-queens.png) //! //! Given an integer n, return all distinct solutio...
//! # Serial Peripheral Interface use nb; pub use crate::hal::spi::{Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}; use crate::pac::{spi0, SPI0, SPI1}; use crate::gpio::gpioa::{PA5, PA6, PA7}; use crate::gpio::gpiob::{PB13, PB14, PB15, PB3, PB4, PB5}; use crate::gpio::{Alternate, Floating, Input, PushPull}; u...
use std::net::ToSocketAddrs; use std::sync::Arc; use std::time::{Duration, Instant}; use failure::{err_msg, Error, ResultExt}; use futures::future::FutureExt; use http::header::HeaderValue; use http::uri::Uri; use hyper::client::HttpConnector; use hyper::server::conn::AddrStream; use hyper::service::{make_service_fn, ...
//! "placement-new" derive macros #![forbid(unsafe_code)] #![deny( missing_docs, clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo )] #![allow(clippy::module_name_repetitions)] extern crate proc_macro; use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::parse::Pars...
use crate::CompositionSettings; pub type Pitches = Vec<f64>; const C: f64 = 261.626; const C_SHARP: f64 = 277.183; const D: f64 = 293.665; const D_SHARP: f64 = 311.127; const E: f64 = 329.628; const F: f64 = 349.228; const F_SHARP: f64 = 369.994; const G: f64 = 391.995; const G_SHARP: f64 = 415.305; const A: f64 = 44...
//! F-BLEAU estimation routines. /// Main estimation routine. /// /// Given training and evaluation (test) data, this function runs /// the desired estimator and returns a tuple containing: /// - smallest estimate /// - final estimate (i.e., the estimate when all the training data was /// available) /// ...
use crate::highlight; use crate::util; use highlight::Highlighter; use pulldown_cmark::*; use std::iter::Peekable; /// # A single ement in the TOC /// /// Represents either a captured event from Pulldown or a header /// element. #[derive(Debug, PartialEq)] pub enum TocElement { /// Pre-Rendered HTML block Html...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Control Register"] pub cr: crate::Reg<cr::CR_SPEC>, #[doc = "0x04 - Mode Register"] pub mr: crate::Reg<mr::MR_SPEC>, #[doc = "0x08 - Receive Data Register"] pub rdr: crate::Reg<rdr::RDR_SPEC>, #[doc = "0x0c - Tr...
//! Fake machine implementation to validate an allocation history. use std::{ collections::{btree_map as map, BTreeMap}, fmt, }; use crate::{AllocZeroed, Event, Pointer, Request, Violation}; /// A memory region. Including its location in memory `ptr`, it's `size` and /// alignment `align`. #[derive(Debug, Cl...
// Copyright (c) Facebook, Inc. and its affiliates. // SPDX-License-Identifier: Apache-2.0 extern crate clap; extern crate common; extern crate ctrlc; extern crate protocol; extern crate retry; extern crate rpc; extern crate tonic; use clap::{App, Arg, ArgGroup}; use tonic::Request; use common::timer; mod rpc_clie...
use std::fmt::*; use std::collections::HashMap; type SymbolId = i32; enum Val { Int(i32), Nil, Cons(Box<Val>, Box<Val>), Symbol(String), } /* struct VmContext<'a> { // I THINK the lifetime specifier here says that the &str // lasts as long as the VmContext does... symbols : std::collect...
pub mod space; pub mod seq; pub mod seq_of; pub mod set; pub mod set_of; pub mod choice; pub mod int; pub mod spec; use nom::{is_alphanumeric, alpha, digit}; use parse::space::skip_other; use parse::seq::asn1_seq; use parse::seq_of::asn1_seq_of; use parse::set::asn1_set; use parse::set_of::asn1_set_of; use parse::cho...
pub type InputMode = i32; pub type OutputMode = i32; pub type EventType = u8; pub type Modifier = u8; pub type Key = u16; pub type Attribute = u16; /// Terminal cursor information #[derive(Debug)] pub struct CursorInfo { pub visible: bool, pub x: i16, pub y: i16, } /// A structure to keep a pair of coordi...
use crate::client::{InnerClient, Responses}; use crate::codec::FrontendMessage; use crate::connection::RequestMessages; #[cfg(feature = "raw")] use crate::types::Type; #[cfg(feature = "raw")] use crate::Client; use crate::Error; use bytes::Bytes; #[cfg(feature = "raw")] use fallible_iterator::FallibleIterator; #[cfg(fe...
use bitcoin_wallet::account::{Account, AccountAddressType, MasterAccount, MasterKeyEntropy, Seed, Unlocker}; use bitcoin_wallet::mnemonic::Mnemonic; use rand::{RngCore, thread_rng}; pub fn get_account(master: &MasterAccount, passphrase: &str, address_type: AccountAddressType, account_number: u32, sub_account_number: u...
use crate::helpers::*; use miniquad::*; /// vertex shader for the sprite rendering pipeline const VERTEX: &str = r#"#version 100 attribute vec2 v_pos; attribute mat4 i_model; attribute vec2 i_tiles; attribute float i_hframe; attribute float i_vframe; attribute float i_depth; uniform mat4 projection; varying highp v...
//! Parser example. //! //! This is a very tiny example that parses arithmetic expressions with variables. The full code is //! less than 200 lines long, including the types for the AST. The parser also handles //! //! - single-line `// ... \n` comments; //! - multi-line `/* ... */` comments. //! //! ```rust //! use sw...
//! //! Module containing the definition of the private key container //! use crate::{sig::Signature, Components, VerifyingKey, DSA_OID}; use core::cmp::min; use digest::{ block_buffer::Eager, consts::U256, core_api::{BlockSizeUser, BufferKindUser, CoreProxy, FixedOutputCore}, typenum::{IsLess, Le, Non...
//! Stored's configuration. //! //! Main type is [`Config`]. use std::fmt; use std::fs::File; use std::io::{self, Read}; use std::iter::FromIterator; use std::net::SocketAddr; use std::net::ToSocketAddrs; use std::path::Path; use std::str::FromStr; use human_size::{Kibibyte, Mebibyte, SpecificSize}; use serde::de::{D...
#![no_std] #![no_main] use cortex_m_rt::entry; use cortex_m_semihosting::hprintln; use panic_semihosting as _; // panic handler use sam4e_xplained_pro::{ hal::{ clock::*, gpio::Ports, pac::{CorePeripherals, Peripherals}, static_memory_controller::{AccessMode, ChipSelectConfiguration...
use std::io::{BufRead, Write, stdout, stdin}; use std::time::{Instant}; use std::cmp::Ordering; use std::collections::BinaryHeap; use crossterm::{ ExecutableCommand, QueueableCommand, style::{self, Attribute, Color, Print}, Result, event, }; #[derive(Copy, Clone, Eq, PartialEq)] struct MinVertex { ...
use std::collections::HashMap; use regex::{Captures, Regex}; use crate::coco_commit::{CocoCommit, FileChange}; use crate::cli_option::ConvertOptions; use crate::database::Database; lazy_static! { static ref COMMIT_INFO: Regex = Regex::new( r"(?x) \[(?P<commit_id>[\d|a-f]{5,12})\] \s(?P<author>.*?)<(?P<em...
use std::fs; use std::cmp; use std::ops; #[derive(Debug, PartialEq, Clone, Copy)] struct Vec2 { x: i32, y: i32 } impl Vec2 { fn new(x: i32, y: i32) -> Vec2 { Vec2{x: x, y: y} } } impl ops::Add for Vec2 { type Output = Vec2; fn add(self, o: Vec2) -> Vec2 { Vec2::new(self.x + o.x, self.y + o.y) } }...
use bitflags::bitflags; use super::Mode; bitflags! { #[derive(Default)] struct LCDControl: u8 { const ENABLE = bit!(7); const WINDOW_TILE_MAP_SELECT = bit!(6); const WINDOW_DISPLAY_ENABLE = bit!(5); const TILE_DATA_SELECT = bit!(4); co...