text
stringlengths
8
4.13M
pub mod any_series; pub mod context; pub mod data_src; pub mod error_format; pub mod exp; pub mod function; pub mod instance_caller; pub mod op; pub mod output; pub mod runtime_convert; pub mod statement; pub use any_series::*; pub use context::*; pub use data_src::*; pub use error_format::*; pub use output::*; // use...
#[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::IRQ_FLAG { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w ...
use serde::{Deserialize, Serialize}; #[repr(C)] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct CodeAnnotation { pub name: String, pub key_values: Vec<AnnotationKeyValue> } #[repr(C)] #[derive(Serialize, Deserialize, Debug, Clone)] pub struct AnnotationKeyValue { pub key: String, pub values...
pub mod dialog_ffi; mod dialog_future; use dialog_ffi::IDialog; use dialog_future::{multiple_return_future, single_return_future}; use crate::backend::DialogFutureType; use crate::FileDialog; use crate::FileHandle; use std::path::PathBuf; use winapi::shared::winerror::HRESULT; use super::utils::init_com; // // Fi...
use super::{Node, Segment}; use std::cmp::min; /// Defines something that may be interpolated #[derive(Debug, PartialEq)] pub enum Interpolatable { String(String), Interpolated(Vec<Node>), } impl From<Vec<Segment>> for Interpolatable { fn from(item: Vec<Segment>) -> Self { let mut tokens: Vec<Node...
// Copyright 2022 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 ...
//! https://github.com/lumen/otp/tree/lumen/lib/megaco/src/app use super::*; test_compiles_lumen_otp!(megaco); fn includes() -> Vec<&'static str> { let includes = super::includes(); // includes.push("lib/inets/src/http_client"); includes } fn relative_directory_path() -> PathBuf { super::relative_d...
use crate::{map_unit_fn::OPTION_MAP_UNIT_FN, matches::MATCH_AS_REF}; use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::higher::IfLetOrMatch; use clippy_utils::source::{snippet_with_applicability, snippet_with_context}; use clippy_utils::ty::{is_type_diagnostic_item, peel_mid_ty_refs_is_mutable}; use ...
//! A flat representation of memory provided by lifters, typically used in a //! read-only fashion //! //! This memory model implements the `TranslationMemory` trait, allowing lifters //! to use it to lift instructions. use crate::architecture::Endian; use crate::executor; use crate::il; use crate::memory::MemoryPermi...
use super::{ and::And, or::Or, passthrough::Passthrough, ActiveFilter, DynamicFilter, FilterResult, GroupMatcher, LayoutFilter, }; use crate::internals::{query::view::Fetch, storage::component::ComponentTypeId, world::WorldId}; /// A filter which negates `F`. #[derive(Debug, Clone, Default)] pub struct Not<F> ...
//! Implementations of the callbacks exposed by wlc. //! These functions are the main entry points into Way Cooler from user action. use rustwlc::handle::{WlcOutput, WlcView}; use rustwlc::types::*; use super::keys; use super::layout::{lock_tree, try_lock_tree, TreeError}; use super::lua; use ::modes::{write_current_...
extern crate hyper; extern crate serde; extern crate serde_json; use hyper::Server; use hyper::server::Request; use hyper::server::Response; use hyper::header::Headers; use hyper::header::Server as ServerHeader; use hyper::header::ContentType; use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value}; struct PingRes...
use challenges::random_bytes; use cipher::{cbc::AES_128_CBC, Cipher}; fn main() { println!("🔓 Challenge 27"); let key = Key::new(); key_recovery_attack(&key); } fn key_recovery_attack(key: &Key) { let pt_0 = b"yellow submarine".to_vec(); let pt_1_2 = b"1234567890abcdef1234567890abcdef".to_vec(); ...
pub mod caputre_packets; pub mod crypt; pub mod decrypter; pub mod mem; mod packet; use std::sync::mpsc::{channel, Receiver}; use std::time::Instant; pub use packet::Direction; pub use packet::PoePacket; #[derive(Debug)] pub enum Error { NoKey, KeyWrongSize, KeyDiffer, WrongKey, NoPermission, ...
// xfail-stage0 // -*- rust -*- use std; import std._uint; fn main() { check (_uint.next_power_of_two(0u) == 0u); check (_uint.next_power_of_two(1u) == 1u); check (_uint.next_power_of_two(2u) == 2u); check (_uint.next_power_of_two(3u) == 4u); check (_uint.next_power_of_two(4u) == 4u); check (_uint.next_po...
use super::*; use proptest::strategy::Strategy; #[test] fn without_big_integer_returns_true() { run!( |arc_process| { ( strategy::term::integer::big(arc_process.clone()), strategy::term(arc_process.clone()) .prop_filter("Right must not be a b...
pub use self::static_prop_dict::StaticPropDict; pub use self::game::*; mod static_prop_dict; mod game;
//! This crate provides barebone, slice-based parsers for extracting [request //! line](https://tools.ietf.org/html/rfc7230#section-3.1.1) components and [header //! fields](https://tools.ietf.org/html/rfc7230#section-3.2) from HTTP requests. //! //! In general, components are extracted along defined delimiters, but fu...
#[doc = "Reader of register PRUART"] pub type R = crate::R<u32, super::PRUART>; #[doc = "Reader of field `R0`"] pub type R0_R = crate::R<bool, bool>; #[doc = "Reader of field `R1`"] pub type R1_R = crate::R<bool, bool>; #[doc = "Reader of field `R2`"] pub type R2_R = crate::R<bool, bool>; #[doc = "Reader of field `R3`"...
use super::simple8b; use integer_encoding::*; use std::error::Error; // Encoding describes the type of encoding used by an encoded timestamp block. enum Encoding { Uncompressed = 0, Simple8b = 1, Rle = 2, } /// encode encodes a vector of signed integers into a slice of bytes. /// /// To maximise compressi...
mod decoder; fn main() { let decoder = decoder::Decoder; let mut harness = toml_test_harness::DecoderHarness::new(decoder); harness .ignore([ "valid/spec/float-0.toml", // Test issue; `Decoder` turns `6.626e-34` into `0.0` // Unreleased "valid/string/escape-esc.t...
// 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 ...
use std::f64::NAN; pub fn pli_eq(x0: f64, dx: f64, y: Box<[f64]>) -> Box<dyn Fn(f64)->f64> { return Box::new(move |x: f64| -> f64 { let k = ((x-x0)/dx) as usize; let y1 = match y.get(k) {Some(value)=>*value, None=>return NAN}; let y2 = match y.get(k+1) {Some(value)=>*value, None=>return NA...
use std::fs::File; use std::io::{ErrorKind, Read}; use std::env; use std::path::Path; mod meta; mod parser; mod render; fn main() { let args: Vec<_> = env::args().collect(); let program = args[0].clone(); let mut opts = getopts::Options::new(); opts.optopt("o", "output", "output dir", "ou...
extern crate reqwest; #[macro_use] extern crate serde_derive; extern crate serde_json; use std::collections::HashMap; use std::io::{copy, Read, stdout}; use reqwest::RequestBuilder; #[derive(Debug, Deserialize)] struct Move { name: String, } #[derive(Debug, Deserialize)] struct PokemonMove { #[serde(rename ...
//! EV3 specific features use std::fs; use std::cell::RefCell; use std::collections::HashMap; use std::collections::HashSet; use std::fmt; use std::fs::File; use std::os::unix::io::AsRawFd; use std::path::Path; use std::rc::Rc; use crate::driver::DRIVER_PATH; use crate::utils::OrErr; use crate::{Attribute, Ev3Result...
use anyhow::{bail, Result}; use serde::Deserialize; use serde_json::Value; use tokio::sync::OnceCell; use tracing::info; static CACHED_KEYS: OnceCell<Vec<Jwk>> = OnceCell::const_new(); #[derive(Debug, Deserialize)] pub struct Jwk { pub kid: String, pub e: String, pub n: String, } pub async fn keys() -> R...
use std::env; use actix_identity::{Identity, IdentityPolicy, IdentityService}; use actix_web::{ dev::{ServiceRequest, ServiceResponse}, error, }; use chrono::{Duration, Utc}; use futures_util::future::{ok, Ready}; use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation}; use serde::{Des...
fn main() { let x = true; assert!(x); let a = 3; let b = 1+2; assert_eq!(a, b); }
pub use self::file::*; pub use self::memory::memory_stream::MemoryStream; pub use self::stream_rw::stream_reader::StreamReader; pub use self::stream_rw::stream_writer::StreamWriter; use std::error::Error; use StreamError; use StreamErrorKind; pub mod file; pub mod memory; pub mod stream_rw; // Specifies the posit...
mod atom; mod id; use std::sync::Arc; use proptest::arbitrary::any; use proptest::strategy::{BoxedStrategy, Strategy}; use liblumen_alloc::erts::Node; use crate::runtime::distribution::nodes; pub fn external() -> BoxedStrategy<Arc<Node>> { (id::external(), atom::external(), any::<u32>()) .prop_map(|(id...
//! ```elixir //! # label 6 //! # pushed to stack: (parent, reference_child) //! # returned form call: {:ok, new_child} //! # full stack: ({:ok, new_child}, parent, reference_child) //! # returns: {:ok, inserted_child} //! {:ok, inserted_child} = Lumen.Web.insert_before(parent, new_child, reference_child) //! ``` use ...
#![cfg_attr(feature = "microbit", no_std)] #![cfg_attr(feature = "microbit", no_main)] #![macro_use] #![allow(incomplete_features)] #![feature(generic_associated_types)] #![feature(const_fn_fn_ptr_basics)] #![feature(type_alias_impl_trait)] #![feature(concat_idents)] mod app; mod device; use device::*; use embassy::ex...
fn main() { let a = -121; println!("{:?}", is_palindrom(a)); } fn is_palindrom(x: i32) -> bool { x.to_string() == x.to_string().chars().rev().collect::<String>() }
use std::ffi::c_void; use std::mem; use std::ptr::NonNull; use liblumen_alloc::erts::exception::InternalResult; use liblumen_alloc::erts::term::prelude::*; use liblumen_alloc::erts::Process; use super::{atom, small_integer}; use liblumen_alloc::erts::apply::find_symbol; use liblumen_alloc::ModuleFunctionArity; pub f...
#[doc = "Reader of register CONF0R"] pub type R = crate::R<u32, super::CONF0R>; #[doc = "Writer for register CONF0R"] pub type W = crate::W<u32, super::CONF0R>; #[doc = "Register CONF0R `reset()`'s with value 0"] impl crate::ResetValue for super::CONF0R { type Type = u32; #[inline(always)] fn reset_value() ...
use clippy_utils::diagnostics::span_lint_and_help; use rustc_hir::{HirId, Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::Const; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::sym; declare_clippy_lint! { /// ### What it does /// Displays a warning...
use std::fs::{self, File}; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use anyhow::bail; use filetime::{set_file_times, FileTime}; const ABOUT: &'static str = " szip compresses and decompresses data in the Snappy format. szip works similarly to gzip. It takes files as parameters, compresses the...
pub struct Solution; #[derive(PartialEq, Eq, Clone, Debug)] pub struct ListNode { pub val: i32, pub next: List, } type List = Option<Box<ListNode>>; impl Solution { pub fn remove_elements(head: List, val: i32) -> List { let mut head = head; let mut cur = &mut head; while cur.is_so...
// // mod.rs // Copyright (C) 2019 Malcolm Ramsay <malramsay64@gmail.com> // Distributed under terms of the MIT license. // pub mod atom2; pub mod atom2_ops; pub mod line2; pub mod line2_ops; pub mod lj2; pub mod lj2_ops; pub use atom2::Atom2; pub use line2::Line2; pub use lj2::LJ2;
#![recursion_limit = "256"] #[macro_use] extern crate stdweb; use crate::components::svgmap::SVGMap; use crate::data::input::SCENARIO; use crate::data::schema::SchemaData; use crate::engine::worker::{Worker, WorkerRequest, WorkerResponse}; use crate::sections::appbar::AppBar; use crate::sections::infopanel::InfoPanel; ...
use std::sync::Arc; use proptest::strategy::{BoxedStrategy, Strategy}; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; pub fn with_arity(arc_process: Arc<Process>, arity: u8) -> BoxedStrategy<Term> { ( super::super::module_atom(), super::index(), su...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - MPCBB control register"] pub mpcbb1_cr: MPCBB1_CR, _reserved1: [u8; 12usize], #[doc = "0x10 - MPCBB control register"] pub mpcbb1_lckvtr1: MPCBB1_LCKVTR1, #[doc = "0x14 - MPCBB control register"] pub mpcbb1_lckv...
// Copyright 2015 MaidSafe.net limited // This MaidSafe Software is licensed to you under (1) the MaidSafe.net Commercial License, // version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which // licence you accepted on initial access to the Software (the "Licences"). // By contributin...
// 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 { fidl::encoding::OutOfLine, fidl_fuchsia_net_policy::{ObserverRequest, ObserverRequestStream}, fidl_fuchsia_net_stack::StackProxy, fuc...
use std::collections::HashSet; fn main() { let n = read::<usize>(); let s = read::<String>(); let s = s.as_bytes(); let mut k = Vec::<usize>::new(); for i in 2..n { let mut kind = HashSet::<u8>::new(); for ss in s.iter().skip(i) { kind.insert(*ss); } k.pu...
use libc::{abort, c_char, c_int, exit, pid_t, EAGAIN}; use std::ffi::CStr; use wasmer_runtime_core::Instance; pub extern "C" fn abort_with_message(message: &str) { debug!("emscripten::abort_with_message"); println!("{}", message); _abort(); } pub extern "C" fn _abort() { debug!("emscripten::_abort");...
#![deny(warnings)] #![deny(missing_docs)] //! A real-time graphing experiment. //! //! rt-graph uses GTK (via the gtk-rs Rust bindings) for its UI and is //! designed to be embedded into any gtk::Container in your //! application. #[macro_use] extern crate derive_builder; #[macro_use] extern crate log; use std::fmt...
//! Publications ページ use yew::prelude::*; pub struct Publications {} impl Component for Publications { type Message = (); type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Self {} } fn update(&mut self, _: Self::Message) -> ShouldRender { fals...
// 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 carnelian::{ App, AppAssistant, Color, Label, Paint, Point, Rect, Size, ViewAssistant, ViewAssistantContext, ViewAssistantPtr, }; use failure::...
// RGB standard library // Written in 2020 by // Dr. Maxim Orlovsky <orlovsky@pandoracore.com> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring rights to this software to // the public domain worldwide. This software is distributed without // any warr...
use syn::export::{Span, ToTokens}; use syn::parse::{Parse, ParseStream}; use syn::punctuated::Punctuated; use syn::{parenthesized, token, Error, Ident, ImplItemMethod, Token}; pub struct CallbackArgs { #[allow(dead_code)] paren_token: token::Paren, args: Punctuated<Ident, Token![,]>, } impl Parse for Call...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless ...
mod compilation; pub use compilation::WasmCompilation; mod hostcall; pub use hostcall::Hostcall; mod event_processing; pub use event_processing::EventProcessing; #[derive(Debug, PartialEq, Eq, Clone, Copy)] enum State { Beginning, Cached, Completed, } impl State { /// Cheaply turn into a `&'static s...
use proconio::input; fn main() { input! { n: usize, m: usize, mut a: [usize; n], }; a.sort(); let mut b = a.clone(); b.extend(a.clone()); // eprintln!("{:?}", b); let mut sums = Vec::new(); let mut last = 0; for i in 0..n { if i < last { ...
//! Capstone-based translator for 32-bit x86. use crate::il::*; use crate::translator::x86::mode::Mode; use crate::translator::{unhandled_intrinsic, BlockTranslationResult, Options}; use crate::Error; use falcon_capstone::{capstone, capstone_sys}; use crate::translator::x86::semantics::Semantics; fn ensure_block_ins...
use quirc::client::*; fn main() { println!("Hello, world!"); let _client = Client::connect(String::from("localhost:6667"), String::from("quirc-bot")); }
use crate::algebra::linear::{Scalar, Vector}; use fructose::algebra::lattice::Lattice; use fructose::operators::{ ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedOps, ClosedRem, ClosedSub, }; use fructose::properties::helpers::identity::{One, Zero}; use fructose::properties::helpers::sign::Signed; use std::alloc:...
use std::env; use std::time::{Duration, Instant}; use crate::contributor::Contributor; use crate::pension::Pension; use crate::pensioner::Pensioner; use crate::types::*; use crate::user::User; pub mod contributor; pub mod doneuser; pub mod pension; pub mod pensioner; pub mod types; pub mod user; pub mod calculations;...
use std::sync::Arc; use futures_core::future::BoxFuture; use crate::connection::ConnectionSource; use crate::cursor::Cursor; use crate::executor::Execute; use crate::pool::Pool; use crate::postgres::protocol::{DataRow, Message, ReadyForQuery, RowDescription}; use crate::postgres::row::Statement; use crate::postgres::...
use actix::{Actor, Context, Handler, System}; use actix_derive::{Message, MessageResponse}; #[derive(MessageResponse)] struct Added(usize); #[derive(Message)] #[rtype(result = "Added")] struct Sum(usize, usize); #[derive(Default)] struct Adder; impl Actor for Adder { type Context = Context<Self>; } impl Handle...
use std::{ collections::{HashMap, HashSet}, hash::BuildHasherDefault, ops::{Deref, DerefMut, Index, IndexMut}, sync::atomic::{AtomicU64, Ordering}, }; use archetype::ArchetypeIndex; use component::{Component, ComponentTypeId}; use downcast_rs::{impl_downcast, Downcast}; use crate::internals::hash::Com...
#![warn(clippy::pedantic)] use failure::Error; use fnv::FnvHashSet as HashSet; use hyper; use ini::Ini; use lazy_static::lazy_static; use mozlz4::decompress; use rayon::{prelude::*, ThreadPoolBuilder}; use regex::Regex; use reqwest::{ blocking::{Client, Response}, header::{self, HeaderMap, HeaderValue}, Sta...
pub use io_uring_callback::IoUring; /// A provider of an io_uring singleton. /// /// This helper trait is intended to decouple the user of an IoUring instance /// (here, a Socket instance) from the creater of an singleton of IoUring (e.g., a runtime). /// And it frees each instance of a user type from storing their own...
use rustc::middle::{ty, def}; use rustc::middle::ty::MethodCall; use syntax::{ast, ast_util, ast_map}; use syntax::codemap::Span; use syntax::parse::token; use syntax::visit; use syntax::visit::Visitor; use std::fmt; use std::mem::replace; use std::collections::BTreeMap; fn type_is_unsafe_function(ty: ty::Ty) -> boo...
use std::cmp; use std::collections::HashMap; mod utils; fn main() { let data = utils::load_input("./data/day_10.txt").unwrap(); let mut nbs: Vec<u32> = data.lines().map(|nb| nb.parse().unwrap()).collect(); nbs.push(0); nbs.sort_unstable(); nbs.push(nbs.last().unwrap() + 3); let mut diff: (u...
extern crate csv; extern crate rustc_serialize; extern crate image; extern crate num; mod color_calc; mod eq; mod fileformat; mod image_create; pub use eq::mandelbrot_divergence; pub use fileformat::parse_frame; pub use image_create::gen_png; pub use image_create::write_png; pub use image_create::Frame; pub use imag...
use crate::types::{HitRecord, Hitable, Material, Ray, Vec3}; pub struct Sphere { center: Vec3, radius: f64, material: Option<Box<dyn Material>>, } impl Sphere { pub fn new(center: Vec3, radius: f64) -> Self { Self { center, radius, material: None, } ...
use std::io::prelude::*; use std::str::FromStr; fn ans( i : Vec<f64> ) -> (f64,f64) { let a = i[0]; let b = i[1]; let c = i[2]; let d = i[3]; let e = i[4]; let f = i[5]; let x = ( (c*e - b*f) / (a*e - b*d) * 1000.0).round() / 1000.0; let y = ( (c*d - a*f) / (b*d - a*e) * 10...
#![allow(dead_code)] #[cxx::bridge] mod ffi { extern "Rust" { type MultiCxx2Thing; fn another_new_thing(id: i64) -> Box<MultiCxx2Thing>; fn another_print_thing(thing: Box<MultiCxx2Thing>); fn another_print_thing_ref(thing: &Box<MultiCxx2Thing>); } } use super::thing; #[repr(C...
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::convert::TryInto; use cosmwasm_std::{Addr, Binary, Coin, StdError, StdResult, Timestamp, Uint128}; use cw721::{Expiration, OwnerOfResponse}; use cw721_base::msg::{ExecuteMsg as CW721ExecuteMsg, QueryMsg as CW721QueryMsg}; use cw721_base::state::Ap...
extern crate cursive; use cursive::Cursive; use cursive::views::TextView; fn main() { let mut siv = Cursive::new(); siv.add_layer(TextView::new("Hello World!\nPress q to quit.")); siv.add_global_callback('q', |s| s.quit()); siv.run(); println!("Hello, world!"); }
use rustc_codegen_ssa::traits::PreDefineMethods; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mir::mono::{Linkage, Visibility}; use rustc_middle::ty::{self, Instance, TypeFoldable}; use rustc_middle::ty::layout::FnAbiExt; use rustc_span::def_id::DefId; use rustc_target::abi::LayoutO...
pub mod background; pub mod border; pub mod graphical; pub mod label; pub mod scroll; pub mod text_block; pub mod text_box;
use amethyst::{ assets::Handle, core::Transform, ecs::{Component, DenseVecStorage}, prelude::{Builder, WorldExt}, renderer::{SpriteRender, SpriteSheet}, shred::World, }; use crate::settings::{ARENA_HEIGHT, ARENA_WIDTH, PADDLE_HEIGHT, PADDLE_WIDTH}; /// Enum used to identify the left/right padd...
//! This module fixes the incorrect handling of fixed values in the schema use crate::schema_registry::SRCError; use avro_rs::schema::{RecordField, UnionSchema}; use avro_rs::types::{ToAvro, Value}; use avro_rs::Schema; use std::collections::HashMap; pub trait FixedFixer { fn fix_fixed(self, schema: &Schema) -> R...
use crate::{instruction::Instruction, registers::Registers}; use failure::{bail, format_err, Error}; use hashbrown::HashSet; use std::path; #[derive(Debug, Default)] pub struct Device { /// If the device is halted. pub halted: bool, /// Loaded instructions. pub instructions: Vec<Instruction>, pub r...
use super::widget::Widget; use std::borrow::Cow; use tui::{ backend::CrosstermBackend, layout::{Alignment, Rect}, widgets::{Block, Borders, Paragraph, Text}, Frame, }; /// A widget showing the current status of the emulator (running, ...) pub struct Status { status: &'static str, } impl Status { ...
use core::fmt; use std::{collections::HashSet, cmp::{min, max}}; fn main() { let mut input = include_str!("input").split("\r\n\r\n"); let mut paper: Paper = input.next().unwrap().parse().unwrap(); let mut folds = input.next().unwrap().lines().map(|s| { let line = s.split(" ").last().unwrap(); ...
/* Utility functions Warning: some of these functions are Linux-specific. */ use chrono::offset::Local; use nix::sys::wait::{waitpid, WaitStatus}; use nix::unistd::{fork, ForkResult}; use rand::Rng; use std::boxed::Box; use std::fmt::Debug; use std::fs::{File, OpenOptions}; use std::io::{self, prelude::*, Bu...
use enigo::*; use rand::*; use std::thread::sleep; use std::time::Duration; fn main() { let mut enigo = Enigo::new(); loop { let mut rng = rand::thread_rng(); let random_time = rng.gen_range(0, 20); let x = rng.gen_range(300, 2200); let y = rng.gen_range(150, 1400); sle...
use std::cmp; use std::fmt; use super::*; use super::pop_count_sum; #[inline] fn upper_block_len(n: usize) -> usize { (n / (64 << 20)) + 1 } #[inline] fn lower_block_len(n: usize) -> usize { (n / (4 * 8)) + 1 } #[inline] fn to_lower_elem(l1: u64, u0: u64, u1: u64, u2: u64) -> u64 { let l2_0 = u0 << 32; ...
use fraction::ToPrimitive; use crate::io::*; pub const DURATION_QUARTER_TIME: i64 = 960; //pub const DURATION_WHOLE: u8 = 1; //pub const DURATION_HALF: u8 = 2; pub const DURATION_QUARTER: u8 = 4; pub const DURATION_EIGHTH: u8 = 8; pub const DURATION_SIXTEENTH: u8 = 16; pub const DURATION_THIRTY_SECOND: u8 = 32; pub co...
mod camera; mod hittable; mod ray; mod aabb; mod bvh; pub mod materials; pub mod models; pub mod textures; pub use camera::Camera; pub use hittable::HitRecord; pub use hittable::Hittable; pub use ray::Ray; pub use aabb::Aabb; pub use bvh::Bvh;
mod othermain; fn main() { println!("0xff") }
// Copyright 2022 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 ...
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
pub mod decisiondatafetcher;
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug)] pub struct VkSparseImageFormatProperties2KHR { pub sType: VkStructureType, pub pNext: *const c_void, pub properties: VkSparseImageFormatProperties, } impl VkSparseImageFormatProperties2KHR { pub fn new(properti...
use std::{iter::Cycle, vec::IntoIter}; use amethyst::{ assets::{AssetStorage, Loader}, audio::{output::Output, OggFormat, Source, SourceHandle}, prelude::WorldExt, shred::World, }; use crate::settings::{BOUNCE_SFX, MUSIC_TRACKS, SCORE_SFX}; pub struct Sounds { pub score_sfx: SourceHandle, pub...
use rusoto_s3::S3Client; use crate::s3::S3Filesystem; #[derive(Default)] pub struct S3FilesystemBuilder { bucket: Option<String>, client: Option<S3Client>, prefix: Option<String>, acl: Option<String>, cache_control: Option<String>, content_type: Option<String>, } impl S3FilesystemBuilder { ...
#[cfg(feature = "codegen")] mod tests { use std::fmt::Debug; use legion::{ storage::Component, system, systems::CommandBuffer, world::SubWorld, Entity, Schedule, }; #[test] fn empty() { #[system(for_each)] fn for_each(_: &Entity) {} Schedule::builder().add_system(f...
use crate::ast; use crate::{Spanned, ToTokens}; /// An index get operation `<target>[<index>]`. #[derive(Debug, Clone, PartialEq, Eq, ToTokens, Spanned)] pub struct ExprIndex { /// Attributes associated with expression. #[rune(iter)] pub attributes: Vec<ast::Attribute>, /// The target of the index set....
use std::{env, process}; use getopts::Options; pub use print_queue::queue; pub use print_queue::user; use user::create_uid_username_mapping; /// Display usage information. Used for handling the "-h" or "--help" flags if passed, or if the Slack /// API key was not given, as that is a _required_ command line argument....
use crate::{ math::{Size, Vector2}, widgets::{TypedWidget, Widget}, Backend, }; pub mod click; /// A Controller is a bit of logic that reacts to a specific Event type. pub trait Controller<T, W: Widget<T>> { type Event; type Reaction; fn event( &mut self, child: &mut W, ...
mod widgets; extern crate regex; extern crate simplelog; extern crate crossterm; use std::collections::HashMap; use std::fs::File; use std::sync::mpsc; use std::sync::mpsc::{Receiver, Sender}; use std::thread; use simplelog::*; use log::info; use crate::runner::TaskRunner; use crate::tasks::Layout; use std::thread:...
extern crate proc_macro; extern crate syn; #[macro_use] extern crate quote; use proc_macro::TokenStream; #[proc_macro_derive(AnnounceDrop)] pub fn announce_drop(input: TokenStream) -> TokenStream { let source = input.to_string(); let ast = syn::parse_derive_input(&source).unwrap(); let name = &ast.ident;...
use std::fs::File; use std::io::{self, prelude::*, BufReader}; use std::str::FromStr; use std::num::ParseIntError; use std::fs; #[derive(Debug,PartialEq)] enum Tile { Tree, Empty } #[derive(Debug)] struct ForestMap { tiles: Vec<Vec<Tile>>, } impl FromStr for ForestMap { type Err = ParseIntError; ...
use std::sync::mpsc; use std::sync::Arc; use std::sync::Mutex; use failure::Error; use log::*; use serde; use crate::protocol::browser::methods::GetVersion; pub use crate::protocol::browser::methods::VersionInformationReturnObject; use crate::protocol::target::methods::{CreateTarget, SetDiscoverTargets}; use crate::...
use regex::{mod, Regex}; use std::io::File; use std::collections::HashMap; use std::fmt::{mod, Show, Formatter}; use std::from_str::FromStr; macro_rules! opt_chain { ($str: expr => $($wrapper: ident)|*) => { None $(.or_else(|| from_str($str).map($wrapper)))* } } #[deriving(Clone)] struct...