text
stringlengths
8
4.13M
// Copyright 2018 Evgeniy Reizner // // 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according...
//! Calculate transaction hashes. use crate::reply::transaction::{ DeclareTransaction, DeclareTransactionV0V1, DeclareTransactionV2, DeployAccountTransaction, DeployTransaction, InvokeTransaction, InvokeTransactionV0, InvokeTransactionV1, L1HandlerTransaction, Transaction, }; use pathfinder_common::{ B...
macro_rules! boolean_infix_operator { ($left:ident, $right:ident, $operator:tt) => {{ let (left_bool, right_bool) = crate::runtime::context::terms_try_into_bools(stringify!($left), $left, stringify!($right), $right)?; let output_bool = left_bool $operator right_bool; Ok(output_bool.into()) ...
use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt}; use std::fs::{DirBuilder, File, OpenOptions}; use std::io::{self, Seek, SeekFrom}; use std::path::{Path, PathBuf}; mod flock; use self::flock::FileLock; const LOG_PATH: &str = env!("TOBY_LOG_PATH"); const RUNTIME_PATH: &str = env!("TOBY_RUNTIME_PATH"); fn ...
use crate::models::todo::Todo; use crate::models::user::User; use crate::state::app::AppState; use actix_web::{web, HttpResponse, Responder}; /// Uncheck the todo /// /// @param {String} todo_id /// /// Success code 200: /// ``` /// { /// "id": "06b8ff8c-3e34-4226-b917-cb07bd98785e", /// "user_id": "c4d5f3b2-5149-...
pub use libra_language_e2e_tests::account_universe::*;
use libc; use core::str; use core::str::Utf8Error; use alloc::String; use alloc::string::ToString; use alloc::Vec; use alloc::borrow::ToOwned; #[derive(Debug)] pub struct Process(*const libc::c_void); impl Process { pub fn find(pid: isize) -> Option<Process> { extern "C" { fn proc_find(pid: ...
use super::{insights::Insight, static_panics::StaticPanicsOfMir}; use crate::{ database::Database, features_candy::analyzer::insights::ErrorDiagnostic, server::AnalyzerClient, utils::LspPositionConversion, }; use candy_frontend::{ ast_to_hir::AstToHir, mir_optimize::OptimizeMir, module::Module, TracingConfi...
//! Additional docs for macros, and guides. pub mod library_evolution; pub mod prefix_types; pub mod sabi_nonexhaustive; pub mod sabi_trait_inherent; pub mod troubleshooting; pub mod unsafe_code_guidelines;
// 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. //! C bindings for wlan-mlme crate. extern crate log; // Explicitly declare usage for cbindgen. extern crate wlan_common; extern crate wlan_mlme; #[macro...
use gl; use gl::types::*; pub trait GLShader { fn to_glenum(&self) -> GLenum; fn get_glsl(&self) -> &'static str; } pub struct GLVertexShader { glsl: &'static str, } impl GLShader for GLVertexShader { fn to_glenum(&self) -> GLenum { return gl::VERTEX_SHADER; } fn get_glsl(&self) -> ...
use crate::consts::MAX_PHYSICAL_PAGES; use spin::Mutex; pub struct SegmentTreeAllocator { a: [u8; MAX_PHYSICAL_PAGES << 1], // root is a[1] m: usize, // m is the leftmost leaf's idx in the segment tree n: usize, // n is the size of the ppn pages offset: usize, // the offset of the ppn page...
pub(crate) use _multiprocessing::make_module; #[cfg(windows)] #[pymodule] mod _multiprocessing { use crate::vm::{function::ArgBytesLike, stdlib::os, PyResult, VirtualMachine}; use winapi::um::winsock2::{self, SOCKET}; #[pyfunction] fn closesocket(socket: usize, vm: &VirtualMachine) -> PyResult<()> { ...
use std::io; use std::io::Write; pub trait Print { fn print(&mut self, text: &str) -> io::Result<()>; fn println(&mut self, text: &str) -> io::Result<()>; } pub struct Printer<W> { writer: W, } impl<W: Write> Printer<W> { pub fn new(writer: W) -> Self { Printer { writer } } } impl<W: Wri...
use encoding::{get_base_enc, Encoding}; use fontref::FontRef; use graphicsstate::Color; use std::fmt; use std::fs::File; use std::io::{BufWriter, Result, Write}; use units::{LengthUnit, UserSpace}; /// A text object is where text is put on the canvas. /// /// A TextObject should never be created directly by the user. ...
//! ```elixir //! # label 1 //! # pushed to stack: (module, function arguments, before) //! # returned from call: before //! # full stack: (before, module, function arguments) //! # returns: value //! value = apply(module, function, arguments) //! after = :erlang.monotonic_time() //! duration = after - before //! time ...
#![allow(non_snake_case)] #![allow(unused_variables)] use clap::App; use clap::Arg; use colored::*; use std::collections::HashMap; use std::fs::*; use std::net::Ipv4Addr; use std::net::{IpAddr, Ipv6Addr}; pub mod config; pub mod serve; pub mod utils; fn main() { let matches = App::new("dns-rs") .version(...
use db::Connector; use db::actions::*; use db::models::*; use interactions::handler::InviteUrl; use interactions::parsing::get_values; use serenity::builder::CreateEmbedField; use serenity::prelude::*; use serenity::model::{Message, User, GuildId, MessageId}; use serenity::framework::standard::Args; use serenity::fra...
pub fn table(data:u32){ println!("WE are in Lib.rs"); for count in 1..=3{ println!("{}*{}= {}", data,count,data*count); } }
fn main() { println!("This is a placeholder for cargo-link!"); }
use super::{Map, MapElement}; /// Generate the test map pub fn generate_test_map() -> Map { info!("Generating Test Map"); let mut map = Map::new(); for x in 20..=22 { for y in 0..=50 { *map.get_mut(x, y) = MapElement::Wall; } } debug!("Done Generating Test ...
// Standard library use std::sync::{Arc, Mutex}; // This crate use crate::actions::{SayHelloAction, ACT_REG}; use crate::exts::LockIt; use crate::signals::{new_signal_order, poll::PollQuery, Timer, SIG_REG}; use crate::skills::SkillLoader; // Other crates use anyhow::Result; use async_trait::async_trait; use unic_lan...
fn main() { let mut x = 10 < 11; assert!(x); }
use arduino_uno::prelude::*; use arduino_uno::adc::Adc; use arduino_uno::hal::port::{ Pin, mode::{Analog, Input, Floating}, portc::{PC0, PC1}, }; use crate::Direction; use super::{InputDevice, InputSignal}; /// Object describing the input received from the JoyStick. #[derive(Copy, Clone)] pub struct JoyS...
use once_cell::sync::OnceCell; use std::{ fs::File, process::{Child, Command, Stdio}, sync::{ atomic::{AtomicUsize, Ordering::SeqCst}, Arc, Weak, }, time::Duration, }; use tokio::sync::Mutex; #[macro_export] /// If `TEST_INTEGRATION` is set and InfluxDB 2.0 OSS is available (either ...
// 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 ...
extern crate rustcalc; #[test] fn simple_addition() { let input = "2+2"; match rustcalc::calc(input) { Ok(x) => assert_eq!(4f64, x), _ => assert!(false) } } #[test] fn complex_addition() { let input = "2+ 3 + (-8)"; match rustcalc::calc(input) { Ok(x) => assert_eq!(-3f6...
use winapi::um::winnt::HANDLE; use winapi::um::winuser::IMAGE_ICON; use crate::win32::resources_helper as rh; use crate::{OemImage, OemIcon, NwgError}; use std::ptr; #[cfg(feature = "embed-resource")] use super::EmbedResource; /** A wrapper over a icon file (*.ico) Windows icons are a legacy thing and should only b...
pub mod common; pub mod dtos; pub mod pattern_queue; pub mod patterns; pub mod reply_to; pub mod utils;
use super::{Read, ReadError, Write, WriteError}; use alloc::vec::Vec; use core::ops::Deref; /// A stream of bytes pub struct DataStream { /// TODO docs bytes: Vec<u8>, /// TODO docs pos: usize, } impl DataStream { /// Read something from the stream /// /// # Errors /// /// Will ret...
#[allow(unused_imports)] use proconio::marker::{Bytes, Chars}; use proconio::{fastout, input}; #[fastout] fn main() { input! { n: usize, s: [String; n], } let mut ac = 0; let mut wa = 0; let mut tle = 0; let mut re = 0; for i in 0..n { if &s[i] == "AC" { ...
use std::{fmt::Display, sync::Arc}; use data_types::{CompactionLevel, ParquetFile}; use observability_deps::tracing::info; use parquet_file::ParquetFilePath; use uuid::Uuid; use crate::{ file_classification::{CompactReason, FileToSplit, FilesToSplitOrCompact, SplitReason}, partition_info::PartitionInfo, p...
use ggez::{graphics, Context, GameResult, nalgebra as na}; use ggez::graphics::{DrawMode}; use ggez::event::EventHandler; pub struct MyGame { // Your state here... n: f64, d: f64 } impl MyGame { pub fn new(_ctx: &mut Context, n: f64, d: f64) -> MyGame { // Load/create resources such as images...
#![crate_name = "r6"] //! r6.rs is an attempt to implement R6RS Scheme in Rust language #![feature(plugin)] #![feature(slicing_syntax)] #![feature(box_syntax)] //TODO: Allow unstable items until Rust hits 1.0 #![allow(unstable)] #[plugin] extern crate phf_mac; extern crate phf; extern crate unicode; #[macro_use] ex...
//Floyd cycle delection algorithm enum Working { Process, Stop } pub struct Floyd{ func: fn(&f32) -> f32, xstart: f32, } impl Floyd { pub fn new(xstart:f32, func: fn(f32) -> f32) -> Floyd { Floyd { func:&func, xstart:xstart, } } /*fn start(&self) -> (i32,i32) { let mut tortoi...
// Copyright 2017 Amagicom AB. // // 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to...
// Copyright 2016 `multipart` Crate 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 exce...
pub type IOpcCertificateEnumerator = *mut ::core::ffi::c_void; pub type IOpcCertificateSet = *mut ::core::ffi::c_void; pub type IOpcDigitalSignature = *mut ::core::ffi::c_void; pub type IOpcDigitalSignatureEnumerator = *mut ::core::ffi::c_void; pub type IOpcDigitalSignatureManager = *mut ::core::ffi::c_void; pub type I...
use super::Solution; // 420. Strong Password Checker impl Solution { #[allow(dead_code)] // 420. Strong Password Checker pub fn strong_password_checker(password: String) -> i32 { // let _ = (password.chars().count(), ()); // // Vec of chars, mutable? Then perform the edits, we only care abo...
#![feature(core_intrinsics)] #![feature(convert)] //! A a low level NBT decoding library that maps NBT structures onto //! standard library containers. extern crate flate2; pub mod types; pub mod decode; pub mod encode; pub mod util; pub mod traits; pub use types::*; // Trait for encoding values to bytes trait Enc...
use std::fs::{read_dir, remove_dir_all, remove_file, File}; use std::io::{BufRead, BufReader, Lines, Result}; use std::path::Path; /// Counts lines in the source `handle`. /// /// # Examples /// ```ignore /// let lines: usize = count_lines(std::fs::File::open("Cargo.toml").unwrap()).unwrap(); /// ``` /// /// Credit: h...
extern crate image; extern crate glob; use crate::animation::Animation; use crate::animation::AnimationManager; use image::GenericImageView; use std::fs::File; use std::io::Read; use std::collections::HashMap; use std::error::Error; use sdl2::render::BlendMode; use sdl2::render::Texture; use sdl2::render::TextureCr...
//! # Analog to Digital Converter. //! //! ## Examples //! //! Check out [examles/adc.rs][]. //! //! It can be built for the STM32F3Discovery running //! `cargo build --example adc --features=stm32f303xc` //! //! [examples/adc.rs]: https://github.com/stm32-rs/stm32f3xx-hal/blob/v0.7.0/examples/adc.rs use crate::{ ...
use hal::register::Register; pub struct Rcc { pub cr: Cr, pub cfgr: Register<u32>, pub cir: Register<u32>, pub apb2rstr: Register<u32>, pub apb1rstr: Register<u32>, pub ahbenr: AhbEnr, pub apb2enr: Apb2Enr, pub apb1enr: Apb1Enr, pub bdcr: Register<u32>, pub csr: Register<u32>, ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "Storage_Pickers_Provider")] pub mod Provider; #[link(name = "windows")] extern "system" {} pub type FileExtensionVector = *mut ::core::ffi::c_void; pub type FileOpenPicker = *mut ::core::f...
pub mod full_stats; pub mod stone_stats; pub mod stone_score;
fn main() { println!(r"cargo:rustc-link-search=/home/maxking/Documents/weechat-relay/build/lib"); }
use std::convert::From; use min_max::*; use crate::rgb::*; #[derive(Debug, PartialEq)] pub struct Cmyk { pub c: f32, pub m: f32, pub y: f32, pub k: f32, } impl Cmyk { fn new(c: f32, m: f32, y: f32, k: f32) -> Self { Self { c, m, y, k } } } impl From<RgbScaled> for Cmyk { fn from...
use hdk::{ self, error::ZomeApiResult, holochain_core_types::{ entry::Entry, }, holochain_persistence_api::{ cas::content::{Address, AddressableContent}, }, }; use crate::anchors::{ RootAnchor, Anchor }; use crate::{ ROOT_ANCHOR_ENTRY, ROOT_ANCHOR_LINK_TO, AN...
pub use self::add_venue_to_organization_request::*; pub use self::admin_display_ticket_type::*; pub use self::display_ticket_pricing::*; pub use self::facebook_web_login_token::*; pub use self::paging::*; pub use self::path_parameters::*; pub use self::register_request::*; pub use self::user_display_ticket_type::*; pub...
//! Private module for selective re-export. use crate::semantics::SequentialSpec; /// An implementation of this trait tests the [consistency] of a concurrent system with respect to /// a "reference sequential specification" [`SequentialSpec`]. The interface for doing so involves /// recording operation invocations an...
extern crate proconio; use proconio::input; fn main() { input! { a: i64, b: i64, } let mut h = std::collections::HashMap::<i64, i64>::new(); for mut x in (b + 1)..=a { let mut y = 2; while y * y <= x { while x % y == 0 { let c = h.entry(y).or_inse...
#![allow(non_camel_case_types, non_snake_case)] use otspec::de::CountedDeserializer; use otspec::de::Deserializer as OTDeserializer; use otspec::types::*; use otspec::{ deserialize_visitor, read_field, read_field_counted, read_remainder, stateful_deserializer, }; use otspec_macros::tables; use serde::de::{Deserial...
use std::fs::File; use std::io::Read; use std::str::FromStr; use computer::IntCodeComputer; fn main() { let mut in_dat_fh = File::open("./data/input.txt").unwrap(); let mut in_dat = String::new(); in_dat_fh.read_to_string(&mut in_dat).unwrap(); let mut icc = IntCodeComputer::from_str(&in_dat).unwrap(...
use proconio::{input, marker::Chars}; fn main() { input! { n: usize, a: [Chars; n], }; for i in 0..n { for j in 0..n { if i == j { continue; } let ng = match a[i][j] { 'W' => a[j][i] != 'L', 'L' => ...
use std::thread::sleep; use core::borrow::Borrow; use std::time::Duration; use std::cmp::Ordering::Greater; // 把红绿灯看成一个状态机,状态转换过程如下: //+-----------+ +------------+ +---------+ //| Green +----->+ Yellow +----->+ Red | //+-----+-----+ +------------+ +----+----+ // ^ ...
/// Cetak vector menjadi string /// e.g. [1,2,3,4,5] /// fn main() { let mut val = vec![1,2,3,4,5]; println!("{}", val.len()); val.insert(1, 7); println!("[{}]", val.iter().fold(String::new(), |acc, &num| acc + &num.to_string() + ", ")); }
use super::{rpc_manager::RpcInfo, PartialHashBatch}; use crate::bls::SIG_SIZE; use crossbeam_channel::Receiver; use log::trace; use randomx::{HashChain, Vm, HASH_SIZE}; use std::{ cmp::Ordering, sync::{atomic, Arc}, }; fn less_than_rev(a: &[u8; 32], b: &[u8; 32]) -> bool { let mut i = 31; while i > 0 {...
use std::iter::{Peekable}; use crate::token::*; use crate::json_syntax::*; use std::collections::{HashMap}; pub struct Parser { tokens: Peekable<std::vec::IntoIter<Token>>, current: Token } impl Parser { pub fn new(tokens: Vec<Token>) -> Self { let mut iter = tokens.into_iter().peekable(); ...
use crate::plugins::config::DebugConfig; use game_lib::bevy::{ecs as bevy_ecs, prelude::*}; #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, SystemLabel)] pub struct ConfigPlugin; impl Plugin for ConfigPlugin { fn build(&self, app: &mut AppBuilder) { app.register_type::<DebugConfig>() .init_r...
use std::ops::{Deref, DerefMut}; #[cfg(windows)] fn allocate_rwx(size: usize) -> *mut u8 { extern "system" { fn VirtualAlloc(base: *mut u8, size: usize, alloc_type: u32, prot: u32) -> *mut u8; } const MEM_COMMIT_RESERVE: u32 = 0x1000 | 0x2000; const PAGE_EXECUTE_READWRITE: u32 = 0x40; ...
/// /// Cannot create object while /// you do not have all fields, self validating #[derive(Debug, Clone)] struct Relation { src: String, dst: String } #[derive(Debug)] struct CurrentRelation { history_index: usize, relations: Vec<Relation> } fn new_relation(src: String, dst: String, state: CurrentRe...
extern crate cassandra; use cassandra::*; static CONTACT_POINTS:&'static str = "127.0.0.1"; static NUM_CONCURRENT_REQUESTS:isize=100; static CREATE_KEYSPACE:&'static str = "CREATE KEYSPACE IF NOT EXISTS examples WITH replication = { \ \'class\': \'SimpleStrategy\', \'replication...
use bigneon_db::dev::TestProject; use bigneon_db::models::*; #[test] fn find_fee_item() { let project = TestProject::new(); let connection = project.get_connection(); let organization = project .create_organization() .with_fee_schedule(&project.create_fee_schedule().finish()) .finis...
pub mod getter; pub mod server; pub mod tester;
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qabstractitemdelegate.h // dst-file: /src/widgets/qabstractitemdelegate.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block e...
use std::io::Error; use std::path::PathBuf; use crate::io; use crate::consts::{ASSETS_DIR, DRIVE_NAME, TMP_DIR}; pub fn create_drive(drive_name: &str) -> Result<(), Error> { let drive_src = PathBuf::from(format!("{}/{}.ext4", ASSETS_DIR, DRIVE_NAME)); let drive_dest = PathBuf::from(format!("{}/{}.ext4", TMP_...
// Implementasi trait `ToString` untuk struk `Person` untuk dapat menggunakan fungsi `to_string` // struct Person { name: String, age: u8, } impl ToString for Person { fn to_string(&self) -> String { format!("Nama saya {} dan umur saya {}", self.name, self.age) } } fn main() { let agus = P...
use super::root::*; use color::Color; use sided_mask::*; use mask::*; use side::*; use mask::masks::*; impl Position { pub fn pseudo_legal_pawn_moves(&self) -> Mask { if self.active == Color::White { self.pseudo_legal_pawn_moves_of::<White>().0 } else { self.pseudo_legal_paw...
use utils::ipoint::IPoint; use state::world::World; use design::blueprint::Blueprint; use player::player::PlayerData; use state::object::Pixel; use state::object::Object; use serde_json; use objects::player::Player; use print_raw; use print; pub struct GameState { pub game: World, pub player: PlayerData } im...
use super::helpers::deserealize_currency; use serde::Deserialize; /// Информация о подписке /// https://developers.xsolla.com/ru/api/v2/getting-started/#api_param_webhooks_payment_purchase_subscription #[derive(Debug, Deserialize)] pub struct Subscription { pub plan_id: String, pub subscription_id: String, ...
use utilities::prelude::*; use crate::allocator::{block::Block, device_allocator::DeviceAllocator}; use crate::impl_vk_handle; use crate::loader::*; use crate::prelude::*; use crate::sampler_manager::SamplerManager; use crate::Extensions; use std::cmp::min; use std::fmt; use std::mem::{size_of, MaybeUninit}; use std:...
//! Generic B-Tree implementation. //! //! This module defines a `Btree<K, V>` type which provides similar functionality to //! `BtreeMap<K, V>`, but with some important differences in the implementation: //! //! 1. Memory is allocated from a `NodePool<K, V>` instead of the global heap. //! 2. The footprint of a BTree ...
use std::path::Path; use std::sync::Arc; use std::sync::Mutex; use vulkano::sync::GpuFuture; use wayland_client::protocol::{wl_keyboard, wl_seat}; use wayland_client::Filter; mod vulkan; mod window; use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer}; use vulkano::command_buffer::AutoCommandBufferBuilder; use vulka...
pub use self::redis_client::*; pub mod redis_client;
//! Views are organized as a tree. A view might receive / send events and render itself. //! //! The z-level of the n-th child of a view is less or equal to the z-level of its n+1-th child. //! //! Events travel from the root to the leaves, only the leaf views will handle the root events, but //! any view can send even...
use std::thread; use std::time::Duration; struct Philosopher { name: String, } impl Philosopher { fn new(name: &str) -> Philosopher { Philosopher { name: name.to_string() } } fn eat(&self) { println!("{} is eating.", self.name); thread::sleep(Duration::from_millis(1000)); ...
use glam::{Quat, Vec3}; use crate::Serializable; use std::{ fmt, time::{SystemTime, UNIX_EPOCH}, }; #[derive(Clone, Debug, PartialEq, Eq)] pub struct ServerInfo { pub name: String, pub description: String, pub host: String, } impl fmt::Display for ServerInfo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt:...
use crate::{DocBase, VarType}; const DESCRIPTION: &'static str = r#" If ... then ... else ... "#; const EXAMPLES: &'static str = r#" ```pine // Draw circles at the bars where open crosses close s1 = iff(cross(open, close), avg(open,close), na) plot(s1, style=plot.style_circles, linewidth=4, color=color.green) ``` "#;...
pub fn selection_sort(mut arr: Vec<i32>) -> Vec<i32> { for i in (1..(arr.len())).rev() { let mut el = i; for j in 0..i { if arr[j] > arr[el] { el = j; } } arr.swap(i, el); } arr } #[test] fn tests() { assert_eq!( selection_...
use mkit::{ cbor::{FromCbor, IntoCbor}, Cborize, }; #[allow(unused_imports)] use crate::wral::Wal; use crate::{entry::Entry, Result}; /// Callback trait for updating application state in relation to [Wal] type. pub trait State: 'static + Clone + Sync + Send + IntoCbor + FromCbor { fn on_add_entry(&mut sel...
extern crate image; extern crate cgmath; extern crate glium_text_rusttype as glium_text; use crate::data_loader; use cgmath::{Matrix4, Vector2}; use glium::glutin; use glium::Surface; use glium::texture::Texture2d; use self::image::{RgbImage}; use std::collections::HashMap; use data_loader::TitleContainer; use std::bo...
use std::cmp::min; use std::sync::atomic::AtomicU64; use std::sync::Arc; use ash::vk; use sourcerenderer_core::graphics::*; use crate::buffer::VkBufferSlice; use crate::pipeline::{ VkGraphicsPipelineInfo, VkPipeline, VkShader, }; use crate::queue::{ VkQueue, VkQueueInfo, VkQueueType, }; use cr...
/// Module defining all possible events we might receive from neovim #[derive(Debug)] pub enum Event { Shutdown, Search, }
#[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::FLOWCTL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
pub struct Solution; impl Solution { pub fn compute_area(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> i32 { let area1 = (c - a) * (d - b); let area2 = (g - e) * (h - f); let i = a.max(e); let j = b.max(f); let k = c.min(g); let l = d.min(h); ...
// iter() -> &T // iter() -> &mut T // into_iter() -> T // iterator is a more basic concept than pointer // fold function fn use_names_for_something_else(_names: Vec<&str>) {} fn test_fold() { let names = vec!["Jane", "Jill", "Jack", "John"]; let total_bytes = names .iter() .map(|name: &&str|...
import str::sbuf; #[cfg(target_os = "linux")] #[cfg(target_os = "macos")] fn getenv(n: str) -> option::t[str] { let s = os::libc::getenv(str::buf(n)); ret if s as int == 0 { option::none[str] } else { option::some[str](str::str_from_cstr(s)) }; } #[cfg(target_os = "linux")] #[cfg(target_o...
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // // Portions Copyright 2017 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the THIRD-PARTY file. //! Emulates virtual ...
use crate::Actor; use crate::Assistant; use async_trait::async_trait; use std::fmt::Debug; /// This Trait allow Actors to receive messages. /// /// Following the example in the [Actor documentation](./trait.Actor.html)... /// ```rust,no_run /// use async_trait::async_trait; /// # use acteur::{Actor}; /// # #[derive(De...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "ApplicationModel_Payments_Provider")] pub mod Provider; #[repr(transparent)] #[doc(hidden)] pub struct IPaymentAddress(pub ::windows::core::IInspectable); unsafe impl ::windo...
use projecteuler::helper; fn main() { helper::check_bench(|| { solve(); }); assert_eq!(solve(), 49); dbg!(solve()); } fn solve() -> usize { /* a.pow(b) if a is greater equal 10, a.pow(b) will always have more digits than b when does a**b has the correct number of digits? 1...
#[doc = "Writer for register C0IFCR"] pub type W = crate::W<u32, super::C0IFCR>; #[doc = "Register C0IFCR `reset()`'s with value 0"] impl crate::ResetValue for super::C0IFCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Write proxy for field `CTEIF0`"] pub ...
use super::Part; use crate::codec::{Decode, Encode}; use crate::{remote_type, RemoteObject}; remote_type!( /// A light. Obtained by calling `Part::light().` object SpaceCenter.Light { properties: { { Part { /// Returns the part object for this light. /// ...
use crate::{ iter::Slice2DIterMut, slice::{Shape2D, SlicePtrMut}, }; pub trait Slice2DFill<T> { fn fill(&mut self, value: T) where T: Clone; fn fill_with<F>(&mut self, f: F) where F: FnMut() -> T; } impl<T: Clone, S> Slice2DFill<T> for S where S: Shape2D + SlicePtrMut<T> + ...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn parse_http_generic_error( response: &http::Response<bytes::Bytes>, ) -> Result<smithy_types::Error, smithy_json::deserialize::Error> { crate::json_errors::parse_generic_error(response.body(), response.headers()) } pub fn de...
pub struct DSU { par: Vec<usize>, size: Vec<i32>, comps: usize, } impl DSU { pub fn new(n: usize) -> Self { Self { par: (0..n).collect(), size: vec![1; n], comps: n, } } pub fn root(&mut self, a: usize) -> usize { if a != self.par[a] {...
mod camera; mod render_state; mod tex2d; mod vertex; use cfg_if::cfg_if; use color_eyre::{eyre::WrapErr, Result}; use log::error; use log::{info, warn}; use winit::event::VirtualKeyCode; use winit::event_loop::ControlFlow; use winit::event_loop::EventLoop; use winit::window::WindowBuilder; use winit_input_helper::Wini...
/** This attribute is used for functions which export a module in an `implementation crate`. This is applied to functions like this: ```rust use abi_stable::prefix_type::PrefixTypeTrait; #[abi_stable::export_root_module] pub fn get_hello_world_mod() -> TextOperationsMod_Ref { TextOperationsMod { reverse_string ...
use ckb_simple_account_layer::{CkbBlake2bHasher, Config}; use ckb_types::{ bytes::{BufMut, Bytes, BytesMut}, core::{DepType, EpochNumberWithFraction, ScriptHashType}, h256, packed, prelude::*, H160, H256, }; use ckb_vm::{Error as VMError, Memory, Register, SupportMachine}; use serde::{Deserialize, S...