text
stringlengths
8
4.13M
use crate::Player; use game_camera::{CameraConfig, CameraMode, ScaledOrthographicProjection}; use game_input::ActionInput; use game_lib::{ bevy::{prelude::*, render::camera::Camera}, tracing::{self, instrument}, }; use game_physics::{JumpStatus, Velocity}; #[instrument(skip(config, input))] pub fn cycle_camera...
use scihub_scraper::SciHubScraper; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt(name = "basic")] struct Opt { #[structopt(short, long)] paper: String, } #[tokio::main] async fn main() { let opt = Opt::from_args(); println!("Fetching paper: {}", opt.paper); let mut scraper = S...
use crate::integer::Integer; use core::cmp::Ordering; macro_rules! impl_partial_eq { ($rhs:ty, $func:path) => { impl PartialEq<$rhs> for Integer { fn eq(&self, other: &$rhs) -> bool { $func(&self, other) == Ordering::Equal } } }; ($rhs:ty, $func:path,...
use crate::Instance; use std::rc::Rc; /// A publisher of messages. /// /// It can be used to route messages back to the [`Application`]. /// /// [`Application`]: trait.Application.html #[allow(missing_debug_implementations)] #[derive(Clone)] pub struct Bus<Message> { publish: Rc<Box<dyn Fn(Message, &mut dyn dodri...
#![allow(clippy::type_complexity)] use fuzzcheck::mutators::bool::BoolMutator; use fuzzcheck::mutators::boxed::BoxMutator; use fuzzcheck::mutators::option::OptionMutator; use fuzzcheck::mutators::recursive::{RecurToMutator, RecursiveMutator}; use fuzzcheck::{make_mutator, DefaultMutator, Mutator}; #[derive(Clone, Debu...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::_2_RIS { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &...
extern crate naive_gui; use naive_gui::{ Gui, Drawer, Widget::*, }; struct DrawContext { fill_rgba: (f32, f32, f32, f32), stroke_rgba: (f32, f32, f32, f32), font_size: f32, } impl DrawContext { fn new() -> Self{ DrawContext{ fill_rgba: (0., 0., 0., 1.), stroke...
pub use self::imp::*; #[cfg(all( regex_runtime_teddy_ssse3, target_arch = "x86_64", ))] mod imp; #[cfg(not(all( regex_runtime_teddy_ssse3, target_arch = "x86_64", )))] #[path = "fallback.rs"] mod imp;
//! Watchlists to detect clauses that became unit. //! //! Each (long) clause has always two watches pointing to it. The watches are kept in the watchlists //! of two different literals of the clause. Whenever the watches are moved to different literals //! the litereals of the clause are permuted so the watched litera...
extern crate nbt; use nbt::NBT; #[test] fn test_byte() { let data: ~str = ~"\x0a\x00\x04abcd\x01\x00\x04test\x01\x00"; let bytes = ~std::io::MemReader::new(data.into_bytes()); let mut parser = NBT::Parser::new(bytes as ~Reader); let root: ~NBT::NamedTag = parser.parse(); assert!(root.get_name() == ...
#[macro_use] extern crate slog; #[macro_use] extern crate clap; use clap::Arg; use daemonize::Daemonize; use sloggers::Config; use std::error::Error; use std::fs::File; use std::io::Read; use std::process::exit; use shaft::db::SqliteDatabase; use shaft::rest::{ format_pence_as_pounds_helper, register_servlets, A...
use std::os::unix::io::FromRawFd; use std::pin::Pin; use std::task::{Context, Poll}; use std::thread; use anyhow::Error; use bytes::{Buf, BytesMut}; use futures::Stream; use lazy_static::lazy_static; use libc::STDIN_FILENO; use log::*; use nix::sys::termios::{self, ControlFlags, InputFlags, LocalFlags, OutputFlags, Se...
//! Holds a stream that ensures chunks have the same (uniform) schema use std::{collections::HashMap, sync::Arc}; use snafu::Snafu; use std::task::{Context, Poll}; use arrow::{ array::new_null_array, datatypes::{DataType, SchemaRef}, record_batch::RecordBatch, }; use datafusion::physical_plan::{ metri...
use crate::enums::{Algorithm, CentersInit, Checks, LogLevel}; use crate::raw; use std::os::raw::c_long; const DEFAULT_REBUILD_THRESHOLD: f32 = 2.0; #[derive(Debug, Clone)] pub struct Parameters { pub algorithm: Algorithm, pub checks: Checks, pub eps: f32, pub sorted: i32, pub max_neighbors: i32, ...
use super::vm::Inst; use std::collections::BTreeMap; #[derive(Debug, Clone)] pub struct Block { pub code: Vec<Inst::Code>, pub start: usize, pub kind: BrKind, pub generated: bool, } #[derive(Clone, Debug, PartialEq)] pub enum BrKind { ConditionalJmp { destinations: Vec<usize> }, UnconditionalJ...
#[doc = "Reader of register PLLFREQ0"] pub type R = crate::R<u32, super::PLLFREQ0>; #[doc = "Writer for register PLLFREQ0"] pub type W = crate::W<u32, super::PLLFREQ0>; #[doc = "Register PLLFREQ0 `reset()`'s with value 0"] impl crate::ResetValue for super::PLLFREQ0 { type Type = u32; #[inline(always)] fn re...
use futures::{future::BoxFuture, prelude::*, ready}; use log::*; use std::{ collections::hash_map::DefaultHasher, hash::{Hash, Hasher}, ops::DerefMut, pin::Pin, sync::{Arc, RwLock}, task::{Context, Poll}, }; use tokio::{ runtime::Builder, sync::{mpsc, oneshot}, task::JoinHandle, ...
use super::state_prelude::*; #[derive(Default)] pub struct Startup; impl<'a, 'b> State<CustomGameData<'a, 'b, CustomData>, StateEvent> for Startup { fn on_start(&mut self, data: StateData<CustomGameData<CustomData>>) { insert_resources(data.world); initialize_music(data.world); initialize_...
tonic::include_proto!("youlearn.headpose.v1");
use std::borrow::Cow; use rust_embed::RustEmbed; #[derive(RustEmbed)] #[folder = "assets"] struct AssetImpl; /// The RustEmbed wrapper for completion. pub struct Asset; impl Asset { pub fn get(file_path: &str) -> Option<Cow<'static, [u8]>> { AssetImpl::get(file_path) } pub fn iter() -> impl Ite...
use std::collections::HashMap; use std::fmt::Debug; use std::marker::PhantomData; use cgmath::prelude::*; use cgmath::BaseFloat; use collision::dbvt::{DynamicBoundingVolumeTree, TreeValue}; use collision::prelude::*; use specs::prelude::{ BitSet, Component, ComponentEvent, Entities, Entity, Join, ReadStorage, Read...
use super::*; /// All COM interfaces (and thus WinRT classes and interfaces) implement /// [IUnknown](https://docs.microsoft.com/en-us/windows/win32/api/unknwn/nn-unknwn-iunknown) /// under the hood to provide reference-counted lifetime management as well as the ability /// to query for additional interfaces that the ...
use num::Num; use std::ops::{BitAnd, BitOr, Not}; pub trait FlagSet<T>: std::default::Default where T: Clone + Num + BitAnd<Output = T> + BitOr<Output = T> + Not<Output = T>, { fn value(&self) -> T; fn new() -> Self { Self::default() } fn from(v: T) -> Self { let mut f = Self::def...
use std::convert::TryFrom; use blake2b_simd::{Params as Blake2bParams, State as Blake2b}; use blake2s_simd::{Params as Blake2sParams, State as Blake2s}; use digest::Digest; use crate::digests::{wrap, Multihash, MultihashDigest, Multihasher}; use crate::errors::DecodeError; #[doc(hidden)] #[macro_export(local_inner_m...
//! Types and operators to work with external data sources. use std::cell::RefCell; use std::rc::{Rc, Weak}; use std::time::{Duration, Instant}; use timely::dataflow::operators::capture::event::link::EventLink; use timely::dataflow::{ProbeHandle, Scope, Stream}; use timely::logging::TimelyEvent; use timely::progress:...
//! The component module provides all the different components available. A //! Component allows querying different kinds of information from a Timer. This //! information is provided as state objects in a way that can easily be //! visualized by any kind of User Interface. pub mod blank_space; pub mod current_compari...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::term::prelude::Term; use crate::erlang::is_record; #[native_implemented::function(erlang:is_record/3)] pub fn result(term: Term, record_tag: Term, size: Term) -> exception::Result<Term> { is_re...
use std::io; #[derive(Clone, PartialEq)] enum Seat { Floor, Empty, Occupied, } fn read_seats() -> (Vec<Seat>, i32, i32) { let mut seats = Vec::new(); let mut width = 0; let mut height = 0; loop { let mut line = String::new(); match io::stdin().read_line(&mut line) { ...
fn main() { for x in vec![1, 2, 3].into_iter().map(|y| y + 1) { println!("{}", x); } }
// Copyright 2018 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. #[cfg(test)] macro_rules! assert_match { ($actual:expr, $expected:pat) => { match $actual { $expected => {} _ => panic!...
use std::fs::File; use std::io::{Error, Read, Write}; use std::path::Path; /* NOTE: Remove any bricks and also the fuse mountpoint from updatedb */ // Ported from host.py in charmhelpers.core.host pub fn add_to_prunepath(path: &String, updatedb_path: &Path) -> Result<(), Error> { let mut f = File::open(updatedb_...
use crate::data::schema::{Allocation, Resource, Route, SchemaData}; use crate::engine::constants::*; use crate::engine::travel::{distance_between_points, distance_in_time}; use std::collections::HashMap; pub fn calculate_plan_value(sd: &SchemaData) -> (f64, f64, f64) { let mut sum: f64 = 0.0; let mut value: f6...
/* * Author: Dave Eddy <dave@daveeddy.com> * Date: January 25, 2022 * License: MIT */ /*! * A rust port of `vsv` * * Original: <https://github.com/bahamas10/vsv> */ #![allow(clippy::uninlined_format_args)] use anyhow::{Context, Result}; use yansi::{Color, Paint}; mod arguments; mod commands; mod config; mod...
//! This example uses no board support crate yet, but is the developer's base line for testing, //! derived from the cortex-m-quickstart examples. //! //! It does nothing, just idles in an infinite loop. #![no_main] #![no_std] #![feature(lang_items)] #[macro_use(entry, exception)] extern crate cortex_m_rt as rt; use...
// 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. //! Utilities for implementing PPP control protocols. //! //! Provides a generic implementation of an LCP-like protocol state machine, and implementations ...
use proconio::input; use topological_sort::topological_sort; fn main() { input! { n: usize, st: [(String, String); n], }; let mut names = Vec::new(); for (s, t) in &st { names.push(s); names.push(t); } names.sort(); names.dedup(); let n = names.len(); ...
// Copyright 2021 Datafuse Labs. // // 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 ...
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate rocket; extern crate dotenv; #[macro_use] extern crate rocket_contrib; #[macro_use] extern crate serde_derive; #[macro_use] extern crate diesel; #[macro_use] extern crate diesel_codegen; use rocket_contrib::{Json, Value}; use rocket::response::status::{Creat...
use crate::libbb::ptr_to_globals::bb_errno; use libc; pub unsafe fn cp_mv_stat2( fn_0: *const libc::c_char, fn_stat: *mut libc::stat, sf: unsafe extern "C" fn(_: *const libc::c_char, _: *mut libc::stat) -> libc::c_int, ) -> libc::c_int { if sf(fn_0, fn_stat) < 0 { if *bb_errno != 2 { crate::libbb::pe...
//! A cumulative sum. use super::*; use crate::algebra::{Group, Monoid}; use std::iter::FromIterator; use std::ops::{Range, RangeTo}; /// A cumulative sum. /// /// # Space complexity /// O(n log σ) #[derive(Clone, PartialEq, Eq, Debug, Hash)] pub struct CumulativeSum<T> { vec: Vec<T>, } impl<M: Monoid> Cumulative...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::CTL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w ...
// 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...
#[doc = "Reader of register CR"] pub type R = crate::R<u32, super::CR>; #[doc = "Writer for register CR"] pub type W = crate::W<u32, super::CR>; #[doc = "Register CR `reset()`'s with value 0"] impl crate::ResetValue for super::CR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
#[macro_use] extern crate serde_derive; use libstd; use std::env; use scrypt::{scrypt, ScryptParams}; fn main() { /* let str = "0xFFFFFFFFFFFFf"; let args: Vec<String> = env::args().collect(); println!("{:?}",args); if args.len()!=1 { //读取命令行参数 match args[1].as_str() { "-c"=...
extern crate serde; mod test_utils; use flexi_logger::LoggerHandle; use hdbconnect_async::{ConnectParams, Connection, HdbResult, IntoConnectParams}; use log::*; use serde::{Deserialize, Serialize}; use std::env; use std::time::Instant; #[tokio::test] async fn test_010_connect() -> HdbResult<()> { let mut log_han...
//! This file contains an implementation of Vec that can't be empty. use crate::*; use std::vec::Drain; use std::vec::Splice; use std::ops::Bound; // =================== // === NonEmptyVec === // =================== /// A version of [`std::vec::Vec`] that can't be empty. #[allow(missing_docs)] #[derive(Clone,Debug...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::PINASSIGN2 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
use noak::descriptor::{BaseType, TypeDescriptor}; use noak::reader::cpool; pub mod javastd; pub mod pubapi; pub mod refer; fn get_type_name(t: &TypeDescriptor) -> String { match t.base() { BaseType::Boolean => "java/lang/Boolean".to_string(), BaseType::Byte => "java/lang/Byte".to_string(), ...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::SSTSH0 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &...
// Copyright 2021 rust-ipfs-api Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accord...
#![allow(unused_assignments)] use types::*; /* * From opensource.apple.com/source/xnu/xnu-1699.26.8/osfmk/mach/i386/syscall_sw.h: * Syscall classes for 64-bit system call entry. * For 64-bit users, the 32-bit syscall number is partitioned * with the high-order bits representing the class and low-order * bits bei...
extern crate rustc_version; use rustc_version::{version_meta, Channel}; pub fn main() { let meta = version_meta().unwrap(); let channel = match meta.channel { Channel::Dev | Channel::Nightly => "nightly", Channel::Beta | Channel::Stable => "stable", }; println!("cargo:rustc-cfg={}_cha...
use core::{cell::RefCell, ops::DerefMut}; use cortex_m::interrupt::{free, CriticalSection, Mutex}; // Struct for easing the usage of mutexes and refcells to contain global variables pub struct GlobalCell<T> { cell: Mutex<RefCell<Option<T>>>, } impl<T> GlobalCell<T> { pub const fn new(value: Option<T>) -> Sel...
// 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. #![allow(warnings)] use std::marker::PhantomData; use std::option::IntoIter; use zerocopy::AsBytes; struct IsAsBytes<T: AsBytes>(T); // Fail compilatio...
use crate::bgp::packet::MutableBgpHeaderPacket; use crate::bgp::packet::MutableBgpOpenPacket; use crate::bgp::packet::{BgpHeaderPacket, BgpOpenOptPacket, BgpOpenPacket, BgpTypes}; use crate::bgp::{Capabilities, Capability, Family, AFI_IP, BGP_HEADER_LEN, SAFI_MPLS_VPN}; use bytes::BytesMut; use pnet::packet::Packet; us...
//! The setups available for any `TestCase` to use by specifying the test name in a comment at the //! start of the `.sql` file in the form of: //! //! ```text //! -- IOX_SETUP: [test name] //! ``` use futures_util::FutureExt; use influxdb_iox_client::table::generated_types::{Part, PartitionTemplate, TemplatePart}; us...
//! An implementation of the SHA-2 cryptographic hash algorithms. //! //! There are 6 standard algorithms specified in the SHA-2 standard: //! //! * `Sha224`, which is the 32-bit `Sha256` algorithm with the result truncated //! to 224 bits. //! * `Sha256`, which is the 32-bit `Sha256` algorithm. //! * `Sha384`, which i...
use anyhow::Result; use crate::Parser; use log::debug; pub struct XMLParser {} impl Parser for XMLParser { fn parse_tokens_str<'a>(&self, input: &'a str) -> Result<()> { // After testing, there's no difference in out examples between `from` and `from_fragment` let tk = xmlparser::Tokenizer::from_fr...
use piston::input::{RenderArgs, UpdateArgs, Button}; use opengl_graphics::GlyphCache; use super::states::State; use super::gamedata::GameData; use opengl_graphics::GlGraphics; use graphics::Context; pub trait GameState { fn render(&mut self, ctx: &Context, gl: &mut GlGraphics, glyphs: &mut GlyphCache); ...
mod rdf { pub fn parse_rdf() { unimplemented!(); } pub fn read_rdf() { let unimplemented!(); } pub fn write_rdf() { unimplemented!(); } }
use std::fs::File; use std::io::prelude::*; fn main() -> std::io::Result<()> { let mut file = File::create("/tmp/file.txt")?; let buffer = "Hello Linux Journal!\n"; file.write_all(buffer.as_bytes())?; println!("Finish writing..."); let mut input = File::open("/tmp/file.txt")?; let mut input_bu...
#[cfg(all(not(target_arch = "wasm32"), feature = "svg"))] mod svg; #[cfg(all(not(target_arch = "wasm32"), feature = "svg"))] pub use self::svg::SVGBackend; #[cfg(all(not(target_arch = "wasm32"), feature = "image"))] mod bitmap; #[cfg(all(not(target_arch = "wasm32"), feature = "image"))] pub use bitmap::BitMapBackend; ...
use std::{ collections::{HashMap, VecDeque}, rc::Rc, }; use crate::{client_actor_manager::ClientActorManager, naia_client::LocalActorKey}; use naia_shared::{wrapping_diff, ActorType, Event, EventType, SequenceBuffer, SequenceIterator}; const COMMAND_HISTORY_SIZE: u16 = 64; /// Handles incoming, local, predic...
use std::collections::HashMap; use std::io::{Cursor, Read}; use std::{error, thread}; use byteorder::{ByteOrder, LittleEndian, ReadBytesExt}; use dbus::arg::RefArg; use serde::export::Formatter; use dbus_common::org_bluez_device1::OrgBluezDevice1; use dbus_common::org_bluez_gatt_characteristic1::OrgBluezGattCharacter...
use std::collections::{HashMap}; use template::{ComponentTemplate, Style, TemplateValue}; use {Error, Context}; /// A generated attribute bundle for a component, used by the component and its class to receive /// data from templates and styles. pub struct Attributes { attributes: HashMap<String, TemplateValue>, ...
use crate::common::CommonState; use crate::game::{State, Transition, WizardState}; use crate::helpers::ID; use crate::ui::UI; use ezgui::{Choice, EventCtx, GfxCtx, Key, ModalMenu, Text, WarpingItemSlider}; use geom::Pt2D; use map_model::{BusRoute, BusRouteID, BusStopID, Map}; pub struct BusRouteExplorer { slider: ...
mod builder; mod html; mod wu; use builder::build_htmldiff; use std::env; use std::fs::File; use std::io; use std::io::prelude::*; use std::io::{stdout, BufReader, BufWriter}; use std::process; fn main() { let args: Vec<String> = env::args().collect(); if args.len() < 3 { eprintln!("Usage: htmldiff F...
use futures::{Async, Future, Stream}; use inotify::{EventMask, Inotify, WatchMask}; use log::Level; use tokio::timer::Interval; use std::collections::HashMap; use std::env; use std::path::Path; use std::rc::{Rc, Weak}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Mutex, Once}; use std::thread; use s...
use clippy_utils::diagnostics::span_lint_and_help; use if_chain::if_chain; use rustc_ast::ast::LitKind; use rustc_hir::{Expr, ExprKind, PathSegment}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::{source_map::Spanned, symbol...
//! The `system_transaction` module provides functionality for creating system transactions. use crate::hash::Hash; use crate::pubkey::Pubkey; use crate::signature::{Keypair, KeypairUtil}; use crate::system_instruction; use crate::system_program; use crate::transaction::Transaction; /// Create and sign new SystemInst...
use amethyst::assets::ProgressCounter; use amethyst::core::Parent; use amethyst::ecs::{Join, Read, ReadExpect, ReadStorage, WriteStorage}; use amethyst::prelude::Builder; use amethyst::ui::{Anchor, UiImage, UiText, UiTransform}; use std::convert::TryFrom; use super::state_prelude::*; const UI_RON_PATH: &str = "ui/dif...
use std; use serialize; pub enum E { Other(String) } /// An Encoder which compiles but always returns an error pub struct T<'a, W : 'a + std::io::Writer> { writer : &'a mut W, } impl<'a, W : 'a + std::io::Writer> T<'a, W> { pub fn new<'b>(w: &'b mut W) -> T<'b, W> { T { writer: w } } } impl<...
use crate::{Buffer, Float}; use core::mem::MaybeUninit; use core::slice; use core::str; impl Buffer { /// This is a cheap operation; you don't need to worry about reusing buffers /// for efficiency. #[inline] pub fn new() -> Self { let bytes = [MaybeUninit::<u8>::uninit(); 24]; Buffer {...
use ndarray::prelude::*; use petgraph::visit::{IntoEdges, IntoNodeIdentifiers, NodeCount}; use petgraph_algorithm_shortest_path::warshall_floyd; use petgraph_drawing::{Drawing, DrawingIndex}; fn line_search(a: &Array2<f32>, dx: &Array1<f32>, d: &Array1<f32>) -> f32 { let n = dx.len(); let mut alpha = -d.dot(dx...
use dotenv::dotenv; use mail::transports::{SmtpTransport, TestTransport, Transport}; use std::env; use tari_client::{HttpTariClient, TariClient, TariTestClient}; #[derive(Clone, PartialEq)] pub enum Environment { Development, Test, Production, } #[derive(Clone)] pub struct Config { pub allowed_origins...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_describe_services( input: &crate::input::DescribeServicesInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::Jso...
use crate::traits::required::*; use crate::views::LocalTransformStoragesMut; use shipyard::*; impl<'a, V, Q, M, N> LocalTransformStoragesMut<'a, V, Q, M, N> where V: Vec3Ext<N> + Send + Sync + 'static, Q: QuatExt<N> + Send + Sync + 'static, M: Matrix4Ext<N> + Send + Sync + 'static, N: Copy + Send + Syn...
extern crate embed_resource; fn main() { embed_resource::compile("hdpi_plotting.rc"); }
use specs::{BitSet, world::Index}; type Point2 = nalgebra::Point2<f32>; pub struct Neighborhood{ areas: Vec<BitSet>, width: i32, height: i32, } impl Neighborhood { pub fn new(width: i32, height: i32) -> Self { let mut areas = Vec::with_capacity( (width * height) as usize ); for _ in 0..(width*height) { area...
use grpc; mod greeter; pub fn server() -> grpc::Result<grpc::Server> { let mut builder = grpc::ServerBuilder::new_plain(); builder.http.set_port(3000); builder.add_service(greeter::GreeterService::new()); builder.build() }
// verify-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B use spella::algebra::{AssociativeMagma, CommutativeMagma, InvertibleMagma, Magma, UnitalMagma}; use spella::io::Scanner; use spella::sequences::FenwickTree; use std::io::{self, prelude::*}; use std::iter::FromIterator; #[deriv...
use std::cell::RefCell; use std::collections::HashMap; use std::fmt; use std::rc::Rc; pub struct Environment { parent: Option<EnvRef>, entries: HashMap<String, Object>, } pub type EnvRef = Rc<RefCell<Environment>>; impl Environment { pub fn new() -> EnvRef { let mut env = Environment { ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type HCS_CALLBACK = isize;
use std::fs::File; use std::io::Read; #[macro_use] extern crate glium; #[derive(Copy, Clone)] struct Vertex { position: [f32; 2], tex: [f32; 2], } fn main() { use glium::{DisplayBuild, Surface}; let display = glium::glutin::WindowBuilder::new().build_glium().unwrap(); implement_vertex!(Vertex, ...
use std::collections::VecDeque; pub fn gen_a1(prev: u64) -> u64 { (prev * 16807) % 2147483647 } pub fn gen_b1(prev: u64) -> u64 { (prev * 48271) % 2147483647 } pub fn part1() { let mut a: u64 = 783; let mut b: u64 = 325; let mut matches: i32 = 0; for _i in 0..40000000 { a = gen_a1(a)...
// Copyright 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-MIT or ...
use std::io; fn main() { let mut reader = io::stdin(); let mut control: String = String::new(); loop { reader.read_line(&mut control); control.trim(); if control.eq("quit\r\n") { println!("adios!"); break; } else { println!("{}", control); ...
#[doc = "Reader of register CR2"] pub type R = crate::R<u32, super::CR2>; #[doc = "Writer for register CR2"] pub type W = crate::W<u32, super::CR2>; #[doc = "Register CR2 `reset()`'s with value 0"] impl crate::ResetValue for super::CR2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)]...
use super::*; use generational_arena::{Arena, Index}; use glutin::{ContextWrapper, PossiblyCurrent}; use image::GenericImageView; use lazy_static::lazy_static; use std::path::Path; use winit::window::Window; const DEFAULT_TEXTURE_SIZE: u32 = 2; lazy_static! { static ref DEFAULT_TEXTURE_DATA: Vec<u8> = vec...
use std::io; use std::env; use std::time::Duration; use settimeout::set_timeout; use futures::executor::block_on; use std::process::{ Command, Stdio }; mod filesystem; pub use crate::filesystem::functions; struct IconParameters { pub width: u32, pub scale: u8, } impl IconParameters { fn get_icon_name(&se...
use super::helpers::c_long_remainder_assign; use crate::integer::Integer; use core::ops::RemAssign; // RemAssign The remainder assignment operator %=. // ['Integer', 'Integer', 'Integer::remainder_assign', 'no', [], ['ref']] impl RemAssign<Integer> for Integer { fn rem_assign(&mut self, rhs: Integer) { ...
use crate::models::Todo; use std::collections::HashMap; #[derive(Debug)] pub struct Store { tasks: HashMap<usize, Todo>, index: usize, } impl Store { pub fn new() -> Store { let mut store = Store { tasks: HashMap::new(), index: 1, }; // seed store st...
#[doc = "Reader of register CSR"] pub type R = crate::R<u32, super::CSR>; #[doc = "Writer for register CSR"] pub type W = crate::W<u32, super::CSR>; #[doc = "Register CSR `reset()`'s with value 0x0c00_0600"] impl crate::ResetValue for super::CSR { type Type = u32; #[inline(always)] fn reset_value() -> Self:...
/// ```rust,ignore /// 171. Excel表列序号 /// 给定一个Excel表格中的列名称,返回其相应的列序号。 /// /// 例如, /// /// A -> 1 /// B -> 2 /// C -> 3 /// ... /// Z -> 26 /// AA -> 27 /// AB -> 28 /// ... /// /// 示例 1: /// /// 输入: "A" /// 输出: 1 /// /// 示例 2: /// /// 输入: "AB" /// 输出: 28 /// /// 示例 3: /// /// 输入: "ZY" /// 输出: 701 /// /// 致谢: /// 特别感谢 @...
// #![cfg_attr(feature = "dev", feature(plugin))] // #![cfg_attr(feature = "dev", plugin(clippy))] // #![cfg_attr( // feature = "dev", // warn( // cast_possible_truncation, cast_possible_wrap, cast_precision_loss, cast_sign_loss, mut_mut, // non_ascii_literal, result_unwrap_used, shadow_reuse, s...
use super::{Bucket, Entries, IndexMap, Slice}; use alloc::vec::{self, Vec}; use core::fmt; use core::iter::FusedIterator; use core::slice; impl<'a, K, V, S> IntoIterator for &'a IndexMap<K, V, S> { type Item = (&'a K, &'a V); type IntoIter = Iter<'a, K, V>; fn into_iter(self) -> Self::IntoIter { ...
extern crate tictactoe; pub use tictactoe::board::Board; pub use tictactoe::error::{self, Result}; pub use tictactoe::{check_for_winner, prompt_for_position}; fn main() { let mut board = Board::new(); loop { println!("\n{}", board); prompt_for_position() .and_then(|position| board...
//! Templates parsed in from markup. mod attributes; mod component; mod parse; mod style; mod template; mod value; pub(crate) use self::component::{TemplateAttribute}; pub use self::attributes::{Attributes}; pub use self::component::{ComponentTemplate}; pub use self::style::{Style}; pub use self::template::{Template...
use proc_macro::TokenStream; use proc_macro_roids::{DeriveInputStructExt, FieldsNamedAppend}; use quote::quote; use syn::{AttributeArgs, DeriveInput, Fields, FieldsNamed, parse_macro_input, parse_quote, Type}; mod db_meta; mod cr; /// 生成数据库通用部分,包括如下: /// # 三个字段, id: String, create_time: i64,update_time: i64 /// # im...