text stringlengths 7.05k 33.9k |
|---|
use crate::optics::hyperparams::{OpticsParams, OpticsValidParams};
use linfa::traits::Transformer;
use linfa::Float;
use linfa_nn::distance::{Distance, L2Dist};
use linfa_nn::{CommonNearestNeighbour, NearestNeighbour, NearestNeighbourIndex};
use ndarray::{ArrayView, Ix1, Ix2};
use noisy_float::{checkers::NumChecker, No... |
/// The ZQM language: abstract syntax
pub mod lang {
use crate::{bitmap, chain, grid, menu};
use hashcons::merkle::Merkle;
use serde::{Deserialize, Serialize};
/// Media combines words and images
/// (eventually, we add sound and moving images)
#[derive(Clone, Debug, Serialize, Deserialize, Has... |
// tests/tests_windows.rs
use std::sync::mpsc::sync_channel;
use windows_bindings::windows::foundation::*;
use windows_bindings::windows::devices::enumeration::*;
use windows_bindings::windows::media::*;
use windows_bindings::windows::media::capture::*;
use windows_bindings::windows::media::capture::frames::*;
use wi... |
use std::collections::HashMap;
use std::path::Path;
use anyhow::Result;
use image::DynamicImage;
use imgui::im_str;
use log::warn;
use crate::{
define_gl_primitive,
shader::{image_shader::ImageShader, relation_line_shader::RelationLineShader},
};
use super::{create_simple_vertex, image::Image, GLPrimitive};
... |
//! Flipper Device Firmware Upgrade
//!
//! The `fdfu` crate defines how to flash new firmware onto Flipper's hardware.
//! It utilizes Flipper's own Rust language bindings to perform the necessary
//! GPIO and UART hardware interactions to enter update mode, copy the firmware,
//! and reboot the board.
#![allow(unsaf... |
//! Advent of Code 2020 Day 19
//! https://adventofcode.com/2020/day/19
//!
//! Challenge part 2
//!
//! Parse a set of rules that define whether a string is valid, then validate all the strings in
//! the input file against these rules. Part 2 adds recursive rules.
use std::collections::HashMap;
use std::fs;
use std... |
use odbc_sys::SqlDataType;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
/// Enumeration over valid SQL Data Types supported by ODBC
pub enum DataType {
/// The type is not known.
Unknown,
/// `Char(n)`. Character string of fixed length.
Char {
/// Column size in characters (excluding terminatin... |
//! This module contains a 2-bit q-gram encoder and enums to modulate its behaviour.
//!
//! The encoder itself is an iterator generated from:
//!
//! * A reference to a text
//! * A value for q (1 <= q <= 32)
//! * A canonicity function (selected using calues of the Canonical enum)
//! * A hash mixing function... |
//! States capturing the stages of the non-interactive DKG protocol.
pub mod cache;
use super::*;
use crate::secret_key_store::volatile_store::VolatileSecretKeyStore;
use crate::threshold::ni_dkg::static_api as ni_dkg_static_api;
use ic_crypto_internal_types::sign::threshold_sig::ni_dkg::CspNiDkgTranscript;
use ic_cry... |
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) a... |
//! A mesh type dedicated to converting sequences of `render::Primitive`s to a representation in
//! vertices ready for uploading to the GPU.
//!
//! While populating the vertices buffer ready for uploading to the GPU, the `Mesh` will also
//! produce a sequence of commands describing the order in which draw commands s... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - DMA Status"]
pub stat: STAT,
#[doc = "0x04 - DMA Configuration"]
pub cfg: CFG,
#[doc = "0x08 - DMA Channel Primary Control Database Pointer"]
pub pdbptr: PDBPTR,
#[doc = "0x0c - DMA Channel Alternate Control Dat... |
//! Display a graph of commits that the user has worked on recently.
//!
//! The set of commits that are still being worked on is inferred from the event
//! log; see the `eventlog` module.
use std::fmt::Write;
use std::time::SystemTime;
use tracing::instrument;
use crate::core::dag::Dag;
use crate::core::effects::E... |
use core_foundation_sys::{
array::CFArrayRef,
base::{Boolean, CFAllocatorRef, CFTypeID},
dictionary::CFDictionaryRef,
string::CFStringRef,
};
use libc::{c_void, size_t};
use crate::{base::CVOptionFlags, image_buffer::CVImageBufferRef, OSType, return_::CVReturn};
const fn as_u32_be(array: &[u8; 4]) -> ... |
//! Displays the current state of the `App`
use crate::app::{App, CommandKind, EntrySelectState, SelectState};
use crate::utils;
use std::io::{self, Stdout};
use std::sync::atomic::Ordering::Release;
use termion::raw::{IntoRawMode, RawTerminal};
use tui::backend::TermionBackend;
use tui::layout::{Alignment, Constraint... |
use std::{cmp::Ordering, collections::BTreeMap, mem::swap};
use crate::{
instruction::{
Instruction::{self, *},
Value,
},
parse::{Node, Nodes},
};
fn merge_instruction(nodes: Nodes) -> Nodes {
let mut new_nodes = Nodes::new();
for node in nodes {
new_nodes.push_back(node);... |
//! Program line parsing
//!
//! This module parses whole program lines, including the symbol definitions, the comments and the
//! line content itself (either an instruction or a directive).
//!
//! When parsing, this module does zero copy over the original input. All members of resulting Line
//! structure reference ... |
use crate::objects::*;
use crate::PrimID;
use crate::{Material, Mesh, Texture, ToMesh};
use rtbvh::{Bounds, Ray, RayPacket4, AABB};
use std::collections::HashMap;
#[cfg(feature = "object_caching")]
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "object_caching", derive(Serialize, Deserialize))]
#[derive(D... |
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fs::{self, File};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use serde::{Deserialize, Serialize};
use serde_xml_rs;
use structopt::StructOpt;
#[derive(Deserialize, Debug, Clone)]
struct Item {
#[serde(rename = "uiIndex")]
inde... |
//! Memory Protection Unit
use cortex_m::{asm, peripheral::MPU};
/// Data access permissions for a memory region from unprivileged code.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum MpuAccessPolicy {
/// Any data access (read or write) will generate a fault.
NoAccess = 0b01,
/// Any write access will gen... |
//! Stage 5 - syslog server rslogd
//!
//! MUST run as root or use sudo
//!
//! ```
//! cargo build
//! sudo target/debug/rslogd --certs ./fullchain.pem --key ./privkey.pem
//! ```
//!
//! # panics
//!
//! If socket cannot bind to syslog UDP port 514 (permissions or already in use)
//!
use docopt::Docopt;
use index_po... |
//! Tidy check to ensure that unstable features are all in order.
//!
//! This check will ensure properties like:
//!
//! * All stability attributes look reasonably well formed.
//! * The set of library features is disjoint from the set of language features.
//! * Library features have at most one stability level.
//! ... |
// Copyright 2018 The Grin Developers
//
// 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 agree... |
//! The TIMER peripherals.
//!
//! This module provides a interface to the TIMER peripherals, more or less
//! directly corresponding to the underlying registers, tasks, and events.
//!
//! At present only timer mode (as opposed to counter mode) is supported.
//!
//! TIMER0's 24-bit mode isn't supported.
use core::mar... |
//! Implementation for the primary directory state machine.
//!
//! There are three (active) states that a download can be in: looking
//! for a consensus ([`GetConsensusState`]), looking for certificates
//! to validate that consensus ([`GetCertsState`]), and looking for
//! microdescriptors ([`GetMicrodescsState`]).
... |
//! The `Button` widget and related items.
use image;
use position::{self, Align, Rect, Scalar};
use text;
use widget;
use {Borderable, Color, Colorable, FontSize, Labelable, Positionable, Sizeable, UiCell, Widget};
/// A pressable button widget whose reaction is triggered upon release.
#[derive(Clone, WidgetCommon_)... |
#![cfg_attr(
not(any(feature = "vulkan", feature = "dx12", feature = "metal", feature = "gl")),
allow(dead_code, unused_extern_crates, unused_imports)
)]
extern crate env_logger;
extern crate gfx_hal as hal;
#[cfg(feature = "dx12")]
extern crate gfx_backend_dx12 as back;
#[cfg(feature = "vulkan")]
extern crate... |
use admission_control_proto::{
proto::{
admission_control::{
SubmitTransactionRequest, SubmitTransactionResponse as ProtoSubmitTransactionResponse,
},
admission_control_grpc::AdmissionControlClient,
},
AdmissionControlStatus, SubmitTransactionResponse,
};
use client::{Acc... |
//! Efficient representation of the source text that is covered by a [`SyntaxNode`].
use std::fmt;
use crate::{interning::Resolver, Language, SyntaxNode, SyntaxToken, TextRange, TextSize};
/// An efficient representation of the text that is covered by a [`SyntaxNode`], i.e. the combined
/// source text of all tokens... |
/// we don't know that it works
///
/// we only know it might
extern crate chrono;
extern crate failure;
#[macro_use]
extern crate failure_derive;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_urlencoded;
extern crate reqwest;
#[cfg(feature = "webhook")] extern crate iron;
use std::fm... |
use core::fmt;
use std::{fmt::Debug, time::Duration};
use rusb::{request_type, Context, Device, Direction, TransferType, UsbContext};
use crate::{
DebugProbeError, DebugProbeInfo, DebugProbeSelector, DebugProbeType, ProbeCreationError,
};
const JTAG_PROTOCOL_CAPABILITIES_VERSION: u8 = 1;
const JTAG_PROTOCOL_CAPA... |
use crate::{ecies::ECIESStream, transport::Transport, types::*, util::pk2id};
use anyhow::{anyhow, bail, Context as _};
use bytes::{Bytes, BytesMut};
use derive_more::Display;
use enum_primitive_derive::Primitive;
use futures::{ready, Sink, SinkExt};
use num_traits::*;
use rlp::{Decodable, DecoderError, Encodable, Rlp,... |
//! The tensorcheck IOP protocol for proving multivariate evaluations
//! $f(\rho_0, \dots, \rho_{n-1})$.
//!
//! Let $f(x) \in \FF\[x\]$ be a polynomial of degree $2^n $
//! represented as the a vector of its coefficients.
//! The tensor check allows to prove the scalar product:
//!
//! \\[
//! \langle f, \otimes_j (1... |
//!
//! [](https://crates.io/crates/paypal-rs)
//! [](https://crates.io/crates/paypal-rs)
//! [](https://crates.io/crates/paypal-rs)
//! ]
pub enum Target {}
pub struct TargetData {
vertex_attribute_overrides: Vec<br::spir... |
/*
Copyright <NAME>. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
use security_framework::os::macos::keychain::*;
use security_framework::os::macos::passwords::{
find_generic_password, find_internet_password, SecAuthenticationType, SecProtocolType,
};
use security_framework_sys::item::{
k... |
use crate::bitstream::*;
use crate::chip::*;
use crate::database::*;
use crate::wires;
use std::collections::{BTreeMap, BTreeSet};
use std::iter::FromIterator;
pub enum FuzzMode {
Pip {
to_wire: String,
full_mux: bool, // if true, explicit 0s instead of base will be created for unset bits for a set... |
use log::{debug, error, trace};
use mruby_vfs::FileSystem;
use std::cell::RefCell;
use std::convert::AsRef;
use std::ffi::{c_void, CStr, CString};
use std::mem;
use std::path::PathBuf;
use std::rc::Rc;
use crate::class;
use crate::convert::{Float, Int, TryFromMrb};
use crate::def::{ClassLike, Define};
use crate::eval:... |
extern crate term;
use std::collections::HashMap;
use std::env;
use std::ffi::OsString;
use std::fs::File;
use std::fs;
use std::io::BufReader;
use std::io::prelude::*;
use std::io;
use std::net::{TcpListener, TcpStream};
use std::path::Path;
use std::process::{Command, Stdio};
use std::str;
use std::sync::{Arc, Mutex... |
extern crate array_tool;
extern crate math;
use array_tool::vec::Intersect;
use math::round;
use std::cmp::{max, Ordering};
use std::collections::HashMap;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::mem;
use std::process;
use std::vec::Vec;
fn swap(x: &mut Vec<usize>, i: usize, j: usize) {
... |
use crate::config::topology::TopicHolder;
use crate::error::ChainResponse;
use crate::message::Messages;
use crate::transforms::cassandra::peers_rewrite::CassandraPeersRewrite;
use crate::transforms::cassandra::peers_rewrite::CassandraPeersRewriteConfig;
use crate::transforms::cassandra::sink_single::{CassandraSinkSing... |
//! The objects central to this module are the `Subscription`, which is created for each potentially
//! long-standing request (currently `Ipfs::{connect, get_block}`), and the `SubscriptionRegistry`
//! that contains them. `SubscriptionFuture` is the `Future` bound to pending `Subscription`s and
//! sharing the same u... |
use std::sync::Arc;
use bevy::{
math::Vec3Swizzles,
prelude::{Entity, EventReader, Local, Query, Res, ResMut, With},
};
use bevy_egui::{egui, EguiContext};
use rose_file_readers::{ConFile, ConMessageType};
use crate::{
components::{ClientEntityName, PlayerCharacter, Position},
events::ConversationDial... |
use super::*;
pub struct Prelude {
add_f32_fn: Function,
add_f64_fn: Function,
add_i8_fn: Function,
add_i16_fn: Function,
add_i32_fn: Function,
add_i64_fn: Function,
add_u8_fn: Function,
add_u16_fn: Function,
add_u32_fn: Function,
add_u64_fn: Function,
add_usize_fn: Function... |
use std::iter::Zip;
/*
* zip2
*/
#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct Zip2<A, B> {
subzip: Zip<A, B>
}
impl<A, B> Iterator for Zip2<A, B> where
A: Iterator,
B: Iterator
{
type Item = (A::Item, B::Item);
#[inline]
fn next(&mut self) -> ... |
// This file is part of Substrate.
// Copyright (C) 2018-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
use std::io::{Error, ErrorKind, Result};
use std::time::Duration;
use bitflags::bitflags;
use bytes::{Buf, BufMut};
use crate::SrtVersion;
/// The SRT-specific control packets
/// These are `Packet::Custom` types
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum SrtControlPacket {
/// SRT handshake reject
/// ... |
use crate::UploaderBuilder;
use log::{error, info, warn};
use notify::{watcher, DebouncedEvent, RecursiveMode, Result as NotifyResult, Watcher};
use once_cell::sync::{Lazy, OnceCell};
use reqwest::blocking::Client as HTTPClient;
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
convert::TryI... |
//! Anonymous MyDHT instance to share enveloppe and votes through tunnel
extern crate sized_windows_lim;
use striple::striple::{
StripleIf,
};
use mio::{
Poll as MioPoll,
SetReadiness,
Registration,
};
use maindht::{
MainDHTConf,
MainKVStoreCommand,
};
use mydht::dhtimpl::{
NoShadow,
Cache,
};
use m... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// 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 applicabl... |
use criterion::{Criterion, black_box, criterion_group, criterion_main, BenchmarkId};
use rand::Rng;
use std::f64::consts::PI;
use cdshealpix::{
HALF_PI,
TWICE_PI,
TRANSITION_LATITUDE,
ONE_OVER_TRANSITION_Z,
SQRT6,
PI_OVER_FOUR,
FOUR_OVER_PI,
F64_SIGN_BIT_MASK,
F64_BUT_SIGN_BIT_MASK
};
use cdshea... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... |
use std::collections::HashMap;
use std::io::Write;
use abstio::{CityName, MapName};
use abstutil::{Tags, Timer};
use geom::{
Bounds, Circle, Distance, FindClosest, GPSBounds, HashablePt2D, LonLat, PolyLine, Polygon, Pt2D,
};
use map_model::raw::{OriginalRoad, RawBuilding, RawIntersection, RawMap, RawRoad};
use map... |
use crate::clients::socks5;
use crate::general::ConnectionTimeouts;
use crate::proxy::ProxyConstructor;
use byteorder::{BigEndian, ByteOrder};
use core::task::{Context, Poll};
use std::io;
use std::pin::Pin;
use std::str::FromStr;
use std::{fmt, ops::Not};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::io::{AsyncRe... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::{
errors::FxfsError,
lsm_tree::types::{Item, LayerIterator},
object_store::{
allocator::Reservation,
... |
// (C) COPYRIGHT 2018 TECHNOLUTION BV, GOUDA NL
// 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
// exce... |
use crate::utils::take;
use crate::{DeserializeErr, DeserializeResult, Deserialized};
use alloc::{string::{String, ToString}, borrow::ToOwned, fmt, vec::Vec, vec, format};
#[cfg(all(test, feature = "std"))]
use crate::protocol::TestRandom;
use crate::byte_order::{ProtoByteOrder, ByteOrder};
#[derive(Clone, Debug, Par... |
use crate::bpb::{default_sectors_per_fat, BiosParameterBlock};
use crate::changeset::{ChangeSet, ChangeSetOps};
use crate::clustermapping::{ClusterMapper, ClusterMapperOps};
use crate::dirent::{FileDirEntry, LfnDirEntry, ENTRY_SIZE};
use crate::fat::{idx_to_cluster, FatEntryValue};
use crate::fsinfo::FsInfoSector;
use ... |
//---------------------------------------------------------------------------//
// Copyright (c) 2017-2020 <NAME>. All rights reserved.
//
// This file is part of the Rusted PackFile Manager (RPFM) project,
// which can be found here: https://github.com/Frodo45127/rpfm.
//
// This file is licensed under the MIT license... |
use super::{matrix_to_array, AsMatrix, GraphMaker};
use std::fmt::Write;
/// Generates a 3D a surface (or wireframe, or both)
///
/// # Example
///
/// ```
/// # fn main() -> Result<(), &'static str> {
/// // import
/// use plotpy::{Surface, Plot};
/// use russell_lab::generate3d;
/// use std::path::Path;
///
/// // d... |
mod iter;
#[cfg(test)]
mod test;
use compare::Compare;
use self::build::{Build, PathBuilder};
use std::cmp::Ordering::*;
use std::mem::{self, replace, swap};
use super::map::Entry;
pub use self::iter::{Iter, MarkedNode, MutMarkedNode};
#[cfg(feature = "range")] pub use self::iter::Range;
pub type Link<K, V> = Optio... |
//! Routines to initialize a server.
use data_types::{database_rules::DatabaseRules, server_id::ServerId, DatabaseName};
use futures::TryStreamExt;
use generated_types::database_rules::decode_database_rules;
use internal_types::once::OnceNonZeroU32;
use object_store::{
path::{parsed::DirsAndFileName, ObjectStorePat... |
//! Parsing implementation for Tor microdescriptors.
//!
//! A "microdescriptor" is an incomplete, infrequently-changing
//! summary of a relay's information that is generated by
//! the directory authorities.
//!
//! Microdescriptors are much smaller than router descriptors, and
//! change less frequently. For this re... |
//! It can be useful to not have to worry about missing keys in a map.
//! If a key is requested that doesn't have a value a default value is simply returned.
//! This is exactly what this library provides.
//!
//! ## Examples
//! ### Counter
//! A clear use case of this is when counting the unique elements in a list.... |
/* ----------------------------------------------------------------------------
Copyright (c) 2018, Microsoft Research, <NAME>
This is free software; you can redistribute it and/or modify it under the
terms of the MIT license. A copy of the license can be found in the file
"LICENSE" at the root of this distribution.
--... |
// parng/capi.rs
//
// Copyright (c) 2016 Mozilla Foundation
//! A C API to `parng`.
#![allow(non_camel_case_types)]
use PngError;
use imageloader::{self, DataProvider, ImageLoader, InterlacingInfo, LevelOfDetail, LoadProgress};
use imageloader::{ScanlinesForPrediction, ScanlinesForRgbaConversion};
use libc::{self, ... |
use std::collections::BTreeSet;
use std::path::PathBuf;
use ic_replicated_state::canister_state::execution_state::WasmBinary;
use ic_replicated_state::{ExportedFunctions, Global, Memory, NumWasmPages, PageMap};
use ic_system_api::sandbox_safe_system_state::{SandboxSafeSystemState, SystemStateChanges};
use ic_system_ap... |
#[macro_use]
extern crate log;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
#[cfg(feature = "casting_errors")]
extern crate zmq;
pub type IndyHandle = i32;
#[repr(transparent)]
#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
pub struc... |
#![recursion_limit = "512"]
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{HtmlTextAreaElement, HtmlInputElement};
//use yew::prelude::*;
use biscuit_auth::{
crypto::{KeyPair, PublicKey},
error,
parser::{parse_source, SourceResult},
token::Biscuit,
token::builder,
token::v... |
use crate::ast::{path_to_string, Info, Node, Path, PathRef, Root, Symbol, Visitor};
use crate::ast_node::*;
use crate::cli_options::Options;
use crate::components::{
Call, Definition, HasErrors, HasType, HasValue, InstancesAt, Sequence, SymbolRef, Untyped,
};
use crate::errors::{RequirementError, TError};
use crate... |
pub(super) fn run() -> Result<(), super::Error> {
let input = Input::parse(super::read_input_lines::<String>("day20")?)?;
{
let result = part1(&input);
println!("20a: {}", result);
assert_eq!(result, 1699 * 2137 * 2539 * 2549);
}
{
let result = part2(&input)?;
println!("20b: {}", result);
assert_e... |
use std::collections::HashMap;
const TILE_SIZE: usize = 10;
const SQUARE_SIDE: usize = 12;
const STRIPPED_TILE_SIZE: usize = TILE_SIZE - 2;
const IMAGE_SIZE: usize = SQUARE_SIDE * STRIPPED_TILE_SIZE;
const SEA_MONSTER_ROWS: usize = 3;
const SEA_MONSTER: [&str; SEA_MONSTER_ROWS] = [
" # ",
"# ... |
//! This module provides interface functionalities and manages all the input/output part of the program
use std::string::String;
use std::io::{self, Write};
use reversi::Side;
use reversi::board::{BOARD_SIZE, Coord};
use reversi::game::PlayerAction;
use reversi::turn::{State, Turn};
use {Result, Action, OtherAction};
... |
// Copyright 2021 <NAME>
//! https://adventofcode.com/2021/day/24
fn main() {
let (a, b) = solve(&input());
println!("{}", a);
println!("{}", b);
}
fn input() -> String {
std::fs::read_to_string("input/24.txt").unwrap()
}
type Regs = [isize; 4];
fn regidx(name: &str) -> usize {
let c = name.cha... |
use std::collections::HashMap;
use std::ffi::CString;
use std::ptr;
use libc::*;
use llvm::*;
use llvm::core::*;
use llvm::prelude::*;
use bytecode::*;
use ast::{Type, UnaryOperator, BinaryOperator, ptr_type};
use super::function::gen_function_ptr;
use super::valueref::ValueRef;
use super::context::Context;
use super::... |
//! Travers paths and or mod declaration paths and manifest entry points.
//!
//! Essentially collects all `Chunk`s used for parsing with an associated `Origin`.
use super::*;
use crate::Documentation;
use anyhow::{anyhow, bail, Error, Result};
use log::{debug, trace, warn};
use std::fs;
use std::path::{Path, PathBu... |
use parking_lot::RwLock;
use std::collections::HashMap;
use std::sync::Arc;
use dora_parser::ast;
use dora_parser::interner::Name;
use dora_parser::lexer::position::Position;
use crate::bytecode::{BytecodeFunction, BytecodeType};
use crate::compiler::fct::JitFctId;
use crate::gc::Address;
use crate::ty::{SourceType,... |
//! TODO:
//! ======
//! - (N, 1) Delete HazardList<T> after it's done being used.
//! See hamt.rs for the solution to this.
//! - (D, 3) Write a version of local_delete in Hp::delete_scan()
//! that allows for multiple HazardList<T>'s to exist at
//! once.
//! - This can be solved by making it a hashmap of
... |
use std::collections::HashMap as Map;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt;
use std::str::FromStr;
use crate::did_resolve::{
DIDResolver, DocumentMetadata, ResolutionInputMetadata, ResolutionMetadata, ERROR_INVALID_DID,
ERROR_NOT_FOUND,
};
use crate::error::Error;
use crate::j... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
// Instrumenting the async fn is not as straight forward as expected because `async_trait` rewrites `async fn`
// into a normal fn which returns `Box<impl Future>`, and this stops the macro from distinguishing `async fn` from `fn`.
// The following cod... |
#[cfg(not(feature = "opentelemetry-on"))]
pub use off::*;
#[cfg(feature = "opentelemetry-on")]
pub use on::*;
pub use context_wrap::MsgWrap;
#[allow(missing_docs)]
#[cfg(feature = "channels")]
pub mod channel;
mod context_wrap;
#[cfg(not(feature = "opentelemetry-on"))]
#[allow(missing_docs)]
mod off;
/// Openteleme... |
use sgx_tstd as std;
use std::collections::HashMap;
use std::format;
use std::prelude::v1::*;
use codec::{Decode, Encode};
use derive_more::Display;
use encointer_balances::{BalanceEntry, BalanceType};
use encointer_ceremonies::{MeetupIndexType, ParticipantIndexType};
use encointer_currencies::CurrencyIdentifier;
use ... |
// Copyright 2018-2021 Cargill Incorporated
//
// 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::{
array::TryFromSliceError,
collections::{BTreeSet, HashMap},
error::Error as StdError,
fmt::{self, Debug, Display, Formatter},
iter::FromIterator,
};
use datasize::DataSize;
use hex::FromHexError;
use itertools::Itertools;
#[cfg(test)]
use rand::{Rng, RngCore};
use serde::{Deserialize, Se... |
use std::{ffi::c_void, marker::PhantomData, os::raw::c_int};
use static_assertions::assert_type_eq_all;
use crate::{
rtl,
sys::{self, mbool, mint, MImage_CS_Type::*, MImage_Data_Type::*},
};
/// Native Wolfram [`Image`][ref/Image]<sub>WL</sub> or
/// [`Image3D`][ref/Image3D]<sub>WL</sub>.
///
// TODO: This r... |
// Copyright (c) 2020 Huawei Technologies Co.,Ltd. All rights reserved.
//
// StratoVirt is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWA... |
//! Module to handle WAD files
pub const LINEDEF_FLAG_IMPASSABLE: usize = 0x0001;
pub const LINEDEF_FLAG_TWO_SIDED: usize = 0x0004;
pub const LINEDEF_FLAG_SHOW_MAP: usize = 0x0080;
pub const LINEDEF_FLAG_DONT_SHOW_MAP: usize = 0x0100;
#[derive(Copy, Clone, Debug)]
pub enum Error {
ArrayConvertionFaile... |
use {
super::*,
crate::{
browser::BrowserState,
command::{Command, Sequence},
conf::Conf,
display::{Areas, Screen, W},
errors::ProgramError,
file_sum, git,
launchable::Launchable,
skin::*,
task_sync::{Dam, Either},
verb::Internal,
... |
// Copyright 2021 <NAME>. All rights reserved.
// Use of this source code is governed by an MIT
// licence that can be found in the LICENCE file.
use std::collections::HashMap;
use std::error::Error;
use std::fs;
use std::fs::OpenOptions;
use std::io::Error as IoError;
use std::io::ErrorKind;
use std::io::Write;
use s... |
use std::sync::Arc;
use anyhow::{bail, Result};
use console::style;
use scraper::{Html, Selector};
use uuid::Uuid;
use crate::message::FeroxMessage;
use crate::{
config::OutputLevel,
event_handlers::{Command, Handles},
filters::WildcardFilter,
progress::PROGRESS_PRINTER,
response::FeroxResponse,
... |
#![windows_subsystem = "windows"]
mod dfudev;
mod ui;
mod update;
use eframe::{egui, epi};
use simple_logger::SimpleLogger;
use ui::{device, file};
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
/// Size of the native application window
const WINDOW_SIZE: egui::Vec2 = egui::vec2(750.0, 505.0)... |
#[macro_use]
extern crate clap;
use clap::Arg;
use colored::*;
use console::style;
use specbmc::environment;
use specbmc::error::Result;
use specbmc::ir::{TryTranslateFrom, Validate};
use specbmc::loader;
use specbmc::solver::*;
use specbmc::util::{DumpToFile, RenderGraph};
use specbmc::{cex, hir, lir, mir};
use std::... |
use cgmath::Point2;
use key_names::KeyMappingCode;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::path::{Path, PathBuf};
use std::time::Duration;
use winit::event::{ElementState, ModifiersState, VirtualKeyCode, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop, EventLoopProxy};
use crate::... |
// Third party
use kiss3d::{
camera::Camera,
context::Context,
renderer::Renderer,
resource::{
AllocationType, BufferType, Effect, GPUVec, ShaderAttribute, ShaderUniform, Texture,
},
};
use na::{Matrix4, Point3, Point4};
// Internal
use super::{texture_creation::load_texture, PointRendererI... |
use std::fmt::{Debug, Formatter};
use std::net::Ipv4Addr;
use std::option::Option as StdOption;
use crate::c_like_enum;
use crate::error::Result;
use crate::ipv4::error::Error;
pub mod consts {
pub const VERSION: u8 = 4;
pub const MIN_HEADER_LEN: u8 = 5;
}
c_like_enum!(
/// assigned internet protocol num... |
use num_derive::FromPrimitive;
use crate::attribute::Attribute;
use crate::character::character_common_data::CharacterCommonData;
use crate::character::character_sub_stat::CharacterSubStatFamily;
use crate::character::{CharacterConfig, CharacterName, CharacterStaticData};
use crate::character::skill_config::CharacterSk... |
use crate::metadata::{
header::{CLIHeader, SectionHeader},
token::*,
};
use rustc_hash::FxHashMap;
#[derive(Debug, Clone)]
pub struct CLIInfo {
pub cli_header: CLIHeader,
pub sections: Vec<SectionHeader>,
}
/// #~ Stream
#[derive(Debug, Clone)]
pub struct MetaDataStream {
/// Major version of tabl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.