text stringlengths 8 4.13M |
|---|
use std::collections::{HashMap, BTreeMap};
use time;
use uuid;
use crate::data::ArcDataSlice;
use crate::object;
use crate::paxos;
use crate::store;
use crate::transaction;
#[derive(Debug, Copy, Clone)]
pub enum PrepareResult {
Nack(paxos::ProposalId),
Promise(Option<(paxos::ProposalId, bool)>)
}
#[derive(... |
use std::io::BufRead;
use quick_xml as qx;
use crate::template::writer::TemplateWriter;
/// Extract templates from a stream and pass them to a TemplateWriter.
pub fn extract_templates<R: BufRead>(stream: R, writer: &TemplateWriter) {
use self::qx::events::Event;
let mut reader = qx::Reader::from_reader(stre... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// Downtime : Downtiming gives you greater control over monitor notifications by allowing you to global... |
use std::collections::HashMap;
use crate::mcc::agent::agent_genome::AgentGenome;
use crate::neatns::network::activation::Activation;
use crate::neatns::network::node::NodeRef;
use crate::neatns::network::order;
#[derive(Clone, Debug)]
pub enum Action {
Link(usize, usize, f64),
// from, to, weight
Activati... |
use avl_tree::node::Node;
use avl_tree::tree;
use entry::Entry;
use std::ops::{Index, IndexMut};
/// An ordered map implemented using an avl tree.
///
/// An avl tree is a self-balancing binary search tree that maintains the invariant that the
/// heights of two child subtrees of any node differ by at most one.
///
//... |
use std::collections::hash_map::HashMap;
use std::collections::binary_heap::BinaryHeap;
pub const INFINITY: u32 = ::std::u32::MAX;
pub struct Node {
pub osm_id: i64,
pub lon: f64,
pub lat: f64,
pub adj: HashMap<usize, usize>
}
pub struct Edge {
pub osm_id: i64,
pub length: u32,
pub max... |
//pub use crate::fallback::vec3::*;
pub use crate::avx::vec3::*;
|
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::GLOBEN {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mu... |
#[derive(Debug)]
struct Point {
x:i32,
y:i32,
}
fn main(){
let pt = Point {
x:44,
y:66};
println!("{:?}",pt);
}//--main |
// Example code that deserializes and serializes the model.
// extern crate serde;
// #[macro_use]
// extern crate serde_derive;
// extern crate serde_json;
//
// use generated_module::[object Object];
//
// fn main() {
// let json = r#"{"answer": 42}"#;
// let model: [object Object] = serde_json::from_str(&jso... |
//! Foundation traits for creating Domain abstractions
//! using [the `Aggregate` pattern](https://martinfowler.com/bliki/DDD_Aggregate.html).
use std::fmt::Debug;
use std::ops::Deref;
use async_trait::async_trait;
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::versioning::Versioned;
/// A short extrac... |
use std::cell::RefCell;
use std::rc::Rc;
use bincode::options;
use serde::de::DeserializeSeed;
use serde::Serialize;
use super::magic_buffer::MagicBuffer;
use crate::buffer_pool::BufferPool;
use crate::protocol::serialization::KvsRequestDeserializer;
use crate::protocol::KvsRequest;
fn assert_eq_req<const SIZE: usiz... |
use ckb_types::{core::BlockNumber, packed::Byte32};
/// The invoker should only rely on `block_median_time` function
/// the other functions only use to help the default `block_median_time`, and maybe unimplemented.
pub trait BlockMedianTimeContext {
fn median_block_count(&self) -> u64;
/// Return timestamp a... |
use std::hash::{Hash, Hasher};
use std::cmp::{Eq, PartialEq, Ord, PartialOrd, Ordering};
use hex2d::{Angle, Coordinate, Direction, ToCoordinate, Position, ToDirection};
use board::{Board, cube_to_offset};
use scoring::move_score;
pub struct Game {
pub board: Board,
pub source: Vec<Vec<Coordinate>>,
pub s... |
mod base;
mod chain;
|
pub mod label;
pub mod progress_bar;
pub trait Renderable {
fn draw(&self, x : usize, y : usize);
} |
#![allow(unknown_lints)] // for clippy
#![warn(fat_ptr_transmutes)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
// TODO #![warn(missing_docs)]
#![warn(trivial_casts)]
#![warn(trivial_numeric_casts)]
#![warn(unused_import_braces)]
#![warn(unused_results)]
#![warn(variant_size_differenc... |
pub mod attrib;
pub mod auth_rule;
pub mod author_agreement;
pub mod cred_def;
pub mod node;
pub mod nym;
pub mod pool;
pub mod rev_reg;
pub mod rev_reg_def;
pub mod rich_schema;
pub mod schema;
pub mod txn;
pub mod validator_info;
pub use super::constants;
pub use super::identifiers;
pub use crate::common::did;
pub u... |
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
use std::time::{Duration, Instant};
pub struct Timer {
start_time: Instant,
duration: Duration,
}
impl Timer {
pub fn new(timer_duration: u64) -> Self {
let start_time = Instant::now();
let d... |
use std::process::Command;
use std::env;
fn main()
{
let mut args = vec![
"-e".to_string(),
include_str!("main.rb").to_string()
];
let mut i = 0;
for argument in env::args() {
if i > 0 {
args.push(argument);
}
i += 1;
}
Command::new(... |
fn main() {
let x = f2();
println!("{}", x);
}
fn f2() -> i32 {
3
}
|
#[derive(Debug)]
pub struct Bounds {
position: Vector2D,
dimensions: (f64, f64)
}
impl Bounds {
pub fn new(position : Vector2D, dimensions : (f64, f64)) -> Self {
Self {
position,
dimensions
}
}
pub fn x(&self) -> f64 {
self.position.x()
}
p... |
use crate::arg;
use crate::{Message, MessageType};
use crate::message::MatchRule;
use crate::strings::{BusName, Path, Interface, Member};
/// Helper methods for structs representing a Signal
///
/// # Example
///
/// Listen to InterfacesRemoved signal from org.bluez.obex.
///
/// ```rust,no_run
/// use dbus::blocking:... |
// 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. This file may not be copied, modified, or distributed
// except according to those terms.
//! Simple bitset l... |
use std::cmp::Ordering;
use std::collections::HashMap;
use crate::solutions::Solution;
use crate::util::int;
pub struct Day4 {}
impl Solution for Day4 {
fn part1(&self, input: String) {
let total: i32 = input
.split('\n')
.map(Room::new)
.filter(|room| room.calculate_c... |
use crate::schema::users;
use chrono::{NaiveDateTime, Local};
use diesel::ExpressionMethods;
#[derive(Insertable, Deserialize, AsChangeset)]
#[table_name="users"]
pub struct NewUser {
pub firstName: String,
pub lastName: String,
pub playerNumber: String,
pub created: NaiveDateTime
}
impl NewUser {
... |
pub struct Entity {
id: u32,
// TODO(orglofch): Add optional debug information.
}
|
use error_chain::error_chain;
error_chain! {
foreign_links {
Io(std::io::Error);
Tunstenite(tungstenite::error::Error);
Mpsc(futures::channel::mpsc::SendError);
}
}
|
pub fn encode(source: &str) -> String {
let sentinel_string = format!("{}{}", source, "\0");
let mut char_count = 0;
sentinel_string
.chars()
.zip(sentinel_string.chars().skip(1))
.fold(String::new(), |mut acc, (ch, prev)| {
char_count += 1;
if ch == '\0' || ch != prev {
if char_co... |
#[doc = "Register `APBRSTR1` reader"]
pub type R = crate::R<APBRSTR1_SPEC>;
#[doc = "Register `APBRSTR1` writer"]
pub type W = crate::W<APBRSTR1_SPEC>;
#[doc = "Field `TIM2RST` reader - TIM2 timer reset"]
pub type TIM2RST_R = crate::BitReader;
#[doc = "Field `TIM2RST` writer - TIM2 timer reset"]
pub type TIM2RST_W<'a, ... |
#[doc = "Reader of register CHAN_WORK[%s]"]
pub type R = crate::R<u32, super::CHAN_WORK>;
#[doc = "Reader of field `WORK`"]
pub type WORK_R = crate::R<u16, u16>;
#[doc = "Reader of field `CHAN_WORK_NEWVALUE_MIR`"]
pub type CHAN_WORK_NEWVALUE_MIR_R = crate::R<bool, bool>;
#[doc = "Reader of field `CHAN_WORK_UPDATED_MIR`... |
use super::full_memory_dump::*;
use super::*;
use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use std::mem::size_of;
use std::mem::MaybeUninit;
use dataview::Pod;
use log::info;
use memflow::*;
use memflow_derive::*;
pub const DUMP_VALID_DUMP64: u32 = 0x34365544;
pub const IMAGE_FILE_MACHINE_AMD64: u32 = 0x8... |
use crate::{core::ClassHash, state::CompressedContract};
#[allow(unused)]
use anyhow::Context;
use rusqlite::{OptionalExtension, Transaction};
use stark_hash::{OverflowError, StarkHash};
pub(crate) fn migrate(transaction: &Transaction<'_>) -> anyhow::Result<()> {
let genesis = transaction
.query_row(
... |
#![allow(non_snake_case)]
use std::io;
macro_rules! parse_line {
($($t: ty),+) => ({
let mut a_str = String::new();
io::stdin().read_line(&mut a_str).expect("read error");
let mut a_iter = a_str.split_whitespace();
(
$(
a_iter.next().unwrap().parse::<$t>().... |
use crate::core::prelude::*;
use crate::queue::clients::QueueAccountClient;
use crate::queue::responses::*;
use crate::queue::HasStorageClient;
use azure_core::errors::AzureError;
use azure_core::prelude::*;
use hyper::StatusCode;
use std::convert::TryInto;
#[derive(Debug, Clone)]
pub struct ListQueuesBuilder<'a, C>
w... |
use std::sync::Arc;
use catalogue::container::Container as CatalogueContainer;
use catalogue::infrastructure::persistence::inmem::InMemCatalogueRepository;
use catalogue::infrastructure::service::{SyncCollectionService, SyncPublicationService};
use common::event::EventSubscriber;
use common::infrastructure::event::{In... |
use git_sys::git_version_string;
use std::ffi::CStr;
use std::marker::PhantomData;
use std::mem::MaybeUninit;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Once;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum InitError {
#[error("this process has already initialized git")]
Initialized,
... |
use std::io;
use crate::board::Board;
use crate::coin::Coin;
pub fn read() -> io::Result<String> {
let mut buffer = String::new();
match io::stdin().read_line(&mut buffer) {
Ok(_n) => Ok(buffer),
Err(error) => Err(error),
}
}
pub fn render_board(board: &Board) {
for row_idx in (0..6).r... |
//! The gRPC generator
use std::{
convert::TryFrom,
num::{NonZeroU32, NonZeroUsize},
time::Duration,
};
use bytes::{Buf, BufMut, Bytes};
use http::{uri::PathAndQuery, Uri};
use metrics::{counter, gauge, register_counter};
use rand::rngs::StdRng;
use rand::SeedableRng;
use serde::Deserialize;
use tonic::{
... |
struct Solution {}
impl Solution {
pub fn longest_palindrome(s: String) -> String {
let mut r : u8 = s.as_bytes()[0];
let mut s = s.as_bytes();
let s_len = s.len();
let mut i = 1;
while i < s_len {
println!("{}", r);
r = r ^ s[i];
i+=1;
... |
use crate::{GuillotineAllocator, ShelfAllocator, Rectangle, Size};
use crate::tiled::SlabAllocatorRegion;
use crate::{point2, size2};
use crate::free_list::*;
#[derive(Copy, Clone, Debug)]
pub struct ArrayAllocId {
id: u32,
allocator_kind: AllocatorKind,
allocator_idx: FreeListHandle,
region_idx: Regio... |
#[doc = "Register `CCIPR2` reader"]
pub type R = crate::R<CCIPR2_SPEC>;
#[doc = "Register `CCIPR2` writer"]
pub type W = crate::W<CCIPR2_SPEC>;
#[doc = "Field `I2C4SEL` reader - I2C4 clock source selection"]
pub type I2C4SEL_R = crate::FieldReader<I2C4SEL_A>;
#[doc = "I2C4 clock source selection\n\nValue on reset: 0"]
... |
impl Solution {
pub fn subsets(nums: Vec<i32>) -> Vec<Vec<i32>> {
fn sets(xs: &[i32]) -> Vec<Vec<i32>> {
if xs.len() == 0 {
return vec![vec![]];
}
let subs = sets(&xs[1..]);
let mut news = subs.clone();
for i in 0..news.len() {
... |
pub fn is_armstrong_number(num: u32) -> bool {
let digits = number_to_vec(num);
num == digits
.iter()
.fold(0, |acc, x| acc + x.pow(digits.len() as u32))
}
fn number_to_vec(n: u32) -> Vec<u32> {
let mut digits = vec![];
let mut n = n;
while n > 9 {
digits.push(n % 10);
... |
//! Representation of LV2 ports.
use rayon::iter::{IntoParallelRefIterator, IterBridge, ParallelBridge};
use crate::bundle_model::{HasRelatedSet, NameRelation, ShortNameRelation, DocRelation, TypeRelation, LabelRelation, GenericRelation, IdentifiedBy, OptionallyIdentifiedBy};
use crate::bundle_model::impl_util::{Known... |
extern crate termion;
use termion::{clear, color, cursor, style};
use termion::event::Key;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
use std::iter::FromIterator;
use std::collections::LinkedList;
use std::io::{Write, stdout, stdin};
use std::time::Duration;
use std::thread;
struct Message {
se... |
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[repr(u8)]
pub enum SectionType {
Named = 0,
Type = 1,
Import = 2,
Function = 3,
Table = 4,
Memory = 5,
Global = 6,
Export = 7,
Start = 8,
Element = 9,
Code = 10,
Data = 11
}
impl SectionType {
pub fn from_int(v: u8... |
/// Solves the Day 03 Part 1 puzzle with respect to the given input.
pub fn part_1(input: String) {
let report: Vec<&str> = input.split_whitespace().collect();
let length = report.len();
let digits = report[0].len();
let mut counters: Vec<usize> = vec![0; digits];
for number in report {
fo... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
AdvancedThreatProtection_Get(#[from] ... |
#![recursion_limit = "1024"]
#[macro_use]
extern crate serde_derive;
extern crate yew_material_macro;
pub mod index;
pub mod theme;
use index::Index;
use wasm_bindgen::prelude::*;
use yew::prelude::*;
use yew::utils::document;
use yew_material_utils::log;
#[wasm_bindgen]
pub fn start() -> Result<(), JsValue> {
... |
use saigon_core::content::Content;
use saigon_core::{Command, HelpText, Plugin, PluginResponse, PluginResult};
use serde::Deserialize;
pub struct CatFact;
#[derive(Deserialize)]
struct CatFactJson {
pub fact: String,
pub length: i32,
}
impl Plugin for CatFact {
fn name(&self) -> String {
env!("CA... |
// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// Copyright (C) 2021 Subspace Labs, Inc.
// 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
//
... |
//! Solutions to the challenges in Set 2.
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use attacks;
use challenges::{ChallengeResults, ChallengeResultsBuilder};
use challenges::helpers;
use utils::block::{BlockCipher, Algorithms, OperationModes, PaddingSchemes};
use utils::data::Data;
us... |
#![no_std]
#![no_main]
#![feature(trait_alias)]
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Executor;
use embassy::time::Clock;
use embassy::util:... |
struct Solution;
impl Solution {
pub fn count_smaller(nums: Vec<i32>) -> Vec<i32> {
let mut result = Vec::new();
let a = Self::discretization(&nums);
// c 是树状数组
let mut c = vec![0; a.len() + 1];
for num in nums.iter().rev() {
let id = Self::get_id(&a, num);
... |
use package::ParenchymaDeep;
use parenchyma::{Build, Result};
use parenchyma::opencl::OpenCLContext;
use parenchyma::utility::Uninitialized;
use super::Package;
impl Build<OpenCLContext<Uninitialized>> for ParenchymaDeep {
fn build(cx: &mut OpenCLContext<Uninitialized>) -> Result<ParenchymaDeep> {
let pr... |
use rstest::rstest;
use autorel_chlg::{BreakingInfo, Change, ChangeLog, ChangeType, SemverScope};
fn semver_scope_of(message: &str) -> Option<SemverScope> {
let change = Change::parse_conventional_commit(message).expect("Not a conventional commit");
let changelog = ChangeLog::default() + change;
changelog... |
pub mod baron;
pub mod hero;
pub mod scenery;
pub mod thing;
|
#![warn(missing_docs)]
use sys;
use std::marker::PhantomData;
use std::ptr;
use {ImGuiColorEditFlags, ImVec2, ImVec4, Ui};
/// Mutable reference to an editable color value.
#[derive(Debug)]
pub enum EditableColor<'p> {
/// Color value with three float components (e.g. RGB).
Float3(&'p mut [f32; 3]),
/// C... |
# Heat shock RS with stress
# @input nostress stress
# @output hse hsp hsf hsf3 mfp hsf3:hse prot hsp:mfp hsp:hsf
# @initial hse prot hsp:hsf stress
# Only reachable graphs are constructed
hsf, hsp, hsf3
hsf hsp mfp, , hsf3
hsf3, hse hsp, hsf
hsf3 hsp mfp, hse, hsf
hsf3 hse, hsp, hsf3:hse
hsf3 hse hsp mfp,... |
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
#[derive(FromPrimitive, ToPrimitive, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[repr(i32)]
pub enum EUniverse {
Invalid = 0,
Public = 1,
Beta = 2,
Internal = 3,
Dev = 4,
}
#[derive(FromPrimitive, ToPrimitive, C... |
mod game;
mod init;
mod ecs;
mod var;
fn it_works() {}
|
use rwl::{App};
use clap::{App as Clap, Arg};
fn main() {
let matches = Clap::new("Worklog")
.version("1.0")
.author("Ota Klapka")
.subcommand(Clap::new("log")
.arg(Arg::new("message")
.required(true)
.index(1)
.about("Message to l... |
pub fn int_to_roman(num: i32) -> String {
let d1 = num % 10;
let d2 = (num / 10) % 10;
let d3 = (num / 100) % 10;
let d4 = (num / 1000) % 10;
let unit = |n: i32, c1: char, c2: char, c3: char| {
match n {
1 => vec![c1],
2 => vec![c1, c1],
3 => vec![c1, c1,... |
use std::fs::File;
use std::path::Path;
use std::io::Read;
use crate::cpu::{ConditionFlags, Register};
use crate::cpu::utils::*;
use crate::cpu::instructions::*;
pub struct Intel8080 {
pub regs: Register,
pub flags: ConditionFlags,
pub pc: usize,
pub sp: usize,
pub int_enable: u8,
pub memory:... |
#![allow(unused_imports)]
use codec::{Encode, Decode};
use frame_system::Config;
use frame_support::weights::DispatchInfo;
use sp_runtime::{
traits::{SignedExtension, DispatchInfoOf, Dispatchable},
transaction_validity::TransactionValidityError,
};
use sp_std::marker::PhantomData;
use sp_core::H160;
pub type A... |
#![deny(clippy::pedantic)]
#![no_std]
#![allow(incomplete_features)]
#![feature(generic_associated_types)]
extern crate alloc;
#[macro_use]
extern crate contracts;
use core::num::NonZeroU32;
use necsim_core::{
lineage::MigratingLineage,
reporter::{boolean::Boolean, Reporter},
};
use necsim_core_bond::{NonNe... |
#[doc = "Register `DCOUNT` reader"]
pub type R = crate::R<DCOUNT_SPEC>;
#[doc = "Field `DATACOUNT` reader - Data count value When read, the number of remaining data bytes to be transferred is returned. Write has no effect."]
pub type DATACOUNT_R = crate::FieldReader<u32>;
impl R {
#[doc = "Bits 0:24 - Data count va... |
//! copyrigt (c) 2020 by shaipe
//! 从rs实体文件中提取字段创建数据库表结构
//!
use lane::fs::{append_content, read_content};
use std::env;
use std::path::{Path, PathBuf};
mod mysql;
mod postgres;
/// 入口函数
fn main() {
// 获取输入参数
let args: Vec<String> = env::args().collect();
let prefix = if args.len() > 1 { &args[1] } else... |
macro_rules! rs_not_supported {
() => { panic!() };
}
macro_rules! locked {
() => { panic!() };
} |
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use futures::executor::block_on;
use memmap2::Mmap;
use rand::prelude::*;
use std::fs::OpenOptions;
use std::io::Write;
use std::num::{NonZeroU64, NonZeroUsize};
use std::time::Instant;
use std::{env, fs};
use subspace_archiving::archiv... |
use Opcode::*;
use Mode::*;
use std::fmt::{Debug, Formatter, Error, Display};
use std::io::Write;
use std::collections::VecDeque;
use std::hint::unreachable_unchecked;
//const DBG: bool = true;
const DBG: bool = false;
#[derive(Debug)]
pub struct Computer {
pub mem: Vec<i64>,
ptr: usize,
input: VecDeque<i... |
#[doc = "Reader of register CONN_REQ_WORD10"]
pub type R = crate::R<u32, super::CONN_REQ_WORD10>;
#[doc = "Writer for register CONN_REQ_WORD10"]
pub type W = crate::W<u32, super::CONN_REQ_WORD10>;
#[doc = "Register CONN_REQ_WORD10 `reset()`'s with value 0"]
impl crate::ResetValue for super::CONN_REQ_WORD10 {
type T... |
use geo::Point;
pub enum Dir {
North,
South,
West,
East
}
impl Dir {
pub fn right(&self) -> Dir {
use Dir::*;
match *self {
North => East,
East => South,
South => West,
West => North
}
}
pub fn left(&self) -> Dir {
... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://rust-lang.org/COPYRIGHT.
//
// 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 o... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Address {
pub address1: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub address2... |
use ::nalgebra::{
base::allocator::Allocator, base::dimension::DimName, DefaultAllocator, Dim, DimMin, U1,
};
use ::num_traits::float::Float;
const STEPS: usize = 1_000;
/// The `Min` trait specifies than an object has a minimum value
pub trait Min<T> {
/// Returns the minimum value in the domain of a given d... |
use super::*;
pub struct Sponge {
pub rate: Rate,
capacity: Capacity,
keccak_f: KeccakF,
}
impl Sponge {
pub fn new(rate: Rate, capacity: Capacity, width: StateBitsWidth) -> Sponge {
Sponge {
rate: rate,
capacity: capacity,
keccak_f: KeccakF::new(width),
... |
#![allow(clippy::op_ref, clippy::type_complexity)]
#![cfg(not(ci))]
use ark_ec::{CurveCycle, PairingEngine, PairingFriendlyCycle};
use ark_ed_on_mnt4_298::EdwardsParameters;
use ark_ff::{One, PrimeField};
use ark_marlin::constraints::snark::{MarlinSNARK, MarlinSNARKGadget};
use ark_marlin::fiat_shamir::constraints::Fi... |
/*!
```rudra-poc
[target]
crate = "messagepack-rs"
version = "0.8.0"
[report]
issue_url = "https://github.com/otake84/messagepack-rs/issues/2"
issue_date = 2021-01-26
rustsec_url = "https://github.com/RustSec/advisory-db/pull/835"
rustsec_id = "RUSTSEC-2021-0092"
[[bugs]]
analyzer = "UnsafeDataflow"
bug_class = "Unin... |
pub fn find() -> Option<u32> {
(1..999)
.flat_map(|a| (1..(999 - a)).map(move |b| (a, b, 1000 - a - b)))
.filter(|(a, b, c)| a * a + b * b == c * c)
.map(|(a, b, c)| a * b * c)
.nth(0)
}
|
use sync_resolve::hosts::{host_file, load_hosts};
fn main() {
let path = host_file();
println!("Loading host table from {}", path.display());
println!("");
let table = match load_hosts(&path) {
Ok(t) => t,
Err(e) => {
println!("Failed to load host table: {}", e);
... |
use anyhow::Result;
use ndarray::Array2;
use ndarray_stats::*;
use std::path::{Path, PathBuf};
// use ndarray::parallel::prelude::*;
use crate::graph::Graph;
use crate::io;
use crate::rank;
use crate::Rank;
pub fn parse_args(
input: &Path,
output: Option<&PathBuf>,
method: Option<&Rank>,
log2: &bool,
... |
// a crust is full of resources
pub mod start;
pub mod capalloc;
pub mod vspace;
// TODO: find a better place
pub const ROOT_SLOT: usize = ::mantle::kernel::CAP_INIT_CNODE;
pub const ROOT_PAGEDIR: usize = ::mantle::kernel::CAP_INIT_VSPACE;
pub const ROOT_BITS: usize = 64; // TODO: maybe this should be 32?
|
use ir::UnaryInst;
pub struct CastInst<'ctx>(UnaryInst<'ctx>);
impl_subtype!(CastInst => UnaryInst);
/// Define a generic cast instruction.
macro_rules! define_cast_instruction {
($name:ident => $ctor:ident) => {
pub struct $name<'ctx>($crate::ir::CastInst<'ctx>);
impl<'ctx> $name<'ctx>
{... |
#[doc = "Register `FNR` reader"]
pub type R = crate::R<FNR_SPEC>;
#[doc = "Field `FN` reader - FN"]
pub type FN_R = crate::FieldReader<u16>;
#[doc = "Field `LSOF` reader - LSOF"]
pub type LSOF_R = crate::FieldReader;
#[doc = "Field `LCK` reader - LCK"]
pub type LCK_R = crate::BitReader;
#[doc = "Field `RXDM` reader - R... |
use std::{
fs::{File, remove_dir_all, remove_file},
path::{PathBuf},
io::Read,
};
use bincode::{serialize_into, deserialize_from};
use chrono::prelude::*;
use tera::{Tera, Context};
use toml;
use walkdir::WalkDir;
use project::{Project};
use error::{StateError, StateResult};
use website::{Website, Color};... |
pub(crate) fn default<T: Default>() -> T {
Default::default()
}
|
use std::collections::{HashMap, HashSet};
use crate::graphemes_struct::Graphemes;
use len_trait::len::Len;
use std::ops::Index;
use push_trait::base::Push;
use itertools::Itertools;
pub mod graphemes_struct;
pub mod metrics;
type Coordinate = (usize, usize);
/// Returns the backtraced path as a vector of coordinates... |
use crate::api::downloads::FileInfo;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct LocalFile {
pub game: String,
pub file_name: String,
pub mod_id: u32,
pub file_id: u64,
pub update_status: UpdateStatus,
}
impl LocalFile {
pub fn new(fi: FileIn... |
use serde::Serialize;
use common::error::Error;
use common::result::Result;
use crate::application::dtos::RoleDto;
use crate::domain::role::RoleRepository;
use crate::domain::user::{UserId, UserRepository};
#[derive(Serialize)]
pub struct GetAllResponse {
pub roles: Vec<RoleDto>,
}
pub struct GetAll<'a> {
r... |
use super::{osgood, Exception, Isolate, Local, Valuable, V8};
pub use V8::Module;
enum Status {
Uninstantiated,
Instantiating,
Instantiated,
Evaluating,
Evaluated,
Errored,
}
impl Module {
pub fn compile(
src: Local<V8::String>,
name: Local<V8::String>,
) -> Result<Loc... |
use crate::material::*;
use crate::shared::*;
/// Information of a ray hit
pub struct HitRecord {
pub point: Point3,
pub normal: Vec3,
pub t: f32,
pub front_face: bool,
pub material: Arc<dyn Material>,
}
impl HitRecord {
pub fn new(ray: Ray, t: f32, outward_normal: Vec3, material: Arc<dyn Mate... |
#[macro_use]
extern crate clap;
extern crate hex;
extern crate ton_block;
extern crate ton_node_old;
extern crate ton_types;
extern crate ton_vm as tvm;
use std::fs::File;
use std::io::Write;
use std::sync::Arc;
use clap::AppSettings;
use serde_json::Value;
use ton_block::Serializable;
use ton_client::abi::{Abi, Call... |
use std::{ env, fs, error };
use error::Error;
pub struct Config {
query: String,
filename: String,
case_sensitive: bool,
}
impl Config {
pub fn new(mut args: env::Args) -> Result<Config, &'static str> {
args.next();
let query = match args.next() {
Some(arg) => arg,
None => return Err("Didn't get a que... |
use entry::Entry;
use treap::{implicit_tree, tree};
/// A struct representing an internal node of a treap.
pub struct Node<T, U> {
pub entry: Entry<T, U>,
pub priority: u32,
pub len: usize,
pub left: tree::Tree<T, U>,
pub right: tree::Tree<T, U>,
}
/// A struct representing an internal node of an ... |
use crate::translations::translations::{bytes_translation, packets_translation};
use crate::Language;
/// Enum representing the possible kind of chart displayed.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ChartType {
Packets,
Bytes,
}
impl ChartType {
pub(crate) const ALL: [ChartType; 2] ... |
use rand::prelude::*;
use rand::rngs::SmallRng;
use rtlib::vec::Vec3;
fn pdf(_p: Vec3) -> f64 {
1.0 / (4.0 * std::f64::consts::PI)
}
const N: u64 = 1000000;
const SEED: u64 = 0;
fn main() -> Result<(), std::io::Error> {
let mut rng = SmallRng::seed_from_u64(SEED);
let mut sum = 0.0;
for _ in 0..N {
... |
mod client;
mod config;
mod data;
mod file;
mod mongo;
mod services;
mod utils;
use std::io::Write;
use actix_web::{
middleware::{Logger, NormalizePath, TrailingSlash},
web, App, HttpServer,
};
use chrono::Local as ChronoLocal;
use clap::{App as ClapApp, Arg};
use env_logger::Env;
use log::info;
use crate::c... |
//! Tools to control view alignment
/// Specifies the alignment along both horizontal and vertical directions.
pub struct Align {
pub h: HAlign,
pub v: VAlign,
}
impl Align {
/// Creates a new Align object from the given horizontal and vertical alignments.
pub fn new(h: HAlign, v: VAlign) -> Self {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.