text stringlengths 8 4.13M |
|---|
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use day_17::{self, INPUT};
fn criterion_benchmark(c: &mut Criterion) {
let parse_result = day_17::parse_input(INPUT);
c.bench_function("day_17::parse_input", |b| {
b.iter(|| day_17::parse_input(black_box(INPUT)));
});
c.b... |
pub mod get_instrument_candles {
#[allow(unused_imports)]
use chrono::prelude::*;
#[allow(unused_imports)]
use fxoanda_definitions::*;
use std::error::Error;
use Client;
#[derive(Debug, Serialize, Deserialize)]
struct RequestHead {
#[serde(rename = "Authorization", skip_serializ... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::IM {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w m... |
// 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 crate::Result;
use failure::ResultExt;
use fidl::encoding::Decodable;
use fidl::endpoints::create_endpoints;
use fidl_fuchsia_media_sessions2::*;
use f... |
mod buf_ext;
mod buf_mut_ext;
pub use buf_ext::BufExt;
pub use buf_mut_ext::BufMutExt;
|
// 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 ... |
use serde::{Serialize, Deserialize};
use std::iter::Iterator;
use std::fmt::Debug;
use chrono::prelude::*;
#[derive(Serialize, Deserialize, Debug)]
pub struct Task
{
pub id: usize,
pub title: String,
pub tags: Vec<String>,
pub deadline: i64,
pub deadline_includes_time: bool,
pub repeats: bool,
... |
use crate::ast::*;
use crate::pretty::*;
use heck::{CamelCase, SnakeCase};
use im::hashmap::HashMap;
use itertools::Itertools;
use std::char;
use std::default::Default;
const INDENT: isize = 4;
#[derive(Debug, Clone, Default)]
struct Env {
vars: HashMap<String, usize>,
}
impl Env {
pub fn local_var_name(&mut... |
mod send_can;
use std::io::Result;
use std::os::unix::net::{UnixListener, UnixStream};
use std::path::Path;
use std::io::{BufReader, BufRead};
fn server_driver(path: &str) -> Result<UnixListener> {
std::fs::remove_file(path)?;
let socket_file = path;
let socket = Path::new(socket_file);
UnixListener::... |
use yew::prelude::*;
use yew_functional::*;
#[function_component(YewStack)]
pub fn yewstack() -> Html {
html! {
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 82" fill="none" class="head-icon">
<circle cx="38" cy="40" r="25" fill="#FFEFB8"/>
<path d="M38.2373 41.0339L14 14" stroke="#... |
use std::{
io::{ErrorKind, Read, Write},
net::{Shutdown, TcpStream, ToSocketAddrs, UdpSocket},
};
use crate::{
common::{NetProtocol, SocketId},
IpAddress, Port, SocketAddress,
};
/// 1MB default buffer size
pub const DEFAULT_BUFFER_SIZE: usize = 1_000_000;
pub trait Socket: Send + Sync {
/// Esta... |
use synacor::memory::{MAX_ADDR, MAX_INT};
type Cache = Vec<Vec<Option<u16>>>;
fn main() {
for h in 0..MAX_INT {
let mut cache = vec![vec![None; MAX_ADDR]; 5];
let res = check(&mut cache, 4, 1, h) % MAX_INT;
println!("Running for {}, {}", h, res);
if res % MAX_INT == 6 {
... |
use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub enum InitializationError {
NodeInitializationError,
RPCInitializationError,
}
impl fmt::Display for InitializationError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
InitializationError::NodeInitiali... |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::SHORTS {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mu... |
use crate::api;
use std::panic;
/// Sets a custom panic hook, uses debug.trace
pub fn set_panic_hook() {
panic::set_hook(Box::new(|info| {
let file = info.location().unwrap().file();
let line = info.location().unwrap().line();
let col = info.location().unwrap().column();
let msg = ... |
use data_types::NamespaceName;
use std::{fmt::Debug, sync::Arc};
/// A [`Sharder`] implementation is responsible for mapping an opaque payload
/// for a given table name & namespace to an output type.
///
/// [`Sharder`] instances can be generic over any payload type (in which case,
/// the implementation operates exc... |
// 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 ... |
use std::env;
use std::fs;
use std::os::windows::prelude::*;
use std::path::Path;
fn main() {
let src_path: String = r#"\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"#.to_string();
let dst: String = r#"d:\var\tmp\wallpaper"#.to_owned();
let user_profi... |
// Copyright 2023 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 ag... |
extern crate tuix;
use tuix::widgets::Button;
use tuix::Application;
use tuix::events::BuildHandler;
use tuix::PropSet;
use tuix::style::themes::DEFAULT_THEME;
fn main() {
let app = Application::new(|win_desc, state, window| {
state.insert_theme(DEFAULT_THEME);
Button::new().build(state, wind... |
use std::cmp::{max, min};
use std::collections::HashSet;
use itertools::Itertools;
use whiteread::parse_line;
fn main() {
let s: String = parse_line().unwrap();
let oo = s
.char_indices()
.filter(|(_, c)| c == &'o')
.map(|(i, _)| i as u64)
.collect_vec();
let xx = s
... |
use super::exp;
/* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN) */
const K: i32 = 2043;
/* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub(crate) fn k_expo2(x: f64) -> f64 {
let k_ln2 =... |
#[macro_use]
extern crate cfg_if;
extern crate log;
cfg_if! {
if #[cfg(target_arch = "wasm32")] {
mod app;
mod loop_wasm;
use wasm_bindgen::prelude::*;
use crate::app::App;
#[wasm_bindgen(start)]
pub fn main_js() {
// Uncomment the line below to enab... |
use std::collections::BTreeSet;
pub fn binary_search()
{
let mut bstree = BTreeSet::new();
bstree.insert(32);
} |
/*
Project Euler Problem 5:
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
*/
fn main() {
for i in 1.. {
for j in 1..21 {
if i % j !=... |
pub struct LightSegment {}
|
use std::fmt::Debug;
#[derive(PartialEq, Clone)]
struct State(Vec<Vec<u8>>);
fn rules_p1(state: &State, col: usize, row: usize) -> u8 {
let mut occupied = 0;
let x_min = col.saturating_sub(1);
let x_max = (col + 1).min(state.0[0].len() - 1);
let y_min = row.saturating_sub(1);
let y_max = (row + 1)... |
use std::io::{self, Bytes, Read};
pub struct Decoder<R> {
bytes: Bytes<R>,
control_bits: u8,
control_idx: u32,
}
impl<R> Decoder<R>
where R: Read
{
pub fn new(read: R) -> Decoder<R> {
Decoder {
bytes: read.bytes(),
control_bits: 0,
control_idx: 8,
... |
use fileutil;
use std::collections::{HashMap, HashSet, BinaryHeap};
use std::iter::Map;
use std::str::Split;
use petgraph::{Graph, Undirected};
use petgraph::graph::NodeIndex;
use petgraph::algo::dijkstra;
fn transitive_orbits(object: &str, orbit_map: &HashMap<&str, HashSet<&str>>) -> u32 {
match orbit_map.get(obj... |
mod main;
mod command;
pub use self::main::reasonable_main;
pub use self::command::Command;
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub struct AdaptiveCardBuilder {}
impl AdaptiveCardBuilder {
pub fn CreateAdaptiveCardFromJson<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(value: Param0) -> ::wi... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_synthetic_add_layer_version_permission_input_body(
input: &crate::input::AddLayerVersionPermissionInput,
) -> Result<smithy_http::body::SdkBody, serde_json::error::Error> {
let body = crate::serializer::AddLayerVer... |
extern crate criterion_ex;
use criterion::{criterion_group, criterion_main, Criterion};
use criterion_ex::*;
fn fibonacci_benchmark(c: &mut Criterion) {
c.bench_function("fibonacci 7", |b| {
b.iter(|| recursive_process_fibancci(7, 0, 1))
});
}
criterion_group!(bench, fibonacci_benchmark);
criterion_mai... |
//! The RegexFilter allows the formatted or unformatted message to be compared against a regular
//! expression.
use Filter;
use config::filter::MatchAction;
use config::filter::MatchAction::*;
use log::{LogLevelFilter, LogRecord};
use regex::Regex;
#[cfg_attr(test, derive(PartialEq))]
#[derive(Clone, Debug)]
/// Rege... |
extern crate assert_cli;
extern crate wppr;
use std::path::PathBuf;
#[path = "./testfns.rs"]
mod testfns;
#[test]
fn test_app_config_works() {
let cfg_file: PathBuf = testfns::get_tests_dir("data/libtestwppr.toml");
let mut binpath: PathBuf = testfns::get_cwd();
binpath.push("target/debug/wppr");
l... |
use crate::utils;
use std::collections::HashMap;
const TEST_MODE: bool = false;
fn read_problem_data() -> Vec<i64> {
let mut result = Vec::new();
let path = if TEST_MODE {
"data/day9.test.txt"
} else {
"data/day9.txt"
};
if let Ok(lines) = utils::read_lines(path) {
for lin... |
use super::{io, PinBuilder, Runner, SubCommand};
use crate::AlfredError;
use std::io::Write;
use super::browser_info;
impl<'api, 'pin> Runner<'api, 'pin> {
pub fn post(&mut self, cmd: SubCommand) {
match self.perform_post(cmd) {
Ok(s) => {
io::stdout()
.writ... |
mod asset_view;
pub use asset_view::AssetView;
|
use bevy::{
prelude::Mesh, render::mesh::Indices, render::mesh::VertexAttribute,
render::pipeline::PrimitiveTopology,
};
use hexasphere::Hexasphere;
use crate::plugin::reverse_triangles;
/// A sphere made from a subdivided Icosahedron.
pub struct SkySphere {
/// The radius of the sphere.
pub radius: f... |
use std::iter::FromIterator;
#[derive(Clone, Default)]
pub struct Buffer {
pub buffer: Vec<char>,
pub buffer_pos: usize,
}
impl Buffer {
pub fn new() -> Self {
Self { ..Self::default() }
}
pub fn insert(&mut self, c: char) {
self.buffer.insert(self.buffer_pos, c);
self.mov... |
#![allow(unsafe_code)]
use crate::backend::c;
use core::num::NonZeroI32;
/// A process identifier as a raw integer.
pub type RawPid = c::pid_t;
/// `pid_t`—A non-zero Unix process ID.
///
/// This is a pid, and not a pidfd. It is not a file descriptor, and the
/// process it refers to could disappear at any time and... |
pub use n3_machine_ffi::{Error as MachineError, QueryError};
use n3_machine_ffi::{Query, WorkId};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug)]
pub enum Error {
LoadError(LoadError),
WorkError(WorkError),
MachineError(MachineError),
}
#[derive(Debug)]
pub enum LoadError {
NoSuc... |
use sdl2::EventPump;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::video::{Window, WindowContext};
use sdl2::render::{Canvas, TextureCreator, Texture};
use sdl2::image::{self, LoadTexture, InitFlag};
use sdl2::rect::Rect;
use sdl2::pixels::Color;
use std::time::Duration;
struct Dillo {
position: Re... |
use crate::app::Args;
use anyhow::{Context, Result};
use clap::Parser;
use icon::Icon;
use maple_core::process::shell_command;
use maple_core::process::{CacheableCommand, ShellCommand};
use maple_core::tools::rg::Match;
use rayon::prelude::*;
use std::convert::TryFrom;
use std::path::PathBuf;
/// Invoke the rg executa... |
use crate::component_registry::ComponentRegistry;
use crate::spatial_reader::ResourcesSystemData;
use crate::system_commands::SystemCommandSender;
use spatialos_sdk::worker::connection::WorkerConnection;
use specs::prelude::{Resources, System, SystemData, WriteExpect};
/// A system which replicates changes in the loca... |
use std::thread;
fn main() {
let top = 100 * 1000 * 1000;
let each = top / 10;
let mut kids = vec![];
for tt in 0..10 {
let local_tt = tt.clone();
kids.push(thread::spawn(move || {
let i0 = local_tt * each as i64;
let i1 = i0 + each as i64;
let mu... |
use std::cmp::Ordering;
pub fn find<T: Ord, U: AsRef<[T]>>(arr: U, key: T) -> Option<usize> {
let array = arr.as_ref();
let mid = array.len() / 2;
match key.cmp(array.get(mid)?) {
Ordering::Equal => Some(mid),
Ordering::Less => find(&array[..mid], key),
Ordering::Greater => find(&ar... |
use super::error_types::XpsError;
use super::material::RenderGroup;
use std::ffi::CString;
pub struct ImportParameters {
pub flip_uv: bool,
pub reverse_winding: bool,
}
pub struct Bone {
pub id: i16,
pub name: CString,
pub co: [f32; 3],
pub parent_id: i16,
}
pub struct BonePose {
pub name: String,
pu... |
use proconio::input;
fn f(a: u64, x: u64, m: u64) -> u64 {
assert!(x >= 1);
if x == 1 {
return 1 % m;
}
if x % 2 == 0 {
(1 + a) * f(a * a % m, x / 2, m) % m
} else {
assert!(x >= 3);
(1 + a * (1 + a) % m * f(a * a % m, (x - 1) / 2, m) % m) % m
}
}
fn main() {
... |
// Copyright 2019 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 {
crate::model::*,
fidl::endpoints::ServerEnd,
fidl_fuchsia_io::NodeMarker,
fuchsia_vfs_pseudo_fs::directory::{self, entry::DirectoryEn... |
use crate::{ASPECT_RATIO, HEIGHT, WIDTH};
use macroquad::prelude::*;
/// Make a Color from an RRGGBBAA hex code.
pub fn hexcolor(code: u32) -> Color {
let [r, g, b, a] = code.to_be_bytes();
Color::from_rgba(r, g, b, a)
}
pub fn mouse_position_pixel() -> (f32, f32) {
let (mx, my) = mouse_positi... |
use std::{
error::Error as StdError,
fmt::{
Formatter,
Result as FmtRes,
Display
},
sync::mpsc::{
RecvError
},
num::ParseIntError as IError,
};
use serde::{
Serialize,
Serializer,
ser::{
SerializeMap
},
};
use serde_json::Error as JsonErr... |
use std::io;
use std::io::prelude::*;
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input)
.ok()
.expect("read error");
let data = parse_input(input);
render(&data);
}
fn parse_input(input: String) -> Vec<i32> {
let numbers: Vec<i32> = input
.split... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
#[repr(transparent)]
pub struct GameServiceGameOutcome(pub i32);
impl GameServiceGameOutcome {
pub const None: Self = Self(0i32);
pub const Win: Self = ... |
use crossterm::event::Event;
use irust_api::{Command, GlobalVariables};
use self::script_manager::ScriptManager;
use super::options::Options;
pub mod script_manager;
pub trait Script {
fn input_prompt(&mut self, _global_variables: &GlobalVariables) -> Option<String>;
fn get_output_prompt(&mut self, _global_... |
pub fn main() {
cc::Build::new()
.files(&["softfp/softfp.c"])
.compile("softfp");
}
|
use amethyst::{
prelude::*,
core::SystemDesc,
derive::SystemDesc,
input::{
InputHandler,
VirtualKeyCode,
StringBindings
},
}
#[derivce(SystemDesc)]
struct GameSystem;
impl<'s> System<'s> for GameSystem {
type SystemData = Read<'s, InputHandler<StringBindings>>;
... |
use crate::config;
/// A clock mask.
///
/// The format looks like this
///
/// ```
/// 0b00000<1><0><2x>
/// ```
///
/// Where
///
/// * `1` is the value of the `SPR1` bit
/// * `0` is the value of the `SPR0` bit
/// * `2x` indicates if double speed mode is enabled
#[derive(Copy, Clone)]
pub struct ClockMask(pub u8);... |
// Copyright (c) 2016 The Rouille developers
// 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. All files in the project carrying such
// notice may not... |
pub mod standard;
|
// https://adventofcode.com/2018/day/4
use std::fs::File;
use std::io::{BufRead, BufReader};
use chrono::prelude::*;
use regex::Regex;
use std::collections::HashMap;
pub fn puzzle1() {
let filename = "input/4.txt";
let file = File::open(filename).expect("There was a problem opening the file:");
let re = R... |
use json::json;
use crate::authorize::ApplicationCredentials;
/// Legacy function, allowing to generate short-lived tokens without using OAuth.
#[allow(dead_code)]
pub(crate) fn generate_token(
endpoint: &str,
creds: &ApplicationCredentials,
) -> Result<String, jwt::Error> {
let current_time = chrono::Utc... |
use crate::matcher::WildcardMatcher;
use crate::util;
use std::net::IpAddr;
#[derive(Debug, Clone)]
pub struct IpMatcher {
allow: Vec<MatchMode>,
deny: Vec<MatchMode>,
}
#[derive(Debug, Clone)]
enum MatchMode {
Ip(IpAddr),
Wildcard(WildcardMatcher),
}
impl MatchMode {
fn new(s: &str) -> Result<Se... |
use super::prelude::*;
pub struct Counter {
get: AtomicUsize,
post: AtomicUsize,
}
impl Counter {
pub fn new() -> Self {
Self {
get: AtomicUsize::new(0),
post: AtomicUsize::new(0),
}
}
}
impl Fairing for Counter {
fn info(&self) -> Info {
Info {
... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::chain::BlockChain;
use actix::prelude::*;
use anyhow::{format_err, Error, Result};
use bus::{Broadcast, BusActor};
use config::NodeConfig;
use crypto::HashValue;
use logger::prelude::*;
use network::{get_unix_ts, NetworkA... |
use std::io::{self, BufRead};
struct Scanner {
depth: u32,
range: u32,
}
impl Scanner {
fn hits(&self) -> bool {
self.depth % self.period() == 0
}
fn period(&self) -> u32 {
2 * self.range - 2
}
fn severity(&self) -> u32 {
self.depth * self.range
}
}
fn get_in... |
use crate::{
HistogramObservation, MakeMetricObserver, MetricKind, MetricObserver, Observation,
ObservationBucket,
};
use parking_lot::Mutex;
use std::sync::Arc;
/// Determines the bucketing used by the `U64Histogram`
#[derive(Debug, Clone)]
pub struct U64HistogramOptions {
buckets: Vec<u64>,
}
impl U64Hi... |
use std::collections::HashMap;
pub fn run(path: &str) {
let input = std::fs::read_to_string(path).expect("Couldn't read data file.");
let part_1_solution = react(&input);
println!("day 5, part 1: {:?}", part_1_solution.len());
let part_2_solution = part_2(&input);
println!("day 5, part 2: {:?}", ... |
//! # Deadpool for SQLite [](https://crates.io/crates/deadpool-sqlite)
//!
//! Deadpool is a dead simple async pool for connections and objects
//! of any type.
//!
//! This crate implements a [`deadpool`](https://crates.io/crates/deadpool)
//! manag... |
#[derive(Clone,Copy,Debug)]
struct Match {
offset: isize,
length: usize,
}
#[derive(Clone,Debug)]
pub struct Encoder<'a> {
data: &'a [u8],
buffer: Vec<u8>,
control_byte_idx: usize,
control_byte_bit: u32,
}
impl<'a> Encoder<'a> {
pub fn new(data: &[u8]) -> Encoder {
Encoder {
... |
use crate::error::UnexpectedNullError;
use crate::postgres::{PgTypeInfo, Postgres};
use crate::value::RawValue;
use std::str::from_utf8;
#[derive(Debug, Copy, Clone)]
pub enum PgData<'c> {
Binary(&'c [u8]),
Text(&'c str),
}
#[derive(Debug)]
pub struct PgValue<'c> {
type_info: Option<PgTypeInfo>,
data:... |
use std::io;
struct Menu {
list_menu: Vec<String>,
answer: i32,
}
impl Menu {
fn show_menu(&mut self) {
print!("{}[2J", 27 as char);
for menu in &self.list_menu {
println!("{}", menu);
}
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
if let Ok(answer) =... |
use crate::vec3::*;
pub struct ONB {
pub u: Vec3,
pub v: Vec3,
pub w: Vec3,
}
impl ONB {
pub fn build_from_w(n: Vec3) -> Self {
let w = n.unit();
let a = if w.x.abs() > 0.9 {
vec3(0.0, 1.0, 0.0)
} else {
vec3(1.0, 0.0, 0.0)
};
let v = w.cross(a).unit();
let u = w.cross(v);
... |
// 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 ... |
use proconio::input;
use std::cmp::Ordering;
fn main() {
input! {
n: usize,
a: i32,
wxv: [(u32, i32, i32); n],
};
let mut ans = 0;
for i in 0..n {
let (_, x, v) = wxv[i];
let mut events = Vec::new();
#[derive(Debug, PartialEq)]
enum E {
... |
// 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.
mod convert;
use {
crate::{device::IfaceMap, telemetry::convert::*},
fidl_fuchsia_cobalt::HistogramBucket,
fidl_fuchsia_wlan_stats as fidl_sta... |
extern crate enet;
use enet::*;
use std::net::Ipv4Addr;
use std::time::Duration;
fn main() {
let enet = Enet::new().expect("could not initialize ENet");
let local_addr = Address::new(Ipv4Addr::LOCALHOST, 9001);
let mut host = enet
.create_host::<()>(
Some(&local_addr),
10... |
#![doc(html_logo_url = "https://raw.githubusercontent.com/georust/meta/master/logo/logo.png")]
//! The `geo-types` library provides geospatial primitive types and traits to the [`GeoRust`](https://github.com/georust)
//! crate ecosystem.
//!
//! In most cases, you will only need to use this crate if you're a crate auth... |
//! An abstraction for a source of [`PartitionData`].
//!
//! This abstraction allows code that uses a set of [`PartitionData`] to be
//! decoupled from the source/provider of that data.
use parking_lot::Mutex;
use std::{fmt::Debug, sync::Arc};
use crate::buffer_tree::partition::PartitionData;
/// An abstraction ove... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Clock control register"]
pub cr: CR,
#[doc = "0x04 - Clock configuration register (RCC_CFGR)"]
pub cfgr: CFGR,
#[doc = "0x08 - Clock interrupt register (RCC_CIR)"]
pub cir: CIR,
#[doc = "0x0c - APB2 peripheral r... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qcommandlinkbutton.h
// dst-file: /src/widgets/qcommandlinkbutton.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
//... |
use crate::io_utils::{MemMap, Writer};
use crate::mapper::{Kind, Mapper, RwLockExt};
use crate::sstable::SSTable;
use crate::Result;
use memmap::Mmap;
use rand::{rngs::SmallRng, seq::SliceRandom, FromEntropy, Rng};
use std::collections::HashMap;
use std::fs::{self, File, OpenOptions};
use std::io::{self, BufReader, ... |
// xfail-stage3
fn start(c: chan[chan[str]]) { let p: port[str] = port(); c <| chan(p); }
fn main() {
let p: port[chan[str]] = port();
let child = spawn start(chan(p));
let c;
p |> c;
} |
//! Stakes serve as a cache of stake and vote accounts to derive
//! node stakes
use hashbrown::HashMap;
use morgan_interface::account::Account;
use morgan_interface::pubkey::Pubkey;
use morgan_stake_api::stake_state::StakeState;
#[derive(Default, Clone)]
pub struct Stakes {
/// vote accounts
vote_accounts: Ha... |
//! Modified from https://github.com/diesel-rs/diesel/blob/master/examples/postgres/advanced-blog-cli/src/pagination.rs
use diesel::{
query_builder::{AstPass, Query, QueryFragment, QueryId},
query_dsl::methods::LoadQuery,
sql_types::BigInt,
QueryResult, RunQueryDsl,
};
use super::{DBConn, DB};
pub tr... |
pub mod events;
pub mod utils;
pub mod settings;
|
pub mod renderer_ascii;
|
extern crate gio;
extern crate gtk;
use gio::prelude::*;
use gtk::prelude::*;
use gtk::{
Application,
ApplicationWindow,
Button,
WindowPosition,
WindowType,
Window,
HeaderBar,
};
use std::process;
pub struct App {
pub window: Window,
pub header: Header,
}
pub struct Header {
p... |
/// Helper methods to act on hyper::Body
use futures::stream::{Stream, StreamExt};
use hyper::body::Bytes;
/// Additional function for hyper::Body
pub trait BodyExt {
/// Raw body type
type Raw;
/// Error if we can't gather up the raw body
type Error;
/// Collect the body into a raw form
fn i... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
//! Drawing algorithms and helpers
use std::sync::Arc;
use crate::component::Component;
use crate::data::{FontMetrics, Workspace};
use crate::design_space::ViewPort;
use crate::edit_session::EditSession;
use crate::guides::{Guide, GuideLine};
use crate::path::Path;
use crate::point::PointType;
use crate::point_list::... |
use crate::stdio_server::provider::ProviderId;
use anyhow::{anyhow, Result};
use once_cell::sync::{Lazy, OnceCell};
use paths::AbsPathBuf;
use printer::DisplayLines;
use rayon::prelude::*;
use rpc::RpcClient;
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde_json::{json, Value};
use std::collections::Has... |
// Copyright 2015 The tiny-http 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
//
// Unless required by applicable law or ag... |
use super::super::AsGtkDialog;
use crate::FileDialog;
use gtk_sys::GtkFileChooserNative;
use std::{
ffi::{CStr, CString},
path::{Path, PathBuf},
ptr,
};
#[repr(i32)]
pub enum GtkFileChooserAction {
Open = 0,
Save = 1,
SelectFolder = 2,
// CreateFolder = 3,
}
pub struct GtkFileDialog {
... |
#[cfg(target_arch = "x86_64")]
pub use self::x86_64::io::*;
mod x86_64
{
pub mod io;
}
|
pub use id_types::*;
pub use basics_data::*;
pub use loot_data::*;
pub use suppressable_data::*;
pub use damage_data::*;
pub use elemental_spells_data::*;
pub use spellbook_data::*;
pub use plant_spells_data::*;
pub use basic_spells_data::*;
pub use drawn_data::*;
pub use player_data::*;
pub use sprite_mappings::*... |
use bintree::Tree;
use P57::*;
pub fn main() {
let mut tree = Tree::end();
add_value(&mut tree, 2);
println!("add 2: {}", tree);
add_value(&mut tree, 3);
println!("add 3: {}", tree);
add_value(&mut tree, 0);
println!("add 0: {}", tree);
}
|
use stream::Stream;
use executor;
/// A stream combinator which converts an asynchronous stream to a **blocking
/// iterator**.
///
/// Created by the `Stream::wait` method, this function transforms any stream
/// into a standard iterator. This is implemented by blocking the current thread
/// while items on the under... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.