text stringlengths 8 4.13M |
|---|
use std::collections::HashMap;
use std::cmp;
use errors::*;
pub mod enums;
pub trait Deser
where Self: ::std::marker::Sized
{
fn deser(value: Download) -> Result<Self>;
}
use destiny::{Download, write_body};
use failure::ResultExt;
macro_rules! body_wrapper{
($inner:ident, $outer:ident) => {
#[derive(Deseri... |
pub use runner::{Runner, State};
mod runner;
mod lua_api;
#[allow(unsafe_code)]
mod context_wrap; |
#![feature(test)]
extern crate strobe_rs;
extern crate test;
use test::Bencher;
use strobe_rs::{SecParam, Strobe};
#[bench]
fn simple_bench(b: &mut Bencher) {
let mut s = Strobe::new(b"simplebench", SecParam::B256);
b.iter(|| {
let mut v = [0u8; 256];
s.send_enc(&mut v, false);
s.rec... |
use eyre::Report;
use crate::{commands::fun::BgGameState, Context};
impl Context {
#[cold]
pub async fn stop_all_games(&self) -> usize {
let active_games: Vec<_> = self.bg_games().iter().map(|entry| *entry.key()).collect();
if active_games.is_empty() {
return 0;
}
... |
use tokio;
use tokio::prelude::*;
use failure;
pub(crate) struct Packetizer<S> {}
fn wrap<S>(stream: S) -> Packetizer
where S: AsyncRead + AsyncWrite {
Packetizer {stream}
}
impl<S> Sink for Packetizer<S> {
}
|
// https://www.codewars.com/kata/530265044b7e23379d00076a
type Point = (f32, f32);
// ref: https://rosettacode.org/wiki/Ray-casting_algorithm
fn point_in_poly(poly: &[Point], point: Point) -> bool {
// need to pop the first onto the end
let looped_poly = [poly, &[*poly.first().unwrap()]].concat();
looped_poly.... |
#[doc = "Register `APB1RSTR2` reader"]
pub type R = crate::R<APB1RSTR2_SPEC>;
#[doc = "Register `APB1RSTR2` writer"]
pub type W = crate::W<APB1RSTR2_SPEC>;
#[doc = "Field `LPUART1RST` reader - Low-power UART 1 reset"]
pub type LPUART1RST_R = crate::BitReader;
#[doc = "Field `LPUART1RST` writer - Low-power UART 1 reset"... |
//! # CKB AppConfig
//!
//! Because the limitation of toml library,
//! we must put nested config struct in the tail to make it serializable,
//! details https://docs.rs/toml/0.5.0/toml/ser/index.html
use std::fs;
use std::path::{Path, PathBuf};
use serde_derive::{Deserialize, Serialize};
use ckb_chain_spec::ChainSp... |
use roaster::editor::Editor;
fn main() {
let mut editor = Editor::new();
editor.run();
} |
//! This module contains a [`Disable`] structure which helps to
//! remove an etheir column or row from a [`Table`].
//!
//! # Example
//!
//! ```rust,no_run
//! # use tabled::{Table, settings::{Disable, object::Rows}};
//! # let data: Vec<&'static str> = Vec::new();
//! let table = Table::new(&data).with(Disable::row(... |
use ctrlc;
use dotenv;
use std::env;
use std::error::Error;
use std::fs::OpenOptions;
use std::io::prelude::*;
use std::net::{TcpListener, TcpStream};
use std::process::exit;
use std::sync::{mpsc, Arc, Mutex};
use std::thread::spawn;
mod cgi;
mod filereader;
mod parser;
mod thread_pool;
enum LoggingSignal {
Loggi... |
use amethyst::{
assets::AssetStorage,
audio::{output::Output, Source},
core::transform::Transform,
derive::SystemDesc,
ecs::{Join, Read, ReadExpect, System, SystemData, WriteStorage},
};
use crate::audio::{play_score_sound, Sounds};
use crate::components::ball::{Ball, BALL_VELOCITY_X, BALL_VELOCITY... |
use crate::data::Pair;
use crate::non_empty::NonEmpty;
#[derive(Debug)]
pub enum Error {
Json(serde_json::Error),
#[cfg(not(feature = "minimal"))]
Hyper(hyper::error::Error),
Io(std::io::Error),
Uri(http::uri::InvalidUri),
InvalidResponse(String),
Http(http::Error),
UnsupportedPairs(No... |
use std::collections::HashMap;
use std::ffi::OsString;
use crate::common::context::LaunchType;
use crate::common::{error::Error, Context};
use crate::log::{dev_info, user_warn};
use crate::pam::{CLIConverser, Converser, PamContext, PamError, PamErrorType, PamResult};
use crate::system::term::current_tty_name;
use sup... |
use super::state;
|
use std::{borrow::Cow, cmp::Reverse, fmt::Write};
use hashbrown::HashMap;
use rosu_v2::prelude::{Grade, Team, Username};
use crate::{
commands::osu::{
CommonMap, MatchCompareComparison, MatchCompareScore, ProcessedMatch, UniqueMap,
},
embeds::{Author, EmbedFields, Footer},
util::{
cons... |
#![feature(test)]
/// A command-line interface for the brute-force attack on the Discrete Log Problem
///
/// Compiled against rustc 1.13.0-nightly (497d67d70 2016-09-01)
///
/// Usage: dl-brute-force <p> <g> <pr>
///
extern crate test;
use std::env;
mod lib;
fn main() {
let args: Vec<String> = env::args().colle... |
fn main() {
let s = String::from("hello");
let slice1 = &s[0..2];
let slice2 = &s[..2];
let len = s.len();
let slice3 = &s[3..len];
let slice4 = &s[3..];
let slice5 = &s[0..len];
let slice6 = &s[..];
println!("{:?}", slice1);
println!("{:?}", slice2);
println!("{:?}", sl... |
//! Report panic messages to the host stderr using semihosting
//!
//! This crate contains an implementation of `panic_fmt` that logs panic messages to the host stderr
//! using [`cortex-m-semihosting`]. Before logging the message the panic handler disables (masks)
//! the device specific interrupts. After logging the ... |
$NetBSD: patch-pgx_pgx-pg-sys_build.rs,v 1.2 2023/01/11 03:33:46 tnn Exp $
Fix include directories for bindgen.
--- ../vendor/pgx-pg-sys-0.6.1/build.rs.orig 2006-07-24 01:21:28.000000000 +0000
+++ ../vendor/pgx-pg-sys-0.6.1/build.rs
@@ -562,10 +562,10 @@ struct StructDescriptor<'a> {
fn run_bindgen(pg_config: &PgCon... |
pub mod built_in_command;
pub mod parser;
pub mod process; |
mod gc_work;
mod global;
pub mod mutator;
pub use self::global::MarkSweep;
pub use self::global::MS_CONSTRAINTS;
|
use std::str::FromStr;
use problem::{Problem, solve};
#[derive(Debug)]
enum Token {
Int(u64),
Plus,
Asterisk,
LeftParen,
RightParen,
}
#[derive(Debug)]
enum ParseError {
InvalidChar(char),
}
struct Expression {
tokens: Vec<Token>,
}
enum Operator {
Add,
Mul,
LeftParen,
}
#[d... |
use core::cmp::min;
use core::fmt::Debug;
use std::collections::HashMap;
// TODO: I probably do need to return actions here
// for every time the cursor moves.
pub struct LineIter<'a, Item> {
current_position: usize,
items: &'a [Item],
newline: &'a Item,
}
impl<'a, Item> Iterator for LineIter<'a, Item>
whe... |
extern crate image;
/* catpicture
* @author Joseph Catrambone <jo.jcat@gmail.com>
* Release notes:
* v0.1.0 : First release -- Supports just '#' for output style. Allows -c for full-color mode, -r, -w, -h to change sizes.
* v0.2.0 : Automatically select correct aspect ratio when only -w or -h supplied. Support f... |
#![allow(non_snake_case, non_camel_case_types)]
use libc::c_int;
use crate::channel::ssh_channel;
use crate::session::ssh_session;
use crate::socket_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ssh_connector_struct {
_unused: [u8; 0],
}
pub type ssh_connector = *mut ssh_connector_struct;
pub type ssh... |
use super::{Error, Module, SassFunction};
use crate::css::Value;
use crate::ordermap::OrderMap;
use crate::value::ListSeparator;
/// Create the `sass:map` standard module.
///
/// Should conform to
/// [the specification](https://sass-lang.com/documentation/modules/map).
pub fn create_module() -> Module {
let mut ... |
/*
* Slack Web API
*
* One way to interact with the Slack platform is its HTTP RPC-based Web API, a collection of methods requiring OAuth 2.0-based user, bot, or workspace tokens blessed with related OAuth scopes.
*
* The version of the OpenAPI document: 1.7.0
*
* Generated by: https://openapi-generator.tech
*... |
//! Nodes that cause the execution of tasks.
use crate::{
node::{Node, Tickable},
status::Status,
};
use std::{
sync::{mpsc, mpsc::TryRecvError, Arc},
thread,
};
/// A node that manages the execution of tasks in a separate thread.
///
/// This node will launch the supplied function in a separate thread... |
use quote::quote_spanned;
use syn::parse_quote_spanned;
use syn::spanned::Spanned;
use super::{
DelayType, FlowProperties, FlowPropertyVal, OpInstGenerics, OperatorCategory,
OperatorConstraints, OperatorInstance, WriteContextArgs, RANGE_1,
};
use crate::graph::ops::OperatorWriteOutput;
/// > 1 input stream, 1... |
use crate::matrix::Matrix;
/*
NOTE: this is all very preliminary...
*/
pub struct Layer {
activations: Option<Box<Matrix>>,
delta_activations: Option<Box<Matrix>>,
sums: Option<Box<Matrix>>,
delta_sums: Option<Box<Matrix>>,
weights: Option<Box<Matrix>>,
delta_weights: Option<Box<Ma... |
//! Warning: this example is a lot more advanced than the others.
//!
//! This example shows a possible way to make shred interact with a scripting
//! language.
//!
//! It does that by implementing `DynamicSystemData` and using `MetaTable`.
extern crate shred;
// faster alternative to std's HashMap
use ahash::AHashM... |
use super::*;
pub use crate::mock::{
run_to_block, Currency, Event as TestEvent, ExtBuilder, LBPPallet, Origin, System, Test, ACA, ALICE, BOB, CHARLIE,
DOT, ETH, HDX,
};
use crate::mock::{ACA_DOT_POOL_ID, HDX_DOT_POOL_ID, INITIAL_BALANCE};
use frame_support::{assert_noop, assert_ok};
use sp_runtime::traits::BadOrigin... |
use std::collections::HashSet;
use hydroflow::compiled::pull::HalfMultisetJoinState;
use hydroflow::util::collect_ready;
use hydroflow::{assert_graphvis_snapshots, hydroflow_syntax};
use multiplatform_test::multiplatform_test;
#[multiplatform_test]
pub fn test_persist_basic() {
let (result_send, mut result_recv) ... |
use diesel::pg::PgConnection;
use diesel::r2d2::{Builder, ConnectionManager, Pool};
pub(crate) use super::prelude::{self, *};
pub(crate) type ConnectionPool = Pool<ConnectionManager<PgConnection>>;
#[allow(dead_code)]
pub(crate) fn establish_connection() -> PgConnection {
dotenv().ok();
let database_url = e... |
struct Point {
x: f64,
y: f64,
}
impl Point {
fn origin() -> Point {
Point { x: 0.0, y: 0.0 }
}
fn new(x: f64, y: f64) -> Point {
Point { x: x, y: y }
}
}
struct Rectangle {
p1: Point,
p2: Point,
}
impl Rectangle {
fn area(&self) -> f64 {
let Point { x: x1, y: y1 } = self.p1;
let Po... |
//!
//! # Arrays
//!
//! This module implements fixed-length arrays and utility functions for it.
//!
//! **Note** that all macros starting with an underscore (`_array_base` etc.)
//! are note intended for public use. Unfortunately it's not possible to hide
//! them.
//!
//! To define a new array type with name `State`... |
use std::hash::Hash;
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)]
pub enum Rank {
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
Ace,
}
impl Rank {
pub fn list() -> Vec<Self> {
vec![
Self::Two,... |
use anyhow::{anyhow, bail, Result};
use pasture_core::math::Alignable;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use std::{
collections::HashMap,
convert::TryFrom,
convert::TryInto,
io::{BufRead, Seek, SeekFrom, Write},
};
use super::{read_json_header, write_json_header};
/// ... |
use std::rc::Rc;
use crate::material::{diffuse_light::DiffuseLight, lambertian::Lambertian, Material};
use crate::shape::{
cube::Cube, rotate_y::RotateY, shape_list::ShapeList, translate::Translate, xy_rect::XyRect,
xz_rect::XzRect, yz_rect::YzRect, Shape,
};
use crate::vec3::{Color, Point3, Vec3};
pub fn bui... |
pub mod request;
pub mod response;
#[cfg(test)]
mod tests {
use request::Request;
use response::Response;
#[test]
fn test_req_create() {
let req = Request::new("GET", "/hello", "1.1");
assert_eq!(req.method, String::from("GET"));
assert_eq!(req.target, String::from("/hello"))... |
use std::path::Path;
use image::{Rgb, RgbImage};
use imageproc::drawing::{draw_filled_circle_mut, draw_filled_rect_mut, draw_line_segment_mut, draw_hollow_circle_mut, draw_cross_mut};
use imageproc::rect::Rect;
use crate::config;
use crate::maze::maze_phenotype::MazeCell;
use crate::maze::maze_phenotype::MazePhenotyp... |
#[doc = "Register `SR` reader"]
pub type R = crate::R<SR_SPEC>;
#[doc = "Field `RTT4B` reader - FIFO is ready to transfer four bytes"]
pub type RTT4B_R = crate::BitReader<RTT4B_A>;
#[doc = "FIFO is ready to transfer four bytes\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RTT4B_A {
#[... |
use bevy::prelude::*;
use crate::digger::{Digger, DiggerState};
use crate::map::Map;
use crate::GameState;
pub struct BasePlugin;
#[derive(SystemLabel, Eq, PartialEq, Hash, Clone, Debug)]
pub enum BaseSystemLabels {
CheckPlayerPosition,
}
impl Plugin for BasePlugin {
fn build(&self, app: &mut AppBuilder) {
... |
use bytes::{Buf, BufMut};
use super::{QuicResult, QUIC_VERSION};
use codec::Codec;
#[derive(Clone, Debug, PartialEq)]
pub struct ClientTransportParameters {
pub initial_version: u32,
pub parameters: TransportParameters,
}
impl Default for ClientTransportParameters {
fn default() -> Self {
Self {
... |
use cc;
fn main() {
if std::env::var("TARGET").unwrap() != "armv7-linux-androideabi" {
return;
}
let mut build = cc::Build::new();
build.warnings(false);
build.flag("-Wno-everything");
build.include("inline-hook");
build.file("inline-hook/inlineHook.c");
build.file("inline-hook... |
#[doc = "Register `PRLH` writer"]
pub type W = crate::W<PRLH_SPEC>;
#[doc = "Field `PRLH` writer - RTC Prescaler Load Register High"]
pub type PRLH_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 4, O>;
impl W {
#[doc = "Bits 0:3 - RTC Prescaler Load Register High"]
#[inline(always)]
#[must_use]
p... |
#[doc = "Reader of register SSPPCELLID0"]
pub type R = crate::R<u32, super::SSPPCELLID0>;
#[doc = "Reader of field `SSPPCELLID0`"]
pub type SSPPCELLID0_R = crate::R<u8, u8>;
impl R {
#[doc = "Bits 0:7 - These bits read back as 0x0D"]
#[inline(always)]
pub fn ssppcellid0(&self) -> SSPPCELLID0_R {
SSP... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use cucumber::{after, before, cucumber, Steps, StepsBuilder};
use starcoin_config::NodeConfig;
use starcoin_logger::prelude::*;
use starcoin_node::NodeHandle;
use starcoin_rpc_client::RpcClient;
use starcoin_storage::cache_storage::... |
use std::{
error::Error as StdError,
fmt,
net::{AddrParseError, Ipv4Addr, Ipv6Addr},
str::FromStr,
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Status {
Ok,
Ko,
}
impl fmt::Display for Status {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
... |
extern crate opencv;
extern crate libc;
// use networktables;
use opencv::_unsafe as cv;
fn main() {
unsafe {
let mut img = cv::cvLoadImage(c_str("lena512.bmp"), cv::CV_LOAD_IMAGE_COLOR);
println!("Image: {}", img);
println!("Window: {}", cv::cvNamedWindow(c_str("Example1"), cv::CV_WINDOW_AUTOSI... |
// https://www.codewars.com/kata/55e7280b40e1c4a06d0000aa
extern crate itertools;
use self::itertools::Itertools;
fn choose_best_sum(t: i32, k: i32, ls: &Vec<i32>) -> i32 {
let mut largest = -1;
for cur in ls.iter().combinations(k as usize) {
let sum = cur.iter().map(|x| *x).sum();
if sum == t... |
/**********************************************
> File Name : AuthenticationManager.rs
> Author : lunar
> Email : lunar_ubuntu@qq.com
> Created Time : Sun 13 Feb 2022 06:28:17 PM CST
> Location : Shanghai
> Copyright@ https://github.com/xiaoqixian
********************************************... |
use clap::{Arg, SubCommand};
use super::{config::Config, Command};
pub struct Repo;
impl Command for Repo {
fn info<'a, 'b>() -> clap::App<'a, 'b> {
SubCommand::with_name("repo")
.about("clone command")
.subcommand(SubCmdClone::info())
.subcommand(SubCmdSearch::info())... |
#[doc = "Register `FCR1` writer"]
pub type W = crate::W<FCR1_SPEC>;
#[doc = "Field `TIM2FC` writer - TIM2FC"]
pub type TIM2FC_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `TIM3FC` writer - TIM3FC"]
pub type TIM3FC_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `TIM4FC` ... |
use chore::*;
#[test]
fn general() -> Result<()> {
for (config, expect) in &[
(
Config {
now: chrono::NaiveDate::from_ymd(2001, 2, 3).and_hms(4, 5, 6),
args: vec!["completed".to_owned(), " ".to_owned()],
tasks: Some(
concat!(
... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Context {
ext: Option<ContextExt>,
}
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct ContextExt {}
|
use crate::types::Vec3;
/// A simple structure for storing a force to be applied.
pub struct Force {
/// The force vector.
pub force : Vec3,
/// The position to apply the force at (in world coordinates).
pub position : Vec3,
}
impl Force {
/// Creates a new instance by consuming the given vectors.
pub fn new(fo... |
pub struct Solution {}
mod s0013_roman_to_integer;
mod s0014_longest_common_prefix;
mod s0015_3_sum; |
extern crate dotenv;
use crate::graphql::utils::generate_uuid_from_str;
use crate::graphql::Context;
use crate::models::user::User;
use chrono::*;
use uuid::Uuid;
#[juniper::graphql_object(description = "A user", name = "User", Context = Context)]
impl User {
fn id(&self) -> i32 {
self.id
}
fn uui... |
use crate::bond::deposit_farm_share;
use crate::contract::{handle, init, query};
use crate::mock_querier::{mock_dependencies, WasmMockQuerier};
use crate::state::{pool_info_read, pool_info_store, read_config};
use pylon_token::gov::Cw20HookMsg as PylonGovCw20HookMsg;
use pylon_token::gov::HandleMsg as PylonGovHandleMsg... |
#[macro_use]
extern crate afl;
fn main() {
fuzz!(|data: &[u8]| {
if let Ok(input) = std::str::from_utf8(data) {
let _ = parser::parse(&input);
}
});
}
|
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
extern crate soup;
extern crate url;
use soup::*;
use std::vec::*;
use url::*;
use crate::ingestion_engine::Word;
use crate::ingestion_engine;
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct Page {
last_linker:String,
title:String,
about:String,
url:String,
words:Vec<Word>
}
pub fn... |
#![cfg(target_os = "android")]
#![allow(non_snake_case)]
// pub unsafe extern fn Java_com_parallel_android_ParallelEngine_cancel(_env: JNIEnv, _: JObject) {}
//
// pub unsafe extern fn Java_com_parallel_android_ParallelEngine_isCanceled(_env: JNIEnv, _: JObject) -> jboolean {}
//
// pub unsafe extern fn Java_com_paral... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// SloBulkDeleteResponse : The bulk partial delete service level objective object endpoint response. T... |
#[doc = "Register `ETH_MTLTxQ1ESR` reader"]
pub type R = crate::R<ETH_MTLTX_Q1ESR_SPEC>;
#[doc = "Field `ABS` reader - ABS"]
pub type ABS_R = crate::FieldReader<u32>;
impl R {
#[doc = "Bits 0:23 - ABS"]
#[inline(always)]
pub fn abs(&self) -> ABS_R {
ABS_R::new(self.bits & 0x00ff_ffff)
}
}
#[doc ... |
#[doc = "Register `LUT1005H` reader"]
pub type R = crate::R<LUT1005H_SPEC>;
#[doc = "Register `LUT1005H` writer"]
pub type W = crate::W<LUT1005H_SPEC>;
#[doc = "Field `LO` reader - Line offset"]
pub type LO_R = crate::FieldReader<u32>;
#[doc = "Field `LO` writer - Line offset"]
pub type LO_W<'a, REG, const O: u8> = cra... |
// 2019-01-01
// On veut modifier une variable sans en prendre l'ownership.
fn main() {
// On crée une chaine de caractère s qui est MODIFIABLE (mutable)
let mut s = String::from("Hello");
// On appelle la fonction change()
// On crée une RÉFÉRENCE MODIFIABLE (mutable reference) avec &mut s
chang... |
use alloc::string::String;
use alloc::vec::Vec;
use crate::Client;
use chain::names::AccountName;
use rpc_codegen::Fetch;
use serde::{Deserialize, Serialize};
#[derive(Fetch, Debug, Clone, Serialize)]
#[api(path="v1/chain/get_abi", http_method="POST", returns="GetAbi")]
pub struct GetAbiParams {
account_name: Acco... |
#![allow(unused)]
pub mod fmc;
|
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Default)]
#[serde(default)]
#[serde(deny_unknown_fields)]
pub struct DebugConfig {
/// An array of values that 'time_scale' can have.
/// Debug controls will allow switching between these values,
/// to slow time down or speed it ... |
//! s3du: A tool for informing you of the used space in AWS S3 buckets.
#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![allow(clippy::redundant_field_names)]
use anyhow::Result;
use std::str::FromStr;
use tracing::{
debug,
info,
};
/// Command line parsing.
mod cli;
/// Common types and traits.
mod common;
... |
use super::{parse, Builder, Compiler, GenericResult};
use std::time::Instant;
use std::{fs::File, io::Read};
// load and execute a file into the vm.
pub fn exec_file<'a>(compiler: &mut Compiler<'a>, path: &str) -> GenericResult<()> {
load_file(compiler, path, "main")?;
let mut builder = Builder::new(&compiler.... |
#[doc = "Register `DFSDM_HWCFGR` reader"]
pub type R = crate::R<DFSDM_HWCFGR_SPEC>;
#[doc = "Field `NBT` reader - NBT"]
pub type NBT_R = crate::FieldReader;
#[doc = "Field `NBF` reader - NBF"]
pub type NBF_R = crate::FieldReader;
impl R {
#[doc = "Bits 0:7 - NBT"]
#[inline(always)]
pub fn nbt(&self) -> NBT_... |
#[doc = "Register `AHBSCR` reader"]
pub type R = crate::R<AHBSCR_SPEC>;
#[doc = "Register `AHBSCR` writer"]
pub type W = crate::W<AHBSCR_SPEC>;
#[doc = "Field `CTL` reader - CTL"]
pub type CTL_R = crate::FieldReader;
#[doc = "Field `CTL` writer - CTL"]
pub type CTL_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, ... |
use failure::{err_msg, format_err, Error};
use std::error::Error as OtherError;
use std::sync::RwLock;
use gtk::*;
use ui::image_container::render_image;
use image::Image as MyImage;
use super::dialogs::open_dialog::OpenDialog;
pub fn open (headerbar: &HeaderBar,
image_container: &Image,
cur... |
// The Rust community thinks about tests in terms of
// two main categories: unit tests and integration
// tests. Unit tests are small and more focused,
// testing one module in isolation at a time, and
// can test private interfaces. Integration tests
// are entirely external to your library and use
// your code... |
use std::io::{Result, Write};
use oops::Oops;
use select::document::Document;
use select::predicate::Class;
use stdinix::stdinix;
use ureq;
fn main() -> Result<()> {
stdinix(|buf| {
let body = ureq::get(&buf[..]).call().oops("Failed to get URI")?.into_string()?;
Document::from(&body[..])
... |
import os::getcwd;
import os_fs;
native "rust" mod rustrt {
fn rust_file_is_dir(path: str::sbuf) -> int;
}
fn path_sep() -> str { ret str::from_char(os_fs::path_sep); }
type path = str;
fn dirname(p: path) -> path {
let i: int = str::rindex(p, os_fs::path_sep as u8);
if i == -1 {
i = str::rinde... |
extern "C" {
pub fn doublemunlock(
addr: *const ::std::os::raw::c_void,
size: usize,
) -> ::std::os::raw::c_int;
pub fn doublemap(size: usize) -> *mut ::std::os::raw::c_void;
pub fn pagesize() -> ::std::os::raw::c_int;
}
#[cfg(test)]
mod tests {
use crate::{doublemap, doublemunloc... |
extern crate proc_macro;
extern crate proc_macro2;
extern crate quote;
extern crate syn;
use quote::quote;
use proc_macro::TokenStream;
use proc_macro_hack::proc_macro_hack;
use syn::{Expr, ExprArray, ExprLit, ExprUnary, Lit, parse, UnOp};
#[proc_macro_hack]
pub fn shape(input: TokenStream) -> TokenStream {
let a... |
use syn::{parse_quote, parse_quote_spanned};
use super::{
FlowProperties, FlowPropertyVal, OperatorCategory, OperatorConstraints, WriteContextArgs,
RANGE_0, RANGE_1,
};
use crate::graph::{OpInstGenerics, OperatorInstance};
/// > 2 input streams of type <(K, V1)> and <(K, V2)>, 1 output stream of type <(K, (V1... |
use super::{u256mod, ModulusTrait};
// Substraction
impl<M: ModulusTrait> std::ops::Sub for &u256mod<M> {
type Output = u256mod<M>;
fn sub(self, other: &u256mod<M>) -> u256mod<M> {
let result_value = if self.value >= other.value {
&self.value - &other.value
... |
extern crate rand;
use rand::Rng;
fn main() {
print!("Give number: ");
println!("");
let secret_number = rand::thread_rng().gen_range(1,101);
loop{
let mut guess: String = String::new(); // mut - can change value(mutable for const from c? lol)
// let static_num: u32 = 667; //
// print!("{}\n",... |
use futures_util::{AsyncReadExt, AsyncWriteExt};
use hreq_h1::buf_reader::BufIo;
use hreq_h1::Error;
mod common;
#[async_std::test]
async fn server_request_with_body_clen() -> Result<(), Error> {
let conn = common::run_server(|parts, body, respond, _| async move {
assert_eq!(parts.method, "POST");
... |
extern crate clap;
extern crate toml;
extern crate serde;
extern crate execute;
use clap::
{
Arg,
App,
SubCommand,
AppSettings
};
use serde::
{
Serialize,
Deserialize
};
use std::fmt;
use crate::system::
{
System,
SystemError,
ReadWriteError
};
use crate::system::util::
{
read_... |
// Copyright 2021 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
//! Session types
use crate::context::Pkcs11;
use crate::error::Result;
use crate::mechanism::Mechanism;
use crate::object::{Attribute, AttributeInfo, AttributeType, ObjectHandle};
use cryptoki_sys::*;
use log::error;
use std... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
use crate::{errors::RandomCoinError, Hasher};
use core::{convert::TryInto, marker::PhantomData};
use math::{FieldElement, StarkField};
use... |
use std::collections::HashMap;
use ncurses::*;
macro_rules! register_color {
($name: expr, $foreground: expr, $background: expr, $map: expr, $i: expr) => {
{
$i += 1;
init_pair($i, $foreground, $background);
$map.insert($name, $i);
}
};
}
lazy_static! {
... |
#[derive(Debug, PartialEq, Eq)]
pub struct URI<'a> {
scheme: Scheme,
authority: Option<Authority<'a>>,
host: Host,
port: Option<u16>,
path: Option<Vec<&'a str>>,
query: Option<QueryParams<'a>>,
fragment: Option<&'a str>,
}
#[derive(Debug, PartialEq, Eq)]
pub enum Scheme {
HTTP,
HTTP... |
#![allow(dead_code)]
extern crate graphics;
extern crate opengl_graphics;
extern crate piston_window;
extern crate piston;
extern crate rustc_serialize;
#[cfg(feature = "include_sdl2")]
extern crate sdl2_window;
#[cfg(feature = "include_glfw")]
extern crate glfw_window;
#[cfg(feature = "include_glutin")]
extern crate... |
mod data;
mod endpoints;
mod service;
pub use data::*;
pub use endpoints::*;
pub use service::*;
|
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use sgstorage::generate_random_channel_store;
#[test]
fn test_channel_store_startup() {
let channel_store = generate_random_channel_store();
let startup_info = channel_store.get_startup_info();
assert!(startup_info.is_o... |
#![allow(dead_code)]
mod args;
mod backend;
mod config;
mod net;
mod track;
mod util;
mod web;
mod sim;
mod modules;
mod tui;
mod logger;
use std::io;
use crate::{
args::{Args, Command},
modules::Module,
util::future::abortable::{Aborted, abortable},
};
fn main() -> ! {
let exit_code = match run() {
Ok(_) =>... |
use serde::de;
use serde::ser;
use serde::{Deserialize, Serialize};
use std::borrow::Cow;
use std::cmp::{Eq, PartialEq};
use std::fmt::{self, Formatter};
use std::slice;
/// A message as sent by an user.
#[derive(Clone, Debug)]
pub struct Message<'a>(Contents<'a>);
impl<'a> Message<'a> {
/// Creates a new message... |
use conveyor::ConveyorError;
use std::error::Error;
use std::fmt;
use std::result::Result;
use std::path::PathBuf;
pub type CrawlResult<T> = Result<T, CrawlError>;
#[derive(Debug)]
pub enum CrawlErrorKind {
Unknown,
Conveyor(String),
Error(Box<dyn Error + Send + Sync>),
NotFound(String),
Io(std::i... |
use std::convert::TryInto;
use crate::*;
// Maybe is should be part of Asset ?
const ACCURACCY: u8 = 8;
const ORACLE_OFFSET: u8 = 4;
// Switch to u128? Reduce decimals for tokens ?
// At least rust will error during overflows checkmate Solidity
// USD prices have 8 decimal places
pub fn check_feed_update(
asset... |
use registry_pol::v1::RegistryValueType;
#[test]
fn reg_none() {
assert_eq!(RegistryValueType::parse(RegistryValueType::REG_NONE as u32), Some(RegistryValueType::REG_NONE));
}
#[test]
fn reg_sz() {
assert_eq!(RegistryValueType::parse(RegistryValueType::REG_SZ as u32), Some(RegistryValueType::REG_SZ));
}
#[t... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::bus::SysBus;
use actix::prelude::*;
use anyhow::Result;
use futures::{
channel::{mpsc, oneshot},
FutureExt,
};
use std::fmt::Debug;
use std::marker::PhantomData;
pub mod bus;
#[derive(Debug, Message)]
#[rtype(re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.