text stringlengths 3.09k 13.9k |
|---|
use std::str;
use std::ops::{Range, Index};
use std::sync::Arc;
use std::mem::{self, ManuallyDrop};
use std::time::Instant;
use crate::range_map::RangeMap;
use crate::elf::{self, Strtab, Endian};
use crate::utils::{StableIndex, get_ms};
use crate::types::{Bitness, Endianness};
use crate::binary::{BinaryData, SymbolTab... |
use crate::logger;
use crate::theme;
use crate::vec::Vec2;
use crate::view::View;
use crate::views;
use crate::Printer;
use unicode_width::UnicodeWidthStr;
#[derive(Clone, Debug, PartialEq)]
enum ModuleFilter {
All,
Module,
}
fn record_above_set_filter(
record_level: log::Level,
display_filter: log::... |
//
// msgf_aeg.rs
// Musical Sound Generator Framework
// Aeg Class
//
// Created by <NAME> on 2021/10/15.
// Copyright (c) 2021 <NAME>.
// Released under the MIT license
// https://opensource.org/licenses/mit-license.php
//
use crate::core::*;
//---------------------------------------------------------
// ... |
use std::fmt;
use std::marker::PhantomData;
use serde::de::{self, Deserializer, DeserializeOwned};
#[derive(Debug, Deserialize, Clone)]
pub struct Pagination {
#[serde(rename = "TotalCount")]
pub total: usize,
#[serde(rename = "PageNumber")]
pub page: usize,
#[serde(rename = "PageSize")]
pub si... |
use super::auth::Auth;
use super::defs::*;
use actix_redis::Command;
use actix_web::{web, HttpResponse};
use redis_async::resp::RespValue;
use redis_async::resp_array;
use serde_json::json;
use std::time::Instant;
pub async fn get_rooms(
// _path: web::Path<String>,
data: web::Data<MyData>,
auth: Auth,
) -... |
use std::io::Error as IOError;
use std::path::Path;
use pest::error::ErrorVariant;
use pest::error::InputLocation;
use pest::error::LineColLocation;
use pyo3::exceptions::PyFileNotFoundError;
use pyo3::exceptions::PyOSError;
use pyo3::exceptions::PyRuntimeError;
use pyo3::exceptions::PySyntaxError;
use pyo3::exception... |
mod utils;
use ndarray::Array2;
use std::iter::Iterator;
use std::str::FromStr;
use tera::{Context, Tera};
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_all... |
extern crate actix_web;
extern crate memmap;
extern crate etag;
use std::io;
use std::fs;
use std::path;
use self::actix_web::{
HttpRequest,
HttpResponse,
HttpMessage,
http,
Body
};
use self::actix_web::http::{
Method,
};
use self::http::header;
use ::templates;
///Matches given ETag against... |
use crate::account_service::*;
use crate::billing::billing_service;
use crate::billing::billing_service::*;
use crate::file_service::*;
use crate::utils::get_build_info;
use crate::{router_service, verify_auth, verify_client_version, ServerError, ServerState};
use lazy_static::lazy_static;
use lockbook_crypto::pubkey::... |
/*! Utilities for benchmarking egg.
These are not considered part of the public api.
*/
use std::path::PathBuf;
use std::time::{Duration, Instant};
use crate::{AstSize, Extractor, Language, Metadata, Pattern, RecExpr, Runner, Searcher};
fn mean_stdev(data: &[f64]) -> (f64, f64) {
assert_ne!(data.len(), 0);
... |
// 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.
#![allow(deprecated)]
use {
crate::{font_catalog::TypefaceInAssetIndex, serde_ext},
anyhow::Error,
manifest::v2,
serde::Deserialize,
s... |
/*
Here is code for creating nice patch
*/
use crate::{CompareResult, Hunk};
use chrono::format::{DelayedFormat, StrftimeItems};
use std::borrow::Cow;
use std::fmt;
/// Options for creating patch files
#[derive(Clone, Copy, Debug)]
pub struct PatchOptions {
/// Sometimes user want's to compare only subslice of a... |
// This code is part of Breakout.
//
// Breakout is free software: you can redistribute it and/or modify it under
// the terms of the CC BY 4.0 license as published by Creative Commons, either
// version 4 of the License, or (at your option) any later version.
//
// https://creativecommons.org/licenses/by/4.0/legalcode... |
// This file is part of the uutils coreutils package.
//
// (c) <NAME> <<EMAIL>>
// (c) <NAME> <<EMAIL>>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (ToDO) NEWROOT Userspec pstatus
#[macro_use]
extern crate u... |
// Copyright (c) 2017 <NAME>, RWTH Aachen University
//
// MIT License
//
// 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... |
//! Types and functions relating to block trees.
#![warn(missing_docs)]
use bitcoin::blockdata::block::BlockHeader;
use bitcoin::consensus::params::Params;
use bitcoin::hash_types::BlockHash;
use thiserror::Error;
use crate::block::store;
use crate::block::time::Clock;
use crate::block::{Bits, BlockTime, Height, Targ... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... |
use std::error;
use std::fmt;
use std::io;
use std::thread;
use std::time::Duration;
use std::time::SystemTime;
use std::{env, sync::Arc};
use rustls::client::ServerCertVerified;
use rustls::client::ServerCertVerifier;
use rustls::ServerName;
use rustls::{Certificate, ClientConfig};
use ureq;
#[derive(Debug)]
struct ... |
mod event;
mod lock;
mod matchable;
pub use self::{
event::{CommandEvent, EventClient},
lock::TestLock,
matchable::{assert_matches, Matchable},
};
use std::{collections::HashMap, fmt::Debug, sync::Arc};
use bson::{bson, doc, oid::ObjectId, Bson};
use semver::Version;
use serde::Deserialize;
use self::ev... |
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
//! Runtime modules.
use std::{collections::BTreeMap, fmt::Debug};
use impl_trait_for_tuples::impl_for_tuples;
use serde::{de::DeserializeOwned, Serialize};
use oasis_core_runtime::common::cbor;
use crate::{
context::{DispatchContext, TxContext},
error, event, modules, storage,
storage::Store,
types:... |
//
use crate::util::OptAccordingToWord;
use crate::util::OptMaxBufferSize;
use flood_tide::parse_simple_gnu_style;
use flood_tide::HelpVersion;
use flood_tide::{Arg, NameVal, Opt, OptNum};
use flood_tide::{OptParseError, OptParseErrors};
use crate::util::OptColorWhen;
use crate::util::OptUcXParam;
use std::str::FromSt... |
use crate::{
format_args::{ExpandInto, FormatArgs, FormatIfArgs, LocalVariable, WriteArgs},
parse_utils::TokenStream2Ext,
shared_arg_parsing::{ExprArg, ExprArgs},
Error,
};
use proc_macro2::{Ident, Span, TokenStream as TokenStream2};
use quote::{quote, quote_spanned};
#[cfg(test)]
mod tests;
///////... |
//! Provides userspace applications with the ability
//! to send and receive 802.15.4 packets.
// System call interface for sending and receiving 802.15.4 packets.
//
// Author: <NAME>
// Date: Jan 12 2017
//
use core::cell::Cell;
use core::cmp;
use kernel::{AppId, Driver, Callback, AppSlice, Shared};
use kernel::Ret... |
// Copyright 2021, The Tremor Team
//
// 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... |
//! Gallery image specification
use std::fmt;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use url::Url;
use crate::{model::common::AccountID, serialization::unix_epoch};
/// Gallery image unique ID
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Serialize, Deserialize)]
pub struct Galle... |
use super::response_utils;
use super::tools::ToolsHandler;
use crate::database::{
postgres::database::Postgres, Database, DatabaseOperation, DatabaseTool, DenViewSettings,
};
use crate::Error;
use hyper::{
header::{LOCATION, USER_AGENT},
Body, Client, Method, Request, Response, Uri,
};
use std::{net::Socket... |
// 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.
//! > \<lqd> bikesh... |
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
use crossbeam_channel::{bounded, Receiver, Sender};
use crate::{
actor::{Act, Actor, ActorHandle},
audio::source::Empty,
error::Error,
};
use super::source::AudioSource;
pub struct AudioOutput {
_handle: ActorHandle<StreamMsg>,
sink: AudioS... |
//! Note: This module is private, and only enabled if both `std` and
//! `error-traces` are on.
use core::sync::atomic::{AtomicU8, Ordering};
#[cfg(feature = "std")]
pub(super) static BACKTRACE_ENABLED: TraceConfig = TraceConfig::new(
&["OCKAM_BACKTRACE", "RUST_LIB_BACKTRACE", "RUST_BACKTRACE"],
false,
);
#[c... |
pub mod circuit;
pub mod dialog;
mod lumped;
mod source;
use crate::editor::{component, component::components::Components, entity::Entity, property};
use crate::{dom, unit};
use wasm_bindgen::JsCast;
pub fn node_name(idx: usize) -> String {
(0..(idx / 26) + 1)
.map(|i| ((idx - 26 * i) as u8 + 97u8) as char... |
use crate::benchmark::BenchmarkConfig;
use crate::connection::OutgoingMessage;
use crate::measurement::Measurement;
use crate::report::{BenchmarkId, ReportContext};
use crate::{ActualSamplingMode, Bencher, Criterion, DurationExt};
use std::marker::PhantomData;
use std::time::Duration;
/// PRIVATE
pub(crate) trait Rout... |
use alloc::{boxed::Box, sync::Arc, vec};
use raw_window_handle::HasRawWindowHandle;
use zerocopy::AsBytes;
use super::{
buffer::Buffer,
buffer_pool::BufferPool,
camera::{Camera, CameraController},
pipeline_cache::PipelineCache,
render_target::OffscreenRenderTarget,
Material, Mesh, Model, Rende... |
use std::convert::TryFrom;
use wasm_bindgen::prelude::*;
use rand::seq::SliceRandom;
use rand::thread_rng;
use web_sys::console;
const COLOR_STEPS: &'static [u8] = &[0, 95, 135, 175, 215, 255];
#[wasm_bindgen(getter_with_clone)]
pub struct ConversionResult {
pub status: i32,
pub message: String,
}
struct AS... |
use std::fmt::Display;
use std::io::{BufRead, BufReader, BufWriter, Write};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::Duration;
use clap::{ArgEnum, Parser};
use eyre::eyre;
use regex::Regex;
use tap::Tap;
use time::{format_description, OffsetDateTime};
use wait_timeout::ChildEx... |
#![allow(clippy::zero_prefixed_literal)]
use std::error::Error as RError;
use std::fmt;
use std::io::Error as IOError;
use std::sync::PoisonError;
use std::time::SystemTimeError;
// use parking_lot;
/// These error can be returned when opening or calling methods on a DB, Transaction etc...
#[derive(Debug, Clone)]
pub... |
use header::Header;
use serde_network;
use super::{HashStoreError, Db, DbError};
use hash::*;
use ::{ValuePtr};
use hashstore::SearchDepth;
use pow::U256;
use pow;
const SKIP_STEPS: [u64;4] = [1, 16, 256, 4096];
/// DbHeader is a header connected to genesis, with some meta-data
///
#[derive(Serialize, Deserialize)]... |
/*! Python `super` class.
See also:
https://github.com/python/cpython/blob/50b48572d9a90c5bb36e2bef6179548ea927a35a/Objects/typeobject.c#L7663
*/
use crate::function::OptionalArg;
use crate::obj::objfunction::PyMethod;
use crate::obj::objstr::PyStringRef;
use crate::obj::objtype::{PyClass, PyClassRef};
use crate::p... |
use crate::{
command_recorder::QueueType,
mesh::Mesh,
render::{ForwardPipeline, Renderer},
setup::DebugUtils,
};
use ash::{
version::{DeviceV1_0, InstanceV1_0},
vk,
};
use present::{Surface, Swapchain};
use render::{RenderPlan, RenderTarget};
use setup::Adapter;
use slotmap::{new_key_type, SlotM... |
use actix_compat_bytes::Bytes;
use actix_web::http::{HeaderMap, HeaderName};
use http::header::SERVER;
use http::HeaderValue;
use std::collections::HashMap;
use std::convert::TryInto;
use std::str;
use crate::core::context::Context;
use crate::Response;
pub use crate::context::actix_request::ActixRequest;
use crate::... |
//! This module contains items used to determine which values are allowed to
//! be used on certain object attributes (aka properties).
use libmtp_sys as ffi;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
/// Enumeration to determine the data type of the allowed values.
#[derive(Debug, Clone, Copy, Fr... |
use crate::Result;
use executor;
use graph::Edge;
use graph::Graph;
use graph::Vertex;
use il;
use il::program::Program;
use il::Function;
use il::FunctionLocation;
use il::ProgramLocation;
use std::collections::HashMap;
use std::collections::HashSet;
// Honestly not a big fan of how the graph is designed, clients of ... |
#[macro_use]
extern crate serde_derive;
use quote::{format_ident, quote};
macro_rules! generated_at {
($output:ident) => {
#[cfg(feature = "debug")]
writeln!(
$output,
"\n\n// GENERATED at {}:{}:{}\n",
module_path!(),
line!(),
column!()
... |
//! Provides a macro for making utf-16 literals.
//!
//! ```rust
//! use utf16_lit::{utf16, utf16_null};
//!
//! const EXAMPLE: &[u16] = &utf16!("example");
//!
//! const EXAMPLE_NULL: &[u16] = &utf16_null!("example");
//!
//! fn main() {
//! let v: Vec<u16> = "example".encode_utf16().collect();
//! assert_eq!(v, E... |
use crate::{Fallible, Label, StoiError};
use std::collections::HashSet;
use std::convert::{From, TryFrom};
use std::fmt;
/// A sequence of distinct signed integer labels uniquely mapping to indices of an axis
///
/// - In a dense patch, it represents the storage order along one dimension
/// - In a catalog, it deter... |
use std::env;
use std::fmt;
use std::fs::File;
use std::io::Write;
use std::path::Path;
#[cfg(feature = "const-generics")]
mod generic_const_mappings;
mod op;
mod tests;
pub enum UIntCode {
Term,
Zero(Box<UIntCode>),
One(Box<UIntCode>),
}
pub enum IntCode {
Zero,
Pos(Box<UIntCode>),
Neg(Box<U... |
use anyhow::{format_err, Error};
use derive_more::Display;
use futures::future::try_join_all;
use itertools::Itertools;
use stack_string::StackString;
use std::{
ffi::OsStr,
path::{Path, PathBuf},
sync::Arc,
};
use stdout_channel::StdoutChannel;
use crate::{
config::Config,
movie_collection::MovieC... |
// The Nature of Code
// <NAME>
// http://natureofcode.com
//
// Example 3-16: Exercise Springs
use nannou::prelude::*;
fn main() {
nannou::app(model).update(update).run();
}
// Spring Type describes an anchor point that can connect to "Bob" objects via a spring
// Thank you: http://www.myphysicslab.com/spring2d.... |
//! FATs managment.
use super::filesystem::FatFileSystem;
use super::Cluster;
use byteorder::{ByteOrder, LittleEndian};
use libfs::block::{Block, BlockDevice, BlockIndex};
use crate::FileSystemError;
#[derive(Debug, Copy, Clone, PartialEq)]
/// Represent a cluster chan value.
pub enum FatValue {
/// Represent a ... |
use {
super::*,
crate::{
app::AppContext,
app::{Selection, SelectionType},
file_sum::FileSum,
git::LineGitStatus,
},
std::{
cmp::{self, Ord, Ordering, PartialOrd},
fs,
path::{Path, PathBuf},
},
};
#[cfg(unix)]
use {std::os::unix::fs::MetadataE... |
// * This file is part of the uutils coreutils package.
// *
// * (c) <NAME> <<EMAIL>>
// *
// * For the full copyright and license information, please view the LICENSE file
// * that was distributed with this source code.
// spell-checker:ignore (ToDO) signalname pids
#[macro_use]
extern crate uucore;
use cla... |
use std::error::Error as StdError;
use std::fmt;
use std::io;
use std::io::ErrorKind::InvalidInput;
use std::result::Result as StdResult;
#[cfg(feature = "serde")]
use serde;
/// A convenient alias type for results when reading/writing the Named Binary
/// Tag format.
pub type Result<T> = StdResult<T, Error>;
/// Er... |
/*! Tester for WebGPU
* It enumerates the available backends on the system,
* and run the tests through them.
*
* Test requirements:
* - all IDs have the backend `Empty`
* - all expected buffers have `MAP_READ` usage
* - last action is `Submit`
* - no swapchain use
!*/
use player::{GlobalPlay, I... |
use std::{cell::Cell, marker::PhantomData, mem};
use crate::{memory::Memory, Executor, FromWasm, Trap};
// TODO maybe writing to memory should always return Result<(), Trap>?
pub trait WasmType: Sized {
type Value;
fn copy_to(&self, mem: &mut [u8]);
fn len() -> usize;
fn value_from_memory(mem: &[u8])... |
// 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... |
// Generated from definition com.github.openshift.api.template.v1.Parameter
/// Parameter defines a name/value variable that is to be processed during the Template to Config transformation.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Parameter {
/// Description of a parameter. Optional.
pub descript... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
pub fn main() {
println!("** exp.rs **");
let x: &str = match Some(("foo", 7)) {
N... |
// Copyright 2019 The Exonum Team
//
// 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 i... |
use crate::Part;
use aoc_runner_derive::{aoc, aoc_generator};
use std::collections::HashMap;
pub type BotId = usize;
pub type OutputId = usize;
pub type Value = usize;
#[derive(Debug, PartialEq)]
pub enum Destination {
Bot(BotId),
Output(OutputId),
}
#[derive(Debug, PartialEq)]
pub enum Instruction {
Inp... |
use std::collections::HashMap;
use std::ops::Range;
type SleepPhase = Range<usize>;
type SleepPhases = Vec<SleepPhase>;
pub(crate) fn strategy_one(input: &[String]) -> usize {
let shifts = split_into_guard_shifts(input);
let sleep_phases_by_guard_id = sleep_phases_by_guard_id(shifts);
let guard = find_lon... |
use std::path::{Path, PathBuf};
use serde_repr::{Deserialize_repr, Serialize_repr};
/// A Base Directory to use.
/// The base directory is the optional root of a FS operation.
/// If informed by the API call, all paths will be relative to the path of the given directory.
///
/// For more information, check the [dirs ... |
/*
* ISC License
*
* Copyright (c) 2021 <NAME>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE A... |
// Copyright (c) 2017-present PyO3 Project and Contributors
//
// based on <NAME>'s https://github.com/dgrunwald/rust-cpython
//! Functionality for the code generated by the derive backend
use crate::err::PyResult;
use crate::exceptions::TypeError;
use crate::ffi;
use crate::init_once;
use crate::types::{PyDict, PyMo... |
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, ToSocketAddrs};
use anyhow::Result;
use bytes::Bytes;
use common::{
generate_uuid, AgentMessagePayloadTypeValue, MessageFramedRead, MessageFramedReader, MessageFramedWrite, MessageFramedWriter, MessagePayload,
PayloadEncryptionTypeSelectRequest, PayloadEncrypt... |
// Copyright 2021-2022 <NAME> <<EMAIL>>
// SPDX-License-Identifier: MIT OR Apache-2.0
use crate::attribute::NtfsAttributeType;
use crate::attribute_value::NtfsAttributeValue;
use crate::error::{NtfsError, Result};
use crate::index_record::NtfsIndexRecord;
use crate::ntfs::Ntfs;
use crate::structured_values::NtfsStruct... |
use crate::audio::{AudioInputStream, AudioStreamFormat};
use crate::error::{convert_err, Result};
use crate::ffi::{
audio_stream_create_pull_audio_input_stream, audio_stream_release,
pull_audio_input_stream_set_callbacks, pull_audio_input_stream_set_getproperty_callback,
SmartHandle, SPXAUDIOSTREAMHANDLE,
}... |
#[macro_use]
extern crate prettytable;
use hyper_tls::HttpsConnector;
use std::{collections::{HashMap, HashSet}, fmt::Display};
use cargo_toml::Manifest;
use hyper::{body::to_bytes, Client};
use prettytable::Table;
pub enum SourceType {
Remote,
Local,
}
pub struct Source {
pub path: String,
pub source... |
use crate::lexer::{expand_bracket, expand_string, macros};
use crate::models::{Range, State, Token, WCode, WTokens};
use crate::stdlib::FUNCTIONS;
use crate::utils::Utils;
use lazy_static::lazy_static;
use phf::phf_set;
use rayon::prelude::*;
use regex::Regex;
use substring::Substring;
pub trait WParser {
fn parse... |
extern crate gtk;
extern crate rusqlite;
extern crate time;
use gtk::prelude::*;
use gtk::{Box, Builder, ComboBoxText, Dialog, Entry, Label, ListBox, SpinButton, TextView};
use rusqlite::Connection;
use time::Timespec;
pub fn db_connect() -> Connection {
let conn = Connection::open("/tmp/test.db").unwrap();
c... |
use std::convert::TryFrom;
type Pos = (usize, usize);
fn auto_dust(mem: &[i64], scaffold: &[Pos], width: usize) -> usize {
let (_, dust_update) = dust(mem);
let du0 = dust_update.start;
// Tried doing this w/ exactly_one,
// but it caused too much indentation,
// since I either need to do an at_m... |
use engine::asset::{Asset, AssetResult, AssetSystem, FileFuture, LoadableAsset, Resource};
use engine::render::shader::{ShaderFs, ShaderVs};
use engine::render::uniforms::*;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use uni_gl::{ShaderKind as WebGLShaderKind, WebGLProgram, WebGLRende... |
use std::io;
use std::cell::Cell;
use std::sync::Arc;
use std::collections::HashMap;
use backoff::ExponentialBackoff;
use backoff::backoff::Backoff;
use futures::unsync::oneshot;
use tokio_core::net::TcpStream;
use tokio_io::AsyncRead;
use tokio_io::io::WriteHalf;
use tokio_io::codec::FramedRead;
use actix::prelude::*;... |
use core::mem::size_of;
use tinyvec::ArrayVec;
include!(concat!(env!("OUT_DIR"), "/constants.rs"));
pub const ILEN: usize = 16;
pub const SEED_LEN: usize = 32;
pub type LmsTreeIdentifier = [u8; ILEN];
pub type Seed = [u8; SEED_LEN];
pub type LmsLeafIdentifier = [u8; 4];
type FvcMax = u16;
type FvcSum = u16;
type Fv... |
use std::collections::HashMap;
use std::collections::linked_list::LinkedList;
use std::time::SystemTime;
use chrono::Local;
use serde_json::json;
use serde_json::Value;
use crate::engine::{parser, runtime};
use crate::engine::node::Node;
use crate::engine::node::NodeType::{NArg, NString};
//use crate::engines::RustEx... |
// Copyright 2021. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
//! Utilities related to LCM fingerprinting
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::parser::{self, Schema};
use crate::Environment;
// Hashing operations
const INITIAL_STRUCT_HASH: i64 = 0x12_345_678i64;
fn hash_update(v: i64, c: i8) -> i64 {
((v << 8) ^ (v >> 55)).... |
// Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
// Copyright (c) 2018, <NAME>PORATION. All rights reserved.
// Copyright (c) 2020 The sticker developers.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the... |
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not u... |
//! Virtual memory operations.
use core::fmt::{Debug, Formatter, Result};
use core::{convert::TryFrom, slice};
use x86_64::{
instructions::tlb,
registers::control::{Cr3, Cr3Flags},
structures::paging::page_table::PageTableFlags as PTF,
};
use crate::utils::page_table::{GenericPTE, PageTableImpl, PageTabl... |
use anchor_lang::{
prelude::*,
solana_program::{program::invoke, system_instruction},
};
use anchor_spl::{
associated_token::*,
token::{self, CloseAccount, Mint, Token, TokenAccount, Transfer},
};
use gem_common::{errors::ErrorCode, *};
use crate::state::*;
#[derive(Accounts)]
#[instruction(bump_far... |
extern crate rand;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum Nationality {
Dane,
Brit,
Swede,
Norwegian,
German,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum Color {
Yellow,
Red,
White,
Green,
Blue,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum Animal {
Horse,
Cat,
Bird... |
pub mod integration_utils;
use integration_utils::{run_core, full_simple_deployment, conn_and_call_ipc,
send_update_contract, get_update_deltas_msg, contract_compute,
send_update_contract_on_deployment, remove_contract, remove_deltas};
pub extern crate enigma_core_app as... |
// cargo run --release --example waves_2
extern crate chrono;
extern crate nannou;
use nannou::color::*;
use nannou::noise::{NoiseFn, Perlin};
use nannou::prelude::*;
mod util;
use util::args::ArgParser;
use util::brush::*;
use util::captured_frame_path;
use util::color::*;
use util::interp::lerp;
fn main() {
nann... |
// Copyright (c) 2019, Arm Limited, All Rights Reserved
// 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
//
// http://www.apache.org/license... |
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use std::cmp::PartialEq;
use std::fmt::Debug;
static FREE_SLOT: i64 = -1;
#[derive(Debug)]
pub struct Dictionary<T> {
capacity: u64,
size: u64,
hash_table: Vec<i64>,
keys: Vec<T>,
}
impl<T: Hash + PartialEq + Clone + Debug>... |
use yew::services::fetch::FetchTask;
use yew::{
agent::Bridged, html, Bridge, Callback, Component, ComponentLink, FocusEvent, Html, InputData,
KeyboardEvent, Properties, ShouldRender,
};
use yew_router::{agent::RouteRequest::ChangeRoute, prelude::*};
use crate::components::list_errors::ListErrors;
use crate::e... |
use crate::common::*;
use std::str::Chars;
type Num = u64;
#[derive(Clone)]
struct BitStream<'a> {
index: usize,
input: Chars<'a>,
buffer: [bool; 4],
buffer_index: usize,
}
impl<'a> BitStream<'a> {
fn new(input: &'a str) -> Result<Self> {
for c in input.chars() {
if !c.is_asci... |
use anyhow::{anyhow, Result};
use num::traits::Pow;
use num_bigint::BigInt;
use std::fmt::Debug;
use std::ops;
use crate::field_element::FieldElement;
#[derive(Debug, PartialEq, Clone)]
pub struct ActualPoint<F> {
pub x: F,
pub y: F,
}
#[derive(Debug, PartialEq, Clone)]
pub enum Point<F> {
Inf,
Actua... |
// with thanks to:
// https://sunjay.dev/learn-game-dev/opening-a-window.html
// https://docs.rs/sdl2/0.30.0/sdl2/render/struct.Canvas.html
// https://docs.rs/sdl2/0.5.0/src/sdl2/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-0.5.0/src/sdl2/rect.rs.html#83-237
// https://github.com/Rust-SDL2/rust-sdl2/blob/master... |
use std::{collections::HashMap, sync::Arc};
use serenity::framework::standard::macros::hook;
use serenity::framework::standard::{
macros::{command, group},
CommandError, CommandResult, StandardFramework,
};
use serenity::model::{
channel::{Channel, Message},
gateway::Activity,
id::*,
};
use serenit... |
use super::fma::fmadd_ps;
use super::intrinsics::*;
pub(crate) unsafe fn sgemm_ukr_16x4(
k: usize,
alpha: f32,
pa: *const f32,
pb: *const f32,
beta: f32,
c: *mut f32,
ldc: usize,
) {
let mut mt00 = _mm256_setzero_ps();
let mut mt01 = _mm256_setzero_ps();
let mut mt02 = _mm256_se... |
use super::Optimizer;
use crate::linalg::{Dot, Matrix, Solve, Vector};
use reverse::*;
/// Implements a [Levenberg-Marquardt optimizer](https://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm)
/// for solving (non-linear) least squares problems.
///
/// # Example
///
/// ```rust
/// use compute::prelude::{... |
use std::sync::mpsc::{Sender, Receiver, channel};
use std::sync::{Arc, Mutex};
use std::clone::Clone;
use std::thread;
use error::Error;
use std::time::Duration;
use sse::ServerEvent;
use model::{Event, EventTyp};
// Internal data for the reactor
struct ReactorData<T> {
sender_list: Vec<(Sender<T>, Vec<String>)>,
... |
use std::ops::{Deref, DerefMut};
use crate::{
sys,
types::{LocalMemoryIndex, Memory},
vm,
};
/// A linear memory instance.
#[derive(Debug)]
pub struct LinearMemory {
/// The actual memory allocation.
memory: sys::Memory,
/// The current number of wasm pages.
current: u32,
// The maxi... |
use futures::future::LocalBoxFuture;
use models::tables;
use protocol;
mod capture;
mod collate;
mod collection;
mod derivation;
mod errors;
mod indexed;
mod materialization;
mod npm_dependency;
mod reference;
mod schema;
mod storage_mapping;
mod test_step;
use errors::Error;
/// Drivers is a delegated trait -- provi... |
//
// Process viewer
//
// Copyright (c) 2019 <NAME>
//
use glib;
use gtk;
use gio::ApplicationExt;
use glib::Cast;
use gtk::{BoxExt, ContainerExt, DialogExt, GridExt, GtkApplicationExt, GtkWindowExt, SpinButtonExt,
SpinButtonSignals, WidgetExt};
use std::cell::RefCell;
use std::fs::create_dir_all;
use std... |
use std::collections::{HashMap};
use std::{env, fs};
mod test;
extern crate petgraph;
use petgraph::graph::NodeIndex;
use petgraph::visit::EdgeRef;
use petgraph::{Graph, Undirected};
struct CaveSystem {
start: NodeIndex,
end: NodeIndex,
g: Graph<String, u8, Undirected>,
visit_small: u8,
paths: Ve... |
// Copyright Cryptape Technologies LLC.
//
// 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 ... |
//! # Entry Defs Store
//! Stores all the entry definitions across zomes
use crate::core::ribosome::guest_callback::entry_defs::EntryDefsHostAccess;
use crate::core::ribosome::guest_callback::entry_defs::EntryDefsInvocation;
use crate::core::ribosome::guest_callback::entry_defs::EntryDefsResult;
use crate::core::riboso... |
use std::collections::HashMap;
use std::io::Error;
use std::mem::size_of;
use std::os::unix::process::CommandExt;
use nix::sys::ptrace;
use nix::sys::signal;
use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus};
use nix::unistd::Pid;
use std::process::{Child, Command};
use gimli::SectionId::DebugInfo;
use libc::{ptra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.