text
stringlengths
3.09k
13.9k
extern crate rand; extern crate getopts; extern crate time; use std::io::Write; use std::fs::File; use std::env; use getopts::Options; use rand::{XorShiftRng, Rng}; fn print_usage(program: &str, opts: Options) { let brief = format!("Usage: {} [options] [OUTPUT_FILE]", program); print!("{}", opts.usage(&brie...
use std::{ io, ops::Deref, ptr, sync::{ atomic::{AtomicU32, Ordering}, Arc, }, }; use crate::{ resultify, sys::{ self, io_sqring_offsets, io_uring_sqe, IORING_ENTER_GETEVENTS, IORING_ENTER_SQ_WAKEUP, IORING_SQ_CQ_OVERFLOW, IORING_SQ_NEED_WAKEUP, }, Pa...
use std::collections::HashSet; /// internal type representation (as argument or object member): /// string: pointer to an array of characters, passed by value /// int, bool: passed by value /// array: pointer to array, passed by value /// object: pointer to struct, passed by value use std::fmt::{Display, Error, Format...
use crate::data; use crate::data::LogSource; use crate::data::LogStream; use crate::data::StreamEntry; use crate::log_merge::LogMerge; use actix_web::error::ResponseError; use actix_web::http::header; use actix_web::web; use actix_web::HttpResponse; use bytes::BufMut; use bytes::Bytes; use futures::stream::StreamExt; u...
use itertools::Itertools; use std::collections::{BinaryHeap, HashMap}; fn main() { let input = include_str!("../../input/23.txt"); println!("Part 1: {}", part_1(input)); println!("Part 2: {}", part_2(input)); } fn right_configuration(maze: &[Vec<char>]) -> bool { maze[2..(maze.len() - 1)] .ite...
use std::io::Write; use std::time::Duration; use thiserror::Error; use bytes::{buf::BufMutExt, BufMut, Bytes, BytesMut}; use futures::{Future, SinkExt, StreamExt, TryFutureExt, TryStream}; use log::{debug, error, warn}; use tokio::net::TcpStream; use tokio::sync::mpsc::UnboundedSender; use tokio::{select, spawn}; use ...
use crate::{ keypair::{Network, PublicKey}, mnemonic, result::{bail, Error, Result}, traits::{TxnFeeConfig, B64}, wallet::Wallet, }; pub use helium_api::{pending_transactions::PendingTxnStatus, Client, Hnt, Hst, Usd}; pub use helium_proto::*; pub use serde_json::json; use std::{ env, fs, io, ...
use crate::utils::pattern::*; pub struct EscapedText { text: String, tag_starts_ends: Vec<(usize,char)> } impl EscapedText { pub fn new(source: &str) -> Self { let text = source.replace("\\\\", "\x1B").replace(&("\\".to_owned() + TAG_START), "\x02").replace(&("\\".to_owned() + TAG_END), "\x03").re...
//! Rocket's logging infrastructure. use std::{fmt, env}; use std::str::FromStr; use log; use yansi::Paint; crate const COLORS_ENV: &str = "ROCKET_CLI_COLORS"; struct RocketLogger(LoggingLevel); /// Defines the different levels for log messages. #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub enum LoggingLevel { ...
// 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...
pub use crate::config::HookType; use crate::logs::HasLogger; use crate::template::render_template; use acme_common::error::Error; use serde::Serialize; use std::collections::hash_map::Iter; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::PathB...
use std::sync::Arc; use ra_syntax::{ ast::{self, ModuleItemOwner, NameOwner}, SmolStr, }; use relative_path::RelativePathBuf; use rustc_hash::{FxHashMap, FxHashSet}; use crate::{ db, descriptors::DescriptorDatabase, input::{SourceRoot, SourceRootId}, Cancelable, FileId, FileResolverImp, }; us...
use apollo_federation_types::build::BuildError; use graphql_client::*; use crate::blocking::StudioClient; use crate::operations::supergraph::fetch::SupergraphFetchInput; use crate::shared::{FetchResponse, GraphRef, Sdl, SdlType}; use crate::RoverClientError; // I'm not sure where this should live long-term /// this i...
#![deny(warnings, rust_2018_idioms)] #![forbid(unsafe_code)] #![allow(clippy::inconsistent_struct_constructor)] use futures::Stream; use pin_project::pin_project; use rand::{rngs::SmallRng, thread_rng, SeedableRng}; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Duration; us...
use std::{fmt::Display, sync::atomic::AtomicI32, iter::{once, Once}}; use anyhow::{anyhow, bail, Context, Error, ensure}; use itertools::Itertools; use regex::{Regex, Captures}; use rust_shared::BasicError; use serde_json::Map; use tokio_postgres::types::{ToSql, WrongType}; use lazy_static::lazy_static; use crate::{uti...
//! Probabilistic sampling scheduler is a corpus scheduler that feeds the fuzzer //! with sampled item from the corpus. use crate::{ bolts::rands::Rand, corpus::Corpus, inputs::Input, schedulers::{Scheduler, TestcaseScore}, state::{HasCorpus, HasMetadata, HasRand}, Error, }; use alloc::string::...
use arrayref::{array_mut_ref, array_ref, array_refs, mut_array_refs}; use num_enum::TryFromPrimitive; use solana_program::{ msg, program_error::ProgramError, program_pack::{IsInitialized, Pack, Sealed}, pubkey::Pubkey, }; /// /// Pool state /// #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, TryFromPrimiti...
use crate::exports::{ExportError, Exportable}; use crate::externals::Extern; use crate::store::Store; use crate::{MemoryType, MemoryView}; use std::convert::TryInto; use std::slice; use std::sync::Arc; use wasmer_types::{Pages, ValueType}; use wasmer_vm::{Export, ExportMemory, Memory as RuntimeMemory, MemoryError}; //...
use gio::prelude::*; use gtk::prelude::*; use std::ops::Deref; use std::rc::Rc; use crate::app::components::utils::AnimatorDefault; use crate::app::components::{Component, EventListener, SongWidget}; use crate::app::models::SongModel; use crate::app::{ state::{PlaybackEvent, SelectionEvent, SelectionState}, Ap...
// 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 // disclai...
use crate::{self as tfgridModule, Config}; use frame_support::{construct_runtime, parameter_types}; use sp_io::TestExternalities; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, }; use frame_system::EnsureRoot; use sp_core::{ed25519, sr25519, Pair, Public, H256}; use sp_std::prelude:...
use serde::Deserialize; use std::time::Duration; use tendermint_light_client::components::verifier::Verdict; use tendermint_light_client::{ tests::{Trusted, *}, types::{LightBlock, Time, TrustThreshold}, }; use tendermint_testgen::{apalache::*, jsonatr::*, Command, TestEnv, Tester}; #[derive(Deserialize, Clone...
//! Quadrature rules for the one-dimensional domain `[-1, 1]`. use crate::Rule; use std::f64::consts::PI; /// Recurrence relation for Legendre polynomials. /// /// Note: we use a formula for which derivatives are *not* defined at |x| == 1, so it is only /// suitable for evaluation in the open interval (-1, 1). #[deri...
// The MIT License (MIT) // // Copyright (c) 2016 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, mo...
use std::io::Write; use std::path::{Path, PathBuf}; use std::{env, fs, io}; use color_eyre::Help; use directories_next::ProjectDirs; use structopt::StructOpt; use crate::errors::LostTheWay; use crate::utils::{get_default_copy_cmd, NAME}; #[derive(StructOpt, Debug)] pub enum ConfigCommand { /// Prints / writes th...
use cranelift_codegen::binemit::Reloc; use cranelift_codegen::isa::TargetIsa; use cranelift_entity::{EntityRef, PrimaryMap}; use cranelift_wasm::{DefinedFuncIndex, MemoryIndex, TableIndex}; use instance::Instance; use memory::LinearMemory; use region::protect; use region::Protection; use std::mem::transmute; use std::p...
//! Implement HID device use super::*; // reference: // HID 1.11: https://www.usb.org/sites/default/files/documents/hid1_11.pdf // HID Usage Tables 1.12: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf #[derive(Clone)] enum UsbHidKeyboardHandlerState { Idle, KeyDown, } /// A handler of a HID ...
//! Reading index files linearly from disk, a capability needed for merging //! index files. use std::fs::{self, File}; use std::io::prelude::*; use std::io::{self, BufReader, SeekFrom}; use std::path::Path; use byteorder::{LittleEndian, ReadBytesExt}; use write::IndexFileWriter; /// A `IndexFileReader` does a single...
use git2::{Oid, Repository}; use std::collections::HashMap; use std::env; use std::io::prelude::*; use std::fs::{self, File}; use std::path::{Path, PathBuf}; use std::process::{self, Command}; use url::Url; const FLUTTER_REPO: &str = "https://github.com/lykenware/flutter"; const FLUTTER_REPO_REV: &str = "e16e402416475...
//! QUIC transport protocol support for Tokio //! //! [QUIC](https://en.wikipedia.org/wiki/QUIC) is a modern transport protocol addressing //! shortcomings of TCP, such as head-of-line blocking, poor security, slow handshakes, and //! inefficient congestion control. This crate provides a portable userspace implementati...
// 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 anyhow::Error; use futures::{ lock::{Mutex, MutexGuard, MutexLockFuture}, prelude::*, }; use rental::*; use std::collections::HashMap; use std:...
use rhai::{Dynamic, Engine, EvalAltResult, Module, Scope, AST}; use std::{ env, fs::File, io::{stdin, stdout, Read, Write}, path::Path, process::exit, }; /// Pretty-print error. fn print_error(input: &str, mut err: EvalAltResult) { let lines: Vec<_> = input.trim().split('\n').collect(); le...
use std::ffi::{CStr, CString}; use std::io::Cursor; use std::slice; use libc::c_char; use pgp::composed::{ Deserializable, KeyType, SecretKeyParamsBuilder, SignedSecretKey, SubkeyParamsBuilder, }; use pgp::crypto::{HashAlgorithm, SymmetricKeyAlgorithm}; use pgp::errors::Result; use pgp::ser::Serialize; use pgp::ty...
/* * Camunda BPM REST API * * OpenApi Spec for Camunda BPM REST API. * * The version of the OpenAPI document: 7.14.0 * * Generated by: https://openapi-generator.tech */ /// HistoricActivityInstanceQueryDto : A historic activity instance query which defines a group of historic activity instances #[derive(Cl...
// SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>> // SPDX-License-Identifier: Apache-2.0 #![cfg_attr(baremetal, no_main)] #![cfg_attr(baremetal, no_std)] #[cfg(baremetal)] #[macro_use] extern crate bitflags; #[macro_use] mod debug; #[cfg(all(test, not(baremetal)))] mod test; mod arch; #[macro_use] mod args; mod ir...
//! Paths and Unix shells //! //! MacOS, Linux, FreeBSD, and many other OS model their design on Unix, //! so handling them is relatively consistent. But only relatively. //! POSIX postdates Unix by 20 years, and each "Unix-like" shell develops //! unique quirks over time. //! //! //! Windowing Managers, Desktop Enviro...
//! This module implements lexing for operators (+, - etc.) used in the JavaScript programing language. use crate::syntax::{ ast::{Position, Punctuator, Span}, lexer::{Cursor, Error, Token, TokenKind, Tokenizer}, }; use boa_interner::Interner; use boa_profiler::Profiler; use std::io::Read; /// `vop` tests the...
use super::*; use crate::common::*; pub trait ModuleEx { fn name(&self) -> Option<&ModuleName>; fn input_paths(&self) -> ModuleInput<'_>; fn output_shape(&self, input_shape: ShapeInput<'_>) -> Option<ShapeOutput>; } #[derive(Debug, Clone, PartialEq, Eq, Hash, AsRefStr, Serialize, Deserialize)] #[serde(tag...
use crate::key_scanner::{KeyScanner, SCAN_SIZE}; use core::convert::Infallible; use embedded_hal::digital::v2::{InputPin, OutputPin}; use stm32l4xx_hal::gpio; type R1 = gpio::gpiob::PB10<gpio::Output<gpio::PushPull>>; type R2 = gpio::gpiob::PB9<gpio::Output<gpio::PushPull>>; type R3 = gpio::gpiob::PB8<gpio::Output<gpi...
extern crate clap; extern crate futures; extern crate hex; extern crate redis; use std::time::Duration; use std::collections::HashMap; use std::collections::HashSet; use std::fs::File; use std::io::{prelude::*, BufReader}; use async_std::future; use std::cell::RefCell; use std::rc::Rc; use clap::{App, Arg}; use r...
use std::sync::{mpsc, Arc, Mutex}; use std::thread; use std::time; use controller::Controller; use memory::{ReadAddr, WriteAddr}; // Loop 100 times a second. const LOOP_SLEEP: time::Duration = time::Duration::from_millis(10); pub const BUTTON_A: u8 = 1u8; pub const BUTTON_B: u8 = 2u8; pub const BUTTON_SELECT: u8 = 4...
// 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::audio::types::{AudioSettingSource, AudioStream, AudioStreamType}, crate::base::{SettingInfo, SettingType}, crate::fidl_common::Fid...
use self::super::super::super::isa::{GeneralPurposeRegisterBank, GeneralPurposeRegister, SpecialPurposeRegister}; use self::super::super::super::micro::{MicroOpPerformError, MicroOpBlock, MicroOp, NEXT_INSTRUCTION}; use arraydeque::{ArrayDeque, Wrapping as ArrayDequeBehaviourWrapping}; use self::super::super::super::is...
#![allow(unused)] pub struct Solution {} use crate::util::linked_list::{to_list, ListNode}; // Definition for singly-linked list. // #[derive(PartialEq, Eq, Clone, Debug)] // pub struct ListNode { // pub val: i32, // pub next: Option<Box<ListNode>> // } // // // impl ListNode { // #[inline] // fn new(val: i32)...
use std::fmt; use std::ops::Deref; use std::sync::Arc; use pretty::{Doc, DocAllocator, DocBuilder}; use symbol::SymbolRef; use types::{ToDoc, Walker}; /// Trait for values which contains kinded values which can be referred by name pub trait KindEnv { /// Returns the kind of the type `type_name` fn find_kind(...
// === The folowing functions aren't necessarily cryptographically secure! #[cfg(any(feature = "test-utils", test))] use rand::{rngs::OsRng, RngCore}; #[cfg(any(feature = "test-utils", test))] pub fn random_u32() -> u32 { OsRng.next_u32() } #[cfg(any(feature = "test-utils", test))] pub fn random_u64() -> u64 { ...
use std::mem; use std::ffi; use std::str; use std::ffi::CString; // Setup linking for all targets. #[cfg(target_os="macos")] mod mac { #[cfg(mac_framework)] #[link(name="SDL", kind="framework")] extern {} #[cfg(not(mac_framework))] #[link(name="SDL")] extern {} } #[cfg(not(target_os="macos"))...
use crate::drawing::backend::{BackendCoord, DrawingBackend, DrawingErrorKind}; use crate::style::{Color, RGBAColor}; use image::{ImageError, Rgb, RgbImage}; use std::path::Path; #[cfg(feature = "gif")] mod gif_support { use super::*; use gif::{Encoder as GifEncoder, Frame as GifFrame, Repeat, SetParameter}; ...
//! A syntax extension for custom subroutines //! //! # Example: //! //! Subroutine call: //! //! ``` //! @call(name, arg1, arg2) //! ``` //! //! FIXME: Maybe use @name(arg1, arg2) instead? //! //! Subroutine definition: //! //! ``` //! @start(name, argc) //! ... //! @end() //! ``` use std::borr...
use std::sync::Arc; use crate::{ array::{Array, StructArray}, bitmap::MutableBitmap, }; use super::{ make_growable, utils::{build_extend_null_bits, ExtendNullBits}, Growable, }; /// A growable PrimitiveArray pub struct GrowableStruct<'a> { arrays: Vec<&'a StructArray>, validity: MutableBi...
use chrono::{DateTime, SecondsFormat, Utc}; use crate::context::TelemetryContext; use crate::contracts::{SeverityLevel as ContractsSeverityLevel, *}; use crate::telemetry::{ContextTags, Measurements, Properties, Telemetry}; use crate::time; /// Represents printf-like trace statements that can be text searched. A trac...
use intcode::emulator::{Program, IntcodeEmulator, Context, Word}; use std::collections::{VecDeque, HashMap}; use std::cell::{RefCell, Cell}; use std::rc::Rc; const ADDR_ZERO: usize = 0x00; const ADDR_NAT: usize = 0xFF; const N_COMPUTERS: usize = 50; fn main() { let program = Program::from_file("input.txt").expect...
// Copyright 2021 - <NAME> <<EMAIL>> // SPDX-License-Identifier: Apache-2.0 use crate::client::mix_traffic::BatchMixMessageSender; use crate::client::topology_control::TopologyAccessor; use futures::task::{Context, Poll}; use futures::{Future, Stream, StreamExt}; use log::*; use nymsphinx::acknowledgements::AckKey; us...
use crate::{ graph::{ Add, Byte, Gamma, InputParam, InputPort, Int, Mul, Node, NodeExt, NodeId, Rvsdg, Theta, }, ir::Const, passes::{ utils::{BinaryOp, ChangeReport, Changes, ConstantStore}, Pass, }, utils::HashSet, values::{Cell, Ptr}, }; /// Fuses chained additions...
// Copyright 2021 <NAME>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
// The Computer Language Benchmarks Game // https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ // // contributed by the Rust Project Developers // contributed by TeXitoi // modified by hanabi1224 to use numeric_array, remove borrow checker hack, do not derive copy, more compile time calculation use generic_a...
use crate::assets::Assets; use crate::{ Canvas, Color, GfxCtx, HorizontalAlignment, Line, Prerender, ScreenDims, Text, UserInput, VerticalAlignment, }; use abstutil::{elapsed_seconds, Timer, TimerSink}; use geom::Angle; use glium::texture::{RawImage2d, Texture2dArray}; use std::collections::BTreeMap; use std::c...
use config::{Config, ConfigError, File}; use dirs_next::home_dir; use once_cell::sync::OnceCell; use serde::Deserialize; use std::{env, fs, path::PathBuf}; const CONFIG_FILE_NAMES: [&str; 2] = ["config.yml", "config.yaml"]; #[derive(Debug, Deserialize, Clone)] pub struct ColorSettings { pub dir_name: String, ...
use actix_web::{web, HttpRequest, HttpResponse}; use meilisearch_error::ResponseError; use meilisearch_lib::tasks::task::{TaskContent, TaskEvent, TaskId}; use meilisearch_lib::tasks::TaskFilter; use meilisearch_lib::{IndexUid, MeiliSearch}; use serde::Deserialize; use serde_cs::vec::CS; use serde_json::json; use crate...
//! Support functions for system calls that involve file descriptors. use crate::{ arena::{Arena, ArenaObject, ArrayArena, ArrayEntry, Rc}, fs::RcInode, kernel::kernel, param::{BSIZE, MAXOPBLOCKS, NFILE}, pipe::AllocatedPipe, proc::{myproc, Proc}, spinlock::Spinlock, stat::Stat, vm:...
// Copyright The pipewire-rs Contributors. // SPDX-License-Identifier: MIT use anyhow::Result; use pipewire as pw; use signal::Signal; use std::{cell::RefCell, collections::HashMap}; use std::{rc::Rc, sync::Arc}; use structopt::StructOpt; use pw::link::Link; use pw::metadata::Metadata; use pw::node::Node; use pw::por...
pub type c_char = u8; pub type c_long = i64; pub type c_ulong = u64; pub type wchar_t = u32; pub type time_t = i64; pub type suseconds_t = i64; pub type register_t = i64; // should be pub(crate), but that requires Rust 1.18.0 cfg_if! { if #[cfg(libc_const_size_of)] { #[doc(hidden)] pub const _ALIGN...
use std::fmt; use crate::Span; #[derive(Debug, Clone, Copy, PartialEq, Default)] pub struct Token { pub kind: TokenKind, pub span: Span, } #[derive(Debug, Clone, Copy, PartialEq)] pub enum TokenKind { LParen, RParen, LBrace, RBrace, LBracket, RBracket, Dot, // . Comma, //...
//! A small rust program that sets all nannou crates within the workspace to the specified version. //! //! Does the following: //! //! - Find all crates via the cargo workspace toml. //! - Sets the version number for each of the `nannou*` packages and updates each of their //! respective `nannou*` dependencies. //! ...
use crate::error::Error; use crate::types::{ PropertyDependency, PropertyName, PropertyNameKind, PropertySpec, PropertyValueSpec, }; use crate::validation::ValidationResult; use semver::Version; use std::collections::HashMap; /// Automatically retrieve and validate config properties from the property spec that: //...
use candid::{CandidType, Deserialize}; use dfn_core::api::{call, CanisterId}; use num::{rational::Ratio, BigInt}; use serde::Serialize; use std::fmt; use std::fmt::Formatter; use ic_base_types::PrincipalId; use ic_ic00_types::{CanisterIdRecord, CanisterStatusResultV2, IC_00}; pub mod ledger; pub mod stable_mem_utils...
#![deny(missing_docs, unsafe_code)] //! Generate bindings for Ethereum smart contracts. Internally, the generated //! types use `web3` crate to interact with the Ethereum network and uses a //! custom [`Instance`](ethcontract::contract::Instance) runtime that can be //! used directly without code generation. //! //! T...
#![feature(test)] extern crate test; #[macro_use] extern crate lazy_static; lazy_static! { static ref INPUT: SeatingSystem = include_str!("../input").parse().expect("invalid input"); } #[derive(PartialEq, Clone, Copy)] enum PositionType { Floor, EmptySeat, OccupiedSeat, } #[derive(PartialEq, Clone)]...
use std::net::{self, ToSocketAddrs}; use std::path::PathBuf; use std::str::FromStr; use node::PeerId; use radicle_org_node as node; use argh::FromArgs; use shared::{identity, LogFmt}; /// Radicle Org Node. #[derive(FromArgs)] pub struct Options { /// listen on the following address for peer messages (default: ...
use num_integer::Integer; fn wrapping_pow(mut base: u64, mut exp: u32) -> u64 { let mut acc: u64 = 1; while exp > 0 { if exp % 2 == 1 { acc = acc.wrapping_mul(base) } base = base.wrapping_mul(base); exp /= 2; } acc } /// Returns integers `(y, k)` such that `...
//! see [`nearest_common_dominator`] use super::ix_bit_set::{IndexLike, IxBitSet}; use super::NonEmptyPath; use petgraph::visit::{EdgeRef, GraphBase, IntoEdgesDirected}; use petgraph::Incoming; /// Finds the nearest common dominator of a set of nodes. /// /// A *common dominator* of a set of nodes is a node that domi...
use std::sync::{Weak, Arc}; use std::mem; use std::collections::VecDeque; use ondrop::OnDrop; use itertools::Itertools; use crate::take_cell::TakeCell; use std::marker::Unsize; const MAX_FACTOR: f64 = 0.5; pub struct WeakVec<T: ?Sized> { vec: Vec<Weak<T>>, potential: usize, } impl<T: ?Sized> WeakVec<T> { ...
use super::menu; use super::scenes::*; use cfg_if::cfg_if; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{Document, Element, HtmlAnchorElement, HtmlElement}; use awsm_web::webgl::WebGlVersion; // Called by our JS entry point to run the example. pub fn start_router(window: web_sys::Window, documen...
// Copyright (c) 2015 [rust-rcon 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 co...
// Copyright 2019 The Starlark in Rust Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable la...
use timely::order::TotalOrder; use timely::dataflow::*; use timely::dataflow::operators::probe::Handle as ProbeHandle; use differential_dataflow::operators::*; use differential_dataflow::difference::DiffPair; use differential_dataflow::lattice::Lattice; use {Arrangements, Experiment, Collections}; use ::types::create...
use crate::{ consts::package::{LABEL, UNKNOWN}, error::Error, rancher, util, }; use anyhow::Result; use bollard::{ container::ListContainersOptions, errors::Error::{DockerResponseNotFoundError, DockerResponseNotModifiedError}, image::{CreateImageOptions, ListImagesOptions}, models::{Containe...
use anyhow::{Result,anyhow}; use async_stream::stream; use futures_core::stream::Stream; use log::{debug,error,warn}; use std::collections::HashMap; use tokio::sync::mpsc::{Sender,Receiver, channel}; use tonic::Request; use uuid::Uuid; use super::handler_registry::TheHandlerRegistry; use crate::axon_server::{FlowContro...
mod assembly; #[macro_use] mod macros; #[cfg(test)] mod test; use std::collections::HashMap; use std::io; use std::path::{Path, PathBuf}; use std::sync::mpsc::{channel, Receiver}; use std::time::Duration; use failure::Error; use mun_abi::{FunctionInfo, Reflection}; use notify::{DebouncedEvent, RecommendedWatcher, Re...
mod goat; use bevy::prelude::*; use bevy::render::{ mesh::{Indices, Mesh, VertexAttributeValues}, pipeline::PrimitiveTopology, }; use bevy_mod_picking::*; use goat::*; use std::sync::Mutex; struct SelectedGoatParent { maybe_parent: Option<GoatEntity>, } struct GoatEntity { goat: Mutex<Goat>, } fn ma...
use dpu_cluster_core::config::ClusterConfiguration; use dpu_cluster_core::cluster::Cluster; use dpu_cluster_core::program::Program; use dpu_cluster_core::error::ClusterError; use dpu_cluster_core::pipeline::PipelineError; use std::io; use dpu_cluster_core::pipeline::plan::Plan; use std::sync::mpsc::channel; use dpu_clu...
use crate::{ app::StatusOr, audio::{ AudioPlayer, Sound }, control::{ Controller, ControllerId, ControlEvent, ControllerEvent, IdentifiedController, }, dimensions::{ Attack, time::DeltaTime }, file::{ ConfigW...
// Copyright 2019 The Exonum Team // // 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 i...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::{ensure, format_err, Context as _, Result}; use libra_config::config::RoleType; use libra_crypto::x25519; use libra_logger::prelude::*; use libra_network_address::NetworkAddress; use libra_types::{ account_config, a...
/*! Rectangle Functions */ use std::mem; use libc::c_int; /// A structure that defines a two dimensional point. #[deriving(PartialEq, Clone, Show)] #[repr(C)] pub struct Point { pub x: i32, pub y: i32 } /// A structure that defines a rectangle, with the origin at the upper left. #[deriving(PartialEq, Clone,...
#[derive(Debug, Copy, Clone, PartialEq, Eq)] enum OperatorType { Sum, Product, Minimum, Maximum, GreaterThan, LessThan, Equal, } impl From<usize> for OperatorType { fn from(input: usize) -> Self { match input { 0 => Self::Sum, 1 => Self::Product, ...
use super::Aura; use codec::{Decode, Encode}; use frame_support::{ decl_event, decl_module, decl_storage, dispatch::{DispatchResult, Vec}, ensure, }; use sp_core::{H256, H512}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sp_core::sr25519::{Public, Signature}; use sp_runtime::traits::{B...
#![feature( format_args_capture, async_closure, map_first_last, box_patterns, )] #![feature(error_iter)] #![allow(type_alias_bounds)] #![deny(warnings)] #[macro_use] extern crate log; #[macro_use] extern crate anyhow; #[macro_use] extern crate diesel; #[macro_use] extern crate diesel_migrations; //...
use num_traits::{Bounded, Num, NumCast}; /// Primitive trait from old stdlib pub trait Primitive: Copy + NumCast + Num + PartialOrd<Self> + Clone + Bounded {} impl Primitive for usize {} impl Primitive for u8 {} impl Primitive for u16 {} impl Primitive for u32 {} impl Primitive for u64 {} impl Primitive for isize {} ...
use std::fs; use std::io; use std::io::{Write,Read}; use std::path::{PathBuf}; use std::process::Command; use std::env::{set_current_dir}; #[macro_use] extern crate json; extern crate git2; struct Config { class_name: String, master_repo: String, description: String } struct Student { name: String, ...
// Copyright 2020 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 2021 Twitter, Inc. // Licensed under the Apache License, Version 2.0 // http://www.apache.org/licenses/LICENSE-2.0 use crate::config_file::*; use rand::rngs::SmallRng; use rand::Rng; use rand_distr::Alphanumeric; use rand_distr::{Distribution, WeightedAliasIndex}; use std::net::SocketAddr; pub const NAME...
#[macro_use] extern crate clap; mod action; mod hint; mod notification; mod notifications; mod replace_file; mod urgency; use crate::action::Action; use crate::hint::Hint; use crate::notification::Notification; use crate::notifications::{ OrgFreedesktopNotifications, OrgFreedesktopNotificationsActionInvoked, ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Flash access control register"] pub acr: ACR, #[doc = "0x04 - Flash key register"] pub keyr: KEYR, #[doc = "0x08 - Flash option key register"] pub optkeyr: OPTKEYR, #[doc = "0x0c - Flash status register"] pu...
// Helper module offering functionality assisting proposal handling registries in proposing transferral of subjects. use std::cmp::Eq; use std::cmp::Ord; use std::cmp::Ordering; use std::cmp::PartialOrd; #[derive(Eq, Debug)] /// An offer provided after a subject proposes to be a member of a given group. pub(in crate::...
// Copyright 2020 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or di...
use crate::rc_ref::RcRef; use crate::vm::value::Value; use crate::vm::value::Undefined; use crate::vm::value::String; use std::fmt; use std::rc::{ Rc, }; use std::cell::{ Cell, Ref, RefMut, RefCell, }; // Well-Known Symbols: https://www.ecma-international.org/ecma-262/9.0/#sec-well-known-symbols // pub const SYMBOLS:...
//! Utilities to parse and process substrate metadata. Can also be enabled in //! `gekko` with the `"metadata"` feature. //! //! # Example //! //! ```no_run //! use gekko_metadata::*; //! //! // Parse runtime metadata //! let content = std::fs::read_to_string("metadata_kusama_9080.hex").unwrap(); //! let data = parse_h...
//! Abstracts architecture details. //! //! The job of this module is to have submodules for each architecture and to //! provide interfaces to them. use core::time::Duration; use crate::memory::address_space::AddressSpace; use crate::memory::{MemoryArea, PageFlags, PhysicalAddress, VirtualAddress}; use crate::multita...
use crate::error::IppError; use crate::result::IppResult; use anyhow; use async_trait::async_trait; use futures::stream::TryStreamExt; use hyper::service::{make_service_fn, service_fn}; use hyper::Method; use hyper::{Body, Request, Response, Server}; use ipp::attribute::IppAttribute; use ipp::model::{DelimiterTag, IppV...