text stringlengths 8 4.13M |
|---|
// TODO: [Object] Type Validation: §4 (interfaces) for objects
// TODO: [Non-Null] §1 A Non‐Null type must not wrap another Non‐Null type.
#[rustversion::nightly]
#[test]
fn test_failing_compilation() {
let t = trybuild::TestCases::new();
t.compile_fail("fail/**/*.rs");
}
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[doc(hidden)]
pub struct IRadio(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IRadio {
type Vtable = IRadio_abi;
const IID: ::wi... |
use std::io::{Read, BufReader, Seek, Error as IOError, Result as IOResult, SeekFrom};
use package_entry::PackageEntry;
use std::collections::HashMap;
use archive_md5_section_entry::ArchiveMD5SectionEntry;
use read_util::{PrimitiveRead, StringRead, StringReadError, RawDataRead};
use crc::{self, Crc};
use utilities::AsnK... |
//! LoRa device configuration definitions
/// LoRa mode radio configuration
#[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct LoRaConfig {
// Preamble length in symbols (defaults to 8)
pub preamble_length: u8,
/// LoRa header configu... |
trait Functor {
type Current;
type Target<V>: Functor;
fn fmap<F, V>(self, f: F) -> Self::Target<V>
where F: Fn(Self::Current) -> V;
}
impl<A> Functor for Option<A> {
type Current = A;
type Target<B> = Option<B>;
fn fmap<F, B>(self, f: F) -> Self::Target<B>
where F: Fn(Self:... |
pub mod constants;
pub mod particle_in_a_box;
pub mod particle_in_a_box_eigenfunction_sampling;
pub mod shared;
|
// Copyright 2020, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
// Copyright 2019
// by Centrality Investments Ltd.
// and Parity Technologies (UK) 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/... |
use super::{sprite_constants::*, FilesystemPath, ResourceVersion, Tags};
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use smart_default::SmartDefault;
create_guarded_uuid!(FrameId);
create_guarded_uuid!(LayerId);
#[derive(Debug, Serialize, Deserialize, SmartDefault, Partial... |
use aoc2018::*;
fn main() -> Result<(), Error> {
let mut records = Vec::new();
for line in BufReader::new(input!("day4.txt")).lines() {
let line = line?;
let (date, rest) = line.split_at(18);
let date = chrono::NaiveDateTime::parse_from_str(date, "[%Y-%m-%d %H:%M]")?;
records.p... |
use std::path::Path;
pub const RUST_LINE_COMMENT_TOKEN: &str = "//";
pub const RUST_MULTI_LINE_COMMENT_TOKEN_PAIR: [&str; 2] = ["/*", "*/"];
pub const RUST_LANGUAGE_SERVER: &str = "rust-analyzer";
pub const RUST_FILE_EXTENSIONS: [&str; 1] = ["rs"];
pub const RUST_IDENTIFIER: &str = "rust";
pub const RUST_INDENT... |
extern crate bootstrap_rs as bootstrap;
extern crate gl_util as gl;
extern crate parse_obj;
use bootstrap::window::*;
use gl::*;
use gl::context::Context;
use parse_obj::Obj;
fn main() {
// Load mesh file and normalize indices for OpenGL.
let obj = Obj::from_file("examples/epps_head.obj").unwrap();
let mu... |
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
//! A writfield1 buffer, with one or more snapshots.
use arrow::record_batch::RecordBatch;
use data_types::TimestampMinMax;
use iox_query::util::compute_timenanosecond_min_max;
use schema::{merge::merge_record_batch_schemas, Schema};
use super::BufferState;
use crate::{
buffer_tree::partition::buffer::{state_mach... |
use std::io::BufferedReader;
use std::io::File;
use std::io::IoError;
use std::collections::HashSet;
#[deriving(Show, Clone)]
pub struct SpeciesProbability {
species: String,
lambda: f64,
}
#[deriving(Show)]
pub struct DecayScenario {
t: i64,
lambdas: Vec<SpeciesProbability>,
}
impl DecayScenario {
... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
extern crate llio;
use llio::{Buff,EventType,Token};
use ::reactor::Handle;
use ::{Context,EventSource,Service};
use std::net::SocketAddrV4;
use std::io::{Result,Read,Write};
use std::marker::PhantomData;
pub struct TcpListener {
inner: llio::TcpListener,
}
impl TcpListener {
pub fn new(addr: SocketAddrV4) -... |
use std::{fs::File, io::Write, path::PathBuf};
use clap::arg_enum;
use eyre::Result;
use items::Item;
use structopt::StructOpt;
mod items;
mod renderer;
arg_enum! {
#[derive(Debug)]
pub enum CallNumber {
LCC,
Dewey
}
}
#[derive(Debug, StructOpt)]
#[structopt(
name = "librarything_to_... |
use lupo::errors::*;
use std::fs::OpenOptions;
use std::io::prelude::*;
//use pretty_assertions::{assert_eq, assert_ne};
use tempfile::tempdir;
// Can't create this as a standard function because 'store' borrows 'home'
macro_rules! temp_store {
($var:ident, $home:ident, $force:expr) => {
let $home = tempd... |
pub struct Solution;
impl Solution {
pub fn contains_nearby_duplicate(nums: Vec<i32>, k: i32) -> bool {
let k = k as usize;
let mut pairs = nums
.into_iter()
.enumerate()
.map(|(i, v)| (v, i))
.collect::<Vec<_>>();
pairs.sort_unstable();
... |
//! Defines the operations and data definitions for a top bar program.
use std::ops::Deref;
use rustwlc::WlcView;
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Bar {
view: WlcView
}
impl Bar {
pub fn new(view: WlcView) -> Self {
Bar { view: view }
}
/// Gets the view tha... |
use rustc_serialize::json;
use rustc_serialize::json::{Json, Object, Array};
use token::{TokenData, Reserved, Exp, CharCase, Sign, NumberLiteral, Radix, Name};
use ast::*;
use track::*;
macro_rules! right {
( $l:expr, $r:expr ) => { $r }
}
macro_rules! tuplify {
( $v:expr, ( $($dummy:tt),* ) ) => {
{
... |
use crate::naia_server::Timestamp;
use std::net::SocketAddr;
#[allow(missing_docs)]
#[allow(unused_doc_comments)]
pub mod user_key {
// The Key used to get a reference of a User
new_key_type! { pub struct UserKey; }
}
#[derive(Clone)]
pub struct User {
pub address: SocketAddr,
pub timestamp: Timestamp... |
use crate::game::Coord;
#[derive(Default)]
pub struct Othello {
player: bool,
board: [[Option<bool>; 8]; 8],
game_over: bool,
}
impl Othello {
pub fn new() -> Self {
let mut board: [[Option<bool>; 8]; 8] = Default::default();
board[3][3] = Some(true);
board[3][4] = Some(false);... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtCore/qmargins.h
// dst-file: /src/core/qmargins.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>
// <=... |
use input_i_scanner::InputIScanner;
use std::collections::HashMap;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $t
... |
#[cfg(test)]
mod v8facade_memory_tests {
use javascript_eval_native::{function_parameter::FunctionParameter, v8facade::V8Facade};
#[test]
#[ignore]
fn it_wont_leak_memory_like_crazy() {
let eval = V8Facade::new();
let _ = eval.run("function echo(val) { return val; }").unwrap();
... |
use crate::stack::Stack;
use std::sync::{MutexGuard, Arc, RwLock};
use minifb::{Window, Key};
pub struct Display {
}
impl Display {
pub fn new() -> Self {
Display {
}
}
pub fn refresh(window: &Window) -> bool {
window.is_open() && !window.is_key_down(Key::Escape)
... |
use crate::module::Module;
pub mod method;
use crate::v02::method as v02_method;
/// Registers all methods for the v0.3 RPC API
pub fn register_methods(module: Module) -> anyhow::Result<Module> {
let module = module
// Reused from v0.2
.register_method(
"v0.3_starknet_addDeclareTransa... |
use failure::{Error, Fail};
pub fn print_error_and_exit(error: Error) -> ! {
for (i, cause) in error.causes().enumerate() {
if i == 0 {
eprintln!("Error: {}", cause);
} else {
let indentation = 4 * i;
eprintln!("{0:1$}Caused by: {2}", "", indentation, cause);
... |
#[doc = "Reader of register ALTBASE"]
pub type R = crate::R<u32, super::ALTBASE>;
#[doc = "Reader of field `ADDR`"]
pub type ADDR_R = crate::R<u32, u32>;
impl R {
#[doc = "Bits 0:31 - Alternate Channel Address Pointer"]
#[inline(always)]
pub fn addr(&self) -> ADDR_R {
ADDR_R::new((self.bits & 0xffff... |
use arrow::array::ArrayDataBuilder;
use arrow::array::StringArray;
use arrow::buffer::Buffer;
use arrow::buffer::NullBuffer;
use num_traits::{AsPrimitive, FromPrimitive, Zero};
use std::fmt::Debug;
use std::ops::Range;
/// A packed string array that stores start and end indexes into
/// a contiguous string slice.
///
... |
use super::log;
use super::model::{
ColumnHeader, ColumnType, CsvErrors, CsvError, StatementSelections, StatementSelection, StatementType, ColumnSelection, ColumnSource,
};
use csv::StringRecord;
use super::{DATETIME_FORMATS, DATE_FORMATS};
use chrono::{NaiveDate, NaiveDateTime};
use wasm_bindgen::prelude::*;
#[wasm... |
use ed25519_dalek::{
Keypair,
PublicKey,
Signature,
Signer,
};
use types::{
SecretKey,
};
pub fn sign(secret_key: SecretKey, message_bytes: [u8;32]) -> String {
match secret_key {
SecretKey::Ed25519(secret_key) => {
let pub_key: PublicKey = (&secret_key).into();
let pair = Keypair{
... |
//! Easier handling of mouse events.
//!
//! Handling the various permutations and combinations of mouse events is messy,
//! repetitive, and error prone.
//!
//! This module implements a state machine that handles the raw event processing,
//! identifying important events and transitions.
//!
//! # Use
//!
//! The sta... |
use std::collections::{HashMap, HashSet};
use parser::types::{Statement, ProgramError, Pass, StatementType, SourceCodeLocation, ExpressionType, Expression, StatementFactory, ExpressionFactory, TokenType};
pub fn leak_reference<'a, T>(s: T) -> &'a T {
Box::leak(Box::new(s))
}
pub struct LambdaLifting<'a> {
cha... |
extern crate time;
use std::default::Default;
use sat::{PartialResult, TotalResult, Solver};
use sat::formula::{Var, Lit, LitMap};
use sat::formula::clause::*;
use sat::formula::assignment::*;
use self::clause_db::*;
use self::conflict::{AnalyzeContext, Seen, Conflict};
pub use self::conflict::CCMinMode;
use self::deci... |
#[cfg(test)]
mod test {
use crate::data_structures::linked_list_persistent::{LinkedListPersistent};
#[test]
fn basics() {
let list = LinkedListPersistent::new();
assert_eq!(list.head(), None);
let list = list.append(1).append(2).append(3);
assert_eq!(list.head(), Some(&3))... |
#[path = "with_link_in_options_list/with_arity_zero.rs"]
mod with_arity_zero;
test_stdout!(without_arity_zero_returns_pid_to_parent_and_child_process_exits_badarity_which_exits_linked_parent, "{parent, badarity}\n");
|
/// HTTP Server handlers for serving static files
pub mod serve_static;
/// HTTP Server handlers for printing logs
pub mod print_log;
|
import vec::len;
import vec::slice;
import ilen = ivec::len;
import islice = ivec::slice;
export ivector;
export lteq;
export merge_sort;
export quick_sort;
export quick_sort3;
type lteq[T] = fn(&T, &T) -> bool ;
fn merge_sort[@T](le: lteq[T], v: vec[T]) -> vec[T] {
fn merge[@T](le: lteq[T], a: vec[T], b: vec[T]... |
use proconio::{input};
fn main() {
input! {
n: i64,
};
let m: i64= 998244353;
let mut x = n % m;
if x < 0 {
x += m;
}
assert!(0 <= x && x < m);
println!("{}", x);
} |
use super::data::*;
pub fn find_s(entries: Vec<Data>) -> Hypothesis{
let len = entries[0].len;
let mut hypothesis = Hypothesis::most_specific(len);
for entry in entries {
if entry.result {
for i in 0..entry.len {
if entry.values[i] {
let next = match hypothesis.values[i] {
... |
/// Construct a [`CloudEvent`] according to spec version 1.0.
///
/// # Errors
///
/// If some of the required fields are missing, or if some of the fields
/// have invalid content an error is returned.
///
/// # Example
///
/// ```
/// #[macro_use]
/// use cloudevents::cloudevent_v1_0;
/// use cloudevents::Data;
///
/... |
use super::prelude::*;
#[command]
pub async fn info(ctx: &Context, msg: &Message) -> CommandResult {
let guilds = ctx.cache.guild_count().await;
let channels = ctx.cache.guild_channel_count().await;
let users = ctx.cache.user_count().await;
let bot = ctx.cache.current_user().await;
let avatar_url =... |
use crate::errors::EvalErr;
use crate::object::Number::{Float, Integer};
use crate::object::Object::Boolean;
use crate::object::{Number, Object};
use crate::service::{expect_1_arg, expect_2_args};
use std::rc::Rc;
pub fn is_number(args: Vec<Rc<Object>>) -> Result<Rc<Object>, EvalErr> {
let arg = expect_1_arg(args... |
use crate::core::random::RandomGenerator;
use crate::prefab::enemies::{ENEMY_STR_1, ENEMY_STR_2, ENEMY_STR_3};
use rand::seq::SliceRandom;
use serde_derive::{Deserialize, Serialize};
/// What kind of enemy should we spawn in infinite wave.
#[derive(Debug, Copy, Clone)]
pub struct WaveDifficulty {
level_1_enemies: ... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub struct GameBar {}
impl GameBar {
#[cfg(feature = "Foundation")]
pub fn VisibilityChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventHandler<::window... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct ExamDto {
pub id: i32,
pub name: String,
pub description: String,
pub questions: Vec<QuestionDto>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct QuestionDto {
pub id: i32,
pub content: String,
... |
use crate::types::{Enemy, Game, Vec2, WIDTH, WeaponKind};
use crate::util;
use crate::objects::Graphics;
impl Enemy {
pub fn tick(mut self, game: &mut Game) -> Enemy {
let screen_x = game.enemies_x + self.position.x;
if screen_x > WIDTH as i32 {
return self;
}
if game.... |
use id::Id;
/// Describes a player actively engaged in a duel.
#[derive(Debug, Clone)]
pub struct Player {
pub id: Id,
// TODO: Reference to some descriptor containing name?
// TODO: Life total
// TODO: Counters, like energy and poison
}
|
pub struct Gun {
is_loaded: bool,
latch_state: LatchState,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum LatchState {
Closed,
Open,
}
pub enum ConsumeError {
LatchWasOpen,
NotLoaded,
}
impl Gun {
pub fn new() -> Self {
Self {
is_loaded: false,
latch_s... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use types::Validator;
/// Trait to implement if one wants to make the `length` validator
/// work for more types
///
/// A bit sad it's not there by default in Rust
pub trait HasLen {
fn length(&self) -> u64;
}
impl HasLen for String {
fn length(&self) -> u64 {
self.chars().count() as u64
}
}
imp... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
use yew::prelude::*;
#[derive(Debug)]
pub struct Model;
impl Component for Model {
type Message = ();
type Properties = ();
fn create(_props: Self::Properties, _link: ComponentLink<Self>) -> Self {
Self
}
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
unimplemented!()... |
#[macro_use]
extern crate failure;
#[allow(unused_imports)]
#[macro_use]
extern crate serde_derive;
#[cfg(test)]
mod tests;
use kv_crud_core::{Create, Entity, Read, Update, ReadWithPaginationAndSort, Page, Sort, Delete};
use serde::de::DeserializeOwned;
use serde::Serialize;
#[derive(Debug, Fail)]
pub enum Error {
... |
use std::{
sync::{Arc, Barrier},
time::Instant,
};
use criterion::{
criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, Throughput,
};
use data_types::NamespaceName;
use mutable_batch::MutableBatch;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use sharder::{JumpH... |
extern crate juniper;
use juniper::FieldResult;
use super::{
DiskInformation, LoadAverage, System, MemoryInformation, ByteUnit, CycleUnit, BootTime
};
graphql_enum!(ByteUnit {
ByteUnit::KB => "KB",
ByteUnit::MB => "MB",
ByteUnit::GB => "GB",
ByteUnit::TB => "TB",
});
graphql_enum!(CycleUnit {
... |
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() -> io::Result<()> {
let f = File::open("bil_prima.rs")?;
let mut reader = BufReader::new(f);
let mut buffer = String::new();
reader.read_line(&mut buffer)?;
println!("{}", buffer);
Ok(())
}
|
//! Parameters used in distributions, simulation modules, etc. are defined
//! here.
//!
//! These ensure the conversion between different parameter types follow
//! the right formulas.
//!
//!
//!
use anyhow::Result;
use std::{
convert::{TryFrom, TryInto},
ops::Neg,
};
use thiserror::Error;
#[readonly::make]
... |
use std::{ffi::CString, os::raw::c_char, ptr};
use crate::v8facade::{JavaScriptError, JavaScriptResult, Output};
#[repr(C)]
#[derive(Debug)]
pub struct UnsafeJavaScriptError {
pub exception: *mut c_char,
pub stack_trace: *mut c_char,
}
#[repr(C)]
#[derive(Debug)]
pub struct PrimitiveResult {
pub number_v... |
use fraction::ToPrimitive;
use encoding_rs::*;
//reading functions
/// Read a byte and increase the cursor position by 1
/// * `data` - array of bytes
/// * `seek` - start position to read
/// * returns the read byte as u8
pub(crate) fn read_byte(data: &[u8], seek: &mut usize ) -> u8 {
if data.len() < *seek {pani... |
//! To run this code, clone the rusty_engine repository and run the command:
//!
//! cargo run --release --example sfx_sampler
use rusty_engine::prelude::*;
#[derive(Default)]
struct GameState {
sfx_timers: Vec<Timer>,
end_timer: Timer,
}
fn main() {
let mut game = Game::new();
let mut game_state... |
fn main() {
let this_file: &str = file!();
println!("file_name: {}", this_file);
println!("line: {}", line!());
println!("column: {}", column!());
}
|
#[derive(PartialEq, Copy, Clone)]
enum Direction {
Down, Up, Left, Right
}
#[derive(PartialEq, Copy, Clone)]
enum Part {
Cable, Letter, Space
}
type Point = (i32,i32);
type Map = Vec<String>;
fn next( p : &Point, d : &Direction ) -> Point {
let (x,y) = p;
match d {
Direction::Down => ( *x, *... |
use std::collections::HashMap;
use std::collections::HashSet;
type Coord = (i32, i32);
fn main() {
let fname = "data/06.txt";
let fdata = std::fs::read_to_string(fname)
.expect(&format!("couldn't read {}", fname));
let mut lines : Vec<&str> = fdata.lines().collect();
lines.sort();
let pa... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[doc(hidden)]
pub struct ISysStorageProviderEventReceivedEventArgs(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for ISysStorageProviderEven... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
// "Tifflin" Kernel - FAT Filesystem Driver
// - By John Hodge (thePowersGang)
//
// Modules/fs_fat/on_disk.rs
//! On-Disk structures and flags
#[allow(unused_imports)]
use kernel::prelude::*;
pub const ATTR_READONLY : u8 = 0x01; // Read-only file
pub const ATTR_HIDDEN : u8 = 0x02; // Hidden File
pub const ATTR_SYST... |
//! Cranelift shared settings.
//!
//! This module defines settings relevant for all code generators.
|
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Backup data register (BKP_DR)"]
pub dr: [DR; 10],
#[doc = "0x28 - RTC clock calibration register (BKP_RTCCR)"]
pub rtccr: RTCCR,
#[doc = "0x2c - Backup control register (BKP_CR)"]
pub cr: CR,
#[doc = "0x30 - BKP... |
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use crate::{MetricKind, MetricObserver, Observation};
/// A `CumulativeGauge` reports the total of the values reported by `CumulativeRecorder`
///
/// Unlike `U64Gauge` this means it is safe to use in multiple locations with the same
/// set of `Attrib... |
use domain_patterns::collections::Repository;
use crate::errors::Error::{ResourceNotFound, NotAuthorized, RepoFailure, ConcurrencyFailure};
use crate::errors::Result;
use domain_patterns::command::Handles;
use crate::survey::Survey;
use crate::app_services::commands::{CreateSurveyCommand, UpdateSurveyCommand, SurveyCom... |
use druid::piet::Color;
use druid::widget::{Button, Flex, Painter};
use druid::Data;
use druid::RenderContext;
use druid::{AppLauncher, PlatformError, Widget, WidgetExt, WindowDesc};
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
mod traverse;
const DEFAULT_HEIGHT: i32 = 9;
const DEFAULT_WIDTH: i... |
use bevy::{prelude::Mesh, render::mesh::VertexAttribute, render::pipeline::PrimitiveTopology};
pub struct Skybox {
pub size: f32,
}
impl Default for Skybox {
fn default() -> Self {
Skybox { size: 1.0 }
}
}
// impl Skybox {
impl From<Skybox> for Mesh {
fn from(cube: Skybox) -> Mesh {
l... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_Foundation")]
pub fn AppCacheCheckManifest(pwszmasterurl: super::super::Foundation::PWSTR, pwszmanifesturl: super::super::Foundati... |
use quickcheck::{quickcheck, TestResult};
use std::fmt::{Debug, UpperHex, Write};
use std::mem;
use std::collections::HashSet;
use super::*;
fn setup(rom: Vec<u8>) -> (Cpu, Cpu) {
use crate::cart::CartConfig;
use crate::cart_header::CartType;
let rom_size = rom.len();
let cart_config = CartConfig { car... |
use ::TypeContainer;
pub use ::errors::*;
pub trait CompilePass {
fn run(typ: &mut TypeContainer) -> Result<()>;
}
pub mod assign_parent;
pub mod assign_ident;
pub mod resolve_reference;
|
use std::fs;
use std::time::Instant;
use std::collections::HashMap;
fn process_mask(mask: &String, value: u64) -> u64 {
let repr = format!("{:036b}", value);
let mut res = String::new();
for it in mask.chars().zip(repr.chars()) {
let (m, r) = it;
let r = match m {
'1' => { '1' ... |
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct AircraftModelRaw {
pub code: Option<String>,
pub text: Option<String>,
} |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
pub mod client;
pub mod jwt;
pub mod validator;
lazy_static! {
static ref HASH_ROUNDS: String = std::env::var("HASH_ROUNDS").unwrap();
}
/*
pub fn hash_password(plain: &str) -> Result<String, ServiceError> {
// get the hashing cost from the env variable or use default
/*
let hashing_cost: u32 = match H... |
extern crate proc_macro;
use proc_macro::{TokenStream};
use syn::{parse_macro_input};
use quote::quote;
use syn::parse::{Parse, ParseStream};
struct ConcatImplInfo {
generics1: Vec<syn::Ident>,
generics2: Vec<syn::Ident>,
}
impl Parse for ConcatImplInfo {
fn parse(input: ParseStream) -> syn::Result<Self>... |
// 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.
use fidl_fuchsia_netstack as fidl;
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
pub enum IpAddressConfig {
StaticIp(fidl_fuchsia_net_ext::Subnet),
... |
use std::fmt;
use std::ops::Deref;
use std::os::unix::io::AsRawFd;
use super::{acpi, IoCtlIterator};
use crate::platform::traits::{BatteryIterator, BatteryManager};
use crate::{Error, Result};
pub struct IoCtlManager(acpi::AcpiDevice);
impl BatteryManager for IoCtlManager {
type Iterator = IoCtlIterator;
fn... |
use bevy::math::{vec2, Vec2};
use noise::*;
use rand::Rng;
use utils::{NoiseMapBuilder, PlaneMapBuilder};
use crate::texture_atlas::Rectangle;
#[derive(Debug)]
pub struct Graph {
pub nodes: Vec<Node>,
pub connections: Vec<Connection>,
}
impl Graph {
pub fn new(_node_count: i32, width: i32, height: i32, se... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use horrorshow::prelude::*;
use miri::Frame;
use regex::Regex;
use rustc::ty::TyCtxt;
use syntect::easy::HighlightLines;
use syntect::highlighting::{Color, ThemeSet};
use syntect::html::{styles_to_coloured_html, IncludeBackground};
use syntect::parsing::{SyntaxDefinition, SyntaxSet};
thread_local! {
/// Loading th... |
use crate::ast::{BinaryOperator, Expression, Program, Statement, UnaryOperator};
use crate::utils::{EvalError, Type, Value};
use std::collections::HashMap;
use std::io::{stdout, stdin, Write};
type EvalResult<T> = Result<T, EvalError>;
type GlobalVar = (Type, Option<Value>);
pub struct Evaluator {
global_scope: H... |
//! File holding the ResponseJSON type and associated tests
//!
//! Author: [Boris](mailto:boris@humanenginuity.com)
//! Version: 1.1
//!
//! ## Release notes
//! - v1.1 : changed `data` to Value instead of &Value
//! - v1.0 : creation
// =======================================================================
// LIBRA... |
use super::*;
/// A trait object used in method that access map entries without replacing them.
#[derive(StableAbi)]
#[repr(C)]
pub struct MapQuery<'a, K> {
_marker: NotCopyNotClone,
is_equal: extern "C" fn(&K, RRef<'_, ErasedObject>) -> bool,
hash: extern "C" fn(RRef<'_, ErasedObject>, HasherObject<'_>),
... |
pub mod algo;
pub mod arena_tree;
pub mod graph;
pub mod node;
pub mod safe_tree;
pub mod topology;
pub mod tree;
pub mod mcts_tree;
#[cfg(test)]
mod tests {
use std::borrow::BorrowMut;
use std::sync::Arc;
use rpool::{Pool, PoolScaleMode, Poolable};
#[derive(Debug)]
struct TestContext {
t... |
use crate::backend::c;
use crate::backend::conv::borrowed_fd;
use crate::backend::fd::{AsFd, AsRawFd, BorrowedFd, LibcFd};
use bitflags::bitflags;
use core::marker::PhantomData;
#[cfg(windows)]
use {
crate::backend::fd::{AsSocket, RawFd},
core::fmt,
};
bitflags! {
/// `POLL*` flags for use with [`poll`].
... |
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
// Copyright 2020 IOTA Stiftung
//
// 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 w... |
use std::sync::Arc;
use data_types::{
Column, ColumnId, ColumnType, ColumnsByName, NamespaceId, PartitionHashId, PartitionId,
PartitionKey, Table, TableId, TableSchema,
};
use crate::PartitionInfo;
pub struct PartitionInfoBuilder {
inner: PartitionInfo,
}
impl PartitionInfoBuilder {
pub fn new() -> ... |
use crate::config;
use crate::source;
use crate::store;
use crate::util;
use crate::video;
use crate::youtube;
pub fn run_url(
config: &config::Config,
store: &mut store::Store,
yt: &youtube::YT,
url: &str,
) -> util::Result<()> {
let yt_sleep_duration = chrono::Duration::hours(4);
let blacklis... |
pub fn strip(chrs: &mut Vec<char>) {
loop {
match chrs.last().cloned() {
None => break,
Some(c) => {
if !c.is_whitespace() {
break;
}
chrs.pop();
}
}
}
}
pub fn char_to_u16(c: &char) -> u16 {... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.