text stringlengths 3.09k 13.9k |
|---|
/**
* File : main.rs
* Author : <NAME> <<EMAIL>>
* Date : 16.05.2020
* Last Modified Date: 16.05.2020
* Last Modified By : <NAME> <<EMAIL>>
*/
/**
* src/main.rs
* Copyright (c) 2020 <NAME> <<EMAIL>>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* yo... |
use crate::cli::buckets_builder::{
BucketSettings, DurabilityLevel, JSONBucketSettings, JSONCloudBucketSettings,
};
use crate::cli::cloud_json::JSONCloudClusterSummary;
use crate::cli::util::cluster_identifiers_from;
use crate::client::{CloudRequest, HttpResponse, ManagementRequest};
use crate::state::State;
use as... |
use std::time::Duration;
use amethyst_assets::AssetStorage;
use amethyst_core::{duration_to_nanos, duration_to_secs, nanos_to_duration, secs_to_duration,
LocalTransform, Time};
use specs::{Fetch, Join, System, WriteStorage};
use interpolation::Interpolate;
use resources::{ControlState, EndControl,... |
/// Errors for bit ranges
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
pub enum Error {
/// The bit range is 0 bits wide
#[error("bitRange width of 0 does not make sense")]
ZeroWidth,
}
/// A bit range, describing the [least significant bit](Self::lsb) and [most significant bit](Self::msb)
#[de... |
use std::collections::{HashSet, VecDeque};
use std::io::prelude::*;
use std::ops::{Deref, DerefMut};
use std::process::exit;
use gba::{Cpu, Gba};
use util::*;
use crate::Window;
static mut DEBUGGER: Option<Debugger> = None;
#[allow(dead_code)]
pub fn init_debugger(gba: *mut Gba) -> &'static mut Debugger {
std::... |
use super::net::ServerConnection;
use crate::prelude::*;
use comn::controls::Heading;
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};
use stdweb::{
traits::IKeyboardEvent,
web::{
document,
event::{ConcreteEvent, KeyPressEvent, KeyUpEvent, MouseDownEvent},
IEventTarget,
... |
use crate::util::{calculate_vec2f, vec2f_to_vec2i, Rect2f, Vec2f, WRng};
use crate::world::agent::brain::{Brain, Command, Commands, Percept, Percepts};
use crate::world::agent::genes::Genes;
use crate::world::params::Params;
use crate::world::plant_grid::PlantGrid;
use rand::Rng;
use strum::EnumCount;
use vek::ops::{Cl... |
use crate::parse_error::ParseError;
use nom::{
combinator::{map, map_opt, map_res},
number::complete::{le_u16, le_u8},
IResult,
};
/// Bits per pixel.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[non_exhaustive]
pub enum Bpp {
/// 8 bits per pixel.
Bits8,
/// 16 bits pe... |
use std::mem;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use neli::attr::Attribute;
use neli::consts::nl::{NlmF, NlmFFlags};
use neli::consts::socket::NlFamily;
use neli::consts::rtnl::{Ifa, IfaFFlags, RtAddrFamily, RtScope, Rtm};
use neli::nl::{NlPayload, Nlmsghdr};
use neli::rtnl::Ifaddrmsg;
use neli::socket::NlSock... |
use crate::engine::all::MatchAllEngine;
use crate::engine::andor::{AndEngine, OrEngine};
use crate::engine::exact::{ExactEngine, ExactMatchingParam};
use crate::engine::fuzzy::{FuzzyAlgorithm, FuzzyEngine};
use crate::engine::regexp::RegexEngine;
use crate::{CaseMatching, MatchEngine, MatchEngineFactory};
use regex::Re... |
use std::ops;
pub type Vec2 = [f32; 2];
/// # Description
/// computes dot product
/// # Comments
/// -loop should get optimized away in --release
pub fn dot(a: Vec2, b: Vec2) -> f32 {
let mut sum = 0.;
for i in 0..2 {
sum += a[i] * b[i]
}
sum
}
pub fn compute_bounding_box_from_points_2d(poin... |
use super::{CurrencyCode, NewPrice, NewPriceHistory, PatchPrice, Price, PriceField, PriceHistory};
use crate::graphql::model::PriceOrderBy;
use crate::graphql::utils::Direction;
use crate::model::{Crud, DbInsert, HistoryEntry};
use crate::schema::{price, price_history};
use crate::{crud_methods, db_insert};
use diesel:... |
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::spanned::Spanned;
use syn::{Ident, Index, Type, TypePath};
use super::return_error;
/// Takes the return arguments part of the host function's signature and returns wrappers around higher
/// level types to make them... |
//! This module handles connecting to and reading from a MYO electric sensor.
//! It assumes the use of an MCP3008 analog-to-digital converter connected to
//! a raspberry pi via SPI.
//!
//! All 40-pin raspberry pi models provide two SPI buses: SPI0 and SPI1. SPI1 has
//! a few limitations, so we'll use SPI0. However,... |
use log::warn;
use pulldown_cmark::CowStr;
use std::ops::Range;
pub struct Replacer {
positions: Vec<usize>,
index: usize,
}
/// A Preprocessor for "Dropbox flavoured" markdown to turn it into CommonMark.
impl Replacer {
/// Replace LaTeX deliminators "$$" with "``" and remember replacement points.
/... |
//! Objective-C's @throw and @try/@catch.
//!
//! By default, if the [`msg_send!`] macro causes an exception to be thrown,
//! this will unwind into Rust, resulting in undefined behavior. However, this
//! crate has an `"catch_all"` feature which, when enabled, wraps each
//! [`msg_send!`] in a [`catch`] and panics if ... |
use std::{collections::VecDeque, mem, time::Duration};
use naia_serde::{BitCounter, BitWrite, BitWriter, Serde, UnsignedVariableInteger};
use naia_socket_shared::Instant;
use crate::{constants::MTU_SIZE_BITS, types::MessageId, wrapping_diff};
use super::{
message_channel::{ChannelSender, ChannelWriter},
mes... |
use std::collections::HashMap;
use blog_common::{
dto::{git::GitRepositoryInfo, user::UserInfo, Response as ApiResponse},
result::{Error, ErrorResponse},
val,
};
use hyper::body::Body;
use hyper::header::{self, HeaderMap, HeaderValue};
use warp::{filters::path::Tail, http::Response, Rejection, Reply};
use... |
#![no_std]
use {core::mem::size_of, static_assertions::const_assert_eq};
#[repr(C, packed)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Rsdp {
pub signature: [u8; 8],
pub checksum: u8,
pub oemid: [u8; 6],
pub revision: u8,
pub rsdt_address: u32,
pub ... |
use agda_mode::pos::InteractionId;
/// Parsed user input.
#[derive(Debug, Clone, Copy)]
pub enum UserInput<'a> {
Define(&'a str),
PushLine(&'a str),
PopLine,
DumpProof,
ShowLine(usize),
Give(InteractionId, &'a str),
Split(InteractionId, &'a str),
Reload,
Context(InteractionId),
... |
#[derive(Debug, PartialEq)]
pub enum CompressionMethod {
Reserved0,
Reserved1,
Reserved2,
Reserved3,
Reserved4,
Reserved5,
Reserved6,
Reserved7,
Deflate,
Unknown
}
impl From<u8> for CompressionMethod {
fn from(byte: u8) -> Self {
use CompressionMethod::*;
ma... |
use std::boxed::Box;
use std::cmp::Ordering;
use std::process::exit;
use ::clap::{App, Arg};
use ::log::*;
pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
pub mod config;
pub mod core;
pub mod log;
pub mod plugin;
pub mod stats;
pub mod store;
pub mod util;
pub const ARG_VERBOSE_SHORT: &str... |
#![allow(non_camel_case_types)]
use core::{
fmt::{self, Display},
marker::PhantomData,
};
#[macro_export]
macro_rules! try_into_array {
($slice:expr, $len:expr$(,)*) => {
match $slice {
(_x) => unsafe { $crate::__priv_try_into_array!(explicit, _x, $len) },
}
};
($slice:... |
use crate::client::state::{self, Connection};
use crate::{Context, Result};
use futures::stream::{SplitSink, StreamExt};
use futures::SinkExt;
use log::{error, trace};
use metalmq_codec::codec::{AMQPCodec, Frame};
use metalmq_codec::frame::{self, AMQPFrame, MethodFrameArgs};
use tokio::net::TcpStream;
use tokio::sync::... |
// Copyright 2020 DCS Corporation, All Rights Reserved.
// 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::fs;
use std::io::{BufRead, Write};
use std::path::PathBuf;
use path_absolutize::*;
pub(crate) fn get_exe_path() -> std::path::PathBuf {
let default_path = std::path::PathBuf::from("./");
let current_exe = std::env::current_exe();
match current_exe {
Ok(exe) => {
match fs::read_... |
//! Example of using the SPI interface using the ESP32 WROVER DEVKIT
//!
//! This examples writes to the display. As this pushes many pixels it is quite slow in debug mode,
//! so please run it in release mode to get an impression of the obtainable speed.
#![no_std]
#![no_main]
use core::{fmt::Write, panic::PanicInfo... |
use crate::{handler_return, Context, Error, Handler, HandlerReturn, HttpDate, Method, Request};
use async_trait::async_trait;
//use service_logging::{log, Severity};
use std::str::FromStr;
use kv_assets::{AssetMetadata, KVAssets};
/// Serves static assets out of Worker KV storage.
pub struct StaticAssetHandler<'asset... |
use proc_macro2::TokenStream;
use quote::*;
use std::fmt::Write;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{
Expr, ExprAssign, ExprLit, ExprPath, ExprRange, ExprReference, Ident, Lit, LitStr, Path,
PathArguments, RangeLimits, Result, Token,
};
pub struct QueryInput {
t... |
//! This Rust crate provides a simple, brokerless message-queue abstraction over asynchronous
//! network streams. It guarantees ordered message delivery and reception, and both TCP and TLS
//! transports are supported.
//!
//! # Examples
//!
//! ````ignore
//! // create a client connection to the server
//! let mut co... |
use gemlab::mesh::{check_face_normals, At, Extract, FaceKey, Mesh, Region};
use gemlab::StrError;
use std::collections::{HashMap, HashSet};
fn check<T>(found: &HashSet<T>, correct: &[T])
where
T: Copy + Ord + std::fmt::Debug,
{
let mut ids: Vec<T> = found.iter().copied().collect();
ids.sort();
assert_e... |
// Copyright (C) 2020 <NAME> <<EMAIL>>
// This file is subject to the terms and conditions defined in
// file 'LICENSE', which is part of this source code package.
use anyhow::{anyhow, Result};
use regex::Regex;
use std::io::{stdin, BufRead};
pub fn line_next(lines_iter: &mut std::io::Lines<impl BufRead>) -> Result<S... |
#[macro_use]
extern crate getset;
#[macro_use]
extern crate quote;
use datapet::{
filter::{group::group, sink::sink, sort::sort},
graph::StreamsBuilder,
prelude::*,
};
use std::path::Path;
#[derive(Getters)]
struct ReadStdinIterator {
name: FullyQualifiedName,
#[getset(get = "pub")]
#[allow(de... |
//! Support functions that don't belong anywhere else or use unsafe code.
use fnv::FnvHasher;
use std::collections;
use std::hash::BuildHasherDefault;
use std::hash::Hash;
use std::ops::Range;
use std::ptr;
use std::slice;
/// Type alias for hashmaps to allow swapping out the implementation.
pub type HashMap<K, V> = ... |
/* Copyright (c) Fortanix, Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[macro_use]
extern crate lazy_static;
extern crate sharedring;
extern crate my... |
//! Contains the `GenParamsIn` type,for printing generic parameters.
use syn::{
token::{Colon, Comma, Const, Star},
GenericParam, Generics,
};
use core_extensions::matches;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use crate::utils::NoTokens;
/// Used to print (with ToTokens) the generc pa... |
use algebra_core::{One, PairingEngine, Zero};
use ff_fft::{cfg_iter, cfg_iter_mut, EvaluationDomain};
use crate::{generator::KeypairAssembly, prover::ProvingAssignment, Vec};
use core::ops::{AddAssign, SubAssign};
use r1cs_core::{Index, SynthesisError};
#[cfg(feature = "parallel")]
use rayon::prelude::*;
pub(crate) ... |
use std::str::FromStr;
use parser::ParserToken;
use eval::ExecutionEnvironment;
use debugln;
#[deriving(Show, PartialEq)]
pub enum LispToken {
Integer(i32),
FloatingPoint(f64),
Boolean(bool),
String(String),//'.*'
Variable(String),//$.*
Function(String),//:.*
Symbol(String),//.* ??
List(Vec<LispToken>),
Exe... |
//! Calculate Dijkstra influence map
//!
//! http://www.roguebasin.com/index.php?title=The_Incredible_Power_of_Dijkstra_Maps
//!
//! This algorithm calculates cost (distance) of moving from the given starting point
//! to the each point on the map. Point which are not reachable will get f32::MAX value.
//!
//! Examp... |
use gtk::prelude::*;
use gtk::ButtonExt;
use gtk::OverlayExt;
use std::ops::Deref;
use std::rc::Rc;
use crate::app::components::{Component, EventListener, ListenerComponent};
use crate::app::state::{SelectionContext, SelectionEvent, SelectionState};
use crate::app::{AppAction, AppEvent};
#[derive(Debug, Clone, Copy)]... |
use crate::codec::decoder::Decoder;
use crate::codec::encoder::Encoder;
use bytes::{Buf, BufMut, BytesMut};
use std::{cmp, fmt, io, str, usize};
/// A simple [`Decoder`] and [`Encoder`] implementation that splits up data into lines.
///
/// [`Decoder`]: crate::codec::Decoder
/// [`Encoder`]: crate::codec::Encoder
#[d... |
use std::{
fmt::{self, Display, Write},
hash::{Hash, Hasher},
};
use codemap::Span;
use crate::{
common::QuoteKind, error::SassResult, parse::Parser, utils::is_ident, value::Value, Token,
};
use super::{Namespace, QualifiedName};
#[derive(Clone, Debug)]
pub(crate) struct Attribute {
attr: QualifiedN... |
use rusqlite::{OptionalExtension, ToSql};
use std::fmt::Display;
/// This is the result of validating a request for data from a site at a specific time.
///
/// This includes all the information available about the site and the most recent initialization
/// time that this site has data available. The most recent time... |
#[cfg(test)]
#[path = "../../tests/unit/validation/routing_test.rs"]
mod routing_test;
use super::*;
use crate::utils::combine_error_results;
use hashbrown::HashSet;
/// Checks that no duplicated profile names specified.
fn check_e1500_duplicated_profiles(ctx: &ValidationContext) -> Result<(), FormatError> {
get_... |
use std::{
borrow::Cow,
io::{BufRead, BufReader, Read},
str::{from_utf8, FromStr},
};
use crate::{
error::{Error, ParseError},
result::Result,
utils::read_line,
};
use bitflags::bitflags;
const MAGIC_NUMBER: &'static [u8] = b"flf2a";
bitflags! {
/// The FIGfont's layout informations.
... |
//! stm32ral module for stm32f410
/// Number of priority bits implemented by the NVIC
pub const NVIC_PRIO_BITS: u8 = 4;
/// Interrupt-related magic for this device
pub mod interrupts;
pub use self::interrupts::Interrupt;
pub use self::interrupts::Interrupt as interrupt;
pub use super::instances::adc1_f410_f412_f413 ... |
//! An example illustrating the use of the cursors API to enumerate arrangements.
//!
//! Dataflow graph construction:
//! * Create a trivial dataflow graph with a single input collection that stores graph
//! edges of type `(u32, u32)`.
//! * Arrange this collection by the first coordinate of an edge; return the tra... |
// Copyright (c) 2016, 2018 vergen 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. All files in the project carrying such notice may not be copi... |
use std::collections::HashMap;
use itertools::Itertools;
use aoc_2021::shared::{Day, read_input_lines};
fn main() {
Day8::new(read_input_lines(8)).run()
}
struct Day8 {
input: Vec<(Vec<String>, Vec<String>)>,
}
impl Day for Day8 {
fn part1(&self) -> usize {
self.input.iter().map(|(_, d)| count_... |
use glium::{VertexBuffer, Program, Surface, Blend};
use glium::backend::Facade;
use glium::index::{NoIndices, PrimitiveType};
use glium::draw_parameters::DrawParameters;
use super::super::data::{Vec2};
use super::super::model::rendering::{ModelRenderer, prepare_model};
use super::{Element, Widget, Group, Grid, ModelEle... |
#![feature(int_abs_diff)]
use anyhow::Result;
use embedded_hal_0_2::{blocking::delay::DelayUs,digital::v2::OutputPin};
use std::{f64::consts, thread, time::Duration};
use display_interface_spi::SPIInterfaceNoCS;
use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::prelude::*;
use embedded_graphics::pri... |
use crate::systems::{get_participant_ratings, outcome_free, PlayersByName, Rating};
use overload::overload;
use std::fmt;
use std::ops;
pub type ParticipantRatings = [(Rating, usize, usize)];
pub type WeightAndSum = (f64, f64);
pub type Metric = Box<dyn Fn(&ParticipantRatings) -> f64>;
// A data structure for storing... |
//! # Metrics Middleware
use crate::RouteFormatter;
use actix_web::{dev, http::StatusCode};
use futures::{
future::{self, FutureExt},
Future,
};
use opentelemetry::{
global,
metrics::{
noop::NoopMeterProvider, Counter, Meter, MeterProvider, MetricsError, ValueRecorder,
},
Key,
};
use ope... |
//! # Page table entry
//! Some code borrowed from [Phil Opp's Blog](http://os.phil-opp.com/modifying-page-tables.html)
use crate::memory::Frame;
use super::{PageFlags, PhysicalAddress, RmmA, RmmArch};
/// A page table entry
#[derive(Debug)]
pub struct Entry(u64);
/// A page descriptor
#[derive(Debug)]
pub struct P... |
use geom::{Line, Pt2D};
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}
impl fmt::Display for Color {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
... |
use super::polar::calculate_helmholtz_energy_density_polar;
use crate::eos::dispersion::{A0, A1, A2, B0, B1, B2};
use crate::parameters::PcSaftParameters;
use feos_core::EosError;
use feos_dft::{
FunctionalContributionDual, WeightFunction, WeightFunctionInfo, WeightFunctionShape,
};
use ndarray::*;
use num_dual::Du... |
use crate::utils::{debug, info, validate_value_containing_name, Error, INTERNAL_ERR};
use clap::Clap;
use glob::Pattern;
use semver::Version;
use std::collections::BTreeMap as Map;
use std::{path::PathBuf, process::Command};
pub fn git<'a>(root: &PathBuf, args: &[&'a str]) -> Result<(String, String), Error> {
debu... |
// Copyright (c) Facebook, Inc. and its affiliates
// SPDX-License-Identifier: MIT OR Apache-2.0
#![forbid(unsafe_code)]
use std::{
io::{BufRead, Write},
sync::{Arc, Mutex},
};
use structopt::StructOpt;
/// Proxy for SMT2 commands. Compatible with the command-line syntax of Z3.
#[derive(Debug, StructOpt)]
st... |
use nu_protocol::{Primitive, UntaggedValue, Value};
use nu_source::{AnchorLocation, Tag};
use std::path::Path;
#[derive(Default)]
pub struct TextView;
impl TextView {
pub fn new() -> TextView {
TextView
}
}
#[allow(clippy::cognitive_complexity)]
pub fn view_text_value(value: &Value) {
let (mut te... |
use crate::traverse::{EntryData, Tree, TreeIndex};
use byte_unit::{n_gb_bytes, n_gib_bytes, n_mb_bytes, n_mib_bytes, ByteUnit};
use std::{fmt, path::Path};
pub fn get_entry_or_panic(tree: &Tree, node_idx: TreeIndex) -> &EntryData {
tree.node_weight(node_idx)
.expect("node should always be retrievable with ... |
use core::fmt;
use std::{convert::TryFrom, ops::Deref, str::FromStr};
use anyhow::{ensure, Error};
use cosmos_sdk_proto::ibc::core::commitment::v1::MerklePrefix;
use rand::{distributions::Alphanumeric, Rng};
use regex::Regex;
use serde::{Deserialize, Serialize};
use crate::ibc::core::ics02_client::client_type::Client... |
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use std::ops::Deref;
use std::sync::Arc;
use kvproto::import_sstpb::*;
use kvproto::kvrpcpb::*;
use kvproto::metapb::*;
use tikv::pd::RegionInfo;
use super::client::*;
// Just used as a mark, don't use them in comparison.
pub const RANGE_MIN: &[u8]... |
use crate::scalar::Scalar;
use crate::{QuadraticBezierSegment, CubicBezierSegment};
use crate::monotonic::Monotonic;
use crate::math::point;
/// Approximates a cubic bézier segment with a sequence of quadratic béziers.
pub fn cubic_to_quadratics<S: Scalar, F>(
curve: &CubicBezierSegment<S>,
tolerance: S,
c... |
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_derive;
use wasm_bindgen::prelude::*;
use libojo::{EdgeKind, NodeId, PatchId};
use ojo_graph::Graph;
use std::collections::{HashMap, HashSet};
#[wasm_bindgen]
pub struct Repo {
inner: libojo::Repo,
}
#[wasm_bindgen]
impl Repo {
#[wasm_bindgen(c... |
use uuid::Uuid;
use tracing::{debug, info};
use chrono::{DateTime, Utc};
use std::{collections::HashMap, fs};
use serde::{Deserialize, Deserializer, Serialize};
use crate::utils::{config::Configuration, errors::InternalError};
use mongodb::{Client, Collection, Database, bson::{self, Document, doc}, options::ClientOptio... |
use std::borrow::Cow;
use minicbor::bytes::ByteSlice;
use minicbor::{Decode, Encode};
#[cfg(feature = "tag")]
use crate::TypeTag;
#[derive(Decode, Debug)]
#[cfg_attr(test, derive(Encode))]
#[rustfmt::skip]
#[cbor(map)]
pub struct Project<'a> {
#[cfg(feature = "tag")]
#[n(0)] pub tag: TypeTag<9056532>,
#[... |
use std::env::args;
use std::fs::File;
use std::io::{BufWriter, Write};
use std::path::Path;
use std::process;
use conllx::{Features, ReadSentence, Sentence, WriteSentence};
use failure::Error;
use getopts::Options;
use stdinout::{Input, OrExit, Output};
use toponn::tensorflow::Tagger;
use toponn::{Numberer, SentVect... |
use native::zcsi::rte_ethdev_api::{
rte_eth_desc_lim, rte_eth_dev_info, rte_eth_dev_portconf, rte_eth_rxconf, rte_eth_rxseg, rte_eth_rxseg_capa,
rte_eth_switch_info, rte_eth_thresh, rte_eth_txconf, RTE_ETH_FLOW_MAX,
};
const RSS_FLOW_NAMES: [&str; (RTE_ETH_FLOW_MAX + 1) as usize] = [
"Unknown",
"Raw",
... |
use na::{DVector, RealField};
use std::ops::Range;
use crate::joint::JointConstraint;
use crate::math::{AngularVector, Point, ANGULAR_DIM, Rotation};
use crate::object::{BodyPartHandle, BodySet};
use crate::solver::helper;
use crate::solver::{ConstraintSet, GenericNonlinearConstraint, IntegrationParameters,
... |
extern crate chrono;
extern crate mysql;
use self::chrono::UTC;
use self::chrono::offset::TimeZone;
use self::mysql::conn::MyOpts;
use self::mysql::conn::pool::MyPool;
use self::mysql::error::MyResult;
use self::mysql::value::from_row;
use self::mysql::value::Value;
use std::clone::Clone;
use std::default::Default;
us... |
#![warn(rust_2018_idioms)]
#![warn(trivial_casts)]
#![warn(trivial_numeric_casts)]
#![warn(unused_qualifications)]
use std::fs;
use std::panic::{catch_unwind, resume_unwind};
use anyhow::Result;
use itertools::Itertools;
use kenny::collections::square::SquareValue;
use kenny::image::PuzzleImageBuilder;
use kenny::puz... |
use std::fmt::Debug;
use std::io::{self, Write};
use anyhow::Result;
use crossterm::cursor::RestorePosition;
use crossterm::execute;
use log::debug;
use rusqlite::types::{ToSql, Value};
use rusqlite::{params, Connection};
use tabwriter::TabWriter;
use super::Options;
/// The main processing engine for all of the sta... |
use std::fmt;
#[derive(Clone, Debug)]
pub enum HttpMethods {
Get,
Post,
}
impl fmt::Display for HttpMethods {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let s: String = format!("{:?}", self);
write!(f, "{}", s.to_uppercase())
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub ... |
use super::{AnyJointVelocityConstraint, AnyVelocityConstraint, DeltaVel, ThreadContext};
use crate::dynamics::solver::{
AnyJointPositionConstraint, AnyPositionConstraint, ParallelSolverConstraints,
};
use crate::dynamics::{IntegrationParameters, JointGraphEdge};
use crate::geometry::ContactManifold;
use crate::math... |
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
/*!
The Rust client library for [Prometheus](https://prometheus.io/).
Use of this library involves a few core concepts:
* A number of [`Counter`](type.Counter.html)s that represent metrics from your system.
* A [`Registry`](struct.Registry.html) with... |
use support::*;
use std::sync::{Arc, Mutex};
use convert::TryFrom;
pub fn new() -> Proxy {
Proxy::new()
}
#[derive(Debug)]
pub struct Proxy {
controller: Option<controller::Listening>,
inbound: Option<server::Listening>,
outbound: Option<server::Listening>,
metrics_flush_interval: Option<Durati... |
// Copyright 2018 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
/... |
use emulator::*;
use ppu::registers::*;
const RAM_START: u16 = 0;
const RAM_END: u16 = 0x1fff;
const PPUCTRL_ADDRESS: u16 = 0x2000;
const PPUMASK_ADDRESS: u16 = 0x2001;
const PPUSTATUS_ADDRESS: u16 = 0x2002;
const OAMADDR_ADDRESS: u16 = 0x2003;
const OAMDATA_ADDRESS: u16 = 0x2004;
const PPUSCROLL_ADDRESS: u16 = 0x200... |
use crate::error;
use spirv_tools_sys::opt;
pub struct Options {
pub(crate) inner: *mut opt::OptimizerOptions,
}
impl From<super::Options> for Options {
fn from(o: super::Options) -> Self {
unsafe {
let inner = opt::optimizer_options_create();
if let Some(vopts) = o.validator_... |
use super::*;
use alloc::string::String;
use alloc::vec::Vec;
use bytes::{Buf, Bytes};
/// Unsubscribe packet
#[derive(Debug, Clone, PartialEq)]
pub struct Unsubscribe {
pub pkid: u16,
pub filters: Vec<String>,
pub properties: Option<UnsubscribeProperties>,
}
impl Unsubscribe {
pub fn new<S: Into<Stri... |
use mpeg2ts_reader::demultiplex;
use mpeg2ts_reader::packet;
use mpeg2ts_reader::psi;
use scte35_reader;
use std::cell;
use std::collections::HashMap;
use std::rc::Rc;
pub struct DumpSpliceInfoProcessor {
pub last_pcr: Rc<cell::Cell<Option<packet::ClockRef>>>,
}
impl scte35_reader::SpliceInfoProcessor for DumpSpli... |
//! A collection of fundamental and/or simple types used by other modules
#[cfg(feature = "mesalock_sgx")]
use std::prelude::v1::*;
use error::{err, Result, StatusCode};
use std::cell::RefCell;
use std::path::Path;
use std::rc::Rc;
pub const NUM_LEVELS: usize = 7;
/// Represents a sequence number of a single entry.... |
use std::vec;
use crate::puzzle::{io, File, Puzzle};
pub struct Day16;
enum ParseState {
Field,
MyTicket,
NearbyTickets,
}
#[derive(Debug, Clone)]
struct Field {
name: String,
valid_ranges: Vec<(usize, usize)>,
}
impl Field {
fn new(name: &str) -> Self {
Self {
name: Stri... |
#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! System Control Block
//!
//! Used by: imxrt1051, imxrt1052
#[cfg(not(feature = "nosync"))]
pub use crate::imxrt105::peripherals::systemcontrol::Instance;
pub use crate::imxrt105::peripherals::systemcontrol::{RegisterBlock, ResetValue... |
use crate::ast::{Expr, ExprX, Exprs, Fun, HeaderExprX, Ident, MaskSpec, Stmt, StmtX, Typ, VirErr};
use crate::ast_util::err_str;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct Header {
pub no_method_body: bool,
pub hidden: Vec<Fun>,
pub require: Exprs,
pub recommend: Exprs,
pub ensure_id_ty... |
use clap::{App, Arg};
use rfd::FileDialog;
use std::fs::{self, File};
use std::io::prelude::*;
use std::{ffi::OsStr, process::Command};
use std::path::PathBuf;
struct Settings {
do_indentation: bool,
do_line_length: bool,
}
fn main() -> Result<(), std::io::Error> {
let matches = App::new("JS formatter and... |
use regex::{Captures, Regex};
use std::str::FromStr;
fn main() {
let input = include_str!("input.txt");
let answer = part_one(input).expect("no solution for part one");
println!("part 1: {}", answer);
let answer = part_two(input).expect("no solution for part two");
println!("part 2: {}", answer);... |
use super::{condition_ready, retry, ConstructContext};
use crate::{controller::ControllerConfig, ANNOTATION_APP_NAME, DEFAULT_IMAGE, LABEL_APP_MARKER};
use async_trait::async_trait;
use drogue_client::{
registry::v1::{Authentication, KafkaAppStatus, KnativeAppSpec},
Translator,
};
use drogue_cloud_operator_comm... |
//! `rust-gravatar` is a small Rust library that generates Gravatar image URLs based on the
//! [official Gravatar specification](https://en.gravatar.com/site/implement/images/).
//!
//! Example
//! --------
//! ```
//! extern crate gravatar;
//! use gravatar::{Gravatar, Rating};
//!
//! let url = Gravatar::new("<EMAIL... |
// Copyright 2020 Veil Rust Developers
//
// 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 disc... |
// Copyright (c) 2020 kprotty
//
// 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 wri... |
// Copyright 2020 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
/* SPDX-License-Identifier: (Apache-2.0 OR MIT OR Zlib) */
/* Copyright © 2021 <NAME> */
use std::{
ffi::c_void,
future::Future,
net::{IpAddr, Ipv4Addr, Ipv6Addr},
sync::Arc,
};
use super::bindings::Windows::Win32::{
Foundation::PWSTR, NetworkManagement::Dns,
};
pub(super) fn browse_services<App,... |
// Based on https://github.com/dfinity/cdk-rs/blob/a253119adb08929b6304d007ee0a6a37960656ed/src/ic-cdk/src/api/stable.rs
// * Supports 64-bit addressed memory
use ic_cdk::api::stable::{
stable64_read, stable64_write, StableMemoryError,
};
use std::io;
const WASM_PAGE_SIZE_IN_BYTES: u64 = 64 * 1024; // 64KB
#[deri... |
use leb128;
use crate::sst::lsm_error::DataStoreError;
use crate::filesystem::Path;
/// Block Size defined for 128 KB.
/// TODO: need to make it configurable
/// and experiment to set optimal size
static BLOCK_SIZE: usize = 128 * 1024;
/// Block has 'data_' which is contigous block
/// of bytes consisting of contiguou... |
//! The object identifiers used in this crate.
//!
//! This module collects all the object indentifiers used at various places
//! in this crate in one central place. They are public so you can refer to
//! them should that ever become necessary.
use bcder::{ConstOid, Oid};
/// [RFC 4055](https://tools.ietf.org/html/... |
use scrivx_reader::get_scrivx;
use std::path::Path;
use std::error::Error;
use std::io::{Read, Write};
use std::fs;
use minidom::Element;
trait DeleteElement {
fn delete_children(&mut self);
}
impl DeleteElement for Element {
fn delete_children(&mut self) {
let ele = Element::builder(self.name())
... |
use crate::{
project::{MetadataExt as _, PackageExt as _},
shell::ColorChoice,
};
use anyhow::Context as _;
use cargo_metadata::Package;
use if_chain::if_chain;
use ignore::{overrides::OverrideBuilder, WalkBuilder};
use itertools::Itertools as _;
use snowchains_core::web::PlatformKind;
use std::{iter, path::Pat... |
use crate::{ByteLit, Literal, test_util::assert_parse_ok_eq};
// ===== Utility functions =======================================================================
macro_rules! check {
($lit:literal) => {
let input = stringify!($lit);
let expected = ByteLit {
raw: input,
value... |
extern crate colored;
use std::env;
use std::fmt::Write;
use std::io::Read;
use std::str;
use std::string::String;
use std::path::{Path, PathBuf};
use std::fs;
use std::fs::File;
use std::process::Command;
use std::process;
use colored::{Colorize, ColoredString};
fn git_status(staged: bool) -> Option<String> {
l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.