text
stringlengths
3.09k
13.9k
use crate::prelude::*; use crate::z3::*; use std::ffi::CStr; pub(crate) struct Assertion(Z3_ast); unsafe impl Send for Assertion {} pub(crate) struct Context(Z3_context); unsafe impl Sync for Context {} impl Default for Context { fn default() -> Self { Self(unsafe { Z3_mk_context(Z3_mk_config()) }) }...
//! Result of SQL Builder. Use it to get SQL that can be sent to the database. use super::select_stream::SelectStream; use crate::{ alias_translator::AliasTranslator, parameter_map::ParameterMap, sql_expr::resolver_error::Result, }; use crate::{ sql::Sql, sql_expr::{resolver::Resolver, SqlExpr}, }; use...
// Local imports use crate::math::{Vec2, Vec3, EPSILON}; use crate::graphics::Material; use crate::graphics::ray::{Ray, Tracable, Bounded, Hit}; use crate::graphics::AABB; use crate::rng::Rng; /// A triangle in 3-dimensional space /// It's normal is inferred from the plane between the vertices #[derive(Debug,...
use serde::{Deserialize, Serialize}; use std::{ cmp, sync::atomic::{AtomicU8, Ordering}, }; /// An allocation preference. If a [StoragePreference] other than [StoragePreference::NONE] /// is used for an operation, the allocator will try to allocate on that storage class, /// but success is not guaranteed. /// ...
#[macro_use] extern crate log; extern crate aqua; extern crate diesel; extern crate dotenv; extern crate env_logger; extern crate rusqlite; use aqua::models::{self, Entry, NewEntry, NewEntryTag, NewTag}; use aqua::schema; use diesel::Connection as DieselConnection; use diesel::prelude::*; use diesel::pg::PgConnection...
use std::{ convert::TryFrom, fmt::{self, Display}, net::IpAddr, }; use bendy::decoding::{self, FromBencode, ListDecoder, Object}; use either::Either; use reqwest::Url; use crate::Peer; #[derive(Debug, PartialEq, Eq)] pub enum Event { Started, Stopped, Completed, Empty, } impl Display for...
// 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 std::collections::HashSet; use crate::capabilities::NodeCapabilities; use crate::{data_source::DataSource, Chain}; use graph::blockchain as bc; use graph::firehose::BasicReceiptFilter; use graph::prelude::*; use prost::Message; use prost_types::Any; const BASIC_RECEIPT_FILTER_TYPE_URL: &str = "type.googleapis...
use super::{DISPLAY_COLUMNS, DISPLAY_LINES}; use anyhow::{ensure, Result}; use rand::Rng; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Colour { Black, // #000000 White, // #FFFFFF Red, // #880000 Cyan, // #AAFFEE Violet, // #CC44CC Green, // #00CC5...
use aoc::*; use eyre::bail; use itertools::Itertools; use regex::Regex; use smallvec::{smallvec, SmallVec}; use std::collections::{HashMap, HashSet}; use std::hash::{Hash, Hasher}; type IndicesVec = Option<SmallVec<[usize; 2]>>; #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] struct Pair { chip_floor: i8...
use std::ops::Deref; fn dereference() { let x = 42; // Y is a reference to an i32 let y = &x; // In order to access the value pointed to by y // we need to dereference y with * println!("y = {}", *y); } // Tuple struct with one element of type T struct CustomBox<T>(T); impl<T> CustomBox<T> {...
// Copyright 2017-2019 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) a...
use bot::Bot; use discord::model::Message; use module; use std::{cmp::Ordering, collections::hash_map::HashMap}; struct Command<'a> { module: &'a module::Module, id: u32, names: &'a [&'a str], } impl<'a> Command<'a> { fn cmp(&self, other: &Self) -> Ordering { match self.names[0].cmp(&other.nam...
/* Copyright 2017 <NAME> * * 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 disclaimer. * ...
use crate::shared::{ get_argument_names, get_package_name, Function, FunctionInfo, }; use flux::imports; use flux::prelude; use flux::semantic::types::{MonoType, Record}; use std::collections::{BTreeMap, HashMap}; use std::fmt; use std::iter::Iterator; pub const BUILTIN_PACKAGE: &str = "builtin"; #[derive(Clone...
use indexmap::IndexMap; use rand::Rng; use std::usize; use util::*; use super::*; type HashTable = IndexMap<Key, Value>; type SeederMapIter<'a> = std::iter::Chain< indexmap::map::Iter<'a, u64, peerinfo::PeerInfo>, indexmap::map::Iter<'a, u64, peerinfo::PeerInfo>, >; pub struct SeederMap { map: [HashTab...
#![feature(type_ascription)] #![feature(option_result_contains)] #![feature(result_flattening)] #![feature(duration_zero)] #![feature(format_args_nl)] use std::sync::Arc; use flan::{emit_error}; use flan::cfg::Command; #[allow(unused_imports)] use flan::error::Handler; use flan::infer; fn main() { use flan::driv...
pub use self::t1d::Texture1D; pub use self::t2d::Texture2D; pub use self::t3d::Texture3D; pub use self::t1d_array::Texture1DArray; pub use self::t2d_array::Texture2DArray; pub use self::tcube::TextureCube; pub use self::tcube_array::TextureCubeArray; mod t1d; mod t2d; mod t3d; mod t1d_array; mod t2d_array; mod tcube;...
//! A collection of widgets. //! //! ``` //! use tinybit::widgets::Text; //! let text = Text::new("Hello, World", None, None); //! ``` use crate::{Color, Pixel, ScreenPos, ScreenSize}; use crate::events::{KeyCode, KeyEvent}; pub trait Widget { fn pixels(&self, size: ScreenSize) -> Vec<Pixel>; } // ---------------...
//! `tor-chanmgr`: Manage a set of channels on the Tor network. //! //! # Overview //! //! This crate is part of //! [Arti](https://gitlab.torproject.org/tpo/core/arti/), a project to //! implement [Tor](https://www.torproject.org/) in Rust. //! //! In Tor, a channel is a connection to a Tor relay. It can be //! direc...
use core::ptr::{null, null_mut}; use crate::{ c_api, cstring, error, error_ref_mut, error_str, widgets::{NcSelector, NcSelectorBuilder, NcSelectorItem, NcSelectorOptions}, NcChannels, NcInput, NcPlane, NcResult, NcString, }; impl NcSelector { /// Creates a selector over a `plane`. /// /// The ...
/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is free...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. //! This module helps deno implement timers. //! //! As an optimization, we want to avoid an expensive calls into rust for every //! setTimeout in JavaScript. Thus in //js/timers.ts a data structure is //! implemented that calls into Rust for o...
#![deny(rust_2018_idioms)] #![warn( missing_copy_implementations, missing_debug_implementations, clippy::explicit_iter_loop, clippy::use_self )] use arrow_deps::arrow::record_batch::RecordBatch; use async_trait::async_trait; use data_types::data::ReplicatedWrite; use exec::{FieldListPlan, GroupedSeries...
//! cli arguments for configuring the evm settings use clap::Parser; use ethers::types::{Address, U256}; use evm_adapters::evm_opts::EvmType; use foundry_config::{ figment::{ self, error::Kind::InvalidType, value::{Dict, Map, Value}, Metadata, Profile, Provider, }, Config, };...
use russell_lab::{Matrix, Vector}; /// Defines a quadrilateral with 9 nodes (quadratic edges; interior node) /// /// The reference coordinates range from -1 to +1 with the geometry centred @ 0 /// /// # Local IDs of nodes /// /// ```text /// 3-----6-----2 /// | s | r s r s /// | ...
//! A PE32 and PE32+ parser //! // TODO: panics with unwrap on None for apisetschema.dll, fhuxgraphics.dll and some others use alloc::vec::Vec; pub mod characteristic; pub mod data_directories; pub mod debug; pub mod exception; pub mod export; pub mod header; pub mod import; pub mod optional_header; pub mod relocati...
use mcfg::actions::*; use mcfg::error::Result; use mcfg::shared::{user_shell, FileSystemResource, InstallerRegistry, Name, PackageRepository}; use mcfg::APP_NAME; use std::convert::TryInto; use std::error::Error; use structopt::StructOpt; // -----------------------------------------------------------------------------...
use neon::prelude::*; use rodio::Source; use std::{ cell::RefCell, fs::File, io::BufReader, sync::mpsc, thread, time::{Duration, Instant}, }; enum Status { Playing(Instant, Duration), Stopped(Duration), } impl Status { #[inline] fn new() -> Status { Status::Stopped(Dura...
//! File tree sync artifact. use crate::{ artifact::Artifact, chunkable::{ ArtifactChunk, ArtifactChunkData, ArtifactErrorCode, ChunkId, Chunkable, ChunkableArtifact, }, crypto::CryptoHash, }; use bincode::{deserialize, serialize}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; c...
use core::{ fmt::{Debug, Formatter}, marker::PhantomData, }; use crate::sync::{Arc, AtomicPtr, AtomicUsize, Ordering}; use alloc::boxed::Box; // TODO // * For now I'm just using Ordering::SeqCst, because I havent really looked into what exactly we // need for the Ordering, so this should probably be made more...
use std::collections::HashMap; use std::path::PathBuf; use std::sync::Arc; use crossbeam_channel::{Sender}; use itertools::Itertools; use parking_lot::{Mutex, RwLock}; use tokio::runtime::Runtime; use segment::types::{HasIdCondition, PointIdType, ScoredPoint, VectorElementType, SegmentType}; use segment::types::Condi...
#![recursion_limit = "1024"] use js_sys::global; use std::unreachable; use wasm_bindgen::{prelude::*, JsCast, JsValue}; use yew::prelude::*; #[global_allocator] static ALLOC: rlsf::SmallGlobalTlsf = rlsf::SmallGlobalTlsf::INIT; mod filechoice; mod helpview; mod imagewell; mod loader; mod outputview; mod worker; mod x...
/// Most of the code for this module comes from `rust-libp2p`. use std::fmt; use rand::{thread_rng, Rng}; use unsigned_varint::{decode, encode}; use crate::handshake::handshake_struct::PublicKey; const SHA256_CODE: u16 = 0x12; const SHA256_SIZE: u8 = 32; /// Identifier of a peer of the network /// /// The data is a...
use proc_macro2::TokenStream; use syn; use syn::{Data, DeriveInput, Field, Fields}; use util::*; #[derive(Default, Debug)] struct ObjAttrs { name: Option<String>, description: Option<String>, } impl ObjAttrs { fn from_input(input: &DeriveInput) -> ObjAttrs { let mut res = ObjAttrs::default(); ...
// Copyright 2021 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::{ deletion_actor::DeletionActor, file_actor::FileActor, instance_actor::InstanceActor, Args, }, async_trait::async_trait, ...
// 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 { rustyline::{ completion::Completer, error::ReadlineError, highlight::Highlighter, hint::Hinter, Helper, }, std::{ borrow:...
use crate::{ debug_drawing::{DebugLine, DebugLines, DebugLinesComponent, DebugLinesParams}, pipeline::{PipelineDescBuilder, PipelinesBuilder}, pod::ViewArgs, submodules::{gather::CameraGatherer, DynamicUniform, DynamicVertexBuffer}, types::Backend, util, }; use amethyst_core::ecs::{Join, Read, S...
use std::{ io, mem, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, os::unix::io::{AsRawFd, RawFd}, pin::Pin, task::{self, Poll}, }; use log::error; use pin_project::pin_project; use tokio::{ io::{AsyncRead, AsyncWrite, ReadBuf}, net::{TcpSocket, TcpStream as TokioTcpStream, UdpSocket}, ...
use std::collections::VecDeque; use piston_window::{Context, G2d}; use crate::direction::Direction; use crate::draw_utils::{Color, draw_square}; use crate::food::Food; use crate::game::{CELL_SIZE, END_CELL_IDX, START_CELL_IDX}; use crate::map::Map; use crate::point::Point; pub struct Snake { pub x: f64, pub ...
use std::{ env, io, path::{Path, PathBuf}, process::Command, }; /// A helper function wrapping the flatdata generator. /// /// Can be used to write build.rs build scripts, generating outputs either from /// a single schema, or recursively from a folder of schemas. /// /// `schemas_path` can either be a sin...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 /// Helper module to generate accounts and signed transactions requests: /// * Generate a group of accounts with a single wallet. /// * Generating customized offline transactions (TXNs), including minting and different /// patterns o...
use crate::{Data, ParseRequestError, UploadValue, Value, Variables}; use serde::{Deserialize, Deserializer}; use std::any::Any; use std::collections::HashMap; use std::fmt::{self, Debug, Formatter}; /// GraphQL request. /// /// This can be deserialized from a structure of the query string, the operation name and the /...
// 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...
// Copyright 2016 <NAME>, <NAME> and <NAME>. // See the README.md file at the top-level directory of this // distribution. // // Licensed under the MIT license <LICENSE or // http://opensource.org/licenses/MIT>, at your option. // This file may not be copied, modified, or distributed // except according to those terms....
use command::{Command, Query}; use command::Command::Normalize; use std::collections::HashMap; use types::normalizer_type::NormalizerType; use command_query::CommandQuery; use queryable::Queryable; use command_line::CommandLine; use commandable::Commandable; use request_cancellable::RequestCancellable; use request_time...
// Copyright 2019 The Grin Developers // // 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 agree...
extern crate chrono; extern crate docopt; extern crate env_logger; extern crate libc; extern crate palette; extern crate pdf_canvas; extern crate serde_json; #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; mod interval; mod reports; mod util; use chrono::{Local, TimeZone, Utc}; use docopt::Doc...
#![feature(alloc_error_handler)] #![cfg_attr(target_arch = "xtensa", no_std)] #[cfg(target_arch = "xtensa")] extern crate panic_halt; extern crate alloc; use idf_hal::{ peripherals::*, wifi::*, gpio::*, pwm::*, watchdog::*, uart::*, nvs::*, system_event::*, }; use freertos_rs::{Tas...
use crate::{has_hash::HasHash, HashType, PrimitiveHashType}; pub(crate) const HASH_CORE_LEN: usize = 32; pub(crate) const HASH_LOC_LEN: usize = 4; /// Length of the a full HoloHash bytes pub const HOLO_HASH_SERIALIZED_LEN: usize = HASH_CORE_LEN + HASH_LOC_LEN; /// A HoloHash contains a vector of 36 bytes representin...
use crate::relayer::compact_block::CompactBlock; use crate::relayer::compact_block_verifier::CompactBlockVerifier; use crate::relayer::Relayer; use ckb_core::{header::Header, BlockNumber}; use ckb_network::{CKBProtocolContext, PeerIndex}; use ckb_protocol::{CompactBlock as FbsCompactBlock, RelayMessage}; use ckb_shared...
use std::path::Path; use is_executable::is_executable; use serde::Deserialize; use crate::config::rules::{AutoScriptRules, ExecuteScriptRules, Frequency, Rules, Unit}; #[derive(Debug, Deserialize)] #[serde(deny_unknown_fields)] pub struct Config { #[serde(default = "Output::default")] pub output: Output, p...
use crate::{CstError, now_secs}; use nix::sys::wait::waitpid; use tokio::fs::OpenOptions; use crate::resp::Message; use crate::server::{EVENT_TYPE_REPLICATED, Server, EventsConsumer}; use nix::unistd::Pid; use crate::replica::replica::ReplicaMeta; use crate::conn::writer::Writer; use tokio::time::sleep; use tokio::time...
// // line2.rs // Copyright (C) 2019 <NAME> <<EMAIL>> // Distributed under terms of the MIT license. // use std::fmt; #[cfg(test)] use approx::AbsDiffEq; use nalgebra::Point2; use serde::{Deserialize, Serialize}; use crate::traits::Intersect; #[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize)] pub stru...
#![no_main] #![no_std] #![feature(default_alloc_error_handler)] extern crate alloc; use cortex_m_rt::entry; use core::{mem::MaybeUninit, panic::PanicInfo}; use embedded_rust_h2al::{events, Component, ComponentsBuilder}; use embedded_rust_hardware_init::device_config; #[global_allocator] static ALLOCATOR: linked_li...
use anyhow::Result; use lazy_static::lazy_static; use log::*; use nannou::{color::named, prelude::*, rand}; use std::{ env::{set_var, var}, string::ToString, }; use structopt::StructOpt; lazy_static! { pub static ref OPT: Opt = Opt::from_args(); } fn main() { init_logging(OPT.verbosity); nannou::a...
// mod utils; extern crate js_sys; // Import `wasm_bindgen` // https://rustwasm.github.io/wasm-bindgen/ use wasm_bindgen::prelude::*; // Use `wee_alloc` as the global allocator // https://fitzgeraldnick.com/2018/02/09/wee-alloc.html #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc =...
/* from <linux/capability.h> */ pub const CAP_CHOWN: u8 = 0; pub const CAP_DAC_OVERRIDE: u8 = 1; pub const CAP_DAC_READ_SEARCH: u8 = 2; pub const CAP_FOWNER: u8 = 3; pub const CAP_FSETID: u8 = 4; pub const CAP_KILL: u8 = 5; pub const CAP_SETGID: u8 = 6; pub const CAP_SETUID: u8 = 7; pub const CAP_SETPCAP: u8 = 8; pub ...
// //! 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 ...
// // Copyright 2021 <NAME> // This file is part of the Ida compiler. // Ida is licensed under the BSD-3 license. See the COPYING file for more information. // use crate::ast; use crate::ast::*; use crate::lex::Token; use crate::ast_builder::AstBuilder; use crate::ast_utils::*; // A utility function for returning a ...
use std::*; pub const PORT_IS_INPUT: usize = 1; pub const PORT_IS_OUTPUT: usize = 2; pub const DEFAULT_MIDI_TYPE: *const u8 = b"8 bit raw midi\0" as *const _; #[repr(C)] pub struct MidiEvent { pub time: u32, pub size: usize, pub buffer: *mut u8, } #[derive(Clone, Copy, PartialEq, Eq)] #[repr(C)] pub enum...
use crate::errors::{Error, Result}; use serde::Deserialize; use serde_json::Value as JsonData; use std::collections::HashMap; /// Draft of DetectIntentResponse. Full specification here: /// https://cloud.google.com/dialogflow/es/docs/reference/rest/v2/DetectIntentResponse /// Currently QueryResult is not fully mapped ...
// Copyright 2020 <NAME> // SPDX-License-Identifier: Apache-2.0 mod constants; mod essence; mod input; mod output; mod transaction_id; mod treasury; mod unlock; use crate::Error; pub use constants::{INPUT_OUTPUT_COUNT_MAX, INPUT_OUTPUT_COUNT_RANGE, INPUT_OUTPUT_INDEX_RANGE, IOTA_SUPPLY}; pub use essence::{Essence, R...
/** * \file flow-rs/src/sandbox.rs * MegFlow is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2019-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS...
use std::iter::ExactSizeIterator; use std::iter::IntoIterator; use std::marker::PhantomData; use std::ops::Deref; use std::ptr::null; use std::ptr::NonNull; use std::slice; // class StringView { // public: // StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {} // // StringView(const uint8_t* cha...
pub mod db; pub mod diff; use std::env::current_dir; use std::error::Error; use std::fs::{copy, create_dir, read_dir, read_to_string, File}; use std::io::Write; use std::path::{Path, PathBuf}; use toml::Value; use ergol_core::{Element, Table}; use crate::diff::{diff, Diff, State}; /// Tries to sort the tables in o...
use crate::*; use obj::Obj; use std::ffi::OsStr; use std::fs; use std::iter; use std::os::unix::fs::PermissionsExt; use walkdir::WalkDir; /// Node of a git tree object. This represents a file or directory in /// a tree. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Node { /// Permission bits pub mode: fs...
use itertools::Itertools; use std::{collections::HashSet, path::PathBuf, slice::Iter, vec}; use crate::AdventOfCode; const DAY: &str = "day19"; type Pos = [i64; 3]; #[derive(Debug, Default)] struct Scanner { orientation: u8, beacons: Vec<Pos>, position: Option<Pos>, } #[derive(Clone)] struct ScannerRot...
use bytes::Bytes; use http::{Request, Response}; use hyper::{self, client::HttpConnector}; use hyper_timeout::TimeoutConnector; pub use kube_core::response::Status; use tower::{util::BoxService, BoxError, Layer, Service, ServiceBuilder}; use tower_http::{ classify::ServerErrorsFailureClass, map_response_body::MapRe...
use crate::ast_pass::{ directive_parsing::{DateTimeScalarType, ParseDirective}, error::{Error, ErrorKind}, schema_visitor::SchemaVisitor, type_name, EmitError, }; use graphql_parser::{ schema::{Document, *}, Pos, }; use std::collections::{BTreeSet, HashMap, HashSet}; #[derive(Debug)] pub struct...
use crate::{ collections::TypedUsize, crypto_tools::{constants, hash, k256_serde::point_to_bytes, paillier, vss}, gg20::keygen::SecretKeyShare, sdk::{ api::TofnResult, implementer_api::{serialize, RoundBuilder}, }, }; use ecdsa::elliptic_curve::Field; use k256::Scalar; use serde::{De...
/* * Copyright 2019 Comcast Cable Communications Management, 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 applicab...
use super::update::*; use super::super::control::*; use super::super::controller::*; use super::super::binding_canvas::*; use super::super::resource_manager::*; use canvas::*; use binding::*; use futures::*; use std::sync::*; use std::collections::HashMap; /// /// Tracker for an individual canvas /// struct CanvasS...
use crate::{ activity::events::ActivityEvent, handler::DiscordMsg, lobby::events::LobbyEvent, overlay::events::OverlayEvent, proto::event::ClassifiedEvent, relations::events::RelationshipEvent, user::{events::UserEvent, User}, voice::events::VoiceEvent, }; use tokio::sync::{broadcast, wa...
// Copyright 2019 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use super::event_ring::{Error as EventRingError, EventRing}; use super::xhci_abi::{ CommandCompletionEventTrb, Error as TrbError, PortStatusChangeE...
use std::error; use std::fmt; use std::result; use crate::vars::*; /// Custom `Result` type. pub type Result<T> = result::Result<T, Error>; /// Custom `Error` type. #[derive(Debug)] pub enum Error { /// UnQLite error code map Custom(Custom), /// Any kind of other errors Other(Box<dyn error::Error>), }...
// Copyright 2019 Bitwise IO, 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 t...
//! Godwit Settings Management //! //! A utility abstraction over persistent settings and access methods. use crate::errors::SettingsError; use crate::plugins::Plugin; use getter_derive::Getter; use glob::glob; use log::info; use serde::{Deserialize, Serialize}; use std::fs::{self, File}; use std::path::PathBuf; /// D...
#[macro_use] extern crate lazy_static; extern crate regex; use std::collections::{HashMap, HashSet}; use std::error::Error; use std::io::{self, Read, Write}; use std::result; use std::str::FromStr; use regex::Regex; macro_rules! err { ($($tt:tt)*) => { Err(Box::<Error>::from(format!($($tt)*))) } } type Result<T...
mod data; pub use data::*; use imgui::Ui; use std::time::Duration; use crate::{common::Camera, optix::OptixRenderer}; use anyhow::Result; use cust::{ error::CudaResult, event::{Event, EventFlags}, function::{BlockSize, GridSize}, memory::DeviceBox, prelude::*, }; use optix::{ context::DeviceC...
#![deny(unsafe_code)] #![no_main] #![no_std] use bern_kernel as kernel; use kernel::{ task::Task, task::Priority, sched, sync::Mutex, }; use panic_halt as _; use cortex_m; use cortex_m_rt::entry; use st_nucleo_f446::StNucleoF446; use stm32f4xx_hal::prelude::*; use bern_kernel::sync::Semaphore; #[lin...
use crate::framework::context::Context; use crate::framework::error::GameResult; use crate::framework::filesystem; use crate::input::combined_menu_controller::CombinedMenuController; use crate::menu::MenuEntry; use crate::menu::{Menu, MenuSelectionResult}; use crate::profile::GameProfile; use crate::shared_game_state::...
use std::{collections::HashMap, path::PathBuf}; use ignore::gitignore::Gitignore; use miette::Diagnostic; use thiserror::Error; use tokio::sync::watch::{self, error::SendError}; use crate::{ action, error::RuntimeError, filter::tagged::{Filter, Matcher}, fs, ignore::IgnoreFilterer, }; /// Errors occurring from ...
#![warn( unreachable_pub, trivial_casts, trivial_numeric_casts, unused_extern_crates, rust_2018_idioms, missing_debug_implementations )] use glam::Vec2; use lazy_static::lazy_static; use log::info; use rand::random; use rayon::prelude::*; use std::f32::consts::PI; #[derive(Debug, Clone, Copy, ...
use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::collections::HashMap; pub fn two_factor_1(file: &str, w: usize, h: usize) -> usize { let screen = Screen { width: w, height: h, }; count_pixels(file, screen) } pub fn two_factor_2(file: &str, w: usize, h: usize) -...
extern crate regex; extern crate utils; use std::fs::File; use std::io::{BufRead, BufReader}; use std::io; use regex::Regex; use crate::Command::{North, South, East, West, Left, Right, Forward}; mod test; #[derive(Debug, Eq, PartialEq, Copy, Clone)] enum Direction { North, South, East, West } // Clo...
/* Utility functions Warning: some of these functions are Linux-specific. */ use chrono::offset::Local; use nix::sys::wait::{waitpid, WaitStatus}; use nix::unistd::{fork, ForkResult}; use rand::Rng; use std::boxed::Box; use std::fmt::Debug; use std::fs::{File, OpenOptions}; use std::io::{self, prelude::*, Bu...
use std::{collections::HashMap, sync::Arc}; use serde::{Deserialize, Serialize}; use crate::{Action, ActionNameList, Identifier, PermissionDenied, ResourceName, Statement}; /// A collection of allowed permissions. This is constructed from a /// `Vec<`[`Statement`]`>`. By default, no actions are allowed on any resour...
//! A first attempt to get particles into rendology. //! //! For now I'll just try to reimplement particle-frenzy: //! https://github.com/leod/particle-frenzy //! //! I'm not sure if it makes sense to include particles in deferred shading, //! but it seems overkill for now. Unfortunately, that would be somewhat //! dif...
#![feature(generators, generator_trait)] #![allow( clippy::borrowed_box, clippy::needless_return, clippy::while_let_on_iterator )] use stack_safe::trampoline; use std::mem::MaybeUninit; use std::ops::{Generator, GeneratorState}; use std::pin::Pin; #[derive(Debug)] pub enum Exp { Num(f64), Add(Vec<E...
extern crate libc; extern crate serde_json; use api::ErrorCode; use errors::indy::IndyError; use errors::common::CommonError; use errors::wallet::WalletError; use services::wallet::WalletService; use std::rc::Rc; use self::libc::c_char; pub enum WalletCommand { RegisterWalletType(String, // xtype ...
use crate::{ collections::{FillHoleVecMap, HoleVecMap, TypedUsize, VecMap, VecMapIter}, sdk::api::TofnResult, }; use super::{holevecmap_iter::HoleVecMapIter, FullP2ps, P2ps}; pub struct FillP2ps<K, V>(VecMap<K, FillHoleVecMap<K, V>>); impl<K, V> FillP2ps<K, V> { pub fn with_size(len: usize) -> Self { ...
// 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 writing,...
//! Defines the Comparison Generator for calculating a comparison which has the //! same final time as the runner's Personal Best. Unlike the Personal Best //! however, all the other split times are automatically balanced by the //! runner's history in order to balance out the mistakes present in the //! Personal Best ...
//! [`brainfucklib::vm::cell`] //! //! This module defines a struct called [`MemoryCell`] which stores a [`i128`] //! value inside it. This represents (as its name implies) a memory cell in //! a Brainfuck virtual machine. The struct provides the necessary functions //! to check inputs such as incrementing and de...
#[cfg(feature = "node")] use crate::node::Header; #[cfg(feature = "node")] use crate::node::Wire; use crate::blocks::{BlockHash, BlockType}; use crate::bytes::Bytes; use crate::{expect_len, Public, Rai, Signature, Work}; use serde::{Deserialize, Serialize}; use std::convert::TryFrom; #[derive(Debug, Clone, Serializ...
use lab_sprites::*; use crate::*; use bevy::input::mouse::MouseWheel; /// System to sample mouse wheel events and update athe ScrollState /// resource that can be used by other systems. pub fn mouse_wheel_system( time: Res<Time>, mut state: ResMut<State>, mut scroll_state: ResMut<ScrollState>, mouse_...
use bitfield::bitfield; /// LM3549 Registers pub enum Register { BankSel = 0x00, Ir0Lsb = 0x01, Ir0Msb = 0x02, Ig0Lsb = 0x03, Ig0Msb = 0x04, Ib0Lsb = 0x05, Ib0Msb = 0x06, Ir1Lsb = 0x07, Ir1Msb = 0x08, Ig1Lsb = 0x09, Ig1Msb = 0x0A, Ib1Lsb = 0x0B, Ib1Msb = 0x0C, Ir...
use std::env; use std::fs::File; use std::fmt::Write as FmtWrite; use std::io::Write; use std::path::Path; use serde::{Deserialize}; #[derive(PartialEq, Clone, Deserialize)] enum ParamType { Number, Float, String, Items, StringList, NumberList, ListOfNumberList, } impl ParamType { fn ...