text stringlengths 8 4.13M |
|---|
use crate::*;
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub struct Globals {
// Global info
pub ident_table: IdentifierTable,
pub global_var: ValueTable,
method_table: GlobalMethodTable,
inline_cache: InlineCache,
method_cache: MethodCache,
pub instant: std::time::Instant,
... |
//! All code responsible for validating and repair the /etc/fstab file.
use self::FileSystem::*;
use crate::system_environment::SystemEnvironment;
use disk_types::{BlockDeviceExt, FileSystem, PartitionExt};
use distinst_chroot::Command;
use distinst_disks::{Disks, PartitionInfo};
use partition_identity::{PartitionID, ... |
mod cat;
mod exit_codes;
mod opt;
mod state;
use std::io::{stdin, stdout, Write};
use std::path::Path;
use std::process;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use anyhow::{anyhow, Result};
use structopt::StructOpt;
use cat::{fast_print, print_insert, echo};
use exit_codes::ExitCode;
use ... |
#![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 ResourceSkuCapacity {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub minimum: Option<i64>,
... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{WalletAccount, WalletStore};
use anyhow::{format_err, Result};
use starcoin_types::account_address::AccountAddress;
use std::collections::{hash_map::Entry, HashMap};
use std::sync::Mutex;
struct WalletAccountObject {
... |
#![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 Operation {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serd... |
//! # Math Integers
//!
//! This module implements a number of different math integers.
//!
//! ## Integers
//!
//! * Unsigned Integers: `unsigned_integer`, `unsigned_public_integer`
//! * Signed Integers: `signed_integer`, `signed_public_integer`
//! * Natural Numbers modulo an integer: `nat_mod`, `public_nat_mod`
//!... |
use serde::{Deserialize, Serialize};
#[derive(Hash, Eq, PartialEq, Debug, Clone, Serialize, Deserialize)]
pub struct SignatureOutput {
pub signature: String,
pub recoverable: bool,
}
|
struct Point {
x : i8,
y : i8
}
fn f (x: i8) -> i8 {
return x;
}
fn main() {
let mut m = 12;
m = 1;
let mut out = f (12);
let hoge = out + 1;
if out == 11 {
println!("yes");
} else {
println!("no")
}
let arr = [0, 1, 2, 3, 4];
for v in arr.iter() {
... |
use rand;
use rand::Rng;
use num::{Num, ToPrimitive};
use std::cmp::Ord;
use std::fmt;
use std::fmt::Display;
use rand::distributions::range::SampleRange;
/// Vector with a defined number of elements that can
/// add, remove and edit values.
///
/// # Remarks
///
/// This struct is implemented to be used with numerica... |
#![allow(dead_code)]
use iced_wgpu::{wgpu, wgpu::vertex_attr_array};
pub struct StarRenderer {
surface_pipeline: wgpu::RenderPipeline,
surface_bind_group_layout: wgpu::BindGroupLayout,
surface_bind_group: wgpu::BindGroup,
atmosphere_pipeline: wgpu::RenderPipeline,
}
impl StarRenderer {
pub fn new... |
// Copyright 2021 <盏一 w@hidva.com>
// 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 writing,... |
use crate::{
constants::currency::{MILLICENTS, UNIT},
pallets_core::Author,
Balances, Event, Runtime,
};
use frame_support::{
parameter_types,
traits::{Currency, Imbalance, OnUnbalanced},
weights::IdentityFee,
};
use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
use sp_runtime... |
use tantivy::tokenizer::AsciiFoldingFilter;
#[derive(Clone)]
pub struct AsciiFoldingFilterFactory {}
impl AsciiFoldingFilterFactory {
pub fn new() -> Self {
AsciiFoldingFilterFactory {}
}
pub fn create(self) -> AsciiFoldingFilter {
AsciiFoldingFilter {}
}
}
#[cfg(test)]
mod tests {
... |
#[macro_use]
extern crate criterion;
use criterion::Criterion;
use std::time::Duration;
fn c() -> Criterion {
Criterion::default()
.sample_size(10) // must be >= 10 for Criterion v0.3
.warm_up_time(Duration::from_secs(1))
.with_plots()
}
fn git_hash() -> String {
use std::process::Com... |
fn main() {
c4_bounds();
println!();
c4_empty_bounds();
println!();
c5_multiple_bounds();
println!();
c6_where_bounds();
println!();
c7_associated_items_1();
println!();
c7_associated_items_2();
}
use std::fmt::Debug;
use std::fmt::Display;
trait HasArea {
fn area(&self... |
// This file is part of Substrate.
// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ht... |
const MAGIC: [u8; 16] = [0x00, 0xff, 0xff, 0x00,
0xfe, 0xfe, 0xfe, 0xfe,
0xfd, 0xfd, 0xfd, 0xfd,
0x12, 0x34, 0x56, 0x78];
pub enum PacketTypes {
/// 0x00
///
/// # Parameters
///
/// 1. Time, `long`
ConnectedPing(i64),
/// 0x01, 0x02
///
/// # Parameters
///
/// 1. Tim... |
use std::fs;
use aoc20::days::day11;
fn get_layout(filename: &str, part: day11::Part) -> day11::SeatLayout {
let contents = fs::read_to_string(filename)
.expect("Something went wrong reading the file");
day11::SeatLayout::new(&contents, part)
}
#[test]
fn day11_parse_seat() {
let layout = ge... |
use crate::core::{transactions, Permission, Pool, ServiceResult};
use crate::identity_policy::{Action, RetrievedAccount};
use crate::login_required;
use crate::web::admin::transactions::{
naive_date_time_option_serializer, TransactionProduct, TransactionWithProducts,
};
use crate::web::utils::HbData;
use actix_web:... |
use crate::domain::domain::SysRole;
use crate::domain::vo::SysResVO;
use chrono::NaiveDateTime;
#[crud_table(table_name: "sys_role"| table_columns: "id,name,parent_id,create_date,del")]
#[derive(Debug, Clone)]
pub struct SysRoleVO {
pub id: Option<String>,
pub name: Option<String>,
//父id(可空)
pub parent... |
#[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::DEVPWREVENTEN {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R,... |
use std::{ops::Add, ops::AddAssign};
/* [0.0, 1.0] range color */
#[derive(Clone, Copy)]
pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
}
impl Color {
pub fn new(r: f32, g: f32, b: f32) -> Color {
Color { r, g, b }
}
pub fn grayscale(&self) -> Self {
let avg = (self.r ... |
use simplex_noise::permutations::Permutations;
use simplex_noise::grad::Grad;
pub fn noise2d(x: f32, y: f32) -> f32 {
let grad3: Vec<Grad> = vec![
Grad::new(1.0, 1.0, 0.0, 0.0), Grad::new(-1.0, 1.0, 0.0, 0.0),
Grad::new(1.0, -1.0, 0.0, 0.0), Grad::new(-1.0, -1.0, 0.0, 0.0),
Grad::new(1.0, ... |
use crate::framework::ApiResultTraits;
use crate::framework::Environment;
use serde::Serialize;
use url::Url;
pub trait Endpoint<ResultType = (), QueryType = (), BodyType = ()>
where
ResultType: ApiResultTraits,
QueryType: Serialize,
BodyType: Serialize,
{
fn method(&self) -> surf::http::Method;
fn... |
/// An enum to represent all characters in the Sundanese block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Sundanese {
/// \u{1b80}: 'ᮀ'
SignPanyecek,
/// \u{1b81}: 'ᮁ'
SignPanglayar,
/// \u{1b82}: 'ᮂ'
SignPangwisad,
/// \u{1b83}: 'ᮃ'
LetterA,
/// \u{1b84}: 'ᮄ'
... |
use crate::components::Codeblock;
use crate::with_raw_code;
use material_yew::{
dialog::{ActionType, MatDialogAction},
MatButton, MatDialog, WeakComponentLink,
};
use std::borrow::Cow;
use yew::prelude::*;
use yew::services::ConsoleService;
pub struct Dialog {
link: ComponentLink<Self>,
basic_dialog_li... |
use serde::Deserialize;
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct QuoteResponseWrapper {
pub quote_response: QuoteResponse,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct QuoteResponse {
pub result: Vec<Quote>,
}
#[derive(Deserialize)]
#[serde(rename_all = "... |
use proconio::input;
fn main() {
input! {
n: i32,
}
let mut ans: f64 = 0.0;
for a in 1..=(n - 1) {
ans += (n as f64) / (a as f64);
}
println!("{}", ans);
}
|
// Copyright 2021 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
//! Slot and token management functions
use crate::context::Pkcs11;
use crate::error::{Result, Rv};
use crate::label_from_str;
use crate::mechanism::{MechanismInfo, MechanismType};
use crate::slot::{Slot, SlotInfo, TokenInfo};... |
use std::borrow::Cow;
use std::collections::HashMap;
use std::sync::Arc;
use hyper::{Method, StatusCode};
use regex::Regex;
use context::Captures;
use middleware::Middleware;
struct Route {
pattern: Regex,
middleware: Arc<Middleware>,
}
#[derive(Default)]
pub struct Router {
routes: HashMap<Method, Vec<... |
// This file is part of rdma-core. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/rdma-core/master/COPYRIGHT. No part of rdma-core, including this file, may be copied, modified, propagated, or distributed ... |
use std::{cmp::Ordering, collections::HashMap, rc::Rc};
use failure::{format_err, Error, ResultExt};
use log::{error, info, warn};
use super::{ChunkVisitor, Origin};
use crate::{
chunks::{
ResourceWrapper, StringTableCache, StringTableWrapper, XmlNamespaceEndWrapper,
XmlNamespaceStartWrapper, XmlT... |
#[derive(Debug, PartialEq, Eq)]
pub struct Palindrome {
factors: Vec<(u64, u64)>,
}
impl Palindrome {
pub fn generate(min: u64, max: u64, num: u64) -> Option<Palindrome> {
if !Self::is_valid(num) {
return None;
}
let factors = (min..max)
.filter_map(|a| Self::fa... |
struct List<T> {
head: Link<T>,
}
type Link<T> = Option<Box<Node<T>>>;
struct Node<T> {
value: T,
next: Link<T>,
}
impl<T> List<T> {
fn new() -> Self {
List {
head: None
}
}
fn push(&mut self, val: T) {
let node = Box::new(Node {
value: val,
... |
use std::collections::VecDeque;
use std::fmt::{self, Debug, Formatter};
use crate::terminal_pane::terminal_character::{
CharacterStyles, TerminalCharacter, EMPTY_TERMINAL_CHARACTER,
};
/*
* Scroll
*
* holds the terminal buffer and controls the viewport (which part of it we see)
* its functions include line-wr... |
//! # FFI (Foreign Function Interface) Module
//!
//! This module contains implementations of functions that libbsd.a expects to
//! be able to call.
//!
//! Copyright (c) 42 Technology, 2019
//!
//! Dual-licensed under MIT and Apache 2.0. See the [README](../README.md) for
//! more details.
use log::debug;
/// Numbe... |
// Copyright 2021 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... |
#[doc = "Register `CFGR` reader"]
pub type R = crate::R<CFGR_SPEC>;
#[doc = "Register `CFGR` writer"]
pub type W = crate::W<CFGR_SPEC>;
#[doc = "Field `SW` reader - System clock switch"]
pub type SW_R = crate::FieldReader<SW_A>;
#[doc = "System clock switch\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq,... |
use std::collections::HashMap;
use std::collections::hashmap::{Occupied, Vacant};
use std::io::{BufferedReader, EndOfFile, File, IoResult};
enum GameResult {
Win,
Draw,
Loss
}
#[deriving(Copy, Clone)]
struct TeamResult {
wins: uint,
draws: uint,
losses: uint,
}
impl TeamResult {
fn new() ... |
mod tryreader;
pub use self::tryreader::TryReader;
mod monoid;
pub use self::monoid::Monoid;
pub use self::monoid::SemiGroup;
pub use self::monoid::FreeMonoid; |
#[aoc_generator(day1)]
fn parse_input_day1(input: &str) -> Vec<i32> {
input.lines().map(|line| line.parse().unwrap()).collect()
}
#[aoc(day1, part1)]
fn part_one(input: &[i32]) -> i32 {
input.iter().map(|x| fuel_requirement(*x)).sum()
}
#[aoc(day1, part2)]
fn part_two(input: &[i32]) -> i32 {
input
... |
pub mod stoppable_task;
pub mod subscriber;
pub mod types;
pub use stoppable_task::{StoppableTask, StoppableTaskPtr};
pub use subscriber::{Subscriber, SubscriberPtr, Subscription};
pub use types::ExecutorPtr;
|
pub trait Versioned: Clone {
fn version(&self) -> String;
}
pub trait VersionFilterable<T> {
fn filter_by_version(&self, expected_version: &str) -> Self;
}
impl<T: Versioned> VersionFilterable<T> for Vec<T> {
fn filter_by_version(&self, expected_version: &str) -> Self {
self.iter()
.fi... |
// Struct that stores a big integer as a vector of u64s
// and provides methods for arithmetic operations
use std::ops::{Add, Mul, Sub, Div, Rem, BitAnd, BitOr, BitXor, Shl, Shr, Neg};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BigInt {
pub digits: Vec<u64>,
pub sign: bool,
}
macro_rules! impl_from {
... |
#[doc = "Reader of register RCC_MP_BOOTCR"]
pub type R = crate::R<u32, super::RCC_MP_BOOTCR>;
#[doc = "Writer for register RCC_MP_BOOTCR"]
pub type W = crate::W<u32, super::RCC_MP_BOOTCR>;
#[doc = "Register RCC_MP_BOOTCR `reset()`'s with value 0"]
impl crate::ResetValue for super::RCC_MP_BOOTCR {
type Type = u32;
... |
struct Solution;
impl Solution {
// 官方题解中的思路
pub fn sorted_squares(a: Vec<i32>) -> Vec<i32> {
let mut ans = vec![0; a.len()];
if a.is_empty() {
return ans;
}
// 这个减少了一半的时间。
if a[0] >= 0 {
return a.into_iter().map(|v| v * v).collect();
}
... |
pub mod interpreter;
pub mod misc;
pub mod symbol_table;
pub mod types;
|
use parity_scale_codec::Encode;
use parity_scale_codec_derive::Encode as DeriveEncode;
#[test]
fn size_hint_for_struct() {
#[derive(DeriveEncode)]
struct Struct<A, B, C> {
pub a: A,
pub b: B,
#[codec(skip)]
pub c: C,
}
let v = Struct::<String, Vec<i32>, u32> { a: String::from("foo"), b: vec![1, 2, 3], c: ... |
/**********************************************
> File Name : extensive_hash_table.rs
> Author : lunar
> Email : lunar_ubuntu@qq.com
> Created Time : Wed 24 Feb 2021 08:15:01 PM CST
> Location : Shanghai
> Copyright@ https://github.com/xiaoqixian
*********************************************... |
//! This is the core implementation that doesn't depend on the hasher at all.
//!
//! The methods of `IndexMapCore` don't use any Hash properties of K.
//!
//! It's cleaner to separate them out, then the compiler checks that we are not
//! using Hash at all in these methods.
//!
//! However, we should probably not let ... |
#[doc = "Register `AHB1ENR` reader"]
pub type R = crate::R<AHB1ENR_SPEC>;
#[doc = "Register `AHB1ENR` writer"]
pub type W = crate::W<AHB1ENR_SPEC>;
#[doc = "Field `GPDMA1EN` reader - GPDMA1 clock enable Set and reset by software."]
pub type GPDMA1EN_R = crate::BitReader;
#[doc = "Field `GPDMA1EN` writer - GPDMA1 clock ... |
#[cfg(debug_assertions)]
use colored::Colorize;
#[cfg(debug_assertions)]
lazy_static! {
pub static ref SS: syntect::parsing::SyntaxSet =
{ syntect::parsing::SyntaxSet::load_defaults_newlines() };
pub static ref TS: syntect::highlighting::ThemeSet =
{ syntect::highlighting::ThemeSet::load_defaul... |
pub async fn http_client(url: String) -> Result<String, reqwest::Error> {
let res = reqwest::get(url)
.await?
.text()
.await?;
Ok(res)
} |
pub struct Post {
content: String,
}
impl Post {
pub fn new() -> DraftPost {
DraftPost {
content: String::new(),
}
}
pub fn content(&self) -> &str {
&self.content
}
}
pub struct DraftPost {
content: String,
}
impl DraftPost {
pub fn request_review(self)... |
use rustc::lib::llvm::{Bool, False, True, IntEQ, IntNE, IntSGT, IntSGE, IntSLT, IntSLE};
use rustc::lib::llvm;
use std::collections::hashmap::HashMap;
use libc::{c_uint, c_ulonglong, puts};
use generator::{Generator, RANGE_GEN_ID, RANGE_GEN_INIT, RANGE_GEN_NEXT};
use generator;
use lltype::*;
use std::owned::Box;
pub ... |
pub mod aes256_cbc;
|
use std::fs::File;
use std::collections::HashMap;
use std::io::{BufRead, BufReader};
const D : [(i8, i8);4] = [(-1, 0), (1, 0), (0, -1), (0, 1)];
fn print_map(map : &Vec<Vec<i8>>) {
println!("Map size: {}x{}", map.len(), map[0].len());
for r in 0..map.len() {
for c in 0..map[r].len() {
let... |
#[cfg(test)]
mod tests {
use std::path::Path;
use backtrace::Backtrace;
use libc::c_void;
pub type Callback = extern "C" fn(data: *mut c_void);
extern "C" {
fn foo(cb: Callback, data: *mut c_void);
}
extern "C" fn store_backtrace(data: *mut c_void) {
let bt = backtrace::Ba... |
extern crate proc_macro;
extern crate syn;
#[macro_use]
extern crate quote;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn dsl(_arg: TokenStream, input: TokenStream) -> TokenStream {
print!("{}", input.to_string());
// let expand = quote! {};
// expand.parse().unwrap()
input
}
|
/*
* 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
*/
/// AwsNamespace : The namespace associated with the tag filter entry.
/// The namespace associated wit... |
#![feature(try_blocks)]
#![feature(in_band_lifetimes)]
pub use domain::ui_interaction::*;
pub use domain::ui_layout::*;
pub use domain::ui_library::*;
pub use grammar::*;
use crate::unflow_parser::{str_to_flow, Unflow};
pub mod grammar;
pub mod unflow_parser;
pub mod domain;
pub fn parse(str: &str) -> Unflow {
... |
use log::{error, info};
use serenity::{
client::bridge::gateway::ShardManager,
framework::standard::{
help_commands,
macros::{check, group, help},
Args, CheckResult, CommandGroup, CommandOptions, CommandResult,
DispatchError::CheckFailed,
HelpOptions, StandardFramework,
... |
extern crate sdl2;
use super::sdl2::keyboard::Scancode;
pub fn sdlk_to_scancode(sdlk: Scancode) -> Option<u8>
{
match sdlk
{
Scancode::Escape => Some(0x01),
Scancode::Num1 => Some(0x02),
Scancode::Num2 => Some(0x03),
Scancode::Num3 => Some(0x04),
Scancode::Num4 => Some(0x05),
Scancode::Num5 => Some(0x06... |
use bellman::{gadgets::Assignment, groth16, Circuit, ConstraintSystem, SynthesisError};
use sapvi::bls_extensions::BlsStringConversion;
use std::rc::Rc;
use std::{cell::RefCell, collections::HashMap};
use std::{
ops::{Add, AddAssign, MulAssign, SubAssign},
time::Instant,
};
// use fnv::FnvHashMap;
use itertools... |
use crate::actix::prelude::*;
use crate::actix::{ Actor, Handler, Running, StreamHandler };
use crate::actor::ws::{ Connect, Disconnect };
use crate::model::{ AppState, Msg };
use actix_web::ws::{ Message, ProtocolError, WebsocketContext };
use std::time::{ Duration, Instant };
use uuid::Uuid;
pub struct Session(pub U... |
use auto_impl::auto_impl;
#[auto_impl(&)]
trait Foo {
fn foo<T>();
fn bar<U>(&self);
fn baz<'a, U>() -> &'a str;
fn qux<'a, 'b, 'c, U, V, T>(&self) -> (&'a str, &'b str, &'c str);
}
fn main() {}
|
use crate::states::intro::IntroStopSignal;
use oxygengine::{
animation::{
phase::Phase,
spline::{SplinePoint, SplinePointDirection},
},
prelude::{filter_box, FilterBoxProps, FilterBoxValues},
user_interface::raui::core::prelude::*,
};
use serde::{Deserialize, Serialize};
fn make_animati... |
#![deny(rust_2018_idioms)]
pub mod cairo;
pub mod config;
pub mod consts;
pub mod core;
pub mod ethereum;
pub mod retry;
pub mod rpc;
pub mod sequencer;
pub mod state;
pub mod storage;
pub mod update;
/// Creates a [`stark_hash::StarkHash`] from an even hex string, resulting in compile-time error
/// when invalid.
ma... |
//! A simple octant struct for transforming line points.
use Point;
use core::ops::{Neg, Sub};
use num_traits::Zero;
/// A simple octant struct for transforming line points.
pub struct Octant {
value: u8,
}
impl Octant {
#[inline]
/// Get the relevant octant from a start and end point.
pub fn new<T>(... |
use std::io::prelude::*;
use std::io::BufReader;
use std::io::Error;
use std::net::{Shutdown, TcpStream};
use std::sync::Arc;
use std::sync::Mutex;
use std::thread;
use std::time::Duration;
use url::Url;
type Callback = Arc<Mutex<Option<Box<Fn(String) + Send>>>>;
type CallbackNoArgs = Arc<Mutex<Option<Box<Fn() + Send>... |
pub mod module {
use std::ops;
#[derive(Copy, Clone, Debug, Default)]
pub struct Vec3 {
e: [f32; 3]
}
impl Vec3 {
pub fn new(x: f32, y: f32, z: f32) -> Vec3 {
let vals = [x, y, z];
Vec3 { e: vals }
}
pub fn init() -> Vec3 {
let vals = [0., 0., 0.];
Vec3 { e: vals }
... |
//! [![github]](https://github.com/ramirezmike/Tlayuda) [![crates-io]](https://crates.io/crates/tlayuda) [![docs-rs]](crate)
//!
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-t... |
use crate::{
tracking::OSU_TRACKING_INTERVAL, util::MessageExt, BotResult, CommandData, Context,
MessageBuilder,
};
use chrono::Duration;
use std::{str::FromStr, sync::Arc};
#[command]
#[short_desc("Adjust the tracking interval (in seconds) - default 3600")]
#[owner()]
async fn trackinginterval(ctx: Arc<Conte... |
// Copyright 2018-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) a... |
use crate::dsp::types::*;
impl DspPoint {
pub fn new(x: i32, y: i32) -> DspPoint {
DspPoint { x, y }
}
}
|
use uuid::Uuid;
#[derive(Default, Debug, Clone)]
pub struct Validation {
code: String,
}
impl Validation {
pub fn new() -> Self {
Validation {
code: Uuid::new_v4().to_string(),
}
}
pub fn code(&self) -> &str {
&self.code
}
}
impl PartialEq for Validation {
... |
use crate::safety::SafetyGame;
use bosy::automata::conversion::LTL2Automaton;
use bosy::specification::Specification;
use cudd::{CuddManager, CuddNode};
use hyperltl::{HyperLTL, Op};
use log::info;
use std::ops::Not;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub(crate) enum ReductionMethod {
SingleCounter... |
#![allow(missing_docs)]
//! Module to translate [ApllodbAst](apllodb_sql_parser::ApllodbAst) into [apllodb_shared_components](crate)' data structures.
pub(crate) mod alias;
pub(crate) mod alter_table_action;
pub(crate) mod column_constraint;
pub(crate) mod column_definition;
pub(crate) mod column_name;
pub(crate) mod... |
use crate::email_service::send_invitation;
use actix::{Handler, Message};
use chrono::{Duration, Local};
use diesel::{self, prelude::*};
use uuid::Uuid;
use crate::errors::ServiceError;
use crate::models::{DbExecutor, Invitation};
use actix::Addr;
use actix_web::{web, Error, HttpResponse, ResponseError};
use futures:... |
#![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 StandardList {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub value: Vec<Standard>,
#[ser... |
mod phantom;
use ndarray::Array2;
use image::GrayImage;
use phantom::shepp_logan_2d;
fn main() {
let arr = shepp_logan_2d(500);
export_image(String::from("C:\\Users\\batemanc\\Documents\\source\\test.png"), arr);
println!("Hello, world!");
}
pub fn export_image(path: String, arr: Array2<f64>) {
... |
use uart;
use mem::alloc::first_fit::FirstFitAlloc;
use mem::alloc::Box;
use mem::data_structs::list::List;
pub fn test_ff() {
uart::write_str("Testing: First fit memory allocator:\nSetting range 0 to 256.\n");
let ff = FirstFitAlloc::new(0,256);
ff.debug_print();
uart::write_str("Allocating 50 bytes:\... |
fn main() {
let vec0 = Vec::new();
let mut vec1 = fill_vec(vec0);
// -----------------------------------------------------
// 1. Make another, separate version of the data that's in `vec0` and pass that
// to `fill_vec` instead.
// ----------------------------------------------------
//let... |
#![deny(clippy::all)]
//! Riddle crate with miscelanious support functionality required by
//! the rest of the riddle crates.
mod color;
mod error;
pub mod eventpub;
pub use color::*;
pub use error::*;
|
use libmimalloc_sys::mi_heap_check_owned;
use libmimalloc_sys::mi_heap_contains_block;
use libmimalloc_sys::mi_heap_malloc_aligned;
use libmimalloc_sys::mi_heap_new;
use libmimalloc_sys::mi_heap_t;
use std::any::TypeId;
use std::cell::Cell;
use std::collections::HashMap;
use std::hash::Hash;
use std::hash::Hasher;
use ... |
//! Low-level bindings for the c-ares library.
//!
//! In most cases this crate should not be used directly. The c-ares crate provides a safe wrapper
//! and should be preferred wherever possible.
extern crate c_types;
extern crate libc;
#[cfg(target_os = "android")]
extern crate jni_sys;
mod constants;
mod ffi;
p... |
#[doc = "Reader of register DDRCTRL_DFILPCFG0"]
pub type R = crate::R<u32, super::DDRCTRL_DFILPCFG0>;
#[doc = "Writer for register DDRCTRL_DFILPCFG0"]
pub type W = crate::W<u32, super::DDRCTRL_DFILPCFG0>;
#[doc = "Register DDRCTRL_DFILPCFG0 `reset()`'s with value 0x0700_0000"]
impl crate::ResetValue for super::DDRCTRL_... |
#![allow(unused_must_use)]
use std::net;
use std::env;
use std::time;
use std::thread;
use std::process;
use std::io::prelude::*;
use std::sync::{Arc, Mutex};
use std::os::unix::io::{RawFd, IntoRawFd};
#[allow(unused_imports)]
use log::{trace, debug, info, warn, error, Level};
#[cfg(not(target_os = "android"))]
exter... |
#![feature(half_open_range_patterns, exclusive_range_pattern)]
use packed_simd::{Simd, u8x8};
use rayon::prelude::*;
macro_rules! decode_func {
($($name:ident: $n:literal),+) => {
$(
#[inline]
fn $name(input: &[u8], res: &mut [u8]) {
assert!(input.len() >= $n);
let n... |
use crossterm::cursor::MoveTo;
use crossterm::style::Print;
use crossterm::terminal::{Clear, ClearType};
use std::collections::VecDeque;
use std::io::{Error, Write};
const MAX_HISTORY: usize = 256;
pub struct Input {
history: VecDeque<Vec<char>>,
cursor: usize,
kind: InputKind,
changed: bool,
heig... |
pub use crate::apex::blackboard::basic::*;
pub use crate::apex::buffer::basic::*;
pub use crate::apex::error::basic::*;
pub use crate::apex::event::basic::*;
pub use crate::apex::file_system::basic::*;
pub use crate::apex::interrupt::basic::*;
pub use crate::apex::limits::*;
pub use crate::apex::logbook::basic::*;
pub ... |
use heroku_nodejs_utils::package_json::PackageJson;
/// Return the package manager name from package.json if it's present and
/// supported.
pub(crate) fn get_supported_package_manager(pkg_json: &PackageJson) -> Option<String> {
let pkg_mgr_name = pkg_json.package_manager.clone()?.name;
match pkg_mgr_name.as_s... |
use std::collections::HashMap;
use std::thread;
use std::time::{Duration, Instant};
extern crate sdl2;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::Sdl;
const TARGET_FPS: u64 = 60;
enum Controls {
Up,
Down,
Left,
Right,
Pause,
Shoot,
Quit,
}
#[derive(Debug)]
pub struct ... |
use pattern::Pattern;
use regex::{Captures, Regex};
pub struct TurnipPattern {
pattern: String,
}
impl Pattern for TurnipPattern {
fn to_regex(&self) -> Regex {
let re = Regex::new(r":(\w+)").unwrap();
let pattern = self.pattern.as_str();
let regex = re.replace_all(pattern, |caps: &C... |
use network::Network;
use network::Node;
use network::Edge;
pub struct Genome {
input_count: usize,
output_count: usize,
genes: Vec<Gene>,
}
impl Genome {
pub fn new(input_count: usize, output_count: usize, genes: Vec<Gene>) -> Genome {
Genome {
input_count: input_count,
... |
#[cfg(feature = "profile")]
use cpuprofiler::PROFILER;
use indicatif::{ParallelProgressIterator, ProgressBar, ProgressStyle};
use rand::prelude::*;
use rand::rngs::SmallRng;
use rayon::iter::ParallelIterator;
use rayon::prelude::*;
use std::io::{self};
use std::sync::Arc;
use structopt::StructOpt;
use rtlib::color::{... |
#[doc = "Register `RCC_MP_AHB4LPENCLRR` reader"]
pub type R = crate::R<RCC_MP_AHB4LPENCLRR_SPEC>;
#[doc = "Register `RCC_MP_AHB4LPENCLRR` writer"]
pub type W = crate::W<RCC_MP_AHB4LPENCLRR_SPEC>;
#[doc = "Field `GPIOALPEN` reader - GPIOALPEN"]
pub type GPIOALPEN_R = crate::BitReader;
#[doc = "Field `GPIOALPEN` writer -... |
use crate::{
i8080::*,
instruction::{InstructionData, Opcode},
mmu::Mmu,
};
impl I8080 {
pub(crate) fn cpi(&mut self, data: InstructionData) -> Result<()> {
if let Some(value) = data.first() {
let (v, c) = self.a.complement_sub(value);
self.flags.set_non_carry_flags(v);
... |
use crate::tokenizer::RawKeyword;
use crate::tokens::Punct;
use std::rc::Rc;
/// A 2 element buffer of
/// MetaTokens, this will use a
/// "ring buffer"-esque scheme
/// for automatically overwriting
/// any element after 2
#[derive(Clone, Debug)]
pub struct LookBehind {
list: [Option<MetaToken>; 3],
pointer: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.