text stringlengths 8 4.13M |
|---|
fn main() {
use config_struct::{DynamicLoading, StructOptions};
std::fs::create_dir_all("src/config").expect("Failed to create config dir.");
println!("cargo:rerun-if-changed=config.json");
println!("cargo:rerun-if-changed=config.ron");
println!("cargo:rerun-if-changed=config.toml");
println!(... |
use gumdrop::Options;
use lexical_bool::LexicalBool;
#[derive(Clone, Options, Debug)]
pub struct Args {
#[options(help = "print help message")]
pub help: bool,
#[options(help = "display current git branch")]
pub git_branch: bool,
#[options(help = "attempt to make the components unique")]
pub ... |
use anyhow::Result;
// use crate::server::StorageDriver;
use crate::storage::storage_driver::{StorageCmd, StorageDriver};
use actix::{Actor, Handler, Message, SyncContext};
use proger_core::protocol::model::StepPageModel;
use tokio::runtime::Runtime;
pub struct StorageExecutor<T: StorageDriver> {
pub driver: T,
... |
#[doc = "Register `SAI_AFRCR` reader"]
pub type R = crate::R<SAI_AFRCR_SPEC>;
#[doc = "Register `SAI_AFRCR` writer"]
pub type W = crate::W<SAI_AFRCR_SPEC>;
#[doc = "Field `FRL` reader - FRL"]
pub type FRL_R = crate::FieldReader;
#[doc = "Field `FRL` writer - FRL"]
pub type FRL_W<'a, REG, const O: u8> = crate::FieldWrit... |
use std::io::{self};
fn main() {
let mut count_input = String::new();
io::stdin().read_line(&mut count_input).unwrap();
let mut numbers_input = String::new();
io::stdin().read_line(&mut numbers_input).unwrap();
print!("{}", calc(count_input.as_str(), numbers_input.as_str()));
}
fn get_numbers(s: &... |
use std::sync::mpsc::channel;
use std::sync::mpsc::Sender;
use Log;
use node::Node;
// TODO: Can this expand to a function?
macro_rules! test_passthrough {
($node:ident) => {
use std::time::Duration;
use node::testing::TestEchoNode;
use std::sync::mpsc::channel;
let (sender, recei... |
mod static_file;
pub type StaticFile = static_file::StaticFile;
|
use crate::SbpString;
pub trait SbpSerialize {
fn append_to_sbp_buffer(&self, buf: &mut Vec<u8>);
fn sbp_size(&self) -> usize;
}
impl SbpSerialize for u8 {
fn append_to_sbp_buffer(&self, buf: &mut Vec<u8>) {
buf.extend(&self.to_le_bytes())
}
fn sbp_size(&self) -> usize {
1
}
}... |
#![no_std]
extern crate alloc;
mod consts;
#[cfg(not(feature = "minimal"))]
mod default;
#[cfg(feature = "minimal")]
mod minimal;
#[cfg(not(feature = "minimal"))]
pub use default::Sha1;
#[cfg(feature = "minimal")]
pub use minimal::Sha1;
#[cfg(test)]
mod tests {
use super::Sha1;
use dev_util::impl_test;
... |
//! Template interpreter.
use std::io;
use std::io::{ Read, Write };
use std::collections::HashMap;
use std::borrow::Cow;
use options;
use {
Options,
Call,
Constant,
Binding,
Instruction,
Cond,
Mem,
Execute,
Fingerprint,
LittleValue,
Template,
Build,
Function,
... |
//! Special utils for if you're running on the NO$GBA emulator.
//!
//! Note that this assumes that you're using the very latest version (3.03). If
//! you've got some older version of things there might be any number of
//! differences or problems.
use super::{DebugInterface, DebugLevel};
use crate::prelude::InitOnce... |
use core::cmp::max;
/// Solves the Day 18 Part 1 puzzle with respect to the given input.
pub fn part_1(input: String) {
// Nodes are of the form (v, p, l, r).
let mut lhs_tree = Vec::<(usize, usize, usize, usize)>::new();
lhs_tree.push((0, 0, 0, 0));
let mut first = true;
for line in input.lines(... |
//! A small [CBOR] codec suitable for `no_std` environments.
//!
//! The crate is organised around the following entities:
//!
//! - [`Encoder`] and [`Decoder`] for type-directed encoding and decoding
//! of values.
//!
//! - [`Encode`] and [`Decode`] traits which can be implemented for any
//! type that should be enco... |
use serde::de::{Deserialize, Deserializer};
use serde_derive::Serialize;
use std::borrow::Cow;
use std::env;
use std::ffi::OsString;
use std::io;
use std::path::{Path, PathBuf};
#[derive(Clone, Debug, Serialize)]
#[serde(transparent)]
pub struct Directory {
path: PathBuf,
}
impl Directory {
pub fn new<P: Into... |
use anyhow::{anyhow, bail, ensure, Context as _, Result};
use cookie_store::CookieStore;
use itertools::Itertools as _;
use std::fs::{self, File};
use std::io::{self, Cursor, Write as _};
use std::mem;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use thiserror::Error;
use ureq_1_0_0::{Agent, Request, Re... |
use crate::controller::base::{ProcessOutcome, StatusSection};
use crate::controller::reconciler::ReconcileError;
use async_trait::async_trait;
use drogue_client::core::v1::{ConditionStatus, Conditions};
use std::{future::Future, time::Duration};
pub struct Progressor<'c, C>(Vec<Box<dyn ProgressOperation<C> + 'c>>);
p... |
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro_hack::proc_macro_hack;
use quote::quote;
use std::process::Command;
use syn::parse::{Parse, ParseStream, Result};
use syn::parse_macro_input;
use syn::{LitStr};
#[derive(Debug)]
struct ShellArgs {
command: String,
}
impl Parse for ShellArgs {
... |
/// 创建爬虫对象
pub struct Crawler {
// 域名
pub domain: String,
// 基础页面
pub base: String,
// 已访问页面地址
visited: Vec<String>
}
/// 爬虫对象功能实现
impl Crawler {
/// 创建一个爬虫对象
pub fn new(domain: String, base: String) -> Self {
Crawler {
domain,
base,
visit... |
// Copyright (c) 2017 oic developers
//
// 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. All files in the project carrying such notice may not be copied,
// mo... |
use std::collections::HashMap;
use serde_json::json;
use crate::{transport::TransportableValue, uri::Uri, GlobalScope, Id, RouterScope, SessionScope};
/// Raw message codes for each message type.
#[allow(missing_docs)]
pub(in crate) mod msg_code {
pub const HELLO: u64 = 1;
pub const WELCOME: u64 = 2;
pub... |
use maplit::hashmap;
use std::collections::HashMap;
use std::convert::TryFrom;
use svm_runtime_ffi as api;
use svm_runtime_ffi::{svm_byte_array, tracking};
use svm_codec::receipt;
use svm_runtime::testing;
use svm_sdk::traits::Encoder;
use svm_sdk::ReturnData;
use svm_types::{Address, Context, Envelope, TemplateAddr... |
pub fn run1(filename: &String) {
let rows = super::input::read_lines(filename.to_string());
let mut twins = 0;
let mut triplets = 0;
for row in rows {
let mut chars: Vec<char> = row.chars().collect();
chars.sort_unstable();
chars.push('\n');
let mut consecutive = 1;
let mut found_twins = fa... |
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum KeyCode {
Modifier(u8),
Keyboard(u8),
Media(u16),
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum FnKeyCode {
FN0,
FN1,
FN2,
}
//#[derive(Copy, Clone, Debug, PartialEq)]
//pub struct ModifierKeyCode(u8);
|
use cargo_metadata::MetadataCommand;
use clap::{App, Arg, SubCommand};
use dirs::home_dir;
use hotwatch::{Event, Hotwatch};
use oxygengine_build_tools::{
atlas::pack_sprites_and_write_to_files,
build::{build_project, BuildProfile},
pack::pack_assets_and_write_to_file,
pipeline::{AtlasPhase, CopyPhase, P... |
pub type PunterId = u64;
pub type SiteId = u64;
|
use crate::obj::r#const::MAX_SIZE;
use crate::obj::{GTwzobj, Twzobj};
use std::fmt::{Debug, Error, Formatter};
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
pub struct Pref<'a, R> {
pub(crate) obj: GTwzobj,
reference: &'a R,
_pd: PhantomData<&'a ()>,
}
impl<'a, R> Deref for Pref<'a, R> {
type Ta... |
pub mod converter;
pub mod finalizer;
pub mod types;
#[macro_export]
macro_rules! vec2 {
($($e: expr),+) => {
{
use $crate::macros::types;
use $crate::macros::converter::Converter;
use $crate::macros::finalizer::Finalizer;
let e = types::EmptyConverter;
... |
#[doc = "Register `CR2` reader"]
pub type R = crate::R<CR2_SPEC>;
#[doc = "Register `CR2` writer"]
pub type W = crate::W<CR2_SPEC>;
#[doc = "Field `MSWU` reader - Master Timer Software update"]
pub type MSWU_R = crate::BitReader<MSWU_A>;
#[doc = "Master Timer Software update\n\nValue on reset: 0"]
#[derive(Clone, Copy,... |
use crate::commands;
use crate::database_state::DatabaseState;
use crate::server_state::ServerState;
use crate::sql_parser::SQLParser;
use common::{get_name, CrustyError, QueryResult};
use optimizer::optimizer::Optimizer;
use queryexe::query::{Executor, TranslateAndValidate};
use sqlparser::ast::Statement;
use std::syn... |
use std::fmt;
use std::io;
use thiserror::Error;
pub const ERR_INVALID_SETUP: u32 = 0x0000_0001;
pub const ERR_UNSUPPORTED_SETUP: u32 = 0x0000_0002;
pub const ERR_REJECT_SETUP: u32 = 0x0000_0003;
pub const ERR_REJECT_RESUME: u32 = 0x0000_0004;
pub const ERR_CONN_FAILED: u32 = 0x0000_0101;
pub const ERR_CONN_CLOSED: u... |
use anyhow::Result;
use bitvec::prelude::*;
fn char_index(c: char) -> usize {
let ascii_code = c as u8;
let a = 'a' as u8;
(ascii_code - a) as usize
}
fn main() -> Result<()> {
let input = advent20::input_string()?;
let mut groups = Vec::new();
let mut current_group = None;
for line in ... |
//! VNDB struct definitions
pub mod dbstats;
pub mod error;
pub mod get;
pub(crate) mod login;
pub(crate) mod request;
pub(crate) mod response;
pub mod set;
|
use crate::parser::ast::Node;
use super::prelude::*;
#[derive(Debug, Clone, PartialEq)]
pub struct Quote {
pub node: Node,
}
impl Display for Quote {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.node)
}
}
|
use crate::{
draw,
phys::{self, PhysHandle},
world, Game,
};
use macroquad::*;
#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize)]
#[serde(transparent)]
pub struct Rot(pub f32);
impl Rot {
fn as_unit(self) -> na::Unit<na::Vector2<f32>> {
na::Unit::new_normalize(
na:... |
pub mod debug;
pub mod terrain;
pub mod ui_event_handler;
|
#[doc = "Register `MPCBB1_VCTR14` reader"]
pub type R = crate::R<MPCBB1_VCTR14_SPEC>;
#[doc = "Register `MPCBB1_VCTR14` writer"]
pub type W = crate::W<MPCBB1_VCTR14_SPEC>;
#[doc = "Field `B448` reader - B448"]
pub type B448_R = crate::BitReader;
#[doc = "Field `B448` writer - B448"]
pub type B448_W<'a, REG, const O: u8... |
use exonum::crypto::PublicKey;
use exonum::storage::{Fork, MapIndex, Snapshot};
use currency::wallet::Wallet;
use currency::SERVICE_NAME;
/// The schema for accessing wallets data.
pub struct Schema<S>(pub S)
where
S: AsRef<Snapshot>;
impl<S> Schema<S>
where
S: AsRef<Snapshot>,
{
/// Internal `MapIndex` ... |
// Enable later, too much noise this early
// #![warn(missing_debug_implementations, rust_2018_idioms, missing_docs)]
use std::env; // CLI args
use std::fmt; // fmt::Display trait
use std::fs; // reading files
use std::io; // for io::Error
use std::net;
use std::thread; // for sleeping
use std::time; // for sleep dura... |
//! A low-level, zero-copy and panic-free serializer and deserializer for binary.
//!
//! # Usage
//!
//! First, add the following to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! byte = "0.3"
//! ```
//!
//! Next, add this to your crate root:
//!
//! ```
//! extern crate byte;
//! ```
//!
//! `Byte` is `no... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
//! A simple arena allocator using tracee's stack
//!
//! Allocation is done on stack, all allocate... |
use ckb_logger::error;
use ckb_notify::NotifyController;
use crossbeam_channel::select;
use jsonrpc_core::{futures::Future, Metadata, Result};
use jsonrpc_derive::rpc;
use jsonrpc_pubsub::{
typed::{Sink, Subscriber},
PubSubMetadata, Session, SubscriptionId,
};
use serde::{Deserialize, Serialize};
use std::colle... |
use std::collections::HashMap;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
use syn::{Ident, ItemEnum, LitStr};
pub struct State {
state_enum: ItemEnum,
classes: HashMap<Ident, LitStr>,
is_standard: bool,
}
impl State {
pub fn new(mut state_enum: ItemEnum, is_standard: ... |
use std::collections::HashMap;
use parser::{File, FileHash, Function, Type, Unit, Variable};
use crate::code::Code;
use crate::filter;
use crate::print::{
self, DiffState, Id, MergeIterator, MergeResult, PrintHeader, PrintState, Printer, SortList,
};
use crate::{Options, Result};
fn assign_ids(file: &File, optio... |
//! Generate a syntax tree from an input stream.
pub mod error;
pub mod expr;
pub use parse::error::{Error, Result};
use lex::token::{Token, TokenKind};
use parse::expr::Expr;
use std::slice::Iter;
use std::iter::Peekable;
/// Build an AST from a stream of tokens.
pub fn parse<V: AsRef<[Token]>>(v: V) -> Result {
... |
use super::instruction::*;
use super::base::*;
use super::reg_access::*;
use super::operand_access::*;
use super::super::mem::Memory;
use super::super::hw::HW;
use std::io::Write;
impl CPU
{
fn stack_push(&mut self, mem: &mut Memory, val: u16)
{
self.sp -= 2;
self.store_memory_u16_noov(mem, self.ss, self.sp, va... |
extern crate codespan;
extern crate codespan_reporting;
extern crate rustyline;
extern crate sparc;
use rustyline::error::ReadlineError;
use rustyline::Editor;
use sparc::Executor;
fn main() {
// `()` can be used when no completer is required
let mut rl = Editor::<()>::new();
if rl.load_history("history.... |
use std::time::Instant;
use std::io;
pub trait Logger {
fn push(&mut self, time: Instant, text: &str);
fn log(&mut self, text: &str){
self.push(Instant::now(), text);
}
fn try_flush(&mut self) -> io::Result<()>;
fn flush(&mut self){
match self.try_flush() {
Err(error) => eprintln!("{}", error),
O... |
#[cfg(test)]
mod test;
use std::{collections::HashMap, convert::TryInto};
use bson::{oid::ObjectId, Bson, RawArrayBuf, RawDocumentBuf};
use serde::Serialize;
use crate::{
bson::doc,
bson_util,
cmap::{Command, RawCommandResponse, StreamDescription},
error::{BulkWriteFailure, Error, ErrorKind, Result},... |
#[doc = "Reader of register INJ_CHAN_CONFIG"]
pub type R = crate::R<u32, super::INJ_CHAN_CONFIG>;
#[doc = "Writer for register INJ_CHAN_CONFIG"]
pub type W = crate::W<u32, super::INJ_CHAN_CONFIG>;
#[doc = "Register INJ_CHAN_CONFIG `reset()`'s with value 0"]
impl crate::ResetValue for super::INJ_CHAN_CONFIG {
type T... |
use std::path::Path;
use dprint_core::formatting::*;
use dprint_core::configuration::{resolve_new_line_kind};
use super::parsing::parse;
use super::swc::parse_swc_ast;
use super::configuration::Configuration;
/// Formats a file.
///
/// Returns the file text `Ok(formatted_text)` or an error when it failed to parse.
... |
fn main ()
{
#[cfg(feature = "bazinga")]
println!("Bazinga!");
}
|
pub mod lang;
pub mod operations;
pub mod set_voice;
use self::operations::Operation;
use anyhow::{bail, Context as _, Result};
use serde_json::json;
use serenity::model::interactions::Interaction;
pub async fn handle_slash_command(
ctx: &serenity::client::Context,
interaction: Interaction,
) -> Result<()> {
... |
// variables5.rs
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
// I AM DONE
fn main() {
let number = "3"; // don't change this line
println!("Number {}", number);
// We need to implement the shadowing concept here. Shadowing allows you
// to define the... |
mod bound;
mod range;
pub use self::bound::{BoundType, Bound};
pub use self::range::Range;
|
/// If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
/// Find the sum of all the multiples of 3 or 5 below 1000.
fn main() {
println!("Finding the sum of all the multiples of 3 or 5 below 1000");
let limit = 1000;
iterative_so... |
//! Callbacks for the `drawin` object in the Lua libraries
use ::luaA;
use ::lua::Lua;
use libc::c_int;
use ::object::WindowState;
use ::callbacks::drawable::DrawableState;
#[repr(C)]
pub struct DrawinState {
pub window: WindowState,
pub ontop: bool,
pub visible: bool,
pub cursor: String,
/// The ... |
//WONT LINK...SEE https://github.com/hobinjk/rusty-kaleidoscope to figure out the issue
#![feature(macro_rules)]
#[link(name = "rustllvm", kind = "static")]
extern crate rustc;
extern crate libc;
use rustc::lib::llvm::{llvm, TypeRef, ContextRef, ModuleRef, ValueRef, BasicBlockRef, False, Bool, ExecutionEngineRef};
... |
use crate::ast::main::AST;
use super::types::{
ASTValue, AccessDotExpr, AccessIndexExpr, Assignable, CallFunctionExpr, DotAccessable,
Identifier, TypeCastExpr,
};
use crate::common::position::Span;
use crate::lexer::parser::TokenType;
pub fn expr_identifier(ast: &mut AST) -> Identifier {
let tok... |
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate serde_derive;
use actix_web::{web, App, HttpResponse, HttpServer};
use diesel::pg::PgConnection;
use diesel::r2d2::{ConnectionManager, Pool};
use dotenv;
use futures::future::Future;
mod model;
mod schema;
const PORT: &str = "127.0.0.1:8000";
fn get_all(
... |
//! Utilities for cleaning data.
pub mod isbns;
pub mod names;
pub mod strings;
|
use failure::{Error, Fail};
use reqwest::{
r#async::Client,
header::{USER_AGENT, REFERER, HeaderMap},
};
use select::{
document::Document,
node::Node,
predicate::{Attr, Name, Predicate},
};
use futures::Future;
use log::debug;
use serde::Serialize;
use std::collections::HashMap;
const URL_CAS_LOGIN... |
use wrapped2d::b2;
use physics as p;
pub trait BodyExt {
fn apply_horiz_accel(&mut self, force: f32);
fn apply_vert_impulse(&mut self, impulse: f32);
}
impl BodyExt for b2::MetaBody<p::EntityUserData> {
fn apply_horiz_accel(&mut self, force: f32) {
self.apply_force_to_center(&b2::Vec2 { x: force, ... |
use std::env;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize,)]
pub struct Config {
pub bind: String,
pub port: String,
pub version: i64,
}
impl Config {
pub fn new(bind: String, port: String, version: i64) -> Self {
Config {
bind,
port,
... |
extern crate cxdbg;
use cxdbg::DebugClient;
use cxdbg::proto::{Event, PageApi, NetworkApi};
use cxdbg::proto::Event::*;
extern crate rustyline;
use rustyline::error::ReadlineError;
use rustyline::Editor;
use std::thread;
use std::sync::{Arc, Mutex};
fn process_event(ev: &Event) {
match ev {
Inspector_de... |
//! mnvec register
read_csr_as_usize_rv32!(0x7c3, __read_mnvec);
|
// Copyright 2013-2014 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 crate::{Node, SchemaNodeTypes, ID};
use async_graphql::{ComplexObject, SimpleObject};
use async_graphql_relay::RelayContext;
#[derive(SimpleObject)]
#[graphql(complex)]
pub struct User {
pub id: ID,
pub name: String,
pub role: String,
}
impl User {
pub async fn get(ctx: RelayContext, id: String) -... |
fn main() {
let password_min = 254032;
let password_max = 789860;
let mut count = 0;
for p in password_min..=password_max {
let mut m = 10;
let mut non_decreasing = true;
let mut has_twins = false;
for _ in 1..6 {
let d1 = p % m / (m / 10);
... |
use nu_test_support::{nu, pipeline};
#[test]
fn capture_errors_works() {
let actual = nu!(
cwd: ".", pipeline(
r#"
do -c {$env.use} | describe
"#
));
assert_eq!(actual.out, "error");
}
|
use std::fs::{canonicalize, File};
use std::io::Write;
mod deserializers;
mod handle_orders;
mod structs;
use handle_orders::handle_orders;
use structs::{Order, Orderbook, Trade};
fn main() {
// Read the file
let json_file_path = canonicalize("./orders.json").unwrap();
let file = File::open(json_file_pat... |
#[doc = "Register `PMC` reader"]
pub type R = crate::R<PMC_SPEC>;
#[doc = "Register `PMC` writer"]
pub type W = crate::W<PMC_SPEC>;
#[doc = "Field `ADC1DC2` reader - ADC1DC2"]
pub type ADC1DC2_R = crate::BitReader;
#[doc = "Field `ADC1DC2` writer - ADC1DC2"]
pub type ADC1DC2_W<'a, REG, const O: u8> = crate::BitWriter<'... |
use crate::game::player::PlayerProps;
pub enum GameObjectType {
Player(PlayerProps)
} |
use nia_protocol_rust::ChangeMappingRequest;
use nia_protocol_rust::KeyChord;
use crate::error::NiaServerError;
use crate::error::NiaServerResult;
use crate::protocol::NiaAction;
use crate::protocol::NiaKeyChord;
use crate::protocol::NiaMapping;
use crate::protocol::Serializable;
#[derive(Debug, Clone, PartialEq, Eq... |
use crate::definitions::*;
use bytes::Bytes;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use std::{collections::HashMap, string::ToString};
use strum_macros::Display;
#[derive(Debug, Default)]
pub struct Properties {
pub properties: HashMap<String, Option<Property>>,
}
impl Properties {
pub f... |
pub mod community;
pub mod err;
pub mod user;
pub mod review;
pub mod restaurant;
pub mod me;
use rocket;
use rocket::request::{FromRequest, Outcome};
use crate::models::{Header};
use crate::logic;
impl<'a, 'r> FromRequest<'a, 'r> for Header {
type Error = ();
fn from_request(request: &'a rocket::request::Re... |
mod globalconstants;
mod maintest;
mod operationtype;
mod playfairconfiguration;
use globalconstants::*;
use operationtype::*;
use playfairconfiguration::PlayfairConfiguration;
use std::collections;
use std::io;
fn main() {
let mut config = PlayfairConfiguration::new();
println!("{}", config);
loop {
... |
use std::{cell::RefCell, collections::HashMap, rc::Rc};
use crate::sqlite::{
sqlite_resource_pool::{db_pool::SqliteDatabasePool, tx_pool::SqliteTxPool},
sqlite_types::{RowSelectionPlan, SqliteTypes},
transaction::sqlite_tx::SqliteTx,
};
use apllodb_immutable_schema_engine_application::use_case::transaction... |
#![deny(warnings)]
extern crate bytes;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_schema;
extern crate smallvec;
mod internal;
pub mod de;
mod schema;
pub mod ser;
pub use de::Deserializer;
pub use ser::StreamSerializer;
|
use std::ops::{Add, Div, Mul, Sub};
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Vec3 {
x: f32,
y: f32,
z: f32,
}
impl Vec3 {
pub fn new(x: f32, y: f32, z: f32) -> Vec3 {
Vec3 { x, y, z }
}
pub fn zeros() -> Vec3 {
Vec3 {
x: 0.0,
y: 0.0,
... |
//! <https://github.com/EOSIO/eosio.cdt/blob/4985359a30da1f883418b7133593f835927b8046/libraries/eosiolib/core/eosio/symbol.hpp#L24-L201>
use crate::{
symbol_from_str, symbol_to_string, symbol_to_utf8, NumBytes,
ParseSymbolError, Read, ScopeName, Symbol, Write,
};
use alloc::string::String;
use core::{
conve... |
mod player;
pub use player::PlayerPlugin;
|
use hydroflow::datalog;
fn main() {
let mut df = datalog!(r#"
.input in1 `source_iter(0..10) -> map(|x| (x, x))`
.input in2 `source_iter(0..10) -> map(|_| ("string",))`
.output out `null::<(u32,)>()`
out(a) :- in1(a, b), in2
"#);
df.run_available();
}
|
use crate::base::LocalContext;
use crate::base::{accessed_inode, distribution_requirement, raft_group, DistributionRequirement};
use crate::base::{empty_response, finalize_response, FlatBufferResponse, FlatBufferWithResponse};
use crate::client::RemoteRaftGroups;
use crate::generated::*;
use crate::storage::message_han... |
/// Provides a TCP client for [GetEventStore] datatbase.
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate log;
mod discovery;
mod internal;
mod connection;
pub mod types;
pub use connection::{
Connection,
ConnectionBuilder,
};
pub use internal::{
commands,
operations::OperationErro... |
use log::{debug, error, warn};
use std::{collections::HashMap, process::Command, thread};
use librespot::{
metadata::audio::UniqueFields,
playback::player::{PlayerEvent, PlayerEventChannel, SinkStatus},
};
pub struct EventHandler {
thread_handle: Option<thread::JoinHandle<()>>,
}
impl EventHandler {
... |
use mcpi_api::{create, TileVec3};
#[test]
fn main() {
let mut mc = create("localhost:4711");
mc.post_to_chat("Hello world!");
let pos1 = TileVec3::from(-31,6,-11);
let pos2 = TileVec3::from(-32,6,-12);
let pos3 = TileVec3::from(-31,7,-11);
let pos4 = TileVec3::from(-30,8,-10);
println!("{:?... |
use super::AppState;
use actix_web::{get, web, HttpResponse, Responder};
pub fn init(cfg: &mut web::ServiceConfig) {
cfg.service(get);
}
#[get("/data/{id}")]
async fn get(id: web::Path<i32>, app_state: web::Data<AppState<'_>>) -> impl Responder {
println!("GET: /data/{}", id);
let data = app_state.databa... |
//! This project is used for measuring memory and execution time of FIR
//! filtering operation using convolution sum operation.
//!
//! Requires `cargo install probe-run`
//! `cargo run --release --example 2_16_direct_fir_filtering`
//!
//! Requires `cargo install cargo-binutils`
//! Requires `rustup component add llv... |
mod config;
mod engine;
mod game;
#[macro_use]
extern crate deferred;
extern crate pretty_env_logger;
#[macro_use]
extern crate log;
use engine::basic_types::err;
use std::env;
use game::GameState;
use log::{info, warn};
fn main() -> Result<(), String> {
let key = "RUST_LOG";
env::set_var(key, "trace");
... |
use modifier::{Modifier, Set};
use std::collections::BTreeMap;
use std::fmt::Debug;
use crate::treeer::element::{TextNode, SelfContainedElement, OpeningElement};
use crate::treeer::state_attr::*;
pub type Attr = BTreeMap<String, String>;
pub type Flags = Vec<String>;
#[derive(Debug)]
pub struct State {
_attr: At... |
use crate::models::access::AccessType;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct LoginRequest {
pub username: String,
pub password: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RegisterRequest {
pub username: String,
pub password: String,
... |
// 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://... |
use std::{any::TypeId, cell::RefCell, fs, rc::Rc};
use uuid::Uuid;
use imgui::*;
use std::collections::HashSet;
use crate::editor_helpers;
use crate::entity::*;
use crate::scene_serde::*;
fn uuid_truncated(id: Uuid) -> String {
id.to_string().chars().take(8).collect::<String>()
}
#[derive(Clone)]
struct Selected... |
#![crate_type = "cdylib"]
#[macro_use]
mod bindings;
use crate::bindings::*;
use std::os::raw::c_int;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
#[no_mangle]
pub unsafe extern "C" fn luaopen_ws(state: *mut lua_State) -> c_int {
register_userdata!(state, [ Conn... |
use super::super::BlockId;
use std::rc::Rc;
#[derive(Clone)]
pub enum Sender {
Player { client_id: Rc<String> },
}
#[derive(Clone)]
pub struct Message {
sender: Sender,
text: Rc<String>,
replies: Vec<BlockId>,
}
impl Message {
pub fn new(sender: Sender) -> Self {
Self {
sender... |
use std::error::Error;
use gc::{Finalize, Trace};
use rnix::TextRange;
pub const ERR_PARSING: EvalError = EvalError::Internal(InternalError::Parsing);
/// Used for rnix-lsp main functions
#[derive(Debug, Clone, Trace, Finalize)]
pub enum AppError {
/// Unspecified internal error
Internal(String),
}
impl std... |
#[macro_use]
extern crate text_io;
pub mod commands;
pub mod http;
pub mod install;
pub mod installer;
pub mod settings;
pub mod terminal;
pub mod util;
|
/// структуры пока просто из камня
enum Block { Air, Stone, Ore, Water } |
// TODO add secret check to question additions
use actix_identity::{CookieIdentityPolicy, Identity, IdentityService};
use actix_web::error::ErrorUnauthorized;
use actix_web::middleware::Logger;
use actix_web::*;
use askama::Template;
use env_logger;
use futures::future;
use std::collections::HashMap;
use std::sync::... |
use midir::{Ignore, MidiInput, MidiInputConnection};
use std::convert::TryFrom;
use std::error::Error;
use std::sync::mpsc;
pub struct MidiBox {
_connnection: MidiInputConnection<()>,
pub rx: mpsc::Receiver<MidiMsg>,
}
impl MidiBox {
pub fn connect() -> Result<Self, Box<dyn Error>> {
let mut midi_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.