text
stringlengths
3.09k
13.9k
//! Traits and shared plumbing for bot commands (e.g. `!uptime`) use crate::auth::Scope; use crate::irc; use crate::prelude::*; use crate::utils; use anyhow::Result; use std::borrow::Cow; use std::collections::HashMap; use std::fmt; use std::num; use std::str; use std::sync::Arc; use std::time::Instant; use thiserror:...
//! # Function Attributes //! //! Function attributes are set to communicate additional information //! about a function. Function attributes are considered to be part of //! the function, not of the function type, so functions with different //! function attributes can have the same function type. //! //! Function att...
use std::mem::take; use std::borrow::Cow; use im::Vector; use crate::spans::*; use crate::tokens::*; use std::ops::Deref; #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct Group<T: Clone> { pub open: Spanning<Paren>, pub close: Spanning<Paren>, pub vals: Vector<T>, } impl<T: Clone> Group<T> { ...
use std::io; use std::pin::Pin; use std::task::{Context, Poll}; use std::net::SocketAddr; use futures::{ ready, prelude::*, channel::oneshot::Receiver, }; use tracing::debug; use crate::config::Config; use crate::error::Error; use crate::command::{Command, MessageBody}; use crate::conn::{Connection, Respon...
#![feature(used, const_fn)] #![no_std] #[macro_use] extern crate cortex_m; extern crate cortex_m_rt; extern crate tm4c129x; use core::cell::Cell; use cortex_m::ctxt::Local; use cortex_m::exception::Handlers as ExceptionHandlers; use tm4c129x::interrupt::Handlers as InterruptHandlers; fn main() { hprintln!("Hello...
// Copyright 2017 Google Inc. // // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. use std::error::Error; use std::io::{stderr, Write}; use std::str::FromStr; use walkdir::DirEntry; use find::matchers::{ComparableValue,...
use crate::days::Day; use itertools::Itertools; use std::collections::HashMap; use std::fs; use std::str::Lines; pub struct Day6 { input: String, } impl Day6 { pub fn new() -> Day6 { let input = fs::read_to_string("res/day6.txt").unwrap(); Day6 { input } } } impl Day for Day6 { /// N...
use std::cmp::Ordering::*; use std::mem; #[derive(Debug)] pub struct Tree<T> { root: Link<T> } #[derive(Debug)] enum Link<T> { Empty, NonEmpty(Box<Node<T>>), } #[derive(Debug)] struct Node<T> { value: T, left: Link<T>, right: Link<T>, } impl<T: Ord> Tree<T> { pub fn new() -> Self { ...
use std::collections::HashMap; use super::common::{CompileOptions, CompileResult, Error, Value, VarMap}; use crate::sbnf::{Grammar, Node, NodeData}; #[derive(Debug, PartialEq, Clone, Copy)] pub enum DefinitionKind { Variable, Rule, } #[derive(Debug)] pub struct Definition<'a> { pub kind: DefinitionKind, ...
// TODO: remove, as it's not required on newer nightly use crate::sgx_module::write_response; use aead::{generic_array::GenericArray, Aead, NewAead}; use aes_gcm_siv::Aes128GcmSiv; use chain_core::state::tendermint::BlockHeight; use chain_core::tx::data::TxId; use chain_core::tx::TransactionId; use chain_core::tx::TxWi...
use platform::*; use farmhashna::*; use farmhashna_shared::*; use farmhashcc_shared::weak_hash_len_32_with_seeds_bytes; use std::mem; fn uo_h(x: u64, y: u64, mul: u64, r: u64) -> u64 { let mut a = (x ^ y).wrapping_mul(mul); a ^= a >> 47; let b = (y ^ a).wrapping_mul(mul); return rotate64(b, r).wrapping...
//! Game setup and very basic main loop. //! All the actual work gets done in the Scene. extern crate chrono; #[macro_use] extern crate failure; extern crate fern; extern crate ggez; extern crate ggez_goodies; #[macro_use] extern crate log; extern crate nalgebra; extern crate ncollide2d; extern crate rand; extern crat...
extern crate proc_macro; extern crate regex; use crate::proc_macro::TokenStream; use quote::quote; use syn; use std::str::FromStr; /// /// /// NotEmpty : not null or empty /// Length(1,3) : String's length between (min, max) /// Min(18) : integer min value /// Max(20) : integer max value /// Range(2,5) : integer va...
use regex::Regex; use color::{Color, Error}; use utils; fn handle_hsl(p: f32, q: f32, t: f32) -> f32 { let pi = p; let qi = q; let mut ti = t; if ti < 0f32 { ti += 1f32; } if ti > 1f32 { ti -= 1f32; } if ti < 0.166666666 { return pi + (qi - pi) * 6f32 * ti; } if ti < 0.5 { return qi; } if ti < 0.6...
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
// 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 in the LICENSE-APACHE file or at: // https://www.apache.org/licenses/LICENSE-2.0 //! Event enum fallbacks for use without winit //! //! Thes...
mod build; mod command; mod dependencies; mod packaging; mod version; use alvr_filesystem as afs; use pico_args::Arguments; use std::{fs, time::Instant}; use xshell::{cmd, Shell}; const HELP_STR: &str = r#" cargo xtask Developement actions for ALVR. USAGE: cargo xtask <SUBCOMMAND> [FLAG] [ARGS] SUBCOMMANDS: ...
use rand::Rng; use std::io; use std::io::Write; // keeps track of number of tries struct Tries { init: u8, left: u8, } impl Tries { fn init(x: u8) -> Tries { Tries { init: x, left: x } } // decrement number of tries left fn dec(&mut self) { self.left = self.left - 1u8; } ...
use crate::sph; use std::convert::TryFrom; use nom::{self, multi::count, number::complete::le_f64, number::complete::le_u64, IResult}; use nalgebra::{self as na, VectorN, U3}; use sph::Particle; use std::io::prelude::*; #[derive(Debug, PartialEq)] struct ParticleDto { position: VectorN<f64, U3>, velocity: ...
//! Path Expression. use crate::path::parse::{FuncStep, PathParser, Step}; use std::fmt; use std::str::FromStr; use crate::yason::YasonResult; use crate::{ArrayRefBuilder, DataType, Number, Value, Yason, YasonError}; use crate::format::{CompactFormatter, FormatResult, Formatter, PrettyFormatter}; use crate::path::qu...
//! This module defines the content of the global configuration file. Additionally it takes //! care of loading the static configuration instance use directories::{ProjectDirs, UserDirs}; use model::LibraryEntryMeta; use std::default::Default; use std::fs::{create_dir_all, File}; use std::io::BufReader; use std::path:...
use clap::Parser as CliParser; use colour::{blue, green_ln, red_ln}; use mips_machine::{Error, Instruction, Machine, Parser, Register, TEXT_BASE_ADDRESS}; use read_input::prelude::*; use std::{fs, path::PathBuf}; /// A simple MIPS virtual machine #[derive(CliParser, Debug)] #[clap(version, long_about = None)] struct A...
#![feature(extend_one)] use proc_macro::TokenStream; use proc_macro2::{Delimiter, Group, Literal, TokenTree}; use syn::parse::{Parse, ParseStream, Result}; use syn::{parse_macro_input, Ident, LitInt, Token}; #[proc_macro] pub fn seq(input: TokenStream) -> TokenStream { let mut seq_generator = parse_macro_input!(in...
use crate::{error::DecodeError, hash_str, Error, Result}; use helium_proto::{ packet::PacketType, routing_information::Data as RoutingData, BlockchainStateChannelResponseV1, Eui, RoutingInformation, }; use lorawan::PHYPayloadFrame; use semtech_udp::{ pull_resp, push_data::{self, CRC}, CodingRate, Da...
// // Copyright (c) 2017, 2020 ADLINK Technology Inc. // // This program and the accompanying materials are made available under the // terms of the Eclipse Public License 2.0 which is available at // http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 // which is available at https://www.apache.or...
#[macro_use] extern crate log; use std::path::PathBuf; use std::sync::{Arc, RwLock}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread; use std::time::Duration; use std::sync::mpsc::channel; use anyhow::{Result}; use structopt::StructOpt; use sds011_exporter::command::*; use sds011_exporter::response::*...
//! This internal module consists of helper types and functions for dealing //! with setting the file times (mainly in `path_filestat_set_times` syscall for now). //! //! The vast majority of the code contained within and in platform-specific implementations //! (`super::linux::filetime` and `super::bsd::filetime`) is ...
/// /// Blitz Money /// /// Frontend/Ui of module for manange forecast values of months /// /// Copyright 2018 <NAME> <<EMAIL>> /// use backend::forecasts::Forecast; use backend::tags::Tag; use backend::accounts::Account; use backend::storage::Storage; use ui::ui::*; use i18n::*; pub struct Forecasts {} impl Forecas...
use std::collections::HashMap; use futures::future; use futures::future::FutureExt; use futures::sink::SinkExt; use futures::stream::StreamExt; use futures::stream::TryStreamExt; use rmp_serde as rmps; use tokio_util::codec::Framed; use tokio::net::TcpStream; use crate::common::WrappedRcRefCell; use crate::daskcodec:...
extern crate chrono; #[macro_use] extern crate cpython; extern crate envy; extern crate failure; extern crate futures; extern crate goji; #[macro_use] extern crate lazy_static; #[macro_use] extern crate lando; #[macro_use] extern crate maplit; extern crate reqwest; #[macro_use] extern crate serde_derive; #[macro_use] e...
/*a Copyright 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 distributed under the...
use clap::{ArgEnum, Parser}; use color_eyre::eyre::ContextCompat; use core_extensions::ToTime; use openssh::Session; use std::{net::SocketAddr, path::PathBuf, process::Stdio, sync::atomic::AtomicBool}; use tokio::io::AsyncWriteExt; use tracing::Instrument; static CANCELLED: AtomicBool = AtomicBool::new(false); #[deri...
use super::contact::ContactInfo; use super::prelude::*; use super::{vec2, vec3, Pnt3f, Vec2f, Vec3f}; #[derive(Copy, Clone, Debug)] pub struct Sphere { pub center: Pnt3f, pub radius: f32, } impl Sphere { pub fn new(center: Pnt3f, radius: f32) -> Sphere { Sphere { center, radius } } pub fn...
pub use hasher::hash; use std::borrow::Borrow; use std::hash::Hash; mod hasher; pub const BSIZE: usize = 8; pub const BGROW: usize = 8; #[derive(Debug)] pub struct BucketList<K, V> { seed: u64, len: usize, buckets: Vec<Vec<(K, V)>>, } impl<K: Hash + Eq, V> BucketList<K, V> where K: Borrow<K>, { ...
extern crate actix; extern crate actix_web; extern crate elasticlunr; extern crate env_logger; #[macro_use] extern crate error_chain; extern crate futures; #[macro_use] extern crate log; extern crate mdbook; extern crate serde; extern crate serde_json; #[macro_use] extern crate tantivy; extern crate tempfile; use std:...
//! Single DST stored inline use std::{marker, mem, ops, ptr}; /// 8 data words, plus one metadata pub const DEFAULT_SIZE: usize = 8 + 1; /// Stack-allocated DST (using a default size) pub type Value<T /*: ?Sized*/> = ValueA<T, [usize; DEFAULT_SIZE]>; /// Stack-allocated dynamically sized type /// /// `T` is the un...
use std::iter::Iterator; use std::vec::IntoIter; use std::collections::HashMap; use std::rc::Rc; #[derive(Debug, PartialEq)] enum NextAction { Stay, ForwardOrStay(String), Done } #[derive(Debug)] enum ParsedData { NoPreviousData, Root(Root), Li(Li) } struct Parser<'a> { source: &'a mut I...
#[macro_use] extern crate hippo_api; #[macro_use] extern crate rute; extern crate rmp_serde as rmps; extern crate serde; //use serde::{Deserialize}; //use rmps::{Deserializer}; use rute::rute::{RUBase, DragEnterEvent, DropEvent, ListWidget, ListWidgetItem}; use rute::PluginUi; use std::ffi::OsStr; use std::path::Pa...
// Copyright (c) 2016 Chef Software Inc. and/or applicable 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 r...
/* * Copyright 2021 Code Dx, Inc * * 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...
#![windows_subsystem = "windows"] extern crate cpal; extern crate env_logger; extern crate iui; #[macro_use] extern crate log; extern crate libc; extern crate rodio; extern crate ui_sys; mod effects; mod player; #[cfg(windows)] mod windows_helper; use std::cell::{Cell, RefCell}; use iui::controls::*; use iui::prelu...
use std::str::FromStr; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::thread::JoinHandle; use std::time::Duration; use std::vec::Vec; use crate::logger::Error::Create; use async_std::fs::File; use async_std::io::BufWriter; use async_std::path::Path; use colored::*; use flu...
use crate::intcode::{ util::{parse_intcode, read_from_iter, write_once}, IoOperation, VM, }; use itertools::Itertools; use std::collections::VecDeque; module!(pt1: parse_intcode, pt2: parse_intcode); fn pt1(memory: Vec<i64>) -> Result<String> { let mut max = std::i64::MIN; let mut max_phases ...
// Copyright 2014 <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...
//! File module for managing Algorithmia Data Files //! //! # Examples //! //! ```no_run //! use algorithmia::Algorithmia; //! let client = Algorithmia::client("111112222233333444445555566")?; //! let my_file = client.file(".my/my_dir/some_filename"); //! //! my_file.put("file_contents")?; //! # Ok::<(), Box<std::error...
#![no_main] use libfuzzer_sys::{arbitrary, fuzz_target}; use waffle::Module; fn reject(bytes: &[u8]) -> bool { let parser = wasmparser::Parser::new(0); let mut has_start = false; let mut has_global_set = false; let mut num_globals = 0; for payload in parser.parse_all(bytes) { match payload...
use aoc_runner_derive::aoc; use aoc_runner_derive::aoc_generator; use std::convert::TryFrom; use std::ops::{Add, AddAssign, Sub, SubAssign}; use std::str::FromStr; enum Action { North(i32), South(i32), East(i32), West(i32), Left(Angle), Right(Angle), Forward(i32), } impl FromStr for Action...
use crate::deserialize; use crate::{Invocation, InvocationResponse}; use redis::Connection; use redis::{self, Commands}; use std::error::Error; const OP_ADD: &str = "Add"; const OP_GET: &str = "Get"; const OP_SET: &str = "Set"; const OP_DEL: &str = "Del"; const OP_CLEAR: &str = "Clear"; const OP_RANGE: &str = "Range";...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::{error::Error, RatesWriter}, wlan_common::{ appendable::Appendable, ie::{self, *}, mac::{self, Bssid}, ...
/*********************************************************************************************************************** * Copyright (c) 2019 by the authors * * Author: <NAME> * License: Apache License 2.0 *************************************************************************************************************...
use clap::{clap_app, crate_authors, crate_version}; use nispor::{Iface, NetConf, NetState, NisporError, Route, RouteRule}; use serde_derive::Serialize; use serde_json; use serde_yaml; use std::fmt; use std::io::{stderr, stdout, Write}; use std::process; #[derive(Serialize)] pub struct CliError { pub msg: String, }...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct ListStatus { /// MsgType = N #[serde(flatten)] pub standard_message_header: super::super::standard_message_header::StandardMessageHeader<'N', ' '>, /// ListID #[serde(rename = "66")] pub list_id: ...
extern crate num; //Todo: create a sup folder/mod for types //extern crate num_traits; // lets you do number ops on generics //use num_traits::{pow, Signed}; use core::{ cmp::*, f32, ops::{Add, Div, Mul, Sub}, }; use glam::Vec4; #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct Vector3<T> { p...
use std::io::{ErrorKind, Read, Write}; use crate::multipart::{Node, Part, FilePart}; use mime::{Mime, TopLevel, SubLevel}; use crate::multipart::error::Error; use crate::header::{ContentDisposition, ContentType, DispositionParam, DispositionType, Headers}; /// The extracted text fields and uploaded files from a `multi...
use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{RwLock, Arc}; use std::collections::{HashSet}; use regex::Regex; use futures::future::{BoxFuture, FutureExt}; use url::Url; struct LinkExtractor { pattern: Regex, accept: fn(&str) -> bool } impl LinkExtractor { fn new(accept: fn(&str) -> bool...
//! `Dir`, `Entry`, and `SeekLoc`. #[cfg(target_os = "android")] use crate::fs::android::{seekdir as libc_seekdir, telldir as libc_telldir}; use crate::fs::FileType; use errno::{set_errno, Errno}; #[cfg(not(any( target_os = "android", target_os = "emscripten", target_os = "l4re", target_os = "linux" ))...
// (c) <NAME> <http://mimosa-pudica.net>, under MIT License. // // almost 1:1 translation of: // mediapipe/framework/formats/object_detection/anchor.proto // mediapipe/calculators/tflite/ssd_anchors_calculator.proto // mediapipe/calculators/tflite/ssd_anchors_calculator.cc // Copyright 2019 The MediaPip...
use data::Direction; use std::fmt::Display; use std::fmt; use termion::style::*; /// `OperandCursor` is a struct to select some operand and location in an instruction. for some /// architectures, an operand may be the composition of multiple locations - consider the x86_64 /// example: `dword [rax + rcx * 4 + 0x54320...
use std::{ borrow::Cow, convert::Infallible, mem::ManuallyDrop, ops::DerefMut, ptr::NonNull, task::Poll, }; use crate::{request::BoxRequest, response::BoxResponse}; use super::{ service::{not_found, CallFuture, HrpcService}, HrpcLayer, }; use matchit::Node as Matcher; use tower::{Layer, Service}; use tra...
#![allow( dead_code, unused_imports, clippy::needless_range_loop, clippy::ptr_arg, clippy::char_lit_as_u8 )] use std::char; use std::cmp::{max, min}; use std::fmt; use std::io::BufRead; use std::iter::*; use std::ops::*; use std::str; use std::str::FromStr; use std::{io, process}; use failure::bai...
use std::{ fs, io::ErrorKind as IoErrorKind, net::SocketAddr, path::PathBuf, sync::Arc, }; use futures::prelude::*; use tokio::runtime::Runtime; use serde::{Deserialize,Serialize}; use rcgen::{self, generate_simple_self_signed}; use quinn::{self, Endpoint, ServerConfigBuilder, ClientConfigBuilder}; ...
use crate::functions::*; use crate::logic::*; use crate::object::*; use crate::scope::*; use crate::service::*; use std::rc::Rc; pub fn eval_args(args: &Object, scope: &Rc<Scope>) -> Result<Rc<Object>, String> { Ok(Rc::new(match args { Object::Pair(a, b) => Object::Pair(eval(&Rc::clone(a), scope)?, eval_a...
use crate::{ field_access::Access, ident_or_index::IdentOrIndex, parse_utils::ParsePunctuated, structural_alias_impl::TypeParamBounds, }; use as_derive_utils::{ attribute_parsing::with_nested_meta, datastructure::{DataStructure,Field,FieldMap}, utils::{LinearResult,SynResultExt,SynPathExt},...
//! UI Component definitions //! //! A Component is basically a type that has all the styling and basic information to print to the //! screen correctly, but it doesn't have the actual data to print, just how it should look. //! It will then delegate the actual printing to a Renderer, a type that given //! the componen...
#![feature(exclusive_range_pattern)] #![feature(associated_type_bounds)] extern crate env_logger; mod api; mod authentication; mod buildings; mod db; mod game_master; mod resource_system; mod setup; mod statistics; mod town_view; mod worker_actions; use actix::prelude::*; use actix_cors::Cors; use actix_web::{http::h...
use crate::input; pub fn solve() { let x = input::file_for_day(11).join("\n"); println!("Solution part 1: {}", part_one(x.clone())); println!("Solution part 2: {}", part_two(x.clone())); } #[derive(Clone, Copy)] enum Direction { UpLeft, Up, UpRight, Right, DownRight, Down, Dow...
//! The Settings crate handles settings for Rita, specifically it uses lazy_static to load and //! deserialize the config file on system start. Once deserialized using Serde into internal data //! structures it is then provided to Rita as a global static reference, this reference is locked //! using a RwLock to allow m...
mod data_widget; mod date_created_input; mod date_modified_input; mod edit_button; mod etag_input; mod helpers; mod locations_list; mod policy_input; mod profile_selector; mod publish_button; mod type_selector; mod version_input; use data_widget::*; use date_created_input::*; use date_modified_input::*; use edit_butto...
// global_config.rs // // Author: <NAME> // Date: 15 Jul 2019 // // All the global variables that would not make sense to pass along the data hierarchy are here. // Obviously, there should be as few of them as possible. // - Cloud Provider // - OS name mapping use crate::yaml_rust::{YamlLoader, Yaml}; use crate::path...
use super::args::{Domain, ForwardPath, ParseDomainError, ParsePathError, ReversePath}; use thiserror::Error; pub enum Command { Helo(Domain), Ehlo(Domain), Mail(ReversePath), Rcpt(ForwardPath), Data, Rset, Vrfy(String), Expn(String), Help(String), Noop, Quit, } impl std::fmt::Display for Command { fn fmt(...
use crate::{analyses, ir, lattices, loaders}; use analyses::reaching_defs::ReachingDefnAnalyzer; use analyses::{AbstractAnalyzer, AnalysisResult}; use ir::types::{Binopcode, IRMap, MemArg, MemArgs, Unopcode, ValSize, Value, X86Regs}; use ir::utils::get_rsp_offset; use lattices::reachingdefslattice::{LocIdx, ReachLattic...
// disable console opening on windows #![windows_subsystem = "windows"] use bevy::{app::AppExit, prelude::*, window::WindowMode}; use serde::{Deserialize, Serialize}; mod assets; pub mod ui; use assets::AssetHandles; mod about; mod game; mod lost; mod menu; mod splash; #[derive(Serialize, Deserialize, Debug)] struc...
use crate::{channel::Channel, error::Error, ffi, helper::*}; use serde::Deserialize; use std::{ffi::CStr, ptr::NonNull, sync::Arc}; /// Define the engine v-table pub static ENGINE_VTABLE: ffi::mrcp_engine_method_vtable_t = ffi::mrcp_engine_method_vtable_t { destroy: Some(engine_destroy), open: Some(engine_open...
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! Licensed under the Apache License, Version 2.0 (the "License"); //! you may not use this file except in compliance with the License. //! You may obtain a copy of the License at //! //! http://www.apache.org/licenses/LICENSE-2.0 //! //! Unless required by appl...
use std::collections::{HashMap, HashSet}; // We first look for corners that are connected by a straight uninterrupted line. // At the same time we make a note for each corner in which direction it's connected. // // Later we simply scan over the corners, pairing each top-left with each right-bottom corner // (provided...
use std::borrow::Cow; use std::fmt; use wain_ast::source::Source; use wain_ast::*; #[cfg_attr(test, derive(Debug))] pub enum ErrorKind { IndexOutOfBounds { idx: u32, upper: usize, what: &'static str, }, MultipleReturnTypes(Vec<ValType>), TypeMismatch { expected: Option<V...
#[cfg(feature = "hot-reloading")] use crate::{ Asset, Compound, hot_reloading::{ AssetReloadInfos, CompoundReloadInfos, HotReloader, UpdateMessage, }, utils::PrivateMarker, }; #[cfg(doc)] use crate::AssetCache; use std::{ borrow::Cow, fmt, fs, io, pa...
//! Driver for the ISL29035 digital light sensor. //! //! <http://bit.ly/2rA00cH> //! //! > The ISL29035 is an integrated ambient and infrared light-to-digital //! > converter with I2C (SMBus compatible) Interface. Its advanced self- //! > calibrated photodiode array emulates human eye response with excellent IR //! > ...
//! (TODO) Watchdog Timer (WDGT) //! //! Ref: Section 13, the User Manual use crate::pac::{FWDGT, WWDGT}; use crate::unit::MicroSeconds; use core::convert::Infallible; use embedded_hal::watchdog::blocking::{Enable, Watchdog}; // Ref: Section 13.1.4 const FWDGT_CMD_ENABLE: u16 = 0xCCCC; const FWDGT_CMD_RELOAD: u16 = 0...
use crate::elasticsearch::search::SearchResponseIntoIter; use crate::elasticsearch::Elasticsearch; use crate::executor_manager::get_executor_manager; use crate::zdbquery::ZDBQuery; use pgx::*; struct ZDBScanState { zdbregtype: pg_sys::Oid, index_oid: pg_sys::Oid, iterator: *mut SearchResponseIntoIter, } #...
use std::collections::HashMap; use std::fs; use std::io::prelude::*; use std::net::TcpStream; use std::thread; use std::time::Duration; fn parse_method(line: &str) -> HashMap<String, String> { ["method", "endpoint", "http"] .iter() .map(|c| String::from(*c)) .zip(line.split(" ").map(|c| Str...
use aoc::ProcessInput; use std::{cmp::Ordering, num::ParseIntError, str::FromStr}; type Input = Ins; type Output = i64; type Num = i32; register!( "input/day24.txt"; (input: input!(process Op)) -> Output { part1(&input); part2(&input); } ); fn part1(ops: &[Op]) -> Output { prog::<Max>...
// Copyright 2019 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 // disclaim...
#![warn(clippy::all)] use std::collections::HashSet; use std::io; use std::os::unix::ffi::OsStrExt as _; use std::os::unix::io::RawFd; use std::path::Path; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use futures_core::Stream; pub use input::event; use input::{Event, Libinput, Libin...
use crate::{DeserializeProperty, Property}; use bevy_utils::{HashMap, HashSet}; use std::any::TypeId; #[derive(Default)] pub struct PropertyTypeRegistry { registrations: HashMap<String, PropertyTypeRegistration>, short_names: HashMap<String, String>, ambigous_names: HashSet<String>, } impl PropertyTypeReg...
use tract_hir::internal::*; use tract_hir::tract_core::{downcast_rs, dyn_clone}; /// Common methods for all variants of model. pub trait Model: downcast_rs::Downcast + std::fmt::Debug + dyn_clone::DynClone + Send + Sync { /// Lookup node id by name fn node_id_by_name(&self, name: &str) -> TractResult<usize...
use crate::models::mute::Mute; use crate::models::reminder::Reminder; use crate::models::server_config::ServerConfig; use crate::DatabasePool; use chrono::Utc; use serenity::model::{id::ChannelId, id::GuildId, id::RoleId, id::UserId}; use serenity::utils::MessageBuilder; use tokio::time::delay_for; use tracing::error; ...
//! Creates the nlprule binaries from a *build directory*. Usage information in /build/README.md. use fs::File; use fs_err as fs; use std::{ hash::{Hash, Hasher}, io::{self, BufReader, BufWriter}, num::ParseIntError, path::{Path, PathBuf}, str::FromStr, sync::Arc, }; use crate::{ rules::R...
use crate::SquareViewport; use macroquad::{ audio::Sound, audio::{load_sound_from_bytes, play_sound, PlaySoundParams}, prelude::*, }; struct PieceWrapper { internal_piece: cheseng::Piece, index: u8, legal_moves: Vec<cheseng::Move>, } pub struct BoardUI { board: cheseng::Board, pieces_t...
use super::*; use crate as pallet_rmrk_core; use frame_support::{parameter_types, traits::Everything, weights::Weight}; use frame_system::EnsureRoot; use sp_core::{crypto::AccountId32, H256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, Perbill, }; mod nfc { // Re-export needed for `i...
use std::collections::BTreeMap; use chrono::{SecondsFormat, Utc}; use serde::Serialize; use url::Url; use uuid::Uuid; use super::{AuditWebhook, ErrorKind, Result, ResultExt}; use crate::{apply::UpgradeInfo, webhooks::UpgradeState}; // Webhook Configuration Map type WHC = BTreeMap<String, String>; // ---------------...
use std::{fmt, future::Future, marker::PhantomData, pin::Pin}; use futures_core::Stream; use tokio::pin; use xitca_io::{io::AsyncIo, net::Stream as ServerStream, net::TcpStream}; use xitca_service::Service; use super::{ body::{RequestBody, ResponseBody}, bytes::Bytes, config::HttpServiceConfig, date::...
use super::{Funding, FundingField, FundingHistory, NewFunding, NewFundingHistory, PatchFunding}; use crate::graphql::model::FundingOrderBy; use crate::graphql::utils::Direction; use crate::model::{Crud, DbInsert, HistoryEntry}; use crate::schema::{funding, funding_history}; use crate::{crud_methods, db_insert}; use die...
// Copyright 2021 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in...
// Copyright (c) The Diem Core Contributors // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 use move_command_line_common::{ env::read_bool_env_var, testing::{format_diff, read_env_update_baseline, EXP_EXT, OUT_EXT}, }; use move_compiler::{ compiled_unit::AnnotatedCompiledUnit,...
use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::{Call, CellPath}; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, }; #[derive(Clone)] pub struct Empty; impl Command for Empty { fn name(&sel...
use std::str::FromStr; type Input = Tree; type Output = u32; register!( "input/day18.txt"; (input: input!(parse Input)) -> Output { part1(&input); part2(&input); } ); fn part1(trees: &[Tree]) -> Output { trees .iter() .cloned() .reduce(|mut t1, t2| { ...
#![deny(bare_trait_objects)] use cgmath::*; use fnv::*; use std::panic; use wasm_bindgen::prelude::*; use web_sys::window; use webgl_gui::gui::*; use webgl_gui::widgets::*; use webgl_gui::Color4; use webgl_gui::*; use webgl_wrapper::*; #[wasm_bindgen(start)] pub async fn main() -> Result<(), JsValue> { panic::set...
use crate::list::{Frontier, OpLog, Time}; use smartstring::alias::String as SmartString; #[cfg(feature = "serde")] use serde_crate::{Deserialize, Serialize}; use smallvec::SmallVec; use crate::localtime::TimeSpan; use crate::{AgentId, ROOT_AGENT, ROOT_TIME}; use crate::list::frontier::frontier_is_sorted; use crate::lis...
use crate::bot::telegram_client::Api; use crate::config::Config; use crate::db::feeds; use crate::db::telegram; use crate::db::telegram::NewTelegramChat; use crate::db::telegram::NewTelegramSubscription; use crate::models::telegram_subscription::TelegramSubscription; use diesel::r2d2::ConnectionManager; use diesel::r2d...