text stringlengths 3.09k 13.9k |
|---|
use anyhow::Result;
use crossterm::event::{KeyEvent, KeyModifiers};
use crossterm::{
event::{self, DisableMouseCapture, EnableMouseCapture, Event as CEvent, KeyCode},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use histogram::Histogram;
use pinger::... |
pub use crate::hashes::TxID;
use crate::serializable::Serializable;
use crate::{self as shared, Cached, Deserializable, DeserializationError};
use crate::{u256, CompactInt};
use bytes::Buf;
use serde_derive::{Deserializable, Serializable};
use warp_crypto::sha256d;
#[derive(Serializable, Debug, Clone)]
pub struct Tran... |
use crate::types::{DateTime, Utc, Value};
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FulfillmentStatus {
Fulfilled,
Partial,
}
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialS... |
use crate::build::container::Context;
use crate::build::package::sign::{import_gpg_key, upload_gpg_key};
use crate::container::ExecOpts;
use crate::image::ImageState;
use crate::recipe::BuildArch;
use crate::{ErrContext, Result};
use std::path::{Path, PathBuf};
use tracing::{debug, info, info_span, trace, Instrument};... |
// 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.
//! Implementation of a "simple" pseudo directory. See [`Simple`] for details.
use crate::{
common::send_on_open_with_error,
directory::{
... |
use std::os::raw::c_int;
use failure::Error;
use redis_module::{raw, Context as RContext, RedisValue};
use crate::{context::*, LOADED_MODULES_HASH_KEY};
const AOF_START: u64 = redis_module::raw::REDISMODULE_SUBEVENT_LOADING_AOF_START;
const MODULE_UNLOADED: u64 = redis_module::raw::REDISMODULE_SUBEVENT_MODULE_UNLOAD... |
use std::cmp::Ordering;
use std::rc::Rc;
use std::sync::Arc;
use glommio::channels::channel_mesh::{
Receivers as ChannelMeshReceiver,
Senders as ChannelMeshSender,
};
use glommio::sync::Gate;
use glommio::{Latency, Local, Shares, Task as GlommioTask};
use tokio::sync::mpsc::{Receiver, Sender};
use tokio::sync:... |
// Copyright 2020 Google 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 to in ... |
#![feature(
proc_macro_diagnostic,
proc_macro_quote,
proc_macro_span,
proc_macro_hygiene
)]
extern crate proc_macro;
use proc_macro::{
quote, Delimiter, Diagnostic, Ident, Level, Literal, Punct, Spacing, Span, TokenStream,
TokenTree,
};
use std::convert::Into;
use std::iter::FromIterator;
fn g... |
use crate::commit::Commit;
use crate::data::get_oid;
use crate::entry::Tree;
use anyhow::{anyhow, Context, Result};
use std::fs::{create_dir_all, OpenOptions};
use std::io::{Read, Write};
use std::path::Path;
use std::str;
use walkdir::WalkDir;
const DSGIT_DIR: &str = ".dsgit";
#[derive(Debug)]
pub struct RefValue {
... |
use near_internal_balances_plugin::SudoInternalBalanceFungibleToken;
use std::collections::HashSet;
use near_sdk::{collections::Vector, env, AccountId, Balance};
use crate::{utils::U256, Contract, FeeReceiver, SetInfo, TokenWithRatio, TokenWithRatioValid};
pub const WRAP_TO_UNDERLYING_RATIO: u128 = 1_000_000;
const ... |
//! A single route containing a set of legs.
use crate::{
bounds::Bounds,
directions::response::{
leg::Leg, overview_polyline::OverviewPolyline, transit_fare::TransitFare,
}, // crate::directions::response
}; // use
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
/// A single route... |
use serde::de::DeserializeOwned;
use std::{fs, fs::File, io, path::Path, str::FromStr};
use super::error::*;
#[non_exhaustive]
#[derive(Debug, Clone, Copy)]
pub enum ConfigFormat {
Json,
Yaml,
Ron,
Toml,
/// See: [Cargo.toml metadata table](https://doc.rust-lang.org/cargo/reference/manifest.html#t... |
/*a Copyright
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, software
distributed under the... |
// 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
// di... |
/*!
This is an implementation of the Tillich-Zémor-style hash function
presented in the paper ["Navigating in the Cayley Graph of SL₂(𝔽ₚ)"
](https://link.springer.com/article/10.1007%2Fs00233-015-9766-5) by
Bromberg, Shpilrain, and Vdovina.
> ### Warning
>
> This module is not produced by cryptography experts, but by... |
// Copyright 2018 Google 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use std::cell::RefCell;
use std::collections::HashMap;
use wasm_bindgen::prelude::*;
use web_sys::*;
static TEXTURED_QUAD_VS: &'static str = include_str!("./textured-quad-vertex.glsl");
static TEXTURED_QUAD_FS: &'static str = include_str!("./textured-quad-fragment.glsl");
static MESH_SKINNED_VS: &'static str = includ... |
use super::db_schema::*;
#[derive(Serialize, Queryable, QueryableByName)]
#[table_name="authors"]
pub struct DbAuthor {
pub id: i32,
pub uid: String,
pub blurb: String,
pub long_name: String,
pub short_name: String,
}
#[derive(Insertable)]
#[table_name="authors"]
pub struct Ne... |
#![no_main]
#![no_std]
extern crate panic_semihosting;
use core::cell::RefCell;
use core::ops::DerefMut;
use core::time::Duration;
use core::u32;
use byteorder::{ByteOrder, LittleEndian};
use nrf51_hal as hal;
use crate::hal::nrf51;
use crate::hal::nrf51::interrupt;
use crate::hal::prelude::*;
use crate::hal::gpio... |
use serde_derive::{Deserialize, Serialize};
/// Contains all parameters for the NEAT algorithm. A reference to `NeatParams`
/// will be passed around internally. Usually you only need to give it to
/// `Population::evolve`.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct NeatParams {
/// Number of input... |
#![cfg(any(feature = "cgi", feature = "scgi"))]
use std::collections::HashMap;
use std::io;
use std::net::SocketAddr;
#[cfg(feature = "cgi")]
use tokio::process::Command;
#[cfg(feature = "cgi")]
use std::path::PathBuf;
#[cfg(feature = "scgi")]
use std::net::ToSocketAddrs;
#[cfg(feature = "scgi")]
use tokio::io::{Asyn... |
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::io::Write;
use std::path::PathBuf;
use chrono::prelude::*;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use anyhow::Result;
use regex::Regex;
#[macro_use]
extern crate lazy_static;
use thiserror::Error;
pub struct... |
use std::error::Error;
use crate::serialization::state::NodeRef as ProtoNodeRef;
use crate::traits::{Decode, Encode, Proto};
use protobuf::Message as ProtoMessage;
#[derive(Clone, Debug, PartialEq)]
pub struct NodeRef {
pub node_location: Vec<u8>,
pub child: Vec<u8>,
}
impl NodeRef {
pub fn new(location... |
#[cfg(test)]
mod tests;
use std::collections::HashMap;
#[cfg(feature = "serialization")]
use std::fmt;
use rand::seq::SliceRandom;
#[cfg(feature = "serialization")]
use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "serialization")]
const KEY_NO_WORD: &str = "\n";
#[cfg(fe... |
use itertools::Itertools;
use crate::input;
pub fn solve() {
let x = input::file_for_day(8);
println!("Solution part 1: {}", part_one(x.clone()));
println!("Solution part 2: {}", part_two(x));
}
fn part_one(input: Vec<String>) -> i64 {
input
.iter()
.map(|x| {
let mut sid... |
use crate::service_scope::ServiceScope;
use crate::test_app::TestApp;
use cancellation::CancellationTokenSource;
use lazy_static::lazy_static;
use sea_orm::DatabaseConnection;
use signal_child::Signalable;
use snmp_sim::configuration::get_configuration;
use snmp_sim::configuration::Settings;
use static_init::dynamic;
u... |
extern crate bit_vec;
extern crate ego_tree;
extern crate notify;
#[macro_use]
extern crate log;
#[macro_use]
extern crate derive_builder;
pub use self::tree::{DirTree, SearchResult};
use self::utils::{Cond, CondAll};
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
use std::borrow;
use std::io;
use std:... |
use std::fmt;
use crate::*;
/// Represents Agent state at given turn
#[derive(Clone, fmt::Debug)]
pub struct Agent {
/// Team id of our Bot's Player
pub team: TeamId,
/// Turn index
pub turn: TurnAmount,
/// Whole GameMap
///
/// # See also
///
/// Check <https://www.lux-ai.org/s... |
use crate::shapehash;
use serde::de::value;
use serde_json::map::Map as JsonMap;
use serde_json::Value as JsonValue;
use serde_urlencoded;
use std::collections::{BTreeMap, HashMap};
#[derive(PartialEq, Clone, Debug, Hash, Eq)]
pub enum BodyDescriptor {
Object(ObjectDescriptor),
Array(ItemsDescriptor),
String,
... |
use algebra::PrimeField;
use r1cs_core::{lc, LinearCombination, SynthesisError, Variable};
use r1cs_std::{fields::fp::FpVar, prelude::*};
pub trait Bitmap<F: PrimeField> {
/// Enforces that there are no more than `max_occurrences` of `value` (0 or 1)
/// present in the provided bitmap
fn enforce_maximum_oc... |
//! Secrets configuration for agents.
//!
//! This struct built from environment variables. It is used alongside a
//! NomadConfig to build an agents `Settings` block (see settings/mod.rs).
use crate::{agent::SignerConf, chains::ethereum, ChainConf};
use eyre::Result;
use serde::Deserialize;
use std::collections::{Has... |
use actix::*;
use actix_web::*;
use context::ChannelItem;
use protocol::{Frame, CloseCode};
use session::{Session, SessionState};
use manager::{Acquire, Release, Broadcast, Record, SessionManager};
mod xhr;
mod xhrsend;
mod xhrstreaming;
mod eventsource;
mod jsonp;
mod htmlfile;
mod websocket;
mod rawwebsocket;
pub ... |
use crate::graphics::{AttributeType, OpenGL};
use log::trace;
/// A trait to describe vertices that will be consumed by a shader.
///
/// # Example
/// ```
/// // This is an example for how to implement VertexDescriptor for a simple type.
/// use storm::cgmath::*;
/// use storm::graphics::*;
///
/// #[repr(C)]
/// #[d... |
use crate::error::ContractError;
use cosmwasm_std::{ Storage, Uint128, Addr, StdResult, StdError, Response, Env, QuerierWrapper, Querier, BalanceResponse};
use cw20::{Cw20ExecuteMsg, Cw20QueryMsg, BalanceResponse as Cw20BalanceResponse, TokenInfoResponse};
use crate::state::{ OWNER, PLATIUM_CARD_NUMBER, GOLD_CARD_NUM... |
use crate::shell::shell_operation::ShellOperation;
pub struct CompletionOperation;
impl ShellOperation for CompletionOperation {
fn bash_eval(&self) -> String {
String::from(
r#"
complete -r venv 2>&1 > /dev/null
_venv_wrapper_completions() {
if [ "${#CO... |
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::collections::VecDeque;
use std::sync::Arc;
use crossbeam::channel::{Receiver, Sender};
use dashmap::DashMap;
#[cfg(debug_assertions)]
use log::warn;
use super::{PostingsStreamDecoder, TermDocsForMerge};
use crate::worker::MainToWorkerMessage;
pub sta... |
use crate::buf::BufCacheHandler;
use crate::constants::{BLK_SIZE, LOG_SIZE, MAX_OP_BLOCKS, ROOT_DEV};
use crate::once::Once;
use crate::pmap::VirtAddr;
use crate::spinlock::{Mutex, MutexGuard};
use crate::{buf, superblock, util};
use core::mem;
// Contents of the header block, used for both the on-disk header block
//... |
use hyper::body::HttpBody;
use hyper::header::{HeaderMap, HeaderName, HeaderValue, CONTENT_LENGTH, CONTENT_TYPE};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, Server};
use reqwest::Client;
use std::borrow::Cow;
use std::net::SocketAddr;
use url::form_urlencoded;
use c... |
// 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... |
//! `bak` is a Rust library for safely moving files out of the way.
//!
//! The API has a few methods, but the one to start with is
//! `bak::move_aside(PATH)`.
//!
//! `move_aside("foo")` will move the file or directory "foo" to
//! "foo.bak", if there isn't already something there. If there is
//! already a file call... |
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::io::{Read, Seek, Write};
use serde::{Serialize};
use crate::mp4box::*;
#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct Tx3gBox {
pub data_reference_index: u16,
pub display_flags: u32,
pub horizontal_justification: i8,
pub verti... |
//! Z80 CPU module
use crate::{
opcode::{
execute_bits, execute_extended, execute_normal, execute_pop_16, execute_push_16, Opcode,
Prefix,
},
RegName16, Regs, Z80Bus,
};
/// Interrupt mode enum
#[derive(Debug, Clone, Copy)]
pub enum IntMode {
Im0,
Im1,
Im2,
}
impl From<IntMode... |
//! Request-id.
//!
//! RequestID provides a "request-id" to a http request. This can be
//! used for tracing, debuging, user error reporting.
//!
//! In general, you just insert a `request-id` middleware and initialize it
//! To access requestID data, [`RequestID`] extractor must be used.
//!
//! ```
//! use actix_web... |
use crate::LoginError;
use dashmap::DashMap;
use futures::stream::{SplitSink, SplitStream};
use futures::{SinkExt, StreamExt};
use jinshu_protocol::{
Body, Message, Pdu, PduCodec, Request, Response, TransactionId, TransactionIdGenerator,
};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use std::time::Ins... |
use bindings::Windows::{
self,
Win32::{
Foundation::{E_NOTIMPL, HWND, LPARAM, LRESULT, PWSTR, RECT, S_OK, WPARAM},
System::Com,
UI::{Controls, Shell, WindowsAndMessaging},
},
};
use windows::*;
use crate::{form, pwstr};
const CLASS_NAME: &str = "WebViewInstallForm";
pub struct Web... |
//! Objects responding to endpoint calls.
//!
//! There are two main objects, both implement the `futures_core::Stream` trait:
//! - `StreamableCamera` initializes the webcam and captures a new frame in its `poll_next` method.
//! - `InferCamera` initializes both the webcam and a neural network model from an `.onnx` fi... |
// Copyright 2015-2016 <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 AUTHORS DISCLAIM ALL... |
/*
WebServe (Rust port)
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 w... |
#![no_std]
pub mod storage;
pub mod table;
pub mod storage_io;
pub mod stream;
pub mod dir;
pub mod dir_entry;
pub mod file;
pub mod path;
use path::Path;
use file::File;
use dir::Dir;
use dir_entry::DirEntry;
use storage::{Storage, StorageRead, StorageWrite};
use storage_io::StorageIo;
use table::{FatTable, FatType}... |
use crate::heightmap::{ColumnHeightMap, CubeHeightMap};
use crate::sources::LightSources;
use crate::PackedNibbleCube;
use std::cmp;
use std::collections::HashMap;
use vocs::component::{CubeStorage, LayerStorage};
use vocs::mask::{BitLayer, Mask};
use vocs::nibbles::{u4, NibbleCube, NibbleLayer};
use vocs::packed::Pack... |
use std::ptr::null_mut;
use tokterm_core::drawing::cell::Cell;
use tokterm_core::drawing::cell_buffer::CellBuffer;
use tokterm_core::drawing::point_2d::Point2d;
use tokterm_core::drawing::size_2d::Size2d;
use tokterm_core::system::terminal::Terminal;
use tokterm_core::Result;
use color::get_u16_from_color;
use winapi::... |
//! Code for working with the agent neural network.
use tch::{self, Device, IValue, IndexOp, Kind, Tensor};
use reason_othello::{self, bitboard::Bitboard, Board, Location, LocationList};
use std::convert::TryFrom;
// Redefine these with types that `tch` likes
const EDGE_LENGTH: i64 = reason_othello::EDGE_LENGTH as i... |
use chrono::{DateTime, Local, TimeZone};
const SIGIL: &str = "- [";
fn now() -> DateTime<Local> {
Local::now()
}
fn mdbook_summary_line_for_time<T: TimeZone>(dt: DateTime<T>) -> String
where
T::Offset: std::fmt::Display,
{
dt.format("- [%A, %b %d, %Y](./%Y/%Y-%m/%Y-%m-%d.md)")
.to_string()
}
fn ... |
use super::{MessageOrHeader, Worker, HEADER_SIZE};
use crate::runner::consumer::ResponseConsumer;
use crate::runner::report::StatusStore;
use crate::runner::{producer::PacketGeneratorStatus, QueryProducer};
use crate::utils::Argument;
use mio::net::UdpSocket;
use mio::{Events, Interest, Poll, Token};
use std::collectio... |
use crate::link::{
primitive::{ForkLink, JoinLink, ProcessLink},
Link, LinkBuilder, PacketStream, ProcessLinkBuilder,
};
use crate::processor::Processor;
#[derive(Default)]
pub struct MtransformNLink<P: Processor + Send> {
in_streams: Option<Vec<PacketStream<P::Input>>>,
processor: Option<P>,
join_... |
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use canonical_serialization::{CanonicalDeserialize, CanonicalDeserializer, CanonicalSerialize, CanonicalSerializer, SimpleDeserializer};
use failure::prelude::*;
use types::access_path::{Accesses, AccessPath};
use types::account_address::AccountAddr... |
use std::env::args;
use std::time::Instant;
fn main() {
let input = args().nth(1).expect("Please provide an input");
let input = input.as_bytes();
let now = Instant::now();
let output = run(input);
let elapsed = now.elapsed();
println!("_duration:{}", elapsed.as_secs_f64() * 1000.);
println... |
#![warn(clippy::all, clippy::pedantic)]
const AUTHOR: &str = "
▞▀▖ ▌ ▞▀▖▞▀▖▞▀▖▛▀▘
▌ ▞▀▖▌ ▌▛▀▖▞▀▖▌ ▌▚▄▘▙▄ ▗▘▙▄
▌ ▖▌ ▌▐▐▐ ▌ ▌▌ ▌▚▄▌▌ ▌▌ ▌▗▘ ▖ ▌
▝▀ ▝▀ ▘▘ ▀▀ ▝▀ ▗▄▘▝▀ ▝▀ ▀▀▘▝▀
Email: <EMAIL>
";
mod commandline;
use revi_core::{Mapper, Mode, ReVi, ReViCommand};
use revi_ui::{Key, Tui};
use mlua::prelude:... |
extern crate serde_json;
use std::io;
use serde_json::Value;
/// Trait used to remove Json Value's element
pub trait Remove {
/// Method use to remove element in Json Values
fn remove(&mut self, json_pointer: &str) -> io::Result<Option<Value>>;
}
impl Remove for serde_json::Value {
/// # Examples: Remove... |
extern crate blas;
extern crate ndarray;
#[cfg(feature = "serde")]
extern crate serde;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde_derive;
use ndarray::prelude::*;
use ndarray::Data;
use ndarray::linalg::{
general_mat_vec_mul,
};
/// The parameters of recursive least squares algorithm.
///
/// Th... |
use crate::constants::*;
use crate::map::{Map, Tile};
use crate::player::Player;
use num::pow;
use std::cmp::min;
use std::f64::consts::PI;
const PLAYER_DIAM: i32 = 6;
const PLAYER_LEN: f64 = 40.0;
const FIELD_OF_VIEW: f64 = PI / 2.0;
const TILE_SIZE: f64 = 4.8;
// FIXME this is suspicious, probably use Option or Re... |
/// pub mod multiplayer:
/// wrappers of client and server abstractions, gaming threads
use crate::{ server, client };
use crate::server::{ YardCtrl, YardInfo };
use crate::transmit::*;
use crate::{ tcp_recv, udp_recv };
use std::thread;
use std::sync::mpsc::{ self, TryRecvError };
use std::net::{ Shutdown, TcpListen... |
use std::fs::read_to_string;
use std::path::Path;
#[derive(Debug)]
pub struct Sheet {
max_x: usize,
max_y: usize,
points: Vec<Point>,
}
pub type Point = (usize, usize);
pub type Instruction = (Axis, usize);
#[derive(Debug, PartialEq)]
pub enum Axis {
X,
Y,
}
impl Sheet {
pub fn from_points(p... |
use crate::vm::VM;
const LOWER_BYTE: i16 = 255;
#[derive(Copy, Clone)]
/// Enum to denote Byte length registers of 8086
pub enum ByteReg {
AL,
AH,
BL,
BH,
CL,
CH,
DL,
DH,
}
#[derive(Copy, Clone)]
/// Enum to denote Word length registers of 8086
pub enum WordReg {
AX,
BX,
CX... |
use crate::{
create_manager::models::BlobMetadata,
models::{CreateMessage, JobStatus},
service_bus_client::{
create_factory, ProcessMessageError, ProcessRetrievalError, RemovableMessage,
RetrievedMessage,
},
state_manager::{JobStatusClient, StateManager},
storage_client::{AzureBl... |
// 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 {
anyhow::{format_err, Context as _, Error},
fidl_fuchsia_net as fnet, fidl_fuchsia_net_dhcpv6 as fdhcpv6,
fidl_fuchsia_net_name as fnetnam... |
use alloc::{vec, vec::{Vec}};
use rbop::{Number, StructuredNode, node::unstructured::{Upgradable}, render::{Area, Renderer, Viewport}};
use rust_decimal::prelude::{One, ToPrimitive, Zero};
use crate::{interface::{Colour}, operating_system::{OSInput, os}, rbop_impl::{RbopContext}};
use super::{Application, ApplicationI... |
use gloo::events::EventListener;
use itertools::Itertools;
use mkt_data::{item_type_from_id, CourseId, ItemType};
use yew::prelude::*;
use yew_agent::{Bridge, Bridged};
use crate::{
agents::data_inventory::{
DataInvCourse, DataInventory, DataInventoryAgent, DataInventoryRequest, Shared,
},
comps::i... |
/*****************************************************
PROJECT : hpc_allocator_rust
VERSION : 0.1.0-dev
DATE : 05/2018
AUTHOR : <NAME>
LICENSE : CeCILL-C
*****************************************************/
///The address space is split into r... |
#[inline]
pub(crate) fn add_as_vlq(buffer: &mut[u8], mut value: u128) -> usize {
let mut index = 0;
while value > 127 {
buffer[index] = ((value & 127) | 128) as u8;
index += 1;
value >>= 7;
}
buffer[index] = value as u8;
index +=1;
index
}
#[inline]
pub(crate) fn add_as_... |
//Editor holds the editor state
use memory::buffer::{BufferList, Buffer, BufferIter};
use std::env;
use std::error::Error;
use std::default::Default;
use std::fs::*;
use std::io::prelude::*;
use std::char::from_digit;
use rustbox::{Color, RustBox};
use rustbox::*;
pub struct Editor {
buf_list: BufferList,
t... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00..0x14 - no description available"]
pub lut0: LUT,
_reserved1: [u8; 0x0c],
#[doc = "0x20..0x34 - no description available"]
pub lut1: LUT,
_reserved2: [u8; 0x0c],
#[doc = "0x40..0x54 - no description available"]
... |
use cgmath::{prelude::*, Matrix3, Matrix4, Quaternion, Rad, Vector3, Vector4};
/// The graphical primitive. A solid can represent any affine transformation of
/// a sphere, cylinder or cube.
// Memory representation:
// [--- --- --- ---
// --- matrix ---
// --- --- --- ---
// -- color - kind]
#[repr(transparent)]
... |
fn idea() {
struct Sheep {
naked: bool,
name: &'static str,
}
impl Sheep {
fn is_naked(&self) -> bool {
self.naked
}
}
trait Animal {
//Static method signatures: Self refers to the implementor type
fn new(name: &'static str) -> Self;
... |
use std::io;
use std::net::SocketAddr;
use std::sync::Arc;
use anyhow::Result;
use futures::stream::StreamExt;
use log::*;
use tokio::net::{TcpStream, UdpSocket};
use tokio::sync::mpsc::channel as tokio_channel;
use tokio::sync::mpsc::{Receiver as TokioReceiver, Sender as TokioSender};
use crate::app::dispatcher::Di... |
use std::collections::{BTreeMap, BTreeSet};
use crate::crypto::{self, PublicKey, PublicKeySet, PublicKeyShare, SecretKey, SecretKeyShare};
use rand;
use crate::{util, NodeIdT};
/// Common data shared between algorithms: the nodes' IDs and key shares.
#[derive(Debug, Clone)]
pub struct NetworkInfo<N> {
/// This n... |
// Copyright 2019-2020 Google 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 t... |
//! `cargo crux-test`: Run symbolic tests of the current crate.
//!
//! Symbolic tests are identified by the `#[crux_test]` attribute, analogous to the `#[test]`
//! attribute used with `cargo test`. Symbolic tests often need to use the `crucible` crate, which
//! is unavailable when building normally, and thus should... |
use std::{
fs::{create_dir_all, File},
io::{stdout, Write},
path::Path,
rc::Rc,
};
use clap::{App, Arg, ArgMatches, SubCommand};
use semver::Version;
mod platform;
mod target;
// Command name
pub const GEN_CMAKE: &str = "gen-cmake";
// Options
const OUT_FILE: &str = "out-file";
const CONFIGURATION_T... |
use crate::{GeoNum, MultiPolygon, Polygon};
use crate::algorithm::winding_order::{Winding, WindingOrder};
pub trait Orient {
/// Orients a Polygon's exterior and interior rings according to convention
///
/// By default, the exterior ring of a Polygon is oriented counter-clockwise, and any interior
//... |
// "Tifflin" Kernel
// - By <NAME> (thePowersGang)
//
// arch/amd64/hw/hpet.rs
// - x86 High Precision Event Timer
#[allow(unused_imports)]
use prelude::*;
use arch::imp::acpi::AddressSpaceID;
module_define!{HPET, [APIC, ACPI], init}
struct HPET
{
mapping_handle: ::memory::virt::AllocHandle,
#[allow(dead_code)]
ir... |
use std::ffi::OsString;
use std::fs;
use std::path::{Path, PathBuf};
use anyhow::{anyhow, bail, Context, Result};
struct DocData<'a> {
topic: &'a str,
subtopic: &'a str,
root: &'a Path,
}
fn index_html(doc: &DocData<'_>, wpath: &Path) -> Option<PathBuf> {
let indexhtml = wpath.join("index.html");
... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
//! Firewall in [`StrongholdP2p`][`crate::StrongholdP2p`] for filtering inbound requests.
pub mod permissions;
use core::fmt;
use futures::channel::oneshot;
use libp2p::PeerId;
use std::{borrow::Borrow, collections::HashMap, fmt::Debug, marker::Phan... |
use anyhow::*;
use wgpu::util::DeviceExt;
use crate::{renderer::*, texture::*};
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CrosshairVertex {
pos: [f32; 4],
tex_coord: [f32; 2],
}
unsafe impl bytemuck::Pod for CrosshairVertex {}
unsafe impl bytemuck::Zeroable for CrosshairVertex {}
impl Vertex for Crosshair... |
use crate::types::NestedList;
pub fn mod_list(list: &NestedList) -> Vec<bool> {
let mut res: Vec<bool> = vec![];
modulate(list, &mut res);
res
}
pub fn dem_list(data: &[bool]) -> NestedList {
demodulate(&mut data.iter().copied()).unwrap()
}
fn modulate_value(signed_num: i64, res: &mut Vec<bool>) {
... |
// This file is part of Substrate.
// Copyright (C) 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
//
// http://... |
use libc;
use {Errno, Result};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use self::sched_linux_like::*;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod sched_linux_like {
use errno::Errno;
use libc::{self, c_int, c_void};
use std::mem;
use std::option::Option;
use std... |
use crate::{
AsClasses, GroupValidationResult, Icon, InputState, ValidatingComponent,
ValidatingComponentProperties, ValidationContext, ValidationFormContext, ValidationResult,
Validator,
};
use std::{marker::PhantomData, rc::Rc};
use uuid::Uuid;
use yew::{prelude::*, virtual_dom::VNode};
// form group
#[... |
use crate::{
cargo_manifest::Metadata,
error::{Error, Result},
};
use cargo::core::Manifest;
use crossbundle_tools::{
commands::{
android, apple, find_package_cargo_manifest_path, find_workspace_cargo_manifest_path,
parse_manifest,
},
tools::AndroidSdk,
types::{
android_m... |
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::mpsc::Receiver;
use std::time::{Duration, Instant};
use libdeflater::{CompressionLvl, Compressor, Decompressor};
use mio::{Events, Poll};
use packet_transformation::handling::{HandlingContext, UnparsedPacket};
use packet_transformation::TransformationR... |
#![cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
//! Lightweight derive macros for bringing orm-like features to sqlx.
//!
//! # Example: Table
//! ```rust,ignore
//! #[derive(ormx::Table)]
//! #[ormx(table = "users", id = user_id, insertable)]
//! struct User {
//! #[ormx(column = "id")]
/... |
use crate::common::StatementCache;
use crate::describe::Describe;
use crate::error::Error;
use crate::executor::{Execute, Executor};
use crate::logger::QueryLogger;
use crate::sqlite::connection::describe::describe;
use crate::sqlite::statement::{StatementHandle, VirtualStatement};
use crate::sqlite::{
Sqlite, Sqli... |
use crate::{error::PrismaError, PrismaResult};
use datamodel::dml::Datamodel;
use datamodel::ValidatedConfiguration;
use serde::Deserialize;
use std::env;
use std::{ffi::OsStr, fs::File, io::Read};
use structopt::StructOpt;
#[derive(Debug, StructOpt, Clone)]
pub enum Subcommand {
/// Doesn't start a server, but al... |
use std::sync::Arc;
use log::trace;
use skulpin::skia_safe::gpu::SurfaceOrigin;
use skulpin::skia_safe::{colors, dash_path_effect, Budgeted, Canvas, Paint, Rect, Surface};
use skulpin::CoordinateSystemHelper;
mod caching_shaper;
pub mod cursor_renderer;
pub mod font_options;
pub use caching_shaper::CachingShaper;
pu... |
use std::cmp;
use std::collections::{BTreeMap, BTreeSet};
use regex;
use twiggy_ir as ir;
use twiggy_opt as opt;
use twiggy_traits as traits;
mod emit;
mod entry;
use self::entry::MonosEntry;
#[derive(Debug)]
struct Monos {
monos: Vec<MonosEntry>,
}
/// Type alias used to represent a map of generic function na... |
use super::ExprValidator;
use crate::diagnostics::{DiagnosticSink, PossiblyUninitializedVariable};
use crate::resolve::{resolver_for_expr, ValueNs};
use crate::{BinaryOp, Expr, ExprId, PatId, Path, Resolver, Statement};
use std::collections::HashSet;
#[derive(Copy, Clone, PartialEq, Eq)]
enum ExprKind {
Normal,
... |
use crate::{
config::SinkContext,
internal_events::{
UnixSocketConnectionEstablished, UnixSocketConnectionFailure, UnixSocketError,
UnixSocketEventSent,
},
sinks::util::{encode_event, encoding::EncodingConfig, Encoding, StreamSinkOld},
sinks::{Healthcheck, VectorSink},
};
use bytes::... |
use crate::math::Vector2;
use log::*;
use pretty_hex::*;
use std::thread::sleep;
use std::time::{Duration, Instant};
use parking_lot::{RwLockWriteGuard, RwLockReadGuard};
use parking_lot::lock_api::RawRwLock;
use std::ops::Deref;
use std::cell::UnsafeCell;
use std::sync::atomic::{AtomicBool, Ordering};
/// A timer whi... |
//! An instance of the `Puzzle` trait for Klotski.
use super::generic_solver::*;
use self::Piece::*;
use self::Direction::*;
const WIDTH: usize = 4;
const HEIGHT: usize = 5;
const N_PIECES: usize = 10;
const N_DIRECTIONS: usize = 4;
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Hash, Debug)]
#[repr(i8)]
en... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.