text stringlengths 3.09k 13.9k |
|---|
use crate::cdsl::operands::{Operand, OperandKind};
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::slice;
use cranelift_entity::{entity_impl, PrimaryMap};
/// An immediate field in an instruction format.
///
/// This corresponds to a single member of a variant of the `InstructionData`
/// data type.... |
use rand::random;
use crate::Food;
use bevy::ecs::query::With;
use bevy::app::EventReader;
use bevy::input::keyboard::KeyCode;
use bevy::input::Input;
use bevy::sprite::ColorMaterial;
use bevy::asset::Handle;
use bevy::math::Vec2;
use bevy::sprite::Sprite;
use bevy::sprite::entity::SpriteBundle;
use bevy::ecs::system:... |
use crate::token::*;
use nom::{
branch::alt,
bytes::complete::{tag, take_until, take_while1},
character::complete::{char, digit1, multispace0},
combinator::{all_consuming, map, opt},
multi::{fold_many0, many0, separated_list},
sequence::{delimited, pair, preceded, separated_pair, terminated, tup... |
use gameboy::cpu::interrupts::{Interrupt, InterruptLine};
use gameboy::Mode;
const FREQ: [u16; 4] = [512, 8, 32, 128];
const DIV_ADDRESS: u16 = 0xFF04;
const TIMA_ADDRESS: u16 = 0xFF05;
const TMA_ADDRESS: u16 = 0xFF06;
const TAC_ADDRESS: u16 = 0xFF07;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum TimerRegist... |
use std::{io::Write, os::unix::prelude::PermissionsExt, path::Path, process::Command};
use anyhow::{anyhow, bail, Context, Result};
use regex::Regex;
use tempfile::NamedTempFile;
use libs::template::Template;
use libs::wsl_interop;
pub fn enable_autostart_on_windows_boot(distro_name: &str) -> Result<()> {
let c ... |
// main.rs
#![feature(plugin)]
#![plugin(docopt_macros)]
extern crate rustc_serialize;
extern crate docopt;
extern crate regex;
use std::io::prelude::*;
use std::io::BufReader;
use std::io::BufWriter;
use std::fs::File;
use std::fs::OpenOptions;
use std::path::Path;
use std::error::Error;
// https:... |
extern crate music;
extern crate piston;
extern crate graphics;
extern crate glutin_window;
extern crate opengl_graphics;
use std::char;
use std::process;
use piston::window::WindowSettings;
use piston::event_loop::{ Events, EventSettings };
use piston::input::{ Button, Key, PressEvent, ReleaseEvent, RenderArgs, Rende... |
use core::mem;
use bit_field::BitField;
use volatile::Volatile;
/// TODO This value should not be hardcoded and should change depending on the choosen frequency
pub const F_CPU: u32 = 72_000_000;
#[repr(C, packed)]
pub struct Mcg {
c1: Volatile<u8>,
c2: Volatile<u8>,
c3: Volatile<u8>,
c4: Volatile<u8... |
use crate::time::Time;
use std::fmt;
use std::sync::atomic;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::thread::sleep;
use std::time::Duration;
use chrono::Timelike;
use chrono_tz::Tz;
use clokwerk::{ScheduleHandle, Scheduler, TimeUnits};
use serde::{Deserialize, Serialize};
use serenity::{
ht... |
/// Spherical K-means clustering with K-means++ initialization.
mod skmeans;
/// Model training.
mod train;
/// Model testing & evaluation.
pub mod eval;
use bincode;
use data::{DataSet, Feature, Label, SparseVector};
use fasthash::murmur3::Murmur3Hasher_x86_32 as MurmurHasher;
use fasthash::FastHasher;
use rayon::p... |
use std::{
env, fmt, fs,
io::{self, BufRead, Write},
path::{Path, PathBuf},
};
use super::prelude::*;
use serde_derive::Deserialize;
use serde_yaml;
const API_ENDPOINT: &str = "https://cs211.cs.northwestern.edu";
const AUTHFILE_VAR: &str = "GSC_AUTH_FILE";
const AUTHFILE_NAME: &str = ".gscauth";
const ... |
//! # Samsung Blu-Ray Player Protocol
//!
//! Protocol used on some Samsung BluRay players and probably other devices from Samsung.
//!
//! Pulse distance coding is used with. After the Header the 16 bit address is sent.
//! Then a pause and then 4 bits of unknown function (could be repeat indicator?)
//! After this th... |
//! Provide a [`Context`] for the plugin chain of responsibilities.
//!
//! Router plugins accept a mutable [`Context`] when invoked and this contains a DashMap which
//! allows additional data to be passed back and forth along the request invocation pipeline.
use crate::json_ext::Value;
use dashmap::mapref::multiple:... |
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
extern crate amethyst;
use amethyst::{
assets::{Loader, AssetLoaderSystemData},
ecs::prelude::*,
core::transform::{Transform, TransformBundle},
core::nalgebra::{Vector3},
prelude::*,
renderer::{Material, Shape, PosNormTex, DrawShaded, MaterialDefaults, Mesh, Rgba,
Camera, Project... |
mod apis;
mod exec;
mod incluster_config;
mod kube_config;
mod utils;
mod oauth2;
use base64;
use failure::{Fail, Context, Backtrace, ResultExt};
use std::fmt::{self, Display};
use reqwest::r#async::Client;
use reqwest::{Certificate, Identity, header};
use crate::kube_config::KubeConfigLoader;
type Result<T> = ::core... |
// 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... |
#![no_std]
extern crate alloc;
extern crate canadensis;
extern crate canadensis_can;
extern crate canadensis_core;
extern crate canadensis_data_types;
extern crate canadensis_encoding;
extern crate canadensis_filter_config;
extern crate crc_any;
use alloc::vec::Vec;
use canadensis::anonymous::AnonymousPublisher;
use... |
//! Arboric ProxyService which does the actual work of the Proxy
use crate::arboric::listener::ListenerContext;
use crate::Claims;
use frank_jwt::{decode, Algorithm};
use futures::future;
use http::header::HeaderMap;
use hyper::rt::Future;
use hyper::service::Service;
use hyper::{Body, Client, Method, Request, Respons... |
use crate::ast::{
self, Expr, Ident, MacroCall, Module, Name, Span, SpanBox, Spanned, Stmt, TopStmt,
};
use crate::error_context::ErrorContext;
use either::Either;
use std::cell::RefCell;
pub fn expand_macros(ast_module: &Module, err: &mut ErrorContext) {
let mut exp = MacroExpander { ast_module, err };
ex... |
mod util;
use neon::prelude::*;
use sks::*;
fn export_1d_patch(mut cx: FunctionContext) -> JsResult<JsString> {
let v = cx.argument::<JsArray>(0)?;
let v_str = v.to_string(&mut cx)?;
Ok(v_str)
}
fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
Ok(cx.string("hello node"))
}
/// Converts from... |
use crate::commands::Command;
use crate::connection_config::ConnectionConfig;
use crate::errors::Result;
use crate::paths::jupyter_runtime_dir;
use crate::responses::Response;
use crate::signatures::HmacSha256;
use failure::format_err;
use glob::glob;
use hmac::Mac;
use log::{debug, trace};
use std::env::current_dir;
u... |
/*!
An expression is a syntatically correct "thing", a symbol, function, sequence,
non-sequence variable, or sequence variable. We try to keep `Expression`s
immutable. We can use `Rc<Expression>`, aliased to `RcExpression`, as a garbage
collected copy-on-write smart pointer.
To implement matching on your own structur... |
// 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... |
#[doc = "Reader of register STATUS"]
pub type R = crate::R<u32, super::STATUS>;
#[doc = "Reader of field `SINGLEACT`"]
pub type SINGLEACT_R = crate::R<bool, bool>;
#[doc = "Reader of field `SCANACT`"]
pub type SCANACT_R = crate::R<bool, bool>;
#[doc = "Reader of field `SINGLEREFWARM`"]
pub type SINGLEREFWARM_R = crate:... |
use core::fmt;
use std::str::FromStr;
use anyhow::{anyhow, Error, Result};
use email::Mailbox;
use serde::de::Visitor;
use serde::{de, Deserialize, Deserializer, Serialize};
use crate::models::speaker::SpeakerKey;
use crate::models::sponsor::SponsorKey;
#[derive(Serialize, Debug, Clone, Eq, PartialEq)]
pub struct Em... |
use std::fs::{self, File, OpenOptions};
use std::io::{BufRead, BufReader, Write};
use std::path::Path;
use regex::Regex;
use super::Result;
use actor::Actor;
fn try_create<P: AsRef<Path>>(actor: &Actor, path: P, overwrite: bool) -> Result<File> {
actor.open_options(OpenOptions::new()
.write(tr... |
// MIT License
// Copyright (c) 2021 <NAME>
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, p... |
use blockstore::{BlockStore};
use fuse::*;
use index::{Index, Inode};
use libc::ENOENT;
use readchain::{Take,Chain};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use time::Timespec;
use std::boxed::Box;
const TTL: Timespec = Timespec { sec: 1, nsec: 0 }; ... |
use crate::arenas::Arenas;
use super::Exhaustiveness;
use as_derive_utils::{
attribute_parsing::with_nested_meta,
spanned_err,
utils::{LinearResult, SynResultExt},
};
use proc_macro2::Span;
use quote::ToTokens;
use syn::{
punctuated::Punctuated, spanned::Spanned, Attribute, Ident, Lit, Meta, MetaLi... |
// Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in th e LICENSE file.
use crate::{
components::{dropdown, font_awesome, tooltip, Placement},
environment::MAX_SAFE_INTEGER,
extensions::{MergeAttrs as _, NodeExt as _},
gen... |
pub mod loader;
pub mod manager;
use crate::{
assets::{IndexedPosColorNormVertices, PosColorNormVertices},
rendering::splatted_triplanar_pbr_pass::ArrayMaterialIndex,
voxel::{LocalVoxelCache, Voxel, VoxelMap, EMPTY_VOXEL},
};
use amethyst::core::ecs::prelude::*;
use amethyst::renderer::rendy::mesh::{Color... |
use gcollections::ops::*;
use interval::{interval_set::*, IntervalSet};
use std::{collections::VecDeque, fmt::Debug};
type T = u32;
// For u32, IntervalSet excludes MAX from its set of valid values due to its
// need to be able to express the width of an interval using a u32.
// This min and max are set accordingly.
... |
use std::io;
use std::process::ExitStatus;
use std::str::Lines;
use std::string::FromUtf8Error;
use ansi_term::Color::Black;
use lazy_static::lazy_static;
use quick_error::quick_error;
use regex::Regex;
lazy_static! {
static ref AUX_FILE: Regex = {
// Lines like:
// *(/tmp/texput.aux)
... |
#![forbid(unsafe_code)]
#![deny(
clippy::all,
clippy::as_conversions,
clippy::float_arithmetic,
clippy::integer_arithmetic,
clippy::must_use_candidate
)]
#![warn(clippy::todo, clippy::dbg_macro)]
//
#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]
pub mod config;
// -------... |
use std::sync::Arc;
use nannou::image::{Bgra, Luma, ImageBuffer};
use nannou::prelude::*;
use azure_kinect::*;
pub struct Kinect {
device: Device,
tracker: Tracker,
}
impl Kinect {
pub fn new(azure_api: Arc<Api>, tracker_api: Arc<ApiTracker>, device_idx: u32) -> Result<Kinect, Box<dyn std::error::Error>>... |
use clap::{App, Arg};
use ossfs::Counter;
use std::{
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
time::{Duration, SystemTime, UNIX_EPOCH},
};
fn main() {
env_logger::from_env(
env_logger::Env::default()
.default_filter_or(std::env::var("LOG_LEVEL").unwrap_or(Str... |
use crate::sounds;
use sauron::{
html::{
attributes::class,
div,
},
prelude::*,
Node,
};
use web_sys::HtmlAudioElement;
const COMPONENT_NAME: &str = "frame";
#[derive(Clone, Debug)]
pub enum Msg {
AnimateIn,
StopAnimation,
HoverIn,
HoverOut,
NextAnimation(f64, f64),... |
use crate::corpusstorage::QueryLanguage;
use std::collections::BTreeMap;
/// A struct that contains the extended results of the count query.
#[derive(Debug, Default, Clone, Serialize)]
#[repr(C)]
pub struct CountExtra {
/// Total number of matches.
pub match_count: u64,
/// Number of documents with at leas... |
//! Logic for coordinating peripheral inputs and outputs
use arduino_hal::{
clock::MHz16,
hal::{
port::{PC0, PC1, PD3},
Adc,
},
port::{
mode::{Analog, Output},
Pin,
},
};
use core::sync::atomic::Ordering;
use crate::{
config::{SystemConfig, UpdateSystemValue},
control_pad::ControlPad,
display::Display... |
// Copyright (c) 2017-present, PingCAP, Inc. Licensed under Apache-2.0.
//! Log file types.
use std::io::{Read, Seek, SeekFrom, Write};
use std::sync::Arc;
use log::warn;
use crate::env::{FileSystem, Handle, WriteExt};
use crate::metrics::*;
use crate::pipe_log::FileBlockHandle;
use crate::{Error, Result};
use sup... |
use anyhow::{bail, Result};
use serde::{Deserialize, Serialize};
use crate::{
config::{Config, Model},
context::{self, Context},
interface::{AudioBuffer, Color, FrameBuffer, Input, LinkCable},
rom::{CgbFlag, Rom},
};
#[derive(Serialize, Deserialize)]
pub struct GameBoy {
rom_hash: [u8; 32],
#[... |
use std::io::{self, Write};
use term::terminfo::TermInfo;
use libc;
use key::Key;
use attr::{Color, Effect};
#[derive(Debug)]
pub struct Terminal {
terminfo: TermInfo,
}
impl Terminal {
pub fn from_env() -> io::Result<Self> {
let terminfo = TermInfo::from_env()?;
Ok(Terminal { terminfo: term... |
use super::preload_prediction::PreloadPrediction;
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
use std::sync::{Arc, RwLock};
use std::thread::{self, JoinHandle};
pub trait PreloadCacheDelegate<T, U>: Send + Sync {
fn get(&self, key: &T) -> Option<U>;
}
pub struct PreloadCache<T, U> {
predict... |
//! Framebuffer support for Glow.
use luminance::backend::color_slot::ColorSlot;
use luminance::backend::depth_slot::DepthSlot;
use luminance::backend::framebuffer::{Framebuffer as FramebufferBackend, FramebufferBackBuffer};
use luminance::framebuffer::{FramebufferError, IncompleteReason};
use luminance::texture::{Dim... |
use crate::errors::{YdbError, YdbResult};
use crate::pub_traits::{Credentials, TokenInfo};
use serde::Deserialize;
use std::fmt::Debug;
use std::ops::Add;
use std::process::Command;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
pub(crate) type CredentialsRef = Arc<Box<dyn Credentials>>;
pub(crate) ... |
use std::fmt::Write;
use types::*;
pub fn color(c: Color) -> String {
match c {
Color::Black => "b",
Color::White => "w",
}
.to_string()
}
pub fn piece(p: Piece) -> String {
match p {
Piece::Pawn => "p",
Piece::Lance => "l",
Piece::Kn... |
//! M27 KVM control
//!
//! A simple tool to manage the GIGABYTE M27Q KVM interface
//! Switching to USB-C input is not supported via DDC, but it is exposed via the monitors usb billboard device.
//!
//! All USB writes have been reverse engineered from the OSD side kick tool by analyzing the USB packets over wireshark.... |
/*
Ownership Rules
1) Each value in Rust has a variable that’s called its owner.
2) There can only be one owner at a time.
3) When the owner goes out of scope, the value will be dropped.
*/
fn main() {
simple_scope();
copy_bind();
move_example();
clone_example();
stack_only_copy();
ownership_an... |
use futures::executor::block_on;
use futures::stream::StreamExt;
use futures_timer::Delay;
use libp2p::core::identity::ed25519;
use libp2p::core::upgrade;
use libp2p::dns;
use libp2p::identify::{IdentifyEvent, IdentifyInfo};
use libp2p::kad;
use libp2p::metrics::{Metrics, Recorder};
use libp2p::noise;
use libp2p::swarm... |
use crate::config;
use crate::wled_types;
use crate::wled_types::*;
use std::collections::{HashMap};
use std::default::Default;
use log::{info};
use raster::Color;
// FIXME rm
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Clone, Debug, PartialEq)]
struct LiveInfo {
effects: Effects,
}
#[derive(C... |
use super::*;
/////////////////////////////////////
/// Functions used to test that the C abi is the same in both the library and the loader.
#[repr(C)]
#[derive(StableAbi)]
pub struct CAbiTestingFns{
pub(crate) take_pair_a:extern "C" fn(Tuple2<u16,()>)->u32,
pub(crate) take_pair_b:extern "C" fn(Tuple2<(),u16... |
//! [Day 10: Balance Bots](https://adventofcode.com/2016/day/10)
use regex::Regex;
use std::collections::{HashMap, HashSet};
/// `main` reads the puzzle input then solves part 1 and part 2
fn main() {
let data = std::fs::read_to_string("input.txt").unwrap();
let data = data.split('\n').collect::<Vec<&str>>()... |
#![allow(dead_code)]
use std::cmp;
extern crate image;
use serde::{Deserialize, Serialize};
/// Pixel represent by R(RED), G(GREEN) and B(BLUE) color
#[derive(Clone, Debug, Copy, Eq, Serialize, Deserialize)]
pub struct Pixel {
pub r: i64,
pub g: i64,
pub b: i64,
#[serde(skip)]
pub x: i64,
#[se... |
use crate::pb::tensor_proto::DataType;
use crate::pb::*;
use prost::Message;
use std::convert::{TryFrom, TryInto};
use tract_hir::internal::*;
impl TryFrom<DataType> for DatumType {
type Error = TractError;
fn try_from(t: DataType) -> TractResult<DatumType> {
match t {
DataType::Bool => Ok(... |
use std::collections::HashMap;
use rand::distributions::WeightedIndex;
use rand::prelude::*;
/// The MarkovChain of order N is a mapping
/// from a sequence of tokens to a probability
/// map over multiple possible tokens.
#[derive(Debug, PartialEq, Eq)]
pub struct MarkovChain {
order: usize,
transitions: Has... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 0x0400],
#[doc = "0x400 - Ready flag"]
pub ready: crate::Reg<ready::READY_SPEC>,
_reserved1: [u8; 0x04],
#[doc = "0x408 - Ready flag"]
pub readynext: crate::Reg<readynext::READYNEXT_SPEC>,
_reserved2: [u8; 0xf8... |
// Copyright 2021 <NAME>.
//
// 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 writ... |
//use syn::Type;
use makepad_render::*;
use makepad_widget::*;
use crate::jseditor::*;
use crate::rusteditor::*;
use crate::plaineditor::*;
use crate::searchindex::*;
use crate::makepadstorage::*;
use std::collections::HashMap;
#[derive(Clone)]
pub struct FileEditors {
pub rust_editor: RustEditor,
pub js_edi... |
use derivative::Derivative;
use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference;
use kube::api::{DynamicObject, Resource, ResourceExt};
use std::{
fmt::{Debug, Display},
hash::Hash,
};
#[derive(Derivative)]
#[derivative(
Debug(bound = "K::DynamicType: Debug"),
PartialEq(bound = "K::Dynam... |
use std::cmp::Ordering;
fn main() {
let mut moons = parse_moons(include_str!("../input"));
let mut time = 0;
while time < 1000 {
time = time_step(&mut moons, time);
}
let total = total_energy(&moons);
println!("Total energy = {}", total);
}
#[derive(Clone, Debug, PartialEq)]
struct ... |
use gaiku_common::mint::Vector3;
use glam::Vec3;
pub(crate) const EPSILON: f32 = 1e-4;
use super::tables::{CORNER_TABLE, EDGE_TABLE, TRIANGLE_TABLE, UV_TABLE};
#[derive(Debug)]
pub(crate) struct GridCell {
pub value: [f32; 8],
pub point: [Vector3<f32>; 8],
}
impl GridCell {
fn lerp(&self, index1: usize, index... |
//! Menu bar functionality (very basic so far).
//!
//! Usage:
//! ```
//! fn show_menu(ui: &mut egui::Ui) {
//! use egui::{menu, Button};
//!
//! menu::bar(ui, |ui| {
//! menu::menu(ui, "File", |ui| {
//! if ui.button("Open").clicked() {
//! // ...
//! }
//! ... |
// Copyright (c) SimpleStaking and Tezedge Contributors
// SPDX-License-Identifier: MIT
use crypto::hash::{BlockHash, ChainId, ProtocolHash};
use tezos_api::client::TezosStorageInitInfo;
use tezos_api::environment::{self, TezosEnvironment, TezosEnvironmentConfiguration};
use tezos_api::ffi::{ApplyBlockError, ApplyBloc... |
use std::io::{Read, Seek};
use std::ops::Range;
use std::slice::Iter;
use thiserror::Error;
cfg_if::cfg_if! {
if #[cfg(any(target_os = "linux",
target_os = "android",
target_os = "freebsd",
target_os = "macos",
))]{
mod unix;
} else if #[cfg(window... |
#![allow(non_snake_case)]
use crate::problem::{Bound, ConstraintOp, Problem};
use crate::util::EPS;
use log::debug;
use std::collections::HashMap;
pub trait StandardizedProblem {
type FeasiblePoint;
fn obj(&self) -> f64;
fn unpack(&mut self) -> (&StandardForm, &mut Self::FeasiblePoint);
}
pub trait Bas... |
use std::cell::RefCell;
use std::ops::Deref;
use std::rc::{Rc, Weak};
// 木構造データ
#[derive(Debug)]
struct Node {
value: i32,
children: RefCell<Vec<Rc<Node>>>,
parent: RefCell<Weak<Node>>,
}
// Cons, Nilはenum Listの列挙子としてここで「定義」している
#[derive(Debug)]
enum List {
Cons(Rc<RefCell<i32>>, Rc<List>),
Nil,
}... |
use gumdrop::Options;
use serde::{Deserialize, Serialize};
use simple_error::*;
use std::collections::BTreeSet;
use std::iter::FromIterator;
use tendermint::block::{self, parts::Header as PartSetHeader, Round};
use crate::validator::sort_validators;
use crate::{helpers::*, Generator, Header, Validator, Vote};
use std:... |
mod components;
mod workers;
use self::components::*;
use self::workers::{main_worker, main_worker::MainWorker};
use devand_core::{PublicUserProfile, User};
use devand_text::Text;
use yew::prelude::*;
use yew_router::switch::Permissive;
use yew_router::{prelude::*, Switch};
type RouterAnchor = yew_router::components:... |
use super::MinerError;
use crate::miner::interface::{CurrentTarget, MinerInterface};
use crate::miner::{Miner, MinerConfig};
use dynamic_ocl::buffer::flags::{DeviceReadOnly, DeviceWriteOnly, HostReadWrite, HostWriteOnly};
use dynamic_ocl::buffer::Buffer;
use dynamic_ocl::device::{Device, DeviceType};
use dynamic_ocl::k... |
use crate::locales::Locales;
use crate::path_prefix::get_path_prefix_client;
/// Detects which locale the user should be served and redirects appropriately. This should only be used when the user navigates to a
/// page like `/about`, without a locale. This will only work on the client-side (needs access to browser i1... |
use super::*;
impl<T: Config> Pallet<T> {
pub fn do_set_weights(origin: T::Origin, uids: Vec<u64>, values: Vec<u32>) -> dispatch::DispatchResult
{
// ---- We check the caller signature
let hotkey_id = ensure_signed(origin)?;
// ---- We check to see that the calling neuron is in the act... |
use crate::vulkan::RafxDeviceContextVulkan;
use crate::*;
use ash::version::DeviceV1_0;
use ash::vk;
#[derive(Clone, Debug)]
pub struct RafxBufferRaw {
pub buffer: vk::Buffer,
pub allocation: gpu_allocator::SubAllocation,
}
#[derive(Debug)]
pub struct RafxBufferVulkan {
device_context: RafxDeviceContextVu... |
use crate::event::Event;
use crate::renderer::{Message, RenderInstruction};
use crate::util::{Color, Queue, Vector2D};
use crate::widget::{Layout, Widget};
use std::cell::RefCell;
use std::rc::Weak;
/// Label is a widget that displays a short text string. Does not react to input events.
/// As a result, it cannot ge... |
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
//! String extension traits.
use std::borrow::Cow;
use std::cmp::Ordering;
use unicode_segmentation::UnicodeSegmentation;
/// An extension trait for strings that adds a truncation method with ellipses.
pub(crate) trait Ellipsis<'a> {
/// String truncation with ellipsis.
fn ellipsis(self, max_length: usize) ->... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
use windows::Win32::{
Foundation::{BOOL, HWND, LPARAM, POINT, PWSTR, RECT},
Graphics::Gdi::*,
};
use std::{
collections::{BTreeSet, VecDeque},
io, mem, ptr,
};
use super::util;
use crate::{
dpi::{Ph... |
mod build;
mod models;
use actix::{Actor, StreamHandler};
use actix_web::{web, App, Error, HttpRequest, HttpResponse, HttpServer};
use actix_web_actors::ws;
//use clap::load_yaml;
//use clap::App as ClapApp; // Add Arg and SubCommand back when you uncomment the stuff at the bottom
use build::find_and_execute;
use colo... |
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Token<'a> {
Newline(usize), // number of newlines in this newline
NormalString(&'a str),
RawString(&'a str),
LineString(&'a str),
Float(f64),
Int(i64),
Name(&'a str),
Symbol(&'a str),
Punctuator(Punctuator),
EOF,
}
... |
use chrono::{DateTime, Utc};
use gloo::{
file::{self, callbacks::FileReader, File},
timers::callback::Timeout,
};
use itertools::Itertools;
use mkt_data::ItemType;
use web_sys::HtmlInputElement;
use yew::prelude::*;
use yew_agent::{Bridge, Bridged};
use crate::{
agents::{
data_inventory::{DataInvIt... |
extern crate miko;
extern crate argparse;
use miko::utils::*;
use miko::syntax::parser::*;
use miko::typeinfer::*;
use miko::codegen::*;
use miko::core::*;
use miko::types::*;
use std::fs;
use std::io;
use std::io::Write;
use std::io::Read;
use std::ops::Deref;
use std::error::Error;
#[derive(Clone, Debug)]
enum Com... |
// Copyright 2020 <NAME>
//
// 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::access_method::rewriter::rewrite_opexrs;
use crate::executor_manager::alter::{
alter_indices, get_index_options_for_relation, get_index_options_for_schema,
};
use crate::executor_manager::drop::{drop_extension, drop_index, drop_schema, drop_table};
use crate::executor_manager::get_executor_manager;
use c... |
/* Manifest of files for itsylinker to link
*
* (c) <NAME>, 2021.
*
* See LICENSE for usage and copying.
*/
use std::fs::File;
use object::Object;
use std::path::{ Path, PathBuf };
use memmap2::{ MmapOptions, Mmap };
use std::collections::HashMap;
pub type FileIdentifier = PathBuf;
/* a manifest is a map of fi... |
// This file is part of Substrate.
// Copyright (C) 2017-2021 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... |
use super::Application;
use crate::{
application::{conf::ApplicationConf, conf::ExecutionMode, ArconLogger},
data::ArconType,
dataflow::constructor::{ErasedComponent, ErasedSourceManager},
manager::{
epoch::{EpochEvent, EpochManager},
snapshot::SnapshotManager,
},
stream::node::{... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use crate::{
map::{TiledMap, TiledMapLayerType},
tileset::TiledTileset,
};
use oxygengine_composite_renderer::sprite_sheet_asset_protocol::*;
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
fs::read_to_string,
io::{Error, ErrorKind},
path::Path,
};
#[derive(Debug, Clone, S... |
use std::fs::{metadata, Metadata};
use std::sync::{Arc};
use std::path::{PathBuf, Path};
mod fingerprint;
mod http;
mod read;
mod root;
mod version;
// sections
mod replication;
mod session_pools;
pub mod authorizers;
pub mod handlers;
pub mod http_destinations;
pub mod ldap;
pub mod listen;
pub mod log;
pub mod netwo... |
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
impl Default for SRC_DATA {
fn default() -> Self {
unsafe { std::mem::zeroed() }
}
}
#[cfg(test)]
#[macro_use]
extern crate all_asserts;
#[cfg(test)]
mod te... |
// This file is part of Substrate.
// Copyright (C) 2019-2022 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... |
// This module contains helpers functions and types that
// are not test in themselves, but are used by several tests.
#![allow(dead_code, unused_macros)]
pub extern crate wayland_client as wayc;
pub extern crate wayland_server as ways;
use std::os::unix::net::UnixStream;
use std::sync::atomic::{AtomicBool, Ordering... |
use log::debug;
use owning_ref::OwningRefMut;
use std::{
cell::{Cell, RefCell},
fmt,
ops::{Deref, DerefMut},
os::raw::{c_ulong, c_void},
};
use winit::window::WindowId;
use x11_dl::xlib;
use super::super::{align::Align, buffer::Buffer, Config, Format, ImageInfo};
// TODO: Non-opaque window
lazy_stati... |
use std::str::FromStr;
use std::ops::{Index, IndexMut};
type Error = Box<::std::error::Error>;
type Result<T> = ::std::result::Result<T, Error>;
#[derive(Debug, PartialEq, Default)]
struct Machine {
registers: Registers,
}
impl Machine {
fn new() -> Self {
Self::default()
}
fn value_of_regis... |
use std::cell::RefCell;
use std::ffi::CStr;
use std::os::raw::c_void;
use std::ptr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use wayland_commons::ThreadGuard;
use wayland_sys::server::*;
use super::resource::ResourceInner;
use crate::{client::Credentials, DispatchData, Interface, Resource, U... |
//! Implements a Discord client for relaying.
//!
//! Built on the serenity library for Discord API intercommunication.
use std::{option::Option, sync::Arc};
use futures::task::FutureObj;
use serde_derive::Deserialize;
use serenity::{
async_trait,
model::{channel::Message as SMessage, gateway::Ready, id::Chann... |
// bencode.rs
// Copyright 2022 <NAME>
//
// 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 agre... |
use crate::de::from_str;
use crate::error::{Error, Result};
use crate::ser::to_string;
use core::fmt::Debug;
use serde::{Deserialize, Serialize};
fn assert_serde<'a, T: PartialEq + Debug + Serialize + Deserialize<'a>>(
value: &T,
serial: &'a str,
) {
assert_eq!(to_string(value).unwrap(), serial);
asser... |
//! Advent of Code 2020 Day 22
//! https://adventofcode.com/2020/day/22
//!
//! Challenge part 2
//!
//! Given an input file with the cards held by two players in a card game, determine who wins the
//! game and their score. Part 2 adds more complex game rules, including recursion.
use std::collections::HashSet;
use s... |
extern crate log;
extern crate libc;
extern crate cassandra;
use cassandra::CassCluster;
use cassandra::CassError;
use cassandra::CassLogLevelType;
use cassandra::CassResult;
use cassandra::CassSession;
use cassandra::CassStatement;
#[deriving(Show, Clone)]
pub struct Extended {
pub bln: bool,
pub flt: f32,
pub... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.