text stringlengths 8 4.13M |
|---|
#![cfg_attr(rustfmt, rustfmt::skip)]
use super::*;
#[cfg(not(any(target_arch = "wasm32", not(feature = "std"))))] // no libc on WASM nor no_std
const_assert! {
::core::mem::size_of::<crate::libc::uintptr_t>()
==
::core::mem::size_of::<crate::libc::size_t>()
}
const _: () = { macro_rules! impl_CTypes {
... |
use std::thread::sleep;
use std::time::Duration;
use wooting_sdk::{analog, Key};
fn main() {
println!(
"Keyboard connected? {}",
analog::is_wooting_keyboard_connected()
);
println!("Reading keyboard state in 5 seconds...");
sleep(Duration::from_millis(5000));
println!("Reading...")... |
use std::cmp;
use nimiq_block::{Block, BlockType};
use nimiq_hash::Blake2bHash;
use crate::{AbstractBlockchain, BlockchainError, ChainInfo};
/// Enum describing all the possible ways of comparing one chain to the main chain.
#[derive(Debug, Eq, PartialEq)]
pub enum ChainOrdering {
// This chain is an extension o... |
use crate::vec::*;
use crate::ray::*;
use crate::hittable::*;
use crate::material::*;
use std::sync::Arc;
//#[derive(Clone)]
pub struct Sphere {
pub center: Point,
pub radius: f64,
pub material: Material,
}
impl Sphere {
pub fn new(x: f64, y: f64, z: f64, radius: f64, material: Material) -> Self {
... |
// Copyright 2020 sacn 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 except according to th... |
use author;
use remnant;
use std::collections::HashMap;
/// A Universe contains two collections:
/// * The known author identifiers and their public keys
/// * The known remnants
///
/// In addition, a Universe also contains information about the author
/// to use for the currently running process.
#[derive(Debu... |
// Copyright 2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
mod input_selection;
#[cfg(feature = "mqtt")]
mod mqtt;
mod signing;
use std::{collections::HashMap, hash::Hash, str::FromStr};
use crypto::keys::slip10::Chain;
use iota_client::{
block::{
address::{Address, AliasAddress},
out... |
use std::collections::BTreeSet;
use std::sync::Arc;
use arrow::array::{Array, ArrayRef, DictionaryArray, StringArray};
use arrow::datatypes::{DataType, Int32Type};
use arrow::error::{ArrowError, Result};
use arrow::record_batch::RecordBatch;
use hashbrown::HashMap;
use crate::dictionary::StringDictionary;
/*
An abs... |
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
include!("bindings.rs");
#[cfg(target_os = "macos")]
#[link(name = "Foundation", kind = "framework")]
extern "C" {}
|
use crate::{
ctx,
game_graph::{GGIndexFormat, GGVertexFormat},
game_graph_driver::GGD_MeshData,
};
use libc::c_void;
use nice_engine::{
mesh_data::{MeshData, Pntl_32F, Pntlb3_32F, Pntlb7_32F},
GpuFuture,
};
use std::slice;
#[allow(non_snake_case)]
pub unsafe extern fn MeshData_Alloc() -> *mut GGD_MeshData {
let ... |
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::*;
// scanner from https://codeforces.com/contest/1396/submission/91365784
struct Scanner {
stdin: Stdin,
buffer: VecDeque<String>,
}
#[allow(dead_code)]
impl Scanner {
fn new() -> Self {
Scanner {
stdin: stdin(),
... |
//! BSP loading code
//!
//! All numeric types use uNN/iNN types instead of `libc::c_****` types because Quake assumes that
//! it's compiled for a 32-bit computer. These numbers are all used for file IO and therefore do not
//! respect the actual C type of the numbers used.
use ioendian::{Little, IntoNativeEndian};
u... |
use crate::riichi::scores::Score;
use crate::riichi::shape_finder::ShapeFinder;
use crate::riichi::shapes::{ClosedShape, CompleteShape, OpenKan, OpenShape, Shape, ShapeType};
use crate::riichi::table::Table;
use crate::riichi::tile::{Tile, TileType};
use enum_iterator::IntoEnumIterator;
use std::collections::HashMap;
u... |
struct Solution;
use std::collections::HashMap;
use std::usize;
impl Solution {
fn find_restaurant(list1: Vec<String>, list2: Vec<String>) -> Vec<String> {
let mut hm: HashMap<&str, usize> = HashMap::new();
let mut min = usize::MAX;
let mut res: Vec<String> = vec![];
for i in 0..li... |
use std::hash::Hash;
use std::hash::Hasher;
use std::net::SocketAddr;
use bip_handshake::Extensions;
use bip_util::bt::{InfoHash, PeerId};
/// Information that uniquely identifies a peer.
///
/// Equality oprations DO NOT INCLUDE `Extensions` as we define a
/// unique peer as `(address, peer_id, hash)`, so equality ... |
extern crate crypto;
use self::crypto::digest::Digest;
use self::crypto::sha3::Sha3;
pub type Index = i32;
pub fn prepare_string_to_hash(index: Index, previous_hash: &str, data: &str) -> String {
format!("{}{}{}", index, previous_hash, data)
}
pub fn hash_from_string(value: String) -> String {
let mut hashe... |
use std::net::IpAddr;
use warp::Filter;
use warp_real_ip::real_ip;
fn serve<'a>(trusted: Vec<IpAddr>) -> impl Filter<Extract = (String,)> + 'a {
warp::any()
.and(real_ip(trusted))
.map(|addr: Option<IpAddr>| addr.unwrap().to_string())
}
#[tokio::test]
async fn test_not_forwarded() {
let remote... |
use core::ffi::{c_int, c_void};
#[repr(C)]
pub struct FlowElement {
pub typ: u8,
pub sub_type: u8,
pub pad: u16,
pub param1: u16,
pub param2: u16,
pub next: u16,
pub param3: u16,
pub param4: u16,
pub param5: u16,
}
// opaque
#[repr(C)]
pub struct TextManager {
pad: u8,
}
#[rep... |
use super::fs::{Filesystem, Inode, Attrs, Kind, Error, ReadFd, WriteFd};
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::collections::{HashMap, BTreeMap};
use fuse;
use libc;
use time::{self, Timespec};
macro_rules! fuse_try(
($val:expr, $reply:expr) => {
match $val {
Ok(val) => val,
... |
use redbox::server;
#[tokio::main]
async fn main() {
let port = 63790; // Redis port is 6379
let addr = format!("127.0.0.1:{}", port);
if let Err(err) = server::run(&addr).await {
panic!("Redbox failed: {}", err);
}
}
|
// Fixed list where elements are of the same type
// Stack allocated
pub fn run() {
// has to have 5 elements, fixed size when defined
let numArray: [i32; 5] = [1, 2, 3, 4, 5];
println!("{:?}", numArray);
println!("The array is taking up {} bytes on the stack", std::mem::size_of_val(&numArray));
... |
use std::convert::TryFrom;
use bytes::Bytes;
use prost::Message;
use crate::{
codec::{primitive::Hash, CodecError, ProtocolCodecSync},
field, impl_default_bytes_codec_for,
traits::ServiceResponse,
types::primitive as protocol_primitive,
types::receipt as protocol_receipt,
ProtocolError, Protoc... |
use futures_core::stream::Stream;
use futures_util::stream::StreamExt;
use reqwest::ClientBuilder;
use serde::de::DeserializeOwned;
use serde_json::json;
use std::collections::HashMap;
use super::client::USER_AGENT;
use super::{Error, KsqlDB, Result};
#[cfg(feature = "http2")]
pub use http2::*;
#[cfg(not(feature = ... |
use std::fs;
use std::path::PathBuf;
use http::Uri;
use slog::Logger;
use tantivy::directory::MmapDirectory;
use tantivy::schema::Schema;
use tantivy::Index;
use tonic::{transport, Code, Response, Status};
use toshi_proto::cluster_rpc::*;
use toshi_types::{Error, Search};
pub fn create_from_managed(mut base_path: Pa... |
extern crate add_one;
fn main() {
let sum = 10;
println!("Hey, {} plus one is {}",sum,add_one::add_one(sum))
}
|
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2
use anyhow::Result;
use futures::{StreamExt, TryStreamExt};
use starcoin_config::NodeConfig;
use starcoin_logger::prelude::*;
use starcoin_rpc_client::RpcClient;
use starcoin_types::system_events::MintBlockEvent;
use std::sync::Arc;
u... |
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;
const MOD: i64 = 100000... |
use std::collections::BTreeMap;
#[derive(Debug, Deserialize)]
pub struct MonthlyPoint {
#[serde(rename = "1. open")]
pub open: String,
#[serde(rename = "2. high")]
pub high: String,
#[serde(rename = "3. low")]
pub low: String,
#[serde(rename = "4. close")]
pub close: String,
#[serde... |
use super::{GraphNode, GraphEdge};
use std::clone::Clone;
use std::cell::Ref;
use std::hash::Hash;
use std::collections::hash_set::HashSet;
use std::collections::hash_map::HashMap;
pub struct DijkstraPathInfo<Node> {
pub node: Node,
pub previous_node: Option<Node>,
pub cost: i32,
}
impl<Node> DijkstraPat... |
#[cfg(ocvrs_opencv_branch_32)]
#[doc(hidden)]
#[deprecated(note = "OpenCV 3.2 is no longer supported")]
#[macro_export]
macro_rules! opencv_branch_32 {
($($tt:tt)*) => { $($tt)* }
}
/// Conditional compilation macro based on OpenCV branch version for usage in external crates.
/// # Examples
///
/// Alternative import... |
mod assets;
mod font_collection;
mod font_with_info;
mod texture_manager;
mod texture_with_info;
pub use assets::Assets;
pub use texture_manager::TextureManager;
|
// array, fixed list and all elements in same data type..
use std::mem;
pub fn run() {
let mut numbers: [i32; 5] = [1, 2, 3, 4, 5];
// Re-assign
numbers[2] = 22;
// all array
println!("{:?}", numbers);
// single i
println!("first: {}, last: {}", numbers[0], numbers[numbers.len() - 1]);
... |
use serde_derive::{Deserialize, Serialize};
use slog::{info, o};
use slog::{Drain, Logger};
use std::net::SocketAddr;
use std::sync::{Arc, Mutex};
use warp::{
http::{self, HeaderValue},
hyper::header::CONTENT_TYPE,
Filter, Rejection, Reply,
};
#[derive(Serialize, Deserialize)]
struct Message {
id: u32,... |
use std::net::SocketAddr;
use republic::{LogMiddleware, RequestCtx, Response, ResponseBuiler, Server};
use tracing::Level;
use tracing_subscriber::FmtSubscriber;
#[tokio::main]
async fn main() {
let subscriber = FmtSubscriber::builder()
// all spans/events with a level higher than TRACE (e.g, debug, info,... |
use serde::*;
use ate::prelude::*;
use fxhash::FxHashMap;
use super::api::*;
use super::dir::Directory;
use super::file::RegularFile;
use super::fixed::FixedFile;
use super::symlink::SymLink;
pub const PAGES_PER_BUNDLE: usize = 1024;
pub const PAGE_SIZE: usize = 131072;
pub const WEB_CONFIG_ID: u64 = 0xb709d79e5cf6dd6... |
use async_trait::async_trait;
use tonic::{transport::Channel, Request};
use tracing::error;
use super::{proto::*, Manifest};
use crate::{error::Result, format::TableDesc};
type ManifestClient = manifest_client::ManifestClient<Channel>;
pub struct RemoteManifest {
client: ManifestClient,
}
impl RemoteManifest {
... |
fn f1() {
let mut s = String::from("gravity");
let r: &String = &s; // An immutable reference to mutable data can be made (mutable data can be borrowed as immutable)
println!("{}", r);
s.push_str(" always"); // But mutating the data implies borrowing as mutable, hence invalidating r.
// println!("{... |
use super::*;
use crate::tools::{assert::CloudMessage, messages::WaitForMessages, tls};
use async_std::sync::Mutex;
use async_trait::async_trait;
use rumqttc::{AsyncClient, Event, Incoming, MqttOptions, Transport};
use std::sync::atomic::{AtomicBool, Ordering};
use std::{fs, sync::Arc, time::Duration};
use tokio::task:... |
use crate::Lexer;
use crate::Object;
use crate::Container;
use crate::parser::on_semicolon;
use crate::traits::LexerTrait;
use crate::traits::ParseTrait;
use crate::traits::EvalTrait;
use crate::traits::NamespaceTrait;
use crate::program::expression::Identifier;
use crate::program::expression::Expression;
use crate... |
use crate::{
ReadNpyError, ReadNpyExt, ReadableElement, WritableElement, WriteNpyError, WriteNpyExt,
};
use ndarray::prelude::*;
use ndarray::{Data, DataOwned};
use std::error::Error;
use std::fmt;
use std::io::{BufWriter, Read, Seek, Write};
use zip::result::ZipError;
use zip::write::FileOptions;
use zip::{Compres... |
mod spectests;
fn main() -> std::io::Result<()> {
spectests::build()
}
|
//! light _Merkle Tree_ implementation.
//!
//! Merkle tree (MT) implemented as a full (power of 2) arity tree allocated as a vec
//! of statically sized hashes to give hashes more locality (although disk based backings
//! are supported, as a partial tree disk based backings). MT is specialized
//! to the extent of a... |
pub struct Solution {}
impl Solution {
pub fn length_of_lis(nums: Vec<i32>) -> i32 {
let mut tracking = Vec::new();
for num in nums {
if let Err(idx) = tracking.binary_search(&num) {
if idx >= tracking.len() {
tracking.push(num);
} els... |
use support::{decl_storage, decl_module, StorageValue, StorageMap, dispatch::Result};
use system::ensure_signed;
pub trait Trait: system::Trait {}
decl_storage! {
trait Store for Module<T: Trait> as VerifiableCreds {
SubjectCount: u32;
Subjects: map u32 => T::AccountId;
}
}
decl_module! {
... |
#[allow(dead_code)]
pub fn run() {
let s = String::from("hello world");
let word = first_word(&s);
//s.clear(); //word still has the values 5 here, but there's no more string that
//==============================================
//we can make index part of string, it is called slice- reference to pa... |
use std::collections::BTreeMap;
const INPUT: &'static str = include_str!("input.txt");
fn main() {
let mut overlaps: BTreeMap<(u32, u32), u32> = BTreeMap::new();
let claims: Vec<Claim> = INPUT.lines().map(|l| Claim::new(l)).collect();
for a in claims {
for x in a.x..a.x + a.width {
for y in a.y..a.y... |
// SPDX-License-Identifier: Apache-2.0
#![allow(clippy::unreadable_literal)]
pub mod error;
pub mod syscall;
pub const STDIN: u64 = 0;
pub const STDOUT: u64 = 1;
pub const STDERR: u64 = 2;
pub const PROT_READ: u64 = 1;
pub const PROT_WRITE: u64 = 2;
pub const PROT_EXEC: u64 = 4;
pub const PROT_NONE: u64 = 0;
pub c... |
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors
//
// 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
//
// Unl... |
use ethers_core::types::{
transaction::eip2718::TypedTransaction, Address, BlockId, Bytes, Signature,
};
use ethers_providers::{maybe, FromErr, Middleware, PendingTransaction};
use ethers_signers::Signer;
use async_trait::async_trait;
use thiserror::Error;
#[derive(Clone, Debug)]
/// Middleware used for locally s... |
#![deny(unsafe_code)]
#![no_main]
#![no_std]
use panic_semihosting as _;
use cortex_m_rt::entry;
use stm32f1xx_hal::{adc, pac, prelude::*};
use cortex_m_semihosting::hprintln;
#[entry]
fn main() -> ! {
// Acquire peripherals
let p = pac::Peripherals::take().unwrap();
let mut flash = p.FLASH.constrain();... |
use super::plumbing::*;
use super::ParallelIterator;
use super::Try;
use std::ops::ControlFlow::{self, Break, Continue};
use std::sync::atomic::{AtomicBool, Ordering};
pub(super) fn try_reduce<PI, R, ID, T>(pi: PI, identity: ID, reduce_op: R) -> T
where
PI: ParallelIterator<Item = T>,
R: Fn(T::Output, T::Outp... |
use mongodb::Database;
use bson::{Document, doc};
use crate::{db::{prelude::*, mongo}, model::password::Password, utils::context::ServiceContext, utils::errors::{ErrorCode, VaultError}};
///
/// Load the requested password from the database.
///
#[tracing::instrument(name="db:load", skip(db))]
pub async fn load(passw... |
extern crate rgsl;
extern crate gnuplot;
mod interpolator;
use interpolator::Interpolator;
use gnuplot::{Figure, Caption, Color};
fn main() {
let xa = &[1_f64, 2., 3.];
let ya = &[6_f64, 2., 9.];
let mut interp = Interpolator::new_polynomial(xa, ya);
let x = (10..31).map(|x| x as f64 / 10.0).collect:... |
use crate::assets::{Handle};
use specs::{Component,storage::{DenseVecStorage}};
use crate::render::types::*;
use crate::common::{Transform,rect::{Rect},Rect2D};
use crate::render::components::{ImageGenericInfo,ImageType,Mesh2D};
pub struct ImageRender {
pub texture:Option<Handle<Texture>>,
info:ImageGenericInfo... |
//! Everything related to effects.
use crate::{
core::{
define_is_as, pool::Handle, reflect::prelude::*, variable::InheritableVariable,
visitor::prelude::*,
},
define_with,
scene::{node::Node, sound::context::SoundContext},
};
use fyrox_sound::dsp::filters::Biquad;
use std::{
cell::... |
extern crate serde;
extern crate serde_json;
#[derive(Debug, PartialEq, Clone)]
pub enum Foo {
Bar,
Baz,
}
impl serde::de::Deserialize for Foo {
fn deserialize<D>(deserializer: &mut D) -> Result<Foo, D::Error>
where D: serde::de::Deserializer
{
deserializer.visit(FooVisitor)
}
... |
pub fn say_hello() {
println!("hello to the world");
}
pub fn print_numbers() {
let numbers = [1, 2, 3, 4, 5];
for n in numbers.iter() {
println!("{}", n);
}
}
pub fn output_sequence(target: &[u8]) {
for n in target {
println!("{}", n);
}
}
pub fn generate_sequence(limit: u8) ... |
//! A SMTP server written in rust
extern crate smtp;
use smtp::Smtp;
pub fn main() {
assert!(Smtp::new().is_ok());
}
|
use super::application::App;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Store {
pub apps: Vec<App>,
}
|
fn main() {
let pi = 3.141592;
// In general, the `{}` will be automatically replaced with any
// arguments. These will be stringified.
println!("{} days", 31);
println!("{0} this is {1}. {1}, this is {0}", "Bubu", "Zuzu");
println!(
"{subject} {verb} {object}",
object = "the laz... |
pub mod db;
mod hir;
pub mod lower_syntax;
|
use std::str::FromStr;
use regex::Regex;
use crate::lib;
struct Password {
first: u32,
second: u32,
ch: char,
password: String,
}
impl Password {
fn valid_count(self: &Self) -> bool {
let count: u32 = self.password.chars()
.map(|ch| if ch == self.ch { 1 } else { 0 })
... |
use crate::graph::Graph;
use crate::behaviour::Behaviour;
use EntityState::Stationary;
use EntityState::Traversing;
use std::fmt;
use std::fmt::Display;
#[derive(Clone, Copy)]
pub enum EntityState<K: Copy> {
Stationary(K, u32),
Traversing(K, K, u32),
}
impl<K: Display + Copy> Display for EntityState<K> {
... |
#[doc = "Register `STAT` reader"]
pub struct R(crate::R<STAT_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<STAT_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<STAT_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<STAT_SP... |
//! Generate substrate parachain with ink! contract
mod contract;
mod parachain;
mod result;
pub use self::{contract::Contract, parachain::Parachain};
|
use crate::mem::PAGE_SIZE;
pub struct Box {
memory: [u8; PAGE_SIZE],
length: usize,
capacity: usize,
}
impl Default for Box {
fn default() -> Self {
Self::new()
}
}
impl Box {
pub fn new() -> Self {
Self {
memory: [0; PAGE_SIZE],
length: 0,
... |
use std::io;
fn main()
{
println!("Please input the number you would like analized.");
let mut guess = String::new();
io::stdin().read_line(&mut guess)
.expect("Please type a number!");
let mut bytes = guess.into_bytes();
println!("The number is {} digits", bytes.len());
//convert from ascii to dec
for i... |
#![no_std]
#![no_main]
#![feature(abi_x86_interrupt)]
mod game;
use core::panic::PanicInfo;
use lazy_static::lazy_static;
use pic8259_simple::ChainedPics;
use x86_64::instructions::port::Port;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
pub const PIC_1_OFFSET: u8 = 32;
pub const VGA... |
//#![windows_subsystem = "windows"]
use std::mem;
use std::ptr::null_mut;
use winapi::shared::minwindef::*;
use winapi::shared::windef::*;
use winapi::um::libloaderapi::GetModuleHandleW;
use winapi::um::winuser::*;
mod util;
use crate::util::*;
mod brushes;
use crate::brushes::*;
mod close_button;
use crate::close_bu... |
use std::collections::HashMap;
const CASH_UNITS: [u128; 15] = [
500_00, 200_00, 100_00, 50_00, 20_00, 10_00, 5_00, 2_00, 1_00, 50, 20, 10, 5, 2, 1,
];
fn cash_units(amount: u128) -> HashMap<u128, u128> {
let mut rest = amount;
let mut result = HashMap::new();
for cash_unit in &CASH_UNITS {
le... |
use scrabble_score::score;
fn main(){
let word = "SAM"; //1 + 1 + 3 = 5
println!("{} {}", word, score(word));
} |
use std::env;
use std::fs;
fn main() {
let input_file = env::args().nth(1).expect("You need to pass an input file!");
let input = fs::read_to_string(input_file).unwrap();
let depths: Vec<u32> = input
.lines()
.map(|line| line.parse::<u32>().unwrap())
.collect();
println!("... |
mod lib;
use chess_engine::*;
fn main() {
let mut board_matrix = lib::board_to_matrix(lib::BOARD.lock().unwrap().get_board());
print_board(board_matrix);
let mut move_str = ['h' as u8, '2' as u8,'h' as u8, '4' as u8];
println!("{}", lib::userMove(&mut board_matrix, &(move_str[0] as i8)));
print_boa... |
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Softwa... |
use std::collections::{HashMap, HashSet};
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
struct CellCoords {
x: i32,
y: i32,
z: i32,
w: i32,
}
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
struct Cell {
coords: CellCoords,
active: bool,
}
impl Cell {
fn activate(&mut self) {
... |
use crate::{Error, Result};
use std::path::Path;
use std::process::Command;
use std::time::{Duration, Instant};
pub struct RunOptions<'a> {
pub executable_path: &'a Path,
pub project_directory: &'a Path,
}
pub fn run(options: &RunOptions) -> Result<()> {
let mut process = Command::new(options.executable_path)
.c... |
pub mod default_impl;
pub use default_impl::DefaultImpl;
pub mod try_into_result_impl;
pub use try_into_result_impl::TryIntoResultImpl;
use crate::core::definition;
use crate::core::implementation;
use crate::core::intermediary;
pub struct DataContext;
impl<'a> implementation::Trait<&'a intermediary::DataContext<... |
use crate::map::MapComponent;
use pathfinding::prelude::absdiff;
/// Deprecated. An enum for expressing the
/// relationship of two X coordinates.
pub enum XPointRelation {
LeftOfPoint,
RightOfPoint,
OnPointX
}
/// Deprecated. An enum for expressing the
/// relationship of two Y coordinates.
pub enum YPo... |
use std::env;
use std::fs;
fn parse_seat(line: &str) -> Result<usize,String> {
if line.len() != 10 {
return Err(format!("Length was {} instead of 10", line.len()));
}
let mut digit_value: usize = 2_usize.pow(10-1);
let mut value: usize = 0;
for digit in line.chars() {
if digit == 'B... |
extern crate mio;
extern crate bitreader;
extern crate hpack_codec;
extern crate rustls;
mod proto;
pub mod app;
pub mod helpers;
|
use std::{env, fs, path};
use std::io::{self, Error, ErrorKind};
use regex::Regex;
use crate::lib::term;
pub const LISTDIR: &str = "./list";
pub fn self_is_symlink() -> bool {
env::current_exe().unwrap().read_link().is_ok()
}
lazy_static! {
static ref RE_EXE: Regex = Regex::new(r"\.[eE][xX][eE]$").unwrap();... |
use bencher::Bencher;
pub fn baseline(b: &mut Bencher) {
b.iter(|| {
assert_eq!(galil_seiferas::gs_find(super::BASELINE1, super::BASELINE), Some(1));
});
}
pub fn big_pattern(b: &mut Bencher) {
b.iter(|| {
assert_eq!(galil_seiferas::gs_find(super::BIG_SEARCH, super::BIG_PATTERN), Some(1));
});
}
pub ... |
#![cfg_attr(all(feature = "alloc", feature = "cortexm"), feature(alloc_error_handler))]
#![cfg_attr(all(not(feature = "std"), feature = "cortexm"), no_std)]
#![cfg_attr(all(not(feature = "std"), feature = "cortexm"), no_main)]
// - bare metal entrypoint ----------------------------------------------------
#[cfg(all(... |
use super::plumbing::*;
use super::ParallelIterator;
use super::Try;
use std::ops::ControlFlow::{self, Break, Continue};
use std::sync::atomic::{AtomicBool, Ordering};
pub(super) fn try_reduce_with<PI, R, T>(pi: PI, reduce_op: R) -> Option<T>
where
PI: ParallelIterator<Item = T>,
R: Fn(T::Output, T::Output) -... |
#[macro_use] extern crate nom;
mod ast;
mod e_ast;
mod parser;
mod eval;
fn main() {
let args = std::env::args().collect::<Vec<_>>();
let source = read_file(args[1].to_string());
match parser::parse(nom::types::CompleteStr(&source)) {
Ok((_, r)) => {
let start = std::time::Instant::no... |
use std::marker::PhantomData;
use either::Either;
use futures_core::stream::BoxStream;
use futures_util::{future, StreamExt, TryFutureExt, TryStreamExt};
use crate::arguments::{Arguments, IntoArguments};
use crate::database::{Database, HasArguments, HasStatement, HasStatementCache};
use crate::encode::Encode;
use cra... |
pub mod sprite;
use sdl2::{EventPump, TimerSubsystem};
use sdl2_image::{self, LoadTexture};
use sdl2::render::Renderer;
use sdl2::pixels::Color;
use sdl2::render::Texture;
use sdl2::rect::{Rect, Point};
use tiled::{Map, parse};
use std::collections::HashMap;
use std::path::Path;
use std::fs::File;
use engine::sprite::... |
extern crate libc;
mod instruction;
mod module;
pub mod enumerations;
pub use instruction::data::*;
pub use module::{Module, ModuleHeader};
pub use instruction::*; |
use winit::event_loop::EventLoopWindowTarget;
use crate::*;
pub(crate) fn create_window(app: &mut Application, target: &EventLoopWindowTarget<()>)
{
use winit::window::WindowBuilder;
use winit::dpi::PhysicalSize;
// get request, if any
if let Some(request) = app.resources().remove::<super::RWindowReq... |
//! low level transport that deals with reading bytes from an underlying Io
//! handling data split accross packets, etc.
use std::collections::VecDeque;
use std::cell::RefCell;
use std::fmt;
use std::io::{self, Write};
use std::mem;
use std::ops::{Deref, DerefMut};
use std::sync::Arc;
use std::str;
use byteorder::{Lit... |
use anomaly::{BoxError, Context};
use thiserror::Error;
use crate::ics24_host::identifier::{ClientId, ConnectionId};
use crate::Height;
pub type Error = anomaly::Error<Kind>;
#[derive(Clone, Debug, Error, Eq, PartialEq)]
pub enum Kind {
#[error("connection state unknown")]
InvalidState(i32),
#[error("co... |
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::fmt::Write;
use std::str::FromStr;
use std::string::ToString;
use fastobo::ast;
use fastobo::ast as obo;
use fastobo::ast::Date;
use fastobo::ast::QuotedString;
use fastobo::ast::Time;
use fastobo::ast::UnquotedString;
use pyo... |
//! The virtio_blk module implements a virtio block device.
//!
//! The spec for Virtual I/O Device (VIRTIO) Version 1.1:
//! https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html
//! 5.2 Block Device:
//! https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-2390002
use crate::bus::VI... |
fn main() {
tonic_build::compile_protos("proto/oxydoro/oxydoro.proto").unwrap();
}
|
#[cfg(test)]
mod test {
use bellman::redshift::redshift::tests::*;
use bellman::redshift::redshift::serialization::*;
use redshift_circuit::circuit::*;
use bellman::redshift::IOP::oracle::coset_combining_rescue_tree::*;
use bellman::redshift::IOP::channel::rescue_channel::*;
use bellman::re... |
#![allow(dead_code)]
use crate::install::InstallPaths;
use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct PkgConfig {
prefix: PathBuf,
exec_prefix: PathBuf,
includedir: PathBuf,
libdir: PathBuf,
name: String,
description: String,
version: String,
requires: Vec<String>,
re... |
// Zinc, the bare metal stack for rust.
// Copyright 2014 Vladimir "farcaller" Pouzanov <farcaller@gmail.com>
//
// 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.o... |
/// Creates Rust structure for new Ruby class
///
/// This macro does not define an actual Ruby class. It only creates structs for using
/// the class in Rust. To define the class in Ruby, use `Class` structure.
///
/// # Examples
///
/// ```
/// #[macro_use]
/// extern crate ruru;
///
/// use ruru::{Class, RString, Ob... |
#[doc = "Register `PDSEL1` reader"]
pub struct R(crate::R<PDSEL1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PDSEL1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PDSEL1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R... |
//! libfs compatibility layer arround libfat.
#![no_std]
extern crate alloc;
use alloc::boxed::Box;
use core::iter::Iterator;
use storage_device::StorageDevice;
use libfs::FileSystemResult;
use libfs::{
DirFilterFlags, DirectoryEntry, DirectoryEntryType, DirectoryOperations, FileModeFlags,
FileOperations, F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.