text stringlengths 3.09k 13.9k |
|---|
use imgui::*;
use std::time::Duration;
use ndcell_core::prelude::*;
#[cfg(debug_assertions)]
mod debug;
pub mod error_popup;
mod setup;
mod simulation;
use crate::commands::Cmd;
use crate::gridview::*;
use crate::mouse::MouseState;
use crate::CONFIG;
#[cfg(debug_assertions)]
use debug::DebugWindow;
use setup::SetupW... |
// Well, I know the code quality is shit. Just wanted to try Rust...
// CAUTION: This generates several ill-formed functions. Need to fix them by hand for now.
//use std::io::{stdin, stdout};
use std::io::Write;
use std::io::{BufRead, BufReader};
use std::fs::File;
struct GLFnInfo {
return_type: String,
gl_func_nam... |
mod fs;
mod structs;
use alloc::{boxed::Box, sync::Arc};
use core::convert::TryFrom;
use core::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
use spin::Mutex;
use crate::arch::cpu;
use crate::config::IO_CPU_ID;
use crate::error::{AcoreError, AcoreResult};
use crate::memory::{
addr::{is_aligned... |
use crate::display;
use deku::bitvec::{BitSlice, Msb0};
use deku::prelude::*;
use std::fmt;
// list copied from https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
#[derive(Debug, PartialEq, DekuRead, DekuWrite)]
#[deku(type = "u8")]
pub enum HeaderIdentOsAbi {
#[deku(id = "0x00")]
SystemV,
#[deku... |
use crate::cartridge::MirroringType;
pub mod registers;
use self::registers::address::*;
use self::registers::controller::*;
use self::registers::data::*;
use self::registers::mask::*;
use self::registers::oam_address::*;
use self::registers::oam_data::*;
use self::registers::scroll::*;
use self::registers::status::*;... |
use crate::Parameters;
use crate::population::brain::NeuralNet;
use crate::population::brain::sensor_actions::{ENABLED_ACTIONS, ENABLED_SENSORS};
use crate::population::brain::sensor_actions::action_implementation::get_action_dispatch;
use crate::population::brain::sensor_actions::sensor_implementation::get_sensor_dis... |
// -----------------------------------------------------------------------------------------------------
// gs-rs - Graph SLAM in Rust
// -----------------------------------------------------------------------------------------------------
//
// SPDX-FileCopyrightText: © 2020 <... |
// MIT License
//
// Copyright (c) 2020 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merg... |
// #![feature(catch_panic)]
extern crate base64;
use std::panic;
use std::slice;
use std::str;
use std::thread;
use base64::decode;
use serde::{Deserialize, Serialize};
// By default, the "env" namespace is used.
extern "C" {
fn ext_stop_forwarding();
fn ext_set_error(ptr: *const u8, len: usize);
// ext_... |
use crate::schema::{parts, properties, wires};
use crate::sim::verifier;
use crate::{dom, dom::form::select, error, sim, PARTS};
use std::convert::TryFrom;
#[derive(PartialEq)]
pub struct Connection {
pub connector: usize,
part: usize,
}
impl Connection {
pub fn new(part: usize, connector: usize) -> Self ... |
use std::{io, sync::Arc, time};
use async_trait::async_trait;
use futures::future::BoxFuture;
use log::*;
use lru_time_cache::LruCache;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::sync::Mutex as TokioMutex;
use tokio::time::timeout;
use crate::{
proxy::{OutboundConnect, OutboundHandler, ProxyStream, ... |
mod display;
use super::*;
/// An SQL expression of any type.
///
/// The parser does not distinguish between expressions of different types
/// (e.g. boolean vs string), so the caller must handle expressions of
/// inappropriate type, like `WHERE 1` or `SELECT 1=1`, as necessary.
#[derive(Debug, Clone, PartialEq, Eq,... |
use super::super::{Properties};
use super::Boundary;
use core::fmt;
/// Information about a character including unicode properties and boundary
/// analysis.
#[derive(Copy, Clone, PartialEq, Eq, Default)]
pub struct CharInfo(pub(crate) Properties);
impl CharInfo {
/// Creates new character information from Unico... |
use std::env;
use std::sync::{Arc, Mutex};
use rand::rngs::SmallRng;
use rand::SeedableRng;
use rand::seq::SliceRandom;
use tide::{Request, Response, StatusCode};
use tide::prelude::*;
use tide::utils::After;
use tide_rustls::TlsListener;
use trust_dns_resolver::config::{NameServerConfigGroup, ResolverConfig, Resolver... |
use std::str::FromStr;
use neon::prelude::*;
use chain_core::state::account::{
Nonce, StakedStateAddress, StakedStateOpAttributes, StakedStateOpWitness, UnjailTx,
};
use chain_core::tx::TransactionId;
use chain_core::tx::TxAux;
use chain_tx_validation::witness::verify_tx_recover_address;
use parity_scale_codec::{... |
/// Authorized user.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct User {
/// Identifier of the user
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// Public display name
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
/// Valid ... |
//! A async client for [OCI compliant image
//! registries](http://github.com/opencontainers/distribution-spec/blob/master/spec.md/)
//! and [Docker Registry HTTP V2 protocol](https://docs.docker.com/registry/spec/api/).
//!
//! # Usage
//!
//! The [`DockerRegistryClientV2`] provides functions to query Registry API and... |
use std::collections::HashMap;
use std::iter;
use tera::{self, Value, Tera, Context, try_get_value};
use super::{Result, ErrorKind, ResultExt};
#[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
fn indent(v: Value, m: HashMap<String, Value>) -> tera::Result<Value> {
let s : String = try_get_valu... |
// Copyright (c) 2021 The Lutino Projects
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
#![doc(hidden)]
use std::any::TypeId;
use std::marker::PhantomData;
use std::slice::Iter;
use crate::iter::indexed::Indexe... |
// M_2_5_01
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// <NAME>, <NAME>, <NAME>, <NAME>
// with contributions by <NAME> and <NAME>
// Copyright 2018
//
// http://www.generative-gestaltung.de
//
// Licensed under the Apache License, Versi... |
use anyhow::{ensure, Context, Result};
use brane_let::callback::Callback;
use brane_let::exec_code;
use brane_let::exec_oas;
use brane_let::redirector;
use clap::Clap;
use dotenv::dotenv;
use log::LevelFilter;
use serde::de::DeserializeOwned;
use socksx::options::MetadataOption;
use specifications::common::Value;
use s... |
use crate::io::binary::{Binary, UNKNOWN_SIZE};
//use crate::geometry::vector::{Vec2, Vec3, Vec4, Vec6};
use crate::property::Value;
use crate::util::bitvec::BitVec;
use crate::util::index::{IndexSet, IndexSetUnchecked, IndexUnchecked};
/// Abstraction to support multiple underlying storage types for property lists.
pu... |
// Copyright 2018 ARP Network
//
// 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 ... |
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
extern crate clap;
extern crate clippy_dev;
extern crate regex;
use clap::{App, Arg, SubCommand};
use clippy_dev::*;
mod fmt;
mod stderr_length_check;
#[derive(PartialEq)]
enum UpdateMode {
Check,
Change,
}
fn main() {
let matches = App::new("Clip... |
use std::{collections::BTreeMap, sync::Arc};
use bytes::Bytes;
use chrono::{TimeZone, Utc};
use futures::future;
use http::StatusCode;
use ordered_float::NotNan;
use prost::Message;
use vector_core::ByteSizeOf;
use warp::{filters::BoxedFilter, path, path::FullPath, reply::Response, Filter, Rejection, Reply};
use crat... |
// Copyright 2021 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 super::{
common::{
next_deadline, with_local_timer_heap, EHandle, ExecutorTime, Inner, TimerHeap,
EMPTY_WAKEUP_ID, TASK_READY_WAKEU... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct DontKnowTrade {
/// MsgType = Q
#[serde(flatten)]
pub standard_message_header: super::super::standard_message_header::StandardMessageHeader<'Q', ' '>,
/// Broker Order ID as identified on problem ex... |
//! Backend for Go
use crate::flavored::*;
use crate::{EnumAdded, FieldAdded, FileSpec, InterfaceAdded, Options, Tags, TupleAdded, EXT};
use backend::PackageProcessor;
use core::errors::Result;
use core::{Handle, RelativePathBuf, Spanned};
use genco::prelude::*;
use genco::tokens::{FormatInto, ItemStr};
use trans::{se... |
//! Queue handling
//!
//! The queue handle and callback,
//! analagous to <http://netfilter.org/projects/libnetfilter_queue/doxygen/group__Queue.html>
mod verdict;
use libc::*;
use std::mem;
use std::ptr::null;
use error::*;
use util::*;
use message::{Message, Payload};
pub use self::verdict::{Verdict, QueueHandle};... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Supply Controller Control Register"]
pub supc_cr: SUPC_CR,
#[doc = "0x04 - Supply Controller Supply Monitor Mode Register"]
pub supc_smmr: SUPC_SMMR,
#[doc = "0x08 - Supply Controller Mode Register"]
pub supc_mr: SU... |
//#![no_std]
use wasm_bindgen::prelude::*;
use web_sys::console;
use js_sys::{Float32Array, Uint16Array, Uint8Array};
mod utils;
//Limits of array data coming from JS. Mirrored in graphData.mjs.
const MAX_NODES: usize = 1<<16;
//const MAX_LINKS: usize = 1<<16;
//const LINKS_PER_NODE: usize = 32;
const IDEAL_NODE_D... |
// nbdkit
// Copyright (C) 2019 Red Hat Inc.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the follow... |
use super::AsyncRead;
use super::Error;
use crate::buf_reader::BufIo;
use crate::fast_buf::FastBuf;
use futures_util::future::poll_fn;
use futures_util::ready;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
/// Decoder to read a `transfer-encoding: chunked` stream.
#[derive(Debug)]
pub struct ChunkedD... |
mod current_cycles;
mod debugger;
mod exec;
mod load_cell;
mod load_cell_data;
mod load_header;
mod load_input;
mod load_script;
mod load_script_hash;
mod load_tx;
mod load_witness;
mod utils;
mod vm_version;
#[cfg(test)]
mod pause;
#[cfg(test)]
mod tests;
pub use self::current_cycles::CurrentCycles;
pub use self::d... |
use crate::enclave_u::init_connection;
use crate::enclave_u::run_server;
use crate::enclave_u::ZMQ_SOCKET;
use crate::start_enclave;
use crate::TIMEOUT_SEC;
use chain_core::common::MerkleTree;
use chain_core::init::address::RedeemAddress;
use chain_core::init::coin::Coin;
use chain_core::state::account::{
StakedSta... |
use cosmwasm_std::{
to_binary, Coin, CosmosMsg, DepsMut, Env, MessageInfo, Response, Uint128, WasmMsg,
};
use cw20::Cw20ExecuteMsg;
use astroport::asset::{Asset, AssetInfo};
use crate::{
error::ContractError,
state::{
load_config, load_state, load_whitelisted_account, store_state, store_whiteliste... |
// Copyright 2018 Developers of the Rand project.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
/... |
use crate::common::{
error::Result,
log::{Log, LogRecord, Loglevel, LoglevelFilter},
util::friendly_enum_parse,
};
use failure::Fail;
use serde::{Deserialize, Serialize};
use std::{fs::File, io::Write, path::PathBuf};
/// Error structure used for reporting TeeFile errors.
#[derive(Debug, Fail, PartialEq)]
... |
//! manage reading the verb shortcuts from the configuration file,
//! initializing if if it doesn't yet exist
use {
super::{
default_conf::DEFAULT_CONF_FILE,
},
crate::{
display::{Col, Cols},
errors::ConfError,
keys,
pattern::{SearchModeMap, SearchModeMapEntry},
... |
#![allow(clippy::too_many_arguments)]
use anyhow::{format_err, Error};
use chrono::{DateTime, NaiveDate, Utc};
use log::debug;
use maplit::hashmap;
use postgres_query::FromSqlRow;
use reqwest::{header::HeaderMap, Response, Url};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{collections::HashMap,... |
use bus::{MainBus, SubsurfaceBus};
use lifeline::prelude::*;
use message::{main::MainSend, subsurface::SubsurfaceSend};
use service::HelloService;
use simple_logger::SimpleLogger;
/// This examples shows how to communicate between Bus instances using the CarryFrom trait
/// When your application gets large, eventually... |
// This file is part of Metaverse.Network & Bit.Country.
// Copyright (C) 2020-2022 Metaverse.Network & Bit.Country .
// SPDX-License-Identifier: Apache-2.0
// 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 o... |
//! Parses the Kobo's Japanse-Japanese dictionary.
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::path::Path;
use flate2::read::GzDecoder;
use quick_xml::events::Event;
use crate::{hiragana_to_katakana, strip_non_kana};
#[derive(Clone, Debug)]
pub struct Entry {
pub key: String,
... |
use crate::signed::{
Message, SignedMessage, PREFIX_TENDERMINT_COMMIT, PREFIX_TENDERMINT_PREPARE,
PREFIX_TENDERMINT_PROPOSAL,
};
use crate::{MacroHeader, MultiSignature};
use beserial::{Deserialize, Serialize};
use nimiq_bls::AggregatePublicKey;
use nimiq_hash::{Blake2bHash, Hash, SerializeContent};
use nimiq_h... |
/*
* Copyright (C) 2017-2021 blocktree.
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* Un... |
use std::{error::Error,
future::Future,
io::Stdout,
time::{Duration,
SystemTime,
UNIX_EPOCH}};
use grapl_observe::metric_reporter::MetricReporter;
use log::info;
use rusoto_s3::S3;
use rusoto_sqs::Sqs;
use tracing::debug;
use crate::{cache::Cache,
... |
// Copyright (c) Microsoft. All rights reserved.
use std::convert::AsRef;
use std::ops::{Deref, Drop};
use std::os::raw::{c_uchar, c_void};
use std::ptr;
use std::slice;
use std::sync::{Mutex, Once};
use lazy_static::lazy_static;
use aziot_tpm_sys::{
aziot_tpm_create, aziot_tpm_destroy, aziot_tpm_free_buffer, az... |
//! Block headers
use crate::merkle::simple_hash_from_byte_vectors;
use crate::serializers;
use crate::{account, block, chain, AppHash, Hash, Time};
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use tendermint_proto::version::Consensus as RawConsensusVersion;
use tendermint_proto::DomainType;
/// Bl... |
use teensycore::math::{max, min};
#[derive(Copy, Clone)]
pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
}
fn abs(val: f32) -> f32 {
if val < 0.0 {
return val * -1.0;
} else {
return val;
}
}
pub fn rgb(r: u8, g: u8, b: u8) -> Color {
return Color {
r: r,
... |
//! This example decodes a ffv1 codec contained in a matroska file.
// ffv1 crate
extern crate ffv1;
// rust-av crates
extern crate av_data as data;
extern crate av_format as format;
// Matroska demuxer
extern crate matroska;
// CLI crates
extern crate clap;
// Byteorder crate
extern crate byteorder;
use std::fs:... |
//! This module contains the data types and the logic for parsing them.
use chrono::{DateTime, TimeZone, Utc};
use serde_json::Value;
use crate::error::Error;
#[derive(Default, Debug, PartialEq)]
/// A user sharing a location with you
pub struct Person {
/// An Opaque identifier
pub id: String,
/// A URL... |
// Copyright 2020 The Matrix.org Foundation C.I.C.
//
// 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... |
#![allow(clippy::type_complexity)]
use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send};
use mpstthree::role::broadcast::RoleBroadcast;
use mpstthree::role::end::RoleEnd;
use mpstthree::{
bundle_struct_fork_close_multi, choose_mpst_multi_to_all, create_multiple_normal_role_short,
create_recv... |
use {
super::*,
crate::{
app::*,
display::W,
errors::ProgramError,
launchable::Launchable,
path,
},
std::{
fs::OpenOptions,
io::Write,
},
};
/// Definition of how the user input should be interpreted
/// to be executed in an external command.... |
use crate::widgets::tasks::Msg::{Complete, Edit};
use crate::widgets::Tasks;
use gtk::prelude::*;
#[derive(relm_derive::Msg)]
pub enum Msg {
Complete(Box<crate::tasks::Task>),
Edit(Box<crate::tasks::Task>),
Filters(Vec<String>),
UpdateFilters(Vec<(String, (u32, u32))>),
UpdateTasks(Vec<crate::tasks... |
#![allow(dead_code)]
use nalgebra::Matrix3;
use nalgebra::Vector3;
use std::collections::HashSet;
#[derive(Debug)]
struct Transform {
offset: Point,
rotation: Matrix,
}
impl Transform {
fn rotate(rotation: &Matrix) -> Self {
Transform {
offset: vector![0, 0, 0],
rotation: r... |
#![allow(dead_code)]
use chrono;
use openssl;
use rand::{self, Rng};
use rustc_serialize::base64::{self, ToBase64};
use serde_urlencoded as urlencoded;
use std::{error, io, fmt};
mod percent {
use percent_encoding::{utf8_percent_encode, SIMPLE_ENCODE_SET};
define_encode_set! {
// All non alphanumeric c... |
use std::thread;
mod instructions;
#[cfg(not(test))]
fn main() {
const INPUT: &str = include_str!("input.txt");
let program = instructions::parse(INPUT);
println!("Part 1: {}", find_first_recovered(&program));
println!("Part 2: {}", run_threads(program));
}
/// Updates a `register` using it's curren... |
// Copyright 2012 Google Inc.
// Copyright 2020 <NAME>
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::scalar::{SCALAR_MAX, Scalar};
#[cfg(all(not(feature = "std"), feature = "libm"))]
use crate::scalar::FloatExt;
// Must be first, because of macr... |
mod filter;
mod table;
mod templates;
use crate::{
transformer::{TransformerDefaults, TransformerInitContext},
transformers::Transformers,
Transformer,
};
use anyhow::Result;
use config::{Config, ConfigError, File, FileFormat};
use serde::Deserialize;
use serde_json::Value as JsonValue;
use std::collection... |
/*
Copyright 2021 Picovoice Inc.
You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
file accompanying this source.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an ... |
#![no_std]
// #![feature(plugin)]
// #![plugin(application_main_fn)]
//! Tests the read/write capability of the memory-backed file (memfs::MemFile)
#[macro_use] extern crate alloc;
// #[macro_use] extern crate log;
#[macro_use] extern crate terminal_print;
extern crate memfs;
extern crate root;
extern crate memory;
u... |
//! Relayer configuration
use std::{fs, fs::File, io::Write, path::Path, time::Duration};
use serde_derive::{Deserialize, Serialize};
use tendermint_light_client::types::TrustThreshold;
use ibc::ics24_host::identifier::{ChainId, PortId};
use crate::error;
use ibc::ics04_channel::channel::Order;
/// Defaults for va... |
/**
* [726] Number of Atoms
*
* Given a chemical formula (given as a string), return the count of each atom.
* The atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.
* One or more digits representing that element's count may follow if the count is ... |
//! wrapper for x86_64 target
use crate::*;
use libc::c_int;
//Registrers
pub const UNW_TDEP_IP: u32 = x86_64_regnum_t_UNW_X86_64_RIP;
pub const UNW_TDEP_SP: u32 = x86_64_regnum_t_UNW_X86_64_RSP;
pub const UNW_TDEP_BP: u32 = x86_64_regnum_t_UNW_X86_64_RBP;
pub const UNW_TDEP_EH: u32 = x86_64_regnum_t_UNW_X86_64_RAX;... |
use three_d::*;
fn main() {
let args: Vec<String> = std::env::args().collect();
let window = Window::new(WindowSettings {
title: "Wireframe!".to_string(),
max_size: Some((1280, 720)),
..Default::default()
})
.unwrap();
let context = window.gl().unwrap();
let pipeline =... |
use coord_2d::Coord;
use pixel_grid::{Window, WindowSpec};
use rand::{Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
use std::num::NonZeroU32;
use std::thread;
use std::time::Duration;
use wfc::wrap::*;
use wfc::*;
use wfc_image::{ImagePatterns, Size};
struct Forbid {
wrapped_top_left_corner_id: Option<Pattern... |
// Copyright 2018 New Vector Ltd
//
// 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 super::Cursor;
use chrono::{DateTime, Utc};
use serde::{
de::{Deserializer, Error, IgnoredAny, MapAccess, Visitor},
Deserialize, Serialize,
};
use std::fmt;
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct ForumPosts {
#[serde(default, skip_serializing_if = "Option::is_none")]... |
use super::*;
#[test]
fn scalar_in_tuple_trait_impl() {
test! {
program {
trait Foo { }
impl Foo for usize { }
impl Foo for isize { }
impl<T1, T2> Foo for (T1, T2) where T1: Foo, T2: Foo { }
impl<T> Foo for (T,T,T) where T: Foo { }
}
... |
// Copyright (C) 2020 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// dis... |
use crate::renderer::Vertex;
use wgpu::util::DeviceExt;
use wgpu::*;
pub const RENDER_TEXTURE_FORMAT: TextureFormat = TextureFormat::Rgba16Float;
pub struct TextureRenderer {
pub background_quad_buffer: Buffer,
pub background_quad_index_buffer: Buffer,
pub render_texture: Texture,
pub shader: ShaderMo... |
//! Fuzzy search capabilities
use std::borrow::Cow;
use std::collections::HashSet;
use std::sync::Arc;
use skim::prelude::{unbounded, ExactOrFuzzyEngineFactory, Key, SkimOptionsBuilder};
use skim::{
AnsiString, DisplayContext, FuzzyAlgorithm, ItemPreview, MatchEngineFactory, MatchRange,
Matches, PreviewContext... |
// Copyright 2019 Baidu, Inc.
//
// 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 in ... |
use rand::Rng;
pub const GRID_SIZE: usize = 32;
#[derive(PartialEq, Copy, Clone)]
pub enum TileType {
Wall,
Floor,
}
#[derive(Clone, Default)]
pub struct Map {
pub rows: usize,
pub columns: usize,
pub tiles: Vec<TileType>,
}
pub enum Orientation {
Horizontal,
Vertical,
}
/// Grid positi... |
// Copyright © 2018 <NAME>.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy, modify, merge, publish,
// distrib... |
extern crate ggez;
use ggez::conf::WindowMode;
use ggez::event;
use ggez::graphics::{self, *};
use ggez::{Context, GameResult};
use ggez::event::Keycode;
use ggez::event::Mod;
use itertools::Itertools;
use crate::engine::automaton::Automaton;
use crate::engine::automaton::AutomatonCell;
use crate::examples::game_of... |
use core::marker::PhantomData;
use necsim_core::{
cogs::{
Backup, CoalescenceRngSample, CoalescenceSampler, DispersalSampler, EmigrationExit,
EventSampler, Habitat, MinSpeciationTrackingEventSampler, RngCore, SpeciationProbability,
SpeciationSample, TurnoverRate,
},
event::{Dispersa... |
use std::collections::HashMap;
use std::pin::Pin;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
};
use std::task::{Context, Poll};
use futures::Future;
// use futures::TryStreamExt;
use hyper::body;
use hyper::{Body, Request};
use url::Url;
use mlua;
use mlua_actor::actor::Actor;
use mlua_actor... |
use std::io::Read;
use std::collections::VecDeque;
use crate::client::*;
use crate::header::*;
use crate::*;
pub(crate) struct ResponseData
{
pub(crate) read_queue: VecDeque<u8>,
pub(crate) headers_done: bool,
pub(crate) completed: bool,
pub(crate) headers: HeaderMap,
pub(crate) status_code: StatusCode,
}
impl ... |
// Copyright (c) 2021 Harry [Majored] [<EMAIL>]
// MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE)
//! A module which supports writing ZIP files.
//!
//! # Example
//! ### Whole data (u8 slice)
//! ```no_run
//! # use async_zip::{Compression, write::{EntryOptions, ZipFileWriter}};
//! # use tok... |
use crate::{second_order_iir::IIR2Coefficients, units::FP, wide_units::WIDE, MAX_CASCADE_COUNT};
#[derive(Copy, Clone, Debug)]
pub struct WideIIR2Coefficients<T: WIDE> {
pub a: T,
pub g: T,
pub gpow2: T,
pub k: T,
pub a1: T,
pub a2: T,
pub a3: T,
pub m0: T,
pub m1: T,
pub m2: T,... |
use super::error::BootloaderError;
use cargo_metadata::{Metadata, Package};
use std::{
fs,
path::{Path, PathBuf},
process::Command,
};
pub struct BuildConfig {
manifest_path: PathBuf,
bootloader_name: String,
target: PathBuf,
features: Vec<String>,
target_dir: PathBuf,
kernel_bin_pa... |
use rand::prelude::SliceRandom;
use rand::thread_rng;
use crate::card::{Card, Rank, Suit};
use crate::CribbageCoreError;
pub struct Deck {
cards_drawn: usize,
cards: Vec<Card>,
}
impl Deck {
pub fn new() -> Deck {
Deck::default()
}
pub fn draw(&mut self) -> Result<Card, CribbageCoreError... |
use async_std::{channel::bounded, task::block_on};
use bindings::Windows::{
Foundation::TypedEventHandler,
Graphics::{
Capture::{Direct3D11CaptureFramePool, GraphicsCaptureItem},
DirectX::{Direct3D11::IDirect3DDevice, DirectXPixelFormat},
RectInt32,
},
Win32::{
Foundation... |
use std::{
net::{AddrParseError, Ipv4Addr},
str,
};
use http_api_client_endpoint::{
http::{Error as HttpError, Method},
Body, Endpoint, Request, Response,
};
use scraper::{Html, Selector};
pub const URL: &str = "https://www.thghosting.com/network/data-centers/";
use crate::{AvailableService, DataCent... |
use std::collections::HashMap;
use std::time::{Duration, Instant};
use futures::sink::SinkExt;
use uuid::Uuid;
use crate::internal::command::Cmd;
use crate::internal::messages;
use crate::internal::messaging::{self, Lifetime, OpMsg};
use crate::internal::package::Pkg;
use crate::types::{Endpoint, OperationError, Retr... |
use crate::{unicode::NORMALIZATION_BUFFER_SIZE, Readiness, Status};
use std::io::{self, IoSliceMut};
/// A superset of [`std::io::Read`], with `read_outcome` and
/// `read_vectored_outcome` which return more information and zero is not
/// special-cased.
pub trait Read {
/// Like [`std::io::Read::read`], but retur... |
//! Procedural world generation.
use noise::{BasicMulti, MultiFractal, NoiseModule};
use super::SECTOR_SIZE;
use super::voxel::{Block, BlockList, SectorSpaceCoords};
const SECTOR_SIZE_F: f32 = SECTOR_SIZE as f32;
/// The world generator.
#[derive(Clone)]
pub struct WorldGen {
//perlin: Perlin,
base_terrain: ... |
use anyhow::{Context, Result};
use std::fmt;
pub fn part1(input: &str) -> Result<impl fmt::Display> {
let (depart, busses) = parse(input)?;
log::debug!("depart earliest: {:?}", depart);
log::debug!("bus schedules: {:?}", busses);
let working = busses.iter().filter_map(|b| b.as_ref()).collect::<Vec<_>>... |
use std::path::{Path, PathBuf};
use async_process::{Command, Stdio};
use async_std::sync::{Arc, Mutex};
use async_trait::async_trait;
use futures::AsyncRead;
use http_types::Method;
use oro_client::{self, OroClient};
use oro_package_spec::{GitInfo, PackageSpec};
use url::Url;
use crate::error::{Result, RoggaError};
u... |
//! Postgres RDBC Driver
//!
//! This crate implements an RDBC Driver for the `postgres` crate.
//!
//! The RDBC (Rust DataBase Connectivity) API is loosely based on the ODBC and JDBC standards.
//!
//! ```rust,no_run
//! use rdbc::*;
//! use rdbc_postgres::PostgresDriver;
//!
//! let driver = PostgresDriver::new();
//... |
use super::Parser;
use smallvec::SmallVec;
use xjbutil::defer;
use crate::awa;
use crate::diag::diag_data;
use crate::diag::location::{SourceLoc, SourceRange};
use crate::parse::lexer::LexerMode;
use crate::syntax::id::Identifier;
use crate::syntax::token::{Token, TokenInner};
use crate::syntax::ty::{ConcreteGenericT... |
/*
* << Haru Free PDF Library 2.0.0 >> -- raw_image_demo.c
*
* Copyright (c) 1999-2006 <NAME> <<EMAIL>>
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and... |
use std::fmt::{Display, Formatter};
use std::ops::Add;
use std::str::FromStr;
use SnailfishNumber::*;
use StackElement::*;
#[derive(Clone)]
pub enum SnailfishNumber {
Regular(u8),
Pair(Box<SnailfishNumber>, Box<SnailfishNumber>),
}
impl Add for SnailfishNumber {
type Output = Self;
fn add(self, other... |
use imgui::{im_str, ImString, Ui, Window};
use smwe_rom::snes_utils::addr::{Addr, AddrPc, AddrSnes};
use self::{helpers::*, modes::*};
use crate::{
frame_context::FrameContext,
ui::{
color,
tool::{title_with_id, UiTool, WindowId},
},
};
pub struct UiAddressConverter {
title: ImString,
... |
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::fs;
use std::ops::{Index, IndexMut};
use std::io::BufReader;
use std::io::prelude::*;
#[derive(Debug)]
struct Row((i32, bool), (i32, bool), (i32, bool), (i32, bool), (i32, bool));
impl Index<i8> for Row {
type Output = (i32, bool);
... |
#![deny(unused_must_use)]
use std::collections::{BTreeMap, BTreeSet};
use std::iter::once;
use std::sync::Arc;
use hbbft::subset::{Subset, SubsetOutput};
use hbbft::ConsensusProtocol;
use hbbft_testing::adversary::{Adversary, NodeOrderAdversary, ReorderingAdversary};
use hbbft_testing::proptest::{gen_seed, TestRng, T... |
//! Syscalls of Inter-Process Communication
#![allow(dead_code)]
use bitflags::*;
use numeric_enum_macro::numeric_enum;
pub use linux_object::ipc::*;
use super::*;
impl Syscall<'_> {
/// returns the semaphore set identifier associated with the argument key
pub fn sys_semget(&self, key: usize, nsems: usize, ... |
use std::{borrow::Cow, collections::VecDeque, thread::current, time::Duration};
use bevy::{math::Vec3Swizzles, prelude::*, utils::HashMap};
use serde::{Deserialize, Serialize};
use crate::{
ldtk_loader::{LdtkMap, MapTileset},
AtlasHandles, TILE_SIZE,
};
pub struct AnimationPlugin;
impl Plugin for AnimationP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.