text
stringlengths
8
4.13M
use std::io::{self, Read, Write}; use futures::{Future, Poll, Async}; use tokio_io::{AsyncRead, AsyncWrite}; struct StreamState { read_done: bool, pos: usize, cap: usize, buf: Box<[u8]>, } impl StreamState { fn new() -> StreamState { StreamState { read_done: false, ...
// Copyright 2019 Conflux Foundation. All rights reserved. // Conflux is free software and distributed under GNU General Public License. // See http://www.gnu.org/licenses/ #[test] fn test_empty_genesis_block() { let state_manager = new_state_manager_for_unit_test(); let mut genesis_epoch_id = H256::default()...
extern crate rayon; pub use self::config::Config; pub fn run(c: Config, input: &[u8]) -> String { match c.problem.as_ref() { "dna" => dna::run(input), "dnap" => run_in_parallel(c,|| dnap::run(input)), "rna" => rna::run(input), "rnap" => run_in_parallel(c,|| rnap::run(input)), ...
type Stacks = Vec<Vec<char>>; type Moves = Vec<(u64,usize,usize)>; fn star1(mut s : Stacks, m : &Moves) { for (a,b,c) in m { for _ in 0..*a { let elem = s[*b].pop().unwrap(); s[*c].push(elem); } } println!("{}", s.iter().map(|l| l.last().unwrap()).collect::<String>()...
// This code was expanded by `xtask`. pub use self::fenwicktree::*; mod fenwicktree { // Reference: https://en.wikipedia.org/wiki/Fenwick_tree pub struct FenwickTree<T> { n: usize, ary: Vec<T>, e: T, } impl<T: Clone + std::ops::AddAssign<T>> FenwickTree<T> { pub fn new...
use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt(about = "极客时间课程下载工具")] pub enum Opt { Query { #[structopt(long, short)] account: String, #[structopt(long, short)] password: String, #[structopt(long, short = "c", help = "the code of country", default_value =...
use std::cell::RefCell; use std::ffi::CString; use std::ptr; use failure::Error; use libc::{c_char, c_int}; thread_local! { static LAST_ERROR: RefCell<Option<Box<Error>>> = RefCell::new(None); } /// Update the most recent error, clearing whatever may have been there before. pub fn update_last_error(err: Error) {...
#![feature(map_into_keys_values)] #![feature(async_closure)] #![feature(array_chunks)] pub mod fs; use fs::async_fs::AsyncFs; use fs::tikv_fs::TiFs; use fuser::MountOption as FuseMountOption; use paste::paste; macro_rules! define_options { { $name: ident, [ $($newopt: ident),* $(,)? ], [ $($opt: ident),* $(,)? ...
#![deny(missing_docs)] mod common; mod events; mod methods; mod structs; mod types; use super::util; use super::Abigen; use crate::contract::structs::InternalStructs; use crate::rawabi::RawAbi; use anyhow::{anyhow, Context as _, Result}; use ethers_core::abi::{Abi, AbiParser}; use proc_macro2::{Ident, Literal, TokenS...
//! Provides an iterator over incoming data frames and messages #![unstable] use dataframe::sender::DataFrameSender; use dataframe::receiver::DataFrameReceiver; use dataframe::converter::DataFrameConverter; use dataframe::WebSocketDataFrame; use message::WebSocketMessaging; use client::WebSocketClient; use common::WebS...
// This programs finds the number of coins and their summed up value // Data model {{{ #[derive(Debug)] struct GenericCoin { pub value: i32, pub quantity: i32, } #[derive(Debug)] enum Coins { Penny(GenericCoin), Dime(GenericCoin), Nickel(GenericCoin), Quarter(GenericCoin), } impl Coins { p...
uucore_procs::main!(uu_tty); // spell-checker:ignore procs uucore
use std::collections::*; use std::io::{self, Write}; use std::{cmp::Ordering, fmt::Result}; fn main() { let mut map = HashMap::new(); map.insert(1, 2); println!("Hello, world!"); }
use super::*; use std::sync::atomic::{AtomicBool, Ordering}; /// Status variable accessed by assembly code #[no_mangle] pub static mut pku_enabled: u64 = 0; lazy_static! { pub static ref PKU_ENABLED: AtomicBool = AtomicBool::new(false); } const PKEY_LIBOS: i32 = 0; const PKEY_USER: i32 = 1; /// Try enable PKU ...
// Author: hankun1991@outlook.com /** * 20230315 * No.1615 */ fn maximal_network_rank(n: i32, roads: Vec<Vec<i32>>) -> i32 { let mut ans = 0; let mut degree = vec![0; n as usize]; let mut graph = vec![vec![false; n as usize]; n as usize]; for i in roads { degree[i[0] as usize] += 1; d...
use chrono::prelude::*; use serde::{Deserialize, Serialize}; const URL_AUTH: &'static str = "https://oauth2.googleapis.com/token"; // https://developers.google.com/identity/protocols/oauth2/service-account // // iss The email address of the service account. // scope A space-delimited list of the permissions that the ...
// Copyright 2020 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 ...
use crate::*; #[test] fn child_references_parent() { expect("a = 1; { a + 2 }").to_yield(3) } #[test] fn child_references_parent_too_early_error() { expect("{ a + 2 }(); a = 1").to_error(NoSuchField, 2) } // TODO make circular reference detection work again // #[test] // fn child_references_parent_circular_err...
mod movement; mod location; mod snake; pub use movement::Direction; pub use movement::Movement; pub use location::Location; pub use snake::Snake;
use crate::{ data::{AppState, Ctx, Library, SavedAlbums}, ui::{ album::album_widget, track::{tracklist_widget, TrackDisplay}, utils::{error_widget, spinner_widget}, }, widget::Async, }; use druid::{widget::List, LensExt, Widget, WidgetExt}; pub fn saved_tracks_widget() -> impl W...
use crate::core::esi; use crate::data; use crate::{config::Config, util::madness::Madness}; use rand::seq::SliceRandom; use std::sync::Arc; pub struct SkillUpdater { esi_client: esi::ESIClient, db: Arc<crate::DB>, config: Config, } impl SkillUpdater { pub fn new(db: Arc<crate::DB>, config: Config) -> ...
//! Ropey is a utf8 text rope for Rust. It is fast, robust, and can handle //! huge texts and memory-incoherent edits with ease. //! //! Ropey's atomic unit of text is Unicode scalar values (or `char`s in Rust) //! encoded as utf8. All of Ropey's editing and slicing operations are done //! in terms of char indices, w...
///! Entry point for binary target. use env_logger; static DEFAULT_LOG_FILTER: &str = "warn,grouse=trace"; pub fn main() { env_logger::init_from_env(env_logger::Env::default().default_filter_or(DEFAULT_LOG_FILTER)); grouse::run().unwrap(); }
// Not exported. fn fn_b() -> String { String::from("B") } // Exported. pub fn a() -> String { ["A", &fn_b()].concat() }
// Copyright (c) 2022 PHPER Framework Team // PHPER is licensed under Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan // PSL v2. You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WIT...
//! Modular math //! //! Perform multiplication and exponentiation with modulo, without overflow. //! The other option was to use num_bigint; this should be more efficient. //! //! Cribbed from [wikipedia][wiki]. //! //! [wiki]: https://en.wikipedia.org/wiki/Modular_arithmetic#Example_implementations /// Compute `(x.p...
use std::collections::HashMap; use std::collections::VecDeque; enum ProgramResult { WaitForInputAt, Output(i64), Halted, } struct ProgramState { program: HashMap<u64, i64>, inputs: VecDeque<i64>, pc: u64, relative_base: i64, } impl ProgramState { fn get(&self, i: u64) -> i64 { ...
// 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 ...
pub mod leap { // pub fn main() { // let truth // println!(is_leap_year(1996).to_string()); // } }
#![feature(phase)] #[phase(plugin, link)] extern crate green; extern crate rtinstrument; green_start!(main) fn main() { let msgs = rtinstrument::instrument(work); for msg in msgs.iter() { println!("{}", msg); } } fn work() { let (tx, rx) = channel(); for _ in range(0u, 10) { let...
fn main() { let _query = sqlx::query!("select $1::text", 0i32); let _query = sqlx::query!("select $1::text", &0i32); let _query = sqlx::query!("select $1::text", Some(0i32)); let arg = 0i32; let _query = sqlx::query!("select $1::text", arg); let arg = Some(0i32); let _query = sqlx::query...
use mayastor::{ bdev::{nexus_create, nexus_lookup, Reason}, core::MayastorCliArgs, }; pub mod common; static NEXUS_NAME: &str = "FaultChildNexus"; static NEXUS_SIZE: u64 = 10 * 1024 * 1024; static CHILD_1: &str = "malloc:///malloc0?blk_size=512&size_mb=10"; static CHILD_2: &str = "malloc:///malloc1?blk_size=5...
use crate::import_map::{ImportHashMap, ImportMap}; use indexmap::IndexSet; use path_slash::PathBufExt; use pathdiff::diff_paths; use regex::Regex; use relative_path::RelativePath; use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, path::{Path, PathBuf}, str::FromStr, }; use url::Url; lazy_stat...
use common::stringify_js_error; use derive_more::Display; use js_sys::Array; use mm2_err_handle::prelude::*; use wasm_bindgen::prelude::*; use web_sys::{IdbDatabase, IdbIndexParameters, IdbObjectStore, IdbObjectStoreParameters, IdbTransaction}; const ITEM_KEY_PATH: &str = "_item_id"; pub type OnUpgradeResult<T> = Res...
#[test] fn test_inc() { assert_template_result!("0", "{%increment port %}", o!({})); assert_template_result!("0 1", "{%increment port %} {%increment port%}", o!({})); assert_template_result!("0 0 1 2 1", "{%increment port %} {%increment starboard%} {%increment port %} {%increment port%} {%increment st...
use std::env; use std::process; fn main() { let inc_msg = String::from("Incorrect usage. Please refer to the help page (-h) for instructions."); let help_msg = String::from("Usage: chat-rust <server> <ip/port> [<username>]\n\n\t -h\t show this message.\n\t server\t 'server' if you wish to start a server, ...
#[macro_use] extern crate lazy_static; use std::collections::{HashSet, VecDeque}; use regex::Regex; use util::res::Result; use util::file::GenericParseError; #[derive(Clone, Debug, PartialEq, Eq, Hash)] enum Binop { Add, Mul } #[derive(Clone, Debug, PartialEq)] enum Token { LParen, RParen, Binop(B...
//! This module implements the `UniMap`, which is a way to get efficient mappings //! optimized for the setting of `tree_borrows/tree.rs`. //! //! A `UniKeyMap<K>` is a (slow) mapping from `K` to `UniIndex`, //! and `UniValMap<V>` is a (fast) mapping from `UniIndex` to `V`. //! Thus a pair `(UniKeyMap<K>, UniValMap<V>)...
mod fun; use std::collections::HashMap; use discord::{model::Message, Discord}; pub fn get_commands<'a>() -> HashMap<String, Box<dyn Fn(&'a Discord, Message, Vec<String>)>> { let mut commands: HashMap<String, Box<dyn Fn(&'a Discord, Message, Vec<String>)>> = HashMap::new(); let fun_coms = fun::get_co...
//! Shorthand reply utilities. use serde::Serialize; use warp::reply; use warp::{http::StatusCode, Reply}; use crate::payload; /// Return a JSON error reply with a custom status code. pub fn error<T: ToString>(e: T, code: StatusCode) -> reply::Response { reply::with_status( reply::json(&payload::ErrorRes...
extern crate ws; extern crate openssl; extern crate rustc_serialize; // use std::{io, str}; // use openssl::pkey::PKey; // use openssl::rsa::{Rsa, PKCS1_PADDING}; // use rustc_serialize::base64::{self, ToBase64, FromBase64}; // use rustc_serialize::hex::FromHex; #[macro_use] mod utils; mod engine; mod socket; // use...
//! A private module that is only included in the crate with feature `foo`. use a::A; /// Some impls (from `bar`) that are always included in the crate. /// (if the parent module is) impl A { /// A public method that is always included in the crate. /// (if the parent module is) pub fn bar(&self) { } ...
use crate::manifest::Id; use std::path::PathBuf; #[derive(Debug)] pub enum Operation { Compare(Id, Id), DeleteManifest(Id), Index(PathBuf), List, Scan(Id), }
#![cfg_attr(rustfmt, rustfmt::skip)] use super::*; impl Env { pub fn create_array (self: &'_ Env) -> Result< JsObject > { Ok(JsObject { __wasm: ::js_sys::Array::new().unchecked_into(), }) } pub fn create_buffer_copy (self: &'_ Env, xs: &'_ [u8]) -> Resul...
// Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 //! cargo run --example 03_simple_block --release //! In this example we will send a block without a payload. use iota_client::{Client, Result}; #[tokio::main] async fn main() -> Result<()> { dotenv::dotenv().ok(); let node_url = std::en...
// Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Copyright © 2022 Alibaba Cloud. All rights reserved. // Copyright © 2019 Intel Corporation. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause //! Provides allocation and releasing strategy for memory slots. //! //...
// Copyright 2020 WHTCORPS INC. Licensed under Apache-2.0. use prometheus::*; lazy_static! { pub static ref FIDel_REQUEST_HISTOGRAM_VEC: HistogramVec = register_histogram_vec!( "edb_fidel_request_duration_seconds", "Bucketed histogram of FIDel requests duration", &["type"] ) .unwra...
use std::{collections::HashMap, error, fmt, iter::Iterator}; use super::{ reqs::{Reqs, Requirement}, scanner::{Token, TokenType}, types::{TypeId, Types}, Action, ConstId, Constant, Effect, Fexp, Fhead, FuncId, Function, Goal, Param, PredId, Predicate, Term, }; pub type PredMap = HashMap<String, Pr...
// * Daily Coding Problem July 1st 2020 // * [Medium] -- Pinterest // * The sequence [0, 1, ..., N] has been jumbled, and the only clue you have // * for its order is an array representing whether each number is larger or // * smaller than the last. Given this information, reconstruct an array that is // * consistent...
use wasm_bindgen::prelude::*; use wasm_bindgen::JsValue; use web_sys::console::log_1; #[wasm_bindgen(start)] pub fn main() { log_1(&JsValue::from("Hello, Linz!")); }
use amethyst::core::{GlobalTransform, Time, Transform}; use amethyst::ecs::prelude::*; use amethyst::input::{is_close_requested, is_key_down}; use amethyst::renderer::{Camera, PngFormat, Projection, Texture}; use amethyst::renderer::{ElementState, Event, VirtualKeyCode}; use amethyst::core::cgmath::{Matrix4, Ortho, Ve...
fn main() { println!("Hello, world!"); let x = another_function("Essehemy"); println!("return {:?}", x ); } fn another_function(name: &str) -> i32 { println!("Hello, {}!", name); 5 }
use crate::input; use std::collections::HashMap; pub fn run() { let contents = input::get_contents("day03"); println!("part1: {}", count_houses(&contents)); println!("part2: {}", count_houses_dual(&contents)); } #[derive(Clone, Default, Eq, Hash, PartialEq)] struct V2 { x: i32, y: i32, } impl Co...
use std::collections::LinkedList; use std::sync::{Arc, Mutex}; struct Client { queue: Arc<Mutex<LinkedList<i32>>>, a: i32, } impl Client { fn print_a(&mut self) { println!("{}", self.a); } } fn main() { let list: LinkedList<i32> = LinkedList::new(); let mut client = Client {a: 10, queue...
#[allow(dead_code)] pub mod command; pub use self::command::*; #[allow(dead_code)] pub mod constants; pub use self::constants::*; #[allow(dead_code)] pub mod direction; pub use self::direction::*; #[allow(dead_code)] pub mod dropoff; pub use self::dropoff::*; #[allow(dead_code)] pub mod entity; pub use self::entity::*;...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::cli_state::CliState; use crate::StarcoinOpt; use anyhow::Result; use clap::Parser; use scmd::{CommandAction, ExecContext}; use serde::{Serialize, Serializer}; use starcoin_rpc_api::types::{CodeView, ResourceView, StrView}...
use super::Responder; use std::net::SocketAddr; pub trait ResponderFactory { type Responder: Responder; fn make_responder(&self, remote_addr: SocketAddr) -> Self::Responder; } impl<'a, T> ResponderFactory for &'a T where T: ResponderFactory + 'a, { type Responder = T::Responder; fn make_responder(...
// * Daily Coding Problem May 12 2020 // * [Medium] -- Microsoft // * Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. // ! Ex: "abracadabra" and the pattern "abr" --> [0, 7] // #![feature(exclusive_range_pattern)] #![allow(dead_code)] fn pattern_indices(inpu...
use crate::db::schema::{gases}; use crate::db::models::dive::Dive; use serde::{Serialize, Deserialize}; #[derive(Queryable, Identifiable, Associations)] #[table_name = "gases"] #[belongs_to(parent = "Dive", foreign_key = "dive_id")] pub struct Gas { pub id: i32, pub dive_id: Option<i32>, pub o2: i32, p...
//! The servers internal files. pub mod connection_hub; pub use self::connection_hub::ConnectionHub; pub mod user; pub use self::user::User;
struct Solution; use std::cmp::Reverse; impl Solution { fn remove_covered_intervals(mut intervals: Vec<Vec<i32>>) -> i32 { intervals.sort_by_key(|v| (v[0], Reverse(v[1]))); let n = intervals.len(); let mut r = -1; let mut res = 0; for i in 0..n { let interval = &...
#![no_std] pub mod instruction; pub mod registers;
use ezemoji::{EZEmojis, EmojiGroups}; #[derive(Hash, Eq, PartialEq)] struct Num; fn main() { let e: EZEmojis<()> = EZEmojis::default(); println!("{:?}", e.get_char(&EmojiGroups::Smile.into())); }
use std::time::Instant; use amethyst::assets::Handle; use amethyst::core::{LocalTransform, Transform}; use amethyst::core::cgmath::{Array, One, Point2, Quaternion, Vector2, Vector3}; use amethyst::ecs::{Entities, Entity, Fetch, Join, LazyUpdate, System, WriteStorage}; use amethyst::renderer::{Material, Mesh}; use rhus...
#[macro_use] extern crate prodbg_api; use prodbg_api::{View, Ui, Reader, Writer, PluginHandler, Service, CViewCallbacks, Vec2}; use prodbg_api::ui_ffi::PDUISELECTABLEFLAGS__SPANALLCOLUMNS; use prodbg_api::events::*; struct ThreadsView { selected_thread: u32, set_selected_thread: bool, thread_id: u32, ...
use crate::util::helper::{length, max, rotate, nsgn}; pub enum SolidType { Box, Sphere } pub struct SolidBody { pos_x: f64, pos_y: f64, scale_x: f64, scale_y: f64, theta: f64, vel_x: f64, vel_y: f64, vel_theta: f64, solid_type: SolidType } impl SolidBody { pub fn new_b...
use anyhow::{anyhow, Error, Result}; use bevy_app::prelude::*; use bevy_ecs::prelude::*; use bevy_fallible::*; struct ShouldFail(bool); #[derive(Default)] struct ErrorStorage(Vec<Error>); struct CustomRes(String); #[fallible_system] fn system() -> Result<()> { println!("simple system"); Ok(()) } #[fallible_s...
use surf::Client; pub struct JsonRpcService { client: Client, } impl JsonRpcService { pub fn new(client: &Client) -> Self { Self { client: client.clone(), } } pub fn get_configuration(&self) {} pub fn introspect(&self) {} pub fn notify_all(&self) {} pub fn permission(&self) {} pub f...
//! //! # Fluvio SC - Delete Processing //! //! Sends Delete SPU group request to Fluvio Streaming Controller //! use std::io::Error as IoError; use std::io::ErrorKind; use std::net::SocketAddr; use log::trace; use future_helper::run_block_on; use sc_api::apis::ScApiKey; use sc_api::spu::{FlvDeleteSpuGroupsRequest, ...
struct Solution; use std::iter::FromIterator; trait Nums { fn nums(self) -> Vec<String>; } impl Nums for &[char] { fn nums(self) -> Vec<String> { let n = self.len(); let mut res = vec![]; for i in 1..=n { let left = String::from_iter(self[..i].iter()); let right...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program 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 Softwa...
use std::os::unix::io::FromRawFd; use mio::Ready; use bytes::BufMut; use tokio::reactor::PollEvented2; use futures::{Async, Poll, Stream, Sink, StartSend, AsyncSink}; pub struct Io { io: PollEvented2<mio::net::UdpSocket>, } impl Io { pub fn new(protocol: libc::c_int) -> nix::Result<Io> { let fd = uns...
// Enums allow you to define a type by enumerating its possible variants // We can enumerate all possible variants, which is where enumeration gets its name. #![allow(unused)] fn main() { // Many people will want to define enum on this format below /* enum IpAddrKind { V4, V6, } ...
//! Streaming bodies for Requests and Responses //! //! For both [Clients](crate::client) and [Servers](crate::server), requests and //! responses use streaming bodies, instead of complete buffering. This //! allows applications to not use memory they don't need, and allows exerting //! back-pressure on connections by ...
pub const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float;
use crate::CodedInputStream; use crate::Enum; use crate::EnumOrUnknown; /// Read repeated enum field when the wire format is length-delimited. pub fn read_repeated_packed_enum_or_unknown_into<E: Enum>( is: &mut CodedInputStream, target: &mut Vec<EnumOrUnknown<E>>, ) -> crate::Result<()> { let len = is.read...
use crate::{ parser::grammar::{description, directive, document::is_definition, name, ty}, Parser, SyntaxKind, TokenKind, S, T, }; /// See: https://spec.graphql.org/draft/#UnionTypeDefinition /// /// *UnionTypeDefinition*: /// Description<sub>opt</sub> **union** Name Directives<sub>\[Const\] opt</sub> Unio...
//! # nlopt //! //! This is a wrapper for `nlopt`, a C library of useful optimization //! algorithms For details of the various algorithms, //! consult the [nlopt docs](https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/) use std::marker::PhantomData; use std::os::raw::{c_uint, c_ulong, c_void}; use std::slice; ...
/** * [516] Longest Palindromic Subsequence * * Given a string s, find the longest palindromic subsequence's length in s. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.   Example 1: Input: s = "bbbab" Output:...
use super::code_editor::CodeGenie; use super::code_editor::InsertionPoint; use super::code_generation; use cs::env_genie::EnvGenie; use cs::structs; use cs::{enums, lang}; use itertools::Itertools; use lazy_static::lazy_static; use objekt::clone_trait_object; use serde_derive::{Deserialize, Serialize}; use crate::cod...
#![no_std] #![no_builtins] pub mod evaluator; pub mod prim; pub mod mem;
use std::io; fn to_celsius(farenheit: f32) -> f32 { (farenheit - 32.0) * (5.0/9.0) } fn get_fahrenheit_from_user() -> f32 { println!("Enter temperature in farenheit"); let mut farenheit = String::new(); io::stdin().read_line(&mut farenheit) .expect("Failed to read line"); let farenheit:...
//! First version of the Fractal Global Credits API. use std::io::Read; use hyper::Client as HyperClient; use hyper::header::{Headers, Accept, qitem}; use hyper::status::StatusCode; use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value}; use hyper::method::Method; use hyper::client::response::Response; use rustc_s...
use std::sync::Arc; use crate::graphics::renderer_3d::mesh::{MeshVBOType, MeshIBOType, MeshCulling, MeshAccess, Vertex3D}; use vulkano::buffer::{BufferAccess, BufferUsage, ImmutableBuffer}; use vulkano::device::Queue; use vulkano::sync::GpuFuture; use cgmath::Matrix4; /// Static `MeshData`, constant, doesn't change //...
use super::*; use error::ResultExt; pub struct RuleIter<'a, I, RInfo: 'a> { pub(crate) node: &'a Node<RInfo>, pub(crate) rules: I, } #[derive(Debug)] pub struct Rule<'a> { pub(crate) syn: &'a syntax::style::Rule, pub(crate) vars: HashMap<String, Value>, } impl <'a> Rule<'a> { pub(crate) fn eval_v...
use bevy::{ prelude::*, render::camera::Camera, }; use crate::data::level::*; use crate::data::player::*; use crate::data::sprite::TILE_SIZE; pub fn update_camera( map_scale: Res<MapScale>, mut query_set: QuerySet<( Query<(&Transform, &Player)>, Query<(&mut Transform, &Camera)>, ...
use crate::EntityId; #[derive(Debug)] pub struct NetworkSynchronization(pub EntityId);
use live_prop_test::live_prop_test; use std::cell::RefCell; use std::time::Duration; mod utils { pub mod expensive_test_tracking; } use utils::expensive_test_tracking::*; #[live_prop_test(postcondition = "cheap_test(tracker)")] pub fn function_with_cheap_test(tracker: &RefCell<TestTracker>) { tracker.borrow_mut(...
use crate::operations::io::BraindamageIo; // +,- // {^.°} // <[@]> // : ; use crate::buffer::VecBuffer; use crate::{Instruction, Cell}; use crate::operations::io::console_io::ConsoleIo; use crate::operations::io::file_io::FileIo; use std::num::Wrapping; pub struct Interpreter<'a, T: Cell> { buffer: Vec...
fn main() { let x = 10; let result = { let y = 100; y * x }; println!("Resultado da expressão: {}", result); // 1000 }
use libc::{c_char, c_int, c_void}; use llvm_lib::transforms::{ipo::*, pass_builder::*, pass_manager_builder::*, scalar::*, vectorize::*}; use llvm_lib::{ analysis::*, bit_reader::*, bit_writer::*, comdata::*, core::*, error::*, error_handling::*, execution_engine::*, initialization::*, ir_reader::*, object::*, ...
extern crate regex; use std::io::{self, BufRead}; use regex::Regex; fn input() { println!("input id: "); let mut id = String::new(); id.clear(); let stdin = io::stdin(); stdin.lock().read_line(&mut id) .expect("input Error"); let id = id.trim(); check(&id) } fn check(id: &str) { ...
use serde_derive::Deserialize; use crate::query_ir::MemberType; use super::aggregator::Aggregator; use super::{DimensionType, MeasureType}; #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct SchemaConfigJson { pub name: String, pub shared_dimensions: Option<Vec<SharedDimensionConfigJson>>, pub cu...
pub mod util; #[cfg(test)] mod tests { use serde::de::Unexpected::Char; #[test] fn test1() { use crate::util::tx::Tx; use crate::util::utxo::Utxo; use crate::util::block::Block; use crate::util::chain::Chain; use crate::util::func; use std::fs::File; ...
use anyhow::Result; use noa_compositor::compositor::Compositor; use crate::editor::Editor; use super::Action; pub struct GoToLine; impl Action for GoToLine { fn name(&self) -> &'static str { "goto_line" } fn run(&self, _editor: &mut Editor, _compositor: &mut Compositor<Editor>) -> Result<()> {...
extern crate util; extern crate knot_hash; extern crate petgraph; use util::{is_tty, prompt}; use knot_hash::{KnotHash, Digest}; type MemoryMap = Box<[[u8; 16]; 128]>; fn make_memory_map(khash : &mut KnotHash, input : &str) -> MemoryMap { use std::fmt::Write; let mut mem_map = Box::new([[0; 16]; 128]); ...
#[derive(Debug, Clone, Copy)] pub struct Average<T>{ av : T, index: u32 } impl Average<f64> { pub fn new(start_value: f64) -> Average<f64> { Average{ av: start_value, index: 0 } } pub fn add(&mut self, value: f64){ if value.is_normal() { s...
use rayfork::ffi; use rayfork::prelude::*; fn main() { let builder = RayforkBuilder::new().build(|_, _, _, rf, rt| { unsafe { ffi::rf_begin_drawing(); ffi::rf_clear_background(ffi::rf_color { r: 0, g: 254, b: 254, a: 25...
#![allow(non_snake_case)] #[macro_use] extern crate log; use byteorder::LittleEndian; use std::io::Cursor; mod camera; mod data_type; mod error; mod read; pub use self::camera::Camera; pub use self::data_type::{DataType, FormData}; pub use self::error::Error; pub use self::read::Read; pub type ResponseCode = u16; ...
//! URLs and handlers for nagivation events. use std::collections::HashMap; use std::collections::HashSet; use std::fmt; use crate::dex::Dex; use crate::ui::component::Component; /// A `pdex`-scheme URL, which is a subset of an HTTP URL, but without an /// origin. pub struct Url<'url> { str: &'url str, path: Vec...