text stringlengths 8 4.13M |
|---|
#[allow(unused_imports)]
#[macro_use] extern crate serde_derive;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate url;
use std::io;
use std::io::Read;
use serde_json::Value;
use url::Url;
#[allow(unused_must_use)]
fn get_json(zip: &str) -> Value {
let key = "1aa84f76ad87af18";
... |
use std::env;
use std::string::String;
use std::num;
use std::num::strconv;
use std::ffi::OsStr;
use std::path::PathBuf;
pub fn get_prompt(status: isize) -> String {
let cwd = match env::current_dir() {
Ok(d) => {d},
Err(f) => {panic!(f.to_string())},
};
let home = match env::home_dir() {
... |
/*
Copyright 2020 Timo Saarinen
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 writing, software
d... |
use crate::archives::packages::patches::{block::MAX_BLOCK_LENGTH, Id, Patch, Entry, Block, decrypt::decrypt};
use std::collections::HashMap;
use std::io::{Write, SeekFrom, Seek, Read};
use crate::archives::Oodle;
use std::alloc::Layout;
#[derive(Debug)]
pub struct Package {
pub id: Id,
pub patches: HashMap<Id,... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct DDP_FILE_EXTENT {
pub Length: i64,
pub Offset: i64,
}
impl DDP_FILE_EXTENT {}
impl ::core::defaul... |
use crate::vm::{builtins::PyModule, PyRef, VirtualMachine};
#[cfg(feature = "ssl")]
pub(super) use _socket::{sock_select, timeout_error_msg, PySocket, SelectKind};
pub fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
#[cfg(windows)]
crate::vm::stdlib::nt::init_winsock();
_socket::make_module(vm)
}
... |
pub mod decimal;
mod hdb_decimal;
pub mod daydate;
pub mod longdate;
pub mod seconddate;
pub mod secondtime;
pub mod lob;
|
extern crate notify_rust;
fn main() {
let mut server = notify_rust::server::NotificationServer::new();
server.start(|n| {
if ! n.summary.is_empty() {
print!("{}", n.summary);
}
if ! n.body.is_empty() {
if ! n.summary.is_empty() {
// Maybe this... |
use proc_macro2::{Ident, Span};
use quote::{format_ident, quote};
fn main() {
let i1 = Ident::new("d1", Span::call_site());
println!("{}", i1);
let exp = quote! { let #i1 = 123; };
println!("{}", exp);
let i2 = format_ident!("{}_copy", i1);
println!("{}", i2);
} |
use anyhow::Result;
use qapi::qga;
use clap::Parser;
use futures::future::{FutureExt, Fuse};
use futures::stream::StreamExt;
use futures::{pin_mut, select};
use tokio::time::sleep;
use std::time::Duration;
use std::path::PathBuf;
use std::fs::File;
use std::io::{self, Read};
use super::{GlobalArgs, QgaStream};
#[deriv... |
//! Application state.
use std::collections::HashMap;
use std::error::Error;
use std::fs;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use druid::kurbo::{Affine, BezPath, Point, Rect, Shape, Size, Vec2};
use druid::{Data, Lens, WindowId};
use norad::glyph::{Contour, ContourPoint, Glyph, GlyphName, PointType};
... |
use std::borrow::{Borrow, BorrowMut};
use std::env;
use std::error::Error;
use std::fs;
#[derive(Debug)]
pub struct Config {
pub query: String,
pub filename: String,
pub case_sensitive: bool,
}
impl Config {
pub fn new(mut args: std::env::Args) -> Result<Config, &'static str> {
args.next();
... |
#![allow(non_snake_case)]
#![cfg(test)]
fn _returnSameI32(x: i32) -> i32 {
x
}
fn _returnDifferentI32(x: i32) -> i32 {
1
}
fn _returnSameString()
{
}
#[test]
fn Can_read_variable_in_inner_block() {
let x: i32 = 1;
{
let x2 = x;
assert_eq!(x2, x);
}
assert_eq!(x, 1);
}... |
use crate::Result;
use serde::{Deserialize, Serialize};
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
struct ResponseList {
topics: Vec<Topic>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Response {
topic: Topic,
}
#[derive(Default, Debug, Clone, Partial... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
#[macro_use]
mod macros;
mod hex;
mod object_id;
mod document;
mod array;
mod value;
pub mod linked_hash_map;
pub mod error;
pub mod vli;
mod datetime;
pub use object_id::{ObjectId, ObjectIdMaker};
pub use document::Document;
pub use array::Array;
pub use datetime::UTCDateTime;
pub use value::*;
pub use error::BsonE... |
// TODO find a better way of not compiling -bin for wasm32
#[cfg(target_arch="wasm32")]
fn main() {
}
#[cfg(not(target_arch="wasm32"))]
fn main() {
main_impl::main();
}
#[cfg(not(target_arch="wasm32"))]
mod main_impl {
extern crate mandelbrot;
extern crate image;
use self::mandelbrot::point::{Poin... |
//! Now we can draw all manner of colorful geometry, but that's not enough for an interesting
//! application.
//!
//! If we wanted to add keyboard support to our previous example, so that the user can use the left
//! and right arrow keys to move the square back ond forth, it would look like this:
//! ```no_run
... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Comparator control/status register"]
pub comp_c1csr: COMP_C1CSR,
#[doc = "0x04 - Comparator control/status register"]
pub comp_c2csr: COMP_C2CSR,
#[doc = "0x08 - Comparator control/status register"]
pub comp_c3csr: ... |
#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)]
pub struct Squares(pub usize);
#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)]
pub struct Feet(pub usize);
#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)]
pub struct Location(pub util::V2i);
impl Squares {
pub const FEET_PER: u... |
//! Ffi wrapper for types defined outside the standard library.
//!
//! The modules here are named after the crates whose types are being wrapped.
//!
#[cfg(feature = "crossbeam-channel")]
#[cfg_attr(feature = "docsrs", doc(cfg(feature = "channels")))]
pub mod crossbeam_channel;
pub mod parking_lot;
#[cfg(feature = ... |
pub mod composite;
pub mod face_split;
pub mod livesplit;
pub mod llanfair;
pub mod llanfair2;
pub mod llanfair_gered;
pub mod portal2_live_timer;
pub mod shit_split;
pub mod splitterz;
pub mod splitty;
pub mod time_split_tracker;
pub mod urn;
pub mod wsplit;
mod bom_consumer;
mod xml_util;
|
#![allow(dead_code)]
use crate::{aocbail, regex, utils};
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::HashSet;
use std::str::FromStr;
use strum::EnumCount;
use strum_macros::{EnumCount as EnumCountMacro, EnumString};
use utils::{AOCError, AOCResult};
lazy_static! {
static ref YEAR_REGEX: ... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub const CEventClass: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcdbec9c0_7a68_11d1_88f9_0080c7d771bf);
pub const CEventPublisher: ::windows::core::GUID = ::windows::core::GU... |
use crate::{Rectangle, Size};
use euclid::{vec2, point2, size2};
use std::num::Wrapping;
const LARGE_BUCKET: usize = 2;
const MEDIUM_BUCKET: usize = 1;
const SMALL_BUCKET: usize = 0;
const NUM_BUCKETS: usize = 3;
fn free_list_for_size(small_threshold: i32, large_threshold: i32, size: &Size) -> usize {
if size.wi... |
// scene.rs
//
// Copyright (c) 2019, Univerisity of Minnesota
//
// Author: Bridger Herman (herma582@umn.edu)
//! A scene, specified by a json file
use std::collections::HashMap;
use glam::{Quat, Vec2, Vec3};
use wasm_bindgen::prelude::*;
use crate::entity::EntityId;
use crate::light::{PointLight, SpotLight};
use ... |
use super::super::*;
use range::Range;
use dungeon::generator::*;
use std::cmp::{min, max, Ordering};
use std::f32;
// Strolneg, M, god of not ingesting poisonous plants and avoiding poison in general, paranoid
// Zarad-dul, F, goddess of creating holes in people, trees, and the ground, etc; consumed with an all-encom... |
/*!
Hashes相关的命令定义、解析
所有涉及到的命令参考[Redis Command Reference]
[Redis Command Reference]: https://redis.io/commands#hash
*/
use std::slice::Iter;
#[derive(Debug)]
pub struct HDEL<'a> {
pub key: &'a [u8],
pub fields: Vec<&'a [u8]>,
}
pub(crate) fn parse_hdel(mut iter: Iter<Vec<u8>>) -> HDEL {
let key = iter.n... |
use proconio::{input, marker::Chars};
fn main() {
input! {
_n: usize,
s: Chars,
};
let mut inner = false;
let mut ans = String::new();
for ch in s {
if ch == '"' {
inner = !inner;
}
if ch == ',' && !inner {
ans.push('.');
} el... |
//! Parsing of HTTP requests that conform to the [V2 Write API] only.
//!
//! [V2 Write API]:
//! https://docs.influxdata.com/influxdb/v2.6/api/#operation/PostWrite
use async_trait::async_trait;
use data_types::{NamespaceName, OrgBucketMappingError};
use hyper::{Body, Request};
use super::{
v2::{V2WriteParseE... |
// 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::test::types::{
StepResult, StepResultItem, TestPlan, TestPlanTest, TestResult, TestResultItem, TestResults,
},
fidl_fuchsi... |
use scanner_proc_macro::insert_scanner;
#[insert_scanner]
fn main() {
let t = scan!(usize);
for _ in 0..t {
let n = scan!(usize);
let s = scan!(String);
solve(n, s);
}
}
fn solve(n: usize, s: String) {
let mo = 998244353_u64;
let mut dp = vec![0; n + 1];
dp[0] = 1;
... |
//mod binary_search_tree;
mod directed_graph;
mod linked_list;
mod linked_list_persistent; |
use crate::window::Geometry;
pub struct Screen<W> {
window: W,
workspace: usize,
view: Geometry,
}
impl<W> Screen<W> {
pub fn new(window: W, view: Geometry) -> Self {
Screen {
window,
workspace: 0,
view
}
}
pub fn get_view(&self) -> &Geometr... |
#![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 BitmapCreateOptions(pub u32);
impl BitmapCreateOptions {
pub const None: Self = Self(0u32);
pub const IgnoreImageCache: ... |
// 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 failure::Error;
use wayland::{WlSubcompositor, WlSubcompositorRequest};
use crate::client::Client;
use crate::object::{ObjectRef, RequestReceiver};
/... |
use futures_core::future::BoxFuture;
use serde::de::DeserializeOwned;
use crate::connection::ConnectionSource;
use crate::cursor::Cursor;
use crate::executor::Execute;
use crate::pool::Pool;
use crate::sqlite::{Sqlite, SqliteArguments, SqliteConnection, SqliteRow};
use crate::sqlite::statement::Step;
use crate::decode... |
extern crate cgmath;
extern crate collision;
use cgmath::{BaseFloat, Decomposed, EuclideanSpace, One, Rotation, Transform};
pub use collision::{Interpolate, TranslationInterpolate};
/// Pose abstraction
pub trait Pose<P, R>: Transform<P>
where
P: EuclideanSpace,
{
/// New pose
fn new(position: P, rotation... |
//! [GitHub](https://github.com/kuretchi/spella)
//!
//! A competitive programming library for Rust.
pub mod algebra;
pub mod byte;
pub mod io;
pub mod sequences;
|
use std::{
fs::File,
io::{self, BufReader, Write},
};
use flate2::read::MultiGzDecoder;
use vcf::{VCFReader, VCFRecord};
use crate::error::Error;
pub trait VcfRecordInspector<R> {
fn inspect_record(&mut self, record: &VCFRecord) -> crate::Result<()>;
fn get_result(&mut self) -> crate::Result<R>;
}
p... |
#[doc = "Reader of register D3CCIPR"]
pub type R = crate::R<u32, super::D3CCIPR>;
#[doc = "Writer for register D3CCIPR"]
pub type W = crate::W<u32, super::D3CCIPR>;
#[doc = "Register D3CCIPR `reset()`'s with value 0"]
impl crate::ResetValue for super::D3CCIPR {
type Type = u32;
#[inline(always)]
fn reset_va... |
// 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 actix::prelude::*;
use anyhow::Result;
use serde::{Deserialize, Serialize};
use starcoin_accumulator::AccumulatorNode;
use starcoin_crypto::HashValue;
use starcoin_state_tree::StateNode;
use starcoin_types::peer_info::PeerId;
use starcoin_types::{
block::{Block, BlockHeader, BlockInfo},
transaction::SignedU... |
use libc::c_char;
use libc::c_int;
use std::ffi::CStr;
/// Execute a dice roll based on the given notation
#[no_mangle]
pub unsafe extern "C" fn roll_dice(notation: *const c_char) -> c_int
{
let notation = CStr::from_ptr(notation);
let result = dicenotation::roll_dice::<i32>(notation.to_str().unwrap());
... |
use super::*;
use std::convert::TryInto;
use proptest::prop_assert;
use proptest::strategy::Just;
use liblumen_alloc::erts::term::prelude::{Boxed, Map};
#[test]
fn with_same_key_in_map1_and_map2_uses_value_from_map2() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
... |
//! Handling of different call formats.
use std::convert::TryInto;
use anyhow::anyhow;
use byteorder::{BigEndian, WriteBytesExt};
use crate::{
context::Context,
core::common::crypto::mrae::deoxysii,
crypto::signature::context::get_chain_context_for,
keymanager, module,
modules::core::Error,
ty... |
use core::marker::PhantomData;
use embedded_graphics::{
draw_target::DrawTarget,
prelude::{PixelColor, Primitive},
primitives::PrimitiveStyle,
Drawable,
};
use embedded_gui::{
data::WidgetData,
widgets::slider::{Slider, SliderDirection, SliderFields, SliderProperties},
WidgetRenderer,
};
u... |
//! Used in the creation of a [`PartitionsSource`](crate::PartitionsSource) of PartitionIds
//! for the [`LocalScheduler`](crate::LocalScheduler).
//!
//! The filtering and fetching operations in these [`PartitionsSource`](crate::PartitionsSource) implementations
//! are limited to the PartitionId and metadata only, an... |
// 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 ... |
mod day1;
mod day2;
mod day3;
mod day4;
fn main() {
println!("Hello, world!");
let mut filename = "inputs/day1".to_string();
day1::solve_day1(&filename);
filename = "inputs/day2".to_string();
day2::solve_day2(&filename);
filename = "inputs/day3".to_string();
day3::solve_day3(&filename... |
// Divide Two Integers
// https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/587/week-4-february-22nd-february-28th/3654/
pub struct Solution;
use std::convert::TryInto;
impl Solution {
pub fn divide(dividend: i32, divisor: i32) -> i32 {
let negative = dividend.is_negative() ^... |
//use proconio::{input, fastout};
use proconio::input;
use num::*;
const L: u64 = 1000000000000000000;
//#[fastout]
fn main() {
input! {
n: usize,
mut d: [u64; n],
}
let lim = bigint::BigUint::from_u64(L).unwrap();
let mut r = bigint::BigUint::from_u64(1).unwrap();
d.sort();
if... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Devices_Pwm_Provider")]
pub mod Provider;
#[repr(transparent)]
#[doc(hidden)]
pub struct IPwmController(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Inter... |
use serde::{Serialize, Serializer};
pub use ser::MCProtoSerializer;
mod ser;
pub(crate) mod write;
pub fn serialize<T, S>(data: &T, serializer: S) -> Result<S::Ok, S::Error>
where
T: ?Sized + Serialize,
S: Serializer,
{
Serialize::serialize(data, serializer)
}
|
use chrono::Local;
use color;
use irc::proto::message::Tag;
use std::{collections::HashMap, iter::FromIterator};
#[inline(always)]
#[allow(dead_code)]
pub fn opt_string(s: Option<String>, default: String) -> String {
if let Some(x) = s {
x
} else {
default
}
}
#[inline(always)]
#[allow(dea... |
#[doc = "Reader of register CR"]
pub type R = crate::R<u32, super::CR>;
#[doc = "Writer for register CR"]
pub type W = crate::W<u32, super::CR>;
#[doc = "Register CR `reset()`'s with value 0"]
impl crate::ResetValue for super::CR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
fn main() {
println!("{}", inc(10));
greeting(String::from("Agus"), 35);
}
fn inc(x: i32) -> i32 {
return x+1;
}
fn greeting(name: String, age: i32) {
println!("Halo bapak {}, umur Anda {}", name, age);
} |
use std;
#[derive(Debug,PartialEq)]
pub enum RleComponent {
Run(usize, u8),
Literal(Vec<u8>)
}
struct Encoder {
working_component: Option<RleComponent>,
components: Vec<RleComponent>,
}
impl Encoder {
fn new() -> Encoder {
Encoder {
working_component: None,
componen... |
use crate::*;
use std::ffi::CString;
#[test]
fn write_rgba1() {
let mut file = std::ptr::null_mut();
let filename = CString::new("out.exr").unwrap();
unsafe {
Imf_RgbaOutputFile_with_dimensions(
&mut file,
filename.as_ptr(),
256,
128,
I... |
use url::{ParseError, Url};
use crate::signing::util::percent_encode_path;
/// An S3 bucket
///
/// ## Path style url
///
/// ```rust
/// # use rusty_s3::Bucket;
/// let endpoint = "https://eu-west-1.s3.amazonaws.com".parse().expect("endpoint is a valid Url");
/// let path_style = true;
/// let name = String::from("r... |
use clap::{App, Arg};
use std::io;
use csvsc::columns::ColSpec;
use csvsc::input::ReaderSource;
use csvsc::AddColumns;
use csvsc::InputStream;
use encoding::label::encoding_from_whatwg_label;
fn main() {
let matches = App::new("csvsc")
.version("1.0")
.author("Abraham Toriz <categulario@gmail.com>... |
use std::env;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
pub fn get<T, F>(v: T, key: &str, f: F) -> Option<T>
where
F: Fn(T, &str) -> Option<T>,
{
if key.is_empty() {
return None;
}
let vecs: Vec<&str> = key.splitn(2, '.').collect();
let v2 = f(v, vecs[0]);
if vecs.l... |
#![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 IQuickLink(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IQuickLink {
type Vtable = IQuickLink_abi;
con... |
mod day_four;
use day_four::solve;
fn main() {
println!("{}", solve())
} |
// Copyright 2016 `multipart` Crate 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 exce... |
extern crate pcap;
use pcap::{Device,Capture};
#[test]
fn it_works() {
assert!(true);
}
fn main() {
let device = Device::lookup().unwrap();
let mut cap = Capture::from_device(device).unwrap();
cap = cap.timeout(60000);
cap = cap.promisc(true);
cap = cap.snaplen(5000);
let mut active_cap = cap.open().unwr... |
extern crate proc_macro;
use proc_macro::{TokenStream, TokenTree};
fn get_type_name(input: TokenStream) -> String {
let mut iter = input.into_iter();
loop {
match iter.next() {
Some(TokenTree::Ident(ident)) => {
let name = ident.to_string();
if name == "stru... |
// List of useful cargo commands:
// run, test, check, clippy, fmt, build --release
fn main() {
println!("Hello, world!");
let _test: u32 = 0;
}
|
use cosmwasm_std::{Response, Uint128};
use cw0::Event;
pub struct SubscribeEvent<'a> {
pub plan_id: Uint128,
pub subscriber: &'a str,
}
impl<'a> Event for SubscribeEvent<'a> {
fn add_attributes(&self, rsp: &mut Response) {
rsp.add_attribute("action", "subscribe");
rsp.add_attribute("plan_i... |
#[macro_use]
extern crate serde_derive;
pub mod block_device;
pub mod vsock_device;
#[cfg(test)]
mod tests {
#[test]
fn test() {
}
} |
use symbol;
pub type Symbol = symbol::SymbolId;
pub type Position = usize;
#[derive(Debug,Clone,PartialEq)]
pub enum Var {
SimpleVar(Symbol, Position),
FieldVar(Box<Var>, Symbol, Position),
SubscriptVar(Box<Var>, Box<Exp>, Position),
}
#[derive(Debug,Clone,PartialEq)]
pub enum Exp {
VarExp(Box<Var>),... |
use elf;
use lz4;
use std;
use std::fmt;
use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use sha2::{Sha256, Digest};
use serde::{Serialize, Serializer, Deserialize, Deserializer};
use serde::ser::SerializeTuple;
use serde::de::{Visitor, Unexpected};
pub fn align(size: usize, padding: usize) -> usize {
((si... |
use crate::{
Coordinate, CoordinateType, Line, LineString, MultiLineString, MultiPoint, MultiPolygon,
Polygon, Rect, Triangle,
};
use geo_types::private_utils::{get_bounding_rect, line_string_bounding_rect};
/// Calculation of the bounding rectangle of a geometry.
pub trait BoundingRect<T: CoordinateType> {
... |
//! Framegraph implementation for Rendy engine.
#![forbid(overflowing_literals)]
#![deny(missing_copy_implementations)]
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![deny(intra_doc_link_resolution_failure)]
#![deny(path_statements)]
#![deny(trivial_bounds)]
#![deny(type_alias_bounds)]
#![deny(uncon... |
mod clip;
mod neighborhoods;
mod osm_reader;
mod split_ways;
use abstutil::{prettyprint_usize, Timer};
use geom::{Distance, FindClosest, Line, PolyLine, Pt2D};
use kml::ExtraShapes;
use map_model::{osm, raw_data, LaneID, OffstreetParking, Position, LANE_THICKNESS};
use std::collections::BTreeMap;
pub struct Flags {
... |
extern crate errno;
extern crate telamon_gen;
use telamon_gen::ir::{CmpOp, CounterKind, CounterVisibility, SetDefKey};
use telamon_gen::lexer::*;
use errno::Errno;
#[test]
#[allow(clippy::cyclomatic_complexity)]
fn lexer_initial() {
// Invalid's Token
assert_eq!(
Lexer::new(b"!".to_vec()).collect::<V... |
use crate::file_util::read_non_blank_lines;
use std::str::FromStr;
use std::collections::HashMap;
use itertools::Itertools;
#[derive(Debug)]
struct Instructions {
mask: String,
assignments: Vec<(usize, usize)>
}
#[allow(dead_code)]
pub fn run_day_fourteen() {
let mut lines = read_non_blank_lines("assets/d... |
#[doc = "Reader of register C1ISR"]
pub type R = crate::R<u32, super::C1ISR>;
#[doc = "Reader of field `TEIF1`"]
pub type TEIF1_R = crate::R<bool, bool>;
#[doc = "Reader of field `CTCIF1`"]
pub type CTCIF1_R = crate::R<bool, bool>;
#[doc = "Reader of field `BRTIF1`"]
pub type BRTIF1_R = crate::R<bool, bool>;
#[doc = "R... |
fn main() {
proconio::input!{k:usize,s:String};
if s.len()<=k{
println!("{}",s)
}else{
println!("{}...",&s[0..k])
}
} |
use std::fmt::Display;
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
pub use input::{QueryAsMacroInput, QueryMacroInput};
pub use query::expand_query;
use crate::database::DatabaseExt;
use sqlx::connection::Connection;
use sqlx::database::Database;
mod args;
mod input;
mod output;
mod query;
pub... |
// 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 std;
use na::*;
use math::*;
use renderer::*;
use alga::general::SupersetOf;
use std::iter::FlatMap;
#[derive(Clone, Copy, Debug)]
pub struct MaterialPoint<T : Real + Copy>{
pub density : T,
pub material : u32,
}
pub type DenMatFn3<T> = Box<Fn(Vector3<T>) -> MaterialPoint<T>>;
pub fn intersection3_mat_a... |
use crate::app::Args;
use anyhow::{Context, Result};
use clap::Parser;
use maple_core::paths::AbsPathBuf;
use maple_core::tools::ctags::{buffer_tags_lines, current_context_tag};
/// Prints the tags for a specific file.
#[derive(Parser, Debug, Clone)]
pub struct BufferTags {
/// Show the nearest function/method to ... |
use libsodium_sys::{
crypto_box_SEEDBYTES, crypto_hash_sha256_BYTES, crypto_pwhash_SALTBYTES,
crypto_secretstream_xchacha20poly1305_ABYTES,
};
pub use crate::object::cached_source::CachedObjectSource;
pub use crate::object::decrypt_reader::DecryptReader;
pub use crate::object::encrypt_writer::EncrypterWriter;
... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Win32_System_WinRT_Graphics_Capture")]
pub mod Capture;
#[cfg(feature = "Win32_System_WinRT_Graphics_Direct2D")]
pub mod Direct2D;
#[cfg(feature = "Win32_System_WinRT_Graphics_Imaging")]
p... |
use std::{env, path::Path};
fn main() {
let mut opts = built::Options::default();
opts
.set_cfg(false)
.set_compiler(false)
.set_dependencies(false)
.set_features(false)
.set_ci(true)
.set_env(true)
.set_git(true)
.set_time(true);
let src = env::var("CARGO_MANIFEST_DIR").unwrap()... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type IWindowsMediaLibrarySharingDevice = *mut ::core::ffi::c_void;
pub type IWindowsMediaLibrarySharingDeviceProperties = *mut ::core::ffi::c_void;
pub type... |
use libwebm::mkvmuxer::writer::MkvWriter;
use std::fs::File;
use std::io;
use std::io::{Error, ErrorKind, Read};
use libwebm::mkvmuxer::util;
// constants for muxer and parser tests
const kAppString: &'static str = "mkvmuxer_unit_tests";
const kOpusCodecId: &'static str = "A_OPUS";
const kVorbisCodecId: &'static str =... |
use std::ops::{self, RangeBounds};
use anyhow::{Context as _, Result};
use cfg_if::cfg_if;
use js_sys::{Uint16Array, Uint32Array};
use web_sys::{WebGlBuffer, WebGlRenderingContext};
use crate::{resolve_range, Buffer, BufferDataUsage, Context, Program, RenderPrimitiveType};
/// Stores the indices of a buffer.
pub str... |
use test_implement::*;
use windows::core::*;
use Windows::Foundation::Collections::*;
#[implement(
Windows::Foundation::Collections::IVectorView<i32>,
Windows::Foundation::Collections::IIterable<i32>,
)]
struct Thing();
#[allow(non_snake_case)]
impl Thing {
pub fn GetAt(&self, index: u32) -> Result<i32> {... |
extern crate rand;
extern crate sfml;
use crate::app::*;
use rand::*;
use sfml::graphics::*;
use sfml::system::*;
pub struct SnowCtx<'a> {
snow: Vec<CircleShape<'a>>,
initialized: bool,
counter: i32,
offsets: Vec<i32>,
}
impl SnowCtx<'_> {
pub fn new() -> SnowCtx<'static> {
SnowCtx {
... |
use crate::{
BlockHash, BlockNumber, BlockTimestamp, ClassCommitment, EventCommitment, GasPrice,
SequencerAddress, StarknetVersion, StateCommitment, StateUpdate, StorageCommitment,
TransactionCommitment,
};
use fake::Dummy;
#[derive(Debug, Clone, PartialEq, Eq, Default, Dummy)]
pub struct BlockHeader {
... |
pub trait Collidable<Other: ?Sized> {
/// Returns whether the `Other` is at least partially contained in `self`.
/// This does include the degenerate case of two boundaries touching, if
/// the concept of boundaries applies. Should be reflexive and is assumed
/// so by the library.
fn intersects(sel... |
pub use VkSampleCountFlags::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkSampleCountFlags {
VK_SAMPLE_COUNT_1_BIT = 0x0000_0001,
VK_SAMPLE_COUNT_2_BIT = 0x0000_0002,
VK_SAMPLE_COUNT_4_BIT = 0x0000_0004,
VK_SAMPLE_COUNT_8_BIT = 0x0000_0008,
VK_SAMPLE_COUNT_16_BIT = 0x0000_... |
// Copyright 2012 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 ethers::{middleware::gas_escalator::GeometricGasPrice, types::U256};
pub fn init_gas_escalator() -> GeometricGasPrice {
let coefficient = 1.12501;
let every_secs: u64 = 5; // TODO: Make this be 90s
let max_gas_price = Some(U256::from(5000 * 1e9 as u64)); // 5k gwei
GeometricGasPrice::new(coefficien... |
use anyhow::Context;
use pathfinder_common::TransactionHash;
use starknet_gateway_types::pending::PendingData;
use starknet_gateway_types::reply::transaction::ExecutionStatus;
use crate::context::RpcContext;
#[derive(serde::Deserialize, Debug, PartialEq, Eq)]
pub struct GetGatewayTransactionInput {
transaction_ha... |
use std::env;
use std::fs::File;
use std::io::Write;
fn main() -> std::io::Result<()> {
let file_name = env::args().nth(1).unwrap_or_default();
let mut file = File::create(file_name)?;
file.write_all(b"sample data")?;
Ok(())
}
|
/// `sysinfo`
pub type Sysinfo = linux_raw_sys::system::sysinfo;
pub(crate) type RawUname = linux_raw_sys::system::new_utsname;
|
use specs;
/// Color component. R, G, B, A format.
pub struct CompColor(pub [f32; 4]);
impl specs::Component for CompColor {
type Storage = specs::VecStorage<CompColor>;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.