text
stringlengths
3.09k
13.9k
/// /// Implements the force-directed graph layout algorithm as /// proposed by Fruchterman and Reingold [1]. /// /// [1]: http://emr.cs.iit.edu/~reingold/force-directed.pdf /// use super::{P2d, Vector}; // k_s == l #[inline] fn attractive_force<V>(p1: &V, p2: &V, k_s: f32) -> V where V: Vector<Scalar = f32> { ...
use derive_more::From; use futures_util::future::FutureExt; use futures_util::select; use futures_util::stream::StreamExt; use rumq_core::{connack, MqttRead, MqttWrite, Packet, Connect, ConnectReturnCode}; use tokio::sync::mpsc::{channel, Receiver, Sender}; use tokio::sync::mpsc::error::TrySendError; use tokio::stream:...
//! SC:R shader replacing code. Debug builds are compiled to support hot reloading //! of shaders, release builds always just serve precompiled binary data. use super::scr; #[cfg(debug_assertions)] use std::path::{Path, PathBuf}; #[cfg(debug_assertions)] use std::time::{Duration, Instant, SystemTime}; #[cfg(debug_ass...
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; use rocket::{ State, http::Status, response::Redirect, form::{Context, Contextual, Form, FromForm}, }; use rocket_dyn_templates::Template; use serde::{Deserialize, Serialize}; #[derive(Debug, FromForm, Serialize, Deseria...
use std::collections::HashMap; use std::io::Read; use std::mem::transmute; use failure::Error; use crate::schema::{FullSchema, Schema, SchemaTypes, UnionRef}; use crate::types::Value; use crate::util::{safe_len, zag_i32, zag_i64, DecodeError}; #[inline] fn decode_long<R: Read>(reader: &mut R) -> Result<Value, Error>...
// 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::{ common::{App, CheckOptions, CheckTiming, ProtocolState, UpdateCheckSchedule}, installer::Plan, request_builder::RequestParams, ...
// Add these into our namespace use serde_json::Value; use std::collections::HashMap; use std::io::Read; use std::io::Write; use std::str::FromStr; use structopt::StructOpt; /// A basic example #[derive(StructOpt, Debug)] #[structopt(name = "basic")] struct Opt { #[structopt()] subcommand: Subcommand, #[st...
use automerge_backend::{ActorID, AutomergeError, Backend, Change, ChangeRequest, Clock}; use serde::de::DeserializeOwned; use serde::Serialize; use wasm_bindgen::prelude::*; extern crate web_sys; #[allow(unused_macros)] macro_rules! log { ( $( $t:tt )* ) => { // web_sys::console::log_1(&format!( $( ...
#![allow(bad_style)] //! Provides a proc-macro for making utf-16 literals. //! //! ```rust //! use utf16_lit::{utf16, utf16_null}; //! //! const EXAMPLE: &[u16] = utf16!("example"); //! //! const EXAMPLE_NULL: &[u16] = utf16_null!("example"); //! //! fn main() { //! let v: Vec<u16> = "example".encode_utf16().collect...
use { Align, Backend, Color, Colorable, Dimension, FontSize, Frameable, FramedRectangle, IndexSlot, Labelable, Positionable, Scalar, Sizeable, Text, TextWrap, Ui, }; use widget::{self, Widget}; /// A simple title bar widget that automatically sizes itsel...
use crate::prelude::*; use rand::{distributions::Distribution, Rng}; /// A linear transformation of the form `xW + b`, where `W` is a matrix, `x` is a vector or matrix, /// and `b` is a vector. If `x` is a matrix this does matrix multiplication. /// /// Implements [Module] for both vectors of size `[I]` and batches of...
use std::collections::VecDeque; use std::net::TcpListener; use crate::config::{Config, WorldGenCfg}; use crate::packets; use crate::Player; use crate::World; pub enum Queue { SpawnPlayer(i8), DespawnPlayer(i8), ChatMessage(String), SetBlock { coords: (i16, i16, i16), block_type: u8, ...
extern crate petgraph; use std::collections::HashSet; use petgraph::{ GraphMap, Dfs, }; use petgraph::visit::{ DfsIter, }; use petgraph::algo::{ dijkstra, }; use petgraph::dot::{Dot, Config}; #[test] fn simple() { //let root = TypedArena::<Node<_>>::new(); let mut gr = GraphMap::new(); ...
use super::program::Program; use super::protocol::{Message, MessageType}; use eui48::MacAddress; use serde::{Deserialize, Serialize, Serializer}; use std::collections::HashMap; use std::net::{SocketAddr, UdpSocket}; use std::sync::{Arc, Mutex}; use std::time::Instant; #[derive(Serialize, Deserialize, Debug, Clone)] pu...
use saphir::*; use saphir::Method; use serde_urlencoded::from_str; use std::net::SocketAddr; use std::str::FromStr; use crate::models::RepositoryCollection; use crate::models::Repository; use crate::models::ip::Ip; use mongodb::coll::options::FindOptions; pub struct LookupController { dispatch: ControllerDispatch<...
//! Implementation of univariate polynomial arithmetic use num_bigint::BigUint; use num_traits::identities::{One, Zero}; use crate::util::{modinv, one, zero}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Polynomial<'a> { pub(crate) coeffs: Vec<BigUint>, pub(crate) modulus: &'a BigUint, } impl<'a> Polyn...
use alloc::boxed::Box; use alloc::vec::Vec; use core::ffi::c_void; use core::{fmt, ptr}; /// An object that can one can write UTF-8 strings to /// /// This allows the C API to write to arbitrary kinds of objects, for example a /// C++ std::string or a char buffer. /// /// The way to use this object is to fill out the ...
use std::convert::TryInto; use std::error::Error; use std::io::{Read, Write}; use std::os::unix::net::UnixStream; use std::sync::Mutex; use base64::{decode, encode}; use crypto_box::{aead::Aead, generate_nonce, PublicKey, SecretKey}; use directories::BaseDirs; use json::{object, JsonValue}; use lazy_static::lazy_stati...
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause #![cfg(feature = "remote_endpoint")] use std::any::Any; use std::result; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::sync::Arc; use std::thread; use std::time::Durat...
use std::mem::{self, ManuallyDrop, MaybeUninit}; #[inline(always)] pub fn generate<T, F, const N: usize>(mut fun: F) -> [T; N] where F: FnMut(usize) -> T, { // SAFETY: assume_init is safe since we convert "MaybeUninit<[T; N]>" to "[MaybeUninit<T>; N]" let mut output = unsafe { MaybeUninit::<[MaybeUninit<T>...
// Copyright (c) 2022, Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 use crate::authority::AuthorityState; use bytes::Bytes; use std::cmp::Ordering; use std::net::SocketAddr; use std::sync::atomic::Ordering as AtomicOrdering; use std::sync::Arc; use sui_network::transport; use sui_types::base_types::Sequenc...
/*! Crabzilla provides a _simple_ interface for running JavaScript modules alongside Rust code. # Example ``` use crabzilla::*; use std::io::stdin; #[import_fn(name="read", scope="Stdin")] fn read_from_stdin() -> Value { let mut buffer = String::new(); println!("Type your name: "); stdin().read_line(&mut b...
use std::collections::HashMap; fn main() { let input = include_str!("input.txt"); let answer = part_one(input).expect("no solution for part one"); println!("part 1: {}", answer); let answer = part_two(input).expect("no solution for part part_two"); println!("part 2: {}", answer); } #[derive(Debu...
use super::*; type IndentDocId = usize; /// 連結リストの先頭への参照のようなもの type IndentDocList = Option<IndentDocId>; type EmitId = usize; /// `Emit` からなる連結リストの先頭への参照のようなもの type EmitList = Option<EmitId>; /// 字下げ付きのドキュメント #[derive(Clone, Debug)] struct IndentDoc { doc: Doc, depth: usize, } /// 構築されるテキストの構成要素 #[derive(...
use adventofcode2021::{default_sub_command, parse_usize, CommandResult, Problem}; use clap::{value_t_or_exit, App, Arg, ArgMatches}; use nom::{ bytes::complete::take, character::complete::newline, combinator::map_parser, multi::{many0, separated_list0}, IResult, }; use std::collections::HashSet; use...
use std::collections::{HashMap, HashSet}; use std::str::FromStr; use std::sync::Arc; use bb8_postgres::tokio_postgres::{types::Json, Client, GenericClient}; use openssl::hash::MessageDigest; use serde::{Deserialize, Serialize}; use tokio::sync::Mutex; use crate::cardpool::Cardpool; use crate::handlews::{AsyncSocks, A...
use std::collections::{HashMap, BTreeMap}; pub struct Version { pub value: String, pub dependencies: Vec<String>, pub timestamp: i64, } pub struct Item { versions: BTreeMap<i64, Version>, current: i64 } impl Item { pub fn new() -> Item { Item{ versions: BTreeMap::new(), current: 0 } ...
// Copyright (c) 2020 ESRLabs // // 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 agre...
mod parser; mod template; pub use self::template::Protocol; use self::{ parser::Tree, template::{Choice, Definition, DefinitionBody, Label, Role, Route, Type}, }; use heck::{CamelCase, SnakeCase}; use indexmap::IndexMap; use petgraph::{ graph::{node_index, NodeIndex}, visit::{EdgeRef, IntoNodeReferenc...
use crate::utilities::constants; use ggez::{ self, graphics::{self, Color, DrawMode, DrawParam, Mesh, Text}, nalgebra as na, Context, GameResult, }; pub fn draw_game_over_screen(context: &mut Context) -> GameResult { let mut game_over_text = Text::new(format!("Game Over!")); game_over_text.set_font...
use crate::hardware::ppu::Mode; use crate::hardware::ppu::memory_binds::{TILE_BLOCK_0_START, TILE_BLOCK_1_START}; use bitflags::*; // # PPU FLAGS # bitflags! { /// FF40 /// LCDC is a powerful tool: each bit controls a lot of behavior, /// and can be modified at any time during the frame. /// /// ...
use crate::ast::Span; use crate::compile; use crate::compile::{CompileVisitor, FileSourceLoader, NoopCompileVisitor, Options, SourceLoader}; use crate::runtime::Unit; use crate::{Context, Diagnostics, SourceId, Sources}; use thiserror::Error; /// Error raised when we failed to load sources. /// /// Look at the passed ...
use std::{env, ffi::OsStr, io::stdout, path::PathBuf}; use byteorder::{BigEndian, LittleEndian, WriteBytesExt}; use serde::{Deserialize, Serialize}; use sha1::Sha1; use sha2::Sha256; use std::io::{Error, Write}; use structopt::{clap, StructOpt}; use treblo::{hex::to_hex_string, walk, walk::Hasher}; use twox_hash::XxHa...
// Copyright 2017 Parity Technologies (UK) Ltd. // // 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, modify, mer...
use kernel::common::StaticRef; use kernel::common::registers::{self, ReadOnly, ReadWrite, WriteOnly, register_bitfields}; /// SSP0/1 #[repr(C)] struct SspRegisters { /// Control Register 0. Selects the serial clock rate, bus type, and data size. cr0: ReadWrite<u32, CR0::Register>, /// Control Register 1. Selects m...
use crypto::digest::Digest; use crypto::ripemd160::*; use crypto::sha2::Sha256; use hex; use jsonrpc_core::*; use rand; use rand::{OsRng, Rng}; use secp256k1::{constants, Message, PublicKey, Secp256k1, SecretKey, Signature}; use std::cmp::min; use std::result::Result; use tari_error::*; use tari_messages::*; pub fn ra...
// File: day_10.rs // Author: <NAME> // Date: December 2020 /* Copyright 2020 <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 t...
use std::borrow::Cow; use std::ffi::OsString; use std::io::{self, ErrorKind}; use std::path::{Component, Path, PathBuf, PrefixComponent}; use crate::{ParseDot, MAIN_SEPARATOR}; impl ParseDot for Path { #[inline] fn parse_dot(&self) -> io::Result<Cow<Path>> { let cwd = get_cwd!(); self.parse_d...
use std::io; //use std::collections::HashMap; //use std::collections::BinaryHeap; //use std::collections::HashSet; //use std::mem; // mem::swap(&mut x,&mut y); use std::cmp; // cmp::max,cmp::min // Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both #[allow(dead_code)] fn read_line() -> String{ let mut s = S...
use std::collections::HashMap; use crate::shader_cache::ShaderCache; use super::{frame_packet::{FramePacket, SpriteInstanceData}, Renderer, AtlasId, GpuAtlas}; pub struct SpriteOverlayRenderStage { pipeline: wgpu::RenderPipeline, texture_bind_group_layout: wgpu::BindGroupLayout, texture_bind_groups: HashM...
use super::{check_owns_village0, internal_server_error}; use crate::game_master::attack_funnel::PlannedAttack; use crate::game_master::event::Event; use crate::game_master::town_worker::TownWorkerEventMsg; use crate::{authentication::Authentication, game_master::story_worker::StoryWorkerMessage}; use actix::prelude::*;...
use { crate::{ cli::ProgramArgs, match_with_log, models::{ assets::{Headers, ReadFrom, Record}, error::ErrorKind, }, }, csv::ReaderBuilder, serde_json::{map::Map as JMap, value::Value as JsonValue}, serde_yaml::{Mapping as YMap, Value as YamlVa...
use std::marker::PhantomData; use Construct; use Data; use Count; use Of; use ToIndex; use ToPos; use Zero; /// Dimension is natural number, position is (a, b). /// Represents all directional pairs that has not same element for `a` and `b`. pub struct NeqPair<T = Data>(PhantomData<T>); impl<T> Construct for NeqPair<...
// Copyright 2022 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. //! The loopback device. use alloc::vec::Vec; use core::convert::Infallible as Never; use net_types::{ ip::{AddrSubnet, AddrSubnetEither, IpAddr, IpAd...
// Copyright 2021 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot 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) any late...
mod list; mod report; use crate::style::{content_visuals, side_visuals}; use crate::theme::Theme; use crate::widgets::CustomWidgets; use egui::{ Align, CentralPanel, CtxRef, Direction, Layout, SidePanel, Stroke, TopBottomPanel, Ui, Vec2, }; use report::TPSReport; use std::collections::HashMap; use tpscube_core::{ ...
use std::io::Write; use async_std::{fs::create_dir_all, net::TcpStream}; use http_types::{Method, Request, Url}; use resol_vbus::{chrono::Duration, Language, RecordingReader, Specification, SpecificationFile}; use tracing::debug; use tracing_subscriber::EnvFilter; #[derive(Debug)] struct Error(String); impl From<Stri...
/* diosix high-level hypervisor's locking primitives * * Provides a standard spin lock and a mutex * * The mutex is reentrant, which means when a physical * core holds a mutex and then tries to acquire it * again, this operation will succeed. * * this is so that, eg, if a core holds a mutex * and is interrup...
use super::{ffi, Connection, Error, Lesult, SqliteTypes, Value}; use std; use std::ffi::CStr; use std::os::raw::c_int; use Row; use Rows; #[derive(Debug)] pub struct Stmt<'con> { con: &'con Connection, pub stmt: *mut ffi::sqlite3_stmt, } impl<'con> Drop for Stmt<'con> { fn drop(&mut self) { let ...
extern crate regex; use std::io::{self, BufRead}; use regex::Regex; #[derive(Debug)] struct Pair { x: i32, y: i32, } impl Pair { pub fn new(x: i32, y: i32) -> Pair { Pair{ x, y } } } #[derive(Debug)] struct Data { pos: Pair, vel: Pair, } impl Data { pub fn new(px: i32, py: i32, vx...
use crate as airdrop; use airdrop::pallet::Config; use airdrop::pallet::Error; use codec::MaxEncodedLen; use core::convert::Into; use frame_support::pallet_prelude::*; use frame_support::traits::Currency; use frame_system; use scale_info::TypeInfo; use serde::Deserialize; use sp_core::H160; use sp_runtime::traits::Conv...
use crate::{camera::interface::ROIImage, Result}; use khygl::{render_texture::TextureRenderer, texture::Texture, Rect}; use std::sync::Arc; pub struct ImageDisplay { raw: Option<Arc<ROIImage>>, texture: Option<Texture<u16>>, displayer: TextureRenderer, pub scale_offset: (f32, f32), pub cross: bool,...
use bit_field::BitField; use std::collections::VecDeque; mod dmc; mod noise; mod pulse; mod triangle; mod units; use dmc::Dmc; use noise::Noise; use pulse::Pulse; use triangle::Triangle; use units::*; trait Channel { fn sample(&mut self) -> u8; fn tick(&mut self); fn tick_len(&mut self); fn tick_eve...
#![cfg_attr(not(feature = "std"), no_std)] pub use pallet::*; #[cfg(test)] mod mock; #[cfg(test)] mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; #[allow(clippy::unnecessary_cast)] pub mod weights; #[frame_support::pallet] pub mod pallet { pub use crate::weights::WeightInfo; use codec::Codec...
use num::ToPrimitive; use num::{Integer, Signed}; use simple_error::SimpleError; use std::str::FromStr; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Position { pub east: i64, pub north: i64, } impl Position { pub fn new(east: i64, north: i64) -> Self { Self { east, north } } pub fn...
use super::parser::{Expr, Literal}; extern crate im; /// Runtime expression, optimized for compactness and use in interpreter /// Now uses variables, but can be optimized to using indexes, offsets, etc. /// #[derive(Debug, PartialEq, Clone)] pub enum RunExpr { Ref(String), LetIn(String, Box<RunExpr>, Box<RunEx...
use std::path::Path; /// YOLO label. #[derive(Debug)] pub struct Label { pub label_index: i8, pub x_centre: f32, pub y_centre: f32, pub width: f32, pub height: f32, pub probability: Option<f32>, pub object_id: Option<i8>, } pub trait Unnormaliser { fn unnormalise(&self, dimensions: (u32, u32)) -> Self; } imp...
#![allow(dead_code, unused_imports)] extern crate libc; extern crate rand as random; extern crate rustc_serialize as serialize; mod cipher; use cipher::{Mode, zombify}; use std::ffi::{CStr, CString}; use std::fs::File; use std::io::Read; use std::sync::{Arc, mpsc}; use std::{str, slice, thread}; use libc::{size_t, c_...
use cotton::prelude::*; use super::Project; use serde_json::Value; #[derive(Debug, Clone, Copy)] pub enum CargoMode { Silent, Verbose, } #[derive(Debug, Clone, Copy)] pub enum CargoState { ScriptDiffers, NoBinary, BinaryOutdated, UpToDate, } impl CargoState { pub fn needs_update(&self) ->...
use std::{ collections::HashMap, convert::From, convert::TryFrom, io::{BufRead, BufWriter, Write}, }; use crate::sarif::{self, BuilderError}; use anyhow::Result; use cargo_metadata::{ self, diagnostic::{Diagnostic, DiagnosticLevel, DiagnosticSpan}, Message, }; use std::convert::TryInto; // TODO: refacto...
use crate::crypto::hash::H256; use crate::experiment::performance_counter::PERFORMANCE_COUNTER; use crate::transaction::{Address, CoinId, Output, Transaction}; use bincode::{deserialize, serialize}; use rocksdb::*; use std::collections::HashSet; pub struct UtxoDatabase { pub db: rocksdb::DB, // coin id to output }...
use super::super::pyobject::{ AttributeProtocol, PyContext, PyFuncArgs, PyObjectKind, PyObjectRef, PyResult, TypeProtocol, }; use super::super::vm::VirtualMachine; use super::objiter; use super::objsequence::{seq_equal, PySliceableSequence}; use super::objstr; use super::objtype; // set_item: pub fn set_item( ...
use std::fs::{metadata,remove_file,remove_dir_all,create_dir}; use std::str; use std::mem; use regex::Regex; use rand::prelude::*; use fxhash::FxHashSet; pub fn make_dir(dirname: &str) -> bool{ if metadata(&dirname).is_ok() == true { if metadata(&dirname).unwrap().is_file() == true { remove_fil...
use crate::client::AuthenticatedClient; use crate::errors::Result; use serde::{Deserialize, Serialize}; use std::collections::HashMap; #[derive(Debug, Serialize, Deserialize)] pub struct StationData { body: Body, status: String, time_exec: f64, time_server: u64, } #[derive(Debug, Serialize, Deserialize)] pub...
//! imgui compat module use ggez::graphics; use ggez::input::keyboard::{KeyCode, KeyMods}; use ggez::Context; use gfx_core::handle::RenderTargetView; use gfx_core::memory::Typed; use imgui::*; use imgui_gfx_renderer::*; use std::time::Instant; #[derive(Copy, Clone, PartialEq, Debug, Default)] struct MouseState { ...
use crate::errors::CircuitError; use crate::pipeline::*; use crate::types::Precision; use crate::Complex; use std::cmp::Ordering; use std::fmt; use std::rc::Rc; /// Possible relations to a parent Register #[derive(Debug)] pub enum Parent { /// A set of owned parents by a given Register, that Register has the union...
use hotspot::shared_types::{truncate_left, MetricsConfig, SpecificMetrics, FILE_GLOBS}; use term_table::TableStyle; extern crate globwalk; use self::globwalk::{DirEntry, GlobWalker, WalkError}; use rust_code_analysis::{ CppParser, FuncSpace, JavascriptParser, ParserTrait, PreprocParser, PythonParser, RustParser, ...
// Copyright 2021, 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 // di...
use indicatif::ProgressBar; use regex::Regex; use rusoto_core::Region; use rusoto_sqs::{ DeleteMessageBatchRequest, DeleteMessageBatchRequestEntry, GetQueueAttributesRequest, GetQueueUrlRequest, ReceiveMessageRequest, SendMessageBatchRequest, SendMessageBatchRequestEntry, Sqs, SqsCli...
use std::env; use std::fs; use std::io::prelude::*; use std::fs::File; use std::path::Path; extern crate toml; extern crate serde_derive; // error in rust compiler. Bugfix requested in Sept. 2017 // these are used, but the compiler is not seeing it for // some reason #[allow(unused_imports)] #[macro_use] extern cra...
use crate::Error; use pin_project::pin_project; use std::fmt; use std::{ future::Future, pin::Pin, task::{Context, Poll}, }; use tower::make::MakeService; use tower_service::Service; use tracing::trace; pub(crate) struct Reconnect<M, Target> where M: Service<Target>, M::Error: Into<Error>, { mk...
//! A codec for "quirky" length delimited encoding, as done by minidsp products. //! Most frames are encoded with a length prefix, but since the applications do not separate frames by length, they //! instead rely on the OS's packetization to feed a single frame in every read request. This works most of the time, //! b...
use tree_sitter::{Node, Parser, Tree}; use tree_sitter_python; pub struct FunctionCC { cnt: usize, } impl FunctionCC { pub fn count_cc(func_root: Node) -> usize { let mut cc = FunctionCC { cnt: 1 }; cc.travers(func_root); cc.cnt } fn travers(&mut self, node: Node) { for...
use std::borrow::Borrow; use hal::{ adapter::{Adapter, AdapterInfo, DeviceType, Gpu, MemoryProperties}, device::CreationError, format, image, queue::{QueueFamilyId, QueuePriority, QueueType}, Features, }; use wasm_bindgen_futures::JsFuture; mod command; mod device; mod window; pub use crate::com...
// compile-flags: -Zmiri-track-raw-pointers // ignore-windows (FIXME: tracking raw pointers does not work on Windows) #![feature(raw_ref_macros)] use std::ptr; // Test various stacked-borrows-related things. fn main() { read_does_not_invalidate1(); read_does_not_invalidate2(); mut_raw_then_mut_shr(); ...
// Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::{ backup_types::{ state_snapshot::{ backup::{StateSnapshotBackupController, StateSnapshotBackupOpt}, restore::{StateSnapshotRestoreController, StateSnapshotRestoreOpt}, }, transaction::{ ...
//! This file is modified from 'page_table.rs' in 'rust-osdev/bootloader' use x86_64::structures::paging::{ mapper::*, FrameAllocator, Mapper, Page, PageSize, PageTableFlags, PhysFrame, Size2MiB, Size4KiB, }; use x86_64::{align_up, PhysAddr, VirtAddr}; use xmas_elf::{program, ElfFile}; pub fn map_elf( elf...
#![allow(warnings)] use rt::{Execution, FnBox}; use rt::thread::Id as ThreadId; use std::collections::VecDeque; use std::fmt; use std::mem; use std::ptr; use std::sync::{Arc, Mutex, Condvar}; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::{Acquire, Release, Relaxed, SeqCst}; use std::thread; #[d...
extern crate alloc; /// [Intel 64 and IA-32 Architectures Software Developer's Manual, Vol. 3A](https://software.intel.com/en-us/articles/intel-sdm) /// /// # 17.2.3 Debug Status Register (DR6) /// /// The debug status register (DR6) reports debug conditions that were sampled at the time the last /// debug exception w...
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0. use crate::cpu::collector::{register_collector, Collector, CollectorHandle}; use crate::cpu::recorder::CpuRecords; use crate::Config; use std::fmt::{self, Display, Formatter}; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::SeqCst;...
// Copyright Materialize, Inc. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License...
// SPDX-FileCopyrightText: 2021 Lutris Engineering, Inc // SPDX-License-Identifier: BlueOak-1.0.0 OR BSD-2-Clause-Patent // SPDX-FileContributor: <NAME> <<EMAIL>> use std::fmt::Debug; use chrono::Utc; use crate::{ builtin_idents, serial::{ deserialize_tr, serialize_aevt, serialize_avet, serialize_eav...
//! Allows constructing Elasticsearch search query. //! //! Elasticsearch provides a full Query DSL (Domain Specific Language) based on JSON to define queries. Think of the Query DSL as an AST (Abstract Syntax Tree) of queries, consisting of two types of clauses: //! //! **Leaf query clauses** //! //! Leaf query clause...
extern crate clap; extern crate octocrab as github; extern crate question; extern crate reqwest; extern crate semver; extern crate serde; extern crate tokio; extern crate tokio_util; #[macro_use] extern crate lazy_static; extern crate url; mod error; mod release; mod version; pub use error::{ReleaserError, Result}; p...
//! Storage crate provides the interfaces to interact with the database. //! The backend database used in this crate is `Postgres`, and interaction //! with it is based on the `diesel` crate. //! //! The essential structure of this crate is the `StorageProcessor`, which //! holds down the connection to the database and...
#![no_std] #![allow(non_snake_case)] #![feature(proc_macro_hygiene)] use wasm_std::types::{U256, Address}; use wasm_mid; use lazy_static; use wasm2ct::types::*; use wasm2ct_derive::gen_contract; use wasm_std::{String}; use wasm2ct::types::{Stream,Sink}; use serde_json::{Result, Value}; use smallvec::{SmallVec, smallv...
use std::io::BufRead; use regex::{Captures, Regex}; #[derive(Debug)] enum Error { InvalidInput(String), InvalidNumber(std::num::ParseIntError) } impl From<std::num::ParseIntError> for Error { fn from(error: std::num::ParseIntError) -> Self { Error::InvalidNumber(error) } } enum ParserCommand...
use std::collections::HashMap; mod binary; mod spec; pub use binary::{parse_structure, view_structure, FieldKind, SeekRead}; pub use spec::{parse_spec, Span, SpecFile}; #[derive(Copy, Clone, Debug, PartialEq)] pub enum Order { LittleEndian, BigEndian, } #[derive(Copy, Clone, Debug, PartialEq)] pub enum Addr...
/// The widget subset used by an add-on. #[derive(Clone, PartialEq, ::prost::Message)] pub struct AddOnWidgetSet { /// The list of widgets used in an add-on. #[prost(enumeration = "add_on_widget_set::WidgetType", repeated, tag = "1")] pub used_widgets: ::prost::alloc::vec::Vec<i32>, } /// Nested message and...
use std::env; use std::io::BufReader; use std::io::BufRead; use std::io::Write; use std::fs::File; fn main() { let args: Vec<String> = env::args().collect(); let word_list_to_check_filename = &args[1]; let mut compound_safe_list_output = format!("{}.compound-safe", &word_list_to_check_filename); if arg...
use std::collections::HashMap; use std::convert::TryFrom; use std::fmt; use std::io; use crossbeam::channel::{Receiver, Sender}; use crossbeam::thread; use crate::computer::{Channel, ComputerMT, Rom}; use crate::error::Error; use crate::utils::Vec2; type Point = Vec2<i64>; pub fn run<R>(reader: R) -> Result<(String...
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
use std::net::SocketAddr; use std::net::{IpAddr, Ipv4Addr}; use std::str::FromStr; use trust_dns_client::client::{Client, SyncClient}; use trust_dns_client::op::DnsResponse; use trust_dns_client::rr::{DNSClass, Name, RData, Record, RecordType}; use trust_dns_client::udp::UdpClientConnection; struct NameServer { ad...
//! Leases are a mechanism for detecting client liveness. The cluster grants leases with a time-to-live. A lease expires if the etcd cluster does not receive a keepAlive within a given TTL period. //! //! # Examples //! //! Grant lease and keep lease alive //! //! ```no_run //! use std::time::Duration; //! //! use etcd...
//! Contains utilites for working with virtual (TUN) network interfaces. use crate::priv_prelude::*; use libc; use crate::iface::build::{IfaceBuilder, build}; /// This object can be used to set the configuration options for a `IpIface` before creating the /// `IpIface` /// using `build`. #[derive(Debug)] pub struct I...
use crate::{point::point_traits::*, Extent2i, Extent3i, ExtentN, Point2i, Point3i, PointN}; use std::convert::TryFrom; /// An extent for which, given some fixed power of 2 called P, satisfies: /// - each component of the minimum is a multiple of P /// - the shape is a cube with edge length P /// /// Equivalently, thi...
//! Running queries against BigQuery. use serde::{de::DeserializeOwned, Deserialize, Serialize}; use std::convert::TryFrom; use super::{ super::client::{percent_encode, Client}, jobs::{ run_job, CreateDisposition, Job, JobConfigurationQuery, Labels, TableReference, WriteDisposition, }, ...
use crate::prelude::*; use egui::RichText; use egui_node_graph::{ DataTypeTrait, NodeDataTrait, NodeId, NodeResponse, NodeTemplateIter, UserResponseTrait, WidgetValueTrait, }; use halfedge::selection::SelectionExpression; use serde::{Deserialize, Serialize}; //use self::node_templates::GraphNodeType; use self:...
use std::collections::HashMap; use std::sync::Mutex; use std::time::Duration; use futures::StreamExt; use rdkafka::consumer::{Consumer, DefaultConsumerContext, StreamConsumer}; use rdkafka::{ClientConfig, Message, Offset, TopicPartitionList}; use rlink::channel::utils::handover::Handover; use rlink::core::runtime::Job...
use std::io::{self, Write}; use byteorder::{LittleEndian, WriteBytesExt}; use noodles_bgzf as bgzf; use super::{ binning_index::ReferenceSequenceExt, index::{ reference_sequence::{bin::Chunk, Bin, Metadata}, ReferenceSequence, }, BinningIndex, Index, MAGIC_NUMBER, }; /// A CSI writer....