text stringlengths 8 4.13M |
|---|
use super::*;
use proptest::strategy::Strategy;
#[test]
fn with_number_atom_reference_function_port_pid_tuple_map_or_list_returns_true() {
run!(
|arc_process| {
(
strategy::term::binary::heap(arc_process.clone()),
strategy::term(arc_process.clone()).prop... |
mod flight_brief_model;
mod live_area_information;
|
pub mod dynamics;
pub mod shapes;
pub mod utils;
|
extern crate getopts;
extern crate url;
extern crate http;
use std::os;
use std::str;
use getopts::{getopts, optflag};
use http::client;
use http::client::response;
use webfinger::WebFinger;
mod webfinger;
static VERSION: &'static str = "alpha";
fn main() {
let argv: Vec<StrBuf> = os::args().iter().map(|x| x.to_s... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub const ANY_CACHE_ENTRY: u32 = 4294967295u32;
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
#[cfg(feature = "Win32_Foundation")]
pub struct APP_CACHE_DOWNLOAD_E... |
{{#ifeq choice_def "Enum"}}!{{value}}{{/ifeq~}}
{{#ifeq choice_def "Integer"}}
{
{{~#each arguments}}
let {{this.[0]}} = {{>set.item_getter this.[1] id=this.[0]}};
{{~/each}}
{{~value}}.complement({{>value_type.univers value_type}})
}
{{~/ifeq~}}
|
use std::fs::File;
use std::io::BufReader;
use std::io::Read;
use regex::Regex;
fn main() {
let file = File::open("input").expect("Failed to read");
let mut buf_reader = BufReader::new(file);
let mut contents = String::new();
buf_reader.read_to_string(&mut contents).expect("Failed to bufferize file")... |
mod block_test;
mod chain_test;
mod digest_test;
mod miner_test;
mod system_test;
mod transaction_test;
mod wallet_test;
|
#![allow(unused_imports)]
use std::path::PathBuf;
use std::collections::HashMap;
use super::wt;
use super::chain::*;
use super::miner::*;
use super::transaction::*;
use super::wallet::*;
pub const START_AMOUNT : f64 = 1_000_000.0;
#[ derive( Clone, Serialize, Deserialize, Debug, PartialEq ) ]
pub struct System
{
... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)]
#[repr(transparent)]... |
// Copyright 2021 Tomba technology web service 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 b... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use std::ops::Deref;
struct Sample<T> {
data: T,
}
impl<T> Deref for Sample<T> {
type Target = T;
fn deref(&self) -> &T {
&self.data
}
}
fn print_int(v: &i32) {
println!("print_int: {}", v);
}
fn main() {
let d = Sample { data: 123 };
assert_eq!(123, *d);
assert_eq!(123, *... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "UI_Notifications_Management")]
pub mod Management;
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :... |
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
fn main() {
let bar: fn(&mut u32) = |_| {};
fn foo(x: Box<dyn Fn(&i32)>) {}
let bar = Box::new(|x: &i32| {}) as Box<dyn Fn(_)>;
foo(bar);
//~^ ERROR E0308
//[nll]~^^ ERROR mismatched types
}
|
#[macro_export]
macro_rules! show_info {
() => (println!());
($($arg:tt)*) => ({
(println!($($arg)*));
});
}
#[macro_export]
macro_rules! show_warn {
($($arg:tt)*) => ({
extern crate colored;
use colored::*;
let prefix = "WARN".yellow();
(println!("{} {}",prefix,... |
// Copyright 2018 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 {
failure::Error,
fidl_fuchsia_bluetooth_control::{ControlMarker, InputCapabilityType, OutputCapabilityType},
fuchsia_component::client::co... |
//! Tests auto-converted from "sass-spec/spec/libsass/base-level-parent/nested"
#[allow(unused)]
use super::rsass;
#[allow(unused)]
use rsass::precision;
/// From "sass-spec/spec/libsass/base-level-parent/nested/at-root-alone"
#[test]
fn at_root_alone() {
assert_eq!(
rsass(
"test {\r\n @at-roo... |
use chrono::{NaiveDate, NaiveDateTime};
use super::yaml_rolling_stocks::YamlRollingStock;
use crate::domain::{
catalog::{
brands::Brand,
catalog_items::{CatalogItem, DeliveryDate, ItemNumber, PowerMethod},
rolling_stocks::RollingStock,
scales::Scale,
},
collecting::{
... |
use crate::compiling::v1::assemble::prelude::*;
/// Compile an `.await` expression.
impl Assemble for ast::ExprAssign {
fn assemble(&self, c: &mut Compiler<'_>, needs: Needs) -> CompileResult<Asm> {
let span = self.span();
log::trace!("ExprAssign => {:?}", c.source.source(span));
let suppo... |
use crate::account::*;
use crate::asset::*;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use borsh::{BorshDeserialize, BorshSerialize};
#[derive(PartialEq, Eq, Serialize, Deserialize, BorshDeserialize, BorshSerialize)]
pub struct Rate {
pub credit: HashMap<Asset, Quantity>,
pub debit: Ha... |
#[macro_use]
extern crate rental;
pub struct Foo<T: 'static> {
t: T,
}
impl<T: 'static> Foo<T> {
fn try_borrow(&self) -> Result<&T, ()> { Ok(&self.t) }
fn fail_borrow(&self) -> Result<&T, ()> { Err(()) }
}
rental! {
mod rentals {
type FooAlias<T> = super::Foo<T>;
#[rental]
pub struct SimpleRef<T: 'stati... |
use beer_recipe::beerxml_conv::BeerXmlSrc;
use beer_recipe::bryggio;
use std::f32;
use std::fs;
use std::io::prelude::*;
use std::path;
fn main() {
let recipe_files = list_recipes("src/bin/recipes");
let recipes = recipe_files
.iter()
.flat_map(read_file_to_string)
.flat_map(|raw| serd... |
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::mouse::MouseButton;
use std::time::Duration;
use sdl2::render::{WindowCanvas, Texture};
use sdl2::EventPump;
use crate::Constants;
use crate::Grid;
use crate::input;
use sdl2::event::EventType::MouseButtonUp;
pub fn run_game_loop(... |
extern crate sdl2;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use sdl2::image::InitFlag;
use sdl2::image::LoadTexture;
fn main() {
let sdl_ctx = sdl2::init().unwrap();
let video_subsys = sdl_ctx.video().unwrap();
let window = video_subsys
.window("Hello SDL", 80... |
use ic_cdk::export::candid::{CandidType, Deserialize, Principal};
use ic_event_hub_macros::Event;
use crate::types::{Controllers, Payload, TokenInfo};
#[derive(Event, CandidType, Deserialize)]
pub struct TokenMoveEvent {
#[topic]
pub from: Option<Principal>,
#[topic]
pub to: Option<Principal>,
pub... |
use std::ptr::{null, null_mut};
use winapi::shared::{dxgi, dxgi1_2, windef};
use winapi::um::d3d11;
use winapi::Interface;
use wio::com::ComPtr;
use crate::d3d11::{D3D11Device, D3D11Texture2D};
use crate::util::{wrap, wrap_unit, Error};
pub struct DXGIFactory2(ComPtr<dxgi1_2::IDXGIFactory2>);
pub struct DXGISwapCha... |
use crate::axis_measure::{AxisMeasure, AxisPair, TableAxis, VisOffset};
use crate::cells::CellsDelegate;
use crate::headings::HeadersFromData;
use crate::selection::CellDemap;
use crate::{
CellRender, Cells, Headings, IndexedData, IndexedItems, LogIdx, Remap, RemapSpec, TableConfig,
TableSelection, VisIdx,
};
u... |
/*
* @lc app=leetcode.cn id=64 lang=rust
*
* [64] 最小路径和
*
* https://leetcode-cn.com/problems/minimum-path-sum/description/
*
* algorithms
* Medium (58.95%)
* Total Accepted: 11.5K
* Total Submissions: 19.4K
* Testcase Example: '[[1,3,1],[1,5,1],[4,2,1]]'
*
* 给定一个包含非负整数的 m x n 网格,请找出一条从左上角到右下角的路径,使得路径上的... |
use hyper::error::Error as HyperError;
use url::ParseError as UrlParseError;
use serde_json::Error as JsonError;
#[derive(Debug)]
pub enum Error {
Error(String),
HyperError(HyperError),
JsonError(JsonError),
UrlParseError(UrlParseError),
}
impl From<HyperError> for Error {
fn from(error: HyperErro... |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::CONFIG {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mu... |
use h3ron::H3Cell;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use h3ron_polars::frame::H3DataFrame;
use itertools::Itertools;
use tokio::task::spawn_blocking;
use tracing::{debug, debug_span, error, trace_span, Instrument};
use ukis_clickhouse_arrow_grpc::{ArrowInterface, QueryInfo};
use crate::clic... |
pub struct Solution;
impl Solution {
pub fn is_power_of_three(n: i32) -> bool {
n > 0 && 1162261467 % n == 0
}
}
#[test]
fn test0326() {
fn case(n: i32, want: bool) {
let got = Solution::is_power_of_three(n);
assert_eq!(got, want);
}
case(27, true);
case(0, false);
... |
//!
//! This crates allows deriving `DescriptorSetLayout` and `PipelineLayout`
//!
//!
//!
//!
//!
#![forbid(overflowing_literals)]
#![deny(missing_copy_implementations)]
#![deny(missing_debug_implementations)]
// #![deny(missing_docs)] // Broken.
#![deny(intra_doc_link_resolution_failure)]
#![deny(path_statements)]
#... |
use cw::{BLOCK, Crosswords, Dir, Point, Range};
fn turn(point: Point) -> Point {
Point {
x: -point.y,
y: point.x,
}
}
/// An iterator of all pairs of empty and filled cells at the boundary of the given cluster.
/// It can be given an additional range that it will consider filled with letters.
... |
use arangors::connection::role::Normal;
use arangors::ClientError;
use mobc::{async_trait, Manager};
#[cfg(feature = "reqwest")]
use arangors::client::reqwest::ReqwestClient;
#[cfg(feature = "surf")]
use arangors::client::surf::SurfClient;
#[derive(Clone, Debug)]
pub struct ArangoDBConnectionManager {
url: String... |
use mila::{BinArchiveReader, BinArchiveWriter};
type Result<T> = std::result::Result<T, mila::ArchiveError>;
pub struct FE14SkillView {
address: usize,
pub seid: String,
pub name: Option<String>,
pub description: Option<String>,
pub effect: Option<String>,
pub id: u16,
pub sort_order: i16,... |
#![deny(rustdoc::broken_intra_doc_links, rustdoc::bare_urls, rust_2018_idioms)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
clippy::explicit_iter_loop,
// See https://github.com/influxdata/influxdb_iox/pull/1671
clippy::future_not_send,
clippy::use_self,
clippy::clo... |
use actix_web::{
web::{block, Data, Json},
Result,
};
use serde::{Deserialize, Serialize};
use db::{
get_conn,
models::{Game, GameQuestion},
PgPool,
};
use errors::Error;
#[derive(Clone, Deserialize, Serialize)]
pub struct CreateGameRequest {
question_ids: Vec<i32>,
}
fn create_db_records(poo... |
use container::Container;
/// A TOML document.
///
/// This is the container that holds the contents of a TOML file.
#[derive(Debug, PartialEq)]
pub struct TOMLDocument<'a>(pub Container<'a>);
impl<'a> TOMLDocument<'a> {
/// Return the string reprentation of a `TOMLDocument`.
pub fn as_string(&self) -> String... |
fn main() {
println!("sample");
}
|
// 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 ... |
pub type HabitId = u32;
|
use std::io::Error;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
pub fn block_until_user_exit() -> Result<(), Error> {
let term = Arc::new(AtomicBool::new(false));
signal_hook::flag::register(signal_hook::SIGINT, Arc::clone(&term))?;
signal_hook::flag::register(signal_hook::SIGTERM, A... |
use std::fmt;
use std::io::prelude::*;
use std::net::TcpStream;
use std::path::{Path, PathBuf, Component};
use http::headers::Headers;
/// HTTP request message
#[derive(Clone)]
pub struct Request {
/// The Method token indicates the method to be performed on the
/// resource identified by the Request-URI. The... |
mod common;
use common::{deduce_falsity, deduce_truth};
use rustollens::boolean::{False, True};
use rustollens::equality::Eql;
#[test]
fn equality_holds_for_all_permutations_of_booleans() {
deduce_truth::<Eql<False, False>>();
deduce_falsity::<Eql<False, True>>();
deduce_falsity::<Eql<True, False>>();
... |
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct RawSpan {
start: u32,
end: u32,
}
impl RawSpan {
pub const fn new(start: u32, end: u32) -> Self {
Self { start, end }
}
pub const fn start(&self) -> u32 {
self.start
}
pub const fn end(&self) -> u32 {
se... |
use bitflags::bitflags;
use otspec::types::*;
use otspec_macros::tables;
use serde::{Deserialize, Serialize};
tables!(
GaspRecord {
uint16 rangeMaxPPEM
RangeGaspBehaviorFlags rangeGaspBehavior
}
gasp {
uint16 version
Counted(GaspRecord) gaspRanges
}
);
bitflags! {
#[derive(Serialize, Deserialize)... |
use crate::erts::message::{Message, MessageAdapter, MessageData};
use intrusive_collections::linked_list::Cursor;
use intrusive_collections::{LinkedList, UnsafeRef};
use liblumen_arena::TypedArena;
pub struct Mailbox {
len: usize,
messages: LinkedList<MessageAdapter>,
storage: TypedArena<Message>,
}
impl... |
use bit_vec::BitVec;
use crate::executor::EXECUTOR;
/// The set of executor threads that a task can be scheduled to.
#[derive(Debug, Clone, PartialEq)]
pub struct Affinity {
bits: BitVec<u32>,
}
impl Affinity {
/// The max number of executor threads in a set.
pub fn max_threads() -> usize {
EXECU... |
use super::{encode_event, encoding::EncodingConfig, Encoding, SinkBuildError, StreamSink};
use crate::{
dns::{Resolver, ResolverFuture},
sinks::{Healthcheck, RouterSink},
topology::config::SinkContext,
};
use bytes::Bytes;
use futures01::{future, stream::iter_ok, Async, AsyncSink, Future, Poll, Sink, StartS... |
use akari::{
config::{Config, GameConfig},
environment::WorldData,
init,
save::SaveData,
GlobalState,
};
fn main() -> Result<(), crow::Error> {
pretty_env_logger::formatted_timed_builder()
.filter_level(log::LevelFilter::max())
.init();
#[cfg(feature = "profiler")]
thre... |
use serde::Deserialize;
use structopt::StructOpt;
fn main() {
let args = Cli::from_args();
match get_zip_data(&args.country, &args.zipcode) {
Err(why) => panic!("{:?}", why),
Ok(value) => {
println!("{}, {}", value.country, value.places[0].place_name);
}
}
}
fn get_zip... |
use async_trait::async_trait;
use crate::errors::CheckedError;
#[async_trait]
pub trait PayloadRetriever<T> {
type Message;
type Error: CheckedError;
async fn retrieve_event(&mut self, msg: &Self::Message) -> Result<Option<T>, Self::Error>;
}
|
table! {
channels (id) {
id -> Int4,
creator -> Varchar,
member -> Varchar,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
table! {
messages (id) {
id -> Int4,
channel_id -> Int4,
message -> Text,
nonce -> Varchar,
creat... |
use crate::base::data::constants::{
TX_ACCOUNT,
TX_SIGNING_PUB_KEY,
TX_FEE,
TX_AMOUNT,
TX_SEQUENCE,
TX_TRANSACTION_TYPE,
TX_FLAGS,
TX_RATE_DEN,
TX_RATE_NUM,
TX_FEE_ACCOUNT,
};
use std::rc::Rc;
use crate::base::serialize::signed_obj::*;
use crate::wallet::keypair::Keypair;
... |
mod connection;
mod function;
mod functions;
mod network;
mod node;
mod port;
mod render_context;
pub use crate::connection::Connection;
pub use crate::function::Function;
pub use crate::functions::*;
pub use crate::network::Network;
pub use crate::node::Node;
pub use crate::port::{Port, PortDirection, PortKind, PortS... |
/*
* @lc app=leetcode.cn id=1104 lang=rust
*
* [1104] 二叉树寻路
*
* https://leetcode-cn.com/problems/path-in-zigzag-labelled-binary-tree/description/
*
* algorithms
* Medium (66.13%)
* Likes: 18
* Dislikes: 0
* Total Accepted: 2.5K
* Total Submissions: 3.8K
* Testcase Example: '14'
*
* 在一棵无限的二叉树上,每个节点... |
extern crate piston;
extern crate graphics;
extern crate glutin_window;
extern crate opengl_graphics;
extern crate rand;
use piston::window::WindowSettings;
use piston::event_loop::*;
use piston::input::*;
use glutin_window::GlutinWindow;
use opengl_graphics::{ GlGraphics, OpenGL };
use std::collections::LinkedList;
u... |
pub(crate) mod crypto;
pub(crate) mod forward;
pub(crate) mod request;
pub use self::crypto::crypto_test;
pub use self::request::{ForwordRequest, _json_test}; //export
pub trait CheckNull {
fn check_null(&self, key: &str) -> bool;
}
pub trait CookieString {
fn as_cookie_string(&self) -> String;
}
|
use crate::common::ColorLegend;
use crate::helpers::{rotating_color, ColorScheme, ID};
use crate::render::area::DrawArea;
use crate::render::building::DrawBuilding;
use crate::render::bus_stop::DrawBusStop;
use crate::render::extra_shape::{DrawExtraShape, ExtraShapeID};
use crate::render::intersection::DrawIntersection... |
#[doc = "Reader of register INT"]
pub type R = crate::R<u32, super::INT>;
#[doc = "Interrupt Identifier\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u16)]
pub enum INTID_A {
#[doc = "0: No interrupt pending"]
NONE = 0,
#[doc = "32768: Status Interrupt"]
STATUS = 32768,
}
impl F... |
// Kernel File System
use crate::serial_log;
// Holds all the meta data about a drive
pub struct MetaBlock {
pub free_space: u64, // Free drive space left in bytes
pub used_space: u64,
}
fn get_metadata() -> MetaBlock {
let meta_data = MetaBlock {
free_space: 10,
used_space: 10,
};
... |
use std::fs::File;
use std::io::Read;
#[derive(Debug, PartialEq)]
pub struct Image {
height: usize,
width: usize,
layers: Vec<Layer>,
}
impl Image {
pub fn checksum(&self) -> usize {
// Note: If this was production code I would need to check that layers has > 0 elements and
// return ... |
use crate::hittable::{HitRecord, Hittable};
use crate::material::Material;
use crate::ray::Ray;
use crate::vec3::Vec3;
pub struct Sphere<M: Material> {
pub center: Vec3,
pub radius: f64,
pub material: M,
}
impl<M: Material> Hittable for Sphere<M> {
fn hit(&self, r: &Ray, t_min: f64, t_max: f64) -> Opt... |
pub mod ppu;
pub mod pallette;
|
use influxdb_iox_client::connection::Connection;
use crate::commands::namespace::Result;
/// Update the specified namespace's data retention period
#[derive(Debug, clap::Parser)]
pub struct Config {
/// The namespace to update the retention period for
#[clap(action)]
namespace: String,
/// Num of hou... |
// Copyright 2023 Datafuse Labs.
//
// 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 ... |
pub use self::{body::*, error::*, expression::*, id::*};
use crate::{
id::IdGenerator,
impl_debug_via_richir, impl_display_via_richir,
rich_ir::{RichIrBuilder, ToRichIr},
};
mod body;
mod error;
mod expression;
mod id;
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct Mir {
pub id_generator: IdGenerato... |
// Creates a simple layer of neurons, with 4 inputs.
// Associated YT NNFS tutorial: https://www.youtube.com/watch?v=lGLto9Xd7bU
fn main() {
let inputs = vec![1.0, 2.0, 3.0, 2.5];
let weights1 = vec![0.2, 0.8, -0.5, 1.0];
let weights2 = vec![0.5, -0.91, 0.26, -0.5];
let weights3 = vec![-0.26, -0.27, 0... |
use std::{sync::Arc, time::{SystemTime, UNIX_EPOCH}};
use futures_util::{SinkExt, StreamExt, stream::{SplitSink, SplitStream}};
use serde_json::json;
use tokio::{net::TcpStream, spawn, sync::Mutex};
use tokio_tungstenite::{MaybeTlsStream, WebSocketStream, connect_async, tungstenite::Message};
use crate::{clien... |
pub use self::device::AvCaptureDeviceInput;
pub use self::port::AvCaptureInputPort;
mod device;
mod port;
use objc_foundation::NSObject;
/// `AVCaptureInput` is an abstract base-class describing an input data source to
/// an `AVCaptureSession` object.
pub trait AvCaptureInput {
fn ports(&self) -> &Vec<Box<AvCapt... |
//! Launching and communication with the subprocess
use super::{
de::{ChildResponse, OutputValue, RefinedChildResponse, Status},
ser::{ChildCommand, CommonProperties},
CallFailure, Command, SharedReceiver, SubProcessEvent, SubprocessError, SubprocessExitReason,
};
use anyhow::Context;
use std::path::PathBu... |
use alloc::string::ToString;
use alloc::collections::btree_set::BTreeSet;
use alloc::vec::Vec;
use std::fs;
use std::fs::File;
use libc::*;
use super::super::super::qlib::common::*;
use super::super::super::qlib::linux_def::*;
use super::super::super::qlib::path::*;
use super::super::super::qlib::auth::cap_set::*;
use... |
#[doc = "Reader of register CFGR3"]
pub type R = crate::R<u32, super::CFGR3>;
#[doc = "Writer for register CFGR3"]
pub type W = crate::W<u32, super::CFGR3>;
#[doc = "Register CFGR3 `reset()`'s with value 0"]
impl crate::ResetValue for super::CFGR3 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::cli_state::CliState;
use crate::StarcoinOpt;
use anyhow::Result;
use scmd::{CommandAction, ExecContext};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "sign_txn")]
pub struct SignTxnOpt {}
pub... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::Result;
use futures_channel::mpsc;
use starcoin_crypto::hash::HashValue;
use starcoin_types::{transaction, transaction::SignedUserTransaction};
use std::sync::Arc;
#[async_trait::async_trait]
pub trait TxPoolAsyncServic... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct CoreIncrementalInkStroke(pub ::windows::core::... |
use proconio::input;
fn main() {
input! {
n: usize,
a: u32,
b: u32,
c: [u32; n],
};
let ans = c.iter().position(|&c| c == a + b).unwrap();
println!("{}", ans + 1);
}
|
use crate::widgets::{Menu, Position};
use crate::{hotkey, text, Canvas, Event, InputResult, Key, Line, ScreenPt, Text};
use std::collections::{BTreeMap, BTreeSet, HashMap};
// As we check for user input, record the input and the thing that would happen. This will let us
// build up some kind of OSD of possible actions... |
pub mod renderer;
pub mod viewport;
pub mod camera; |
#[cfg(test)]
mod me_tests {
use log::LevelFilter;
use rraw::auth::{CodeAuthenticator, PasswordAuthenticator, TokenAuthenticator};
use rraw::message::WhereMessage;
use rraw::Client;
fn init() {
if let Err(error) = env_logger::builder()
.is_test(true)
.filter_level(Lev... |
// Copyright 2017 CoreOS, Inc.
//
// 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 rustbox;
use rustbox::{Color, RustBox};
use std::sync::{Arc, Mutex};
use std::{thread, time};
/*
█▒
*/
fn print_whitekeys(rustbox: &Arc<Mutex<RustBox>>) {
for y in 0..16 {
// Last border is lonely
rustbox.lock().unwrap().print(156, y, rustbox::RB_BOLD, Color::Black, Color::White, "|"... |
extern crate hello_server;
use hello_server::ThreadPool;
use hello_server::html_builder::Builder;
use hello_server::html_builder::*;
extern crate chrono;
use chrono::prelude::Local;
//use std::fs;
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
use std::process::Command;
fn main() {
... |
// The MIT License (MIT)
//
// Copyright (c) 2015 FaultyRAM
//
// 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,... |
//use proconio::{input, fastout};
use proconio::input;
use itertools::*;
use std::collections::HashMap;
const M: u128 = 998244353;
//#[fastout]
fn main() {
input! {
n: usize,
s: u128,
mut a: [u128; n],
}
let mut dp = HashMap::new();
let mut r = 0;
for e in 0..n {
i... |
use std::mem;
fn main() {
let a: bool;
let a = a == true;
println!("{}", mem::size_of_val(&a));
}
|
use duct::cmd;
fn main() {
let stdout = cmd!("echo", "hello", "world").read().unwrap();
print!("{}\n", stdout)
}
|
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader, Error};
fn count_plz(s: String) -> usize {
let bytes = s.as_bytes();
(b'a'..=b'z')
.filter(|c| bytes.contains(c))
.collect::<Vec<u8>>()
.len()
}
fn solution_1() -> Result<(), Error> {
let file = Fil... |
use clap::{App, Arg};
pub fn build() -> App<'static, 'static> {
App::new("local")
.version("version")
.about("about")
.arg(Arg::with_name("FILE").multiple(true).default_value("."))
.arg(
Arg::with_name("all")
.short("a")
.overrides_with("almost-all")
.long("al... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::DCGCI2C {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, ... |
use reqwest::{header, Client};
use std::fmt;
use std::fs;
use std::path::Path;
#[derive(Clone)]
pub struct Episode {
title: String,
link: String,
url: String,
size: u64,
release_date: String,
downloaded: bool,
}
// Function that allows episodes to be printed
impl fmt::Display for Episode {
... |
use std::marker::PhantomData;
use oasis_core_runtime::storage::mkvs;
use super::Store;
/// A key-value store that hashes all keys and stores them as `H(k) || k`.
pub struct HashedStore<S: Store, D: digest::Digest> {
parent: S,
_digest: PhantomData<D>,
}
impl<S: Store, D: digest::Digest> HashedStore<S, D> {
... |
use std::io::{self, Write};
use super::{Value, Tag, Vec2, Vec3, Vec4, Box2, Writer};
pub struct TextWriter<W> {
output: W,
first: bool,
indent: i32,
}
impl<W: Write> TextWriter<W> {
pub fn new(output: W) -> TextWriter<W> {
TextWriter {
output: output,
first: true,
... |
extern crate clap;
extern crate duct;
extern crate regex;
extern crate reqwest;
use clap::{App, Arg, ArgMatches};
use regex::Regex;
use std::env;
use std::process;
use std::str;
use std::io;
use duct::cmd;
use std::collections::HashMap;
pub struct Success {
pub command_result: CommandResult,
pub error_message... |
mod components;
mod systems;
use components::*;
use systems::*;
use bevy::prelude::*;
use bevy::math::Vec3;
use std::time::Duration;
fn main() {
App::build()
.add_default_plugins()
.add_startup_system(setup.system())
.add_startup_system(add_particle_system.system())
// Unsure if this staging is n... |
use formater::Formater;
use std::cell::RefCell;
use std::rc::Rc;
#[derive(Clone)]
pub struct Mock {
format_one_line_called: Rc<RefCell<Vec<FormatOneLineInputs>>>,
format_diff_called: Rc<RefCell<FormatDiffInputs>>,
format_passed_test_called: Rc<RefCell<bool>>,
format_failed_test_called: Rc<RefCell<bool>... |
use druid::{
widget::{Label, ViewSwitcher},
AppLauncher, Data, Lens, Widget, WidgetExt, WindowDesc,
};
mod theme;
mod tools;
mod widget;
#[derive(Clone, Data, Lens, Default)]
pub struct State {
shift: tools::shift::ShiftState,
vigenere: tools::vigenere::VigenereState,
base64: tools::base64::Base64... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.