text
stringlengths
8
4.13M
foo = gl_Vertex.xyz py = gl_Vertex.y gl_FragColor = vec4 foo py
#![allow(dead_code)] use std::path::PathBuf; use crate::builder::*; use crate::const_values::*; use std::thread::*; use std::sync::{Arc,Mutex}; use std::collections::HashMap; #[derive(Debug,Clone)] pub enum ThreadState{ ALIVE,DEAD } #[derive(Debug)] pub struct ThreadObserver{ threadid:Option<ThreadId>, dll...
use std; use std::ptr; use std::borrow::Borrow; use std::cmp::Ordering; use ordered_iter; const SEQ_START: u64 = 0; const SEQ_END: u64 = !0; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] struct Key<K> { key: K, sequence: u64 } impl<K> Key<K> { fn as_ref<Q>(&self) -> Key<&Q> where...
use std::collections::HashSet; #[derive(Clone)] enum Move { Up, Down, Left, Right, } fn compute_tail_position(current_tail_pos: (u32, u32), new_head_pos: (u32, u32)) -> (u32, u32) { let is_connected = |t1: (u32, u32), t2: (u32, u32)| { let distance = i32::abs(t1.0 as i32 - t2.0 as i32) + i...
use crate::account::KeyedAccount; use crate::pubkey::Pubkey; use std; /// Reasons a program might have rejected an instruction. #[derive(Debug, PartialEq, Eq, Clone)] pub enum ProgramError { /// The program instruction returned an error GenericError, /// The arguments provided to a program instruction whe...
use oauth2::AccessToken; pub trait BearerToken { fn token_type(&self) -> &str; fn scopes(&self) -> &[String]; fn expires_in(&self) -> u64; fn access_token(&self) -> &AccessToken; } pub trait RefreshToken { fn refresh_token(&self) -> &AccessToken; } pub trait ExtExpiresIn { fn ext_expires_in(&...
// Pass by reference Tutorial struct Object { value: i32 } // Mutate functions fn mutate_obj(obj: &mut Object) -> () { obj.value = 20; } fn mutate_var(value: &mut i32) -> () { // Dereference pointer to assign new value to var *value = 20; } fn main() -> () { // Declared and initalized data l...
#[doc = "Register `ISR1` reader"] pub type R = crate::R<ISR1_SPEC>; #[doc = "Register `ISR1` writer"] pub type W = crate::W<ISR1_SPEC>; #[doc = "Field `TOHSTX` reader - Timeout high"] pub type TOHSTX_R = crate::BitReader; #[doc = "Field `TOHSTX` writer - Timeout high"] pub type TOHSTX_W<'a, REG, const O: u8> = crate::B...
extern crate maud; use maud::{html, Markup}; pub fn head() -> Markup { html! { head{ meta charset="utf8"; meta lang="en-US"; meta name="viewport" content="width=device-width, initial-scale=1"; meta name="author" content="tom pridham"; meta name="d...
use std::borrow::Cow; use std::cmp; use std::marker; use std::sync::Arc; use std::usize; use crate::file::FileHash; use crate::function::ParameterOffset; use crate::namespace::Namespace; use crate::source::Source; use crate::{Id, Size}; /// The kind of a type. #[derive(Debug, Clone)] pub enum TypeKind<'input> { /...
use crate::evdev::{Device, UInputDevice}; use crate::foreign::*; use super::{DeviceId, Error, Result}; use std::cell::Cell; pub struct DestinationDevice { id: DeviceId, uidev: UInputDevice, components: InternalComponents, should_sync: Cell<bool>, } #[derive(Clone)] pub enum Action { RelativeMove ...
//! # GameBuilder Helper //! Utility for creating complex games with non standard komi, handicap etc... //! # Exemple //! ``` //! use crate::goban::rules::game_builder::GameBuilder; //! use crate::goban::rules::Rule; //! //! let mut builder = GameBuilder::default(); //! let game = builder //! .rule(Rule::Japanese) ...
use std::convert::{Infallible, TryFrom, TryInto}; use bitflags::{bitflags, BitFlags}; pub trait Flags: BitFlags<u32> + TryFrom<u32> + TryInto<u32> + Default { fn test(&self, value: u32) -> bool { let flags = value.try_into().or(Err(crate::Error::Unexpected)).unwrap(); self.contains(flags) } } ...
enum TrafficLight { Green, Red, Yellow } impl TrafficLight { fn time(&self) -> u8 { match self { TrafficLight::Green => 10, TrafficLight::Red => 20, TrafficLight::Yellow => 30 } } } pub fn test_lights() { let green = TrafficLight::Green; ...
use std::iter; use std::ops::{Add, Sub, Neg, Mul}; pub trait Additive where Self: Sized { const ZERO: Self; fn add(self, n: Self) -> Self; fn sub(self, n: Self) -> Self { self.add(n.neg()) } fn neg(self) -> Self { Self::ZERO.sub(self) } } macro_rules! additive_impl_core { ($id:ident => $body:expr, $($t:ty...
pub mod rom; pub use self::rom::Rom; pub mod basic_mmu; pub trait Mmu { fn read_byte(&self, addr: u16) -> u8; fn write_byte(&mut self, addr: u16, value: u8); fn rom_len(&self) -> usize; }
use amethyst::{ prelude::*, renderer::{ plugins::{RenderFlat2D, RenderToWindow}, types::DefaultBackend, RenderingBundle, Camera, ImageFormat, SpriteRender, SpriteSheet, SpriteSheetFormat, Texture, }, ecs::prelude::*, utils::app...
#[doc = "Reader of register ETH_MTLOMR"] pub type R = crate::R<u32, super::ETH_MTLOMR>; #[doc = "Writer for register ETH_MTLOMR"] pub type W = crate::W<u32, super::ETH_MTLOMR>; #[doc = "Register ETH_MTLOMR `reset()`'s with value 0"] impl crate::ResetValue for super::ETH_MTLOMR { type Type = u32; #[inline(always...
extern crate cxx_build; fn main() { cxx_build::bridge("src/main.rs") .file("src/demo.cpp") .flag_if_supported("-std=c++17") .compile("cxxbridge-demo"); cc::Build::new() .file("src/demo_c.c") .define("FOO", Some("bar")) .include("src") .compile("demo_c");...
use parking_lot::Mutex; use sc_utils::mpsc::{TracingUnboundedReceiver, TracingUnboundedSender}; use sp_consensus_slots::Slot; use sp_runtime::traits::{Block as BlockT, NumberFor}; use std::convert::TryInto; use std::sync::Arc; use subspace_core_primitives::{BlockNumber, Randomness}; /// Data required to produce bundle...
mod map_deserialize; use self::map_deserialize::N; use networking::ToPlcConn; use std::collections::BTreeMap; #[derive(Debug, Deserialize, Serialize)] pub struct Setting { pub connection_parameter: AmsConn, pub plc: Vec<PlcSetting>, pub versions: BTreeMap<N, VersionSetting>, } #[derive(Debug, Deserialize,...
use std::convert::TryFrom; use anyhow::{anyhow, Result}; use grid::Grid; use crate::Challenge; use itertools::Itertools; pub struct Day11; type Layout = Grid<Cell>; impl Challenge for Day11 { const DAY_NUMBER: u32 = 11; type InputType = Layout; type OutputType = usize; fn part1(input: &Self::Inpu...
#[doc = "Reader of register DDRCTRL_POISONSTAT"] pub type R = crate::R<u32, super::DDRCTRL_POISONSTAT>; #[doc = "Reader of field `WR_POISON_INTR_0`"] pub type WR_POISON_INTR_0_R = crate::R<bool, bool>; #[doc = "Reader of field `WR_POISON_INTR_1`"] pub type WR_POISON_INTR_1_R = crate::R<bool, bool>; #[doc = "Reader of f...
#![cfg_attr(not(feature = "std"), no_std)] #![feature(nll)] #![feature(external_doc)] #![feature(try_trait)] #![deny(missing_docs)] #![doc(include = "../README.md")] #![doc(html_logo_url = "https://doc.dalek.rs/assets/dalek-logo-clear.png")] #![doc(html_root_url = "https://docs.rs/bulletproofs/2.0.0")] extern crate al...
use std::path::PathBuf; #[test] fn non_existent_file() { let path = PathBuf::from("src/fixtures/no-such-file"); let result = super::read_file(path); match result { Err(err) => match err { super::ParserError::BadFile(msg) => println!("{}", msg), super::ParserError::BadSize(m...
#![no_std] #![cfg_attr(feature = "external_doc", feature(external_doc))] #![cfg_attr(feature = "external_doc", doc(include = "../README.md"))] extern crate proc_macro; extern crate proc_macro2; extern crate alloc; use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, Data, DeriveInput}; use allo...
#[doc = "Reader of register FMC_HWCFGR2"] pub type R = crate::R<u32, super::FMC_HWCFGR2>; #[doc = "Reader of field `RD_LN2DPTH`"] pub type RD_LN2DPTH_R = crate::R<u8, u8>; #[doc = "Reader of field `NOR_BASE`"] pub type NOR_BASE_R = crate::R<bool, bool>; #[doc = "Reader of field `SDRAM_RBASE`"] pub type SDRAM_RBASE_R = ...
use std::{i8, i16, i32, i64, u8, u16, u32, u64, isize, usize, f32, f64}; use std::io::stdin; fn main() { // Client let facade = PhoneFactoryFacade{}; facade.develop_phones(10); } #[derive(Debug)] struct PhoneFactoryFacade {} impl PhoneFactoryFacade { fn develop_phones(&self, amount_of_phones: i64) { ...
use std::cell::RefCell; use std::rc::Rc; use lattices::{Point, WithBot}; use serde::de::{DeserializeSeed, Visitor}; use serde::{Serialize, Serializer}; use super::point::PointWrapper; use crate::buffer_pool::{AutoReturnBuffer, BufferPool}; use crate::protocol::serialization::lattices::point::PointDeserializer; #[rep...
//! An expression that consumes any single character. //! //! See [`crate::any`]. use crate::error::UnexpectedEndOfInput; use crate::parser::Parser; use crate::span::Span; /// The struct returned from [`crate::any`]. pub struct Any; impl Parser for Any { type Value = char; type Error = UnexpectedEndOfInput; ...
fn main(){ let n1 = "Tutorials".to_string(); let n2 = "Point".to_string(); let n3 = n1 + &n2; // n2 reference is passed let n4 = n1 + n2; println!("{}",n3); println!("{}",n4); }
use ratatui::style::{Color, Modifier, Style}; use ratatui::text::{Line, Span}; use ratatui::widgets::Paragraph; pub struct TopBar<'a> { pub widget: Paragraph<'a>, text: Vec<Line<'a>>, } impl<'a> TopBar<'a> { pub fn new() -> Self { let text = vec![Line::from(vec![ Span::styled(" <u>", S...
use format::Row; use std::collections::HashMap; use std::fs; use tfdeploy; use tfdeploy::analyser::Analyser; use tfdeploy::tfpb::graph::GraphDef; use OutputParameters; use Result as CliResult; #[derive(Debug, Serialize)] pub struct Edge { pub id: usize, pub src_node_id: usize, pub src_node_output: usize, ...
//! Private module for selective re-export. use crate::actor::{Actor, Network}; use std::fmt::Debug; use std::hash::{Hash, Hasher}; use std::sync::Arc; /// Represents a snapshot in time for the entire actor system. pub struct ActorModelState<A: Actor, H = ()> { pub actor_states: Vec<Arc<A::State>>, pub networ...
use std::borrow::Borrow; pub trait KVIterator<K, V> { fn valid(&self) -> bool; fn key(&self) -> &K; fn value(&self) -> &V; fn next(&mut self); fn advance<Q: ?Sized + Ord>(&mut self, key: &Q) where K: Borrow<Q>; } #[cfg(test)] pub mod tests { use super::*; use rand::prelude::ran...
pub use drive_selector_derive::DriveSelector; use std::collections::{HashMap, HashSet}; pub trait DriveSelector { fn selector() -> String { let mut selector = String::new(); Self::selector_with_ident("", &mut selector); selector } fn selector_with_ident(ident: &str, selector: &mut ...
#![feature(lang_items, no_core)] #![no_core] #[no_mangle] pub fn main() {} #[lang = "sized"] trait Sized {} #[lang = "copy"] pub trait Copy {}
use std::error::Error; mod lib; fn main() -> Result<(), Box<Error>> { lib::notify("Hello", "World! 🌍") }
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ use reverie::syscalls::Displayable; use reverie::syscalls::Errno; use reverie::syscalls::Syscall; u...
use sudo_test::{Command, Env, TextFile}; use crate::Result; use super::{CHMOD_EXEC, DEFAULT_EDITOR, EDITOR_TRUE}; #[test] #[ignore = "gh657"] fn supresses_syntax_error_messages() -> Result<()> { let env = Env("this is fine") .file(DEFAULT_EDITOR, TextFile(EDITOR_TRUE).chmod(CHMOD_EXEC)) .build()?...
use std::{self, env}; use std::collections::HashMap; use std::convert::From; use std::path::PathBuf; use std::ffi::{self, CString}; use std::fs::File; use std::io::{self, BufReader, BufRead}; pub enum Error { IoError(io::Error), Utf8Error(std::str::Utf8Error), IntoStringError(ffi::IntoStringError), Par...
use super::expressions::*; use super::lex_token::TokenType; use super::lex_token::*; use super::scanner::Scanner; use super::statements::*; use anyhow::Result as AnyResult; use std::iter::Peekable; pub struct Parser<'a> { pub ast: Vec<StmtBox<'a>>, allow_unidentified: bool, scanner: Peekable<Scanner<'a>>, ...
/* * Copyright (c) 2020 Adel Prokurov * All rights reserved. * 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 a...
#[macro_export] macro_rules! profile_start { ($tag_count: expr) => { $crate::profiler::internal::begin($tag_count) }; } #[macro_export] macro_rules! profile_finish { ($writer: expr) => { $crate::profiler::internal::end($writer) }; } #[macro_export] macro_rules! profile_finish_to_file ...
#[doc = "Register `OPTR` reader"] pub type R = crate::R<OPTR_SPEC>; #[doc = "Field `RDPROT` reader - Read protection"] pub type RDPROT_R = crate::FieldReader<RDPROT_A>; #[doc = "Read protection\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u8)] pub enum RDPROT_A { #[doc = "0: Level 1"] ...
//! Implemented an [Object-Oriented Design Pattern] //! //! [object-oriented design pattern]: https://doc.rust-lang.org/book/ch17-03-oo-design-patterns.html use std::error::Error; use the_book::ch17::sec02::Post; fn main() -> Result<(), Box<dyn Error>> { let mut post = Post::new(); post.add_text("Let's start...
use std; use thiserror::Error; use bson::document::ValueAccessError; use bson::oid::Error as BsonError; use mongodb::error::Error as MongoError; use crate::model::ErrorMessage; use crate::reject::get_internal_error_message; pub type Result<T> = std::result::Result<T, Error>; #[derive(Error, Debug)] pub enum Error {...
fn main() { let f1 = 2.0; // f64 println!("{:?}", f1); let f2: f32 = 2.0; println!("{:?}", f2); let f3: f64 = 2.0; println!("{:?}", f3); }
// Problem 39 - Integer right triangles // // If p is the perimeter of a right angle triangle with integral length sides, // {a,b,c}, there are exactly three solutions for p = 120: // // {20, 48, 52}, {24, 45, 51}, {30, 40, 50} // // For which value of p ≤ 1000, is the number of solutions maximised? use std::co...
pub fn setup() { println!("During test"); }
use crate::Stargate; use http::{HeaderMap, HeaderValue}; use serde::{Deserialize, Serialize}; use serde_json::Value; #[derive(Serialize, Deserialize, Debug)] pub struct GraphQLRequest { pub query: String, #[serde(rename = "operationName")] pub operation_name: Option<String>, pub variables: Option<Value...
use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::ToTokens; use syn::parse::Parser; use syn::parse_macro_input::parse; use syn::punctuated::Punctuated; use syn::token::Comma; use syn::{Attribute, Error, Path}; use syn::{ExprAssign, LitStr}; pub(crate) struct ProvidesAttr { pub p...
#[doc = "Register `AHB3RSTR` reader"] pub type R = crate::R<AHB3RSTR_SPEC>; #[doc = "Register `AHB3RSTR` writer"] pub type W = crate::W<AHB3RSTR_SPEC>; #[doc = "Field `QSPIRST` reader - Quad SPI memory interface reset"] pub type QSPIRST_R = crate::BitReader; #[doc = "Field `QSPIRST` writer - Quad SPI memory interface r...
use super::{BaseMap, Point3}; /// Implement these for handling conversion to/from 2D coordinates (they are separate, because you might /// want Dwarf Fortress style 3D!) pub trait Algorithm3D: BaseMap { /// Convert a Point (x/y) to an array index. fn point3d_to_index(&self, pt: Point3) -> usize; /// Conve...
pub mod predefined; pub mod init; pub mod start;
//! Game Tree Search use crate::state::*; use crate::consts::*; use std::cmp; use std::collections::VecDeque; use crate::hashtables::*; // Evaluation Type #[derive(Copy,Clone,Debug,PartialEq,Eq)] pub enum EvalType { Alpha, Exact, } // Evaluation Result #[derive(Copy,Clone,Debug,PartialEq,Eq)] pub struct Eval...
extern crate aws_kms_crypt; // Optional; needed only if EncryptedSecret is serialized into JSON string extern crate serde_json; use std::collections::HashMap; fn main() { let mut encryption_context = HashMap::new(); encryption_context.insert("entity".to_owned(), "admin".to_owned()); let options = aws_km...
extern crate two_timer; // for timing the cost savings of using a serialized matcher fn main() { two_timer::MATCHER.parse("yesterday"); }
//! A tiny crate of utilities for working with implicit Wasm codegen conventions //! (often established by LLVM and lld). //! //! Examples conventions include: //! //! * The shadow stack pointer //! * The canonical linear memory that contains the shadow stack #![deny(missing_docs, missing_debug_implementations)] use ...
use specs::Join; pub struct HookSystem { collided: Vec<(::specs::Entity, f32)>, } impl HookSystem { pub fn new() -> Self { HookSystem { collided: vec![] } } } impl<'a> ::specs::System<'a> for HookSystem { type SystemData = ( ::specs::ReadStorage<'a, ::component::PhysicBody>, :...
use fltk::{app, button::*, enums::*, frame::*, group::*, prelude::*, window::*}; use std::cell::RefCell; use std::rc::Rc; /* Created:0.0.1 updated:0.0.1 description: As the file name explains. This is just example code for any new devs to go off of. */ fn _main() -> Result<(), Box<dyn std::error::Error>> { //re...
//! Implements the "Universal Chess Interface" protocol communication. //! //! "Universal Chess Interface" (UCI) is an open communication //! protocol for chess engines to play games automatically, that is to //! communicate with other programs including Graphical User //! Interfaces (GUI). UCI was designed and develop...
use anyhow::{format_err, Error}; use rusoto_s3::Object; use stack_string::{format_sstr, StackString}; use std::path::Path; use time::{format_description::well_known::Rfc3339, OffsetDateTime}; use url::Url; use crate::{ file_info::{FileInfo, FileInfoTrait, FileStat, Md5Sum, Sha1Sum}, file_service::FileService, ...
use super::{CacheError, Cacheable, FileData, FileLists, LocalFile}; use crate::config::Config; use std::collections::BinaryHeap; use std::collections::HashMap; use std::ffi::OsStr; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::time::UNIX_EPOCH; use std::fs; use tokio::sync::RwLock; // Con...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Resource { #[serde(default, skip_serializing_if = "Option::is_none")] pub id: Option<String>, #[serde(d...
use std::io; use std::path::PathBuf; use thiserror::Error; #[derive(Error, Debug)] pub enum EnvReaderError { #[error("io env reader error")] Io { #[from] source: io::Error, }, #[error("space on var name `{0}`")] SpaceOnVarName(String), #[error("unknown env error")] Unknown,...
use crate::config; use crate::maze::maze_genotype::MazeGenome; use crate::mcc::maze::maze_species::MazeSpecies; pub struct SpeciatedMazeQueue { pub species: Vec<MazeSpecies>, pub species_added: u32, } impl SpeciatedMazeQueue { pub fn new(mazes: Vec<MazeGenome>) -> SpeciatedMazeQueue { let mut queu...
struct CircularBuffer<T : Copy> { seqno : usize, data : Vec<T>, } struct CircularBufferIterator<'a, T: 'a + Copy> { slice : &'a [T], start : usize, end : usize, pos : usize, wrap : bool, } impl <T : Copy> CircularBuffer<T> { fn new(size : usize, default_value : T) -> CircularBuffer<T> { ...
use crate::rtb_type; rtb_type! { NativeImageAssetType, 500, Icon=1 }
use super::*; /// Structure that saves the reader specific to writing and reading a nodes csv file. /// /// # Attributes pub struct EdgeFileWriter { pub(crate) writer: CSVFileWriter, pub(crate) sources_column: String, pub(crate) sources_column_number: usize, pub(crate) destinations_column: String, ...
use octocrab::models::repos::Object; use octocrab::models::Repository; use octocrab::Octocrab; use octocrab::params::repos::Reference; use serde_json::Value; use warp::{Rejection, Reply}; use warp::http::StatusCode; pub async fn run() -> Result<impl Reply, Rejection> { let token = read_env_var("GITHUB_TOKEN"); ...
// Copyright (C) 2021 Subspace Labs, Inc. // SPDX-License-Identifier: GPL-3.0-or-later // 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 Software Foundation, either version 3 of the License, or // (at your option)...
use super::client::PlayerClient; use super::{IncomingMessage, LobbyState, OutgoingMessage}; use super::{LobbyChannel, LobbyCommand, LobbyError, LobbyResponse, ResponseChannel}; use crate::database::games::{DBGameError, DBGameStatus, DatabaseGame}; use crate::game::{ builder::GameBuilder, snapshot::{GameSnapshot...
//! # Feature Table //! //! Data model and parsers for the DDBJ/ENA/GenBank Feature Table. //! //! See: http://www.insdc.org/files/feature_table.html use nom::{ IResult, branch::{ alt, }, bytes::complete::{ tag, take_while_m_n, take_while, take_while1, }, character::{ is_alphanumeri...
use parquet::basic::LogicalType; use parquet::file::reader::{FileReader, SerializedFileReader}; use parquet::record::Field; use std::{collections::HashMap, convert::TryFrom, path::Path}; pub struct Data { pub types: HashMap<String, LogicalType>, pub data: HashMap<String, Vec<i64>>, } impl Data { pub fn n...
// Copyright (c) 2021, Roel Schut. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. use gdnative::api::CPUParticles2D; use crate::*; #[derive(NativeClass)] #[inherit(CPUParticles2D)] pub struct PlayerDestroyParticles {} #[methods] impl Play...
pub use self::arch::*; #[cfg(target_arch = "x86")] #[path="x86/paging.rs"] mod arch; #[cfg(target_arch = "x86_64")] #[path="x86_64/paging.rs"] mod arch;
use assembly_fdb::{mem::Database, store}; use color_eyre::eyre::{self, WrapErr}; use mapr::Mmap; use std::{fs::File, io::BufWriter, path::PathBuf, time::Instant}; use structopt::StructOpt; #[derive(StructOpt)] /// Creates a FDB file with the same table structure as the input file, but without any rows struct Options {...
#![allow(missing_docs)] #[cfg(feature = "sdram")] mod as4c16m32msa; #[cfg(feature = "sdram")] pub use as4c16m32msa::*; #[cfg(feature = "sdram")] mod is42s16400j; #[cfg(feature = "sdram")] pub use is42s16400j::*; #[cfg(feature = "sdram")] mod is42s32800g; #[cfg(feature = "sdram")] pub use is42s32800g::*; #[cfg(featu...
fn main() { #[cfg(all(windows, not(debug_assertions)))] { // Set application icon. let mut res = winres::WindowsResource::new(); res.set_icon("resources/icon/infinite_minesweeper.ico"); res.compile().unwrap(); } }
use super::{Result, Settings, KV}; use reqwest::Client; const USER_AGENT: &str = concat!( env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"), " (+", env!("CARGO_PKG_HOMEPAGE"), ")" ); pub async fn update_consul(settings: &Settings, kvs: Vec<KV>) -> Result<()> { let client = Client::bui...
// Generated by `scripts/generate.js` use std::os::raw::c_char; use std::ops::Deref; use std::ptr; use std::cmp; use std::mem; use utils::c_bindings::*; use utils::vk_convert::*; use utils::vk_null::*; use utils::vk_ptr::*; use utils::vk_traits::*; use vulkan::vk::*; /// Wrapper for [VkAabbPositionsKHR](https://www.k...
use std::fmt; use std::hash::{Hash, Hasher}; use std::mem::{MaybeUninit, size_of}; use std::ptr::{read, drop_in_place}; use std::ops::{Deref, DerefMut}; use std::slice::{self, from_raw_parts, from_raw_parts_mut}; use std::iter::FromIterator; use crate::vector::Vector; use crate::array::{Array, ArrayIndex}; use crate::u...
use priv_prelude::*; use future_utils; #[derive(Clone, PartialEq)] /// Represents an ethernet frame. pub struct EtherFrame { buffer: Bytes, } impl fmt::Debug for EtherFrame { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let payload = self.payload(); f .debug_struct("EtherFra...
use std::convert::Infallible; use std::io::Read; use warp::filters::path::FullPath; use warp::Filter; async fn request_screenshot(path: FullPath) -> Result<Vec<u8>, Infallible> { let dir = tempfile::tempdir().unwrap(); let cmd = tokio::process::Command::new("google-chrome") .arg("--no-sandbox") ...
// This file is part of libfringe, a low-level green threading library. // Copyright (c) Nathan Zadoks <nathan@nathan7.eu>, // whitequark <whitequark@whitequark.org> // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE...
use crate::{ bit_set, bit_set::{word, Word}, }; /// A constant value of [Access::size](trait.Access.html#tymethod.size). pub trait Capacity { const CAPACITY: u64; } pub trait Access { /// The potential bit size of the container. /// /// But the container is not guaranteed to be able to reach t...
use std::env; use std::fs::File; use std::io::Write; use std::path::Path; use std::process::Command; fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("gnvim_version.rs"); let mut f = File::create(&dest_path).unwrap(); let mut cmd = Command::new("git"); ...
// TODO use predicate instead of equijoin // This is an inner equijoin only for now. use super::{DbIterator}; use super::tuple::{Tuple}; #[derive(Debug, Clone)] pub struct NestedLoopsJoin<I> { // intitialize input_l: I, input_r: I, current_l: Option<Tuple>, col_l: usize, col_r: usize, } impl<I...
//! Message Module //! //! //! //! //! //! Check link below for more info: //! https://github.com/ValvePython/steam/blob/09f4f51a287ee7aec1f159c7e8098add5f14bed3/steam/core/msg/headers.py #[cfg(test)] mod tests { use protobuf::Message; use steam_language_gen::{MessageHeader, MessageHeaderExt, SerializableByte...
////////////////////////////////////////////////// // General notes // // - Rust is an expression-based language // ////////////////////////////////////////////////// // Functions // // - Must declare the type of each parameter // - Function bodies are made up of a series of // statements optionally ending in an exp...
use std::fs::File; use std::io::Read; #[derive(Debug)] pub struct Parser { name: String, lines: Vec<String>, idx: usize, } impl Parser { pub fn new(path: &str, name: &str) -> Self { let file_name = format!("{}{}", path, name); let mut file = File::open(file_name).expect("File not found!...
use hilbert_qexp::diff_op::rankin_cohen; use hilbert_qexp::elements::{div_mut, relations_over_q, HmfGen}; use hilbert_qexp::bignum::Sqrt2Q; use hilbert_qexp::bignum::RealQuadElement; use parallel_wt::*; use mixed_wt::*; use flint::fmpq::Fmpq; use std::fs::File; use serde; use serde_pickle; use std::io::Write; /// Corr...
/**********************************************************\ | | | hprose | | | | Official WebSite: http://www.hprose.com/ | | ...
use ranges::Ranges; pub struct CPUCache { line_size: u8, line_size_bits: u8, sets_min_1: u64, assoc: u64, tags: Vec<u64>, } /* Returns the base-2 logarithm of x. Returns None if x is not a power of two. */ fn log2(x: u32) -> Option<u8> { /* Any more than 32 and we overflow anyway... */ ...
use super::regex::{Regex, Region}; use super::scope::*; use super::syntax_definition::*; use yaml_rust::{YamlLoader, Yaml, ScanError}; use yaml_rust::yaml::Hash; use std::collections::HashMap; use std::error::Error; use std::path::Path; use std::ops::DerefMut; #[derive(Debug, thiserror::Error)] #[non_exhaustive] pub e...
#[macro_use] extern crate log; #[macro_use] extern crate rustful; extern crate env_logger; extern crate rust_captcha; use rustful::{Server, TreeRouter}; use std::error::Error; use std::env; use rust_captcha::requesthandler::{RequestHandler, CaptchaMethod}; fn precondition_checks() -> bool { match env::var("REDIS...
use std::io::Read; use std::io::BufReader; use std::io::Error as IoError; use std::ascii::AsciiExt; use color::{ColorType}; use image::{DecodingResult, ImageDecoder, ImageResult, ImageError}; extern crate byteorder; use self::byteorder::{BigEndian, ByteOrder}; /// PPM decoder pub struct PPMDecoder<R> { reader: B...
#[doc = "Reader of register BIST_ADDR_START"] pub type R = crate::R<u32, super::BIST_ADDR_START>; #[doc = "Writer for register BIST_ADDR_START"] pub type W = crate::W<u32, super::BIST_ADDR_START>; #[doc = "Register BIST_ADDR_START `reset()`'s with value 0"] impl crate::ResetValue for super::BIST_ADDR_START { type T...
use std::{ convert::TryInto, net::{IpAddr, SocketAddr}, }; use bytes::{BufMut, BytesMut}; use num_enum::{FromPrimitive, IntoPrimitive, TryFromPrimitive}; use std::net::ToSocketAddrs; use tokio::{ io::{AsyncRead, AsyncReadExt}, net::TcpStream, }; // Version of SOCKS proxy protocol pub const SOCKS_VERSI...