text stringlengths 8 4.13M |
|---|
use super::{Expression, JsonValue, name::NameExpression, visitor::ExpressionVisitor};
#[derive(Debug)]
pub struct PropertyAssignmentExpression {
pub name: Box<dyn Expression>,
pub value: Box<dyn Expression>,
}
impl PropertyAssignmentExpression {
pub fn new(name: Box<dyn Expression>, value: Box<dyn Express... |
#[derive(Copy, Clone, Debug)]
pub struct Point {
pub x: f64,
pub y: f64
}
impl Point {
pub fn new() -> Self {
Point { x: 0.0, y: 0.0 }
}
}
|
// https://rustcc.gitbooks.io/rustprimer/content/std/process.html
use std::{env::args, process::Command};
fn main() {
let mut args = args();
args.next().unwrap();
let pattern = args.next().unwrap_or("main".to_string());
let path = args.next().unwrap_or("./".to_string());
let output = Command::new("... |
/* NOTE:
* push_str -> Add string
* push -> Add character
*/
fn translate_string(curr_str: &mut String) -> String
{
// Create blank string
let mut new_str = String::new();
// Iterate string
for letter in curr_str.chars()
{
// Use match operator to check how to modify string
match l... |
use crate::message::Message;
use byteorder::{LittleEndian, ReadBytesExt};
use cirrus_peer::{
errors::{message::ErrorKind::IoError, Result, ResultExt},
MessagePacket,
};
use std::io;
#[derive(Clone, Debug)]
pub struct PingMessage {
pub nonce: u64,
}
impl Message for PingMessage {
fn command() -> &'stat... |
use anyhow::{anyhow, Result};
use mockall::*;
use proger_backend::{Server, StorageCmd, StorageDriver};
use proger_core::protocol::model::StepPageModel;
use proger_core::{protocol::request::CreateStepPage, API_URL_V1_CREATE_STEP_PAGE};
use reqwest::blocking::Client;
use std::thread;
use std::time::Duration;
use tokio::r... |
extern crate easy_toml_config;
use self::easy_toml_config::*;
use std::path::{PathBuf};
use std::fs::File;
use std::env::home_dir;
use log::LevelFilter;
static CONFIG_FILE: &'static str = "default.toml";
lazy_static! {
pub static ref CONFIG: Config = {
set_config_dir(String::from(".config/BEST-Bot"));
... |
use std::{
io,
mem::MaybeUninit,
os::{
fd::{AsRawFd, RawFd},
unix::net::UnixStream,
},
sync::OnceLock,
};
use crate::{cutils::cerr, log::dev_error};
use super::{
handler::{SignalHandler, SignalHandlerBehavior},
info::SignalInfo,
signal_name, SignalNumber,
};
static STR... |
//! Module containing errors for database account problems
use thiserror::Error;
#[derive(Debug, Error, PartialEq)]
/// Errors relating to user lookup.
pub enum AccountError {
#[error("The username does not exist.")]
UserDoesNotExist,
#[error("This email address is already in use.")]
DuplicateAccount,... |
//! Contains utilites for working with virtual (TAP) network interfaces.
use priv_prelude::*;
use sys;
use iface::build::{IfaceBuilder, build};
/// This object can be used to set the configuration options for a `EtherIface` before creating the
/// `EtherIface`
/// using `build`.
#[derive(Debug)]
pub struct EtherIface... |
use std::{env, io};
use actix_files as fs;
use actix_web::{
error, middleware, web, App, HttpResponse, HttpServer,
Result,
};
use log::{error};
use env_logger;
use tera::{compile_templates};
use serde_derive::{Deserialize};
use rust_birkana::document_from_string;
#[derive(Deserialize)]
pub struct FormData {
... |
use std::process::Command;
use std::net::{IpAddr, Ipv4Addr};
use regex::Regex;
// LINUX EXAMPLE IFCONFIG
//
// eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
// inet 172.17.0.2 netmask 255.255.0.0 broadcast 0.0.0.0gf
// inet6 fe80::42:acff:fe11:2 prefixlen 64 scopeid 0x20<link>
// ... |
fn cal_points(operations: Vec<String>) -> i32 {
let mut points: Vec<i32> = Vec::new();
for o in operations {
match o.as_ref() {
"C" => {
let _ = points.pop();
}
"D" => points.push(points[points.len() - 1] * 2),
"+" => points.push(points[po... |
#[doc = "Reader of register CLK_FLL_CONFIG4"]
pub type R = crate::R<u32, super::CLK_FLL_CONFIG4>;
#[doc = "Writer for register CLK_FLL_CONFIG4"]
pub type W = crate::W<u32, super::CLK_FLL_CONFIG4>;
#[doc = "Register CLK_FLL_CONFIG4 `reset()`'s with value 0xff"]
impl crate::ResetValue for super::CLK_FLL_CONFIG4 {
typ... |
use crate::{
dispose::Dispose,
hex::{
pointer::HexPointer,
render::renderer::HexRenderer,
shape::cubic_range::{CubicRangeShape, Range},
},
world::RhombusViewerWorld,
};
use amethyst::{
ecs::prelude::*,
prelude::*,
renderer::{debug_drawing::DebugLinesComponent, palette... |
use crate::args::FileParser;
use std::path::{Path};
use std::fs::{OpenOptions};
use std::io::{Read};
use std::fmt::Display;
use std::str::{FromStr, Lines};
use plotters::prelude::{BitMapBackend, WHITE, ChartBuilder, IntoFont, LineSeries, RED, PathElement, BLACK, PointSeries, EmptyElement};
use plotters::drawing::IntoDr... |
//! Pragmatic crates aims to solve real world VRP variations allowing users to specify their problems
//! via simple **pragmatic** json format.
#![warn(missing_docs)]
#[cfg(test)]
#[path = "../tests/helpers/mod.rs"]
#[macro_use]
mod helpers;
#[cfg(test)]
#[path = "../tests/generator/mod.rs"]
mod generator;
#[cfg(te... |
#[doc = "Register `SDMMC_CLKCR` reader"]
pub type R = crate::R<SDMMC_CLKCR_SPEC>;
#[doc = "Register `SDMMC_CLKCR` writer"]
pub type W = crate::W<SDMMC_CLKCR_SPEC>;
#[doc = "Field `CLKDIV` reader - CLKDIV"]
pub type CLKDIV_R = crate::FieldReader<u16>;
#[doc = "Field `CLKDIV` writer - CLKDIV"]
pub type CLKDIV_W<'a, REG, ... |
mod data;
use crate::data::{Definitions, BANNER, DEFS};
use anyhow::anyhow;
use anyhow::Result as AnyResult;
use clap::crate_version;
use clap::{App, Arg, ArgMatches};
use console::style;
use service_policy_kit::data::Context;
use service_policy_kit::runner::{RunOptions, SequenceRunner};
use std::process::exit;
fn mai... |
use crate::enums::{Align, CallbackTrigger, Color, Damage, Event, Font, FrameType, LabelType};
use crate::image::Image;
use crate::prelude::*;
use crate::utils::FlString;
use fltk_sys::browser::*;
use std::{
ffi::{CStr, CString},
mem,
os::raw,
};
/**
Creates a normal browser.
Example usage:
```r... |
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::models::canister_id_store::CanisterIdStore;
use clap::Clap;
use ic_types::principal::Principal;
/// Prints the identifier of a canister.
#[derive(Clap)]
pub struct CanisterIdOpts {
/// Specifies the name of the canister.
... |
extern crate mpd_rs_interface;
extern crate colored;
extern crate mpd;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate serde;
extern crate xdg;
use colored::*;
use mpd::Client;
use std::net::TcpStream;
use std::env;
use std::fs::File;
use std::io::Write;
use mpd_rs_interface::{get_tag, n... |
use gfx;
use gfx::ui;
use io::timer;
use realtime;
pub fn main() {
gfx::clear_screen(0xFF, 0xFF, 0xFF);
let timer = timer::Timer::new(lease!(TIMER0), 0, 0, timer::Prescaler::Div1, None);
let _sleep_timer = realtime::SleepTimer::new(&timer);
let ui = ui::Ui::new(gfx::top_screen, [0, 0, 0]);
let c... |
use crate::{
constants::SUBREDDIT_MEMES,
types::{Error, PoiseContext},
utils::{apis::reddit_random_post, discord::reply_embed},
};
async fn reddit_command(
ctx: PoiseContext<'_>,
subreddits: &[&str],
image: bool,
) -> Result<(), Error> {
let post = reddit_random_post(subreddits, image).await?;
reply_embed(ctx,... |
use handlegraph::{
handle::{Edge, Handle},
mutablehandlegraph::*,
pathhandlegraph::*,
};
use gfa::mmap::MmapGFA;
use handlegraph::packedgraph::PackedGraph;
use gfa::gfa::Line;
use anyhow::Result;
use rustc_hash::FxHashMap;
#[allow(unused_imports)]
use log::{debug, error, info, trace, warn};
pub fn pa... |
use crate::Hasher as HasherImpl;
use ares::hashers::Hasher;
use ares::iv::Iv;
use ares::raw_key::RawKey;
use std::io::Error;
pub struct Input {
input: String,
}
impl Input {
#[allow(dead_code)]
fn from_dialoguer() -> Result<Self, Error> {
let input = dialoguer::PasswordInput::new()
.wi... |
use std::rc::Rc;
use std::cell::RefCell;
use request::Request;
type RcRequest = Rc<RefCell<Request>>;
type NewRequest = RcRequest;
type OldRequest = RcRequest;
type QuantumStart = f64;
type CtxxStart = f64;
#[derive(Debug)]
pub enum CpuState {
Idle,
Busy(RcRequest, QuantumStart),
CtxSwitching(NewRequest,... |
use crate::src_a::a::*; // 绝对路径
pub fn c_echo() {
println!("c_echo");
a_echo();
}
|
pub fn square_of_sum(num: i32) -> i32 {
(1..num+1).sum::<i32>().pow(2)
}
pub fn sum_of_squares(num: i32) -> i32 {
(1..num+1).map(|x| x * x).sum()
}
pub fn difference(num: i32) -> i32 {
square_of_sum(num) - sum_of_squares(num)
} |
use crate::component::ComponentFlags;
use std::ops::{Deref, DerefMut};
/// Unique borrow of an entity's component
pub struct Mut<'a, T> {
pub(crate) value: &'a mut T,
pub(crate) flags: &'a mut ComponentFlags,
}
impl<'a, T> Deref for Mut<'a, T> {
type Target = T;
#[inline]
fn deref(&self) -> &T {
... |
use crate::error::*;
pub fn split_type_name(name: &str) -> ParseResult<(&str, &str)> {
let index = name.rfind('.').ok_or_else(|| ParseError::InvalidTypeName)?;
Ok((&name[0..index], &name[index + 1..]))
}
|
use super::*;
static VALID_COLORS: [u8; 75] = [
20, 21, 26, 27, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78,
79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164,
165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, ... |
use image2ascii::image2ascii;
use std::fs::File;
use std::io::{BufWriter, Write};
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
struct CmdOpt {
#[structopt(short, long)]
input: String,
#[structopt(short, long)]
output: Option<String>,
#[structopt(short, long)]
width: u32,
#[structop... |
// Chip-8 Emulator
// Written by Austin Bricker, 2019
// Uses Rust + SDL2
// TODO:
// Add screen buffer to avoid flickering; OR the X most recent screen buffers together
// Hit detection in Pong is still off. Improperly drawing sprite XY locations?
// Add sound
extern crate sdl2;
use chip8_core::cpu::*;
use rand::R... |
use once_cell::sync as once_cell;
use regex;
use std::iter;
pub fn solve_1() {
let pairs = parse_lines(include_str!("input.txt"));
let passing = pairs
.iter()
.filter(|(policy, password)| policy.check_count(password));
println!("{} passwords pass their old policies.", passing.count());
}
pub fn solve_2() {
l... |
//! Lorem ipsum generator.
//!
//! This crate generates pseudo-Latin [lorem ipsum placeholder
//! text][wiki]. The traditional lorem ipsum text start like this:
//!
//! > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
//! > eiusmod tempor incididunt ut labore et dolore magna aliqua.
//!
//! This text i... |
#[doc = "Reader of register CLK_OUTPUT_FAST"]
pub type R = crate::R<u32, super::CLK_OUTPUT_FAST>;
#[doc = "Writer for register CLK_OUTPUT_FAST"]
pub type W = crate::W<u32, super::CLK_OUTPUT_FAST>;
#[doc = "Register CLK_OUTPUT_FAST `reset()`'s with value 0"]
impl crate::ResetValue for super::CLK_OUTPUT_FAST {
type T... |
use std::env;
#[inline(never)]
pub fn foo(next_in : u32, input: &[u8]) -> u64 {
let v = 0 as u64;
let w = v | (input[next_in as usize] as u64) << 56;
w
}
fn main() {
let args: Vec<String> = env::args().skip(1).collect();
let a = args.iter().map(|x| x.parse::<u8>().unwrap()).collect::<Vec<u8>>();
... |
use core::marker::PhantomData;
use necsim_core::{
cogs::{
Backup, CoalescenceRngSample, CoalescenceSampler, DispersalSampler, EmigrationExit,
EventSampler, Habitat, MinSpeciationTrackingEventSampler, RngCore, SpeciationProbability,
SpeciationSample, TurnoverRate,
},
event::{Dispersa... |
//!Handles the boot command line multiboot2 tag.
///Represents the boot command line tag.
#[repr(C)]
struct BootCommandLine { //type = 1
tag_type: u32,
size: u32,
string: [u8]
}
|
use std::{error::Error, fmt, fs::{self, File}, str};
use fnv::FnvHashMap;
use std::path::{Path, PathBuf};
use std::io::Read;
#[derive(Debug)]
struct MimeInfoDbError(String);
impl fmt::Display for MimeInfoDbError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl... |
use anyhow::Error;
use serde::de::DeserializeOwned;
use yew::format::{Json, Nothing};
use yew::services::fetch::{FetchTask, Request, Response};
use yew::services::FetchService;
use yew::{html, Component, ComponentLink, Html, Properties, ShouldRender};
use yew_router::components::RouterAnchor;
use yew_router::router::Ro... |
extern crate serde;
extern crate bincode;
extern crate gtk;
pub mod manager;
pub mod ui;
|
#![doc = "generated by AutoRust 0.1.0"]
#[cfg(feature = "package-2020-03-30")]
mod package_2020_03_30;
#[cfg(feature = "package-2020-03-30")]
pub use package_2020_03_30::{models, operations, API_VERSION};
#[cfg(feature = "package-2020-03")]
mod package_2020_03;
#[cfg(feature = "package-2020-03")]
pub use package_2020_0... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Voltage regulator control and status"]
pub vreg: VREG,
#[doc = "0x04 - brown-out detection control"]
pub bod: BOD,
#[doc = "0x08 - Chip reset control and status"]
pub chip_reset: CHIP_RESET,
}
#[doc = "Voltage regul... |
extern crate hyper;
extern crate slack_api;
use self::hyper::Client;
use self::slack_api::search;
pub fn all_messages<F>(token: &str, username: &str, mut handler: F)
where F: FnMut(&str) {
let client = Client::new();
let query = format!("from:@{}", username);
let mut page = 0;
loop {
let ... |
use super::{path_to_str, OpenBackend};
use crate::error;
use crate::EditorOpts;
use std::env;
use std::path::PathBuf;
use std::process::Command;
pub struct Tmux;
impl OpenBackend for Tmux {
fn run(&mut self, mut path: PathBuf, name: &str, opts: EditorOpts) -> error::Result<()> {
let self_path = env::curre... |
// This file is part of Substrate.
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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://... |
extern crate time;
extern crate rayon;
use std::io;
use std::env;
const OUTPUT_TIMES : bool = false;
fn factorsums(sums: &mut [u64], start: u64) {
// Either split in two or calculate current part of array
if sums.len() > 50 {
let split = sums.len()/2;
let (left, right) = sums.split_at_mut(split);
let split =... |
use chrono::{Datelike, Duration, Utc, Weekday, NaiveDate};
use serenity::builder::CreateEmbed;
use serenity::framework::standard::CommandResult;
use serenity::model::prelude::{ChannelId, Message, MessageId, ReactionType, UserId};
use serenity::prelude::Context;
use std::ops::Add;
use crate::reactions;
use crate::types... |
fn main() {
let a = [-1, 0, 1];
let mut iter = a.iter().take_while(|x| **x < 0); // need two *s!
assert_eq!(iter.next(), Some(&-1));
assert_eq!(iter.next(), None);
let mut iter = a.iter();
assert_eq!(iter.next(), Some(&-1));
let mut iter = a.iter().map(|x| *x * 2);
assert_eq!(ite... |
use serenity::framework::standard::{Args, CommandError};
use serenity::model::channel::Message;
use serenity::prelude::Context;
use super::alias_from_arg_or_channel_name;
use crate::db::*;
#[cfg(test)]
mod tests;
fn remove_server_helper(db_conn: &DbConnection, alias: &str) -> Result<(), CommandError> {
db_conn.r... |
use self::unify::TypeVarId;
use crate::hir::{EnumDefId, HirData, StructDefId};
use derive_more::Display;
mod infer;
mod unify;
pub use self::infer::{infer, InferenceId, InferenceResult, VarMode};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Type {
Primitive(PrimitiveType),
Fn(FnType),
Struct(StructDef... |
//< Helpers that are useful for tests and doctests.
use super::rsrc::*;
use super::loader;
use super::arch::Arch;
use super::loaders::sc::ShellcodeLoader;
use super::workspace::Workspace;
/// Helper to construct a 32-bit Windows shellcode workspace from raw bytes.
///
/// It may panic when the workspace cannot be cre... |
extern crate actix_web;
#[macro_use]
extern crate rust_embed;
extern crate mime_guess;
use std::{env, io};
use actix_web::body::Body;
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
use mime_guess::from_path;
use std::borrow::Cow;
#[derive(RustEmbed)]
#[folder = "face/public/"]
struct Asset;
fn h... |
//! "lw" log-watcher utility
//! LW docs
#![forbid(unsafe_code)]
#![deny(
missing_docs,
unstable_features,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
trivial_numeric_casts,
unused_import_braces,
unused_qualifications,
bad_style,
const_err,
d... |
use http::{HeaderMap, HeaderValue};
use hyper::{Body, Response, StatusCode, Uri};
use std::collections::BTreeMap;
pub async fn body_to_str(body: &mut Body) -> Option<String> {
match body.next().await {
Some(Ok(chunk)) => {
let bytes = chunk.into_bytes();
let json_body = String::from... |
/// Iterator adapters for working with Result<> iterators
pub mod optfilter;
/// Common interfaces and formatting rules accross repository objects
pub mod repoobject;
|
mod commands;
mod config;
mod utils;
#[macro_use]
extern crate serde;
#[macro_use]
extern crate failure;
use exitfailure::ExitFailure;
use std::path::PathBuf;
use structopt::StructOpt;
/// Manages a list of projects throughout your file system
#[derive(StructOpt)]
#[structopt(name = "projects-cli")]
struct App {
... |
pub trait ShannonEntropy {
fn shannon_entropy(&self) -> f64;
}
impl ShannonEntropy for [u8] {
fn shannon_entropy(&self) -> f64 {
// Initialize a dataset of byte frequencies
let mut frequencies: [usize; 256] = [0; 256];
// Get byte frequencies
for byte in self {
freque... |
extern crate agg;
use agg::Render;
fn rgb64(r: f64, g: f64,b: f64,a: f64) -> agg::Rgba8 {
agg::Rgba8::new((r * 255.0).round() as u8,
(g * 255.0).round() as u8,
(b * 255.0).round() as u8,
(a * 255.0).round() as u8)
}
#[test]
fn rasterizers() {
let (... |
/*!
# FM-Index Long Read Corrector v2
This library provides access to the functionality used by FMLRC2 to perform read correction using a Burrows Wheeler Transform (BWT).
Currently, the BWT is assumed to have been generated externally (typically with a tool like ropebwt2) and stored in the same numpy format as FMLRC v... |
use std::pin::Pin;
pub enum MaybeResult<F, T> {
Future(F),
Result(T),
Gone,
}
impl<F, T> MaybeResult<F, T> {
pub fn project(self: Pin<&mut Self>) -> MaybeResult<Pin<&mut F>, &mut T> {
// safety: we only need to keep the `Future` pinned
let this = unsafe { self.get_unchecked_mut() };
... |
use std::ptr;
#[allow(dead_code)]
// may be used more later
#[repr(C, packed)]
pub struct Context {
rax: u64,
rbx: u64,
rcx: u64,
rdx: u64,
rbp: u64,
rsi: u64,
rdi: u64,
r8: u64,
r9: u64,
r10: u64,
r11: u64,
r12: u64,
r13: u64,
r14: u64,
r15: u64,
// beg... |
#[macro_use]
extern crate failure;
#[macro_use]
extern crate log;
extern crate serde_json;
extern crate hyper;
#[cfg(test)]
extern crate serde;
#[cfg(test)]
#[macro_use]
extern crate serde_derive;
pub mod error;
|
use oxygengine::prelude::*;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum PlayerType {
North,
South,
}
#[derive(Debug, Copy, Clone)]
pub struct Player(pub PlayerType);
impl Component for Player {
type Storage = VecStorage<Self>;
}
|
use super::{u256mod, ModulusTrait};
// Addition
impl<M: ModulusTrait> std::ops::Add for &u256mod<M> {
type Output = u256mod<M>;
fn add(self, other: &u256mod<M>) -> u256mod<M> {
let sum_value = self.value + other.value;
if sum_value >= M::modulus() {
return u256mod { value: &sum_va... |
use crate::solutions::Solution;
use crate::utilities::intcode;
pub struct Day02 {}
impl Solution for Day02 {
fn part_one(&self, input: &str) -> String {
let tape: Vec<i32> = input
.split(',')
.map(|t| t.parse::<i32>().unwrap())
.collect();
let mut vm = intcode::... |
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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>,... |
mod funcs;
pub use self::funcs::*;
pub const ERROR_BUFFER_LENGTH: usize = 256;
|
use anilist::models::Staff;
use serenity::builder::CreateEmbed;
use serenity::framework::standard::CommandResult;
use serenity::model::channel::{Message, Reaction, ReactionType};
use serenity::prelude::Context;
use crate::anilist::embeds::{
staff_overview_embed, staff_related_anime_embed, staff_related_manga_embed... |
#[macro_use]
extern crate maplit;
pub mod character;
|
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::ops::Bound;
#[derive(Eq, PartialEq, Debug, Clone)]
pub struct ChunkOffsetSize {
pub offset: u64,
pub size: usize,
}
impl ChunkOffsetSize {
pub fn new(offset: u64, size: usize) -> Self {
Self { offset, size }
}
pub fn end(&sel... |
use crate::packet::SerializedPacket;
use crate::Notification;
#[cfg(not(feature = "std"))]
use crate::PublishNotification;
use core::convert::TryInto;
use fugit::TimerDurationU32;
use fugit::TimerInstantU32;
#[cfg(not(feature = "std"))]
use heapless::{pool, pool::singleton::Pool};
use heapless::{FnvIndexMap, FnvIndexSe... |
/// This file handles bindings from the DOM to the application
/// It sets up bindings from the canvas into the program for example mouse
/// clicks, selecting the canvas to use etc.
use std::cell::RefCell;
use std::rc::Rc;
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
use wasm_bindgen::JsCast;
pub mod app;
pub ... |
// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]
extern crate env_logger;
extern crate actix_web;
extern crate postgres;
extern crate oracle;
extern crate serde;
extern crate serde_json;
extern crate inner;
extern crate futures;
extern crate csv;
extern crate ini;
extern crate bio;
extern crate rayo... |
use exonum::crypto::PublicKey;
#[derive(Serialize, Deserialize)]
pub struct FuzzData {
pub genesis: PublicKey,
pub alice: PublicKey,
pub bob: PublicKey,
}
|
fn main() {
println!("こんにちは");
println!("AtCoder");
} |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
Operations_List(#[from] operations::l... |
#[derive(Debug, Clone)]
pub struct SpherePacking {
min: [f64; 3],
max: [f64; 3],
r: f64,
current: [f64; 3],
current_offset: f64,
}
impl SpherePacking {
pub fn fit_n_in_box(n: u64, min: [f64; 3], max: [f64; 3]) -> Self {
let range = [max[0] - min[0], max[1] - min[1], max[2] - min[2]];
... |
use crate::lbvrf::*;
use crate::param::*;
use crate::rand::RngCore;
use crate::serde::Serdes;
use crate::VRF;
#[test]
fn test_param_gen() {
let p = LBVRF::paramgen([0; 32]);
println!("{:?}", p);
}
#[test]
fn test_hash_to_challenge() {
let input = "this is a random input for testing";
let c = hash_to_ch... |
use crate::config;
use crate::util::*;
use std::fs::File;
pub fn run() {
let name = if args_len() < 3 {
get_input()
} else {
get_argument(2)
};
match File::create(format!("{}{}{}", &config::directory(), name, config::EXTENSION)) {
Ok(_) => println!("Note {} created.", name),
... |
use crates_io_api::{SyncClient, Crate, Error, Sort, ListOptions};
use serde::{Deserialize};
use serde_json::{Deserializer};
use std::process::{Command, Stdio};
use std::io::Write;
#[derive(Deserialize, Debug)]
struct BuildMetadataTarget {
kind: Vec<String>,
crate_types: Vec<String>,
name: String,
}
#[deri... |
extern crate percent_encoding;
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`');
pub fn construct_startpage_search_url(query: &str) -> String {
let encoded_query = utf8_percent_encode(query, FRAGMENT).to_strin... |
extern crate minigrep_v2;
use minigrep_v2::Config;
#[test]
fn performs_case_sensitive_search() {
assert_eq!(
minigrep_v2::run(Config {
query: String::from("to"),
path: String::from("poem.txt"),
case_sensitive: true,
}).unwrap(),
vec![
String::... |
/// Module to attack substitution cipher texts.
///
/// This module uses a word patter matching method to guess probable key used to cipher
/// a text using substitution algorithm.
///
/// You should be aware that to be successful charset used for attack should be the
/// same used to cipher. Besides, this module tries... |
use std::borrow::Cow;
use std::sync::Arc;
use command_data_derive::MenuCommand;
use discorsd::{async_trait, BotState};
use discorsd::commands::*;
use discorsd::errors::BotError;
use discorsd::http::channel::{create_message, MessageChannelExt};
use discorsd::model::interaction::{ButtonPressData, GuildUser, InteractionU... |
#[cfg(feature = "grpc_support")]
tonic::include_proto!("as/r#as");
#[cfg(feature = "grpc_support")]
pub mod external;
pub mod integration;
|
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
use ferr_os_librust::{io, syscall};
//mod build_tree;
pub mod lexer;
//use build_tree::command::{Command, Connector};
pub mod command;
use command::{Command, Connector, Redirect};
pub mod parser;
pub fn bash(string: String, env: &mut B... |
/**********************************************
> File Name : build_tree.rs
> Author : lunar
> Email : lunar_ubuntu@qq.com
> Created Time : Fri 15 Apr 2022 02:02:52 PM CST
> Location : Shanghai
> Copyright@ https://github.com/xiaoqixian
**********************************************/
use st... |
// Copyright 2019 Red Hat, Inc. All Rights Reserved.
// SPDX-License-Identifier: (BSD-3-Clause OR Apache-2.0)
#[cfg(all(feature = "virtio-v4_14_0", not(feature = "virtio-v5_0_0")))]
mod bindings_v4_14_0;
#[cfg(feature = "virtio-v5_0_0")]
mod bindings_v5_0_0;
// Major hack to have a default version in case no feature ... |
use anyhow::Result;
fn main() -> Result<()> {
// let door_key = 5764801;
// let card_key = 17807724;
//
let door_key = 11562782;
let card_key = 18108497;
let mut door_loop = 0;
let mut card_loop = 0;
let mut found = 0;
let mut v = 1;
for loop_size in 1.. {
v = round(v,... |
// father of all kinds of renderengine like opengl, dx12
use gfx;
use rand::{self, Rng};
//use super::types::*;
//use super::types::ColorFormat;
use render::types::ColorFormat;
gfx_defines!{
vertex Vertex {
position: [f32; 2] = "a_Position",
}
// color format: 0xRRGGBBAA
vertex Instance {
... |
use std::net::UdpSocket;
use std::net::{SocketAddr, ToSocketAddrs};
use docopt::Docopt;
const USAGE: &'static str = "\
Simle tool for receive UDP datagrams.
Usage: zudp help
zudp listen <hostport>
zudp send <hostport> <data>
";
const BUFFER_SIZE: usize = 2048;
const MAX_PRINT_SIZE: usize = 256;
const ... |
extern crate dmbc;
extern crate exonum;
extern crate exonum_testkit;
extern crate hyper;
extern crate iron;
extern crate iron_test;
extern crate mount;
extern crate serde_json;
pub mod dmbc_testkit;
use std::collections::HashMap;
use dmbc_testkit::{DmbcTestApiBuilder, DmbcTestKitApi};
use exonum::crypto;
use hyper::... |
use crate::built_info;
use crate::provider::ClientLedger;
use directory_client::presence::providers::MixProviderPresence;
use directory_client::requests::presence_providers_post::PresenceMixProviderPoster;
use directory_client::DirectoryClient;
use log::{debug, error};
use std::time::Duration;
use tokio::runtime::Handl... |
use sha2::Digest;
use serde::Deserialize;
use serde::ser::{Serialize, Serializer, SerializeStruct};
use serde_json::json;
use crate::transaction::*;
/// ```rust
/// use bc::block::*;
/// let x = "hello".to_string();
/// assert_eq!(
/// string2hash_string(&x),
/// "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caada... |
use crate::access_control;
use fund::{
accounts::{vault::TokenVault, Fund},
error::{FundError, FundErrorCode},
};
use serum_common::pack::Pack;
use solana_program::{
account_info::{next_account_info, AccountInfo},
msg, program,
pubkey::Pubkey,
};
use spl_token::instruction;
use std::convert::Into;
... |
fn main() {
/*let x: i64 = 5;
let a: i64 = 8;
let sum = x + a;
{
println!("{:?}", a);
let a = 12;
println!("{:?}", a);
}
println!("{:?}", a);
println!("{}", sum);*/
// print_number(77);
// print_sum(9, 8);
println!("{:?}", add_one(9));;
}
fn print_number(x: i64) {
println!("{:?}", x);
}
fn print_s... |
mod cgroup;
mod config_linux;
mod error;
mod join;
mod mount;
mod namespace;
mod prctl;
mod process;
mod seccomp;
mod selinux;
mod systemd;
#[macro_use]
mod system;
mod user;
use crate::config;
use crate::process::ProcessStatus;
use error::Result;
use nix::sys::signal::Signal;
use nix::unistd::Pid;
use std::io::Write;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.