text stringlengths 8 4.13M |
|---|
#[cfg(feature = "ops")]
pub(crate) mod deref;
#[cfg(feature = "ops")]
pub(crate) mod deref_mut;
#[cfg(feature = "fn_traits")]
pub(crate) mod fn_;
#[cfg(feature = "fn_traits")]
pub(crate) mod fn_mut;
#[cfg(feature = "fn_traits")]
pub(crate) mod fn_once;
#[cfg(feature = "generator_trait")]
pub(crate) mod generator;
#[cfg... |
#[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::DMARIS {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
use std::fs::File;
use std::io::{BufReader, Read};
use bencode::FromBencode;
use serde_bencode::de;
use serde_bytes::ByteBuf;
use serde_derive::Deserialize;
fn main() {
// let s = TorrentFile { announce: "http://bttracker.debian.org:6969/announce".to_string(), info: Info { name: "debian-10.3.0-amd64-netinst.iso"... |
use onnx_pb::ModelProto;
use prost::Message;
use crate::shape_inference_proto;
/// Error type.
#[derive(Debug)]
pub enum Error {
/// Decode error.
Decode(prost::DecodeError),
/// Encode error.
Encode(prost::EncodeError),
}
/// Infers model shapes.
pub fn shape_inference(model: &ModelProto) -> Result... |
use std::collections::HashMap;
pub type Id = i32;
pub type UUID = String;
pub type Urgency = f32;
/// static std::string defaultProject;
static default_project: &str = "";
/// static std::string defaultDue
static default_due: &str = "";
/// static std::string defaultScheduled;
static default_scheduled: &str = "";
... |
pub struct Solution;
impl Solution {
pub fn shortest_palindrome(s: String) -> String {
if s.is_empty() {
return s;
}
let bytes = s.into_bytes();
let l = bytes.len();
let nan = std::usize::MAX;
let shift = {
let mut shift = vec![nan; l / 2];
... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
pub trait KtStd {
fn let_ref<R>(&self, block: impl FnOnce(&Self) -> R) -> R {
block(self)
}
fn let_mut<R>(&mut self, mut block: impl FnMut(&mut Self) -> R) -> R {
block(self)
}
fn let_owned<R>(self, block: impl FnOnce(Self) -> R) -> R where Self: Sized {
block(self)
}
... |
use opentelemetry::trace::StatusCode;
use std::{fmt::Display, str::FromStr};
pub(crate) enum Status {
Success,
Failure,
}
impl Display for Status {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Status::Success => "success",
St... |
use std::fmt;
pub struct Slope {
pub right: usize,
pub down: usize,
}
impl fmt::Display for Slope {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "(right {}, down {})", self.right, self.down)
}
}
|
use crate::ast::context::CheckerContext;
use crate::ast::error::TypeError;
use crate::ast::{type_check_code, Condition, VarDef, VarMap};
use crate::constraint::dedup_inputs;
use crate::ir::{self, Adaptable};
use utils::RcStr;
use itertools::Itertools;
use log::trace;
#[derive(Clone, Debug)]
pub struct TriggerDef {
... |
extern crate chrono;
extern crate gluster;
extern crate init_daemon;
extern crate juju;
extern crate rand;
extern crate rustc_serialize;
extern crate uuid;
use std::fs::{create_dir, File, OpenOptions};
use std::io::{BufRead, BufReader, Read, Write};
use std::path::Path;
use std::thread;
use self::chrono::*;
use self:... |
//! Classes for describing instruction operands.
// FIXUP: These will be used eventually.
// use cdsl::_camel_case;
// use cdsl::types::ValueType;
// use cdsl::typevar::_TypeVar;
|
use crate::wallet::keypair::*;
use crate::base::serialize::signed_obj::{SignedTxJson, TxJsonTxnSignatureBuilder, TxJsonBuilder};
use crate::base::crypto::signature::traits::signature::SignatureI;
use crate::base::crypto::signature::builder::SignatureBuilder;
use crate::base::data::inverse_fields_map::INVERSE_FIELDS_... |
use std::collections::HashMap;
use std::rc::Rc;
use std::sync::{mpsc, Arc};
use std::time::Duration;
use dbus::arg::{RefArg, Variant};
use dbus::ffidisp::stdintf::org_freedesktop_dbus::PropertiesPropertiesChanged;
use dbus::message::SignalArgs;
use dbus::tree::{Access, Factory};
use dbus::Path;
use crate::album::Albu... |
// Copyright 2018 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 failure::Error;
use wayland::{WlDataDeviceManager, WlDataDeviceManagerRequest};
use crate::client::Client;
use crate::object::{ObjectRef, RequestRecei... |
pub mod command_raw;
pub mod command;
pub use command_raw::CommandRaw;
pub use command::Command; |
use crate::challenges::Challenge;
use crate::ResultHashMap;
use crate::file_lines_to_string_vec;
use crate::ExpenseReport;
pub fn challenge() -> Challenge {
return Challenge::new(
expense_report_product_from_2_sum,
expense_report_product_from_3_sum,
String::from("resources/expense_report.tx... |
pub enum UnitType
{
SVG_ANGLETYPE_UNKNOWN = 0,
SVG_ANGLETYPE_UNSPECIFIED = 1,
SVG_ANGLETYPE_DEG = 2,
SVG_ANGLETYPE_RAD = 3,
SVG_ANGLETYPE_GRAD = 4
}
pub struct SVGAngle
{
unit_type : UnitType,
value : f32
} |
#[derive(Clone)]
pub struct GitUrl {
host: String,
path: String,
}
impl GitUrl {
const HTTP_PREFIX: &'static str = "http://";
const HTTPS_PREFIX: &'static str = "https://";
#[allow(dead_code)]
pub fn parse(value: &str) -> Option<Self> {
if value.starts_with(Self::HTTP_PREFIX) {
... |
mod hui_works;
pub mod material;
pub mod env;
|
mod file;
mod flush;
mod graphite;
mod internal;
mod native;
mod statsd;
pub use self::file::{FileServer, FileServerConfig};
pub use self::flush::FlushTimer;
pub use self::graphite::{Graphite, GraphiteConfig};
pub use self::internal::{Internal, InternalConfig, report_full_telemetry,
report_tel... |
#![feature(mpsc_select)]
extern crate time;
use std::thread;
use std::sync::mpsc;
use std::sync::mpsc::{SyncSender, Receiver};
use std::sync::mpsc::Select;
use std::io::prelude::*;
use std::fs::File;
use std::vec::Vec;
use time::PreciseTime;
struct StressedPacket {
writer : i32,
n : i32,
}
fn writer(out : S... |
use crate::models::*;
use std::vec::Vec;
pub trait UserRepository {
fn find(&self, id: &i64) -> Result<User, diesel::result::Error>;
fn delete(&self, id: &i64) -> bool;
fn create(&self, u: NewUser) -> Result<User, diesel::result::Error>;
fn message(&self) -> String;
fn find_all(&self) -> Result<Vec... |
// Copyright 2022 Datafuse Labs.
//
// 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 ... |
use input_i_scanner::{scan_with, InputIScanner};
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
let (h, w) = scan_with!(_i_i, (usize, usize));
let mut a = vec![vec![]; h];
for i in 0..h {
a[i] = scan_with!(_i_i, u64; w);
}
let mut ok = ... |
//! Package implement Write-Ahead-Logging.
//!
//! Write-Ahead-Logging is implemented by [Wal] type, to get started create
//! a configuration [Config] value. Subsequently, a fresh Wal instance can be
//! created or existing Wal from disk can be loaded, using the configuration.
//! Wal optionally takes a type parameter... |
/// A trait describing a buffer that is interleaved and mutable.
///
/// This allows for accessing the raw underlying interleaved buffer.
pub trait AsInterleavedMut<T> {
/// Access the underlying interleaved mutable buffer.
///
/// # Examples
///
/// ```rust
/// use audio::{Channels, AsInterleav... |
use super::*;
use crate::StableAbi;
use std::{
error::Error as ErrorTrait,
fmt::{self, Debug, Display},
};
///////////////////////////////////////////////////////////////////////////////
#[repr(transparent)]
#[derive(PartialEq, Eq, Clone, Copy, StableAbi)]
pub struct RSendError<T>(pub T);
impl<T> RSendErro... |
extern crate sync;
extern crate postgres;
extern crate time;
use std::str::from_utf8;
use std::io::{Acceptor, Listener};
use std::io::{TcpListener, TcpStream};
use time::Timespec;
use postgres::{PostgresConnection, NoSsl};
struct SensorPacket {
id: i32,
value: f64,
name: String,
time_created: time::Timespec... |
use crate::{
routes::crates_io::crate_versions::CrateVersionsGenerator,
source::{Source, SourceBuilder},
};
pub mod crate_versions;
pub struct CratesIoSource;
impl SourceBuilder for CratesIoSource {
fn build_source() -> Source {
Source::new("crates-io").register(CrateVersionsGenerator)
}
}
|
use super::InternalEvent;
use crate::transforms::lua::v1::format_error;
use metrics::{counter, gauge};
#[derive(Debug)]
pub struct LuaEventProcessed;
impl InternalEvent for LuaEventProcessed {
fn emit_metrics(&self) {
counter!("events_processed", 1,
"component_kind" => "transform",
... |
#[path = "is_process_alive_1/with_self.rs"]
mod with_self;
#[path = "is_process_alive_1/without_self.rs"]
mod without_self;
test_stdout!(without_pid_errors_badarg, "{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{cau... |
#[cfg(test)]
mod test;
use crate::runtime::time::datetime;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::*;
#[native_implemented::function(erlang:time/0)]
pub fn result(process: &Process) -> Term {
let time: [usize; 3] = datetime::local_time();
process.tuple_from_slice(... |
use crate::services::{config::Config, database::DB};
use events::Handler;
use lazy_static::lazy_static;
use log::warn;
use serenity::{
framework::standard::{
help_commands,
macros::help,
Args,
CommandGroup,
CommandResult,
HelpOptions,
StandardFramework,
}... |
use std::io;
use std::io::Read;
use regex::Regex;
fn matches_rule(val: u16, rule: (u16, u16, u16, u16)) -> bool {
(rule.0 <= val && val <= rule.1) || (rule.2 <= val && val <= rule.3)
}
fn main() {
let mut input = String::new();
io::stdin().read_to_string(&mut input).unwrap();
let re_rule = Regex::ne... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
#[doc = "Reader of register HOSTXDESC"]
pub type R = crate::R<u32, super::HOSTXDESC>;
#[doc = "Reader of field `CURTXDESC`"]
pub type CURTXDESC_R = crate::R<u32, u32>;
impl R {
#[doc = "Bits 0:31 - Host Transmit Descriptor Address Pointer"]
#[inline(always)]
pub fn curtxdesc(&self) -> CURTXDESC_R {
... |
use crate::p2p::{MultiaddrWithPeerId, MultiaddrWithoutPeerId};
use crate::subscription::{SubscriptionFuture, SubscriptionRegistry};
use core::task::{Context, Poll};
use libp2p::core::{connection::ConnectionId, ConnectedPoint, Multiaddr, PeerId};
use libp2p::swarm::handler::DummyConnectionHandler;
use libp2p::swarm::{
... |
use super::AutoCfg;
#[test]
fn autocfg_version() {
let ac = AutoCfg::with_dir("target").unwrap();
println!("version: {:?}", ac.rustc_version);
assert!(ac.probe_rustc_version(1, 0));
}
#[test]
fn version_cmp() {
use super::version::Version;
let v123 = Version::new(1, 2, 3);
assert!(Version::ne... |
use serde::Serialize;
macro_rules! mk_limits{
( $($id:ident : $type:ty = $value:expr,)* ) => {
#[derive(Serialize)]
pub struct Limits {
$( pub $id : $type, )*
}
pub const LIMITS : Limits = Limits {
$( $id : $value, )*
};
}
}
mk_limits! {
msg... |
//! Types and parsers for the `FROM` clause common to `DELETE` or `SHOW` schema statements.
use crate::common::{
qualified_measurement_name, ws1, MeasurementName, OneOrMore, Parser, QualifiedMeasurementName,
};
use crate::identifier::{identifier, Identifier};
use crate::internal::ParseResult;
use crate::keywords::... |
use sdl2::image::{self, InitFlag};
use sdl2::keyboard::Keycode;
use sdl2::mouse::MouseState;
use sdl2::rect::Point;
use sdl2::video::Window;
use sdl2::EventPump;
use std::collections::HashSet;
pub struct Input {
pub keys_current: HashSet<Keycode>,
pub keys_down: HashSet<Keycode>,
keys_up: HashSet<Keycode>... |
mod with_atom_name;
use super::*;
use crate::runtime::scheduler::SchedulerDependentAlloc;
#[test]
fn without_atom_name_errors_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
strategy::term::is_not_atom(arc_process.clone()),
strateg... |
// *****************************************************************************
//
// This program 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 2 of the License, or (at your option) any la... |
fn main(){
proconio::input!{n:u64,a:[u64;n]}
let mut m=0;
let mut x=0;
for &i in a.iter(){
if i<m{x+=m-i;}
m=m.max(i);
}
println!("{}",x);
} |
// Original implementation Copyright 2013 The Rust Project Developers <https://github.com/rust-lang>
//
// Original source file: https://github.com/rust-lang/rust/blob/master/src/libstd/io/buffered.rs
//
// Modifications copyright 2018 Austin Bonander <austin.bonander@gmail.com>
//
// Licensed under the Apache Li... |
use rocket::request::Form;
use rocket_contrib::json::JsonValue;
use crate::http::console::PagingParams;
use crate::http::user_session;
use crate::http::{session_user, Context};
use crate::models::domain::Domain;
use crate::models::user::UserFlag;
use crate::repo::{DomainRepo};
use crate::{conn, util};
#[derive(FromF... |
// Copyright 2023 Datafuse Labs.
//
// 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 ... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
use std::fs;
fn main() {
let result = solve_puzzle("input");
println!("And the result is {}", result);
}
fn solve_puzzle(file_name: &str) -> u32 {
let mut layout = parse_layout(read_data(file_name));
loop {
let new_layout = run_round(&layout);
if new_layout == layout {
brea... |
// 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::switchboard::base::*,
crate::switchboard::hanging_get_handler::{HangingGetHandler, Sender},
crate::switchboard::switchboard_impl::S... |
use oxygengine::prelude::*;
#[derive(Debug, Default)]
pub struct GameState {
camera: Option<Entity>,
camera_ui: Option<Entity>,
}
impl State for GameState {
fn on_enter(&mut self, world: &mut World) {
// instantiate world objects from scene prefab.
world
.write_resource::<Prefa... |
// =========
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use std::process::exit;
const MOD: usize = 1000000007;
pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);
impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
pub fn new(r: R, w: W) -> IO<R, W> {
IO(r, std::io::B... |
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
pub struct VkDebugReportCallbackCreateInfoEXT {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkDebugReportFlagBitsEXT,
pub pfnCallback: PFN_vkDebugReportCallbackEXT,
pub pUserData: *mut c_void,
}
impl VkD... |
// Copyright 2017 Dasein Phaos aka. Luxko
//
// 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 a... |
use crate::extensions::context::ClientContextExt;
use serenity::{
framework::standard::{macros::command, CommandResult},
model::prelude::*,
prelude::*,
};
#[command]
async fn prefix(ctx: &Context, msg: &Message) -> CommandResult {
let config = ctx.get_config().await;
if let Err(why) = msg
... |
/*
* Given an array of integers, return indices of the two numbers such that they add up to a specific target.
* You may assume that each input would have exactly one solution, and you may not use the same element twice.
*
* Example:
* ----------
* Given nums = [2, 7, 11, 15], target = 9,
* Because nums[0] + num... |
#![allow(non_snake_case)]
#![cfg(test)]
#[test]
fn Cannot_reassign_immutable_variable() {
let x = 1;
//x = 3;
assert_eq!(x, 1);
}
#[test]
fn Can_reassign_mutable_variable() {
let mut x = 1;
x = 3;
assert_eq!(x, 3);
}
#[test]
fn Can_create_explicit_var_1() {
let x: i32 = 1;
}
#[test]
fn... |
//! Implementation of the standard x64 ABI.
use alloc::vec::Vec;
use log::trace;
use regalloc::{RealReg, Reg, RegClass, Set, SpillSlot, Writable};
use std::mem;
use crate::binemit::Stackmap;
use crate::ir::{self, types, types::*, ArgumentExtension, StackSlot, Type};
use crate::isa::{x64::inst::*, CallConv};
use crate... |
use crate::error::HandleError;
use crate::filter::*;
use http::StatusCode;
use model::*;
use mysql::MySqlPool;
use repository::ResetScore;
use warp::filters::BoxedFilter;
use warp::path;
use warp::{Filter, Rejection, Reply};
pub fn route(db_pool: &MySqlPool) -> BoxedFilter<(impl Reply,)> {
warp::post()
.an... |
/*
Copyright (c) 2015, 2016 Saurav Sachidanand
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, di... |
use crate::domain;
use near_sdk::{
json_types::U128,
serde::{Deserialize, Serialize},
};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(crate = "near_sdk::serde")]
pub struct BatchId(pub U128);
impl From<domain::BatchId> for BatchId {
fn from(value: domain::BatchId) -> Self {
S... |
#[cfg(feature = "erasure")]
use crate::erasure::{NUM_CODING, NUM_DATA};
#[derive(Clone, Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
// The Meta column family
pub struct SlotMeta {
// The number of slots above the root (the genesis block). The first
// slot has slot 0.
pub slot: u64,
// The ... |
use super::CelestialBody;
use crate::codec::{Decode, Encode};
use crate::{remote_type, Quaternion, RemoteObject, Vector3};
remote_type!(
/// Used to get flight telemetry for a vessel, by calling `Vessel::flight()`. All of
/// the information returned by this class is given in the reference frame passed to that method.... |
pub mod escape_stm;
|
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
//
#![allow(dead_code, non_snake_case)]
use std::path::Path;
pub fn ASSET_PINECONE_MATTE() -> &'static Path {
Path::new("../assets/pinecones/matte/Pinecone.gltf")
}
pub fn ASSET_PINECONE_SHINY() -> &'static Path {
Path::new("../assets/pi... |
use nalgebra as na;
use uwb_clock_tracker::{
dwt_utils,
clock_tracker,
clock_tracker::ClockTracker,
};
fn main() {
println!("Hello, dwt: {}", na::Vector3::<f32>::x());
let tracker = ClockTracker::<clock_tracker::CONSTRUCTED>::new(1e-8, 0.18e-9);
let mut tracker = tracker.init_with_matdiag(0,... |
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::fmt;
use rabble::{Pid, CorrelationId, Envelope};
use msg::Msg;
use vr::states::*;
use super::vr_msg::VrMsg;
use super::vr_ctx::VrCtx;
/// Generate a state struct: `$struct_name` from a set of fields
///
/// Gene... |
//! Implémentation d’une intelligence artificielle plaçant systématiquement aléatoirement un jeton
use super::connect_four::{Interface, Area, State};
/// Intelligence artificielle aléatoire
pub struct RandomBot {
#[doc(hidden)]
name : String
}
impl RandomBot {
/// Initialise l’intelligence artificielle
... |
use anyhow::{anyhow, Error, Result};
use std::str::FromStr;
#[derive(Debug, Clone)]
enum Op {
Nop(isize),
Acc(i32),
Jmp(isize),
}
impl FromStr for Op {
type Err = Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut s = s.trim().split(' ');
let token = s.next().ok_or_e... |
use crate::load_function_ptrs;
use crate::prelude::*;
use std::os::raw::c_void;
load_function_ptrs!(PhysicalDeviceProperties2Functions, {
vkGetPhysicalDeviceProperties2KHR(
physicalDevice: VkPhysicalDevice,
pProperties: *mut VkPhysicalDeviceProperties2KHR
) -> (),
vkGetPhysicalDeviceFeatu... |
use crate::{error, state, types};
use mysql::{params, prelude::Queryable};
use snafu::ResultExt;
pub fn check_database(config: &types::Config) -> error::Result<()> {
let _ = mysql::Pool::new(&config.db_url).context(error::DbConnectionError {})?;
Ok(())
}
pub fn insert_subscriptions(
list_name: &str,
s... |
//! Modules that can be implemented for specific cores.
pub use self::spi::HardwareSpi;
pub use self::timer::{
Timer8, Timer8Setup, ClockSource8, WaveformGenerationMode8,
Timer16, Timer16Setup, ClockSource16, WaveformGenerationMode16,
};
pub use self::usart::HardwareUsart;
mod spi;
mod timer;
mod usart;
|
//! The module exposes the `H2Client` struct, which implements a futures-based API for performing
//! HTTP/2 requests, based on Tokio.
use super::{
HttpRequestHeaders,
HttpRequestBody,
HttpResponseHeaders,
HttpResponseBody,
HttpResponse
};
use client::connectors::{TlsConnector, CleartextConnector, ... |
mod hash;
mod poseidon;
pub use hash::{poseidon_hash, poseidon_hash_many, PoseidonHasher};
pub use poseidon::{permute, permute_comp, PoseidonState};
|
fn main() {
windows::core::build_legacy! {
Windows::ApplicationModel::Contacts::KnownContactField,
};
}
|
use crate::{DocBase, VarType};
const DESCRIPTION: &'static str = r#"
Natural logarithm of any `x > 0` is the unique `y` such that `e^y = x`
"#;
pub fn gen_doc() -> Vec<DocBase> {
let fn_doc = DocBase {
var_type: VarType::Function,
name: "log",
signatures: vec![],
description: DESCR... |
#[macro_use]
pub mod errors;
pub mod commands;
pub mod http;
pub mod metrics;
pub mod types;
|
use super::country_data::CountryData;
use nanoserde::DeRon;
fn load_countries() -> Vec<CountryData> {
let countries: Vec<CountryData> =
DeRon::deserialize_ron(include_str!("../assets/Countries.ron")).unwrap();
countries
}
lazy_static! {
pub static ref COUNTRIES: Vec<CountryData> = load_countries();
}
|
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
#[macro_use]
extern crate lazy_static;
use aoc;
use regex::Regex;
use std::cmp;
use std::collections::HashMap;
type HexCoord = (i32, i32, i32);
type HexVec = (i32, i32, i32);
type HexGrid = HashMap<HexCoord, i32>;
fn add(c: HexCoord, v: HexVec) -> HexCoord {
(c.0 + v.0, c.1 + v.1, c.2 + v.2)
}
fn count_black_ad... |
use gl::types::*;
use std::marker::PhantomData;
use super::{BufferType, BufferData, BufferAcces, ReadBufferMap, WriteBufferMap, DynamicBuffer};
use crate::get_value;
pub struct Buffer<T, Kind, Acces>
where
T: Sized + BufferData,
Kind: BufferType,
Acces: BufferAcces
{
pub(crate) id: GLuint,
pub(crat... |
// xfail-stage0
use std;
use libc();
use zed(name = "std");
use bar(name = "std", ver = "0.0.1");
// FIXME: commented out since resolve doesn't know how to handle crates yet.
// import std._str;
// import x = std._str;
mod baz {
use std;
use libc();
use zed(name = "std");
use bar(name = "std", ver = "0.0.1");... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::IsA;
use glib::translate::*;
#[cfg(any(feature = "v2_2", feature = "dox"))]
use glib::GString;
use std::fmt;
use webkit2_webextension_sys;
glib_wrapper! {
pub ... |
use std::thread;
use bus::Bus;
use super::Signal;
impl From<usize> for Signal {
fn from(sig: usize) -> Signal {
match sig as libc::c_int {
signal_hook::consts::SIGINT => Signal::INT,
signal_hook::consts::SIGTERM => Signal::TERM,
signal_hook::consts::SIGQUIT => Signal::... |
mod c01_convert_hex_to_base64;
use failure::Error;
pub fn add_challenges(cryptochallenges: &mut Vec<fn() -> Result<(), Error>>) {
cryptochallenges.push(c01_convert_hex_to_base64::run);
}
|
struct Node {
data: i32,
next: Option<Box<Node>>,
}
impl Node {
fn new(data: i32) -> Node {
Node {
data: data,
next: None,
}
}
fn assign_next(&mut self, next: Node) {
self.next = Some(Box::new(next));
}
}
fn main() {
let node = No... |
use cgmath::*;
use num_traits::cast::NumCast;
use serde::*;
#[derive(Copy, Clone, PartialEq, Debug, Serialize, Deserialize)]
pub struct Rect<T> {
pub start: Point2<T>,
pub end: Point2<T>,
}
impl<T> Rect<T> {
pub fn new(start: Point2<T>, end: Point2<T>) -> Self {
Self { start, end }
}
}
impl<T... |
use super::util;
use super::writer::Writer;
use crate::MkvId;
const MAX_TRACK_NUMBER: u64 = 126;
// Class to hold data the will be written to a block.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Frame {
// Id of the Additional data.
add_id_: u64,
// Pointer to additional data. Owned by this class.
... |
//! Interactability might be important, but just sticking to regular shapes can get a bit boring.
//!
//! It's time for the wonderful world of images! Drawing images is almost the same as drawing
//! colors, but instead of using `Background::Col` we use `Background::Img`. The big change to
//! learn with images is asse... |
#[doc = "Reader of register WRP1BR"]
pub type R = crate::R<u32, super::WRP1BR>;
#[doc = "Writer for register WRP1BR"]
pub type W = crate::W<u32, super::WRP1BR>;
#[doc = "Register WRP1BR `reset()`'s with value 0xff00_ff00"]
impl crate::ResetValue for super::WRP1BR {
type Type = u32;
#[inline(always)]
fn rese... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
pub mod size;
pub use size::*;
|
//! Add a bonus to the comment line or the line that can have a declaration.
//!
//! Ref: https://github.com/jacktasia/dumb-jump/blob/master/dumb-jump.el
use crate::Score;
pub type FileExtension = String;
#[derive(Debug, Clone)]
pub struct Language(FileExtension);
impl<T: AsRef<str>> From<T> for Language {
fn f... |
use super::*;
#[test]
fn testing_the_scaling() {
let mut miniworld = World::new();
let some_entity = miniworld
.spawn()
.insert_bundle((
HerdSize::new_single_population(100),
Susceptible(22),
Infected(2),
Recovered(14),
))
.id();
... |
pub struct UniverseMap {}
|
use super::*;
use std::cell::Cell;
#[allow(clippy::redundant_allocation)]
fn _covariant_arc<'a: 'b, 'b, T>(foo: Arc<&'a T>) -> Arc<&'b T> {
foo
}
fn _covariant_rarc<'a: 'b, 'b, T>(foo: RArc<&'a T>) -> RArc<&'b T> {
foo
}
#[test]
fn test_covariance() {
struct F<T>(T);
fn eq<'a, 'b, T>(left: &RArc<&'... |
//works but still a bit slow (around 40s)
use projecteuler::digits;
use projecteuler::primes;
const SET_SIZE: usize = 5;
fn main() {
dbg!(digits::concat_numbers(1234, 5678));
let mut prime_generator = primes::primes_iterator()
.filter(|x| match x {
primes::PrimeOrFactor::Prime(_) => true,
... |
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn static_id<'a,'b>(t: &'a ()) -> &'static ()
where 'a: 'static { t }
//~^ WARN unnecessary lifetime parameter `'a`
fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
where 'a: 'b, 'b: 'static { t }
//~^ WARN unnecess... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.