text stringlengths 8 4.13M |
|---|
extern crate clap;
extern crate daemonize;
extern crate log;
//default plugins;
extern crate gary_docker;
mod cli;
mod cluster_api;
mod cluster_management;
mod deployment_management;
mod runtime_plugin_manager;
fn main() {
cli::cli();
}
|
#!/usr/bin/env rust-script
//! ```cargo
//! [package]
//! name = "trianglearea"
//! authors = ["Evan Boehs"]
//! version = "0.1.0"
//! license = "Commons Clause Apache-2.0"
//! edition = "2018"
//!
//! [dependencies]
//!
//! ```
// Copyright 2021, Evan Boehs
#![forbid(unsafe_code)]
use std::io::stdin;
struct Triangle... |
use super::*;
use std::convert::TryInto;
use liblumen_alloc::erts::term::prelude::SmallInteger;
#[test]
fn with_small_integer_returns_small_integer() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::integer::small::isize(),
)
... |
use chrono;
// https://github.com/diesel-rs/diesel/issues/1785
#[allow(proc_macro_derive_resolution_fallback)]
use super::schema::{
wcf1_user,
wcf1_user_group,
wcf1_user_to_group,
wcf1_user_activity_event,
organizations,
users,
user_file_entries,
user_file_entry_types
};
#[derive(Ident... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../gir-files
// DO NOT EDIT
use crate::Auth;
use crate::Message;
use crate::SessionFeature;
use crate::URI;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
... |
#[doc = r" Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 264usize],
#[doc = "0x108 - TXD byte sent and RXD byte received."]
pub events_ready: EVENTS_READY,
_reserved1: [u8; 504usize],
#[doc = "0x304 - Interrupt enable set register."]
pub intenset: INTENSET,
#[doc = ... |
extern crate encoding;
#[macro_use]
mod logging;
mod mem_map;
pub mod game_pad;
pub mod instruction;
pub mod interconnect;
pub mod rom;
pub mod sinks;
pub mod sram;
pub mod time_source;
pub mod timer;
pub mod v810;
pub mod vip;
pub mod virtual_boy;
pub mod vsu;
pub mod wram;
pub use rom::*;
pub use sram::*;
pub use ... |
//! Timers
use crate::ccu::{Ccu, Clocks};
use crate::hal::timer::{Cancel, CountDown, Periodic};
use crate::pac::ccu::{BusClockGating0, BusSoftReset0};
use crate::pac::hstimer::{self, HSTIMER};
use crate::pac::timer::{
Control, IrqEnable, IrqStatus, RegisterBlock as TimerRegisterBlock, TIMER,
};
use core::convert::... |
// 这个example暂时跑不了,过会儿修
// // Example taken from https://serde.rs/json.html
// use serde::Serialize;
// use coruscant_nbt::to_string_transcript;
// #[derive(Serialize)]
// struct Wrap {
// inner: E,
// }
// #[derive(Serialize)]
// enum E {
// W { a: i32, b: i32 },
// X(i32, i32),
// Y(i32),
// Z,
... |
use darling::ast::Data;
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{Error, LitInt};
use crate::{
args::{self, RenameTarget},
utils::{get_crate_name, get_rustdoc, visible_fn, GeneratorResult},
};
pub fn generate(object_args: &args::MergedObject) -> GeneratorResult<TokenStrea... |
fn main() {
println!("Hellowo world!");
} |
mod parser;
use winnow::prelude::*;
use parser::expr;
#[allow(clippy::eq_op, clippy::erasing_op)]
fn arithmetic(c: &mut criterion::Criterion) {
let data = " 2*2 / ( 5 - 1) + 3 / 4 * (2 - 7 + 567 *12 /2) + 3*(1+2*( 45 /2));";
assert_eq!(
expr.parse_peek(data),
Ok((";", 2 * 2 / (5 - 1) + 3 * ... |
/*!
This crate provides an "expert" API for executing regular expressions using
finite automata.
**WARNING**: This `0.2` release of `regex-automata` was published
before it was ready to unblock work elsewhere that needed some
of the new APIs in this release. At the time of writing, it is
strongly preferred that you co... |
#![feature(proc_macro)]
#![feature(proc_macro_path_invoc)]
#[macro_use]
extern crate pyo3;
use pyo3::prelude::*;
#[py::modinit(_pyo3typeerror)]
fn init(py: Python, m: &PyModule) -> PyResult<()> {
#[pyfn(m, "loads")]
fn loads(py: Python, s: &str) -> PyResult<PyObject> {
Ok(s.to_object(py))
}
O... |
use crate::context::RpcContext;
use anyhow::Context;
use pathfinder_common::BlockId;
#[derive(serde::Deserialize, Debug, PartialEq, Eq)]
pub struct GetBlockTransactionCountInput {
block_id: BlockId,
}
type BlockTransactionCount = u64;
crate::error::generate_rpc_error_subset!(GetBlockTransactionCountError: BlockN... |
#[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::LCRH {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w... |
extern crate iron;
extern crate multipart;
use iron::prelude::*;
use multipart::server::Entries;
use multipart::server::iron::Intercept;
fn main() {
// We start with a basic request handler chain.
let mut chain = Chain::new(|req: &mut Request|
if let Some(entries) = req.extensions.get::<En... |
pub mod home;
pub mod sms_app;
pub mod sms_setting;
pub mod sms_try;
pub mod email_app;
pub mod email_setting;
pub mod email_try; |
use core::ops::{ControlFlow, Try};
use redoxfs::{BLOCK_SIZE, Disk};
use syscall::{EIO, Error, Result};
use std::proto::Protocol;
use uefi::guid::{Guid, BLOCK_IO_GUID};
use uefi::block_io::BlockIo as UefiBlockIo;
pub struct DiskEfi(pub &'static mut UefiBlockIo);
impl Protocol<UefiBlockIo> for DiskEfi {
fn guid() -... |
use std::io::BufRead;
use std::io::{self};
use std::str::FromStr;
use Direction::*;
use NavAction::*;
#[derive(Debug, PartialEq)]
struct Ship {
east_pos: i32,
north_pos: i32,
dir_faced: Direction,
waypoint: (i32, i32),
}
#[derive(Debug, PartialEq, Clone, Copy)]
enum Direction {
East,
South,
... |
{{#if use_old~}}
store.get_old_{{name}}({{>choice.arg_ids}}diff)
{{~else~}}
store.get_{{name}}({{>choice.arg_ids}})
{{~/if~}}
|
use std::fmt;
#[derive(Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ChessPiece {
NoPiece = 0x00,
WhitePawn = 0x01,
WhiteKnight = 0x02,
WhiteBishop = 0x03,
WhiteRook = 0x04,
WhiteQueen = 0x05,
WhiteKing = 0x06,
BlackPawn = 0x09,
BlackKnight = 0x0A,
BlackBishop = 0x0B,
BlackRook... |
use std::convert::From;
// TODO: consider adding keyword associations like: prefer, exclude
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub struct Keyword {
pub id: String,
}
impl From<&'static str> for Keyword {
fn from(original: &'static str) -> Keyword {
Keyword {
... |
use na::{DMatrix, Real};
use nt::{DiscreteSystemMatrix, ContinuousSystemMatrix, DiscreteInputMatrix, ContinuousInputMatrix};
pub struct DiscreteSystemEqMatrices<N : Real> {
pub mat_f : DiscreteSystemMatrix<N>,
pub mat_h : DiscreteInputMatrix<N>,
}
/// ```math
/// F = F(dt) = exp(A*dt) = SUM_i=0...infinite (... |
use futures::channel::mpsc as channel;
use futures::stream::{FusedStream, Stream};
use std::collections::HashMap;
use std::fmt;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use libp2p::core::{
connection::{ConnectedPoint, ConnectionId, ListenerId},
Multiaddr, PeerId,
};
use libp2p::f... |
use dump_parser::Error as DumpParsingError;
use std::{fmt::Display, io::Error as IoError, path::PathBuf};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug)]
pub enum Error {
IoError {
action: &'static str,
path: PathBuf,
cause: IoError,
},
InvalidNameToCodeFormat ... |
#![allow(dead_code)]
extern crate rand;
extern crate mpc_framework;
use mpc_framework::*;
use rand::distributions::{IndependentSample, Range};
use rand::ThreadRng;
use std::path::Path;
use std::env;
use std::fs::File;
use std::io::{BufReader, BufRead, Write};
fn main() {
let args = env::args().collect::<Vec<_>>();... |
fn get_input() -> Vec<u64> {
let vec: Vec<u64> = include_str!("../input.txt")
.split("\r\n")
.map(|s| {
// dbg!(s);
s.parse().unwrap()
})
.collect();
assert_eq!(vec.len(), 200);
vec
}
fn part_one() {
let mut vec = get_input();
vec.sort_unst... |
// 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 agre... |
use canvas::Canvas;
use rand;
use rand::distributions::{IndependentSample, Range as Uniform};
use nalgebra::{Vector2, Point2};
use num::{Float, cast};
use std::ops::Range;
use std::rc::Rc;
use std::convert::{From, Into};
pub struct Parametric<F: Fn(N) -> Point2> {
f: F
range: Uniform<N>,
sa... |
use serde::{Deserialize, Serialize};
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StartResponse {
color: String,
head_type: String,
tail_type: String,
}
impl StartResponse {
pub fn new(color: String, head_type: String, tail_type: String) -> StartResponse {
StartResponse {
color... |
use bevy::math::*;
use bevy::prelude::*;
use meshie::Meshie;
use rand::Rng;
use crate::equations_of_motion::{Destination, EquationsOfMotion, Momentum};
pub struct Sectors;
impl Plugin for Sectors {
fn build(&self, app: &mut AppBuilder) {
app.add_startup_system(sector_init.system())
.add_startup... |
//! Logging for _trace_ logs
use tracing_subscriber::{
fmt::format::{Format, JsonFields},
prelude::*,
EnvFilter, Registry,
};
use crate::{SystemError, SystemResult};
mod middleware;
pub use middleware::{
LoggerMiddleware,
LoggerLayer,
};
pub struct Logger {
is_prod: bool,
level: String,
path: String... |
#[derive(Debug, Clone, Copy)]
pub struct Flags {
pub z: bool, // zero
pub n: bool, // subtract
pub h: bool, // half carry
pub c: bool, // carry
}
impl Flags {
pub fn clear() -> Self {
Flags {
z: false,
n: false,
h: false,
c: false,
}
... |
use super::{hashes, types, converters};
use super::types::curve::big::BIG;
use amcl::rand::RAND;
use rand::Rng;
use std::cmp::Ordering;
use sha3::Shake256;
use sha3::digest::{Input, ExtendableOutput ,XofReader};
pub fn rand_big(rng: &mut RAND) -> BIG {
BIG::random(rng)
}
pub fn new_seeded_rand(seed: &[u8]) ->... |
use super::Cartridge;
use crate::ines::File;
use crate::ines::Mirroring;
use std::mem;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct NROM {
#[serde(skip)]
pub file: File,
sram: Vec<u8>,
chr_ram: Vec<u8>,
}
impl NROM {
pub fn new(file: File) -> NROM {
NR... |
use crate::*;
use winapi::um::winuser::WM_LBUTTONUP;
use std::cell::RefCell;
struct MessageBoxOnDrop {}
impl Drop for MessageBoxOnDrop {
fn drop(&mut self) {
simple_message("Dropped", "A MessageBoxOnDrop object was dropped");
}
}
#[derive(Default)]
struct FreeingData {
raw_handler_bound: bool,
... |
extern crate capnp;
#[macro_use]
extern crate capnp_rpc;
extern crate native_tls;
extern crate tokio;
extern crate tokio_tls;
extern crate helloworld;
use std::env;
use std::fs::read;
use std::io::BufWriter;
use std::net::SocketAddr;
use capnp::capability::Promise;
use capnp::Error;
use capnp::message::HeapAllocator;... |
//! Crate specific errors.
//
use crate::{ import::*, CloseEvent };
/// The error type for errors happening in `ws_stream_wasm`.
///
/// Use [`Error::kind()`] to know which kind of error happened.
//
#[ derive( Debug, Clone, PartialEq, Eq ) ]
//
pub struct Error
{
pub(crate) kind: ErrorKind
}
/// The different ki... |
use ggez;
use ggez::graphics;
use ggez_goodies::scene;
use log::*;
use legion::prelude as legion_p;
use warmy;
use crate::components as c;
use crate::input;
use crate::resources;
use crate::scenes;
use crate::world::World;
use legion::prelude::IntoQuery;
pub struct LevelScene {
done: bool,
kiwi: warmy::Res<re... |
use flexi_logger::Logger;
use hdbconnect::{Connection, HdbError, HdbResult};
use log::{debug, error, info};
use serde::Deserialize;
use serde_bytes::ByteBuf;
pub fn connect_string_from_file(s: &'static str) -> HdbResult<String> {
std::fs::read_to_string(s).map_err(|e| HdbError::ConnParams {
source: Box::ne... |
use juniper::graphql_scalar;
#[graphql_scalar(transparent)]
struct ScalarSpecifiedByUrl;
fn main() {}
|
///! `StandardAlloc` is a general purpose allocator that divides allocations into two major
///! categories: multi-block carriers up to a certain threshold, after which allocations use
///! single-block carriers.
///!
///! Allocations that use multi-block carriers are filled by searching in a balanced
///! binary tree ... |
//! This module contains the `EvalContext` methods for executing a single step of the interpreter.
//!
//! The main entry point is the `step` method.
use rustc::mir;
use rustc::mir::interpret::EvalResult;
use super::{EvalContext, Machine};
impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {... |
// Cates
extern crate chrono;
extern crate time;
// Crate imports
use chrono::{NaiveDate};
const YEAR_OFFSET: i32 = 1900;
pub mod ddate;
/// Enum containing all supported calendars
#[allow(dead_code)]
#[derive(Debug)]
enum Calendar {
Discordian,
}
/// Enum containing all the supported time input formats
#[der... |
#![feature(no_coverage)]
pub mod arg;
#[derive(Clone, Copy, Default)]
pub struct FuzzerStats {
pub total_number_of_runs: usize,
pub number_of_runs_since_last_reset_time: usize,
pub exec_per_s: usize,
}
#[derive(Clone, Copy)]
pub enum FuzzerEvent {
Start,
Stop,
End,
CrashNoInput,
Pulse... |
pub use VkIOSSurfaceCreateFlagsMVK::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkIOSSurfaceCreateFlagsMVK {
VK_IOS_SURFACE_CREATE_NULL_BIT = 0,
}
use crate::SetupVkFlags;
#[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub struct VkIOSSurfaceCreateFlagBitsMVK(u32);
SetupVkFlags!... |
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... |
fn main() {
yew::start_app::<todomvc_std_web::Model>();
}
|
fn naive(n: i64, k: i64) -> i64 {
let mut res = 0;
for a in 1..=n {
for b in 1..=n {
for c in 1..=n {
for d in 1..=n {
if a + b - (c + d) == k {
res += 1;
}
}
}
}
}
res... |
// Copyright 2012-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-MI... |
use super::FormatBranch;
use crate::infrastructure::git::git_branch::GitBranch;
use crate::infrastructure::git::GitRepository;
pub fn analysis(url: &str, local_git: bool) -> Vec<FormatBranch> {
let repo = GitRepository::open(url, local_git);
let mut branches = vec![];
for br in GitBranch::list(repo) {
... |
use bigneon_db::dev::TestProject;
use bigneon_db::models::{
FeeSchedule, NewFeeScheduleRange, Organization, OrganizationEditableAttributes,
OrganizationUser, Roles, User,
};
use uuid::Uuid;
#[test]
fn create() {
let project = TestProject::new();
let connection = project.get_connection();
let user =... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub const DWRITE_ALPHA_MAX: u32 = 255u32;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: c... |
/// This allows dumping a CSV of all the evaluations that were performed during a run, as well as a
/// graphviz (.dot) graph recapitulating the run.
///
/// NOTE: This applies to the old log format, which is was less precise and does not contain
/// precise run details, such as actions not taken, or timings. This fil... |
//
// Sysinfo
//
// Copyright (c) 2017 Guillaume Gomez
//
use ::DiskExt;
use ::utils;
use super::system::get_all_data;
use libc::statvfs;
use std::mem;
use std::fmt::{Debug, Error, Formatter};
use std::path::{Path, PathBuf};
use std::ffi::{OsStr, OsString};
use std::os::unix::ffi::OsStrExt;
/// Enum containing the... |
use sprack::PackOptions;
use std::path::Path;
pub struct RunOptions<'a> {
pub pack_options: PackOptions<'a>,
pub input_paths: Vec<&'a Path>,
pub output_path: &'a Path,
pub keep_work_dir: bool,
pub demo_run: bool,
pub recursive: bool,
}
impl<'a> Default for RunOptions<'a> {
fn default() -> RunOptions<'... |
//! A collection of common types used by the Oasis Contract SDK.
pub mod address;
pub mod env;
pub mod event;
pub mod message;
pub mod modules;
pub mod storage;
pub mod token;
pub mod testing;
/// Unique stored code identifier.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, cbor::Decode, cbor::Encode)]
#[cbor(... |
pub(crate) use _sre::make_module;
#[pymodule]
mod _sre {
use crate::{
atomic_func,
builtins::{
PyCallableIterator, PyDictRef, PyGenericAlias, PyInt, PyList, PyStr, PyStrRef, PyTuple,
PyTupleRef, PyTypeRef,
},
common::{ascii, hash::PyHash},
convert::To... |
#[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::IF1MSK2 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, ... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct FinishExamDto {
pub pattern: String,
pub data: FinishExamData,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct FinishExamData {
pub id_student: i32,
pub id_student_exam: i32,
}
|
use candy_vm::{
fiber::{Fiber, FiberId},
lir::Lir,
tracer::Tracer,
vm::Vm,
};
use extension_trait::extension_trait;
use rustc_hash::FxHashMap;
use std::{borrow::Borrow, hash::Hash, num::NonZeroUsize};
#[extension_trait]
pub impl FiberIdExtension for FiberId {
fn get<L: Borrow<Lir>, T: Tracer>(self,... |
use std::fs;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;
use guarding_core::domain::code_file::CodeFile;
use crate::identify::c_sharp_ident::CSharpIdent;
use crate::identify::code_ident::CodeIdent;
use crate::identify::java_ident::JavaIdent;
use crate::identify::js_ident::JsIdent;
use crate::identify::rust_... |
#![allow(clippy::derive_partial_eq_without_eq)]
use crate::{
prefix_type::{PrefixRef, WithMetadata},
StableAbi,
};
mod cond_fields {
use super::*;
/// This type is used in prefix type examples.
#[repr(C)]
#[derive(StableAbi)]
#[sabi(kind(Prefix(prefix_ref = Module_Ref, prefix_fields = Mod... |
#[macro_use]
mod common;
macro_rules! get_hash(
($str:expr) => (
$str.split(' ').collect::<Vec<&str>>()[0]
);
);
macro_rules! test_digest {
($($t:ident)*) => ($(
mod $t {
use common::util::*;
static UTIL_NAME: &'static str = "hashsum";
static DIGEST_ARG: &'static str =... |
#![ allow (unused_parens) ]
#[ macro_use ]
extern crate clap;
#[ macro_use ]
extern crate output;
extern crate btrfs;
extern crate flate2;
extern crate rustc_serialize;
extern crate serde_json;
extern crate sha2;
extern crate time;
#[ doc (hidden) ]
#[ macro_use ]
mod misc;
mod commands;
mod arguments;
mod databas... |
//! A write buffer.
use arrow::record_batch::RecordBatch;
use data_types::{StatValues, TimestampMinMax};
use mutable_batch::{column::ColumnData, MutableBatch};
use schema::{Projection, TIME_COLUMN_NAME};
use super::{snapshot::Snapshot, BufferState, Transition};
use crate::{
buffer_tree::partition::buffer::{
... |
use chrono::NaiveDate;
use super::task_data::TaskData;
#[derive(Debug)]
pub struct TaskPerformanceData {
pub task: TaskData,
pub timestamps: Vec<NaiveDate>,
}
|
mod languages;
pub mod rand;
pub use languages::Language;
|
//! The main scheduler logic.
//!
//! The scheduler is implemented as a singleton in order to make it easy for code anywhere in the
//! project to make use of async functionality. The actual scheduler instance is not publicly
//! accessible, instead we use various standalone functions like `start()` and `wait_for()` to... |
#[derive(Clone,Debug)]
pub struct Neuron {
bias: f32,
pub weights: Vec<f32>,
pub activation: f32,
}
#[derive(Clone)]
pub struct FullNet {
pub layers: Vec<Vec<Neuron>>, //fix vec![Vec<Neuron>;4] not sure how to get this to work, would be nice to but not necareccy.
}
/*
/¯¯¯m
i----m
\___m... |
/*-------------------------------
game_text.rs
ゲーム内で表示するテキストを一挙に取ってくる
Tomlから取得する予定
* struct Source: tomlファイルから読み込んだ内容がここに
* impl GameText:
* new()
* new_score() : スコア表示のためTextを再生成
* from_array()
-------------------------------*/
use std::io::Result;
use ggez::graphics::{ Font,... |
//! Contains implementation of default logger.
use enso_prelude::*;
use crate::AnyLogger;
use crate::Message;
use enso_shapely::CloneRef;
use std::fmt::Debug;
#[cfg(target_arch = "wasm32")]
use web_sys::console;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::JsValue;
// ==============
// === Logger ===
// ====... |
use std::fs::File;
use std::io::{Read, Result};
fn main() {
println!("{:}", time_remaining());
}
fn retrieve(path: &str) -> Result<String> {
let mut f = try!(File::open("/sys/class/power_supply/BAT0/".to_string() + path));
let mut buffer = String::new();
f.read_to_string(&mut buffer).unwrap();
Ok(... |
extern crate iron;
extern crate urlencoded;
use iron::prelude::*;
use iron::status;
use std::error::Error;
use std::fs::File;
use std::path::Path;
use std::io::prelude::*;
use std::collections::HashMap;
use urlencoded::UrlEncodedQuery;
// fn print_query(hashmap: &&HashMap<String,Vec<String>>){
//
// println!(... |
// Copyright (c) 2018 Chef Software Inc. and/or applicable 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 r... |
/// 各種特殊ノートを含む譜面かどうか
#[derive(Clone, Debug)]
pub struct IncludeFeatures {
undefined_ln: UndefinedLn,
mine_note: MineNote,
random: Random,
long_note: LongNote,
charge_note: ChargeNote,
hell_charge_note: HellChargeNote,
stop_sequence: StopSequence,
}
impl From<i32> for IncludeFeatures {
f... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qgesture.h
// dst-file: /src/widgets/qgesture.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin =>... |
use procon_reader::ProconReader;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: usize = rd.get();
let mut a: Vec<u32> = rd.get_vec(n);
let mut b: Vec<u32> = rd.get_vec(n);
let mut c: Vec<u32> = rd.get_vec(n);
a.sort();
b.sort();
c.so... |
//! This module describes all text information showing in the game.
use hero;
pub const STR_HERO_RACE: &str = "Race: ";
pub const STR_HERO_CLASS: &str = "Class: ";
pub const STR_HERO_LEVEL: &str = "Level: ";
pub const STR_HERO_EXP: &str = "Experience: ";
pub const STR_HERO_HP: &str = "Health/Max Health: ";
pub const ... |
//Include `rustful_macros` during the plugin phase
//to be able to use `router!` and `try_send!`.
#![feature(phase)]
#[phase(plugin)]
extern crate rustful_macros;
extern crate rustful;
use rustful::{Server, Request, Response};
use rustful::Method::Get;
fn say_hello(request: Request, response: Response) {
//Get th... |
#[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::ERR {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w ... |
use floor_sqrt::floor_sqrt;
use procon_reader::ProconReader;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: usize = rd.get();
let m: usize = rd.get();
let mut g = vec![vec![]; n];
for _ in 0..m {
let a: usize = rd.get();
let b: us... |
use super::cli;
use super::exit;
use super::logging;
/// Canvasctl main function flow:
/// 1. Parse command line arguments
/// 2. Initialize logger
/// 3. Dispatch command to corresponding function
/// 4. Return
pub fn main() {
let parsed_args =
cli::CanvasCtlArgs::parse_args().unwrap_or_else(|e| exit::cle... |
use std::error::Error;
use std::fmt::{self, Formatter};
use reqwest::Response;
use crate::data;
#[derive(Debug)]
pub enum ValidationError {
Status { expected: u16, got: u16 },
}
impl Error for ValidationError {
fn description(&self) -> &str {
match *self {
ValidationError::Status {
... |
use juniper::{graphql_object, GraphQLInterface};
pub struct ObjA {
id: String,
}
#[graphql_object(impl = CharacterValue)]
impl ObjA {
fn id(&self, is_present: bool) -> &str {
is_present.then_some(&*self.id).unwrap_or("missing")
}
}
#[derive(GraphQLInterface)]
#[graphql(for = ObjA)]
struct Charact... |
pub mod basic;
pub mod wifi;
use serial::SystemPort;
use std::io::prelude::*;
pub struct ATClient {
handle: SystemPort,
}
impl ATClient {
pub fn new(handle: SystemPort) -> Self {
ATClient { handle }
}
pub fn send(&mut self, command: &str) -> String {
// write
let command = co... |
use {
StrSpan,
};
/// An XML token.
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Token<'a> {
/// Declaration token.
///
/// Version, encoding and standalone.
///
/// Example: `<?xml version="1.0"?>`
Declaration(StrSpan<'a>, Option<StrSpan<'a>>, Option<StrSpan<'a>>),
/// Processing... |
use std::process::Command;
#[test]
fn run_lisp_tests() {
let status = Command::new("cargo")
.args(&["test"])
.current_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/lisp"))
.spawn()
.expect("should spawn tests OK")
.wait()
.expect("should wait OK");
assert!(status.suc... |
use mrusty::{
self,
Mruby,
MrubyType,
MrubyImpl,
MrubyError,
MrubyFile
};
use rmp;
use rmp_rpc;
use rmp_serde;
use protocol::{
TickRequest,
TickResult,
WorldState,
Entity,
};
pub struct Runner {
mrb: MrubyType,
}
fn num_to_float(v: mrusty::Value) -> Result<f64, MrubyError... |
pub struct Block(Vec<Statement>);
impl Block {
pub fn new() -> Block {
Block(Vec::new())
}
pub fn assign(&mut self, name: String, expr: Expr) {
self.0.push(Statement::Assign { variant: AssignVariant::None,
name: name, expr: expr, });
}
pub ... |
fn read_values(program_state: &Vec<i32>, op_pos: usize) -> (i32, i32, usize) {
(
program_state[program_state[op_pos + 1] as usize],
program_state[program_state[op_pos + 2] as usize],
program_state[op_pos + 3] as usize
)
}
fn run_program(mut program_state: Vec<i32>) -> i32 {
let m... |
#[macro_use]
extern crate clap;
#[macro_use]
extern crate serde_derive;
use std::fs::File;
use std::fs::OpenOptions;
use std::io::stdin;
use std::io::stdout;
use std::io::{Read, Write};
use std::path::Path;
use std::process::exit;
use clap::App;
mod datamodel_parser;
mod json_formatter;
mod dot_formatter;
fn main()... |
#[derive(PartialEq, Debug)]
pub enum Statement {
// Let binding
SLet(String, Expr),
// Probably side-effectual expression <expr>;
SExpr(Expr),
// TODO: Assignment?
}
#[derive(PartialEq, Debug)]
pub enum Expr {
Id(String),
Op(Box<Expr>, &'static str, Box<Expr>),
// if <cond> then <e1> el... |
use colored::*;
use std::io::{stdout, Write};
pub struct Print;
impl Print {
/// Toggles coloring based on environment.
/// For instance, colors do not work for `cmd`on Windows.
pub fn check_support_for_colors() {
let term = term::stdout().unwrap();
if !term.supports_color() {
... |
//!
//! WAL receiver connects to the WAL safekeeper service, streams WAL,
//! decodes records and saves them in the repository for the correct
//! timeline.
//!
//! We keep one WAL receiver active per timeline.
use crate::relish::*;
use crate::restore_local_repo;
use crate::tenant_mgr;
use crate::waldecoder::*;
use cr... |
//! # Multihash
//!
//! Implementation of [multihash](https://github.com/multiformats/multihash) in Rust.
//!
//! A `Multihash` is a structure that contains a hashing algorithm, plus some hashed data.
//! A `MultihashRef` is the same as a `Multihash`, except that it doesn't own its data.
#![deny(missing_docs)]
mod di... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use crate::actions::{Action, ActionAnswer, ActionContext};
use crate::collections::BaseRegistry;
use crate::exts::LockIt;
use anyhow::Result;
use async_trait::async_trait;
use lazy_static::lazy_static;
use log::error;
pub type QueryD... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
use super::{Cursor, Disk, Tower};
const TOWER: &str = "|";
const TOWER_BASE: &str = "_";
const DISK: &str = "█";
const CURSOR: &str = "▼";
pub trait Drawable {
fn as_lines(&self) -> Vec<String>;
fn draw(&self) {
println!("{}", self.as_lines().join("\n"));
}
}
impl Drawable for Cursor {
fn as_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.