text stringlengths 8 4.13M |
|---|
use crate::common::{self, *};
pub type Button = AMember<AControl<AButton<TestableButton>>>;
#[repr(C)]
pub struct TestableButton {
pub base: common::TestableControlBase<Button>,
label: String,
h_left_clicked: Option<callbacks::OnClick>,
}
impl<O: controls::Button> NewButtonInner<O> for TestableB... |
use std::fs::File;
use std::io::BufReader;
pub fn read_input_to_string(day: &str) -> String {
let path = format!("{}/input/{}", std::env!("CARGO_MANIFEST_DIR"), day);
match std::fs::read_to_string(&path) {
Ok(input) => input,
Err(e) => {
println!("Failed to read input from '{}' with... |
/// this analyzer parses the Control Flow Guard function table.
/// it populates functions in the workspace.
/// the purpose of the table is to enumerate the functions that may be called indirectly.
///
/// references:
/// - https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format#load-configuration-directory... |
use super::atom::btn::{self, Btn};
use super::atom::fa;
use isaribi::{
style,
styled::{Style, Styled},
};
use kagura::component::Cmd;
use kagura::prelude::*;
use nusa::prelude::*;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use wasm_bindgen::{prelude::*, JsCast};
pub struct Props {
pub direction: Dire... |
use std::io::{self, Read};
type Bridge = Vec<Pipe>;
#[derive(Debug, Clone)]
struct Pipe {
value: u32,
unused_ends: Vec<u32>,
}
impl Pipe {
fn has_end(&self, val: u32) -> bool {
self.unused_ends.contains(&val)
}
fn remove_end(&mut self, val: u32) {
let first_idx = self.unused_ends... |
use std::cmp::Ordering;
fn count_signs(v: &Vec<i32>) -> Vec<i32> {
let mut negative_count = 0;
let mut neutral_count = 0;
let mut positive_count = 0;
for el in v.iter() {
match el.cmp(&0) {
Ordering::Less => negative_count += 1,
Ordering::Greater => positive_count += 1,
Ordering::Equal => neutral_coun... |
pub mod hosting;
mod serving; |
use euclid::default::Point2D;
#[derive(Copy, Clone)]
pub struct GlyphData {
id: u32,
advance: i32,
offset: Point2D<i32>,
}
impl GlyphData {
pub fn new(id: u32, advance: i32, offset_x:i32, offset_y: i32) -> Self {
GlyphData {
id,
advance,
offset: Point2D::new... |
#![cfg_attr(not(feature = "std"), no_std)]
use liquid::storage;
use liquid_lang as liquid;
use liquid_lang::InOut;
use liquid_prelude::{string::String, vec::Vec};
#[derive(InOut)]
pub struct TableInfo {
key_column: String,
value_columns: Vec<String>,
}
#[liquid::interface(name = auto)]
mod table_manager {
... |
use amethyst::core::{Named, Parent};
use amethyst::ecs::prelude::*;
use amethyst_editor_sync::SerializableEntity;
pub use self::biped_entities::*;
pub use self::revolver_entities::*;
mod biped_entities;
mod revolver_entities;
/// Finds the first entity named `name` in the hierarchy starting with `entity`.
///
/// Pe... |
use dex::Dex;
use memmap::Mmap;
pub struct DexFileStats {
pub class_count: usize,
pub defined_method_count: usize,
pub referenced_method_count: usize,
}
impl DexFileStats {
pub fn create(dex: Dex<Mmap>) -> DexFileStats {
let mut class_count = 0;
let mut defined_method_count = 0;
... |
pub mod stdio;
pub mod mem; |
pub mod assets;
|
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
use crate::{
group::Group,
keypair::{KeyPair, SignalKeyPair, SizedBytes},
opaque::*,
rkr_encryption::{RKRCipher as _, RKRC... |
use std::collections::HashMap;
use std::hash::Hash;
use crate::swapping::{Swapper, SWAPPER_DEFAULT_CAPACITY};
use crate::utils::deque::{Deque, Node, NonNullLink};
pub struct LruSwapper<T> {
list: Deque<T>,
hash: HashMap<T, NonNullLink<T>>,
capacity: usize,
}
impl<T: Hash + Eq + Copy> Default for LruSwapp... |
use amethyst::{
{GameDataBuilder, Application},
utils::application_root_dir,
core::TransformBundle,
renderer::{RenderingBundle, RenderToWindow, RenderFlat2D, types::DefaultBackend},
};
use crate::bundle::GameBundle;
use crate::state::game::Game;
use crate::state::title::Title;
use amethyst::ui::{Render... |
use consts::SHUTDOWN;
use specs::*;
use types::*;
use std::sync::atomic::Ordering;
use std::time::{Duration, Instant};
use protocol::server::ServerMessage;
use protocol::ServerMessageType;
use protocol::{to_bytes, ServerPacket};
use websocket::OwnedMessage;
use std::process;
#[derive(Default)]
pub struct SignalHand... |
#[doc = "Reader of register INTR_MASKED"]
pub type R = crate::R<u32, super::INTR_MASKED>;
#[doc = "Reader of field `TIMER_EXPIRED`"]
pub type TIMER_EXPIRED_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - Logical and of corresponding request and mask fields."]
#[inline(always)]
pub fn timer_expired(&self... |
use std::collections::HashMap;
pub fn arith_series_sum(lower_limit: usize, upper_limit: usize, step: usize) -> usize {
let first_element = lower_limit + (step - (lower_limit % step));
let last_element = (upper_limit - 1) - ((upper_limit - 1) % step);
let number_of_elements = ((last_element - first_element) ... |
use crate::mode::Mode;
use crate::PageSpec;
use observer::prelude::*;
use serde::ser::{Serialize, SerializeStructVariant, Serializer};
pub enum Response {
Http(http::response::Response<Vec<u8>>),
Page(PageSpec),
}
#[observed(with_result, namespace = "realm__response")]
pub fn json<T, UD>(in_: &crate::base::In... |
#[doc = "Reader of register TIMx_AF1"]
pub type R = crate::R<u32, super::TIMX_AF1>;
#[doc = "Writer for register TIMx_AF1"]
pub type W = crate::W<u32, super::TIMX_AF1>;
#[doc = "Register TIMx_AF1 `reset()`'s with value 0x01"]
impl crate::ResetValue for super::TIMX_AF1 {
type Type = u32;
#[inline(always)]
fn... |
mod sender;
use actix_web::HttpResponse;
use drogue_client::{registry, Translator};
use drogue_cloud_endpoint_common::{
error::HttpEndpointError,
sender::{Publish, PublishOptions, Publisher, UpstreamSender},
sink::Sink,
};
use serde::Deserialize;
#[derive(Deserialize)]
pub struct CommandOptions {
pub ... |
use crate::{fragment::Bounds, util, Cell, Point};
use nalgebra::Point2;
use parry2d::shape::{ConvexPolygon, Polyline};
use std::{
cmp::Ordering,
fmt,
hash::{Hash, Hasher},
};
use sauron::{
html::attributes::*,
svg::{attributes::*, *},
Node,
};
/// TODO: Add an is_broken field when there is a p... |
use failure::Fail;
#[derive(Debug, Fail)]
pub enum Ja3Error {
#[fail(display = "Not a TLS handshake packet")]
NotHandshake,
#[fail(display = "Parsing error")]
ParseError,
}
|
mod encoded;
mod hdrval;
pub use self::encoded::Encoded;
pub use self::hdrval::HdrVal;
|
#![allow(non_snake_case)]
#![allow(dead_code)]
//! Module for Board and BoardBuilder structs
//!
//! Use [BoardBuilder](struct.BoardBuilder.html) struct to initialize the [Board](struct.Board.html) struct,
//! and use [Board](struct.Board.html) struct to manipulate GPIO Pins.
use crate::mailbox;
use libc;
use std::... |
// Problem 22 - Names scores
//
// Using "../resources/p022_names.txt", a 46K text file containing over
// five-thousand first names, begin by sorting it into alphabetical order.
// Then working out the alphabetical value for each name, multiply this value by
// its alphabetical position in the list to obtain a name sc... |
use super::SelectionPhase::{Exploitation, Exploration, Initial};
use super::*;
use crate::helpers::models::domain::*;
use crate::utils::Timer;
fn create_rosomaxa(rebalance_memory: usize) -> Rosomaxa {
let mut config = RosomaxaConfig::new_with_defaults(4);
config.rebalance_memory = rebalance_memory;
Rosoma... |
/// An enum to represent all characters in the TangutComponents block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum TangutComponents {
/// \u{18800}: '𘠀'
TangutComponentDash001,
/// \u{18801}: '𘠁'
TangutComponentDash002,
/// \u{18802}: '𘠂'
TangutComponentDash003,
/// \u{18... |
use std::mem;
use wasmer_runtime_core::{
types::{Type, WasmExternType},
vm::Ctx,
};
#[repr(transparent)]
#[derive(Copy, Clone)]
pub struct VarArgs {
pub pointer: u32, // assuming 32bit wasm
}
impl VarArgs {
pub fn get<T: Sized>(&mut self, ctx: &mut Ctx) -> T {
let ptr = emscripten_memory_point... |
// My first rustlang project
// Rustlang primitive types
// boolean -- bool -- true, false
// numbers -- ix, -- x = 8, 16, 32, 64 (integers) [ux for unsigned]
// floating numbers -- fx -- x = 32, 64
// arrays -- [T;nbr] -- nbr is a compile time constant
// slices -- &[T] -- &a[..] --> a slice containing all the elemen... |
use airhobot::prelude::*;
use cv::gui::*;
use env_logger::{Builder, Env};
use log::*;
use std::{
env, error,
net::UdpSocket,
sync::{Arc, Mutex},
time::Duration,
};
fn main() -> std::result::Result<(), Box<dyn error::Error>> {
Builder::from_env(Env::default().default_filter_or("info")).init();
... |
use crate::hittable::{HitRecord, Hittable};
use crate::material::Material;
use crate::ray::Ray;
use crate::vec3::Point3;
use crate::Num;
use std::ops::Range;
#[derive(Clone, Copy)]
pub struct Sphere {
center: Point3,
radius: Num,
mat: Material,
}
impl Sphere {
pub(crate) fn new(center: Point3, radius:... |
use crate::renderer::Ray;
use glam::{Vec3, Vec3A};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct Sphere {
pub position: Vec3,
pub radius: f32,
pub diffuse: Vec3,
pub specular: Vec3,
pub ambient: Vec3,
pub mirror: bool,
}
#[derive(Debug, Deserialize)]
pub struct Quad {
pu... |
use std::fs;
type InfiniteImg = (Vec<Vec<char>>, bool);
fn main() {
let filename = "input/input.txt";
let (enhancement_algorithm, img) = parse_input_file(filename);
let enhancement_algo_slice = enhancement_algorithm.as_slice();
// println!("enhancement_algorithm: {:?}", enhancement_algorithm);
//... |
//! provides access to general purpose registers (GPRs)
/// refers to a GPR
pub trait GeneralPurposeRegister {
const ID: u32;
}
macro_rules! define_gpr {
($name: ident, $id: expr, $doc_name: expr, $doc_id: expr) => {
#[allow(non_camel_case_types)]
#[doc = "register"]
#[doc = $doc_id]
... |
#[macro_use]
extern crate trackable;
use clap::Parser;
use fibers_transport::UdpTransporter;
use futures::Future;
use rustun::channel::Channel;
use rustun::client::Client;
use rustun::message::Request;
use rustun::transport::StunUdpTransporter;
use rustun::Error;
use std::net::ToSocketAddrs;
use stun_codec::rfc5389;
u... |
mod block_relayer;
pub use block_relayer::BlockRelayer;
|
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_659"
#[allow(unused)]
use super::rsass;
// From "sass-spec/spec/libsass-closed-issues/issue_659/issue_659.hrx"
#[test]
fn issue_659() {
assert_eq!(
rsass(
"// libsass issue 659: never output empty blocks\
\n//... |
mod moebius_instruction;
mod moebius_state;
use proc_macro::TokenStream;
use syn::parse_macro_input;
use crate::{moebius_instruction::MoebiusInstruction, moebius_state::MoebiusState};
#[proc_macro_attribute]
pub fn moebius_state(attr: TokenStream, item: TokenStream) -> TokenStream {
let _ = attr;
let state =... |
extern crate rand;
extern crate rmp_serde;
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::Arc;
use futures::channel::mpsc::unbounded;
use futures::future::{lazy, FutureExt, LocalBoxFuture};
use rand::seq::SliceRandom;
use super::genesis::{build_node_transaction_map, build_verifiers, PoolTransactions}... |
pub mod ep0r {
pub mod ea {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40005C00u32 as *const u32) & 0xF
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40005C00u32 as *const u32);... |
// Copyright (c) 2018, ilammy
//
// Licensed under the Apache License, Version 2.0 (see LICENSE in the
// root directory). This file may be copied, distributed, and modified
// only in accordance with the terms specified by the license.
extern crate exonum;
extern crate exonum_legislation as legislation;
#[macro_use]
... |
pub mod algorithm;
pub mod utils;
pub mod custom_ga; |
use crate::BoxedErrorResult;
use crate::constants;
use crate::filesystem;
use crate::globals;
use crate::heartbeat;
use crate::operation::*;
use std::collections::HashMap;
use std::future::Future;
use std::fs::{self, File, OpenOptions};
use std::io::{self, Write};
use std::net::{Ipv4Addr, UdpSocket};
use std::str::From... |
use super::{
create_array, extract_type_from_pointer, AnnotatedFunction, AnnotatedFunctionMap, BasicBlock,
CodegenError, CodegenResult, Compiler, Context, Function, FunctionType, LLVMInstruction,
Object, Scope, Token, Type,
};
use llvm_sys::core::*;
pub fn build_functions(
compiler: &mut Compiler,
... |
use diesel::r2d2;
use diesel::pg::PgConnection;
use dotenv::dotenv;
use std::env;
use std::thread;
fn main() {
dotenv().ok();
let manager: r2d2::ConnectionManager<PgConnection> = r2d2::ConnectionManager::new(env::var("DATABASE_URL").unwrap());
let pool = r2d2::Pool::builder()
.max_size(15)
... |
use std::{collections::HashMap, env};
fn main() -> Result<(), std::io::Error> {
let mut abi = HashMap::new();
let contract_abi = <contract::__LIQUID_ABI_GEN as liquid_lang::GenerateAbi>::generate_abi();
let mut local_abi =
Vec::with_capacity(contract_abi.event_abis.len() + contract_abi.fn_abis.le... |
fn prime(v: u64) -> bool {
!(2..).take_while(|x| x * x <= v).any(|x| v % x == 0)
}
fn digits_match(mut s: u64, mut b: u64) -> bool {
let sdigits = std::iter::from_fn(move || {
if s == 0 {
None
} else {
let digit = s % 10;
s = s / 10;
Some(digit)
... |
use crate::msg::adc_msg::AdcMsg;
use crate::msg::adc_msg::CtrlParam;
use crate::msg::adc_msg::XGbeIdParam;
use crate::msg::snap2_msg::AppParam;
use crate::msg::snap2_msg::Snap2Msg;
use crate::msg::snap2_msg::XGbePortOp;
use crate::msg::snap2_msg::XGbePortParam;
use crate::net::send_adc_msg;
use crate::net::send_udp_buf... |
// Copyright 2019 Steven Bosnick
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE-2.0 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 according... |
use crate::utils::get_fl_name;
use proc_macro::TokenStream;
use quote::*;
use syn::*;
pub fn impl_menu_trait(ast: &DeriveInput) -> TokenStream {
let name = &ast.ident;
let name_str = get_fl_name(name.to_string());
let ptr_name = Ident::new(name_str.as_str(), name.span());
let add = Ident::new(format!("... |
use crate::utils::file2vec;
pub fn day12(filename: &String){
let contents = file2vec::<String>(filename);
let contents:Vec<String> = contents.iter().map(|x| x.to_owned().unwrap()).collect();
let mut pos = Position::start();
for act in &contents {
let action = Action::from_str(&act);
... |
use super::super::context::{Args, Context, ParentOrRoot, RootContext};
use super::super::error::{CrawlErrorKind, CrawlResult};
use super::super::utils::station_fn_ctx2;
use super::super::utils::{WorkArcWrapper, WorkBoxWrapper};
use super::super::work::{Work, WorkBox, WorkOutput, Worker};
use super::flow_description::*;... |
#![warn(clippy::all)]
use std::io;
use std::io::Read;
use std::net::IpAddr;
use std::net::Ipv4Addr;
use std::net::SocketAddr;
use tit::print_tcp_key;
use tit::start_nic;
use tit::Tcp;
use tit::TcpListener;
use tit::TitError;
const LISTEN_ON_IP: Ipv4Addr = Ipv4Addr::UNSPECIFIED;
// const LISTEN_ON_IP: Ipv4Addr = Ipv4... |
pub mod chip8;
#[cfg(target_arch = "wasm32")]
pub mod wasm_bindings;
|
pub fn longest_common_prefix(strs: Vec<&str>) -> String {
// for w in strs.windows(2) {
// w[0];
// w[1];
// }
strs.iter().skip(1).fold(strs[0].to_string(), |acc, el| {
acc.chars()
.zip(el.chars())
.take_while(|(a, b)| a == b)
.map(|(a, _)| a)
... |
use nalgebra::{DMatrix, Dynamic, MatrixXx1, U1};
use rand::prelude::*;
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::path::Path;
struct MnistDataset {
records: Vec<MnistRecord>,
}
struct MnistRecord {
target: usize,
targets: Vec<f32>,
inputs: Vec... |
//! Data shared between the state::server module files, but hidden to users of the module.
use std::sync::{ Arc, Mutex };
use std::sync::mpsc::{ Receiver, Sender };
use protocol;
/// Shorthand for the type of the UserList (a reference-counted mutex around some list.)
pub type UserList = Arc<Mutex<Vec<String>>>;
/... |
#[cfg(test)]
#[path = "../../../tests/unit/algorithms/gsom/network_test.rs"]
mod network_test;
use super::*;
use crate::utils::parallel_into_collect;
use hashbrown::HashMap;
use rand::prelude::SliceRandom;
use std::cmp::Ordering;
use std::ops::Deref;
use std::sync::{Arc, RwLock};
/// A customized Growing Self Organiz... |
pub trait TerminalSymbol {
type SymbolLiteral: PartialEq;
fn contains(literal: Self::SymbolLiteral) -> bool;
fn from_literal(literal: Self::SymbolLiteral) -> Self;
fn to_literal(&self) -> Self::SymbolLiteral;
fn is_literal(&self, literal: Self::SymbolLiteral) -> bool {
self.to_literal() == ... |
use clap::App;
use clap::Arg;
use clap::ArgMatches;
use clap::SubCommand;
use crate::client::html_client::Client;
use crate::model::Id;
use crate::cli::HnCommand;
use crate::error::HnError;
pub struct Query;
impl HnCommand for Query {
const NAME: &'static str = "query";
fn parser<'a, 'b>() -> App<'a, 'b> {
... |
use std::collections::HashSet;
/*
AOC 2018
Day 1 - Part 1 : 592
generator: 12.666µs,
runner: 34.021µs
Day 1 - Part 2 - set : 241
generator: 260ns,
runner: 27.686372ms
Day 1 - Part 2 - vec : 241
generator: 657ns,
runner: 2.242261429s
*/
#[aoc(day1, part1)]
pub fn part1... |
use std::{collections::HashMap, sync::Mutex};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use tracing::{info, instrument, warn};
// funtranslations is very rate limited and slow so I've opted to use an in memory cache.
// In a production API I would buy an API key for funtranslations because even ... |
use sdl2::image::InitFlag;
use sdl2::event::Event;
use sdl2::pixels::Color;
use sdl2::image::LoadTexture;
pub struct Display {
// Private field
event_pump: sdl2::EventPump,
// Accessible field
pub texture_creator: sdl2::render::TextureCreator<sdl2::video::WindowContext>,
pub canvas: sdl2::render::C... |
extern crate arith;
use arith::{parse, eval};
fn main() {
let program = parse("if iszero pred succ 0 then succ succ pred 0 else false");
match program {
Ok(term) => {
println!("Source program: {}", term);
println!("Evaluated program: {}", eval(&term));
}
Err... |
//! Functions used for encrypting and decrypting data using XOR.
use utils::data::Data;
/// XORs the given data with a repeating key.
pub fn xor(data: &Data, key: &Data) -> Data {
// Create a new vector to store the resulting bytes in.
let mut bytes = Vec::with_capacity(data.len());
// Repeatedly loop o... |
mod parser;
mod code_writer;
use parser::CommandType;
use crate::parser::Parser;
use crate::code_writer::CodeWriter;
fn main() {
let input_file_path = "../MemoryAccess/StaticTest/StaticTest.vm";
let output_file_path = "../MemoryAccess/StaticTest/StaticTest.asm";
// let input_file_path = "../StackArithmet... |
extern crate libc;
use std;
use std::ffi::CString;
use self::libc::c_int;
use self::libc::c_char;
use self::libc::c_uint;
enum QtHandle {}
#[link(name="qt5rust")]
extern {
fn qapplication_new(argc: c_int, argv: *mut *mut c_char) -> *mut QtHandle;
fn qapplication_exec(this: *mut QtHandle) -> c_int;
fn ... |
mod common;
mod days;
mod points;
fn main() {
for day in days::all_numbers() {
if let Some(solver) = days::get_solver(day) {
let input = common::get_day_input(day).expect(&format!(
"Problem occured while getting input for day{:02}",
day
));
... |
// Copyright 2019, 2020 Wingchain
//
// 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... |
// #![feature(bool_to_option)]
pub mod client;
#[macro_use]
mod macros;
pub mod models;
mod query_variables;
mod utils;
|
use std::collections::HashMap;
use rand::seq::SliceRandom;
use rand::Rng;
use crate::config;
use crate::neatns::network::genome::Genome;
use crate::neatns::network::link::Link;
use crate::neatns::network::node::{Node, NodeRef};
use crate::neatns::network::{activation, connection, order};
#[derive(Clone)]
pub struct ... |
use anyhow::Error;
use serde_derive::Deserialize;
use yew::{
format::{Json, Nothing},
html,
services::{
fetch::{FetchTask, Request, Response},
FetchService,
},
Component, ComponentLink, InputData,
};
#[derive(Deserialize)]
struct Cep {
cep: String,
logradouro: String,
co... |
use simple_error::bail;
use evmap;
use evmap::{ReadHandle, WriteHandle};
use std::error;
use std::io;
use std::io::BufRead;
use std::sync::mpsc;
use std::thread;
use crate::day;
pub type BoxResult<T> = Result<T, Box<dyn error::Error>>;
struct Intcode {
p: Vec<i64>,
base: i64,
}
impl Intcode {
fn new(p: &... |
#[no_mangle]
pub extern "C" fn what_have_we_here() -> i32 {
leaf::HOW_MANY * leaf::HOW_MANY
}
|
//! Parse OpenLibrary JSON.
use std::str::FromStr;
use log::*;
use serde::de;
use serde::Deserialize;
use thiserror::Error;
use crate::tsv::split_first;
/// Struct representing a row of the OpenLibrary dump file.
///
/// The row extracts the key and record, deserializing the record from JSON to the
/// appropriate t... |
// (Full example with detailed comments in examples/01a_quick_example.rs)
//
// This example demonstrates clap's "builder pattern" method of creating arguments
// which the most flexible, but also most verbose.
use clap::{Arg, App};
fn main() {
let matches = App::new("My Super Program")
.version("1.0")
... |
pub mod bitvec;
mod chunked_vec;
pub use crate::chunked_vec::ChunkedVecInt as ChunkedVecInt;
|
use super::auto::{HasInner, Spawnable, Abstract};
use super::clickable::{Clickable, ClickableInner};
use super::control::{AControl, Control, ControlInner};
use super::has_label::{HasLabel, HasLabelInner};
use super::member::{AMember, Member};
define! {
Button: Control + Clickable + HasLabel {
constructor: ... |
#[cfg(test)]
mod tests {
use lib::get_max_range;
#[test]
fn test_get_max_range() {
let array: [i32; 7] = [-15, 110, 78, 32, -45, 120, -50];
assert_eq!(get_max_range(&array), 170);
let array: [i32; 7] = [0, 1, -2, 0, 3, 2, 5];
assert_eq!(get_max_range(&array), 7);
}
... |
use super::float_eq;
use std::default::Default;
use std::fmt;
use std::ops;
use tuples::Tuple;
#[derive(Copy, Clone, Debug)]
pub struct Matrix2 {
pub rows: [[f32; 2]; 2],
}
impl PartialEq for Matrix2 {
fn eq(&self, other: &Matrix2) -> bool {
for row in 0..2 {
for col in 0..2 {
... |
/// Random links on macro invocation
///
/// <https://github.com/rust-lang/rfcs/blob/master/text/0378-expr-macros.md>
/// discussion
/// <https://users.rust-lang.org/t/braces-square-brackets-and-parentheses-in-macro-call/9984/4>
///
#[macro_export]
macro_rules! vec {
// moo
( $( $x:expr ),* ) => {
{
let... |
use std::fs;
use crate::wiifs;
pub mod read {
pub struct ReadInfo {
current_node: u32,
string_table: Option<String>
}
#[allow(dead_code)]
impl ReadInfo {
pub fn new() -> ReadInfo {
ReadInfo {
current_node: 1,
string_table: ... |
use std::fs::File;
use std::io::prelude::*;
extern crate protobuf;
use protobuf::Message;
mod protos;
use protos::payload::{CreateProgramAction,ProgramPayload, ProgramPayload_Action};
fn main() -> std::io::Result<()>{
let mut buffer = File::create("payload").unwrap();
let payload: ProgramPayload = create_progr... |
//! Console version of picross.
#![deny(missing_docs)]
use crate::cell::SimpleCell;
use itertools::Itertools;
use pancurses::{
curs_set, endwin, init_pair, initscr, noecho, start_color, Input, COLOR_BLACK, COLOR_GREEN, COLOR_PAIR, COLOR_WHITE,
};
use picore::{constraints, Cell, Picross, Puzzle};
use std::collecti... |
extern crate rocksdb;
mod aggregates;
mod error;
mod filters;
pub mod index;
mod json_shred;
pub mod json_value;
mod key_builder;
mod parser;
pub mod query;
pub mod repl;
mod returnable;
mod snapshot;
mod stems;
|
fn main() {
let digits: u32 = 8;
gen(digits);
}
// fn read_from_file() -> u32 {
// let mut file = File::open("output.txt").expect("Unable to open file");
// let buffer = BufReader::new(file);
// let mut res: u32 = 0;
// for line in buffer.lines() {
// let num: u32 = lin... |
use std::fmt;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use base64::encode;
#[derive(Debug, Clone)]
pub enum ChasmError {
InvalidCommitRequest,
InvalidCommitJSON,
FilenameMissing,
PostfolderMissing,
ImageDataMissing,
RepoMissing,
AccessTokenMissing,
}
impl fmt::D... |
#[macro_use]
extern crate rbatis;
pub mod model;
use crate::model::{init_db, BizActivity};
use rbatis::rbdc::datetime::FastDateTime;
use rbatis::sql::page::PageRequest;
use rbs::Value;
//crud!(BizActivity {},"biz_activity");//custom table name
//impl_select!(BizActivity{select_all_by_id(table_name:&str,id:&str) => "`... |
use std::fmt;
#[derive(Default, Debug, PartialEq)]
pub struct Filter {
pub name: Option<String>,
pub domain: Option<String>,
pub stype: Option<String>,
pub protocol: Option<String>,
pub port: Option<u16>,
}
impl Filter {
pub fn new() -> Filter {
Filter {
..Default::default()
... |
use std::net::SocketAddr;
use std::default::Default;
use std::convert::{TryFrom, TryInto};
use url::{Url, ParseError};
#[derive(Debug, PartialEq, Clone)]
pub struct Credential {
name: String,
password: String
}
#[derive(Debug, PartialEq, Clone)]
pub struct Host {
target: SocketAddr,
vhost: String,
... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
use q... |
/*
* Copyright Stalwart Labs Ltd. See the COPYING
* file at the top-level directory of this distribution.
*
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
* https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
* <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
* optio... |
// This crate implements ECVRF based on the Edwards25519 elliptic curve. The
// code is based on section 5 of draft-irtf-cfrg-vrf-15 (version 15):
// https://datatracker.ietf.org/doc/draft-irtf-cfrg-vrf/
//
// The cipher suite is ECVRF-EDWARDS25519-SHA512-ELL2 (4), but the method for
// ciphersuite ECVRF-EDWARDS25519-... |
#[cfg(test)]
pub fn runner(tests: &[&dyn Fn()]) {
use crate::*;
println!("Running Tests");
for test in tests {
test();
println!("... Ok");
}
}
|
#[doc = "Reader of register BUILD_CONFIG"]
pub type R = crate::R<u32, super::BUILD_CONFIG>;
#[doc = "Writer for register BUILD_CONFIG"]
pub type W = crate::W<u32, super::BUILD_CONFIG>;
#[doc = "Register BUILD_CONFIG `reset()`'s with value 0x0100_1f08"]
impl crate::ResetValue for super::BUILD_CONFIG {
type Type = u3... |
use std::path::PathBuf;
use cli_integration_test::IntegrationTestEnvironment;
use predicates::prelude::Predicate;
use predicates::str::contains;
use short::cli::terminal::emoji::RIGHT_POINTER;
use short::BIN_NAME;
use test_utils::init;
use test_utils::{
HOME_CFG_FILE, PRIVATE_ENV_DEV_FILE, PRIVATE_ENV_DIR, PROJEC... |
use wasm_bindgen::prelude::*;
use wasm_bindgen::convert::{OptionIntoWasmAbi, IntoWasmAbi, FromWasmAbi};
use crate::bigint_256::{self, WasmBigInteger256};
use algebra::biginteger::BigInteger256;
use algebra::{ToBytes, FromBytes};
use mina_curves::pasta::fp::{Fp, FpParameters as Fp_params};
use algebra::{
fields::{Fi... |
#[doc = "Register `ETH_DMAA4TxACR` reader"]
pub type R = crate::R<ETH_DMAA4TX_ACR_SPEC>;
#[doc = "Register `ETH_DMAA4TxACR` writer"]
pub type W = crate::W<ETH_DMAA4TX_ACR_SPEC>;
#[doc = "Field `TDRC` reader - TDRC"]
pub type TDRC_R = crate::FieldReader;
#[doc = "Field `TDRC` writer - TDRC"]
pub type TDRC_W<'a, REG, con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.