text stringlengths 3.09k 13.9k |
|---|
//! [`UInt`] comparisons.
//!
//! By default these are all constant-time and use the `subtle` crate.
use super::UInt;
use crate::limb::{Inner, SignedInner, SignedWide, BIT_SIZE};
use crate::Limb;
use core::cmp::Ordering;
use subtle::{Choice, ConstantTimeEq, ConstantTimeGreater, ConstantTimeLess};
impl<const LIMBS: us... |
use crate::emulator;
use crate::hardware::processor::general::*;
use crate::hardware::processor::segment::*;
use libc::c_void;
use gdbstub::arch;
use gdbstub::arch::x86::reg::id::X86_64CoreRegId;
use gdbstub::target;
use gdbstub::target::ext::base::singlethread::{ResumeAction, SingleThreadOps, StopReason};
use gdbstub:... |
pub mod idea;
pub mod plan;
pub mod slot;
use async_std::task;
use std::{cell::RefCell, collections::HashMap};
use log::info;
use sqlx::MySqlPool;
use crate::{common::{app_state::AppState, config, error::Error}, modules::{ssp::{self, dsp_slot::DspSlot}, weight::{self, Weight}}};
use self::{
idea::Idea,
plan:... |
use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
use actix_web::http::header::HeaderName;
use actix_web::{Error, ResponseError};
use futures::{future, Future, Poll};
use sentry::protocol::{ClientSdkPackage, Request};
use sentry::Hub;
use uuid... |
// 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 glow::HasContext;
use std::cell::RefCell;
use std::rc::Rc;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::JsCast;
#[cfg(target_arch = "wasm32")]
use web_sys::{window, HtmlCanvasElement, WebGl2RenderingContext, WebGlContextAttributes};
use super::framebuffer::*;
use super::mesh::*;
use super::program::*;
use supe... |
use std::convert::Infallible;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::ops::Add;
use std::sync::Arc;
use async_trait::async_trait;
use chrono::{DateTime, Duration, Utc};
use http::StatusCode;
use openidconnect::{
AuthorizationCode, ClientId, ClientSecret, CsrfToken, IssuerUrl, Nonce, OAuth2TokenRespo... |
#[cfg(feature = "dbus")]
use dbus::arg::messageitem::{MessageItem, MessageItemArray};
pub use image::DynamicImage;
use image::GenericImageView as _;
use std::cmp::Ordering;
use std::convert::TryFrom;
use std::error::Error;
use std::fmt;
use std::path::Path;
use crate::miniver::Version;
mod constants {
pub const ... |
//! Facilities for creating and reading objects on the memory of an
//! AssemblyScript (Asc) WASM module. Objects are passed through the `asc_new`
//! and `asc_get` methods of an `AscHeap` implementation. These methods take
//! types that implement `To`/`FromAscObj` and are therefore convertible to/from
//! an `AscType... |
// 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.
#![cfg(test)]
use cstr::cstr;
use fdio::{self, SpawnOptions};
use fuchsia_runtime as runtime;
use fuchsia_zircon::{self as zx, AsHandleRef, Task};
use std... |
//! Service abstraction for language servers.
use std::error::Error;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::future::Future;
use std::pin::Pin;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::task::{Context, Poll};
use futures::compat::Future01CompatExt;
use futur... |
//! Stream utilioties to help implement [`super::AbstractCircMgr.`]
use futures::stream::{Fuse, FusedStream, Stream, StreamExt};
use futures::task::{Context, Poll};
use pin_project::pin_project;
use std::pin::Pin;
/// Enumeration to indicate which of two streams provided a result.
#[derive(Debug, Clone, Eq, PartialEq... |
use std::fmt;
use crate::completion::{CompletionSymbol, CompletionSymbolContent};
use crate::either;
use gluon::{
self,
base::{
ast::{Expr, SpannedExpr},
filename_to_module,
kind::ArcKind,
pos::{BytePos, Spanned},
symbol::Symbol,
types::{ArcType, BuiltinType, Ty... |
//! Definition of the variable module
//!
//! A `Variable` represents a random variable in a Probabilistic Graphic Models.
use util::JeromeError;
use itertools::{Itertools, MultiProduct};
use std::collections::HashMap;
use std::convert::From;
use std::ops::Range;
use std::string::ToString;
/// A `Variable` in a Pr... |
use crate::plonk::circuit::allocated_num::*;
use crate::plonk::circuit::linear_combination::*;
use crate::plonk::circuit::rescue::*;
use crate::rescue::*;
use crate::plonk::circuit::curve::sw_affine::AffinePoint;
use crate::plonk::circuit::bigint::field::*;
use crate::plonk::circuit::bigint::bigint::*;
use crate::plon... |
//! Library for reading and writing PCX image format.
//!
//! PCX is quite old format, it is not recommended to use it for new applications.
//!
//! PCX does not contain any color space information. Today one will usually interpret it as containing colors in [sRGB](https://en.wikipedia.org/wiki/sRGB) color space.
//!
/... |
use crate::cpu::interrupt::Flag::Joypad;
use crate::debug;
use crate::debug::message::DebugMessage;
use crate::emulator::control::ControlMessage;
use crate::input::input_message::InputMessage;
use crate::input::joypad::JoyPadKey;
use crate::ppu::{PPUFramebuffer, FB_H, FB_W};
use debug::debug_state::DebugState;
use flum... |
/* Copyright [2021] [Cerda]
*
* 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 wri... |
//! # ∂rug - Differentiable Rust Graph
//!
//! This crate is a collection of utilities to build build neural networks (differentiable
//! programs). See [examples](https://github.com/CasperN/drug/tree/master/examples)
//! for implementations of canonical neural networks. You may need to download those datasets
//! your... |
#[cfg(test)]
mod tests;
#[cfg(target_os = "linux")]
mod linux;
mod unix;
use std::{
collections::{HashMap, HashSet},
fmt::Write,
};
use delegate::*;
use failure::format_err;
use formatter::{FormatMap, FormatString};
use nix::sys::socket::{Ipv4Addr, Ipv6Addr};
use serde::{
de::{Deserialize, Deserializer},... |
use libc::c_char;
use std::{borrow::Cow, ffi::CStr, os::raw::c_void, ptr};
use weechat_sys::{t_gui_buffer, t_weechat_plugin};
use super::Hook;
use crate::{buffer::Buffer, LossyCString, Weechat};
/// Hook for a modifier, the hook is removed when the object is dropped.
#[cfg_attr(feature = "docs", doc(cfg(unsound)))]
... |
use std::mem;
use itertools::Itertools;
use ndarray::prelude::*;
use bio::stats::{LogProb, Prob};
use crate::io::codebook::Codeword;
/// Basic model for the probability of making i 1-0 and j 0-1 errors.
pub struct Xi {
p0: Vec<LogProb>,
p1: Vec<LogProb>,
}
impl Xi {
/// Create a new instance.
///
... |
pub type in_addr_t = u32;
pub type in_port_t = u16;
pub type pthread_key_t = usize;
pub type pthread_t = usize;
pub type sa_family_t = u8;
pub type socklen_t = usize;
pub type time_t = i64;
s! {
pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
pub ai_socktype: ::c_int,
... |
use chain_core::common::H256;
use client_common::tendermint::lite;
use client_common::{ErrorKind, Result, ResultExt, Storage};
use parity_scale_codec::{Decode, Encode};
use tendermint::validator;
/// key space of wallet sync state
const KEYSPACE: &str = "core_wallet_sync";
/// Sync state for wallet
#[derive(Debug, En... |
use std::cmp::Ordering;
use crate::timer;
use crate::todo;
use crate::todotxt;
/// Sorting rules. First, the list of todos is sorted by the fields defined
/// in `fields` in order of appearance. Then, if `rev` is `true` the list is
/// reversed
#[derive(Debug, Clone)]
pub struct Conf {
/// comma separated list of... |
use crate::bot::loops::launches_loop;
use crate::bot::utils::Utils;
use crate::extensions::context::ClientContextExt;
use log::info;
use log::*;
use serenity::{async_trait, model::prelude::*, prelude::*};
use std::sync::Arc;
#[derive(Debug)]
pub struct Handler {
pub(crate) run_loops: Mutex<bool>,
}
#[allow(unuse... |
#![no_std]
#![deny(unsafe_code)]
#![deny(missing_docs)]
#![deny(warnings)]
//! ### Printer operator box
use embedded_hal::digital::v2::{InputPin, OutputPin};
/// Driver for the operator box
pub struct OpBox<I: InputPin, O: OutputPin> {
clk_pin: O,
latch_pin: O,
output_pin: O,
input_pin: I,
state_o... |
use std::time::Duration;
use anyhow::Result;
use async_trait::async_trait;
use headless_chrome::{Browser, Element};
use log::info;
use magnet_url::Magnet;
use rbatis::crud::CRUD;
use regex::Regex;
use scraper::{Html, Selector};
use serde::Deserialize;
use serde::Serialize;
use thiserror::Error;
use crate::global;
us... |
use crate::types::{ApplicationSecret, FlowType, JsonError};
use super::Token;
use chrono::Utc;
use futures::stream::Stream;
use futures::Future;
use hyper;
use hyper::header;
use serde_json as json;
use url::form_urlencoded;
/// Implements the [Outh2 Refresh Token Flow](https://developers.google.com/youtube/v3/guides... |
#![cfg(feature = "diagnostics-report")]
use miette::{Diagnostic, LabeledSpan, SourceSpan};
use std::borrow::Cow;
use std::cmp;
use std::path::PathBuf;
use thiserror::Error;
use vec1::Vec1;
use crate::token::{self, TokenKind, Tokenized};
pub type BoxedDiagnostic<'t> = Box<dyn Diagnostic + 't>;
/// `Result` that incl... |
use crate::prelude::*;
#[ cfg (feature = "hss-accepter") ]
pub enum Accepter {
TcpListener (Arc<tokio::TcpListener>),
#[ cfg (feature = "hss-tls-rust") ]
RustTlsTcpListener (Arc<tokio_rustls::TlsAcceptor>, Arc<tokio::TcpListener>),
#[ cfg (feature = "hss-tls-native") ]
NativeTlsTcpListener (Arc<tokio_natls::... |
use crate::limiter::create_rate_limiter;
use crate::{
constants::{MAX_NAME_LENGTH, MAX_SYMBOL_LENGTH, MAX_URI_LENGTH, USE_RATE_LIMIT},
parse::parse_solana_config,
};
use anyhow::Result;
use indicatif::ParallelProgressIterator;
use log::{error, info};
use mpl_token_metadata::{
instruction::sign_metadata, sta... |
//! Tagger shared (e.g. protocol) code
//!
//! This crate contains code shared between the Tagger server and client crates. Currently, it consists of the
//! [serde](https://crates.io/crates/serde)-enabled structs and enums which define the client/server protocol.
//!
//! The `tag_expression` submodule defines the exp... |
#[macro_use]
extern crate diesel;
use actix::*;
use actix_files as fs;
use actix_identity::Identity;
use actix_identity::{CookieIdentityPolicy, IdentityService};
use actix_web::{error, get, http, web, App, Error, HttpResponse, HttpServer};
use diesel::SqliteConnection;
use tera::Context;
use tera::Tera;
mod api;
mod... |
#[cfg(feature = "no_std")]
extern crate alloc;
#[cfg(not(feature = "no_std"))]
extern crate std as alloc;
use alloc::{rc::Rc, vec::Vec};
use core::{cell::RefCell, pin::Pin};
use futures::{
io::Error,
prelude::*,
task::{Context, Poll, Waker},
};
pub struct RingBuffer {
data: Vec<u8>,
read_idx: usiz... |
use crate::connection::Throughput as ThroughputEnum;
use crate::estimate::Estimate;
use crate::model::BenchmarkGroup;
use crate::report::{
compare_to_threshold, BenchmarkId, ComparisonResult, MeasurementData, Report, ReportContext,
};
use crate::value_formatter::ValueFormatter;
use anyhow::Result;
use serde... |
use {RxResult, RxError};
use ethernet::EtherType;
use pnet::packet::Packet;
use pnet::packet::ethernet::EthernetPacket;
use rx::RxListener;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::sync::mpsc::Sender;
use std::time::SystemTime;
/// Anyone interested in receiving ethernet frames... |
// SPDX-FileCopyrightText: 2019-2020 <NAME>
// SPDX-License-Identifier: AGPL-3.0-or-later
use libwebp_sys::*;
use rgb::RGBA8;
use std::mem::MaybeUninit;
use crate::common::{exif_orientation, orient_image, CompressResult, Image, ReadResult};
use crate::profile::{is_srgb, SRGB_PROFILE};
pub fn read(buffer: &[u8]) -> R... |
use super::errors::*;
use super::Database;
use super::{ds_data_key, fetch_ds_data, DatasetData, DatasetId, DatasetTree, Generation};
use crate::cow_bytes::{CowBytes, SlicedCowBytes};
use crate::tree::{DefaultMessageAction, Tree, TreeBaseLayer, TreeLayer};
use std::borrow::Borrow;
use std::collections::HashSet;
use std:... |
use iced::{button, scrollable, Align, Button, Column, HorizontalAlignment, Row, Scrollable, Text};
use typetest_core::stats::TestStats;
use typetest_themes::ApplicationTheme;
use super::Action;
/// Represents the state for the results view.
pub struct ResultsState {
stats: TestStats,
show_missed_words: bool,... |
#![no_main]
#![no_std]
#[allow(unused_imports)]
use panic_semihosting;
use cortex_m_semihosting::{hprintln};
use rtfm::app;
use nrf52840_hal::{gpio, prelude::*, uarte, };
use nrf52840_pac as pac;
// const PWM_RISING_EDGE: u16 = 0x0000;
const PWM_FALLING_EDGE: u16 = 0x8000;
// 16MHz -> 62.5 ns
// 62.5 ns * 20 -> ... |
use sfml::graphics::*;
use sfml::system::Vector2f;
use sfml::window::*;
use sfml::window::mouse::Button;
use crate::AssetManager;
use super::{WIN_HEIGHT, WIN_WIDTH};
pub trait Actor {
fn update(&mut self, d: f32);
fn draw(&self, win: &mut RenderWindow);
fn events(&mut self, evt: Event);
}
struct Circl... |
//! A simple disassembler from the EVM Toolkit.
//!
//! Converts a stream of bytes into an iterator of [`ConcreteOp'].
//!
//! See the documentation for [`Disassembler`] for more information.
mod error {
use snafu::{Backtrace, Snafu};
use super::Offset;
/// Errors that may arise during disassembly.
#[... |
use bigdecimal::BigDecimal;
use calculator::CalcError;
use std::{fmt, mem};
/// A token
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Token {
BlockName(String),
Num(BigDecimal),
ParenClose,
ParenOpen,
Separator,
VarAssign(String),
VarGet(String),
Add,
And,
BitshiftLeft,
B... |
// Copyright 2021 Alibaba Cloud. All Rights Reserved.
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use super::brand_string::{BrandString, Reg as BsReg};
use super::common::get_vendor_id;
use super::{CpuId, CpuIdEntry};
pub mod amd;
pub mod common;
p... |
use crate::{
auth_urls,
clients::{BaseClient, OAuthClient},
headers,
http::{Form, HttpClient},
ClientResult, Config, Credentials, OAuth, Token,
};
use std::collections::HashMap;
use maybe_async::maybe_async;
use url::Url;
/// The [Authorization Code Flow](reference) client for the Spotify API.
//... |
/*
* opencl demos with rust
* Copyright (C) 2021 trivernis
* See LICENSE for more information
*/
use std::fmt::{self, Display, Formatter};
use std::ops::Deref;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{Duration, Instant};
use ocl_stream::executor::context::ExecutorContext;
use ocl_stream::ex... |
// Copyright <NAME>, 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 the A... |
use std::marker::PhantomData;
use group::{cofactor::CofactorGroup, GroupEncoding};
use halo2::{arithmetic::FieldExt, pasta::pallas};
use super::*;
/// A refinement type for `[u8; 32]` indicating that the bytes represent
/// an encoding of a RedPallas verification key.
///
/// This is useful for representing a compre... |
#![allow(clippy::needless_option_as_deref)]
use iced::text_input::{Style, StyleSheet};
use iced::Color;
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyString};
use crate::wrapped::WrappedColor;
use crate::{dyn_style_proto, extract_multiple, getters};
pub(crate) fn init_mod(_py:... |
use super::logging::Must;
use super::errors::Error;
use super::networkproxy::NetworkProxy;
use async_trait::async_trait;
use base64::decode;
use futures::pin_mut;
use std::net::SocketAddr;
use std::sync::Arc;
use thrussh::{client::{Handle, Session}, client};
use thrussh_keys::key;
use tokio::net::{TcpListener, TcpStre... |
use super::{request_stream::Forward, response_stream};
use crate::convert::{encode_node_id, error_into_grpc, FromProtobuf, IntoProtobuf};
use chain_core::property;
use network_core::error as core_error;
use network_core::gossip::NodeId;
use network_core::server::request_stream::MapResponse;
use futures::prelude::*;
us... |
use std::fs::File;
use std::thread;
use std::time::Duration;
use std::sync::mpsc::Sender;
use std::path::{Path, PathBuf};
use rand::{thread_rng, Rng};
use hex_database::{Track, Token, TrackKey};
use hex_music_container::{Container, Configuration};
use error::{Error, Result};
pub struct Stream {
pub track: Track,... |
use crate::*;
use std::collections::HashMap;
use std::convert::TryInto;
use std::i32;
use std::io::{self, BufRead, Read, Result};
#[derive(Debug, Clone, PartialEq)]
pub struct TabixChunk {
pub begin: u64,
pub end: u64,
}
impl TabixChunk {
fn from_reader<R: Read + BinaryReader>(reader: &mut R) -> Result<Se... |
//! MBR definitions
use crate::{gpt::error::*, types::*};
use core::{convert::TryFrom, mem::size_of};
/// Hard-coded legacy MBR size.
pub const MBR_SIZE: usize = 512;
/// Legacy MBR boot code.
///
/// Required because a bare array wouldn't be `Copy`.
#[derive(Copy, Clone)]
#[repr(transparent)]
struct BootCode([u8; 44... |
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use num_traits::FromPrimitive;
use crate::data::{
pubs::spell::{SpellTargetRestrict, SpellTargetType, SpellType, ESF_DATA_SIZE},
EOByte, EOChar, EOInt, EOShort, EOThree, Serializeable, StreamBuilder, StreamReader,
};
/// data structure of a singl... |
use super::{attr::Attributes, isv, misc::MiscSelect, Masked};
#[repr(transparent)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Vendor(u32);
impl Vendor {
pub const UNKNOWN: Vendor = Vendor(0x0000);
pub const INTEL: Vendor = Vendor(0x8086);
pub const fn new(id: u32) -> Self {
Self(id)
... |
//! Consensus account address structures.
use std::fmt;
use bech32::{self, FromBase32, ToBase32};
use crate::common::{
crypto::{hash::Hash, signature::PublicKey},
namespace::Namespace,
};
const ADDRESS_VERSION_SIZE: usize = 1;
const ADDRESS_DATA_SIZE: usize = 20;
const ADDRESS_SIZE: usize = ADDRESS_VERSION_S... |
//! The `main` function for the `iec` compiler.
//!
//! This crate doesn't really add new functionality to the compiler, instead it
//! glues together the front-end ([`iec_syntax`]), middle-end ([`iec`]), and
//! back-end to produce a functional compilation tool.
use codespan::{ByteOffset, ByteSpan, CodeMap, FileMap};... |
use crate::core::texture::{TextureMapping2Ds, Textures, SpectrumT, Texture, TextureMapping2D, TextureMapping3Ds, TextureMapping3D, TextureFloat, get_mapping2d, IdentityMapping3D, TextureSpec};
use std::sync::Arc;
use log::{error, warn};
use crate::core::interaction::SurfaceInteraction;
use crate::core::geometry::vector... |
pub mod length;
pub mod weight;
// Initialize details of measurement unit
pub struct Unit {
pub name: String,
pub alias: String,
pub base: UnitMeasurement,
pub prefix: PrefixUnit,
pub category: Category,
pub relative: Vec<RelativeUnit>,
}
impl Unit {
pub fn convert_to(&self, target: &Self)... |
use derive_more::{Deref, DerefMut, From};
use std::convert::TryFrom;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
fn fetch_file_path() -> &'static str {
if Path::new("src/input.txt").exists() {
"src/input.txt"
} else {
"day11/src/input.txt"
}
}
#[derive(Debug,... |
use std::thread;
use std::time::{Instant, SystemTime};
use crate::logging::log_settings::{
get_log_settings_provider, set_log_settings_provider, LogLevelFilter, LogSettings,
};
use crate::logging::logger::{initialize_buffered_logger, LogBufferProvider};
use super::*;
const PROC_NAME: &str = "ee-shared-lib-tests"... |
use chrono::{DateTime, Utc};
use log::{log, Level};
use rweb::{get, post, Rejection, Reply};
use serde::Deserialize;
use serde_json::json;
use std::convert::Infallible;
use crate::api;
use crate::http_error::{decorate_error, HttpError};
use crate::model;
use crate::util;
#[derive(Debug, Deserialize)]
#[serde(rename_a... |
// Protocol SIGPEQ
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use rand_os::OsRng;
use crate::petpit::{rando};
//First move
pub fn sigpeq_flow_1 (pk0: (RistrettoPoint,RistrettoPoint),sk0: Scalar, pk1: (RistrettoPoint,RistrettoPoint),sk1: Scalar, c0: (RistrettoPoint,Ristret... |
//! Support for notification toasts on win32 for events.
extern crate winrt;
use std::{result, env, path, ffi};
use super::Error as NotificationError;
use winrt::*;
use winrt::windows::data::xml::dom::*;
use winrt::windows::ui::notifications::*;
const ICON_FILE_NAME: &str = "oxixenon.png";
const SHORTCUT_NAME: &str =... |
/*
* Twilio - Api
*
* This is the public Twilio REST API.
*
* The version of the OpenAPI document: 1.25.0
* Contact: <EMAIL>
* Generated by: https://openapi-generator.tech
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ApiV2010AccountCall {
/// The SID of the Account t... |
//! Support for the `PCA9536` "4-bit I2C-bus and SMBus I/O port"
use crate::I2cExt;
/// `PCA9536` "4-bit I2C-bus and SMBus I/O port"
pub struct Pca9536<M>(M);
impl<I2C> Pca9536<shared_bus::NullMutex<Driver<I2C>>>
where
I2C: crate::I2cBus,
{
pub fn new(i2c: I2C) -> Self {
Self::with_mutex(i2c)
}
}
... |
use std::convert::TryFrom;
use anyhow::{anyhow, Result};
use grid::Grid;
use crate::Challenge;
use itertools::Itertools;
pub struct Day11;
type Layout = Grid<Cell>;
impl Challenge for Day11 {
const DAY_NUMBER: u32 = 11;
type InputType = Layout;
type OutputType = usize;
fn part1(input: &Self::Inpu... |
use std::process::Stdio;
use actix_web::{HttpRequest, HttpResponse, Responder, ResponseError, web};
use actix_web::http::header::{ACCEPT_RANGES, ACCESS_CONTROL_EXPOSE_HEADERS, CACHE_CONTROL};
use actix_web::web::Query;
use tokio_util::io::ReaderStream;
use serde::Deserialize;
use anni_provider::Range;
use crate::{Annil... |
// Copyright (c) 2021 <NAME> (Dargot) <<EMAIL>>
//
// 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
// ex... |
// Copyright <NAME>, 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 the A... |
/*! Handling all attributes of requests (GET/POST/PUT/DELETE) sent by
[`Element.request()`](https://sciter.com/docs/content/sciter/Element.htm) and
[`View.request()`](https://sciter.com/docs/content/sciter/View.htm)
functions and other load requests.
*/
#![allow(non_camel_case_types, non_snake_case)]
use capi::scty... |
use treenode::{TreeNodeValue, TreeNodeInsertable, TreeNodeParent, Instantiatable, TreeNode};
use std::collections::LinkedList;
use std::hash::Hash;
use std::rc::Rc;
use std::fmt::Debug;
use std::borrow::Borrow;
///The properties of a Sack
///A Sack is a refinement of a type-driven tree
///A Sack is both persistent and... |
//! Symbol table implementation
use std::collections::HashSet;
use time::{format_description::well_known::Rfc3339, OffsetDateTime};
pub type SymbolIndex = u64;
use super::{Check, Fact, Predicate, Rule, Term, World};
#[derive(Clone, Debug, PartialEq, Default)]
pub struct SymbolTable {
symbols: Vec<String>,
}
cons... |
use crate::{collections::TypedUsize, sdk::api::TofnFatal};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use tracing::{error, warn};
use super::api::{BytesVec, TofnResult};
use bincode::{
config::{
BigEndian, Bounded, RejectTrailing, VarintEncoding, WithOtherEndian, WithOtherIntEncoding,
... |
use byteorder::{ByteOrder, BE};
use log::warn;
use std::fmt::{Display, LowerHex, Write};
use std::io::{Read, Seek, SeekFrom};
use thiserror::Error;
/// Parse the suffix of a DFU file and calculate the data's real checksum, storing the results in a
/// [SuffixInfo] struct. When this returns, `file`'s cursor is at the b... |
use std::cmp;
use super::color::RGBColor;
use crate::utils::*;
use cmp::Ordering;
use nalgebra::*;
use poincarepoint::{PoincarePoint, PoincareWall};
use point::{Point, Wall};
use serde::Deserialize;
/// Struct representing a point on the Minkowski
/// hyperboloid model.
/// Wrapper for nalgebra's Point3.
#[derive(Clo... |
use argon2::{self, Config};
use bytes::Bytes;
use data_encoding::HEXUPPER;
use failure;
use rand;
use rusqlite::NO_PARAMS;
use rusqlite::{params, Connection};
use std::env;
// User Struct
pub struct User {
pub name: String,
pub salt: String,
pub hash: String,
pub active: i32,
}
// Constants
const CRED... |
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{decl_module, decl_storage, decl_event, dispatch::DispatchResult, ensure};
use system::ensure_signed;
pub trait Trait: system::Trait {
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
}
decl_storage! {
trait Store for Module<T: Trai... |
// Copyright 2017 <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 writi... |
use std::collections::VecDeque;
use std::fs::File;
use io_ops;
use std::io;
use hash_roll::buzhash::BuzHashBuf;
use std::io::Write;
use std::io::Read;
use crypto::digest::Digest;
use crypto::sha2::Sha256;
use std::mem::transmute;
use std::str;
use zstd::Encoder;
pub struct ChunkerConfig<'a> {
pub chunk_count: ... |
// This code adapted from https://github.com/TimelyDataflow/timely-dataflow/blob/master/timely/src/dataflow/operators/capture/replay.rs
//! Custom replay operator that supports stopping replay arbitrarily
//! and throttling the number of epochs in flight that are introduced by it.
//! It also provides events in order ... |
//! A various strategies to destroy parts of an existing solution.
use crate::construction::heuristics::{InsertionContext, RouteContext};
use crate::models::problem::Job;
use crate::models::Problem;
use crate::solver::RefinementContext;
use crate::utils::Random;
use std::iter::{empty, once};
use std::sync::Arc;
/// A... |
use std::{env, thread, time};
use std::fs::File;
use std::io::prelude::*;
//const DATA: &str = "data/"; //TODO move examples to 'data/'
type World = Vec<Vec<bool>>;
#[derive(Debug)]
struct Coord {
x: usize,
y: usize,
}
//show_world is a placeholder, just uses side-effects to pretty print the world
//TODO: P... |
// #[macro_use]
// extern crate serde_derive;
//
use gloo::timers::callback::Interval;
use wasm_bindgen::prelude::*;
// use wasm_bindgen::{JsCast, JsValue};
use wasm_bindgen::JsCast;
use web_sys::{console, Document, HtmlElement, Window};
fn get_window() -> Window {
web_sys::window().expect("no global `window` exis... |
use crate::lang::errors::{CrushResult};
use crate::lang::execution_context::CommandContext;
use crate::lang::data::scope::Scope;
use crate::lang::value::{Value, ValueType};
use crate::lang::data::table::{ColumnType, Row};
use signature::signature;
use crate::lang::command::OutputType::Known;
use nix::unistd::Pid;
use c... |
//! Handle redis call reply
use crate::error::Error;
use crate::raw;
use crate::value::Value;
use crate::{FromPtr, GetPtr, RResult};
/// Wrap the pointer of a RedisModuleCallReply
#[repr(C)]
pub struct CallReply {
ptr: *mut raw::RedisModuleCallReply,
}
impl GetPtr for CallReply {
type PtrType = raw::RedisMod... |
use futures::{
future::{err, result, Either},
Future,
};
use auth::{
AuthData, AuthError, HasSessionStorage, HasUserAuth, IsSessionData, IsSessionStorage,
IsUserAuth,
};
use crypto::{CanDecrypt, HasSecretKey};
use user::{HasUserStorage, IsUserStorage};
use warp::{any, header, reject::custom, Filter, Re... |
extern crate sdl2;
extern crate sdl2_ttf;
use sdl2::render::{Renderer, TextureQuery, BlendMode};
use sdl2::rect::Rect;
use sdl2::pixels::Color;
use std::vec::Vec;
use std::cmp::Ordering;
use std::path::Path;
use std::ops::Index;
use std::ops::DerefMut;
pub struct FontSet {
font_size: u16,
font_regular: sdl2_t... |
/*
Copyright 2021 Integritee AG and Supercomputing Systems AG
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... |
use std::{collections::HashMap, fs, num::ParseIntError};
use anyhow::Context;
fn main() {
let input = fs::read_to_string("./input/day4.txt").expect("failed to read input file");
let (boards, drawn_numbers) = parse(&input).unwrap();
match play_to_win(boards, drawn_numbers) {
BingoResult::Bingo { b... |
use crate::coords::Coords;
use std::f64::consts::PI;
pub const MAX_ZOOM: u8 = 18;
pub const TILE_SIZE: u32 = 256;
#[derive(Eq, PartialEq, Debug)]
pub struct Tile {
pub zoom: u8,
pub x: u32,
pub y: u32,
}
#[derive(Eq, PartialEq, Debug)]
pub struct TileRange {
pub min_x: u32,
pub max_x: u32,
p... |
use crate::dht::bbdht::dynamodb::api::item::Item;
use crate::dht::bbdht::dynamodb::client::Client;
use crate::dht::bbdht::dynamodb::schema::cas::ADDRESS_KEY;
use crate::dht::bbdht::dynamodb::schema::cas::CONTENT_KEY;
use crate::dht::bbdht::dynamodb::schema::string_attribute_value;
use crate::dht::bbdht::dynamodb::schem... |
#[macro_use]
extern crate carbide_core;
extern crate carbide_glium;
#[macro_use]
extern crate carbide_winit;
extern crate find_folder;
extern crate glium;
use glium::Surface;
mod support;
const WIDTH: u32 = 600;
const HEIGHT: u32 = 300;
widget_ids! {
struct Ids { canvas, list_select }
}
fn main() {
// Buil... |
// Copyright (c) 2017 <NAME>
//
// 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. All files in the project carrying such notice may not be copied,
// modified, ... |
// Copyright 2012 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 {
super::*,
::p256::arithmetic::{AffinePoint, ProjectivePoint, Scalar},
rand_core::{CryptoRng, RngCore},
};
/// An ECDH provider using the pure-Rust `p256` crate.
pub struct P256Provider {}
impl P256Provider {
/// Creates a new instance.
pub fn new() -> Self {
Self {}
}
}
impl Ecd... |
use audio;
use gfx;
use visualizer::symmetry::symmetry::SymmetryVisualizer;
use visualizer::visualizer::SubVisualizer;
pub struct PentaSymmetryVisualizer {
symmetry_visualizer: SymmetryVisualizer,
}
impl SubVisualizer for PentaSymmetryVisualizer {
fn new() -> PentaSymmetryVisualizer {
PentaSymmetryVis... |
// SPDX-License-Identifier: MIT
// Copyright (C) 2021 <NAME> <<EMAIL>>
mod ascii;
mod changes;
mod config;
mod controller;
mod curses;
mod cursor;
mod editor;
mod file;
mod history;
mod inifile;
mod ui;
mod view;
use config::Config;
use controller::Controller;
use curses::Curses;
// Exit codes
const EFAULT: i32 = 14... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.