text stringlengths 8 4.13M |
|---|
use std::io::{Read, Result as IOResult, Error as IOError};
use std::string::FromUtf8Error;
#[derive(Debug)]
pub enum StringReadError {
IOError(IOError),
StringConstructionError(FromUtf8Error)
}
pub trait StringRead {
fn read_null_terminated_string(&mut self) -> Result<String, StringReadError>;
fn read_fixed_l... |
#[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::EEDONE {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
use morgan_vote_api::vote_state::MAX_LOCKOUT_HISTORY;
pub const MINIMUM_SLOT_LENGTH: usize = MAX_LOCKOUT_HISTORY + 1;
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
pub struct EpochSchedule {
/// The maximum number of slots in each epoch.
pub slots_per_epoch: u64,
/// A number of slots before slot... |
use crate::db::model::photo_model::PhotoModel;
use dotenv::dotenv;
use std::env;
use std::error::Error;
pub fn craw_photo_splider(count: usize) -> Result<Vec<PhotoModel>, Box<dyn Error>> {
dotenv().ok();
let url = env::var("IMAGE_URL")?;
println!("will request for {:?}", url.as_str());
#[derive(Deser... |
use geo::Point;
use std::cmp;
use codearea::CodeArea;
use consts::{
CODE_ALPHABET, ENCODING_BASE, GRID_CODE_LENGTH, GRID_COLUMNS, GRID_ROWS, LATITUDE_MAX,
LAT_INTEGER_MULTIPLIER, LNG_INTEGER_MULTIPLIER, LONGITUDE_MAX, MAX_CODE_LENGTH,
MIN_TRIMMABLE_CODE_LEN, PADDING_CHAR, PADDING_CHAR_STR, PAIR_CODE_LENGT... |
#![allow(dead_code)]
//! # Native bindings for Apache Mesos.
//!
//! This module links dynamically against `libmesos` and provides a native
//! `Scheduler` implementation, which delegates to a user-supplied Rust
//! `Scheduler` for all callbacks.
//!
//! Additionally, this module provides a native `SchedulerDriver` th... |
use serde::de::{self, Visitor};
use serde::{Deserialize, Deserializer};
use std::fmt::{self, Formatter};
use std::path::PathBuf;
#[derive(Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct Config {
pub server: Server,
pub certificate_path: PathBuf,
}
pub struct Server {
pub hostname: String,
... |
use super::system_prelude::*;
const ANIM_NAME_COLLISION_STEADY: &str = "in_collision";
const ANIM_NAME_COLLISION_ENTER: &str = "on_collision_enter";
const ANIM_NAME_COLLISION_LEAVE: &str = "on_collision_leave";
#[derive(Default)]
pub struct DynamicAnimationSystem;
impl<'a> System<'a> for DynamicAnimationSystem {
... |
/// Access a file randomly using a memory map
///
/// Creates a memory map of a file using `memmap` and simulates some non-sequential
/// reads from the file. Using a memory map means you just index into a slice rather
/// than dealing with `seek`ing around in a File.
///
/// The `Mmap::as_slice` function is only safe ... |
/*
*/
/*
The node trait
*/
use crate::core::{
context::{ptype::PType, Context},
utils::typedefs::Key,
};
use super::slot::Slot;
use std::collections::BTreeMap;
pub type SlotTypes = BTreeMap<Key, PType>;
pub trait Node {
fn eval(
&self,
context: Context,
input: Vec<Slot>,
... |
use serde::Serialize;
use std::fmt::Formatter;
#[derive(Clone, Debug, Serialize)]
pub struct Visibility(bool);
impl Visibility {
pub fn new(v: bool) -> Visibility {
Visibility(v)
}
pub fn to_bool(&self) -> bool {
self.0
}
}
impl std::fmt::Display for Visibility {
fn fmt(&self, f:... |
use crate::BotRawEventHandler;
use serenity::model::prelude::Event;
use serenity::prelude::Context;
pub async fn raw_event(_handler: &BotRawEventHandler, _ctx: Context, _event: Event) {
// handle raw events here
}
|
pub struct Solution;
impl Solution {
pub fn rotate(nums: &mut Vec<i32>, k: i32) {
let n = nums.len();
if n == 0 {
return;
}
let k = (k as usize) % n;
if k == 0 {
return;
}
nums.reverse();
nums[..k].reverse();
nums[k..].... |
pub mod color;
pub mod framebuffer;
pub mod geometry;
pub mod world;
mod csi_color;
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../gir-files
// DO NOT EDIT
use crate::Message;
use crate::Request;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[doc(alias = "SoupRequestHTTP")]
pub struct RequestHTTP(Object<ffi::SoupRequestHTTP, ffi:... |
//! libc syscalls supporting `rustix::event`.
use crate::backend::c;
use crate::backend::conv::ret_c_int;
#[cfg(any(apple, netbsdlike, target_os = "dragonfly", target_os = "solaris"))]
use crate::backend::conv::ret_owned_fd;
use crate::event::PollFd;
#[cfg(any(linux_kernel, bsd, solarish, target_os = "espidf"))]
use c... |
/// Env wraps environment variables (NAME=VALUE)
#[derive(Debug, Eq, PartialEq)]
pub struct Env {
pub name: String,
pub value: String
}
/// EnvList is a wrapper for a list of Env
pub type EnvList = Vec<Env>;
impl Env {
pub fn new(name: &str, value: &str) -> Env {
Env { name: name.to_string(), val... |
use crate::{
event::metric::{Metric, MetricValue},
sinks::influxdb::{
encode_namespace, encode_timestamp, healthcheck, influx_line_protocol, influxdb_settings,
Field, InfluxDB1Settings, InfluxDB2Settings, ProtocolVersion,
},
sinks::util::{
http::{HttpBatchService, HttpClient, Htt... |
use std::borrow::Borrow;
use std::cmp::Ordering;
use std::convert::TryInto;
use std::marker::PhantomData;
use std::ops::Index;
use crate::error::{HelixError, Result};
use crate::types::{Bytes, Entry};
pub(crate) trait KeyExtractor<T: Borrow<Self>>: Eq {
fn key(data: &T) -> &[u8];
}
impl<T: Index<usize, Output = ... |
use hotkey::KeyCode;
/// The configuration to use for a Hotkey System. It describes with keys to use
/// as hotkeys for the different actions.
#[derive(Debug, Eq, PartialEq, Hash)]
pub struct HotkeyConfig {
/// The key to use for splitting and starting a new attempt.
pub split: KeyCode,
/// The key to use ... |
use proconio::{input, marker::Chars};
fn main() {
input! {
n: usize,
s: Chars,
};
let mut zero = 0;
let mut one = 0;
if s[0] == '0' {
zero = 1;
} else {
one = 1;
}
let mut ans: usize = one;
for i in 1..n {
let (zero_, one_) = if s[i] == '0' {... |
use chrono::{DateTime, Utc};
use serenity::async_trait;
use crate::{HOME_DIR, config::DatabaseType};
use super::CONFIG;
pub mod sqlite_connection;
use sqlite_connection::SqliteConnection;
#[derive(Debug, Clone)]
pub struct DBUser {
pub user_id: String,
pub level: i32,
pub xp: i32,
pub last_xp: DateTi... |
// Copyright 2020-2021, The Tremor Team
//
// 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 agr... |
#[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::PCON {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut ... |
use std::borrow::Cow;
const IAS_CERT: &[u8] =
include_bytes!("../../../../client-core/src/cipher/AttestationReportSigningCACert.pem");
#[derive(Clone)]
pub struct EnclaveCertVerifierConfig<'a> {
/// PEM encode bytes containing attestation report signing CA certificate
pub signing_ca_cert_pem: Cow<'a, [u8]... |
#[doc = "Reader of register EISC"]
pub type R = crate::R<u32, super::EISC>;
#[doc = "Writer for register EISC"]
pub type W = crate::W<u32, super::EISC>;
#[doc = "Register EISC `reset()`'s with value 0"]
impl crate::ResetValue for super::EISC {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
#![cfg(windows)]
#![recursion_limit = "256"]
#[macro_use]
extern crate detour;
extern crate encoding;
extern crate failure;
#[macro_use]
extern crate failure_derive;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate serde_derive;
extern crate toml;
extern crate winapi;
extern crate wio;
use detour::Stat... |
//! This mutation is chosen when the element mutator is a “unit” mutator,
//! meaning that it can only produce a single value. In this case, the
//! vector mutator’s role is simply to choose a length.
//!
//! For example, if we have:
//! ```
//! use fuzzcheck::{Mutator, DefaultMutator};
//! use fuzzcheck::mutators::vec... |
// 基础币
pub const CURRENCY : &'static str = "SWT";
//手续费
pub const FEE : u64 = 10000;
//SECP256K1 加密算法对应的零号、一号地址
pub const ACCOUNT_ZERO : &'static str = "jjjjjjjjjjjjjjjjjjjjjhoLvTp";
pub const ACCOUNT_ONE : &'static str = "jjjjjjjjjjjjjjjjjjjjBZbvri";
//SM2P256V1 加密算法对应的零号、一号地址
pub const ACCOUNT_ZERO... |
//! A 2D environment simulator, that let's you define the behavior and the shape
//! of your entities, while taking care of dispatching events generation after
//! generation.
//!
//! # Overview
//! `semeion` is a library that was born out of the curiosity to see
//! how to abstract those few concepts that are, most of... |
//! Capability module docs.
use chain::PipelineStageFlags;
bitflags! {
/// Bitmask specifying capabilities of queues in a queue family.
/// See Vulkan docs for detailed info:
/// <https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkQueueFlagBits.html>
#[repr(transparent)]
pub s... |
use super::error;
use super::ztxt;
use super::RawDmi;
use image::imageops;
use image::GenericImageView;
use std::collections::HashMap;
use std::io::prelude::*;
use std::io::Cursor;
use std::num::NonZeroU32;
#[derive(Clone, Default, PartialEq, Debug)]
pub struct Icon {
pub version: DmiVersion,
pub width: u32,
pub h... |
pub mod routes;
pub mod errors; |
#![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 BSTRBLOB {
pub cbSize: u32,
pub pData: *mut u8,
}
impl BSTRBLOB {}
impl ::core::default::Default ... |
const STD_MODULES: &[&str] = &["Block", "Event", "Time"];
const STD_BYTECODE: &[&[u8]] = &[
include_bytes!("../assets/target/modules/0_Block.mv"),
include_bytes!("../assets/target/modules/1_Event.mv"),
include_bytes!("../assets/target/modules/2_Time.mv"),
];
const USER_MODULES: &[&str] = &["Store", "EventP... |
// 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::buffer_writer::BufferWriter,
bitfield::bitfield,
failure::{bail, ensure, Error},
zerocopy::{AsBytes, ByteSlice, ByteSliceMut, ... |
mod system;
pub use self::system::System;
|
use tonic_build::compile_protos;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// compiling protos using path on build time
let protobuf_definitions = ["proto/engine.proto"];
for def in protobuf_definitions.iter() {
compile_protos(def)?;
}
Ok(())
}
|
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use itertools::Itertools;
use whiteread::parse_line;
fn main() {
let (n, m, k): (usize, usize, usize) = parse_line().unwrap();
if n <= k {
// すべてのパターンok
}
for i in 1..=n + m {
if i <= k {
continue;
... |
#[derive(Debug)]
#[allow(dead_code)]
pub struct TmpTypeElement<'a> {
pub t: &'a str,
pub level: usize,
}
impl<'a> PartialEq<TmpTypeElement<'a>> for TmpTypeElement<'a> {
fn eq<'b>(&self, other: &TmpTypeElement<'b>) -> bool {
return self.t.eq(other.t) && self.level == other.level;
}
}
... |
use crate::{http, trace_labels, Outbound};
use linkerd_app_core::{config, errors, http_tracing, svc, Error};
use tracing::debug_span;
impl<H, HSvc> Outbound<H>
where
H: svc::NewService<http::Logical, Service = HSvc> + Clone + Send + 'static,
HSvc: svc::Service<http::Request<http::BoxBody>, Response = http::Res... |
use aoc2018::*;
use std::ops::RangeInclusive;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Tile {
Clay,
Still,
Flowing,
Empty,
}
struct Tiles {
source: (i64, i64),
tiles: HashMap<(i64, i64), Tile>,
ry: RangeInclusive<i64>,
ry_with_source: RangeInclusive<i64>,
}
impl Tiles {
... |
#![feature(test)]
extern crate test;
use hello_world::greeter_client::GreeterClient;
use hello_world::HelloRequest;
use futures::future;
use std::time::Instant;
pub mod hello_world {
tonic::include_proto!("helloworld");
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client =... |
//! Library that decodes the binary documents contained on an APK (both resources.arsc and binary
//! XMLs).
//!
//! It exposes also structures to query this binary files on a structured way. For example, it's
//! possible to check which chunks of data a document contains, and perform specific queries
//! depending on ... |
use nalgebra::Matrix4;
use crate::traits::{required::{SliceExt, Matrix4Ext}, extra::F32Compat};
////////// F32 ///////////////////////////
impl F32Compat for Matrix4<f32> {
fn write_to_vf32(&self, target: &mut [f32]) {
target.copy_from_slice(self.as_slice());
}
}
impl SliceExt<f32> for Matrix4<f32> {
... |
// 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.
//! This module contains methods for creating OAuth requests and interpreting
//! responses.
use crate::constants::{
FUCHSIA_CLIENT_ID, OAUTH_REVOCATI... |
use crate::prelude::*;
#[repr(C)]
#[derive(Debug)]
pub struct VkMVKDeviceConfiguration {
pub supportDisplayContentsScale: VkBool32,
pub imageFlipY: VkBool32,
pub shaderConversionFlipFragmentY: VkBool32,
pub shaderConversionFlipVertexY: VkBool32,
pub shaderConversionLogging: VkBool32,
pub perfor... |
use std::fs::File;
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::path::Path;
use lz4::EncoderBuilder;
#[derive(Debug, Default)]
struct WriteCount {
written: u64,
}
impl Write for WriteCount {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.written += buf.len() as u64;
... |
#![feature(test)]
//learn from https://medium.com/@james_32022/unit-tests-and-benchmarks-in-rust-f5de0a0ea19a
extern crate test;
use rand::{thread_rng, Rng};
use test::Bencher;
pub fn random_vector(i: i32) -> Vec<i32> {
let mut numbers: Vec<i32> = Vec::new();
let mut rng = rand::thread_rng();
for i in 0.... |
//! Types defined by the SDK.
pub mod address;
pub mod callformat;
pub mod message;
pub mod token;
pub mod transaction;
|
fn main(){
let a:[isize;3] = [1,2,3];
let b:&[isize] = &a;
println!("{:?}",b);
for elm in b {
println!("{}",elm)
}
} |
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use itertools::Itertools;
use whiteread::parse_line;
const ten97: usize = 1000000007;
fn alphabet2idx(c: char) -> usize {
if c.is_ascii_lowercase() {
c as u8 as usize - 'a' as u8 as usize
} else if c.is_ascii_uppercase() {
c a... |
use griddle::HashMap as IncrHashMap;
use hashbrown::HashMap;
use ritekv::{MemStore, Store};
use std::time::{Duration, Instant};
use griddle::hash_map::DefaultHashBuilder;
type AHashMap<K, V> = IncrHashMap<K, V, DefaultHashBuilder>;
const N: u32 = 1 << 22;
fn main() {
let mut hm = HashMap::new();
let mut mx =... |
// Copyright 2018 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 super::*;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Kernel {
pub id: Uuid,
pub name: String,
pub storage_id: Uuid,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct NewKernel {
pub name: String,
pub storage_id: Uuid,
}
#[derive(Error, Debug)]
pub enum KernelError {... |
#[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 {
... |
use lazy_static::lazy_static;
use std::collections::HashMap;
pub fn run() {
lazy_static! {
static ref INPUT: String =
std::fs::read_to_string("data/input-day-6.txt")
.unwrap()
.strip_suffix("\n")
.unwrap()
.to_string();
}
... |
//! # FCM/APNs/HMS Push Relay
//!
//! This server accepts push requests via HTTPS and notifies the push
//! service.
//!
//! Supported service:
//!
//! - Google FCM
//! - Apple APNs
//! - Huawei HMS
#![deny(clippy::all)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::manual_unwrap_or)]
#[macro_use]
extern cra... |
// 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 const SEED_NOTE_HASH: &'static [u8] = b"note";
pub const SEED_NULLIFIER: &'static [u8] = b"nullifier";
|
#![allow(unused_unsafe)]
use crate::com::*;
use crate::consts::*;
use crate::texture::*;
use raw_window_handle::HasRawWindowHandle;
use winapi::_core::f32::consts::PI;
use winapi::_core::mem;
use winapi::shared::basetsd::UINT16;
use winapi::shared::minwindef::{FALSE, TRUE};
use winapi::shared::ntdef::HANDLE;
use winapi... |
mod drawing;
mod tool;
mod fs;
pub use self::drawing::draw_bin;
pub use self::tool::RunOptions;
pub use self::fs::{new_work_dir, cleanup_work_dir, copy_result_to_out};
|
#![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 CLASSIC_EVENT_ID {
pub EventGuid: ::windows::core::GUID,
pub Type: u8,
pub Reserved: [u8; 7],... |
use std::{path::PathBuf, process::Command};
pub fn main() {
set_casm_compiler_version();
}
#[derive(serde::Deserialize)]
struct CargoMetadata {
pub packages: Vec<Package>,
}
#[derive(serde::Deserialize)]
struct Package {
pub name: String,
pub id: String,
}
fn set_casm_compiler_version() {
let ma... |
use input_i_scanner::InputIScanner;
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
};
(($($t: ty),... |
use crate::{DocBase, VarType};
const DESCRIPTION: &'static str = r#"
Fills background between two plots or hlines with a given color.
"#;
const EXAMPLES: &'static str = r#"
```pine
h1 = hline(20)
h2 = hline(10)
fill(h1, h2)
p1 = plot(open)
p2 = plot(close)
fill(p1, p2, color=color.green)
```
"#;
const ARGUMENTS: &'... |
use crate::ai::AI;
use std::process::{Command, Stdio, Child};
use std::io::Write;
use std::io::Read;
pub struct PipeAI {
process: Child,
}
impl AI for PipeAI {
fn get_move(&mut self, last_move: i64) -> i64 {
let to_send = last_move.to_string() + "\r\n";
match self.process.stdin.as_mut().unwrap... |
//! Handles configuration of the game
use piston::input;
use serde_derive::{Deserialize, Serialize};
use std::{collections::BTreeMap, env, fmt, fs, io, path};
mod serde_buffer_size;
mod serde_key_bindings;
/// Holds all the configuration values relevant to the gameplay itself, such as like skin
/// paths or key bind... |
/**
* Collections for the Order Signal.
*
* Take into account that the methods here expect the translation to be done
* already, SkillLoader is the one responsible for that (either directly or
* expecting the translation to be done already).
*/
// Standard library
use std::collections::HashMap;
use std::fmt::Debu... |
use crate::physics::{Mass, PhysicsBundle};
use game_controller::{Player, PlayerBundle};
use game_core::{modes::ModeExt, GameStage, GlobalMode, ModeEvent};
use game_lib::{
bevy::{ecs as bevy_ecs, prelude::*},
tracing::{self, instrument},
};
use game_tiles::{EntityWorldPosition, EntityWorldRect};
#[derive(Clone,... |
#[doc = r" Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Start HFCLK clock source."]
pub tasks_hfclkstart: TASKS_HFCLKSTART,
#[doc = "0x04 - Stop HFCLK clock source."]
pub tasks_hfclkstop: TASKS_HFCLKSTOP,
#[doc = "0x08 - Start LFCLK clock source."]
pub tasks_lfclkstart:... |
// error-pattern:assignment to immutable vec content
fn main() { let v: vec[int] = [1, 2, 3]; v.(1) = 4; } |
use std::collections::HashMap;
impl Solution {
pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
let mut map = HashMap::new();
let mut ans = Vec::new();
for i in 0..nums.len() {
let tmp = map.entry(target - nums[i]).or_insert(-1);
if *tm... |
use gotham::state::State;
use gotham::router::Router;
use gotham::router::builder::*;
fn sample(state: State) -> (State, String) {
(state, "sample".to_string())
}
fn router() -> Router {
build_simple_router(|route| {
route.get("/sample").to(sample);
})
}
fn main() {
let addr = "127.0.0.1:808... |
//! A module containing crate-local data types that are shared across the
//! ingester's internals for processing DML payloads
mod ingest_op;
pub use ingest_op::*;
pub mod encode;
pub mod write;
|
use serde::de;
use serde::{Deserialize, Serialize};
use color_eyre::{
eyre::{eyre, Report, Result, WrapErr},
Section,
};
use reqwest::header::{
HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE, REFERER, USER_AGENT,
};
use tokio::{runtime::Handle, task};
use crate::{
nix::{NixLicense, NixPacka... |
extern crate asciii;
use std::error::Error;
use asciii::actions;
use asciii::storage::StorageDir;
fn main() {
let dir = StorageDir::All;
match actions::calendar(dir) {
Ok(cal) => println!("{}", cal),
Err(er) => println!("{}", er.description())
}
}
|
use input_i_scanner::InputIScanner;
use union_find::UnionFind;
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
... |
#[doc = r" Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 2048usize],
#[doc = "0x800 - Unspecified"]
pub acl: [ACL; 8],
}
#[doc = r" Register block"]
#[repr(C)]
pub struct ACL {
#[doc = "0x00 - Description cluster[n]: Configure the word-aligned start address of region n to prote... |
#![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use)]
#![cfg_attr(feature = "cargo-clippy", deny(warnings))]
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::parse::{self, Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{GenericParam, Iden... |
/// By convention:
/// * K is a map's key type, implementing `Copy` and `Ord`.
/// * T is an arbitrary type, typically stored as a value in a map.
/// * Op is an arbitrary operation type (typically a mode-specific enum).
use disambiguation_map::{DisambiguationMap, Match};
use ordered_vec_map::InsertionResult;
use std:... |
pub use self::base::*;
pub use self::iterable::*;
pub mod base;
pub mod iterable;
|
use crate::get_segment_from_slot;
use log::*;
use serde_derive::{Deserialize, Serialize};
use morgan_interface::account::Account;
use morgan_interface::account::KeyedAccount;
use morgan_interface::account_utils::State;
use morgan_interface::hash::Hash;
use morgan_interface::instruction::InstructionError;
use morgan_int... |
pub mod front_of_house;
|
pub mod events;
pub mod input;
pub mod chatlog;
pub mod chatroom; |
use super::{BinOperation, Number, Var};
use derive_more::Display;
#[derive(Display)]
pub enum Expr {
Number(Number),
Var(Var),
BinOperation(BinOperation),
}
impl Expr {
pub fn derivative(&self, var: &Var) -> Self {
use Expr::{BinOperation, Number, Var};
match self {
Number(... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Win32_Security_Cryptography_Catalog")]
pub mod Catalog;
#[cfg(feature = "Win32_Security_Cryptography_Certificates")]
pub mod Certificates;
#[cfg(feature = "Win32_Security_Cry... |
use specs::join::JoinIter;
use specs::prelude::*;
use specs::world::Index;
use std::cmp::min;
use std::collections::BTreeMap;
use std::marker::PhantomData;
use std::ops::{Add, Sub};
use std::sync::{Arc, Weak};
pub use std::time::Duration;
const ZERO_DURATION: Duration = Duration::from_secs(0);
#[derive(Debug, Clone, ... |
#[allow(unused_imports)]
use proconio::{marker::*, *};
#[allow(unused_imports)]
use std::{cmp::Ordering, collections::HashMap, convert::TryInto};
#[allow(unused_imports)]
use lib::*;
#[fastout]
fn main() {
input! {
s: Chars,
t: Chars,
}
let mut s_chars: HashMap<&char, i32> = HashMap::new... |
// Copyright 2016 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::error;
use std::rc::Rc;
use std::cell::RefCell;
use std::ops::Deref;
use std::sync::Mutex;
use gl_bindings::gl;
use cgmath::{Matrix4, SquareMatrix, vec3, Point3, Rad};
use crate::demo;
use crate::utils::lazy_option::Lazy;
use crate::render::{Framebuffer, FramebufferAttachment, AttachmentPoint, ImageFormat, Ren... |
// maps mob names to their IDs and vice versa
use bimap::BiBTreeMap;
use lazy_static::lazy_static;
lazy_static! {
pub static ref MOBS: BiBTreeMap<i64, &'static str> = {
let mut map = BiBTreeMap::new();
map.insert(3, "Bat");
map.insert(4, "Bee");
map.insert(5, "Blaze");
map... |
fn sentido() -> String {
"HAcerla chillar".to_string()
}
fn senectud() -> i32 {
let edad = 90;
edad
}
fn main() {
println!("El sentido de la vida: {}", sentido());
println!("Cuando empieza la senectud: {}", senectud());
} |
use crate::Data;
use crate::ExtensionValue;
use chrono::prelude::{DateTime, FixedOffset};
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
/// CloudEvent according to spec version 0.2
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
pub struct CloudEventV0_2 {
#[serde(rename = "... |
// api.rs
// ======
//
// Primary Python module and Rust-lib public API.
use futures_util::FutureExt;
use pyo3::{prelude::*, wrap_pyfunction};
use tokio_tungstenite::tungstenite::Message as WsMessage;
use crate::server::{self, consumer_state::{self}};
use consumer_state as cs;
/// Starts the websocket server.
#[pyfu... |
use crate::source_code::SourceLocation;
// pub(crate) fn new_location_error(
// index: usize,
// field: &str,
// vm: &VirtualMachine,
// ) -> PyRef<PyBaseException> {
// vm.new_value_error(format!("value {index} is too large for location {field}"))
// }
pub(crate) struct AtLocation<'a>(pub Option<&'a ... |
use std::path::PathBuf;
use crate::sensors_and_pools::stats::EmptyStats;
use crate::traits::{CorpusDelta, Pool, SaveToStatsFolder};
use crate::{CompatibleWithObservations, PoolStorageIndex};
/// A pool that stores only one given test case.
///
/// Currently, it can only be used by fuzzcheck itself
/// because it requ... |
// 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 ... |
#[macro_use]
pub mod core;
pub mod graphics;
pub mod device;
pub mod debug;
#[macro_use]
pub mod numeric;
pub mod sound;
|
// Copyright 2017 rust-ipfs-api Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accord... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.