text stringlengths 3.09k 13.9k |
|---|
//! Use a badge for color highlighting important information.
//!
//! *This API requires the following crate features to be activated: badge*
use std::hash::Hash;
use iced_native::{
event, layout, Align, Clipboard, Element, Event, Layout, Length, Point, Rectangle, Widget,
};
use crate::core::renderer::DrawEnviron... |
use bindle::testing;
use std::collections::HashMap;
use std::io::Cursor;
use bindle::standalone::{StandaloneRead, StandaloneWrite, INVOICE_FILE, PARCEL_DIR};
use tokio::stream::StreamExt;
#[tokio::test]
async fn test_successful_write() {
let tempdir = tempfile::tempdir().expect("unable to create tempdir");
... |
//! Diff Feedback, comparing the content of two observers of the same type.
//!
use alloc::string::{String, ToString};
use core::{
fmt::{self, Debug, Formatter},
marker::PhantomData,
};
use serde::{Deserialize, Serialize};
use crate::{
bolts::tuples::{MatchName, Named},
events::EventFirer,
executo... |
use std::marker::PhantomData;
use std::sync::Arc;
use crate::debug::{get_type_name, save_type_name};
use crate::Injector;
use std::any::{type_name, Any};
use std::ops::Deref;
pub(crate) trait Factory<T: ?Sized + 'static> {
fn load(&self, injector: &Injector) -> Arc<T>;
// fn into_trait_loader<Trait: ?Sized +... |
pub trait Probe {
type Msg: Send;
type Pay: Clone + Send;
fn event(&self, evt: Self::Msg);
fn payload(&self) -> &Self::Pay;
}
pub trait ProbeReceive {
type Msg: Send;
fn recv(&self) -> Self::Msg;
fn reset_timer(&mut self);
fn last_event_milliseconds(&self) -> u64;
... |
use core::num::IntErrorKind;
use std::convert::{Infallible, TryFrom};
use std::error::Error;
use std::fmt::{self, Display, Formatter};
use std::iter::once;
use std::ops::Deref;
use crate::header::map::TypedHeader;
use crate::header::name::HeaderName;
use crate::header::value::HeaderValue;
/// The maximum size the con... |
use core::cell::RefCell;
use async_std::sync::{Arc, Weak};
use browser_webrtc::signaling_protocol::{ChannelId, NetworkMode};
use browser_webrtc::Server;
use sycamore::prelude::*;
use crate::SenderBuilderView;
const DEFAULT_NETWORK_MODE: NetworkMode = NetworkMode::PeerToPeer;
#[derive(Debug)]
pub struct SendersListV... |
use std::collections::HashMap;
use petgraph::graph::{DiGraph, EdgeIndex, NodeIndex};
use petgraph::visit::{DfsPostOrder, Visitable};
use toc_span::FileId;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SourceDepend {
pub relative_path: String,
pub kind: SourceKind,
}
#[derive(Debug, Clone, Copy, PartialEq... |
//! Module implementing a sparse bi-adjacency list.
use std::borrow::Borrow;
use std::collections::{hash_set, HashSet};
use crate::{Digraph, InGraph, InsertGraph, OutGraph};
use super::sparse;
#[allow(missing_docs)]
pub type Vert = super::key::SparseVert;
#[allow(missing_docs)]
pub type Edge = super::key::SparseEdg... |
use crate::{
pk_parameter, pk_parameter_cloned, pk_struct, read_attributes, updatable_columns_enum,
COLUMN_SEPARATOR, DELETE_UNIQUE, INSERT, INSERT_USING_TTL, SELECT_ALL, SELECT_ALL_COUNT,
SELECT_UNIQUE, TRUNCATE, UPDATE_MULTIPLE_COLUMNS, UPDATE_OPTIONALS, UPDATE_SINGLE_COLUMN,
UPDATE_SINGLE_COLUMN_DYNA... |
use serde::{Serialize, Deserialize};
use std::fs;
use rust_decimal::prelude::*;
use rust_decimal_macros::dec;
use crate::core::block::Block;
use crate::core::utxo::Utxo;
use crate::core::tx::Tx;
use crate::core::func;
#[derive(Debug, Serialize, Deserialize, Clone,PartialEq)]
pub struct Chain {
pub blocks: Vec<Bloc... |
use crate::exact_size::ExactSized;
/// Types that have capacity.
pub trait CapacityAware: ExactSized {
/// Capacity unit
type CapacityType = Self::SizeType;
/// Returns the number of elements the `Self` can hold without reallocating.
fn capacity(&self) -> Self::CapacityType;
}
/// Collections that ca... |
//! Test case generators.
//!
//! Test case generators take raw, unstructured input from a fuzzer
//! (e.g. libFuzzer) and translate that into a structured test case (e.g. a
//! valid Wasm binary).
//!
//! These are generally implementations of the `Arbitrary` trait, or some
//! wrapper over an external tool, such that... |
use std::collections::BTreeSet;
use anyhow::Context;
use chrono::{TimeZone, Utc};
use itertools::Itertools;
use log::{debug, warn};
use mysql::prelude::Queryable;
use crate::go_database_dsn::GoDatabaseDsn;
use crate::migration_state::MigrationState;
pub(crate) struct MigrationRunner {
pool: mysql::Pool,
tx_o... |
// 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::enums::*;
use anyhow::{format_err, Context as _};
use core::convert::{TryFrom, TryInto};
use spinel_pack::*;
use std::io;
use std::num::NonZeroU... |
//! Imports a static factory that is able to instanciate the different eleents
//! described by the RDF.JS data model.
#![deny(missing_docs)]
extern crate wasm_bindgen;
use crate::datamodel::term::*;
use crate::datamodel::quad::*;
use crate::dataset::SophiaExportDataset;
use sophia::term::*;
use uuid::Uuid;
use was... |
// Copyright © 2018 <NAME>
// [This software is released under the "MIT License"]
// Please see the file LICENSE in the source
// distribution of this software for license terms.
#[macro_use] extern crate derive_builder;
extern crate image;
extern crate imageproc;
use derive_builder::*;
pub mod image_obfuscation {
... |
//! Cortex-M bit-banding support.
//!
//! Some Cortex-M processors have a very unusual feature called "bit-banding."
//! There is a section of the processor address space, the "bit-band alias
//! region," which represents a *magnified view* of another section (called the
//! bit-band "target" section here). The LSB of ... |
use std::collections::HashMap;
use rand::distributions::WeightedIndex;
use rand_xoshiro::Xoshiro256StarStar;
use crate::decode::Decoder;
use crate::util::{sample_with_exclusive_repeats, xor_block, seed_block_rng, get_adjacent_blocks};
use crate::types::{StreamId, BlockIndex, CheckBlockId};
pub struct OnlineCoder {
... |
#![allow(dead_code)]
use std::str::{Chars, pattern::Pattern};
use std::str::pattern::Searcher;
#[derive(Debug)]
pub struct CharIter<'d> {
chars : Chars<'d>,
next_char : Option<char>,
row : usize,
column : usize
}
impl<'d> Iterator for CharIter<'d>{
type Item = char;
fn next(&mut s... |
#![cfg(windows)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(
nightly,
feature(maybe_uninit_uninit_array, maybe_uninit_array_assume_init)
)]
#![warn(
unsafe_op_in_unsafe_fn,
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
rust_2018_idioms,
clippy::to... |
// The MIT License (MIT)
//
// Copyright (c) 2017 <NAME> <<EMAIL>>
// Copyright (c) 2021 <NAME> <<EMAIL>>
//
// 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, includi... |
use std::{
sync::{Arc, Mutex},
thread,
};
use ndi::{self, FindCreateError, FindSourcesTimeout};
use super::*;
static NDI_RECEIVER_NAME: &'static str = "Sh4derJockey";
#[derive(Debug)]
pub struct Ndi {
sources: Arc<Mutex<Vec<ndi::Source>>>,
videos: HashMap<String, Arc<Mutex<image::DynamicImage>>>,
... |
//! Actix-web extractor which validates OAuth2 tokens through an
//! [RFC 7662](https://datatracker.ietf.org/doc/html/rfc7662) token
//! introspection endpoint.
//!
//! To protect a resource, you add the `RequireAuthorization` extractor.
//! This extractor must be configured with a token introspection url
//! before it... |
mod bulb;
#[macro_use] extern crate prettytable;
use prettytable::Table;
use std::str;
use std::env;
use std::process::exit;
use std::{thread, time};
use std::net::{TcpStream, UdpSocket};
use std::sync::mpsc::{Sender, Receiver, channel};
use bulb::Bulb;
use bulb::RGB;
use std::io::{self, Write, BufRead, Read};
const... |
//
// Copyright © 2021 Microsoft
//
// SPDX-License-Identifier: Apache-2.0
//
#![allow(non_camel_case_types)]
//
// MOVS - Move Data from String to String
//
use crate::arch::emulator::{EmulationError, PlatformEmulator};
use crate::arch::x86::emulator::instructions::*;
use crate::arch::x86::regs::DF;
use crate::arch... |
use anyhow::{Error, Result};
use move_binary_format::deserializer::{load_constant_size, load_signature_token};
use move_binary_format::file_format::SignatureToken;
use move_binary_format::file_format_common::{
BinaryData, TableType, VersionedCursor, write_u64_as_uleb128,
};
use crate::context::TableContext;
use cr... |
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::{quote_spanned, ToTokens};
use syn::{
parse::Parse, parse_macro_input, parse_quote, punctuated::Punctuated, spanned::Spanned, Error,
FnArg, Ident, ItemFn, ReturnType, Stmt, Token,
};
/// Registers a function as a gpu kernel.
///
/// This attribute ... |
//! Special object that implements `super`
use crate::avm1::function::Executable;
use crate::avm1::property::Attribute;
use crate::avm1::return_value::ReturnValue;
use crate::avm1::script_object::TYPE_OF_OBJECT;
use crate::avm1::{Avm1, Error, Object, ObjectPtr, ScriptObject, TObject, Value};
use crate::context::Update... |
//! Support for configurable alphabets
use core::fmt;
/// Prepared Alphabet for
/// [`EncodeBuilder::with_alphabet`](crate::encode::EncodeBuilder::with_alphabet) and
/// [`DecodeBuilder::with_alphabet`](crate::decode::DecodeBuilder::with_alphabet).
#[derive(Clone, Copy)]
pub struct Alphabet {
pub(crate) encode: [... |
#![allow(unused_imports)]
use std::iter::FromIterator;
use std::{collections::HashMap, hash::Hash};
use std::slice::Windows;
use parse_display::FromStr;
use utils::{Solution, Input};
#[derive(FromStr, Debug)]
#[display("{from} -> {to}")]
struct Rule {
from: String,
to: String,
}
trait IncrOrInsert {
fn i... |
//! everything that has to do with HTML event handling
use crate::{prelude::*, AsEntity, Element};
/// An enum for different event types
pub enum EventHandlerCallback {
MouseEvent(Closure<dyn FnMut(web_sys::MouseEvent) + 'static>),
KeyboardEvent(Closure<dyn FnMut(web_sys::KeyboardEvent) + 'static>),
Event(Closure<... |
#[macro_use]
extern crate nom;
use nom::branch::alt;
use nom::bytes::complete::{tag, take_till1, take_while_m_n};
use nom::character::{is_digit, is_hex_digit};
use nom::character::complete::{char, multispace1};
use nom::combinator::{eof, map_res};
use nom::sequence::{pair, preceded, terminated};
use thiserror::Error;... |
use stm32f3xx_hal as p_hal;
use p_hal::stm32 as pac;
use pac::{I2C1, USART1};
use embedded_hal::digital::v2::{OutputPin};
use p_hal::flash::FlashExt;
use p_hal::gpio::GpioExt;
use p_hal::rcc::RccExt;
use p_hal::time::{Hertz, U32Ext};
pub fn setup_peripherals() -> (
// LED output pin
UserLed1Type,
DelayS... |
use std::fs;
use std::io::prelude::*;
use std::path::Path;
use wsg::build;
// generated from https://jaspervdj.be/lorem-markdownum/
static FILE: &'static str = "# Me hodierna corpusque namque prodit
## Pudore origo Assaracus conveniant
Lorem markdownum plura comitique temeraria Thracis requievit lignum faciem
sagit... |
//! WSTP environment object management.
//!
//! It's necessary that a `WSENV` always outlive any links which are created in
//! that environment. However, requiring that every [`Link`][crate::Link] be tied
//! to the lifetime of a [`WstpEnv`] created by the user would make the `wstp` API
//! unnecessarily burdensome. T... |
#[derive(Debug)]
pub(crate) struct Logs {
inner: [Option<Log>; 10],
// Index of the newest log. Moves backwards as new logs are pushed.
head: usize,
}
impl Logs {
pub(crate) fn new(interfaces: impl IntoIterator<Item = String>, ssh: &crate::config::Ssh) -> Result<std::sync::Arc<std::sync::Mutex<Self>>, crate::Erro... |
use std::env;
use std::io;
use std::sync::Arc;
use actix_cors::Cors;
use actix_identity::CookieIdentityPolicy;
use actix_identity::Identity;
use actix_identity::IdentityService;
use actix_web::middleware::Logger;
use actix_web::{error, web, App, Error, HttpRequest, HttpResponse, HttpServer, Result};
use dotenv::dotenv... |
use crate::{
result::Result,
traits::{ReadWrite, B58},
};
use byteorder::ReadBytesExt;
use ed25519::Signature;
pub use ed25519::{PublicKey, SecretKey, Seed};
use sodiumoxide::crypto::sign::ed25519;
use std::{fmt, io, str::FromStr};
static START: std::sync::Once = std::sync::Once::new();
pub const KEYTYPE_ED255... |
use itertools::Itertools;
use std::ops::Add;
fn main() {
let input = include_str!("../../input/18.txt");
println!("Part 1: {}", part_1(input));
println!("Part 2: {}", part_2(input));
}
type Exploded = Option<(Option<i64>, Option<i64>)>;
#[derive(Clone)]
enum Num {
Nested(Box<Num>, Box<Num>),
Valu... |
//! Advent of Code 2020 Day 14
//! https://adventofcode.com/2020/day/14
//!
//! Challenge part 2
//!
//! Execute commands from an input file to update values in a HashMap representing memory, then
//! sum all non-zero values to find the challenge answer. Bitmasks are created to modify memory
//! locations, and presence... |
/// Structs for manipulating a Tuple Variation Header
///
/// Tuple Variation Headers are used within a Tuple Variation Store to locate
/// the deltas in the design space. These are low-level data structures,
/// generally used only in serialization/deserialization.
use bitflags::bitflags;
use otspec::types::*;
use ots... |
// Copyright (c) 2021 <NAME> <<EMAIL>>. All rights reserved.
// Use of this source is governed by Apache-2.0 License that can be found
// in the LICENSE file.
//! From arch/mips/include/uapi/asm/signal.h
use core::fmt;
use core::mem::size_of;
use crate::{sighandler_t, siginfo_t, sigrestore_t, size_t, SIG_DFL, _NSIG}... |
use std::ops::Deref;
use std::sync::Arc;
use std::str::FromStr;
use std::fmt::{Display, Formatter};
use std::env;
use serde_derive::{Deserialize, Serialize};
use arc_swap::ArcSwap;
use getopts::{Options, Matches};
use crate::utils::from_args::{FromArgs, ArgsError, args_terminals};
use crate::math::{IVec2, Ve... |
pub(self) mod ailments;
pub(self) mod flags;
pub use self::ailments::Ailment;
pub use self::flags::Flags;
pub use self::flags::FlagTable;
use std::collections::HashMap;
use crate::enums::*;
use crate::FromVeekun;
use crate::moves::MOVE_COUNT;
use crate::Stat;
use crate::vcsv;
use crate::vcsv::FromCsv;
use crate::vdat... |
pub use bobbin_hal::configure::*;
pub use bobbin_hal::enabled::*;
pub use bobbin_hal::serial::*;
pub use uart::*;
#[derive(Debug, Default)]
pub struct Config {
pub bdh: Bdh,
pub bdl: Bdl,
}
impl Config {
pub fn set_baud_divisor(mut self, baud_divisor: u16) -> Self {
self.bdh = self.bdh.set_sbr((ba... |
//! Provides saving and restoring of architecture specific execution context.
use super::gdt::{TSS, USER_CODE_SEGMENT, USER_DATA_SEGMENT};
use super::interrupts::lapic;
use crate::arch;
use core::mem::size_of;
use crate::memory::address_space::AddressSpace;
use crate::memory::{Address, PhysicalAddress, VirtualAddress}... |
use std::{
ffi::c_void,
fmt,
future::Future,
io, mem,
net::{Shutdown, SocketAddr},
os::windows::io::FromRawSocket,
pin::Pin,
ptr::{self},
sync::Arc,
task::{Context, Poll},
time::Duration,
};
use winapi::{
shared::{
guiddef::GUID,
minwindef::TRUE,
w... |
use std::collections::HashMap;
use std::fmt;
use std::io;
use std::str;
use failure;
use bio::io::fastq;
use fastx_split::linkers::*;
/// Collected information about one particular sample
pub struct Sample {
name: String,
index: Vec<u8>,
dest: fastq::Writer<Box<io::Write>>,
total: usize,
umi_cou... |
//! Direct Lighting Integrator
#![allow(dead_code)]
use bumpalo::Bump;
use core::camera::*;
use core::geometry::*;
use core::integrator::*;
use core::interaction::*;
use core::material::*;
use core::paramset::*;
use core::reflection::*;
use core::sampler::*;
use core::scene::*;
use core::spectrum::*;
use std::sync::A... |
use std::{f32::consts::TAU, mem};
use hecs::{Entity, World};
// haha DirectionN go brrrrr
use cogs_gamedev::controls::InputHandler;
use hex2d::{Angle, Coordinate as HexCoord, Direction as Direction6};
use macroquad::prelude::{info, Vec2};
use crate::{
controls::{Control, InputSubscriber},
modes::ove... |
use crate::errors::{FileSource, LookaheadError, TokenVec, UnexpectedToken};
use crate::lexer::{FormatToken, TerminalIndex, TokenStream};
use crate::parser::{ProductionIndex, StateIndex};
use log::trace;
use miette::{miette, Result, WrapErr};
use std::borrow::Borrow;
use std::cmp::Ordering;
use std::fmt::Debug;
///
///... |
use std::borrow::Cow;
use std::ffi::{c_void, CStr};
use std::mem::transmute;
use std::ops::{Deref, DerefMut};
use std::{fmt, slice};
use crate::raw::{METHOD_ATTRIBUTE_ABSTRACT, METHOD_ATTRIBUTE_STATIC, METHOD_ATTRIBUTE_VIRTUAL};
use crate::{
raw, Arguments, Il2CppClass, Il2CppException, Il2CppObject, Il2CppType, P... |
type Number = u64;
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
enum Operator {
Add,
Multiply,
}
#[derive(Debug, Clone, Copy)]
enum Token {
Number(Number),
Operator(Operator),
LeftParenthesis,
RightParenthesis,
}
fn tokens(input: &str) -> impl Iterator<Item = Token> + '_ {
let mut it = in... |
use emulator::heap::iter;
use emulator::heap::ptr::DataPtr;
use emulator::heap::{IHeap, HeapError};
use rt_defs::stack::IStack;
use rt_defs::Word;
use term::lterm::*;
use term::raw::*;
use std::fmt;
/// A heap structure which grows upwards with allocations. Cannot expand
/// implicitly and will return error when cap... |
//! A module that implements the Adobe RGB color space. The Adobe RGB space differs greatly from
//! sRGB: its components are floating points that range between 0 and 1, and it has a set of
//! primaries designed to give it a wider coverage (over half of CIE 1931).
use bound::Bound;
use color::{Color, XYZColor};
use c... |
/*
* DMNTK - Decision Model and Notation Toolkit
*
* MIT license
*
* Copyright (c) 2018-2022 <NAME> Software
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRIN... |
use crate::run::{random_doouble, Vec3};
use crate::texture::Texture;
use rand::Rng;
const POINT_COUNT: usize = 256;
#[allow(dead_code)]
#[derive(Clone)]
pub struct Perlin {
pub ranvec: [Vec3; POINT_COUNT],
pub ranfloat: [f64; POINT_COUNT],
pub perm_x: [i32; POINT_COUNT],
pub perm_y: [i32; POINT_COUNT]... |
use std::{collections::HashMap, thread, time::{Duration, Instant}};
use crossbeam_channel as channel;
use glm;
use rand::{FromEntropy, rngs::SmallRng};
use tracking::{Measurement, MeasurementModel, TrackingConfig, SignalSource, SignalConfig, Particle, filter_runner::ParticleMode};
use super::instance::InstanceCommand... |
use std::cell::RefCell;
use std::fmt;
use std::ops::DerefMut;
use std::str::FromStr;
use http::{HeaderMap, HeaderValue};
use http::header::{Entry, HeaderName, ValueIter};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::de::{self, MapAccess, Visitor};
use serde::ser::{self, SerializeMap, Seria... |
use crypto::sha1::Sha1;
use crypto::hmac::Hmac;
use crypto::mac::Mac;use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
use protobuf::{self, Message, MessageStatic};
use rand::thread_rng;
use std::io::{self, Read, Write};
use std::marker::PhantomData;
use tokio_core::io::{Io, Framed, write_all, WriteAll, read_exact,... |
use std::collections::HashSet;
use std::fmt::Write;
use std::str::FromStr;
use proc_macro2::Span;
use quote::quote;
use syn::ext::IdentExt;
pub fn model(ast: &mut syn::ItemStruct) -> proc_macro2::TokenStream {
let fields = match &mut ast.fields {
syn::Fields::Named(fields) => fields,
_ => panic!("... |
use futures::future::select_all;
use std::future::Future;
use std::pin::Pin;
use std::process::Stdio;
use std::task::{Context, Poll};
use std::time::Duration;
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
use tokio::time::timeout;
use super::find_binary;
pub type NuxmvOutput = (u32, String, String);
pub ... |
// Copyright 2020 <NAME>
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
//! 3-part business check PDF creation library
use english_numbers::convert;
use english_numbers::Formatting;
use printpdf::*;
use std::fs::... |
use crate::{app::App, canvas::Painter, constants::*};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
symbols::Marker,
terminal::Frame,
text::Span,
text::Spans,
widgets::{Axis, Block, Borders, Chart, Dataset},
};
use unicode_segmentation::UnicodeSegmentation;
pub trait MemGraphWid... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use super::{
error::Closed,
message::{self, Message},
BatchControl,
};
use futures::future::TryFutureExt;
use pin_project::pin_project;
use std::{
marker::PhantomData,
sync::{Arc, Mutex},
};
use tokio::{
stream::StreamExt,
sync::mpsc,
time::{delay_for, Delay},
};
use tower::{Service, Ser... |
use std::cmp;
use std::collections::hash_map::Entry;
use std::collections::{BTreeMap, HashMap};
use std::io;
use std::io::prelude::*;
pub fn part_one() {
let mut state = read_input();
let answer = solve_1(&mut state);
println!("{}", answer);
}
pub fn part_two() {
let state = read_input();
let ans... |
// Chariot: An open source reimplementation of Age of Empires (1997)
// Copyright (c) 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 ... |
// Copyright 2021 The AutoCore.AI.
//
// 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 t... |
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate solana_sdk;
mod dashboard;
mod game;
mod program_command;
mod program_state;
mod result;
mod simple_serde;
use program_command::Command;
use program_state::State;
use result::{ProgramError, Result as ProgramResult};
use simple_serde::SimpleSerde... |
use prost_build;
use tempfile;
use std::{
collections::HashMap,
env, fs,
io::{Error, ErrorKind, Read, Result, Write},
path::{Path, PathBuf},
process::Command,
};
use heck::SnakeCase;
use prost::Message;
use prost_build::{protoc, protoc_include};
use prost_types::{DescriptorProto, FileDescriptorPr... |
use crate::module::ModuleIndex;
use std::collections::HashMap;
use std::fmt;
use std::hash::Hash;
/// An address value which points an `Item` in `LinkableCollection`
/// The pointee item must be exists in the collection.
#[derive(PartialEq, Eq, Hash)]
pub struct GlobalAddress<Item>(usize, std::marker::PhantomData<Item... |
// TODO: conversion macro for all enums?
use crate::{
css::{self, BorderStyle, Overflow, Style, StyleProp},
layout::{self, LayoutStyle},
renderer::{Color, ContainerStyle, Outline, Shadow, StrokeStyle},
};
pub fn container_style(style: &css::Style) -> ContainerStyle {
let mut res = ContainerStyle::defa... |
use anchor_lang::prelude::*;
use anchor_lang::solana_program::{
hash::hash,
native_token::{lamports_to_sol, sol_to_lamports},
};
use std::convert::TryInto;
use anchor_spl::token::{self, Mint, MintTo, TokenAccount};
declare_id!("7TM227WVFEwEjWdk3euwyd1JdjTs4wyDCy6euRzz5M5T");
#[program]
pub mod pow {
use ... |
use crate::error::Result;
use crate::ui::buffer::Buffer;
use crate::ui::layout::Rect;
use crate::ui::style::{Color, Style};
use crate::ui::widget::{Block, Widget};
use crate::ui::width::AppendWidthTab8;
use crate::ui::UserOutput;
use std::collections::VecDeque;
/// currently only support cjk mode
#[derive(Debug)]
pub ... |
//! Type definitions used in merkle pallet
use bulletproofs::BulletproofGens;
use codec::Input;
use curve25519_dalek::ristretto::CompressedRistretto;
use sp_std::prelude::*;
pub type ScalarBytes = Vec<u8>;
pub fn slice_to_bytes_32(vec: &[u8]) -> [u8; 32] {
let mut bytes_array = [0u8; 32];
bytes_array
.iter_mut()
... |
/// This contains the current evaluation methods for the VRF and its link to
/// the stake distribution
use crate::chaineval::PraosNonce;
use crate::date::SlotId;
use crate::setting::ActiveSlotsCoeff;
use crate::stake::PercentStake;
use chain_crypto::{
vrf_evaluate_and_prove, vrf_verified_get_output, vrf_verify, Cu... |
use std::env;
use warp::Filter;
use feature_flags::db::get_db_server;
#[tokio::main]
async fn main() {
if env::var_os("RUST_LOG").is_none() {
// Setting the logger to info as the default
env::set_var("RUST_LOG", "todos=info");
}
pretty_env_logger::init();
let db_lite = get_db_server(... |
//! Requires the "client", "standard_framework", and "voice" features be enabled
//! in your Cargo.toml, like so:
//!
//! ```toml
//! [dependencies.serenity]
//! git = "https://github.com/serenity-rs/serenity.git"
//! features = ["client", "standard_framework", "voice"]
//! ```
use std::env;
use serenity::{
async_... |
use super::batch::Batch;
use flate2::write::GzEncoder;
use partition::Partition;
use serde::{Deserialize, Serialize};
use std::io::Write;
pub mod json;
pub mod metrics;
pub mod partition;
#[derive(Serialize, Deserialize, Debug, Copy, Clone)]
#[serde(rename_all = "lowercase")]
pub enum Compression {
None,
Gzip... |
use super::bitfield;
use bytemuck::Pod;
use thiserror::Error;
/// The maximum supported size of the raw buffer.
const MAX_BUFFER_SIZE: usize = u16::MAX as usize;
/// Encodes a set of `[Pod]` values into a byte buffer relative to a reference snapshot.
///
/// # Security
/// This function fails if the delta encoded out... |
use fixedvec::FixedVec;
use frame_allocator::FrameAllocator;
use os_bootinfo::MemoryRegionType;
use x86_64::structures::paging::{self, MapToError, RecursivePageTable, UnmapError};
use x86_64::structures::paging::{Mapper, MapperFlush, Page, PageSize, PageTableFlags, PhysFrame, Size4KiB};
use x86_64::{align_up, PhysAddr,... |
//! Implementation of the [t-distribution](https://en.wikipedia.org/wiki/Student%27s_t-distribution)
use crate::functions::beta::*;
use crate::functions::gamma::*;
use crate::stats::traits::*;
/* Copyright (c) 2012 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person... |
/*! Proxy reference for `&mut bool`
`BitSlice` regions can easily produce *read* references to `bool`s that they
contain, by testing the bit and producing the appropriate `&'static bool`, but
Rust’s rules forbid production of a *write* reference to a `bool` stored within
a `BitSlice` region. This is because references... |
use crate::{
list::_list,
lock::Lock,
metadata::{metadata_reg, MetaInfo},
util::{extract_crate, pkg_path, signature},
IndexPackage,
};
use failure::{bail, Error, ResultExt};
use git2;
use semver::VersionReq;
use std::{fs, io::Write, path::Path};
/// Add a new entry to the index.
///
/// The `index_... |
// Rust Bitcoin Library
// Written in 2014 by
// <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warranty.
//
// You should have r... |
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
mod types;
use std::cell::RefCell;
use std::convert::From;
use std::rc::Rc;
use bytes::Bytes;
use derive_more::{Display, From};
use binding_macro::{genesis, hook_after, service, tx_hook_after, tx_hook_before};
use protocol::traits::{ExecutorParams, ServiceResponse, ServiceSDK, StoreMap};
use protocol::try_service_re... |
extern crate piston;
extern crate opengl_graphics;
extern crate graphics;
extern crate touch_visualizer;
#[cfg(feature = "include_sdl2")]
extern crate sdl2_window;
#[cfg(feature = "include_glfw")]
extern crate glfw_window;
#[cfg(feature = "include_glutin")]
extern crate glutin_window;
use touch_visualizer::TouchVisua... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
//! A module that provides a type describing peers.
use crate::types::metrics::PeerMetrics;
use bee_message::milestone::MilestoneIndex;
use bee_network::{Multiaddr, PeerId, PeerInfo, PeerRelation};
use std::{
sync::atomic::{AtomicBool, AtomicU... |
use crate::common::{self, *};
const BASE_CLASS: &str = "NSAlert";
lazy_static! {
static ref WINDOW_CLASS: common::RefClass = unsafe {
register_window_class("PlyguiMessage", BASE_CLASS, |decl| {
decl.add_method(sel!(anyButtonPressed:), button_pressed as extern "C" fn(&mut Object, Sel, cocoa_id)... |
mod parser;
mod types;
use anyhow::{anyhow, Context, Result};
use gimli::{
read::{Dwarf, EndianSlice},
RunTimeEndian,
};
use object::{Object, ObjectSection};
use std::borrow;
use std::collections::HashMap;
pub use types::{ObjectLocationMap, Subprogram, Subroutine};
/// Loads a DWARF object from file
///
/// *... |
#[cfg(any(test, feature = "testing"))]
use crate::account_address::AccountAddress;
#[cfg(any(test, feature = "testing"))]
use canonical_serialization::SimpleSerializer;
use canonical_serialization::{
CanonicalDeserialize, CanonicalDeserializer, CanonicalSerialize, CanonicalSerializer,
};
#[cfg(any(test, feature = "... |
use std::collections::HashMap;
use std::fs::OpenOptions;
use std::io::Write;
use std::path::{self, Path, PathBuf};
use std::process;
use toml;
use lanoma_lib::config::SubjectConfig;
use lanoma_lib::error::Error;
use lanoma_lib::masternote::MasterNote;
use lanoma_lib::modify_toml_table;
use lanoma_lib::note::Note;
use... |
//! The `tournament` module.
//!
//! The provided `SelectionOp` implementations are:
//! * `TournamentSelector`
use crate::{
algorithm::EvaluatedPopulation,
genetic::{Fitness, Genotype, Parents},
operator::{GeneticOperator, MultiObjective, SelectionOp, SingleObjective},
random::{random_index, random_pr... |
// Built-in deps
use std::cell::{Cell, RefCell};
use std::time::Duration;
// External uses
use diesel::backend::UsesAnsiSavepointSyntax;
use diesel::connection::{AnsiTransactionManager, Connection, SimpleConnection};
use diesel::prelude::*;
use diesel::query_builder::{AsQuery, QueryFragment, QueryId};
use diesel::query... |
// Copyright 2019 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 {
crate::{
big_endian::BigEndianU16,
buffer_reader::BufferReader,
mac::{data::*, MacAddr, MacFrame},
},
zerocopy::{... |
use crate::math::Vec3;
use crate::Hittable;
use crate::Material;
use rand::RngCore;
use rand_distr::{Distribution, Uniform, UnitDisc};
use std::sync::Arc;
pub struct Ray {
pub origin: Vec3,
pub direction: Vec3,
pub time: f64,
}
impl Ray {
pub fn at(&self, t: f64) -> Vec3 {
self.origin + t * se... |
extern crate semver;
extern crate serde_json;
extern crate serde;
extern crate petgraph;
extern crate release_triage;
use std::process::Command;
use std::path::Path;
use std::fs::{self, DirEntry, File};
use std::io::{self, Read};
use std::collections::{HashMap, HashSet};
use std::env;
use std::cmp;
use release_triage... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.