text stringlengths 8 4.13M |
|---|
//! common tools for tree manipulation
pub use super::diagnosis::{TraversalType, TreeBuilder, TreeHandle, T};
pub use super::raw_def::TreeNode;
pub use super::shortcuts;
pub use super::template;
|
use std::io;
use async_std::channel::{unbounded, Receiver, Sender};
use futures::{
executor::ThreadPool,
future::{Future, FutureExt},
pin_mut, select,
};
const INTERNAL_CHANNEL: &str = "Control channel closed, this should never happen.";
/// Added functionality for the `futures::executor::ThreadPool` fu... |
#[allow(dead_code)]
use criterion::Criterion;
mod hashes;
fn main() {
let crit = &mut Criterion::default().configure_from_args();
hashes::group(crit);
crit.final_summary();
}
|
use crate::grid::config::Entity;
/// A trait which is responsible for configuration of a [`Table`].
///
/// [`Table`]: crate::Table
pub trait TableOption<R, D, C> {
/// The function allows modification of records and a grid configuration.
fn change(self, records: &mut R, cfg: &mut C, dimension: &mut D);
/... |
use std::ops::Bound;
use anyhow::Context;
use chrono::Utc;
use tracing::error;
use uuid::Uuid;
use crate::app::api::v1::AppError;
use crate::app::error::ErrorExt;
use crate::app::error::ErrorKind as AppErrorKind;
use crate::app::AppContext;
use crate::clients::event::LockedTypes;
use crate::clients::{
conference:... |
use crypto::buffer::{self, BufferResult, ReadBuffer, WriteBuffer};
use lazy_static::lazy_static;
use rand::Rng;
lazy_static! {
static ref KEY: [u8; 16] = rand::thread_rng().gen();
}
fn main() {
let (block_size, total_size) = detect_block();
let result = detect_bytes(block_size, total_size);
println!("... |
use crate::{
FieldResultExtra,
FileInfo,
FieldInfo,
Result,
MulterError,
Handler,
};
use actix_web::{
http::header::ContentDisposition,
web::block,
};
use futures::future::{LocalBoxFuture, FutureExt, TryFutureExt, try_join};
use log::error;
use rand::{Rng, thread_rng, distributions::Alph... |
use crate::{
scene::{
node::NodeKind,
Scene
},
gui::UserInterface,
math::vec2::Vec2,
resource::{
Resource,
ResourceKind,
model::Model,
ttf::Font,
texture::Texture
},
utils::{
pool::{
Pool,
Handle
... |
//! # AuthN and authZ for site
//!
//! We are not getting fancy here...yet. We are using Google's single sign on OAuth for
//! authentication but we still need a way to protect some endpoints.
//!
//! ## Signing in
//!
//! When the user clicks the Sign in with Google button, the google api.js library will reach out
//... |
use super::*;
use crate::errors::*;
use crate::util::*;
use stun::message::*;
use async_trait::async_trait;
use crc::{Crc, CRC_32_ISCSI};
use std::fmt;
use std::ops::Add;
use std::sync::atomic::{AtomicU16, AtomicU64, AtomicU8, Ordering};
use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tokio... |
use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod test_recent_bh {
use super::*;
pub fn initialize(_ctx: Context<Initialize>) -> ProgramResult {
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize<'info> {
pub recent_blockhashes: Sys... |
// Copyright 2021 Protocol Labs.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, di... |
use lazy_static::lazy_static;
use crate::{cmap::StreamDescription, options::AuthMechanism};
use super::sasl::SaslStart;
lazy_static! {
static ref MECHS: [String; 2] = [
AuthMechanism::ScramSha1.as_str().to_string(),
AuthMechanism::ScramSha256.as_str().to_string()
];
}
#[test]
fn negotiate_bo... |
mod mbc0;
mod mbc1;
mod mbc3;
use std::fs::File;
use std::io::Read;
pub trait Cartridge {
fn read_rom(&self, addr: u16) -> u8;
fn read_ram(&self, addr: u16) -> u8;
fn write_rom(&mut self, addr: u16, value: u8);
fn write_ram(&mut self, addr: u16, value: u8);
}
pub fn new(rom_name: &str) ... |
use super::{chunk_header::*, chunk_type::*, *};
use bytes::{Buf, BufMut, Bytes, BytesMut};
use std::fmt;
///This chunk shall be used by the data sender to inform the data
///receiver to adjust its cumulative received TSN point forward because
///some missing TSNs are associated with data chunks that SHOULD NOT be
///... |
fn main() {
let one_thousand = 1e3;
let one_million = 1e6;
let thirteen_billions_and_half = 13.5e9;
let twelve_millionths = 12e-6;
println!("{}\n{}\n{}\n{}",
one_thousand,
one_million,
thirteen_billions_and_half,
twelve_millionths);
}
|
#[macro_use]
extern crate syn;
extern crate proc_macro;
mod impls;
#[proc_macro_attribute]
pub fn parameterized(
args: ::proc_macro::TokenStream,
input: ::proc_macro::TokenStream,
) -> ::proc_macro::TokenStream {
impl_macro(args, input)
}
fn impl_macro(
args: ::proc_macro::TokenStream,
input: ::p... |
use approx::{abs_diff_eq};
use lazy_static::lazy_static;
use ndarray::{arr2, s, stack, Array2, ArrayView2, Axis};
use rayon::prelude::*;
type M2 = Array2<f64>;
lazy_static! {
static ref LEVEL_26_ANSWER: M2 = arr2(&[
#[allow(clippy::unreadable_literal)]
[0.6106926463383254, -0.7918677236182143, 102... |
#[repr(C)]
struct Eye {
current_facing_dir: Direction
}
impl Eye {
pub fn new(facing_dir: Direction) -> {
Eye {
current_facing_dir = facing_dir
}
}
pub fn turn(&mut self, degrees_to_right: f32) {
self.current_facing_dir = /**/;
unimplemented!();
}
... |
pub mod davidson;
|
use super::{Subsystem, WebsocketSystem};
use crate::error::error_chain_fmt;
use anyhow::Context;
use glob::glob;
use serde::Deserialize;
use std::path::Path;
#[derive(thiserror::Error)]
pub enum PythonRepoError {
#[error("Invalid path: {0:?}")]
InvalidPath(String),
#[error(transparent)]
UnexpectedError... |
//! A thin wrapper around [`text_size`] to add some helper functions and types.
#![deny(clippy::pedantic, missing_debug_implementations, missing_docs, rust_2018_idioms)]
pub use text_size::{TextLen, TextRange, TextSize};
/// A value located in a text file.
#[derive(Debug, Clone, Copy)]
pub struct WithRange<T> {
//... |
use std::error::Error;
use std::fmt::Display;
/// # The error type for encoding
#[derive(Debug)]
pub enum EncodingError {
/// An invalid app segment number has been used
InvalidAppSegment(u8),
/// App segment exceeds maximum allowed data length
AppSegmentTooLarge(usize),
/// Color profile exceeds... |
extern crate getopts;
extern crate termios;
extern crate libc;
extern crate unicode_width;
use std::env;
use std::io;
use getopts::Options;
use input::{InputHandler, PosixInputHandler, DefaultInputHandler};
use input::InputCmd;
use interpreter::Interpreter;
mod parser;
mod ast;
mod errors;
mod interpreter;
mod lexer;... |
// Copyright 2020 The VectorDB Authors.
//
// Code is licensed under Apache License, Version 2.0.
mod tests;
pub mod binary;
pub mod constant;
pub mod expression;
pub mod factory;
pub mod variable;
pub use binary::BinaryExpression;
pub use constant::ConstantExpression;
pub use expression::Expression;
pub use express... |
mod lease_blob_options;
pub use self::lease_blob_options::{LeaseBlobOptions, LEASE_BLOB_OPTIONS_DEFAULT};
mod blob_block_type;
pub use self::blob_block_type::BlobBlockType;
mod block_list_type;
pub use self::block_list_type::BlockListType;
mod blob_block_with_size;
pub use self::blob_block_with_size::BlobBlockWithSize;... |
use actix_web::{middleware::Logger, App, HttpServer};
use dotenv::dotenv;
use octo_budget_api::{config, db::ConnectionPool, redis::Redis, routes::init_routes};
use octo_budget_lib::auth_token::ApiJwtTokenAuthConfig;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
dotenv().expect("Failed to parse .env f... |
/// A struct to wrap any sized type that could be used as a key
pub struct Key<T: Sized>(T);
// Implement From for any Sized type and wrap it in a Key struct
impl<T> From<T> for Key<T> {
fn from(input: T) -> Self {
Key::<T> { 0: input }
}
}
impl Into<Key<String>> for Key<&str> {
fn into(self) -> K... |
#[macro_use]
extern crate serde_derive;
extern crate chrono;
pub mod handle;
pub mod slack;
use chrono::prelude::*;
use rocket::request::FromForm;
#[derive(Deserialize, Debug)]
pub struct SlackEvent {
pub token: String,
pub challenge: Option<String>,
pub event: Option<EventDetails>,
}
#[derive(Deserializ... |
pub mod google_tts;
pub mod models;
|
fn main() {
let pattern = [7, 0, 4, 3, 2, 1];
let len_pattern = pattern.len();
let mut recipies: Vec<usize> = vec![3, 7];
let mut cursor_one = 0;
let mut cursor_two = 1;
let mut check_cursor = 0;
loop {
// part 1
// if recipies.len() > 704321 + 10 {
// println!(... |
#[doc = "Register `DDRCTRL_SCHED1` reader"]
pub type R = crate::R<DDRCTRL_SCHED1_SPEC>;
#[doc = "Register `DDRCTRL_SCHED1` writer"]
pub type W = crate::W<DDRCTRL_SCHED1_SPEC>;
#[doc = "Field `PAGECLOSE_TIMER` reader - PAGECLOSE_TIMER"]
pub type PAGECLOSE_TIMER_R = crate::FieldReader;
#[doc = "Field `PAGECLOSE_TIMER` wr... |
use crate::prelude::*;
pub fn build_dijkstra(starts: &[usize], map: &Map) -> DijkstraMap {
DijkstraMap::new(SCREEN_WIDTH, SCREEN_HEIGHT, starts, map, 1024.0)
}
|
// ===============================================================================
// Authors: AFRL/RQQA
// Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
//
// Copyright (c) 2017 Government of the United State of America, as represented by
// the Secretary of th... |
#[macro_use]
extern crate log;
use std::fs;
use clap::{App, Arg, SubCommand};
use rsocket_rust::prelude::*;
use rsocket_rust::transport::Connection;
use rsocket_rust::utils::EchoRSocket;
use rsocket_rust::Result;
use rsocket_rust_transport_tcp::{
TcpClientTransport, TcpServerTransport, UnixClientTransport, UnixSe... |
/// Sort an array using insertion sort
///
/// # Parameters
///
/// - `arr`: A vector to sort in-place
///
/// # Type parameters
///
/// - `T`: A type that can be checked for equality and ordering e.g. a `i32`, a
/// `u8`, or a `f32`.
///
/// # Undefined Behavior
///
/// Does not work with `String` vectors.
///
/... |
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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>,... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
use reverie::syscalls::Sysno;
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Clone,... |
use core::fmt;
use core::marker::PhantomData;
use conquer_pointer::{MarkedNonNull, MarkedPtr};
use crate::traits::Reclaim;
use crate::{Protected, Shared};
/********** impl Clone ****************************************************************************/
impl<T, R, const N: usize> Clone for Shared<'_, T, R, N> {
... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub mod galleries {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub async fn... |
pub use self::users::*;
mod users; |
#[deriving(Show, FromPrimitive)]
pub enum Color {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Pink = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
LightRed = 12,
LightPink = 13,
Yellow = 14,
White = 15,
}
struct Char {
pub char: u8,... |
use diesel::prelude::*;
use hyper::{Body, Response};
use nails::error::NailsError;
use nails::Preroute;
use serde::Serialize;
use crate::context::AppCtx;
use crate::models::Tag;
#[derive(Debug, Preroute)]
#[nails(path = "/api/tags")]
pub(crate) struct ListTagsRequest;
#[derive(Debug, Serialize)]
pub(crate) struct Li... |
use crate::glsl::Glsl;
use std::{
collections::HashMap,
convert::{TryFrom, TryInto},
};
use syn::{Error, Result, Stmt};
use crate::yasl_expr::YaslExprFunctionScope;
use crate::{yasl_ident::YaslIdent, yasl_item::YaslItem, yasl_type::YaslType};
mod local;
use local::YaslLocal;
#[derive(Debug)]
pub enum YaslStm... |
// This file is part of dpdk. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT. No part of dpdk, including this file, may be copied, modified, propagated, or distributed except accordin... |
use alloc::boxed::Box;
use core::mem::transmute;
use collections::Vec;
use super::c_char;
pub struct CString {
inner: Box<[u8]>
}
impl CString {
pub fn new(bytes: Vec<u8>) -> Result<CString, ()> {
// let bytes = t.into();
match bytes.iter().position(|x| *x == 0) {
Some(i) => Err((... |
// thread 'rustc' panicked at 'not implemented: NonMutatingUse(ShallowBorrow)'
// prusti-interface/src/environment/loops.rs:117:22
fn main() {
loop {
match Some(1) {
Some(c) if c <= 1 => (),
Some(_) => (),
None => (),
}
}
}
|
/// An enum to represent all characters in the HanifiRohingya block.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum HanifiRohingya {
/// \u{10d00}: '𐴀'
LetterA,
/// \u{10d01}: '𐴁'
LetterBa,
/// \u{10d02}: '𐴂'
LetterPa,
/// \u{10d03}: '𐴃'
LetterTa,
/// \u{10d04}: '𐴄... |
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::PyDict;
use pyo3::{wrap_pymodule};
mod macros;
pub(crate) use crate::macros::*;
mod edge_file_writer;
mod from_csv;
mod getters;
mod setters;
mod edge_lists;
mod filters;
mod metrics;
mod node_file_writer;
mod preprocessing;
mod remap;
mod trees;
mod connecte... |
fn decode_boarding_pass(pass: &str) -> (i32, i32) {
// here as a monument to my folly
// let mut row_cur = 0;
// let mut row_gap = 128;
// let mut col_cur = 0;
// let mut col_gap = 8;
// let chars = pass.chars();
// for char in chars {
// match char {
// 'F' => { row_gap ... |
use std::fs::File;
use std::io::Read;
fn main() {
let mut file = File::open("input").unwrap();
let mut buf = String::new();
file.read_to_string(&mut buf).unwrap();
let initial_chars: Vec<char> = buf.lines().next().unwrap().chars().collect();
let mut min = std::i32::MAX;
for (lower, upper) in (... |
use rodio::Source;
use serde::{Deserialize, Serialize};
use std::{
cmp::Ordering,
fs::File,
io::{BufReader, BufWriter, Read, Write},
path::Path,
time::Duration,
};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("io error: {0}")]
IO(#[from] std::io::Error),
#[error("json err... |
use crate::Error;
use common::rsip::{self};
use models::transport::TransportMsg;
//transport processor
#[derive(Debug, Default)]
pub struct Processor;
impl Processor {
pub async fn process_incoming_message(&self, msg: TransportMsg) -> Result<TransportMsg, Error> {
use super::{uac, uas};
let Tran... |
#[macro_export]
macro_rules! uint_from_bytes {
(u32 => $i:expr, $block:expr, $bytes:expr, $from_bytes:ident) => {
$block[$i] = u32::$from_bytes([
$bytes[$i * 4],
$bytes[$i * 4 + 1],
$bytes[$i * 4 + 2],
$bytes[$i * 4 + 3],
]);
};
(u64 => $i:expr... |
mod front_of_house;
mod front_of_house2;
pub use crate::front_of_house::hosting;
pub use crate::front_of_house2::hosting2;
pub fn eat_at_restaurant() {
hosting::add_to_waitlist();
hosting::add_to_waitlist();
hosting::add_to_waitlist();
hosting2::add_to_waitlist();
hosting2::add_to_waitlist();
... |
use super::File;
use crate::command::Command;
use crate::date::Date;
use crate::error::*;
use crate::field::*;
use crate::filter::Filter;
use crate::modification::Modification;
#[derive(Debug, PartialEq)]
enum ArgStage {
Filter,
Command,
Modification,
}
pub enum ArgNext<'a> {
Filter(Filter<'a>),
C... |
extern crate chrono;
extern crate clap;
extern crate rusqlite;
#[macro_use]
extern crate serde_derive;
extern crate serde_rusqlite;
extern crate strum;
#[macro_use]
extern crate strum_macros;
#[macro_use]
extern crate log;
extern crate simplelog;
mod logging;
#[allow(dead_code)]
mod db;
use clap::App;
use db::DataMg... |
use std::io::Read;
fn main() -> Result<(), Box<dyn std::error::Error>> {
if std::env::args().count() != 1 {
println!("compute_class_hash -- reads from stdin, outputs a class hash");
println!(
"the input read from stdin is expected to be a class definition, which is a json blob."
... |
use crate::utils::asserts::meta::assert_meta;
use crate::utils::asserts::transaction::{assert_vote_data, test_vote_array};
use crate::utils::mockito_helpers::{mock_client, mock_http_request};
use serde_json::from_str;
use serde_json::Value;
use std::borrow::Borrow;
#[tokio::test]
async fn test_all() {
let (_mock, ... |
// rust-lang/rust#101913: when you run your program explicitly via `ld.so`,
// `std::env::current_exe` will return the path of *that* program, and not
// the Rust program itself.
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::process::Command;
mod common;
fn main() {
if std::env::var... |
use crate::headers::{HEADER_DATE, HEADER_VERSION};
use crate::resources::permission::AuthorizationToken;
use crate::resources::ResourceType;
use crate::TimeNonce;
use azure_core::{Context, Policy, PolicyResult, Request, Response};
use http::header::AUTHORIZATION;
use http::HeaderValue;
use ring::hmac;
use std::borrow::... |
use crate::bba;
use crate::proof_system::*;
use crate::schnorr;
use algebra::{AffineCurve, FftField, PrimeField};
use array_init::array_init;
use plonk_5_wires_circuits::gate::GateType;
use schnorr::CoordinateCurve;
// c, total value
pub const PUBLIC_INPUT: usize = 2;
// Parameters for the update proof circuit.
#[der... |
use std::collections::HashMap;
use std::io::{self, BufRead};
#[derive(PartialEq, PartialOrd, Eq, Ord, Clone, Debug)]
enum Operation {
Mem {
address: u64,
value: u64,
},
Mask {
and_mask: u64,
or_mask: u64,
mask: String,
},
}
fn parse(s: String) -> Option<Operatio... |
#![allow(non_camel_case_types)]
#[cfg(target_arch = "aarch64")]
use core::arch::aarch64::*;
use core::mem::transmute;
// TODO: 等待 stdarch 项目增加 这个类型。
type poly128_t = u128;
#[inline]
unsafe fn vreinterpretq_u8_p128(a: poly128_t) -> uint8x16_t {
transmute(a)
}
// NOTE: 不同编译器的优化:
// https://gist.github.com/LuoZijun... |
pub mod dict;
pub mod json;
|
#[doc = "Register `COMP4_CSR` reader"]
pub type R = crate::R<COMP4_CSR_SPEC>;
#[doc = "Register `COMP4_CSR` writer"]
pub type W = crate::W<COMP4_CSR_SPEC>;
#[doc = "Field `COMP4EN` reader - Comparator 4 enable"]
pub type COMP4EN_R = crate::BitReader<COMP4EN_A>;
#[doc = "Comparator 4 enable\n\nValue on reset: 0"]
#[deri... |
use std::io::{self};
pub fn readline(mut input: String) -> String {
io::stdin().read_line(&mut input).unwrap();
input
}
pub fn parse_all<T>(s: &str) -> Vec<T>
where
T: std::str::FromStr,
<T as std::str::FromStr>::Err: std::fmt::Debug,
{
let v: Vec<&str> = s.split(" ").collect();
v.into_iter().... |
use reqwest::Certificate;
use std::{fs::File, io::Read, path::Path};
const SERVICE_CA_CERT: &str = "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt";
pub fn add_service_cert(
mut client: reqwest::ClientBuilder,
) -> anyhow::Result<reqwest::ClientBuilder> {
let cert = Path::new(SERVICE_CA_CERT);
... |
use std::ops::{Add, Div, Mul, Neg, Sub};
use crate::prelude::*;
#[derive(Debug, Copy, Clone)]
pub struct Tuple {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}
impl Tuple {
pub const fn new(x: f32, y: f32, z: f32, w: f32) -> Self {
Self { x, y, z, w }
}
pub fn from_point(x: f32... |
#![doc(html_root_url = "https://spetex.github.io/spacesim/")]
//! # Spacesim Library
//! Hobby library for simulating celestial mechanics
pub mod datatypes;
pub mod calculations;
pub mod objects {
use datatypes::Coordinates;
/// Celestial is a generic object for everything that can reside in the space.
pu... |
//! Various utils to implement `fumio` that are not actually specific to it.
#![doc(html_root_url = "https://docs.rs/fumio-utils/0.1.0")]
#![warn(
missing_debug_implementations,
missing_docs,
nonstandard_style,
rust_2018_idioms,
clippy::pedantic,
clippy::nursery,
clippy::cargo,
)]
#![allow(
clippy::module_name... |
use std::error as rust_error;
use std::fmt;
use std::str::Utf8Error;
/// An error type for libpcap operations.
#[derive(Debug)]
pub struct Error {
inner: Inner,
}
#[derive(Debug)]
enum Inner {
Pcap(String),
Utf8(Utf8Error),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Resu... |
/// Disclaimer: The lexer is basically spaghetti. What did you expect?
#[derive(Clone, Debug, PartialEq)]
pub enum Token {
// Words
Select, From, Where, Group, Having, By, Limit,
Distinct,
Order, Asc, Desc,
As, Join, Inner, Outer, Left, Right, On,
Insert, Into, Values, Update, Delete,
Creat... |
use std::{borrow::Cow, collections::HashMap};
use crate::{Program, TacFunc};
use anymap::AnyMap;
pub mod sanity_checker;
/// Represents a single pass inside the compilation pipeline.
///
/// A `Pass` should be constructible from an [`OptimizeEnvironment`], which
/// supplies external data needed for this pass.
#[all... |
use std::process::Command;
use std::process::Stdio;
fn main() {
//let trsh_id = get_random_string("32");
//let trsh_key = get_random_string("32");
//let trsh_iv = get_random_string("8");
let trsh_id = "ohpie2naiwoo1lah6aeteexi5beiRas7";
let trsh_key = "Fahm9Oruet8zahcoFahm9Oruet8zahco";
let trs... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control register"]
pub cr: CR,
#[doc = "0x04 - Configuration register"]
pub cfr: CFR,
#[doc = "0x08 - Status register"]
pub sr: SR,
}
#[doc = "CR (rw) register accessor: Control register\n\nYou can [`read`](crate::g... |
use std::collections::hash_map::Entry as HmEntry;
use std::collections::{btree_map::Entry, BTreeMap, HashMap};
use std::path::{Path, PathBuf};
use failure::{Error, Fail};
use itertools::Itertools;
use morton::interleave_morton;
use rocksdb::{Options, DB};
use smallvec::{smallvec, SmallVec};
use crate::gridstore::comm... |
#[doc = "Register `FMC_CSQISR` reader"]
pub type R = crate::R<FMC_CSQISR_SPEC>;
#[doc = "Register `FMC_CSQISR` writer"]
pub type W = crate::W<FMC_CSQISR_SPEC>;
#[doc = "Field `TCF` reader - TCF"]
pub type TCF_R = crate::BitReader;
#[doc = "Field `TCF` writer - TCF"]
pub type TCF_W<'a, REG, const O: u8> = crate::BitWrit... |
use shorthand::ShortHand;
use std::vec::Vec;
#[derive(ShortHand, Default)]
#[shorthand(enable(collection_magic))]
struct Example {
vec: Vec<&'static str>,
irrelevant_field: usize,
}
fn main() { let _: &mut Example = Example::default().push_vec("value"); }
|
#[doc = "Register `MEMRM` reader"]
pub type R = crate::R<MEMRM_SPEC>;
#[doc = "Register `MEMRM` writer"]
pub type W = crate::W<MEMRM_SPEC>;
#[doc = "Field `MEM_MODE` reader - Memory mapping selection"]
pub type MEM_MODE_R = crate::FieldReader;
#[doc = "Field `MEM_MODE` writer - Memory mapping selection"]
pub type MEM_M... |
//
extern crate rand;
pub mod vec3;
pub mod ray;
pub mod material;
pub mod hitable;
pub mod camera;
use std::io::Write;
use std::fs::File;
use std::path::Path;
use std::f32;
use vec3::*;
use ray::*;
use material::*;
use hitable::*;
use camera::*;
#[allow(dead_code)]
fn random_spheres(world: &mut HitableList, clear:... |
#[macro_export]
macro_rules! lua_multi {
[] => { $crate::LNil };
[$head: expr] => { $crate::LCons($head, $crate::LNil) };
[$head: expr, $($tail: expr), *] => { $crate::LCons($head, lua_multi![$($tail), *]) };
[$head: expr, $($tail: expr), *,] => { $crate::LCons($head, lua_multi![$($tail), *]) };
}
#[ma... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 0x04],
#[doc = "0x04 - RI input capture register"]
pub icr: ICR,
#[doc = "0x08 - RI analog switches control register 1"]
pub ascr1: ASCR1,
#[doc = "0x0c - RI analog switches control register 2"]
pub ascr2: ASCR... |
//! Endpoint types.
//!
//! These types are transparent, short-lived wrappers around `Client`. They avoid having an
//! enormous number of methods on the `Client` itself. They can be created from methods on
//! `Client`, so you generally won't ever need to name them.
//!
//! # Common Parameters
//!
//! These are some c... |
use ansi_term::{ANSIString, ANSIStrings, Colour, Style};
#[cfg(feature = "crossterm")]
use crossterm::{cursor, terminal, ClearType, InputEvent, KeyEvent, RawScreen};
use std::io::Write;
use sublime_fuzzy::best_match;
pub enum SelectionResult {
Selected(String),
Edit(String),
NoSelection,
}
pub fn interact... |
use approx::ApproxEq;
use alga::general::{AbstractMagma, AbstractGroup, AbstractLoop, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Field, Real, Inverse, Multiplicative, Identity};
use alga::linear::{Transformation, ProjectiveTransformation};
use core::{Scalar, ColumnVector};
use core::di... |
//! # 48. 旋转图像
//! https://leetcode-cn.com/problems/rotate-image/
//! 给定一个 n × n 的二维矩阵表示一个图像。
//! 将图像顺时针旋转 90 度。
//! 说明:
//! 你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要使用另一个矩阵来旋转图像。
//! # 解题思路
//! 从外层往内层递归旋转 最外层旋转规律(0<=i<n) [0,i]->[i,n]->[n,n-i]->[n-i,0]->[0,i]
pub struct Solution;
impl Solution {
pub fn rotate(matrix: &mu... |
$NetBSD: patch-vendor_libc-0.2.144_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.1 2023/07/05 20:33:42 he Exp $
Add riscv64.
--- ../vendor/libc-0.2.144/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 1973-11-29 21:33:09.000000000 +0000
+++ ../vendor/libc-0.2.144/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -2807,6 +2807,9 @@ cfg_... |
//! An audio module that enables basic audio output in Amethyst
//!
//! Based on [`rodio`], this crate provides audio output that works out of the box not only
//! on many mainstream platforms, but supports different backends (e.g. Alsa and Jack on Linux).
//!
//! [rodio]: https://docs.rs/rodio/0.14.0/rodio/index.html
... |
/// CreateIssueOption options to create one issue
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct CreateIssueOption {
/// username of assignee
pub assignee: Option<String>,
pub assignees: Option<Vec<String>>,
pub body: Option<String>,
pub closed: Option<bool>,
pub due_date: ... |
//! `const fn` implementation of the SHA-2 family of hash functions.
//!
//! This crate allows you to use the SHA-2 hash functions as constant
//! expressions in Rust. For all other usages, the [`sha2`] crate includes more
//! optimized implementations of these hash functions.
//!
//! [`sha2`]: https://crates.io/crates... |
//! Defines various views to use when creating the layout.
#[macro_use]
mod view_wrapper;
// Essentials components
mod position;
mod view_path;
// Helper bases
mod scroll;
// Views
mod box_view;
mod button;
mod dialog;
mod edit_view;
mod full_view;
mod id_view;
mod key_event_view;
mod linear_layout;
mod menu_popup;... |
use anyhow::{anyhow, Result};
use clap::{ArgMatches, Values};
use rpassword;
use std::path::PathBuf;
use crate::icore::arg::{Arg, OverwriteStrategy, SendArg, RecvArg};
pub fn parse_input(m: &ArgMatches) -> Result<Arg> {
let arg = match (m.occurrences_of("send"), m.occurrences_of("receive")) {
(1, 0) => par... |
//! Module related to the user struct.
use crate::{
auth::Auth,
client::{route::Route, Client},
error::Error,
model::{misc::Fullname, misc::Params, usersubreddit::UserSubreddit},
};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
/// The struct representing a reddi... |
#[doc = "Reader of register SLEEP_EN1"]
pub type R = crate::R<u32, super::SLEEP_EN1>;
#[doc = "Writer for register SLEEP_EN1"]
pub type W = crate::W<u32, super::SLEEP_EN1>;
#[doc = "Register SLEEP_EN1 `reset()`'s with value 0x7fff"]
impl crate::ResetValue for super::SLEEP_EN1 {
type Type = u32;
#[inline(always)... |
use std::error::Error;
use cashier_server::{config::Config, services};
#[actix_rt::main]
async fn main() -> Result<(), Box<dyn Error>> {
env_logger::init();
let config = Config::from_env()?;
match config {
Config::Init(init_config) => services::init::init(&init_config).await?,
Config::Start... |
#[cfg(feature = "libm")]
mod libm_math {
#[inline(always)]
pub(crate) fn abs(f: f64) -> f64 {
libm::fabs(f)
}
#[inline(always)]
pub(crate) fn acos_approx(f: f64) -> f64 {
libm::acos(f.clamp(-1.0, 1.0))
}
#[inline(always)]
pub(crate) fn asin_clamped(f: f64) -> f64 {
... |
pub const HANGEUL_OFFSET: u32 = 0xAC00; // 44032
pub const SYLLABLE_START: u32 = 0xAC00;
pub const SYLLABLE_END: u32 = 0xD7A3;
pub const CHOSEONG_COUNT: u32 = 588;
pub const JUNGSEONG_COUNT: u32 = 28;
pub const JAMO_START: u32 = 0x1100;
pub const JAMO_END: u32 = 0x11FF;
pub const COMPATIBLE_JAMO_START: u32 = 0x3131;... |
extern crate unterflow_protocol;
use std::env;
use std::net::TcpStream;
use unterflow_protocol::{RequestResponseMessage, TransportMessage};
use unterflow_protocol::io::{FromBytes, FromData, ToBytes, ToData};
use unterflow_protocol::message::{CREATE_STATE, TaskEvent};
use unterflow_protocol::sbe::{EventType, ExecuteCom... |
// https://www.jianshu.com/p/be4f12c9ac83
fn main() {
println!("Hello, world!");
}
struct Config {
path: String,
}
impl Config {
fn new(path: String) -> Config {
Config { path }
}
fn get_path(self) -> String {
self.path
}
}
#[cfg(test)]
mod tests {
use super::*;
#[te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.