text stringlengths 3.09k 13.9k |
|---|
use futures::FutureExt;
use std::marker::PhantomData;
use std::sync::Arc;
use foundationdb::{
future::FdbSlice, tuple::Subspace, Database, FdbError, FdbResult, TransactOption,
};
use super::serializers::UpstreamSerializer;
use super::traits::ToPrimaryKey;
use crate::{
CommitToUpstream, DataCommitRequest, Data... |
//! The `ExportedFunction` and relative collection that encapsulate Wasmer
//! memory and instances.
use super::inspect::InspectExportedFunction;
use crate::value::Value;
use pyo3::{
class::basic::PyObjectProtocol,
exceptions::{LookupError, RuntimeError},
prelude::*,
types::{PyFloat, PyLong, PyTuple},... |
//! Contains methods and types which are useful for logging
use std::fs::File;
use std::io::{BufRead, BufReader, Read};
use std::path::Path;
use crate::types::combined_position_orientation_array_to_isometry;
use crate::{BodyId, Error, Velocity};
use nalgebra::{DVector, Isometry3, Vector6};
use std::convert::TryInto;
u... |
use crate::core::{context, error, message};
use crate::custom::jwt;
use redis::AsyncCommands;
use rsa::{pkcs8::ToPrivateKey, pkcs8::ToPublicKey};
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Claims {
pub sub: String,
pub exp: usize,
pub ajd: jwt::AdditionalData, /* Additional J... |
use errors::*;
use utils::PtValue;
use bbox::Bbox;
use rulinalg::matrix::Matrix;
use rulinalg::vector::Vector;
use num_traits::{Float, Zero, FromPrimitive};
#[derive(Debug, Clone)]
pub struct Rbf<'a, T: 'a> {
obs_points: &'a [PtValue<T>],
weights: Vector<T>,
distance_function: fn(T, T) -> T,
epsilon: ... |
type Grid = [i32; GRID_SIZE * GRID_SIZE];
const GRID_SIZE: usize = 300;
fn get_index(x: usize, y: usize) -> usize {
y * GRID_SIZE + x
}
// def get_index(x: int, y: int) -> int:
// return y * GRID_SIZE + x
fn calculate_power_level(x: usize, y: usize, serial_number: i32) -> i32 {
let x = x as i32;
let ... |
use crate::parse::flag::{Flag, FlagKind};
use crate::parse::number::RawNumber;
use crate::parse::operator::EvaluationOperator;
use crate::parse::token_tree::{Delimiter, SpannedToken, Token};
use nu_protocol::ShellTypeName;
use nu_source::{DebugDocBuilder, HasSpan, PrettyDebug, Span, Spanned, SpannedItem, Text};
#[deri... |
//! A simple example that demonstrates using carbide within a basic `winit` window loop, using
//! `glium` to render the `carbide_core::render::Primitives` to screen.
#[macro_use]
extern crate carbide_core;
extern crate carbide_glium;
#[macro_use]
extern crate carbide_winit;
extern crate glium;
extern crate uuid;
use... |
//! Module testing that the library can verify JWTs in WASM.
#![no_std]
extern crate alloc;
use chrono::Duration;
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
use alloc::string::{String, ToString};
use core::{convert::TryFrom, fmt};
use jwt_compact::{
alg::{Ed25519, Es256k, Hs256, Hs384, ... |
use quicli::prelude::CliResult;
use std::path::{Path, PathBuf};
use structopt::StructOpt;
use crate2nix::render;
use failure::format_err;
use failure::{bail, Error};
use serde::Deserialize;
use serde::Serialize;
use std::str::FromStr;
const DEFAULT_OUTPUT: &str = "./Cargo.nix";
#[derive(Debug, StructOpt, Deserialize... |
use crate::conv_req::convert_req;
use crate::Options;
use actix_web::{http::StatusCode, web, HttpRequest, HttpResponse};
use fmterr::fmt_err;
use perseus::error_pages::ErrorPageData;
use perseus::html_shell::interpolate_page_data;
use perseus::router::{match_route, RouteInfo, RouteVerdict};
use perseus::{
err_to_st... |
use std::{convert::From, env, fmt};
use std::io::{self, BufRead, Error as IOError};
use base64::{self, decode_config_slice as base64_decode};
use rusqlite::{Connection, Error as SQLiteError, Statement, ToSql, NO_PARAMS};
use serde::{Deserialize, Deserializer, de::Error as _};
use serde_json::Error as JSONError;
// A u... |
pub use crate::traits::access_control::*;
use brush::{
declare_storage_trait,
modifier_definition,
modifiers,
traits::AccountId,
};
pub use derive::AccessControlStorage;
use ink_storage::{
traits::{
SpreadAllocate,
SpreadLayout,
},
Mapping,
};
#[cfg(feature = "std")]
use ink... |
extern crate tokio;
extern crate futures;
use std::env;
use std::io;
use std::net::SocketAddr;
use std::collections::HashMap;
use futures::{Future, Stream, Sink};
use futures::sync::mpsc::{UnboundedSender, unbounded};
use redis_asio::{RedisResult, RedisValue, RedisError, RedisErrorKind, FromRedisValue, from_redis_val... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use super::*;
use crate::prelude::*;
use anyhow::Error;
use futures::channel::oneshot;
use futures::sink::Sink;
use parking_lot::Mutex;
use std::sync::Arc... |
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate getopts;
extern crate smoltcp;
extern crate byteorder;
mod utils;
use std::str::FromStr;
use std::collections::BTreeMap;
use std::cmp;
use std::os::unix::io::AsRawFd;
use smoltcp::time::{Duration, Instant};
use smoltcp::phy::Device;
use smoltcp::phy... |
//! Persistent HashMap used for caching previous scan results.
use crate::output::p2s;
use fnv::FnvHashMap;
use nix::fcntl;
use rmp_serde::{decode, encode};
use serde::{Deserialize, Serialize};
use std::fs;
use std::io;
use std::io::prelude::*;
use std::ops::{Deref, DerefMut};
use std::os::unix::prelude::*;
use std::p... |
use std::time::Instant;
use std::fs::File;
use std::io::{self, BufRead};
use std::usize;
use std::borrow::Borrow;
fn main() {
//let start = Instant::now();
//println!("The first answer is {}", day9_1_result("./input"));
//let duration = Instant::now() - start;
//println!("how quick, this quick: {} μs",... |
/*!
In this module, there're implementations & tests of `Publisher`
*/
use common::{Observable, RawFunc, Subscription, SubscriptionFunc, UniqueId};
use handler::Handler;
use std::marker::PhantomData;
use std::sync::{Arc, Mutex};
/**
The `Publisher` implements *PubSub-like* features.
# Arguments
* `X` - The generic t... |
// Copyright © 2016 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribu... |
use std::io::Read;
use crate::util::{fill_buf, latin1_decode, read_byte};
use crate::{
Event, MetaCommand, MetaEvent, MidiMessage, SMFError, SMFFormat, Track, TrackEvent, SMF,
};
/// An SMFReader can parse a byte stream into an SMF
#[derive(Clone, Copy)]
pub struct SMFReader;
impl SMFReader {
fn parse_header... |
//! Provides a set of tools convert raw packets from Ouster sensors.
use super::{
config::Config,
consts::COLUMNS_PER_PACKET,
packet::{Column, Packet},
pcd_converter::{Point, PointCloudConverter},
};
use crate::common::*;
/// A frame is a collection of points gathered in one
/// LIDAR rotation.
#[deri... |
use crate::format::PantraceFormat;
use crate::TracerouteReply;
use chrono::{Duration, TimeZone, Utc};
use deku::DekuContainerWrite;
use std::net::Ipv6Addr;
use std::ops::{Add, Sub};
use warts::{Address, Object, Timeval, TraceProbe, TraceStopReason, TraceType, Traceroute};
impl PantraceFormat for Traceroute {
fn fr... |
use std::fs::File;
use std::io::{Read, Write};
use io_device::IODevice;
pub struct Catridge {
rom: Vec<u8>,
ram: Vec<u8>,
#[allow(dead_code)]
mbc_type: u8,
ram_enable: bool,
bank_no_upper: u8,
bank_no_lower: u8,
num_rom_banks: u8,
mode: bool,
}
impl Catridge {
pub fn new(fname... |
// Copyright 2017, 2018 Parity Technologies
//
// 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... |
use crate::error::TraceResult;
use crate::ssh::SshClient;
use regex::Regex;
use std::cell::RefCell;
use std::net::{IpAddr, SocketAddr};
const CIRPACK_PROCESSES: &[&str] = &[
"ibcf",
"bgcf",
"gw_sip",
"imstscfg",
"hactrl",
"stup",
"s7pnumcfg",
"goblin",
"goblout",
"transit",
... |
#[doc = "Register `P6IV` reader"]
pub struct R(crate::R<P6IV_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<P6IV_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::convert::From<crate::R<P6IV_SPEC>> for R {
fn from(reader: crate::R<P6IV_SPEC>) ->... |
// SPDX-License-Identifier: ISC
extern crate regex;
extern crate walkdir;
#[macro_use]
extern crate lazy_static;
use std::env;
use std::cmp::Ordering;
use std::fs::{File, read_dir};
use std::path::{Path, PathBuf};
use std::collections::{HashMap, HashSet};
use std::io::{BufReader, BufRead};
use regex::{Regex, RegexSet}... |
use core::mem;
// Used to identify a register number. No register type exceeds 255 registers.
type IRQRegNum = usize;
// Used to identify a byte offset in a 32 bit register.
type IRQRegByte = usize;
// Enumerate each of the GIC Distributor registers that are word-accessible
#[derive(Debug)]
#[allow(non_camel_case_t... |
#[macro_use]
extern crate rustful;
use std::sync::RwLock;
use std::error::Error;
use rustful::{Server, TreeRouter, Context, Response, Log, Handler};
use rustful::filter::{FilterContext, ResponseFilter, ResponseAction, ContextFilter, ContextAction};
use rustful::response::Data;
use rustful::StatusCode;
use rustful::he... |
#[macro_use]
extern crate log;
use std::ops::Deref;
use std::str::FromStr;
use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult, Testable};
use rand::prelude::*;
use pattern_based_deobfuscator::keystone_assemble;
use pattern_based_deobfuscator::pattern::*;
#[cfg(debug_assertions)]
const QUICKCHECK_TESTS: u64 = 1... |
//! Utility functions.
use std::{
collections::BTreeMap,
ffi::CString,
fs::{self, File},
io::{self, BufReader},
mem, slice,
str::FromStr,
};
use crate::generated::{TC_H_MAJ_MASK, TC_H_MIN_MASK};
use libc::{if_nametoindex, sysconf, _SC_PAGESIZE};
use io::BufRead;
const ONLINE_CPUS: &str = "/s... |
//!
//! The function definition statement.
//!
use inkwell::types::BasicType;
use crate::yul::lexer::lexeme::symbol::Symbol;
use crate::yul::lexer::lexeme::Lexeme;
use crate::yul::lexer::Lexer;
use crate::yul::parser::identifier::Identifier;
use crate::yul::parser::statement::block::Block;
///
/// The function defin... |
use std::convert::{TryFrom, TryInto};
#[derive(Debug, Eq, PartialEq)]
pub enum Diff {
Insert { index: usize },
Delete { index: usize },
}
pub fn diff<T: Eq>(old: &[T], new: &[T]) -> Vec<Diff> {
let mut diff = Vec::new();
diff_impl(&mut diff, old, new, 0, 0);
diff
}
fn diff_impl<T: Eq>(
diff: ... |
use argh::FromArgs;
use std::env;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::path;
use std::path::PathBuf;
use std::process::exit;
use subprocess::{Exec, ExitStatus};
use chwd::ChangeWorkingDirectory;
#[derive(FromArgs)]
/// Harness the power of Grumpy to automate standard project creation and mainte... |
extern crate couchbase_lite_c;
extern crate uuid;
use serde::{Deserialize, Serialize};
use std::time::Duration;
use couchbase_lite_c::Database;
use couchbase_lite_c::Replicator;
static DATABASE_PATH: &str = "/data/local/tmp";
static TARGET_URL: &str = "ws://127.0.0.1:4984/mydb";
#[derive(Serialize, Deserialize, Deb... |
use crate::{
filter::{EmptyFilter, Filterable},
model::attribute::{FacetAttribute, SearchableAttributes},
};
use chrono::{DateTime, Utc};
use serde::{ser::SerializeMap, Serialize};
use crate::filter::{CommonFilter, CommonFilterKind};
/// Perform multiple write operations in a single API call.
/// In order to ... |
// Copyright (C) 2017 <NAME>.
//
// 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 in writ... |
/*!
# Yesvgmap
*/
#![forbid(unsafe_code)]
#![warn(clippy::filetype_is_file)]
#![warn(clippy::integer_division)]
#![warn(clippy::needless_borrow)]
#![warn(clippy::nursery)]
#![warn(clippy::pedantic)]
#![warn(clippy::perf)]
#![warn(clippy::suboptimal_flops)]
#![warn(clippy::unneeded_field_pattern)]
#![warn(macro_use_ex... |
// Copyright 2020 Google Inc. All Rights Reserved.
//
// 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... |
/// A simple wait-free, grow-only radix tree, assumes a dense keyspace.
use std::sync::atomic::Ordering::SeqCst;
use epoch::{Atomic, Guard, Owned, Shared, pin, unprotected};
use {PageID, debug_delay};
const FANFACTOR: usize = 6;
const FANOUT: usize = 1 << FANFACTOR;
const FAN_MASK: usize = FANOUT - 1;
#[inline(alw... |
use tokio_core::reactor::{ Core, Remote, Handle };
use futures::{ Future, Stream, future };
use futures::sync::oneshot;
use std::{ thread };
use std::sync::{ Mutex, Arc };
use std::sync::mpsc;
use librespot::core::authentication::Credentials;
use librespot::core::config::{DeviceType, SessionConfig, ConnectConfig, Vol... |
/*!
* Visualizer for BIRCH CFTrees.
*/
use std::ops::{Range, RangeBounds};
use palettes::{Palette, Triple};
use plotters::{
coord::Shift,
prelude::{BitMapBackend, DrawingArea, IntoDrawingArea, RGBColor, TextStyle, WHITE},
};
use plotters_backend::BackendTextStyle;
use thiserror::Error;
use borscht::{
c... |
// Copyright (c) 2015, <NAME>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and th... |
extern crate proc_macro;
use crate::proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{
parse::Parser, parse_macro_input, punctuated::Punctuated, spanned::Spanned, Ident, ItemFn, Lit,
LitFloat, LitStr, Meta, NestedMeta, Token,
};
struct VerifyAttribute {
url: LitStr,
eps: Opti... |
//! Disassembly calling function for most targets.
use crate::Function;
use std::{collections::HashSet, env, process::Command, str};
// Extracts the "shim" name from the `symbol`.
fn normalize(mut symbol: &str) -> String {
// Remove trailing colon:
if symbol.ends_with(':') {
symbol = &symbol[..symbol.... |
use crate::js::export::VMFunction;
use crate::js::export::{Export, VMTable};
use crate::js::exports::{ExportError, Exportable};
use crate::js::externals::{Extern, Function as WasmerFunction};
use crate::js::store::Store;
use crate::js::types::Val;
use crate::js::RuntimeError;
use crate::js::TableType;
use js_sys::Funct... |
#[macro_use]
extern crate serde;
mod test_utils;
use flexi_logger::LoggerHandle;
use hdbconnect::{Connection, HdbResult};
use log::{debug, info};
#[test] // cargo test --test test_026_numbers_as_strings -- --nocapture
pub fn test_026_numbers_as_strings() -> HdbResult<()> {
let mut log_handle = test_utils::init_l... |
//! A diagram type for illustrating timings of messages between processes.
//!
//! Like a UML timing diagram, this illustrates interactions between processes over time. However,
//! this diagram is simpler (the UML diagram type supports nonspecific times, process state changes,
//! and many other data complexities); as... |
use crate::input::Input;
use std::collections::HashSet;
use std::slice::Iter;
#[derive(Copy, Clone)]
enum Direction {
Up,
Right,
Down,
Left,
}
impl Direction {
const fn delta(self) -> (i32, i32) {
match self {
Self::Up => (0, 1),
Self::Right => (1, 0),
S... |
/*
Copyright 2020 <NAME> (github.com/erwanM974)
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 in wri... |
use crate::{ChainSpec, Epoch};
use serde_derive::{Deserialize, Serialize};
use std::convert::TryFrom;
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(try_from = "String")]
#[serde(into = "String")]
pub enum ForkName {
... |
use std::{collections::BTreeMap, path::PathBuf};
use pyo3::{
exceptions::{PyIndexError, PyKeyError, PyReferenceError, PyRuntimeError, PyTypeError},
prelude::*,
types::PyInt,
};
use crate::{
cli::Config,
definitions::{
locations::Location,
mapsquares::{MapSquare, MapSquareIterator, ... |
use parking_lot::{
RwLock,
};
use std::collections::VecDeque;
use std::sync::Arc;
use std::ops::{Deref, DerefMut};
use futures::Future;
use futures::sync::mpsc::{
UnboundedSender
};
use futures::sync::oneshot::{
Sender as OneshotSender
};
use ::error::*;
use ::utils as client_utils;
use boxfnonce::SendBoxFnO... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! This file contains the code necessary to interface with the compiler backend
use crate::GotocCtx;
use bitflags::_core::any::Any;
use cbmc::goto_program::symtab_transformer;
use cbmc::goto_program::... |
extern crate btleplug;
extern crate clap;
extern crate ruuvi_sensor_protocol;
use clap::Parser;
use std::collections::BTreeMap;
use std::io::Write;
use std::panic::{self, PanicInfo};
use std::time::SystemTime;
use crate::ruuvi_sensor_protocol::{
Acceleration, BatteryPotential, Humidity, MeasurementSequenceNumber,... |
use std::collections::HashMap;
use serial::prelude::*;
use std::thread;
use std::sync::mpsc;
use std::sync::mpsc::{Receiver, Sender};
use std::io::{Read, Write};
use std::time::Duration;
use log::{debug, warn};
use crate::utils::Result;
use anyhow::anyhow;
type MsgAndResponseChannel = (u32, String, Sender<Strin... |
//! This module implements the test-only invariant checks for the
//! `Tracker`'s snapshot generation logic.
use std::sync::Arc;
use crate::chain_error;
use crate::loader::Chunk;
use crate::manifest_schema::fingerprint_sqlite_header;
use crate::manifest_schema::Manifest;
use crate::result::Result;
use super::Tracker;... |
#![allow(missing_docs)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
use std::collections::HashMap;
use std::ffi::CString;
use std::str;
use std::vec::Vec;
#[rustfmt::skip]
#[allow(clippy::all)]
mod scanner;
use crate::scanner::*;
pub struct Scanner {
data: Vec<u8>,
ps: i32,
p: i32,
pe: i32,
... |
use core::marker::PhantomData;
use embassy::util::Unborrow;
use embassy_extras::unborrow;
use embedded_hal::blocking::spi as eh;
use gpio::Pin;
use crate::{gpio, pac, peripherals};
#[non_exhaustive]
pub struct Config {
pub frequency: u32,
}
impl Default for Config {
fn default() -> Self {
Self {
... |
use super::Mbc;
use std::path::Path;
use std::io::{BufWriter, Write};
use std::fs::File;
pub struct Mbc1 {
rom: Vec<u8>,
ram: [u8; 0x8000],
ram_enabled: bool,
bank1: usize,
bank2: usize,
mode: bool,
rom_size: u8,
ram_size: u8,
has_battery: bool,
}
impl Mbc1 {
pub fn new(rom: Ve... |
/*
lib.rs contains all the logic of the program
*/
use std::{error::Error, fmt::Display, str::FromStr, io::{self, Write}};
use rand::Rng;
/// handles setup for the game
pub struct Config {
players: Vec<Player>,
}
impl Config {
/// creates and returns a new Config from user input
pub fn new() -> Result<C... |
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
extern crate proc_macro;
use proc_macro2::{TokenStream, TokenTree, Group, Literal};
use syn::parse::{Parse, ParseStream};
use syn::{parse_macro_input, braced, Result, Token, Ident};
use quote::{quote, format_ident, ToTokens, TokenStreamExt};
use std::ops::Range;
use syn::*;
use core::cell::RefCell;
#[proc_macro]
pu... |
mod draw;
use cogs_gamedev::controls::InputHandler;
use crate::{
assets::Assets,
boilerplates::{FrameInfo, Gamemode, GamemodeDrawer, Transition},
controls::{Control, InputSubscriber},
modes::ModeEnding,
simulator::{
board::Board,
floodfill::{FloodFillError, FloodFiller},... |
#[macro_use]
extern crate libretro_backend;
#[macro_use]
extern crate log;
use libretro_backend::{
AudioVideoInfo, CoreInfo, GameData, JoypadButton, LoadGameResult, PixelFormat, RuntimeHandle,
};
use bit::BitIndex;
use unsafe_unwrap::UnsafeUnwrap;
use rustboyadvance_core::keypad::Keys as GbaButton;
use rustboya... |
// Generated by `scripts/generate.js`
use utils::vk_traits::*;
/// Wrapper for [VkMemoryPropertyFlags](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkMemoryPropertyFlags.html).
///
/// Use the macro `VkMemoryPropertyFlags!` as an alternative method to create a structure. For example, these tw... |
/// Simple application that reads in a dictionary and removes words with a "'".
use std::env;
use std::fs;
fn main() {
let args: Vec<String> = env::args().collect();
// If the number of arguments don't match, throw an error
if args.len() != 3 || args.contains(&"-h".to_string()) {
print_help();
... |
use std::collections::BTreeSet;
use crdts::merkle_reg::{Hash, MerkleReg, Node};
use crdts::{CmRDT, CvRDT};
use quickcheck_macros::quickcheck;
#[test]
fn test_write_resolves_fork() {
let mut reg = MerkleReg::new();
reg.apply(reg.write("a", Default::default()));
reg.apply(reg.write("b", Default::default()... |
use postgres;
use reqwest;
use crate::{
worker,
err::HecateError
};
#[derive(Serialize, Deserialize)]
pub struct WebHook {
id: Option<i64>,
name: String,
actions: Vec<String>,
url: String
}
impl WebHook {
pub fn new(id: i64, name: String, actions: Vec<String>, url: String) -> Self {
... |
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::fs;
type CardMap = HashMap<u32, (usize, usize)>;
#[derive(Debug)]
struct Card {
// Map number to its row and column
lookup: CardMap,
found_values: Vec<u32>,
rows: [u32; 5],
cols: [u32; 5],
}
impl Card {
fn new(input: &s... |
/*
* Camunda BPM REST API
*
* OpenApi Spec for Camunda BPM REST API.
*
* The version of the OpenAPI document: 7.14.0
*
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct HistoricActivityInstanceDto {
/// The id of the activity instanc... |
//! Instructions for `cryptid_signer`
/// Cancels a transaction
#[path = "./004_cancel_transaction.rs"]
pub mod cancel_transaction;
/// Crates a cryptid account
#[path = "./000_create_cryptid.rs"]
pub mod create_cryptid;
/// Directly executes a transaction
#[path = "./005_direct_execute.rs"]
pub mod direct_execute;
//... |
#![allow(dead_code)]
#![allow(unused_imports)]
extern crate dissimilar;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate futures;
#[macro_use]
extern crate serde_json;
extern crate clap;
extern crate deno_core;
extern crate indexmap;
#[cfg(unix)]
extern crate nix;
extern crate rand;
e... |
//! Systems are actions performed every frame to manipulate entities and components.
//!
//! A system can declare mutable or immutable access
//! to archetype-specific components and global states.
//! dynec will schedule systems such that systems have unique access to mutable resources they
//! request.
//! Furthermor... |
use super::*;
use crate::element::*;
use crate::error::{Error, Result};
use serde::{Deserialize, Serialize};
#[inline]
fn is_false(v: &bool) -> bool {
!v
}
#[inline]
fn is_nan(v: &f32) -> bool {
v.is_nan()
}
/// Validator for 32-bit floating-point values.
///
/// This validator will only pass f32 values. Vali... |
pub use async_trait::async_trait;
pub use jsonwebtoken::Validation;
use http::header::{AUTHORIZATION, WWW_AUTHENTICATE};
use http::HeaderValue;
use jsonwebtoken::{dangerous_unsafe_decode, decode};
use roa_core::{Context, Model, Next, Status, StatusCode};
use serde::{de::DeserializeOwned, Serialize};
const INVALID_HEA... |
use libc::{c_char, c_int};
use libc::{waitpid, PT_ATTACH, PT_DETACH, PT_VM_ENTRY, WIFSTOPPED};
use std::convert::From;
use std::ffi::{CStr, OsStr};
use std::io;
use std::iter::Iterator;
use std::os::unix::ffi::OsStrExt;
use std::path::PathBuf;
use std::ptr;
use super::bindings::{caddr_t, ptrace_vm_entry};
use super::P... |
//! In memory source.
use std::{
borrow::Borrow,
collections::{HashMap, HashSet},
vec,
};
use crate::{
key::{PartialKey, PartialKeyIter},
source::{ConfigSource, ConfigSourceAdaptor},
value_ref::Refresher,
ConfigError, ConfigKey, ConfigValue, PartialKeyCollector,
};
/// Hash Source.
#[doc(h... |
//! # ufb
//!
//! Just quickly show or draw a framebuffer in a window, nothing else!
//! Why use ufb:
//! - Uses hardware-acceleration via OpenGL.
//! - To quickly debug image or framebuffer output, instead of writing to files.
//! - Supports L8, La8, Rgb8 and Rgba8 `&[u8]` buffers.
//! - Fast to build.
//! - Doesn't n... |
use std::collections::HashMap;
use std::env;
use std::fs;
use std::path::Path;
use bitcoincore_rpc::{Auth, Client};
use url::Url;
use crate::errors::{Error, OptionExt};
#[derive(Debug, Serialize)]
pub struct Network {
name: String,
network: String,
rpc_url: String,
rpc_cred: Option<(String, String)>... |
use crate::env::WebEnv;
use crate::model::deep_links::VideoDeepLinks;
use semver::Version;
use serde::Serialize;
use stremio_core::models::common::{Loadable, ResourceLoadable};
use stremio_core::models::ctx::Ctx;
use stremio_core::models::player::{Player, Selected};
use stremio_core::runtime::Env;
use url::Url;
use was... |
extern crate regex;
use regex::Regex;
fn main() {
let input = include_str!("../input.txt");
let valid_entries = part_1(input);
println!("{:#?}", valid_entries);
}
fn part_1(input: &str) -> usize {
let mut passports = Vec::<Passport>::new();
let mut last_line = String::new();
for line in inpu... |
#![windows_subsystem = "windows"]
use std::ffi::CString;
use std::mem::MaybeUninit;
use std::slice;
use log::{error, info, LevelFilter};
use std::sync::mpsc::channel;
use trayicon::{MenuBuilder, TrayIconBuilder};
use winapi::um::libloaderapi::{GetModuleHandleA, GetProcAddress};
use winapi::um::processthreadsapi::Get... |
use crate::program::Program;
use crate::pipeline::transfer::MemoryTransfers;
use crate::pipeline::GroupPolicy;
use crate::pipeline::output::Output;
use crate::pipeline::PipelineError;
use crate::pipeline::monitoring::EventMonitor;
use crate::cluster::Cluster;
use crate::pipeline::monitoring::Event;
use crate::view::Vie... |
use crate::Document;
use regex::Regex;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
pub struct OptDoc {
pub(crate) date: Option<String>,
pub(crate) institution: Option<String>,
pub(crate) name: Option<String>,
pub(crate) page: Option<String>,
}
/// Represents a Document with fields that were ... |
#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug)]
pub struct RPCPayload {
pub jsonrpc: String,
pub id: String,
pub method: Option<String>,
pub params: Option<RPCParams>
}
impl Default for RPCPayload {
fn default() -> RPCPayload {
RPCPayload {
jsonrpc: "2.0".to_string... |
use makepad_render::*;
use crate::texteditor::*;
use crate::textbuffer::*;
use crate::tokentype::*;
use crate::widgetstyle::*;
#[derive(Clone)]
pub struct TextInput {
pub text_editor: TextEditor,
pub text_buffer: TextBuffer,
pub empty_message: String,
}
#[derive(Default)]
pub struct TextInputOptions {
... |
use convert_case::{Case, Casing};
use regex::Regex;
use roxmltree::{Document, Node};
use std::ffi::OsStr;
use std::fs::{self, File};
use std::io::{self, Read, Write};
use std::path::PathBuf;
type IO<T> = Result<T, Box<dyn std::error::Error>>;
mod config;
pub use config::Config;
/// An XML field representing a Qt obj... |
use std::convert::TryInto;
use crate::riverdb::common::{Error, Result};
use crate::riverdb::pg::protocol::{Messages, Tag};
const FIELD_DESCRIPTION_SIZE: u32 = 3*4 + 3*2;
/// An object for efficiently accessing a Postgres row description in Messages
pub struct RowDescription {
msg: Messages,
fields: Vec<Fi... |
use cgmath::num_traits::clamp;
use cgmath::{EuclideanSpace, InnerSpace, Transform};
use js_sys::Array;
use legion::IntoQuery;
use twin_stick_shooter_core::collision::Shape;
use twin_stick_shooter_core::game::Game;
use twin_stick_shooter_core::health::HealthComponent;
use twin_stick_shooter_core::hitbox::{HitboxComponen... |
#![feature(test)]
#![feature(destructuring_assignment)]
extern crate test;
#[macro_use]
extern crate lazy_static;
#[derive(PartialEq)]
enum InfoPart {
Value(i128),
X,
}
impl std::str::FromStr for InfoPart {
type Err = String;
fn from_str(input: &str) -> Result<Self, Self::Err> {
if input == ... |
use anyhow::Result;
use average::{Estimate, Max, Min, Quantile};
use reqwest::{Client, Error, Method, Response, Url};
use serde::Serialize;
use std::collections::HashMap;
use std::option::Option::Some;
use std::sync::Arc;
use std::time::{Duration, Instant};
use tokio::sync::mpsc;
use tokio::task;
use uuid::Uuid;
#[der... |
//! Module implementing an immutable in-adjacency list.
use std::borrow::Borrow;
use itertools::{Itertools, MapInto};
use std::ops::Range;
use crate::{
map::{self, Map, MapMut},
Digraph, Homomorphism, InGraph,
};
use super::dense::{self, Key};
#[allow(missing_docs)]
pub type Vert = super::key::DenseVert;
#[allow... |
//! Compiled user function.
use itertools::Itertools;
use std::fmt;
use std::sync::{mpsc, Arc, Condvar, Mutex};
use super::convert::ValueConverter;
use super::Compiler;
use crate::errors::*;
use crate::{ConstValue, RuleMeta, Type};
/// Raw JIT-compiled function pointer.
type JitFnPtr = unsafe extern "C" fn(*mut usiz... |
use algebraics::abstruct::Monoid;
use itertools::Itertools;
use std::{
fmt::{Debug, Display},
ops::RangeBounds,
};
/// Generic segment-tree
#[derive(Clone)]
pub struct SegmentTree<M: Monoid> {
len: usize,
capacity: usize,
size: usize,
height: usize,
buffer: Vec<M::I>,
}
impl<M> Debug for S... |
use anyhow::Result;
use apparatus::color;
use apparatus::engine::apparatus::{Apparatus, ApparatusSettings};
use apparatus::engine::game::Game;
use apparatus::engine::key::Key;
use apparatus::errors::ApparatusError;
struct Geometry {
option: u32,
}
impl Game for Geometry {
fn on_create(_app: &Apparatus) -> st... |
use near_contract_standards::fungible_token::core_impl::ext_fungible_token;
use near_sdk::{
assert_one_yocto,
borsh::{self, BorshDeserialize, BorshSerialize},
collections::{TreeMap, UnorderedMap, UnorderedSet},
env, ext_contract,
json_types::{Base64VecU8, U128, U64},
log, near_bindgen,
serde... |
extern crate array_tool;
#[test]
fn it_squeezes_characters() {
use array_tool::string::Squeeze;
assert_eq!("yellow moon".squeeze(""), "yelow mon");
assert_eq!(" now is the".squeeze(" "), " now is the");
assert_eq!("ééé".squeeze(""), "é");
assert_eq!(" /// aa".squeeze("/"), " / aa");
let string: S... |
use actix_web::{
AsyncResponder,
FutureResponse,
HttpRequest,
HttpResponse,
Path,
Result as ActixResult
};
use futures::future::{self, Future};
use lazy_static::lazy_static;
use log::*;
use serde_derive::Deserialize;
use serde_qs as qs;
use tesseract_core::format::{format_records, FormatType};
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.