text stringlengths 8 4.13M |
|---|
//! A _rusty_ (and very much incomplete) crate library for dealing with Arch Linux's `PKGBUILD`
//! files and implement some of `makepkg`'s (or related tools) functionality.
//!
//! This crate so far can only parse certain key variables and arrays in a PKGBUILD file. In the
//! near future it will also be able to edit ... |
use sabun_maker::intf::member_desc::MemberDesc;
use crate::imp::structs::param_source::ParamSource;
use sabun_maker::structs::{RustMemberType, ParamType};
use crate::imp::structs::table_source::TableSource;
use crate::imp::structs::clist_source::CListSource;
use crate::imp::structs::cil_source::CilSource;
use crate::im... |
use serde::{Serialize, Deserialize};
use async_trait::async_trait;
pub struct Metric {
pub object: String,
pub property: String,
pub value: String,
}
#[typetag::serde(tag = "type")]
pub trait DestinationConfig {
fn name(&self) -> String;
fn init(self : Box<Self>) -> Box<dyn Destination>;
}
#[asyn... |
use std::net::IpAddr;
#[derive(Debug)]
pub struct TcpDatagram{
src_ip: IpAddr,
src_port: u16,
dst_ip: IpAddr,
dst_port: u16,
bytes: u32,
ack_num: u32,
seq_num: u32,
flags: u16,
}
impl TcpDatagram {
pub fn new(src_ip: IpAddr, src_port: u16, dst_ip: IpAddr, dst_port: u16, bytes: u32,... |
mod addr;
mod behaviour;
mod message;
mod protocol;
mod substream;
use self::protocol::DiscoveryProtocol;
use addr::AddressManager;
use behaviour::DiscoveryBehaviour;
use crate::{event::PeerManagerEvent, peer_manager::PeerManagerHandle};
use futures::channel::mpsc::UnboundedSender;
use tentacle::{
builder::MetaB... |
// Copyright 2021 Conflux Foundation. All rights reserved.
// Conflux is free software and distributed under GNU General Public License.
// See http://www.gnu.org/licenses/
use cfx_addr::{cfx_addr_decode, cfx_addr_encode, EncodingOptions, Network};
use cfx_types::H160;
use serde::{de, Deserialize, Deserializer, Serial... |
use std::collections::HashMap;
use std::cmp;
fn main() {
let result = run_instructions(include_str!("../input/input.txt"));
println!("Part 1: {}", result.0);
println!("Part 2: {}", result.1);
}
fn run_instructions(instr: &str) -> (i32, i32) {
let mut max_val = 0;
let mut registers : HashMap<&str, ... |
use sxd_document::Package;
use sxd_document::dom::Element;
/// TODO
pub struct Resourcetype {
rt: String
}
impl Resourcetype {
pub fn new() -> Resourcetype {
Resourcetype { rt: "todo".to_string() }
}
pub fn to_element<'a>(&self, package: &'a Package) -> Element<'a> {
let href = packag... |
use std::ops::Add;
struct Milimeters(u32);
struct Meters(u32);
// impl Add<Meter>라고 명시하여 기본값 Self 대신 RHS타입 파라미터 지정
impl Add<Meters> for Milimeters {
type Output = Milimeters;
fn add(self, other: Meters) -> Milimeters {
Milimeters(self.0 + (other.0 * 1000))
}
} |
use crate::errors::*;
use bincode::{deserialize, serialize};
use bytes::BytesMut;
use log::*;
use serde_derive::{Deserialize, Serialize};
use std::convert::{TryFrom, TryInto};
#[derive(Serialize, Deserialize, Debug)]
pub struct Response {
pub success: bool,
pub content: Option<String>,
}
impl TryInto<BytesMut... |
use crate::schema::shop_vip_metadatas;
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
#[derive(Queryable, Identifiable, Deserialize, Serialize, Debug, Clone)]
#[primary_key(shop_vip_id)]
pub struct ShopVipMetadata {
pub shop_vip_id: i64,
pub level: i64,
pub item_id: i64,
pub bag_type: ... |
sp_api::decl_runtime_apis! {
#[api_version]
pub trait Api {
fn test(data: u64);
}
}
fn main() {}
|
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#![feature(io_error_other)]
use std::borrow::Cow;
use std::collections::BTreeSet;
use std::collections::HashMap;
use std::collec... |
use velox::AppBuilder;
fn main() {
let app = AppBuilder::from_config(include_str!("../velox.conf.json").to_string())
.invoke_handler(|_proxy, req| {
Some(velox::json!({
"result": "Hello, world!",
}))
})
.build();
app.run().unwrap();
}
|
use std::rc::Rc;
use yew::prelude::*;
use yewdux::prelude::*;
#[derive(Clone)]
struct State {
count: u32,
}
enum CounterInput {
/// Increment count by one.
Increment,
}
enum CounterOutput {
/// Output the current count but doubled.
Doubled(u32),
}
struct CounterStore {
state: Rc<State>,
... |
use std::process;
use rusimeta;
fn main() {
let cfg_result = rusimeta::Config::new( std::env::args() );
if let Ok(cfg) = cfg_result {
if cfg.print_help() {
println!("\
Provide paths (absolute or relative) to image files whose metadata should be read.
The read metadata will be written to JS... |
use std::env::current_dir;
use std::error;
use std::fs::File;
use std::io::{Error, ErrorKind, Read};
use std::path::PathBuf;
use std::str;
const RES_FILE_HEADER: &str = "RES0";
const INVALID_HEADER_ERROR: &str = "Opened file is not a valid RES package";
pub fn open_res_file(file_name: &str) -> Result<File, Box<dyn er... |
pub static GIT_HEAD_COMMIT_HASH: &'static [u8] = include_bytes!("../build/commit_hash");
|
#![recursion_limit = "1024"]
#![allow(dead_code, unused_must_use, unused_variables)]
extern crate byteorder;
pub extern crate rmp;
pub extern crate rmp_serde;
extern crate serde;
extern crate tempdir;
extern crate tempfile;
extern crate time;
#[macro_use]
pub mod util;
#[macro_use]
pub mod msgmacros;
pub mod errors... |
//! Sagan subcommands
mod start;
mod version;
use self::{start::StartCommand, version::VersionCommand};
use crate::config::SaganConfig;
use abscissa_core::{Command, Configurable, Help, Options, Runnable};
use std::path::PathBuf;
/// Configuration filename
pub const CONFIG_FILE: &str = "sagan.toml";
/// Subcommands
... |
use crate::issues::*;
pub fn validate(gtfs: >fs_structures::Gtfs) -> Vec<Issue> {
let missing_url = gtfs
.agencies
.iter()
.filter(|agency| !has_url(agency))
.map(|agency| Issue::new_with_obj(Severity::Error, IssueType::MissingUrl, agency));
let invalid_url =
gtfs.agen... |
// OpenAOE: An open source reimplementation of Age of Empires (1997)
// Copyright (c) 2016 Kevin Fuller
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including wi... |
/**
* [1306] Jump Game III
*
* Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + arr[i] or i - arr[i], check if you can reach to any index with value 0.
Notice that you can not jump outside of the array at any time.
E... |
use std::str::FromStr;
use std::ops::Deref;
use std::fmt;
use std::time::{Duration as StdDuration, SystemTime};
use crate::duration::{self, parse_duration, format_duration};
use crate::date::{self, parse_rfc3339_weak, format_rfc3339};
/// A wrapper for duration that has `FromStr` implementation
///
/// This is useful... |
use std::{future::Future, pin::Pin};
/// This a trait used to abstract the task executor that is used in several modules.
/// For instance, it can be used to execute tasks with tokio or wasm-bindgen if needed
/// This is the same approach that is used within some components of libp2p
pub trait TaskExecutor {
/// R... |
#[cfg(test)] extern crate env_logger;
extern crate handlebars;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
extern crate itertools;
extern crate pathfinding;
extern crate regex;
extern crate rustfmt;
extern crate serde;
#[macro_use] extern crate serde_derive;
extern crate serde_json;
#[macro_us... |
use async_std::{fs::OpenOptions, path::PathBuf, stream};
use awair_record::api;
use futures::{stream::once, AsyncReadExt, AsyncWriteExt, StreamExt};
use log::error;
use serde::{Deserialize, Serialize};
use std::time::Duration;
#[derive(Serialize, Deserialize, Default)]
pub struct Config {
awair_local_uri: String,
... |
//! These endpoints relate to the core packaging features.
//!
//! Publish, yank, unyank, and download are the bare essentials needed for
//! adding new crates to the registry and using the registry to install crates.
//!
//! For now, the endpoints related to "owners" are on the back burner.
//! For the small-scale use... |
use std::mem::size_of_val;
use std::ptr::null;
pub use detector::internals::Pitch;
use crate::pitch_detection::detect_pitch_ii16;
use jni::JNIEnv;
use jni::objects::{JClass, JObject};
use jni::objects::ReleaseMode::{CopyBack, NoCopyBack};
use jni::sys::{jintArray, jobject, jshortArray, jstring};
pub mod detector;
pub... |
extern crate gl;
extern crate glfw;
extern crate libc;
extern crate nuke;
use gl::types::*;
use glfw::{Action, Context as glfwContext, Key};
use nuke::*;
use std::ffi::CString;
use std::mem;
use std::ptr;
use std::str;
macro_rules! c_str {
($s:expr) => {
concat!($s, "\0").as_ptr() as *const i8
};
}
... |
use crate::render_output::hdr_backbuffer::HdrBackbuffer;
use crate::render_output::screen::Screen;
use crate::wgpu_utils::pipelines::*;
use crate::{
simulation::HybridFluid,
wgpu_utils::{
self,
binding_builder::{BindGroupBuilder, BindGroupLayoutBuilder, BindGroupLayoutWithDesc},
binding_... |
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
use image::{self, hdr::HDRDecoder};
use nalgebra_glm as glm;
use super::ColorTexture;
pub fn open<'a, P: AsRef<Path>>(path: P) -> Result<ColorTexture, Box<dyn Error + 'a>> {
let f = File::open(path)?;
let reader = BufReade... |
#[cfg(feature = "fs")]
#[cfg(not(target_os = "redox"))]
#[test]
fn test_owned() {
use rustix::fd::{AsFd, AsRawFd, FromRawFd, IntoRawFd};
let file = rustix::fs::openat(
rustix::fs::CWD,
"Cargo.toml",
rustix::fs::OFlags::RDONLY,
rustix::fs::Mode::empty(),
)
.unwrap();
... |
// 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::io::{self, Write, BufWriter};
bitflags! {
struct Flags : u8 {
const HELP = 1;
const ESCAPE = 2;
const NO_NEWLINE = 4;
const NO_SPACES = 8;
}
}
const MAN_PAGE: &'static str = /* @MANSTART{echo} */ r#"NAME
echo - display a line of text
SYNOPSIS
echo [ -h | --he... |
use std::collections::HashMap;
use svm_layout::{FixedLayout, Layout};
use svm_types::{
Address, BytesPrimitive, CodeKind, CodeSection, CtorsSection, DataSection, GasMode, Section,
Sections, Template, TemplateAddr,
};
/// Information about templates already deployed at genesis.
#[derive(Debug)]
pub struct Genes... |
// Copyright 2020 Parity Technologies
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accor... |
extern crate redux;
extern crate time;
use std::io::Write;
use std::io::Read;
use std::io::Cursor;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use redux::model::Parameters;
use redux::model::Model;
use redux::model::AdaptiveLinearModel;
use redux::model::AdaptiveTreeModel;
macro_rules! debug_println {
... |
pub trait Display: Drop {
fn getch(&self) -> Option<char>;
}
|
use crate::prelude::{Index, RAReader, Value};
use super::IndexIterator;
/// An iterator that loops through each range step in the path expression and yield the index of
/// each item in the loop.
///
/// A range step at position `i` in the path is defined by `lowerbounds[i]` (start),
/// (`upperbounds[i]` & `neg_uppe... |
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PlayerController;
|
use actix_web::{
web,
HttpResponse,
};
use super::super::request::sample::RequestSampleIndex;
pub fn sample_index(item: web::Query<RequestSampleIndex>) -> HttpResponse {
println!("model: {:?}", &item);
HttpResponse::Ok().json(item.0)
} |
use crate::configuration::ImporterConfiguration;
use crate::utils::{download, osmconvert};
fn input(config: &ImporterConfiguration) {
download(
config,
"input/tel_aviv/osm/israel-and-palestine-latest.osm.pbf",
"http://download.geofabrik.de/asia/israel-and-palestine-latest.osm.pbf",
);
}... |
use std::fmt::Debug;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::str::FromStr;
#[derive(Clone, Debug)]
pub struct BadInput;
pub struct InputReader {
path: &'static str,
}
impl InputReader {
pub fn new(path: &'static str) -> InputReader {
InputReader { path }
}
// =========... |
//! [`arci`] implementation using ROS1.
mod cmd_vel_move_base;
mod error;
mod joy_gamepad;
mod msg;
mod ros_control_action_client;
mod ros_control_client;
mod ros_localization_client;
mod ros_nav_client;
mod ros_robot_client;
mod ros_speak_client;
pub mod ros_transform_resolver;
pub mod rosrust_utils;
// re-export
pu... |
// Copyright 2019 Conflux Foundation. All rights reserved.
// Conflux is free software and distributed under GNU General Public License.
// See http://www.gnu.org/licenses/
use super::super::errors::*;
// TODO: make it Delta MPT only. Add another type for Persistent MPT later.
pub type RowNumberUnderlyingType = u32;
... |
//! Promiscous run items, no output but aborts if one fail
//!
//! # Example
//!```
//!use automatic::promiscuous_list::PromiscuousList;
//!use automatic::runitem::RunItem;
//!use automatic::run::Run;
//!let items = vec![
//! RunItem::new("true".to_string(), vec![]),
//! RunItem::new("true".to_string(), vec![]),
... |
extern crate libc;
extern crate serde;
extern crate serde_json;
use libc::syscall;
use std::io::prelude::*;
use std::error::Error;
use std::fs::File;
use std::io::{ErrorKind, Read};
use std::mem::size_of;
use std::ffi::CString;
fn main() -> Result<(), Box<dyn Error>> {
// TODO: Get the rootfs key and other par... |
use std::env;
fn main() {
if let Ok(target) = env::var("TARGET") {
println!("cargo:rustc-env=TACD_TARGET={}", target);
};
}
|
use glutin_frontend::tile_map::{TileMapData, UpdateTileMapData, ShaderTemplateInfo};
use tile::TileCoord;
const TILE_STATUS_IDX: usize = 3;
const TILE_STATUS_ENABLED: u32 = 1 << 0;
pub struct OverlayCoord(pub TileCoord);
pub fn shader_template_info() -> ShaderTemplateInfo<'static> {
btreemap!{
"TILE_STAT... |
// Copyright 2019 Conflux Foundation. All rights reserved.
// Conflux is free software and distributed under GNU General Public License.
// See http://www.gnu.org/licenses/
extern crate cfx_bytes as bytes;
extern crate cfxkey as keylib;
extern crate core;
#[macro_use]
extern crate log;
extern crate network;
extern cra... |
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Softwa... |
use std::{
io::SeekFrom,
path::{Path, PathBuf},
};
use log::{debug, info, warn};
use once_cell::sync::Lazy;
use reqwest::Client;
use serde::Deserialize;
use tokio::{fs::File, io::AsyncReadExt, sync::Semaphore, task::JoinHandle};
use crate::options::OPTIONS;
static CONCURRENT_DOWNLOAD_LIMIT: Lazy<Semaphore> =... |
use super::dispatch::dispatch_contract;
use crate::common::sled_db;
use crate::common::sled_db::read_set_from_db;
use crate::common::tools::{get_dot_env, CONTRACT_FAIL, CONTRACT_PROGRESS, CONTRACT_SUCCESS};
use crate::contract::contracts::SmartContract;
use crate::raft::config::ConfigRaft;
pub fn thread_tasks() {
... |
use std::sync::Arc;
use vulkano::pipeline::{GraphicsPipelineAbstract, GraphicsPipeline};
use vulkano::command_buffer::{DynamicState, AutoCommandBufferBuilder, AutoCommandBuffer, CommandBuffer};
use vulkano::framebuffer::{RenderPassAbstract, Subpass, FramebufferAbstract, Framebuffer};
use std::cell::RefCell;
use vulkano... |
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::state::State;
use deno_core::ErrBox;
use deno_core::OpRegistry;
use deno_core::ZeroCopyBuf;
use serde_derive::Deserialize;
use serde_json::Value;
use std::rc::Rc;
pub fn init(s: &Rc<State>) {
s.register_op_json_sync("op_resources"... |
use std::{
fmt,
fmt::Debug,
future::Future,
pin::Pin,
task::{Context, Poll},
};
use crate::{provider::ProviderError, JsonRpcClient, PubsubClient};
use async_trait::async_trait;
use ethers_core::types::{U256, U64};
use futures_core::Stream;
use futures_util::{future::join_all, FutureExt, StreamExt};... |
use crate::game::sub_section::*;
/// Total number of sub-sections contained within a section.
pub const SUB_SECTION_COUNT: usize = 5;
/// A section which contains SUB_SECTION_COUNT sub-sections the victim and killer might search.
pub struct Section {
/// Name of the section.
pub name: String,
// Letter i... |
extern crate seccomp;
use std::io::{self, Write};
use seccomp::{Action, Compare, Filter, get_syscall_number};
use seccomp::Op::*;
fn main() {
println!("before filtering");
let mut stderr = io::stderr();
let mut filt = Filter::new(Action::Kill).expect("could not create filter");
// Allow writing to... |
use proc_macro2::{ Span as Span2, TokenStream as TokenStream2 };
use syn::Error;
pub fn compile_error(span: Span2, msg: &str) -> TokenStream2 {
Error::new(span, msg).to_compile_error()
}
pub mod msg {
pub const ARGUMENTS_ORDER_ERROR: &str = "order of arguments is invalid, all [optional arguments] should be p... |
#[macro_use]
extern crate lazy_static;
pub mod common;
pub mod reader;
pub mod decode_hint_type;
pub mod qrcode;
pub mod multi_format_reader;
pub mod binary_bitmap;
pub mod result_point;
pub mod error; |
#![allow(non_snake_case)]
mod util;
use std::collections::HashMap;
use std::collections::VecDeque;
#[derive(Debug)]
struct QT {
quant: i64,
element: String,
}
fn parse_one(s: &str) -> QT {
let s = s.trim().split(" ").collect::<Vec<_>>();
let quant = s[0].parse::<i64>().unwrap();
let element = s[1].to_strin... |
pub use universal_wallet::{
contents::{
Content,
ContentEntity,
public_key_info::KeyType,
},
locked::LockedWallet,
unlocked::UnlockedWallet,
};
pub struct CppUnlockedWallet {
wallet: UnlockedWallet
}
pub struct CppLockedWallet {
wallet: LockedWallet
}
impl CppUnlockedW... |
use crate::{
core::{algebra::Vector2, color::Color, pool::Handle},
define_constructor,
grid::{Column, GridBuilder, Row},
message::{MessageDirection, UiMessage},
numeric::{NumericType, NumericUpDownMessage},
vec::{make_mark, make_numeric_input},
BuildContext, Control, NodeHandleMapping, UiNod... |
//! Augments `syn`'s AST with helper methods to deal with Near SDK definitions.
//! Additionally, provides function to deal with Rust syntax.
#![deny(warnings)]
#![warn(missing_docs)]
use syn::{
Attribute, FnArg, ImplItem, ImplItemMethod, ItemEnum, ItemImpl, ItemStruct, Lit, Meta,
MetaList, MetaNameValue, Nest... |
// Project Euler: Problem 15
extern crate euler;
extern crate num;
use euler::util::n_choose_k;
/* This one requires some explaining.
* To move through an n x n lattice requires exactly n moves
* along the x-axis and n moves along the y-axis, hence
*
* dx_1 + dx_2 + ... + dx_2n = n, dx_i in {0, 1}
* dy_1 + ... |
use lazy_static::lazy_static;
use rcore_fs::dev::BlockDevice;
use rcore_fs::vfs::FsError;
use rcore_fs::vfs::INode;
use rcore_fs_sfs::SimpleFileSystem;
pub use inode_ext::INodeExt;
pub use stdin::STDIN;
pub use stdout::STDOUT;
use crate::fs::config::BLOCK_CACHE_CAPACITY;
pub mod config;
pub mod inode_ext;
pub mod st... |
extern crate wasm_bindgen;
extern crate web_sys;
extern crate js_sys;
extern crate specs;
use std::f64;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use specs::{Read, Component, VecStorage, World, Builder, System, ReadStorage, RunNow};
use web_sys::{CanvasRenderingContext2d};
// console.log macro
macro_ru... |
use crate::config;
use crate::db::totp::add_totp_token;
use crate::db::user::modify_user;
use crate::models::{ServerError, User};
use crate::{err_input, err_server};
use actix_http::cookie::{Cookie, SameSite};
use chrono::{Duration, Utc};
use time::Duration as Dur;
use totp_rs::{Algorithm, TOTP};
/// Create a totp to... |
extern crate clap;
extern crate gamenet_spec;
extern crate logger;
extern crate serde_json;
use std::error::Error;
use std::fs::File;
use std::path::Path;
use std::process;
fn process(path: &Path) -> Result<(), Box<dyn Error>> {
let file = File::open(path)?;
let _spec: gamenet_spec::Spec = serde_json::from_re... |
use crate::{HashM, HashS, HashMt, HashSt};
use json5_parser::Span;
use crate::error::Result;
use crate::imp::structs::rust_value::{RustValue};
use crate::imp::structs::ref_value::{RefValue, RefSabValue};
use crate::imp::structs::ref_def_obj::{RefDefObj};
use crate::imp::structs::rust_list::{ConstItem, MutItem};
use cra... |
// Copyright 2019 Conflux Foundation. All rights reserved.
// Conflux is free software and distributed under GNU General Public License.
// See http://www.gnu.org/licenses/
use crate::{
message::{
GetMaybeRequestId, Message, MessageProtocolVersionBound, MsgId,
RequestId, SetRequestId,
},
sy... |
fn main() {
server::run();
}
|
use std::{fmt, io};
/// Custom error type for CLI errors
///
/// Used mainly when users pass invalid arguments.
///
/// # Examples
///
/// When passing in invalid monetary amounts, such as `error` or `no_amount`,
/// this error will be thrown.
#[derive(Debug)]
pub enum CliError {
Io(io::Error),
Args(&'static s... |
use std::cell::RefCell;
use std::io;
use std::os::unix::prelude::RawFd;
use std::task::{Context, Poll, Waker};
use super::epoll::{Event, Token};
use super::readiness::Readiness;
#[derive(Clone, Default)]
pub(crate) struct IoSource {
/// Raw file descriptor of the IO resource
pub(crate) io: RawFd,
/// Toke... |
//! I/O関連の構成設定を集めたモジュール.
use crate::types::{LogicalDuration, Probability, Range};
/// `Timer`用の構成設定.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimerConfig {
/// 一つの選挙期間のタイムアウト尺.
///
/// リーダからのハートビートを受信しない期間が、
/// ここで指定された尺を超えた場合には、
/// リーダがダウンしたものと判断されて、次の選挙が始まる.
#[serde(defaul... |
use protobuf::well_known_types::any::Any;
use protobuf::MessageFull;
use super::test_any_pb::MessageOne;
use super::test_any_pb::MessageTwo;
#[test]
fn test_static() {
let mut m1 = MessageOne::new();
m1.set_i(10);
let any = Any::pack(&m1).unwrap();
assert_eq!("type.googleapis.com/test_any.MessageOne",... |
use std::vec;
use crate::binary_tree::*;
use nannou::prelude::*;
use rand::random;
use rand::seq::SliceRandom;
#[derive(Clone, Copy)]
pub enum Direction {
X,
Y,
}
#[derive(Clone, Copy)]
pub struct Split {
pub direction: Direction,
pub ratio: f32,
}
impl Split {
#[allow(unused)]
fn random() -... |
use std::default::Default;
use std::fmt;
#[derive(Eq, Default)]
pub struct Nucleotides {
pub a: usize,
pub c: usize,
pub g: usize,
pub t: usize,
}
impl PartialEq for Nucleotides {
fn eq(&self, other: &Nucleotides) -> bool {
self.a == other.a &&
self.t == other.t &&
... |
mod fourier;
mod pitch_smoothing;
pub use self::fourier::*;
pub use self::pitch_smoothing::*;
|
#![no_std]
#![no_main]
use core::panic::PanicInfo;
pub fn main() {
loop {}
}
#[panic_handler]
fn panic(_info: &PanicInfo<'_>) -> ! {
loop {}
}
|
/*
* ORY Keto
*
* Ory Keto is a cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
*
* The version of the OpenAPI document: v0.7.0-alpha.1
* Contact: hi@ory.sh
* Generated by: https://openapi-generator.tech
*/
use reqwe... |
use std::collections::hash_map::Entry;
use std::ffi::{c_void, CString};
use std::mem::forget;
use std::os::raw::{c_char, c_int};
use std::slice::from_raw_parts;
use num_integer::gcd;
use pyo3::{
exceptions::PyTypeError, once_cell::GILOnceCell, types::PyCapsule, Py, PyResult, PyTryInto,
Python,
};
use rustc_has... |
extern crate base64;
extern crate clap;
extern crate dirs;
use chrono::SubsecRound;
use clap::{App, Arg};
use hashtags::core::HashTags;
use serde_json;
use std::string::String;
const SEP_SIMPLE: &str =
"--------------------------------------------------------------------------------";
const SEP_EQUAL: &str =
"... |
#![feature(lang_items)]
#![feature(asm)]
#![feature(const_fn)]
#![no_std]
extern crate rlibc;
extern crate abi;
extern crate spin;
#[macro_export]
macro_rules! system_print {
( $($arg:tt)* ) => ({
use core::fmt::Write;
let _ = write!(&mut $crate::PrintWriter::new(), $($arg)*);
})
}
pub mod un... |
#[doc = "Register `TIMEOUT` reader"]
pub struct R(crate::R<TIMEOUT_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<TIMEOUT_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<TIMEOUT_SPEC>> for R {
#[inline(always)]
fn from(reader: crat... |
use super::*;
use core::fmt::*;
impl<'pool, M: Manager> Debug for Handle<'pool, M>
where M::Item: Debug
{
fn fmt(&self, f: &mut Formatter) -> Result {
Debug::fmt(&*self.item, f)
}
}
impl<'pool, M: Manager> Display for Handle<'pool, M>
where M::Item: Display
{
fn fmt(&self, f: &mut Formatter) -> Re... |
use libnghttp2_sys::nghttp2_stream_proto_state;
use std::hint::unreachable_unchecked;
/// State of stream as described in RFC 7540.
#[derive(Debug, Clone)]
pub enum StreamState {
/// idle state.
Idle,
/// open state.
Open,
/// reserved (local) state.
ReservedLocal,
/// reserved (remote) state.
Reserved... |
// https://leetcode.com/problems/move-pieces-to-obtain-a-string/
// You are given two strings start and target, both of length n. Each string consists only of the
// characters 'L', 'R', and '_' where:
// The characters 'L' and 'R' represent pieces, where a piece 'L' can move to the left only if there
// is a blank sp... |
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you m... |
//@revisions: stack tree
//@[tree]compile-flags: -Zmiri-tree-borrows
// Make sure validation can handle many overlapping shared borrows for different parts of a data structure
use std::cell::RefCell;
#[allow(unused)]
struct Test {
a: u32,
b: u32,
}
fn test1() {
let t = &mut Test { a: 0, b: 0 };
{
... |
pub mod node;
pub mod sound_context;
|
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct NfsSettingsZone {
/// Specifies the per-zone NFS configuration settings.
#[serde(rename = "settings")]
pub settings: Option <crate::models::NfsSettingsZoneSettings>,
}
|
#[derive(Debug)]
pub struct BusinessObject {
pub something: char,
pub lastlast: char,
}
impl BusinessObject {
pub fn new() -> BusinessObject {
BusinessObject {
something: 's',
lastlast: 'l',
}
}
}
|
use std::convert::TryInto;
use std::fmt::{Debug, Display, Formatter};
use anyhow::{anyhow, Result};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
fn to_fixed(bytes: Vec<u8>) -> Result<[u8; 32]> {
let output: Box<[u8; 32]> = bytes
.into_boxed_slice()
.try_into()
.map_err(... |
//use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::*;
// scanner from https://codeforces.com/contest/1396/submission/91365784
struct Scanner {
stdin: Stdin,
buffer: VecDeque<String>,
}
#[allow(dead_code)]
impl Scanner {
fn new() -> Self {
Scanner {
stdin: stdin(),... |
use secret_sharing::shamir_secret_sharing::get_shared_secret;
use secret_sharing::pedersen_vss::PedersenVSS;
use crate::signature::{Params, Sigkey, Verkey};
use amcl_wrapper::field_elem::{FieldElement, FieldElementVector};
use amcl_wrapper::group_elem_g1::G1;
use std::collections::HashMap;
use secret_sharing::pedersen... |
#[doc = "Register `RX` reader"]
pub struct R(crate::R<RX_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<RX_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<RX_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<RX_SPEC>) -> Se... |
use super::*;
use rand::SeedableRng;
use starcoin_crypto::{ed25519, Uniform};
use starcoin_types::genesis_config::ChainId;
use starcoin_types::{
account_address::AccountAddress,
transaction,
transaction::helpers::get_current_timestamp,
transaction::{Script, TransactionPayload},
};
use tx_pool::Listener... |
use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
let mut input = String::new();
stdin.read_line(&mut input);
let count : usize = input.trim().parse().unwrap();
let mut sum_a = 0i64;
let mut sum_b = 0i64;
for i in 0..count{
let mut input = String::new();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.