text stringlengths 3.09k 13.9k |
|---|
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - SPI Control Register 1"]
pub c1: C1,
#[doc = "0x01 - SPI Control Register 2"]
pub c2: C2,
#[doc = "0x02 - SPI Baud Rate Register"]
pub br: BR,
#[doc = "0x03 - SPI Status Register"]
pub s: S,
_reserved4: ... |
/*
* Copyright (c) 2021 gematik GmbH
*
* 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 agr... |
//! These tests are intentionally simple and just test that
//! node types have expected traits e.g. `Clone`, `Serialize` etc.
use maplit::btreemap;
use pretty_assertions::assert_eq;
use serde_json::{json, Result, Value};
use stencila_schema::{
Article, BlockContent, CodeExpression, CreativeWorkAuthors, CreativeWo... |
#![windows_subsystem = "windows"]
use std::{
env::current_exe,
fs::{read_link, File},
io::Write,
mem::size_of,
panic::set_hook,
process::Command,
time::SystemTime,
};
use memmap::MmapOptions;
use zerocopy::LayoutVerified;
#[cfg(windows)]
use winapi::{
shared::windef::HWND,
um::{
... |
// Copyright 2019 The Fuchsia Authors. All right reserved.
// Use of this source code is goverend by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::model::walk_state::WalkStateUnit,
fidl_fuchsia_io::{self as fio},
fidl_fuchsia_io2::{self as fio2},
lazy_static::lazy_static,
... |
use bevy::{
diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin},
prelude::*,
render::primitives::Aabb,
window::PresentMode,
};
use bevy_mod_raycast::{
DefaultPluginState, DefaultRaycastingPlugin, RayCastMesh, RayCastMethod, RayCastSource,
RaycastSystem,
};
// This example will show... |
use std::collections::HashMap;
use std::fs::{create_dir_all, metadata, rename, File, OpenOptions};
use std::io::{prelude::*, BufReader, SeekFrom};
use std::path::Path;
use std::sync::{Arc, Mutex, MutexGuard};
use super::KvsEngine;
use crate::error::{KvsError, Result};
use crate::protocol::{Command, OpType};
const MAX... |
use crate::synchronizer::{BlockStatus, Synchronizer};
use crate::types::HeaderView;
use crate::{
BLOCK_DOWNLOAD_TIMEOUT, BLOCK_DOWNLOAD_WINDOW, MAX_BLOCKS_IN_TRANSIT_PER_PEER,
PER_FETCH_BLOCK_LIMIT,
};
use ckb_core::header::Header;
use ckb_network::PeerIndex;
use ckb_store::ChainStore;
use ckb_util::try_option;... |
mod model;
mod texture;
use crate::{
mesh::Mesh,
mesh_data::MeshData,
mesh_group::MeshGroup,
texture::{ImmutableTexture, Texture},
threads::FILE_THREAD,
};
use atom::AtomSetOnce;
use futures::{future::lazy, task::SpawnExt};
use std::{
collections::HashMap,
ops::Range,
path::{Path, PathBuf},
sync::{Arc, Mutex}... |
use crate::error::*;
use std::convert::TryInto;
use std::str::FromStr;
use nom::
{
character::complete::*,
number::complete::*,
sequence::*,
multi::*,
IResult,
};
/// # Examples
///
/// ```
/// # use adventofcode::solution::{ y2021::d4pt1::Solution, Solution as S };
/// # env_logger::init();
/// let input = "7,... |
use phala_mq::MessageOrigin;
#[cfg(feature = "queue")]
#[test]
fn test_send_message() {
struct TestSigner(Vec<u8>);
impl MessageSigner for TestSigner {
fn sign(&self, _data: &[u8]) -> Vec<u8> {
self.0.clone()
}
}
use phala_mq::{MessageSendQueue, MessageSigner};
let que... |
use geo::algorithm::area::Area;
use geo::*;
use gre::*;
use noise::*;
use prelude::BoundingRect;
use rand::prelude::*;
use svg::node::element::path::Data;
use svg::node::element::Group;
use voronoi::{make_polygons, voronoi, Point};
fn lt(x: f64, a: f64) -> f64 {
if x < a {
1.0
} else {
0.0
... |
use crate::geometry::{Point, Rect};
use ash::version::DeviceV1_0;
use ash::{vk, Device};
use anyhow::Result;
#[allow(unused_imports)]
use log::{debug, error, info, trace, warn};
use crate::app::selection::SelectionBuffer;
use crate::vulkan::{draw_system::nodes::NodeVertices, GfaestusVk};
use super::{ComputeManage... |
// Nรฆยง@@@รรยฉ
// รฆ@@@@@@@@@@@@@@@@@@
// ร@@@@?.?@@@@@@@@@@@@@@@@@@@N
// ยถ@@@@@?^%@@.=@@@@@@@@@@@@@@@@@@@@
// N@@@@@@@?^@@@ยป^@@@@@@@@@@@@@@@@@@@@@@
// @@@@@@@@?^@@@ยป.............?@@@@@@@@@ร
// ร... |
use fnv::FnvHashMap;
use super::fact_base::FactBase;
use super::graph::{Exit, Graph, Label, Language};
use super::lattice::Lattice;
pub struct AnalyzeInstruction<'a, F> {
fact: &'a mut F,
}
impl<'a, F> AnalyzeInstruction<'a, F> {
fn new(fact: &'a mut F) -> Self {
AnalyzeInstruction { fact }
}
... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
use crate::{
fail::Fail,
protocols::{
ip,
ipv4::datagram::{Ipv4Header, Ipv4Protocol2},
},
runtime::RuntimeBuf,
};
use byteorder::{ByteOrder, NetworkEndian};
use std::convert::{TryFrom, TryInto};
//============... |
use crate::prelude::*;
use crate::geometry::bbox::{BBox, PartialBoundingBox};
use crate::geometry::prim::Prim;
use crate::material::Material;
use crate::mat4::{Mat4, Transform};
use crate::raytracer::{Ray, Intersection};
use crate::vec3::Vec3;
#[cfg(test)]
use crate::material::materials::FlatMaterial;
#[allow(dead_co... |
//! Solution to Advent of Code 2019 [Day 14](https://adventofcode.com/2019/day/14).
use itertools::Itertools;
use std::cmp;
use std::collections::HashMap;
fn main() {
let part1 = day14_part1();
println!("part1 = {}", part1);
let part2 = day14_part2();
println!("part2 = {}", part2);
}
fn day14_part1(... |
use std::str::FromStr;
use std::error::Error;
use std::collections::HashSet;
#[derive(Debug, Copy, Clone, PartialEq)]
enum Turn {
Left,
Right,
}
impl FromStr for Turn {
type Err = Box<Error>;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"R" => Turn::Right,
... |
// Logging support
#[macro_use]
extern crate log;
// Config parser (YAML)
extern crate yaml_rust;
// Webhook listener
extern crate hyper;
extern crate rifling;
// Run shell commands
extern crate run_script;
use std::collections::HashMap;
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::io... |
use core::mem;
use redbpf_probes::{bindings::iphdr, bindings::tcphdr, xdp::prelude::*};
#[repr(C)]
#[derive(Debug)]
pub struct TcpSignature {
pub quirks: u32, /* Quirks */
pub opt_eol_pad: u8, /* Amount of padding past EOL */
pub ip_opt_len: u8, /* Length of IP opti... |
//! `PalmTimestamp` type & conversion methods
//!
//! Palm OS has two epochs used for storing time - the "old Palm epoch" (seconds since 1904-01-01
//! 00:00:00), and the standard UNIX epoch (seconds since 1970-01-01 00:00:00). If the "old Palm
//! epoch" is used for storing the time, it is stored as an _unsigned_ 32-b... |
//! Quadtrees and octrees encoded in OpenGL textures.
use anyhow::{Context, Result};
use glium::texture::unsigned_texture2d::UnsignedTexture2d;
use glium::texture::{ClientFormat, RawImage2d};
use itertools::Itertools;
use log::warn;
use palette::{Mix, Pixel, Srgba};
use std::borrow::Cow;
use std::collections::HashMap;... |
use crate::ral;
use core::time::Duration;
/// General purpose timers (GPT)
pub struct GPT {
/// Registers for this GPT instance
registers: ral::gpt::Instance,
}
/// GPT clock divider
///
/// This crystal oscillator is very sensitive. Not all values
/// seem to work. 5 is one of them that does. So is 3. 10 doe... |
use std::collections::VecDeque;
use bstr::ByteVec;
use bv::*;
use gfa::gfa::Orientation;
use handlegraph::handle::{Direction, Handle, NodeId};
use handlegraph::handlegraph::HandleGraph;
use handlegraph::hashgraph::HashGraph;
//use rayon::prelude::*;
//use rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator,... |
//#![deny(missing_docs)]
//#![cfg_attr(all(test, feature = "nightly"), feature(test))]
//#![cfg_attr(all(feature = "nightly"), feature(io))]
//! jed creates Json iterators over instances of io.Read
extern crate rustc_serialize;
use std::io::{ /*Chars,*/ Read };
use std::iter::Iterator;
use rustc_serialize::json::{ J... |
mod cli;
use cli::Cli;
use petname::Petnames;
use std::collections::HashSet;
use std::fmt;
use std::fs;
use std::io;
use std::path;
use std::process;
use rand::seq::IteratorRandom;
use structopt::StructOpt;
fn main() {
let cli = Cli::from_args();
match run(cli) {
Ok(()) | Err(Error::Disconnected) =>... |
// part_two.rs
// Chinese remainder theorem (https://en.wikipedia.org/wiki/Chinese_remainder_theorem)
//
// x โก ai (mod ni)
//
// N = n1 * n2 * n3 * ... * nk
// Nk = N / ni
// Mi * Ni โก 1 (mod ni)
//
// x = Sum(ai * Mi * Ni)
//
fn chinese(rem_mod: &[(usize, usize)]) -> Option<usize> {
// rem_mod = (remainde... |
use std::{
convert::TryInto,
fmt,
str,
};
use anyhow::{Error, Result};
use crate::{
error::LifxError,
util,
};
#[derive(Default)]
pub struct Header {
pub tagged: bool,
pub source: u32,
pub target: u64,
pub res_required: bool,
pub ack_required: bool,
pub sequence: u8,
}
impl... |
use crate::field::{CellPos, Field};
#[derive(Debug, Clone)]
pub struct AStarNode {
pub cell_pos: CellPos,
pub g: i32,
pub h: i32,
pub parent: Option<Box<AStarNode>>,
}
impl AStarNode {
pub fn f_static(g: i32, h: i32) -> i32 {
g + h * 2
}
pub fn f(&self) -> i32 {
AStarNode:... |
// Copyright 2021 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 in ... |
//! # [Day 5: Doesn't He Have Intern-Elves For This?](https://adventofcode.com/2015/day/5)
//! Santa needs help figuring out which strings in his text file are naughty or nice.
//!
//! A nice string is one with all of the following properties:
//!
//! - It contains at least three vowels (`aeiou` only), like `aei`, `x... |
use crate::config::{Icinga2ClientConfig, Stream};
use crate::error::Icinga2CollectorError;
use actix::prelude::*;
use http::header;
use log::*;
use reqwest::Client;
use std::io::{BufRead, BufReader};
use std::{thread, time};
use tornado_collector_common::Collector;
use tornado_collector_jmespath::JMESPathEventCollector... |
#[allow(unused_imports)]
pub(crate) use super::components::auth::casbin::casbin_event_consumer::{
handle_event_for_watcher, launch_casbin_rule_events_consumer,
};
#[allow(unused_imports)]
pub(crate) use super::components::auth::casbin::*;
pub(crate) use super::components::base::SchedulerMetaInfo;
pub(crate) use sup... |
use crate::utils::Answer;
use regex::Regex;
#[derive(Debug)]
enum Op {
On(Cuboid),
Off(Cuboid),
}
impl Op {
fn space(&self) -> Cuboid {
match self {
Op::Off(c) => c.clone(),
Op::On(c) => c.clone(),
}
}
}
#[derive(Debug, Clone)]
struct Cuboid {
min_x: i64,
... |
// use db::DBManager;
use executor::Executor;
use models::{
OutputModel,
// TaskModel
};
#[cfg(feature = "docker")]
use once_cell::sync::Lazy;
use reactor::Reactor;
#[cfg(feature = "server")]
use server::Server;
// use shiplift::Docker;
use std::{sync::Arc};
use tasks::{
// CmdTask,
// DockerImageType,... |
use std::collections::HashMap;
use regex::Regex;
fn part1(input: &str) -> Option<usize> {
let mut num = 0usize;
let required = vec!["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"];
let passports = input.trim().split("\n\n");
for passport in passports {
let data: Vec<_> = passport.split_whites... |
mod ai;
mod components;
mod engine;
mod event_log;
mod geometry;
mod map;
mod systems;
mod tiles;
use crate::ai::{AIComponent, PlayerAI, Swarm};
use crate::components::*;
use crate::engine::*;
use crate::event_log::EventLogRenderer;
use crate::tiles::*;
use quicksilver::{
geom::{Rectangle, Vector},
graphics::{... |
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0.
use crate::local::local_span_stack::{LocalSpanStack, SpanLineHandle, LOCAL_SPAN_STACK};
use crate::util::{CollectToken, RawSpans};
use std::cell::RefCell;
use std::rc::Rc;
use minstant::Instant;
/// A collector to collect [`LocalSpan`].
///
/// [`Lo... |
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::*;
use syn::*;
use syn::spanned::Spanned;
mod attributes;
use attributes::{Attributes, parse_attr_setting_group, AttrSetting, SpanError, AttrResult};
mod actions;
use actions::{Action, WriteInstructions};
mod binwrite_endian;
use proc_macro2::{TokenS... |
//
// Copyright 2022 The Project Oak 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 required by applicable law o... |
extern crate regex;
extern crate reqwest;
use fuzzy_matcher::skim::fuzzy_match;
use regex::Regex;
use rusqlite::types::ToSql;
use rusqlite::{Connection, NO_PARAMS};
use serde::{Deserialize};
use std::cmp::max;
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
u... |
use std::ops::Range;
use cgmath::{Matrix4, Point3, Rad, Vector3, prelude::*};
/// This camera implementation always uses (0, 0, 1) as up-vector. Because the
/// direction vector must never be linear dependent to the up-vector, we have
/// limit the possible values theta can take. This is the "safe zone" that theta
/... |
use super::opus::OpusFrame;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use futures::channel::{mpsc, oneshot};
use futures::future::select;
use futures::pin_mut;
use futures::{SinkExt, StreamExt};
use log::debug;
use std::error::Error;
use std::net::{SocketAddr, ToSocketAddrs};
use std::sync::Arc;
use std:... |
use bus::Bus;
use crossbeam::scope;
use std::io;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{channel, TryRecvError};
use std::thread;
use std::time::Duration;
use super::{CHUNK_SIZE, BUCKET_SIZE};
enum WriteUpdate {
WroteChunk(usize, u64),
Finished(usize),
Erro... |
// Copyright ยฉ 2019 Intel Corporation
//
// 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... |
use signal_hook::consts::SIGWINCH;
use signal_hook::low_level::pipe;
use termion::event::{parse_event, Event, Key, MouseEvent};
use std::fs::File;
use std::io;
use std::io::Read;
use std::os::unix::io::AsRawFd;
use std::os::unix::net::UnixStream;
const POLL_INFINITE_TIMEOUT: i32 = -1;
const SIGWINCH_PIPE_INDEX: usize... |
use std::marker::PhantomData;
use std::fmt;
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use byteorder::{ByteOrder, LittleEndian, BigEndian, NativeEndian};
use uninitialized::uninitialized;
use packed::{Unaligned, Aligned, Packed};
use pod::Pod;
/// A type alias for unaligned little endian primitives
pub typ... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use std::io::{BufRead, BufReader};
use std::path::PathBuf;
use anyhow::{anyhow, Result};
use itertools::Itertools;
use once_cell::sync::OnceCell;
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use crate::process::rstd::StdCommand;
use crate::process::BaseCommand;
/// Unit type wrapper of [`BaseCommand`]... |
// Lua indexes start at 1 for some reason.
// If the config file specifies 60 periods, they will be FULL candles indexed from 1-60.
// Index 0 will be the current period's incomplete candle.
use lua;
use indicators::Indicator;
use tick::Tick;
#[derive(Clone,Copy)]
pub enum ChartPeriod {
M1,
M5,
M15,
M... |
use crate::internal::*;
use tract_core::internal::*;
pub fn expand<E: Expansion>(e: E) -> Box<dyn InferenceOp> {
Box::new(Box::new(e) as Box<dyn Expansion>)
}
pub trait Expansion:
tract_core::dyn_clone::DynClone
+ std::fmt::Debug
+ Send
+ Sync
+ tract_core::downcast_rs::Downcast
+ tract_co... |
use crate::Result;
use std::{any::type_name, marker::PhantomData, ops::Deref};
use anyhow::Context;
use hecs::Entity;
use itertools::Itertools;
use ivy_graphics::{GpuCameraData, Renderer};
use ivy_resources::{Handle, Resources, Storage};
use ivy_vulkan::{
context::SharedVulkanContext,
descriptors::{DescriptorB... |
use cosmwasm_std::{
from_binary, to_binary, Api, BankMsg, Binary, Coin, Context, CosmosMsg, Env, Extern,
HandleResponse, HumanAddr, InitResponse, Querier, StdError, StdResult, Storage, Uint128,
WasmMsg,
};
use crate::msg::{CountResponse, HandleMsg, InitMsg, QueryMsg, Snip20Msg};
use crate::state::{c... |
use mpstthree::binary::struct_trait::{end::End, recv::Recv, send::Send};
use mpstthree::role::broadcast::RoleBroadcast;
use mpstthree::role::end::RoleEnd;
use mpstthree::{
broadcast_cancel, bundle_struct_fork_close_multi, choose_mpst_multi_cancel_to_all,
create_normal_role, create_recv_mpst_session_bundle, crea... |
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
use crate::error::Error;
use crate::error::Result;
use crate::packet::Packet;
use crate::packet::PacketId;
use crate::transport::Transport;
use bytes::{BufMut, Bytes, BytesMut};
use native_tls::TlsConnector;
use std::borrow::Cow;
use std::convert::TryFrom;
use std::str::from_utf8;
use std::sync::{Arc, Mutex, RwLock};
u... |
// Copyright 2018 The Exonum Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
// 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 alloc::collections::hash_map::{Entry, HashMap};
use core::hash::Hash;
/// The result of inserting an element into a [`RefCountedHashMap`].
#[cfg_attr(... |
// Copyright (c) 2015-2019 <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. This file may not be copied, modified, or distributed except
// according to ... |
//! The Bandcamp platform for update checking.
use crate::sources::{CheckForUpdates, SourceUpdate};
use chrono::{DateTime, Local, TimeZone};
use rayon::iter::{IntoParallelIterator, IntoParallelRefMutIterator, ParallelIterator};
use select::document::Document;
use select::predicate::{Attr, Class, Name, Predicate};
use ... |
use pyo3::ffi::{
PyContextVar_Get, PyEval_SetProfile, PyFrameObject, PyUnicode_AsUTF8, Py_tracefunc,
CO_ASYNC_GENERATOR, CO_COROUTINE, CO_ITERABLE_COROUTINE,
};
use pyo3::prelude::*;
use pyo3::wrap_pyfunction;
use pyo3::{AsPyPointer, PyAny, Python};
use std::cell::Cell;
use std::collections::HashMap;
use std::c... |
use super::state::CurationJig;
use components::{
module::_common::thumbnail::{ModuleThumbnail, ThumbnailFallback},
player_popup::{PlayerPopup, PreviewPopupCallbacks},
};
use dominator::{clone, html, with_node, Dom};
use futures_signals::signal::SignalExt;
use shared::domain::jig::JigRating;
use std::rc::Rc;
use... |
use std::collections::BTreeSet;
use std::io::{self, Read};
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
enum Turn {
Left,
Straight,
Right
}
#[derive(Clone, Debug)]
struct Cart {
position: (usize, usize),
direction: (i32, i32),
next_turn: Turn
}
// Returns (carts, track)
fn parse(input: &str) ... |
use crate::extensions::{DetailedCell, DetailedCells};
use crate::utils::remove_item;
use bincode::serialize;
use ckb_indexer::store;
use ckb_types::{core::BlockNumber, packed, prelude::*, H160};
use derive_more::Display;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
#[repr(u8)]
#[der... |
use crate::common::DISABLE_GLOBAL_SEQUENCE_NUMBER;
use crate::util::decode_fixed_uint64;
#[derive(Eq, PartialEq, Clone)]
pub enum CompressionType {
NoCompression = 0x0,
SnappyCompression = 0x1,
ZlibCompression = 0x2,
BZip2Compression = 0x3,
LZ4Compression = 0x4,
LZ4HCCompression = 0x5,
Xpre... |
use crate::change::{OSMObjectChange, OSMObjectChangeType};
use crate::object::*;
use crate::Error;
use crate::Result;
use hashbrown::HashMap;
use std::io::Read;
use std::str::FromStr;
use xml::{attribute::OwnedAttribute, reader::XmlEvent, EventReader};
fn convert_to_map(attributes: Vec<OwnedAttribute>) -> HashMap<Stri... |
use crate::display;
use crate::filesystem;
use crate::flows;
use crate::fzf;
use crate::handler;
use crate::parser;
use crate::structures::cheat::{Suggestion, VariableMap};
use crate::structures::fzf::{Opts as FzfOpts, SuggestionType};
use crate::structures::option;
use crate::structures::{error::command::BashSpawnErro... |
use anyhow::{bail, Context};
use std::fs;
use std::path::Path;
use std::process::Command;
use tempfile::TempDir;
#[derive(serde::Deserialize, serde::Serialize)]
struct Test {
source_filename: String,
commands: Vec<serde_json::Value>,
}
fn run(wast: &Path) -> Result<(), anyhow::Error> {
static INIT_LOGS: s... |
//! Backoff functionality.
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
missing_docs,
clippy::explicit_iter_loop,
clippy::future_not_send,
clippy::use_self,
clippy::clone_on_ref_ptr
)]
us... |
// 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.
//! Typesafe wrappers around the /pkgfs/packages filesystem.
use {
fidl_fuchsia_io::{DirectoryMarker, DirectoryProxy, DirectoryRequestStream},
fuc... |
use algebra::{Field, FromBytesChecked};
use r1cs_core::{ConstraintSynthesizer, ConstraintSystemAbstract, SynthesisError};
struct MySillyCircuit<F: Field> {
a: Option<F>,
b: Option<F>,
}
impl<ConstraintF: Field> ConstraintSynthesizer<ConstraintF> for MySillyCircuit<ConstraintF> {
fn generate_constraints<CS:... |
/*
* Copyright 2018-2020 <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. This file may not be copied, modified, or distributed
* except according ... |
//! Substrate Material
use bumpalo::Bump;
use core::bssrdf::*;
use core::interaction::*;
use core::material::*;
use core::microfacet::TrowbridgeReitzDistribution;
use core::paramset::*;
use core::pbrt::*;
use core::reflection::*;
use core::spectrum::*;
use core::texture::*;
use std::sync::Arc;
use textures::*;
/// Im... |
/*!
Multi Token implementation with JSON serialization.
NOTES:
- The maximum balance value is limited by U128 (2**128 - 1).
- JSON calls should pass U128 as a base-10 string. E.g. "100".
- The contract tracks the change in storage before and after the call. If the storage increases,
the contract requires the ... |
use embedded_hal::blocking::i2c::{Read, Write};
use heapless::Vec;
use crc_all::Crc;
pub enum Command {
StartContinuousMeasurement = 0x0010,
StopContinuousMeasurement = 0x0104,
SetMeasurementInterval = 0x4600,
GetDataReadyStatus = 0x0202,
ReadMeasurement = 0x0300,
S... |
pub mod closures;
pub mod higher_order_functions;
pub mod diverging_functions;
pub mod methods;
pub fn main() {
methods();
closures();
capturing();
closure_as_input_parameters();
}
// ๊ฐ๋ฅํ closure ํ์
์ ๋ค์๊ณผ ๊ฐ๋ค.
// Fn : ํด๋ก์ ์ ์บก์ฒ ๋ณ์๋ฅผ ์ฐธ์กฐ๋ก ํ๋ (&T)
// FnMut : ํด๋ก์ ์ ์บก์ฒ ๋ณ์๋ฅผ ๊ฐ๋ณ ์ฐธ์กฐ๋ก ํ๋(&mut T)
// FnOnce : ํด๋ก์ ์ ์บก์ฒ ๋ณ์... |
use std::ops::{Deref, DerefMut};
use derive_more::Constructor;
use crate::{
math::{Point, Ray, Vector},
util::approx::FLOAT_EPSILON,
Object,
};
/// A trait that objects need to implement if they can be intersected in a
/// scene, returns a list of the intersection points.
pub trait Intersectable {
fn... |
use interface::{DivansResult, StreamMuxer, StreamDemuxer};
use alloc::Allocator;
use super::interface::{
EncoderOrDecoderSpecialization,
CrossCommandState,
BLOCK_TYPE_LITERAL_SWITCH,
};
use ::interface::{
ArithmeticEncoderOrDecoder,
BillingDesignation,
CrossCommandBilling,
BlockSwitch,
L... |
use super::btleplug_internal::{
BtlePlugInternalEventLoop,
DeviceReturnFuture,
DeviceReturnStateShared,
};
use crate::{
core::{
errors::{ButtplugDeviceError, ButtplugError, ButtplugUnknownError},
messages::RawReading,
ButtplugResultFuture,
},
device::{
configuration_manager::{BluetoothLESpec... |
use crate::*;
use os::time::SystemDate;
#[cfg(not(test))]
use std::fs::{
create_dir,
File,
};
use std::panic;
#[cfg(not(test))]
use std::path::{
Path,
PathBuf,
};
#[cfg(not(test))]
use std::io::Write;
use std::sync::Mutex;
/// Level of verbosity in a log
pub enum Verbosity {
Debug,
Info,
Warning,
Error,
}
... |
//! Utilities for converting between Arrow and Postgres formats.
use convergence::protocol::{DataTypeOid, ErrorResponse, FieldDescription, SqlState};
use convergence::protocol_ext::DataRowBatch;
use datafusion::arrow::array::{
BooleanArray, Date32Array, Date64Array, Float16Array, Float32Array, Float64Array, Int16Arra... |
#![allow(non_snake_case)]
//! Julier-Uhlmann 'Unscented' state estimation.
//!
//! A discrete Bayesian estimator that uses the [`KalmanState`] linear representation of the system.
//! The 'Unscented' transform is used for non-linear state predictions and observation.
//!
//! The 'Unscented' transforma interpolates the... |
///! Sqlite implementations
use std::path::Path;
use rusqlite;
use rusqlite::OptionalExtension;
use crate::domain::model;
use crate::domain::model::PkgMeta;
use crate::error;
const IDX_UP_MIGRATION: &'static str = "
BEGIN;
CREATE TABLE IF NOT EXISTS pkg_meta (
id INTEGER NOT NULL PRIMARY KEY,
name TE... |
//! String interning.
//!
//! There are many times where we want to store or compare user-written strings, for instance when
//! working with identifiers (which we do a lot). It should be efficient, i.e. O(1), to duplicate a
//! string and to compare strings for equality.
//!
//! However, the String type is heap-alloca... |
use std::ffi::c_void;
use std::ptr::null_mut;
use crate::common::llmq_type::LLMQType;
/// This types reflected for FFI
#[repr(C)] #[derive(Clone, Copy, Debug)]
pub struct MasternodeList {
pub block_hash: *mut [u8; 32],
pub known_height: u32,
pub masternode_merkle_root: *mut [u8; 32], // nullable
pub qu... |
/*
*
* TORAT (Treasury Office Routing number Analysis Tool)
* Created by <NAME> <<EMAIL>> on June 5th, 2020.
*
*/
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::collections::HashMap;
use std::io::Write;
use std::env;
struct Datum {
routing_number : String,
state : String,
... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
diag,
diagnostics::Diagnostics,
expansion::ast::{ModuleIdent, ModuleIdent_, SpecId},
hlir::ast as H,
parser::ast::{FunctionName, ModuleName, Var},
shared::{unique_map::UniqueMap, AddressBytes, Name},... |
use super::Stanza;
use crate::{FromXmlElement, Jid, Packet, ToXmlElement};
use std::fmt;
use std::io;
use std::str::FromStr;
use uuid::Uuid;
use xmpp_xml::Element;
#[derive(Debug, Clone)]
pub struct GenericIq {
id: String,
iq_type: IqType,
to: Option<Jid>,
from: Option<Jid>,
element: Option<Elemen... |
use std::fs;
use rand_core::OsRng;
use derive_more::Display;
use std::convert::TryFrom;
use argon2::PasswordHasher;
use argon2::PasswordVerifier;
use serde::{Deserialize, Serialize};
use crate::{grpc::api, utils::errors::{ErrorCode, VaultError}};
#[derive(Clone, Copy, Debug, Deserialize, Display, Serialize, PartialEq)... |
#![allow(dead_code)]
extern crate variant_count;
extern crate field_types;
use variant_count::VariantCount;
use field_types::{FieldType, FieldName};
#[derive(FieldType, FieldName)]
#[field_types_derive(VariantCount, Debug, Clone, PartialEq)]
struct Test {
first: i32,
second_field: Option<String>,
#[field... |
/*
* Copyright 2019 The Starlark in Rust Authors.
* 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
*
* https://www.apache.org/lic... |
/*
{
let r; // ---------+-- 'a
// |
{ // |
let x = 5; // -+-- 'b |
r = &x; // | |
} // -+ |
// |
println!("r: {}", r); // ... |
use crate::api::job::JobStatus;
use crate::api::{Job, Provider};
use anyhow::{bail, Result};
use chrono::{DateTime, Local, TimeZone};
use std::convert::TryFrom;
use std::fmt;
use std::fmt::{Display, Formatter};
use std::ops::Sub;
// Compute operation result
pub enum ComputeResults {
NoError = 0,
PowSolutionFou... |
// 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 writi... |
extern crate utils;
use std::env;
use std::error;
use std::fmt;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::str::FromStr;
use std::io::{self, BufReader};
use std::io::prelude::*;
use std::fs::File;
use utils::*;
type Input = Vec<Part>;
#[derive(PartialEq, Eq, Debug, Clone)]
pub enum Signa... |
use crate::GraphicsContext;
use bytemuck::{Pod, Zeroable};
use glam::{IVec2, Mat4, Vec2, Vec3, Vec4};
use std::time::Duration;
use wgpu::util::DeviceExt;
pub struct Camera {
pub pan: Vec2,
pub zoom: f32,
pub pan_speed: f32,
pub zoom_speed: f32,
pub zoom_step: f32,
pub min_zoom: f32,
pub ma... |
use crate::hal::blocking;
use crate::hal::serial;
use crate::target_device::UART;
use embedded_hal::prelude::*;
//use crate::target_device::{UART, USART0, USART1, USART2, USART3};
use crate::gpio::{Pa8, Pa9, PfA};
use crate::target_device::uart::mr::{CHMODE_A, PAR_A};
use crate::time::Hertz;
use core::fmt;
/// UART co... |
#![deny(clippy::all)]
#![allow(clippy::nonstandard_macro_braces)]
#[macro_use]
extern crate napi_derive;
use std::env;
use std::fs;
use std::path;
use std::str;
use std::sync::Arc;
use deno_ast::swc::parser::{Syntax, TsConfig};
use deno_lint::ast_parser::get_default_ts_config;
use deno_lint::linter::LinterBuilder;
u... |
#![no_std]
#![recursion_limit = "1024"]
extern crate embedded_hal;
extern crate bit_field;
pub mod status;
pub mod register;
use embedded_hal::blocking::spi::{Transfer, Write};
use embedded_hal::digital::v2::OutputPin;
use crate::status::{Status, WriteProtection};
use crate::register::{Instruction, Erase};
use bit_f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.