text
stringlengths
8
4.13M
use crate::vec3::Vec3; use crate::ray::Ray; pub struct Camera { pub vfov: f64, pub aspect: f64, pub look_from: Vec3, pub look_at: Vec3, pub look_up: Vec3 } impl Camera { pub fn new( look_from: Vec3, look_at: Vec3, look_up: Vec3, vfov: f64, aspect: f64) -> Camera { Camera { look_from, ...
use wasm_bindgen::prelude::*; use crate::game::*; use crate::ai; use crate::ai::types::*; #[wasm_bindgen] pub struct GameJs { game: Game } #[wasm_bindgen] impl GameJs { pub fn new(random_first_move: bool) -> GameJs { GameJs { game: Game::new(random_first_move) } } pub fn skip_turn(&mut self) { ...
#![recursion_limit = "1000"] extern crate proc_macro; extern crate syn; #[macro_use] extern crate quote; use proc_macro::TokenStream; use syn::Ident; use quote::Tokens; #[proc_macro_derive(IntoHeap)] pub fn derive_into_heap(input: TokenStream) -> TokenStream { let source = input.to_string(); let ast = syn::p...
use crate::*; extern "C" { type MlirSymbolTable; } /// This enum represents the visibility of a symbol in a symbol table #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum Visibility { /// The symbol is public and may be referenced anywhere internal or external /// to the visible reference...
#[macro_use] extern crate actix_web; #[macro_use] extern crate diesel; #[macro_use] extern crate diesel_migrations; mod chunker; mod db; mod external_id; mod graphql_schema; mod graphql_service; mod mk_certs; mod models; mod playlists_service; mod prng; mod schema; mod tracks_service; use std::sync::Arc; use actix_f...
use crate::hal::time::Hertz; use crate::hal::time::U32Ext; use alloc::string::String; use alloc::vec::Vec; use embedded_hal::timer::CountDown; pub type Result<T> = core::result::Result<T, crate::io::Error>; #[derive(Debug)] pub enum Error { Timeout, EOF, WriteError, ReadError, Other(String), B...
mod term; use std::io; use std::str::FromStr; fn main() { let mut input = String::new(); match io::stdin().read_line(&mut input) { Ok(_) => { match term::Term::from_str(&input) { Ok(t) => { println!("{}", term::normal_form(&t, term::Strategy::Normal)); ...
extern crate math; use math::round; use std::cmp::Ordering; use std::mem; // courtesy of https://stackoverflow.com/a/28294764 fn swap<T>(x: &mut Vec<T>, i: usize, j: usize) { let (lo, hi) = match i.cmp(&j) { // no swapping necessary Ordering::Equal => return, // get the smallest and large...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IWebApplicationActivation(pub ::windows::core:...
use std::collections::HashSet; fn part_1_solve(input_str: &str) -> i32 { input_str.lines().map(|x| x.parse::<i32>().unwrap()).sum() } fn part_2_solve(input_str: &str) -> i32 { let mut frequencies = HashSet::new(); let mut frequency = 0; let _ = input_str.lines().cycle().map(|x| x.parse::<i32>().unwr...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CallEnclave<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(lproutine: isize, lpparameter: *const ::co...
use alloc::vec::Vec; /// Trait to be implemented by a collection that can be extended from a slice /// /// ## Example /// /// ```rust /// use smallvec::{ExtendFromSlice, SmallVec}; /// /// fn initialize<V: ExtendFromSlice<u8>>(v: &mut V) { /// v.extend_from_slice(b"Test!"); /// } /// /// let mut vec = Vec::new(); ...
use std::thread; use tokio::sync::{broadcast, mpsc, watch}; pub mod consumer_state; mod tokio_server; pub fn start(port: u32) -> Result<(), ()> { // Server thread-alive channel. let (ser_thread_alive_tokio_tx, ser_alive_consumer_rx) = { watch::channel::<bool>(false) }; // Client connection event channel....
use std::collections::{HashMap, HashSet}; use std::io::{Write, stdin}; #[macro_use] mod error; mod client; mod cost; mod index; use crate::client::{Client, ItemId, Recipe, RecipeId}; use crate::cost::{Cost, Source}; use crate::error::Result; use crate::index::{Index, RecipeSource}; #[derive(Debug, Clone)] struct Pr...
#[cfg(test)] mod tests { use connectfour::*; #[test] fn board_with_one_item() { let mut board = Board::new(); board.drop_into(2, SlotState::Red); assert!(!board.check_for_winner()); } #[test] fn board_with_winning_row() { let mut board = Board::new(); board.drop_into(1, SlotState::Red); bo...
mod utils; mod sliding_square; use getrandom; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{console, CanvasRenderingContext2d, OffscreenCanvas, Performance}; use tetris::{Tetris, TetrisBuilder, Randomizer, MoveDirection, RotationDirection, TetrisAction}; #[cfg(feature = "wee_alloc")] ...
#![no_std] use core::{cmp::min, fmt}; pub use crypto_mac::Mac; use crypto_mac::{InvalidKeyLength, MacResult}; use digest::{ generic_array::sequence::GenericSequence, generic_array::{ArrayLength, GenericArray}, BlockInput, FixedOutput, Input, Reset, }; const IPAD: u8 = 0x36; const OPAD: u8 = 0x5c; /// The ...
use cpu::register::Register; use cpu::CPU; /// Perform and or between accumulator and register and put results into the accumulator /// /// Sets condition flags /// /// # Cycles /// /// * Register M: 7 /// * Other: 4 /// /// # Arguments /// /// * `cpu` - The cpu to perform the or in /// * `register` - The register to ...
#[derive(Clone, Debug, PartialEq, Eq)] pub enum TokenKind { Character(char), Number(usize), BraceString(String), } impl TokenKind { pub fn is_character(&self) -> bool { match self { TokenKind::Character(_) => true, _ => false, } } pub fn is_number(&self)...
use std::usize; use winit::event::{DeviceEvent, ElementState, Event, MouseScrollDelta, VirtualKeyCode}; use super::{ engine::Engine, window::{Window, WindowMode}, }; #[derive(Debug, PartialEq, Copy, Clone)] struct InputState { /// Stores whether a mouse button is held down mouse_held: [bool; 16], ...
use std::path::Path; use sdl2::event::Event; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::render::TextureQuery; use setup; const SCREEN_WIDTH: u32 = 640; const SCREEN_HEIGHT: u32 = 480; // handle the annoying Rect i32 macro_rules! rect( ($x:expr, $y:expr, $w:expr, $h:expr) => ( Rect::new($x...
use crate::{ nfa, util::{ id::{PatternID, StateID}, start::Start, }, }; /// An error that occurred during the construction of a DFA. /// /// This error does not provide many introspection capabilities. There are /// generally only two things you can do with it: /// /// * Obtain a human read...
//! This module implements the session setup request. //! The SMB2 SESSION_SETUP Request packet is sent by the client to request a new authenticated session //! within a new or existing SMB 2 Protocol transport connection to the server. //! This request is composed of an SMB2 header, followed by this request structure....
//! Tests for `#[derive(GraphQLInputObject)]` macro. pub mod common; use juniper::{ execute, graphql_object, graphql_value, graphql_vars, parser::SourcePosition, GraphQLError, GraphQLInputObject, RuleError, }; use self::common::util::schema; mod trivial { use super::*; #[derive(GraphQLInputObject)]...
use crate::fs::FileTypeTrait; use std::ffi::OsStr; use std::fmt::Debug; use std::fs; use std::io; use std::path::Path; pub trait DirEntryTrait: Debug { /// The full path that this entry represents. /// /// See [`walkdir::DirEntry::path`] for more details fn path(&self) -> &Path; /// Return `true` ...
use futures_util::future::BoxFuture; use crate::any::connection::AnyConnectionKind; use crate::any::{Any, AnyConnection}; use crate::database::Database; use crate::error::Error; use crate::transaction::TransactionManager; pub struct AnyTransactionManager; impl TransactionManager for AnyTransactionManager { type ...
pub use chain::*; pub use chain_btc::*; pub use chain_eee::*; pub use chain_eth::*; pub use error::*; pub use parameters::*; pub use setting::*; pub use traits::*; pub use types::*; pub use wallet::*; mod types; mod wallet; mod parameters; mod chain; mod chain_eth; mod chain_eee; mod chain_btc; mod error; mod traits; ...
pub mod core; /* */
mod game; mod mastermind; use clap::{App, Arg}; use std::io; const DEFAULT_COLORS_COUNT: u32 = 4; fn main() -> Result<(), io::Error> { let matches = App::new("MasterMind") .args(&[ Arg::new("len") .long("len") .short('l') .about("Sets the length...
use std::env::args; use std::net::UdpSocket; use std::str::from_utf8; fn main() -> std::io::Result<()> { let arguments: Vec<String> = args().collect(); let addr = &arguments[1]; let socket = UdpSocket::bind(addr)?; let mut buf = [0; 100]; let (amt, src) = socket.recv_from(&mut buf)?; println!(...
//! Tmux version checks use std::cmp::Ordering; /// Represents Tmux version. /// /// If for some reason `tmux -V` does not work, or can't parse the output /// Will return [TmuxVersion::Max]. #[derive(Debug, PartialEq)] pub enum TmuxVersion { Max, Version(usize, usize), } impl From<Option<&str>> for TmuxVersi...
// Copyright 2018 Benjamin Fry <benjaminfry@me.com> // // 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 exce...
#[macro_use] extern crate lazy_static; use clap::Clap; use regex::{Captures, Regex}; use std::fs::read_to_string; #[derive(Clap)] struct Opts { input: String, } fn main() -> Result<(), std::io::Error> { let opts: Opts = Opts::parse(); let input = read_to_string(opts.input)?; let count_valid = input ...
use crate::models::User; use crate::errors::ServiceError; use crate::schema::users; use crate::schema::user_tokens; use diesel::prelude::*; use crate::models::*; use diesel::r2d2::Pool; use diesel::r2d2::ConnectionManager; use crate::state::AppState; use crate::repositories::UserRepository; use serde::Deserialize; use ...
mod common; use common::{round_beam_intersect, round_cutoff, round_tp}; use crisscross::{BeamIntersect, Crossing, Grid, TilePosition, TileRaycaster}; #[test] fn last_valid() { let tc = TileRaycaster::new(Grid::new(4, 4, 1.0)); assert_eq!( tc.last_valid(&((0, 0.0), (0, 0.0)).into(), 30_f32.to_radians()...
// 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_fuchsia_net_ext as fidl_net_ext; use fuchsia_async; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use crate::tests::{assert_ping, TestSetup}; trai...
//! REST API types. /// Matrix REST API pub mod matrix; /// Generic REST API mod rest_api; /// Rocket.Chat REST API pub mod rocketchat; pub use self::matrix::MatrixApi; pub use self::rest_api::{RequestData, RestApi}; pub use self::rocketchat::RocketchatApi;
use std::io::{self, Write}; use super::{Stmt, Expr, BodyRef, Function, FunctionPrototype, ParsedModule}; const INDENT_STRING: &str = " "; const SUBITEM_INDENT: &str = " "; fn print_body<W: Write>(body: BodyRef, w: &mut W, indent: usize) -> io::Result<()> { for stmt in body { stmt.print(w, indent)?; ...
use super::logs::Log; use crate::commands::IteratorKind; use crate::errors::Error; use serde::{Deserialize, Serialize}; #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Itr { pub log: String, pub name: String, pub func: String, pub kind: IteratorKind, } impl Itr { pub fn next(&se...
use magnum_opus::Decoder; use byteorder::{ByteOrder, LittleEndian, ReadBytesExt}; use std::io::{self, Read, Write, Cursor}; /* https://github.com/s1lentq/revoice/blob/master/revoice/src/VoiceEncoder_Opus.cpp#L173-L255 acc//unttänään klo 07.07 after 0x06 there's 2 bytes which are "total length" then there's 2 bytes of...
use core::fmt; use std::fmt::{Debug, Formatter}; #[macro_export] macro_rules! if_opt { ($child_expr: expr, $some_expr: expr) => { if $child_expr { Some($some_expr) } else { None } }; } pub struct DebugFn<'a, F: Fn(&mut Formatter) -> fmt::Result>(pub &'a F); impl...
//! This module exposes bare C API functions. As most of them are provided with a "safe" wrapper //! function with an intuitive name and intuitive implementation for Rust, there is no gain to //! darely use these functions. //! //! The only exceptions are `k` and `knk` which are not provided with a "safe" wrapper be...
//! This module implements a SMB2 negotiate request //! The SMB2 NEGOTIATE Request packet is used by the client to notify the server what dialects of the SMB 2 Protocol the client understands. //! This request is composed of an SMB2 header, followed by this request structure. use rand::{ distributions::{Distributi...
use winapi::um::{ winuser::{WS_VISIBLE, WS_DISABLED, SS_WORDELLIPSIS}, wingdi::DeleteObject }; use winapi::shared::windef::HBRUSH; use crate::win32::window_helper as wh; use crate::win32::base_helper::check_hwnd; use crate::{Font, NwgError, HTextAlign, VTextAlign, RawEventHandler, unbind_raw_event_handler}; us...
//! Simple consensus runtime. use std::collections::BTreeMap; use oasis_runtime_sdk::{self as sdk, modules, types::token::Denomination, Version}; /// Simple consensus runtime. pub struct Runtime; impl sdk::Runtime for Runtime { const VERSION: Version = sdk::version_from_cargo!(); type Modules = ( mo...
//! Syscalls for process //! //! - fork //! - vfork //! - clone //! - wait4 //! - execve //! - gettid //! - getpid //! - getppid use super::*; use bitflags::bitflags; use core::fmt::Debug; use linux_object::fs::INodeExt; use linux_object::loader::LinuxElfLoader; use linux_object::thread::{CurrentThreadExt, ThreadExt};...
#[macro_use] extern crate nom; #[macro_use] extern crate derive_read_cstruct; use nom::IResult; use nom::le_u32; trait ReadCStruct { type Item; fn parse(input: &[u8]) -> IResult<&[u8], Self::Item>; } #[derive(PartialEq, Debug, ReadCStruct)] struct Person { age: u32, } fn main() { let input = &[0x10...
use std::fmt::Display; use std::path::PathBuf; use nu_ansi_term::Color; use crate::traits::{CompatibleWithObservations, CorpusDelta, Pool, SaveToStatsFolder, Sensor, Stats}; use crate::{CSVField, PoolStorageIndex, ToCSV}; const NBR_ARTIFACTS_PER_ERROR_AND_CPLX: usize = 8; pub(crate) static mut TEST_FAILURE: Option<...
extern crate futures; extern crate futures_cpupool; extern crate protobuf; extern crate grpc; extern crate tls_api; extern crate frank_jwt; pub mod jwt; pub mod jwt_grpc;
//! # Yet Another Progress Bar //! //! This library provides lightweight tools for rendering progress indicators and related information. Unlike most //! similar libraries, it performs no IO internally, instead providing `Display` implementations. Handling the details //! of any particular output device is left to the ...
#[doc = "Reader of register C1_AHB4LPENR"] pub type R = crate::R<u32, super::C1_AHB4LPENR>; #[doc = "Writer for register C1_AHB4LPENR"] pub type W = crate::W<u32, super::C1_AHB4LPENR>; #[doc = "Register C1_AHB4LPENR `reset()`'s with value 0"] impl crate::ResetValue for super::C1_AHB4LPENR { type Type = u32; #[i...
#[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::HB16TIME4 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R...
use super::{Blocks, Chunks, SuccinctBitVector}; impl SuccinctBitVector { /// Returns `i`-th element of the `SuccinctBitVector`. /// /// # Panics /// When _`i` >= length of the `SuccinctBitVector`_. pub fn access(&self, i: u64) -> bool { self.rbv.access(i) } /// Returns the number o...
use super::*; use crate::engine::{Event, Logger}; pub struct CliState { pub(crate) visible: bool, input: String, pub(crate) auto_focus: bool, pub(crate) auto_scroll: bool, } impl Default for CliState { fn default() -> Self { Self { visible: false, input: Default::...
pub mod board_logic; pub mod console_display; pub mod piece_logic; /// Engine for the boardgame "chess" /// /// Minimal interaction example: /// ``` /// fn example() -> Result<String, String> { /// # use maltebl_chess::{chess_game::*, *}; /// let mut game = init_standard_chess(); /// /// // construct comman...
/// A simple macro for defining bitfield accessors/mutators. #[cfg(feature = "alloc")] macro_rules! define_bool { ($bit:expr, $is_fn_name:ident, $set_fn_name:ident) => { fn $is_fn_name(&self) -> bool { self.bools & (0b1 << $bit) > 0 } fn $set_fn_name(&mut self, yes: bool) { ...
#![deny(warnings)] mod config; pub mod filesearch; pub mod search_paths; pub use self::config::*; pub use self::filesearch::{FileMatch, FileSearch}; pub use self::search_paths::{PathKind, SearchPath};
use simplemm::{error, state, types}; use snafu::{ErrorCompat, ResultExt}; use std::os::unix::fs::PermissionsExt; use std::os::unix::net::{UnixListener, UnixStream}; static PROGRAM: &str = "simplemmd daemon"; fn main() { if let Err(e) = run() { error_abort(e) } } fn run() -> error::Result<()> { i...
use gobs_core::cubic_surface_extractor::extract_cubic_mesh; use gobs_core::raw_volume::RawVolume; use gobs_core::raw_volume_sampler::RawVolumeSampler; use gobs_core::region::Region; use gobs_core::volume::Volume; #[test] fn basic_case() { let region = Region::cubic(16); let mut volume: RawVolume<i32> = RawVolu...
// 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 ...
table! { ommu_conversations (conversation_id) { conversation_id -> Integer, publish -> Integer, buddy_talent_id -> Nullable<Integer>, member_id -> Nullable<Integer>, creator_id -> Integer, user_id -> Integer, conversation_start -> Nullable<Datetime>, c...
// This file was generated by `cargo dev update_lints`. // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![ LintId::of(attrs::DEPRECATED_CFG_ATTR), LintId::of(booleans::NONMINIMAL...
fn main() { println!("tree"); }
use diesel; use diesel::prelude::*; use diesel::PgConnection; use schema::users; #[derive(Serialize, Deserialize, Queryable)] pub struct User { pub id: Option<i32>, pub first_name: String, pub last_name: String, pub user_name: String, pub cell_number: String, pub cell_verified: bool, pub em...
#[doc = "Reader of register MMCRXIM"] pub type R = crate::R<u32, super::MMCRXIM>; #[doc = "Writer for register MMCRXIM"] pub type W = crate::W<u32, super::MMCRXIM>; #[doc = "Register MMCRXIM `reset()`'s with value 0"] impl crate::ResetValue for super::MMCRXIM { type Type = u32; #[inline(always)] fn reset_va...
#[macro_use] mod common; mod bool_tests; mod float_tests; mod int_tests; mod misc_tests; mod none_tests;
use std::ffi::{CStr, CString}; use tui::{backend::Backend, Terminal}; use pam::Converse; use crate::loginform::LoginForm; pub struct DynamicConv<'a, B> where B: Backend, { username: Option<String>, form: LoginForm, term: &'a mut Terminal<B>, } impl<'a, B> DynamicConv<'a, B> where B: Backend, { ...
// 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 ...
use opentelemetry::trace::{SpanId, TraceId}; use rand::prelude::*; use std::fmt::Display; use std::str::FromStr; pub(crate) struct BuildId { trace: u128, span: u64, } impl BuildId { pub(crate) fn generate() -> Self { Self { trace: rand::thread_rng().gen(), span: rand::threa...
use std::io; use std::str::FromStr; fn main() { let mut input = String::new(); if let Err(_) = io::stdin().read_line(&mut input) { panic!("Failed to read a line"); } let gallons = f64::from_str(input.trim()); let gallons = match gallons { Ok(value) => value, Err(_) => panic!("Failed to parse gallons") }; ...
//! `pipe` and related APIs. //! //! # Safety //! //! `vmsplice` is an unsafe function. #![allow(unsafe_code)] use crate::fd::OwnedFd; use crate::{backend, io}; #[cfg(not(any( solarish, windows, target_os = "espidf", target_os = "haiku", target_os = "redox", target_os = "wasi", )))] use backen...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qatomic.h // dst-file: /src/core/qatomic.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= m...
tag colour { red; green; } obj foo[T]() { fn meth(x: &T) { } } fn main() { foo[colour]().meth(red); }
use efflux::prelude::*; /// The struct which implements the `Reducer` trait for PageRank. /// Should be called repeatedly to refine the PageRank. pub struct PageRankReducer; /// A PageRank reducer. /// Receives the same kind of output as it emits. /// The input is a list of ΔPageRank scores from in nodes, plus a list...
use super::{bool_to_enum, enum_to_bool, BitArray64, BooleanEnum}; #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[repr(u8)] pub enum Bool { /// False = 0, /// True = 1, } unsafe impl BooleanEnum for Bool { const FALSE: Self = Self::False; const TRUE: Self = Self::True; } #[test] fn with_count(...
//! Implementation of [Stream] that performs gap-filling on tables. use std::{ pin::Pin, sync::Arc, task::{Context, Poll}, }; use arrow::{ array::{ArrayRef, TimestampNanosecondArray}, datatypes::SchemaRef, record_batch::RecordBatch, }; use arrow_util::optimize::optimize_dictionaries; use datafu...
/* Ownership Rules 1) Each value in Rust has a variable that’s called its owner. 2) There can only be one owner at a time. 3) When the owner goes out of scope, the value will be dropped. */ fn main() { simple_scope(); copy_bind(); move_example(); clone_example(); stack_only_copy(); ownership_an...
use crate::models::launch::{Launch, LaunchID}; use crate::services::DB; use anyhow::Result; use chrono::{DateTime, Utc}; use sqlx::postgres::PgQueryResult; #[derive(Debug, sqlx::FromRow)] pub struct DBLaunch { pub launch_id: LaunchID, pub name: String, pub net: DateTime<Utc>, pub vid_url: Option<String...
pub mod bus; pub mod cartridge; pub mod cpu; pub mod sound; pub mod input; pub mod ppu; pub mod timer; mod memory; use anyhow::Result; use bus::Bus; use cartridge::{load_rom}; use cpu::Cpu; use ppu::{PpuInterrupt}; use crate::gui::{self, Message}; pub struct Emu { cpu: Cpu, bus: Bus, } impl Emu { pub...
// 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 ...
use std::collections::VecDeque; use proconio::{input, marker::Usize1}; fn main() { input! { n: usize, }; let mut g = vec![vec![]; n]; for i in 0..n { input! { c: usize, p: [Usize1; c], }; g[i] = p; } let mut visited = vec![false; n]; ...
#[derive(PartialEq, PartialOrd, Debug)] pub enum SyntaxKind { UnknownToken, WordlyToken, NumberToken, // Number like: 12 or 1.2 StringToken, // String like "Sina#" CharToken, // A character WhitespaceToken, // :D QuotationToken, // " SingleQou...
// origin: FreeBSD /usr/src/lib/msun/src/s_cos.c */ // // ==================================================== // Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. // // Developed at SunPro, a Sun Microsystems, Inc. business. // Permission to use, copy, modify, and distribute this // software is freely ...
pub mod utils; pub mod ftp;
use join::Join; use proconio::input; fn main() { input! { n: usize, }; let mut s = vec![]; for i in 1..=n { let mut t = Vec::new(); t.extend(s.clone()); t.push(i); t.extend(s); s = t; } println!("{}", s.iter().join(" ")); }
use crate::misc::RawSend; use crate::parker::Parker; use crate::tag::{with_tag, Tag}; use crate::worker::{Entry, Shared}; use std::future::Future; use std::pin::Pin; use std::ptr; use std::task::{Context, Poll, Waker}; pub(super) struct WaitFuture<'a, F> where F: Future, { /// The future being polled. pub(...
// 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 ...
#[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; mod db; mod ser; mod util; use std::{ error::Error, future::ready, io, sync::{Arc, Mutex}, }; use bytes::Bytes; use xitca_http::http::{ header::{HeaderValue, CONTENT_TYPE, SERVER}, Method, }; use xitca_web::{dev::fn_s...
use std::time::Instant; use std::fs; use std::cmp::max; pub fn get_sids(rows: Vec<String>)->Vec<u16>{ let mut sids:Vec<u16>=vec![]; for row in rows { let r: String = row.get(0..7).unwrap().chars().map(|x| match x { 'B' => '1', 'F' => '0', _ => panic!("Not exp...
use actix_web::{http::StatusCode, FromRequest, HttpResponse, Json, Path, Query}; use bigneon_api::controllers::organizations; use bigneon_api::controllers::organizations::*; use bigneon_api::models::{Paging, PagingParameters, PathParameters, Payload, SortingDir}; use bigneon_db::models::*; use chrono::NaiveDateTime; us...
/* cargo run -p async-ssh2-lite-demo-smol --bin inspect_ssh_agent */ use std::io; #[cfg(not(unix))] use std::net::TcpListener; #[cfg(unix)] use std::os::unix::net::UnixListener; #[cfg(unix)] use tempfile::tempdir; use async_io::Async; use futures::executor::block_on; use async_ssh2_lite::AsyncAgent; fn main() -> i...
use super::moving_object::MovingObject; use super::config; use std::collections::HashMap; use piston::input::keyboard::Key; use std::rc::Rc; use std::cell::RefCell; use piston_window::rectangle; use graphics::*; use opengl_graphics::GlGraphics; use graphics::Context; use super::texture_loader::TextureLoader; use super:...
extern crate vcpkg; fn main() { if cfg!(windows) && cfg!(target_env = "msvc") { vcpkg::find_package("sqlite3").unwrap(); } }
#[doc = "Reader of register FTSR2"] pub type R = crate::R<u32, super::FTSR2>; #[doc = "Writer for register FTSR2"] pub type W = crate::W<u32, super::FTSR2>; #[doc = "Register FTSR2 `reset()`'s with value 0"] impl crate::ResetValue for super::FTSR2 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
// Copyright 2012-2014 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...
fn main() { println!("cargo:rerun-if-changed=bootil"); println!("cargo:rerun-if-changed=build.rs"); // Build Bootil LZMA cc::Build::new() .file("bootil/src/3rdParty/lzma/LzFind.c") .file("bootil/src/3rdParty/lzma/LzmaLib.c") .file("bootil/src/3rdParty/lzma/LzmaDec.c") .file("bootil/src/3rdParty/lzma/LzmaEn...
use proconio::{input, marker::Bytes}; fn main() { input!(h:usize, w:usize, k:usize, c:[Bytes; h]); println!("h={:?}", h); println!("1<<h={:?}", 1<<h); println!("{:?}", w); println!("{:?}", k); println!("{:?}", c); let mut r = 0; for a in 0..1<<h{ for b in 0..1<<w{ let mut v=0; println!(...
// 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 ...
/// This is a template for ./main/main.cpp pub fn main_cpp(name: &str) -> String { format!("#include <iostream>\n#include \"{}.h\"\n#include \"lib/proconlib.h\"\n#include <vector>\n#include <algorithm>\n// using namespace std;\n\nint main() {{\n std::cout << \"Hello, world\" << std::endl;\n return 0;\n}}\n", ...
//! Heru Handika //! 31 October 2020 //! Range and Summary use std::iter::Iterator; // For sum function struct Range<T> { min: T, max: T, } fn main() { let vec: Vec<f64> = vec![10.0, 20.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0]; print_vector(&vec); ...