text stringlengths 8 4.13M |
|---|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub const ICW_ALREADYRUN: u32 = 4u32;
pub const ICW_CHECKSTATUS: u32 = 1u32;
pub const ICW_FULLPRESENT: u32 = 1u32;
pub const ICW_FULL_SMARTSTART: u32 = 2048u32... |
#[doc = "Reader of register OPAMP2_CSR"]
pub type R = crate::R<u32, super::OPAMP2_CSR>;
#[doc = "Writer for register OPAMP2_CSR"]
pub type W = crate::W<u32, super::OPAMP2_CSR>;
#[doc = "Register OPAMP2_CSR `reset()`'s with value 0"]
impl crate::ResetValue for super::OPAMP2_CSR {
type Type = u32;
#[inline(always... |
use std::io::{self, Write};
use std::net::{SocketAddr, ToSocketAddrs, UdpSocket};
use nalgebra::{Point3, Translation3, UnitQuaternion, Vector3};
pub struct Client {
socket: UdpSocket,
target: SocketAddr,
buf: Vec<u8>,
}
impl Client {
pub fn new<A: ToSocketAddrs>(bind: A, target: SocketAdd... |
use crate::physics;
use crate::physics::{EntityToBody, EventQueue, Gravity, RapierPhysicsScale};
use bevy::prelude::*;
use rapier::dynamics::{IntegrationParameters, JointSet, RigidBodySet};
use rapier::geometry::{BroadPhase, ColliderSet, NarrowPhase};
use rapier::math::Vector;
use rapier::pipeline::PhysicsPipeline;
//... |
// Copyright 2022 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 ... |
use std::collections::HashMap;
fn main() {
}
fn create_shift_substitutions(n: i32) -> (HashMap<char, char>, HashMap<char, char>) {
let mut encoding: HashMap<char, char> = HashMap::new();
let mut decoding: HashMap<char, char> = HashMap::new();
let ascii_char = get_ascii();
let alphabet_size = &ascii_ch... |
#[macro_use] extern crate log;
extern crate net_gazer_core as core;
use core::*;
use pnet::packet::ethernet::EthernetPacket;
use pnet::datalink::NetworkInterface;
const ID:u8=core::PLUGIN_ID_DEMO;
const NAME:&str="Demo plugin";
#[derive(Default)]
pub struct DemoPlugin;
impl Plugin for DemoPlugin{
fn get_name(&... |
use async_trait::async_trait;
use chrono::{Duration, Utc};
use crate::db::{self, Db};
pub async fn save_credentials(
db: &Db,
true_layer: &true_layer::Client,
token_res: true_layer::TokenResponse,
) -> anyhow::Result<String> {
let metadata = true_layer.token_metadata(&token_res.access_token).await?;
... |
#[doc = "Reader of register CCONF"]
pub type R = crate::R<u8, super::CCONF>;
#[doc = "Writer for register CCONF"]
pub type W = crate::W<u8, super::CCONF>;
#[doc = "Register CCONF `reset()`'s with value 0"]
impl crate::ResetValue for super::CCONF {
type Type = u8;
#[inline(always)]
fn reset_value() -> Self::... |
use std::collections::BTreeMap;
use rustc_serialize::json::{Json,ToJson};
use parse::*;
use record::Record;
use message::Message;
use method::SetError;
make_prop_type!(MessageCopy, "MessageCopy",
message_id: String => "messageId",
mailbox_ids: Vec<String> => "mailboxIds",
is_unread: bool =... |
use crate::accessor;
use crate::{Buffer, Skin};
/// Inverse Bind Matrices of type `[[f32; 4]; 4]`.
pub type ReadInverseBindMatrices<'a> = accessor::Iter<'a, [[f32; 4]; 4]>;
/// Skin reader.
#[derive(Clone, Debug)]
pub struct Reader<'a, 's, F>
where
F: Clone + Fn(Buffer<'a>) -> Option<&'s [u8]>,
{
pub(crate) ... |
use std::path::Path;
use std::fs;
use regex::Regex;
use node_version::NodeVersion;
use home_directory::HomeDirectory;
pub struct Ls {
home: HomeDirectory
}
impl Ls {
fn is_directory<P: AsRef<Path>>(&self, path: P) -> bool {
match fs::metadata(path) {
Ok(metadata) => metadata.is_dir(),
... |
#[cfg(feature = "async")]
use crate::protocol::util_async;
#[cfg(feature = "sync")]
use crate::protocol::util_sync;
#[cfg(feature = "sync")]
use byteorder::{LittleEndian, ReadBytesExt};
use crate::{
protocol::{parts::field_metadata::InnerFieldMetadata, util},
FieldMetadata, HdbResult, TypeId,
};
use std::{ops:... |
use std::{convert::{Into, TryFrom},
fmt,
ops::{Index, IndexMut},
str};
use serde::{Deserialize, Serialize};
use crate::*;
/// Cargo - map of resource amounts by resource type
///
/// # See also
///
/// Check <https://www.lux-ai.org/specs-2021#Resources>
#[derive(Clone, Copy, Default, fm... |
use fraction::ToPrimitive;
use crate::io::*;
pub const _MAX_LYRICS_LINE_COUNT: u8 = 5;
/// Struct to keep lyrics
/// On guitar pro files (gp4 or later), you can have 5 lines of lyrics.
/// It is store on a BTreeMap:
/// * the key is the mesure number. The start mesure is 1
/// * the value is the text. Syntax:
/// ... |
#[doc = "Reader of register PCTL"]
pub type R = crate::R<u32, super::PCTL>;
#[doc = "Writer for register PCTL"]
pub type W = crate::W<u32, super::PCTL>;
#[doc = "Register PCTL `reset()`'s with value 0"]
impl crate::ResetValue for super::PCTL {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
/// O(sqrt(N))
/// 与えられた数の素因数分解を行う
/// TODO: HashMap<usize, usize>にして素因数の数を数えても良いかも知れない
fn bunkai(mut n: usize) -> Vec<usize> {
let mut ans = vec![];
let mut pivot = 2;
while pivot * pivot <= n {
while n / pivot * pivot == n {
ans.push(pivot);
n /= pivot;
}
p... |
//! Miscellaneous solver state.
use crate::solver::SolverError;
/// Satisfiability state.
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum SatState {
Unknown,
Sat,
Unsat,
UnsatUnderAssumptions,
}
impl Default for SatState {
fn default() -> SatState {
SatState::Unknown
}
}
/// Mis... |
use crate::{match_controller::*, GameState};
use derive_more::Display;
use futures::{
prelude::*,
stream::{SplitSink, SplitStream},
};
use mahjong::{anyhow::*, messages::*, tile::Wind};
use std::sync::atomic::{AtomicU64, Ordering};
use thespian::{Actor, Remote, StageBuilder};
use tracing::*;
use warp::{filters:... |
use dynasm::dynasm;
use dynasmrt::{x64::Assembler, DynasmApi};
// Syscalls are in r0, r7, r6, r2, r10, r8, r9, returns in r0, r1 clobbers r11
// See <https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI> A.2.1
// See <https://github.com/apple/darwin-xnu/blob/master/bsd/kern/syscalls.master>
// TODO: These intrinsics... |
#[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::HB16CFG2 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R,... |
// xfail-stage0
// -*- rust -*-
use std;
import std._str;
import std._vec;
fn test_simple() {
let str s1 = "All mimsy were the borogoves";
/*
* FIXME from_bytes(vec[u8] v) has constraint is_utf(v), which is
* unimplemented and thereby just fails. This doesn't stop us from
* using from_bytes for now sin... |
use std::collections::HashMap;
//hashmap相对之前的vector和string来说用的较少,因此没有包括在自动引入的特点中
//所以使用时需要使用use引入.
//同时也没有内置的宏支持
//hashmap的所有key必须是同一类型,value也必须是同一类型
pub fn map() {
//根据new关联方法构造
let mut scores = HashMap::new();
scores.insert(String::from("Blue"), 10);
scores.insert(String::from("Yellow"), 50);
//... |
#[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::CHMAP1 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
use std::{
ffi::{c_void, CString},
os::raw::c_char,
ptr,
};
const PAGE_EXECUTE_READWRITE: u32 = 0x40;
#[link(name = "kernel32")]
extern "stdcall" {
fn GetProcAddress(module: *mut c_void, name: *const c_char) -> *const c_void;
fn VirtualProtect(addr: *mut c_void, len: usize, new_prot: u32, old_prot... |
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0.
use block_format::Block;
use cid::Cid;
use crate::error::Result;
use crate::merkledag::NodeGetter;
/// Node must support deep copy
/// Node is the base interface all IPLD nodes must implement.
///
/// Nodes are **Immutable** and all methods defined on ... |
#[macro_use]
extern crate log;
mod lint;
pub use self::lint::{
default_filter, AllRulesValidator, Filter, NodeIterator, Rule, RuleCode, SourceCode,
ValidationError, Validator, RULES,
};
|
// SPDX-License-Identifier: Apache-2.0
use super::{Command, Error};
use ciborium::de::from_reader;
use koine::Contract;
use reqwest::header::CONTENT_TYPE;
use structopt::StructOpt;
use uuid::Uuid;
#[derive(StructOpt)]
pub struct List {
/// The server base URL
#[structopt(short, long, env = "ENARX_SERVER")]
... |
use self::generated_types::{schema_service_client::SchemaServiceClient, *};
use ::generated_types::google::OptionalField;
use client_util::connection::GrpcConnection;
use crate::connection::Connection;
use crate::error::Error;
/// Re-export generated_types
pub mod generated_types {
pub use generated_types::influx... |
use assert_fs::prelude::*;
use predicates::str::ends_with;
mod retry_test;
use retry_test::*;
#[test]
fn test_default() -> TestResult {
RetryCommand::new()?
.command(&["echo", "-n", "test"])
.assert()
.success()
.stdout(ends_with("test"));
Ok(())
}
#[test]
fn test_retry_on_success() -> TestResul... |
#![crate_type = "staticlib"]
#![no_std]
#![feature(core,core_intrinsics, lang_items, compiler_builtins_lib)]
#[macro_use] extern crate fixedvec;
extern crate rlibc;
extern crate compiler_builtins;
pub mod hal;
use core::intrinsics::abort;
use core::str::from_utf8;
use fixedvec::FixedVec;
enum CharType {
Control... |
/*
* hurl (https://hurl.dev)
* Copyright (C) 2020 Orange
*
* 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 ... |
#![allow(unused_variables)]
extern crate actix;
extern crate actix_web;
extern crate env_logger;
extern crate futures;
extern crate regex;
extern crate serde_json;
extern crate maxminddb;
#[macro_use]
extern crate tera;
use std::env;
use std::net::IpAddr;
use std::str::FromStr;
use std::collections::{HashMap, BTreeMa... |
// Copyright 2019 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 {
bt_avctp::Error as AvctpError,
failure::{Error, Fail},
futures::{sink::Sink, stream::FusedStream, task::Context, Poll, Stream},
pin_u... |
extern crate arcball;
extern crate cgmath;
extern crate clock_ticks;
extern crate glium;
extern crate image;
type Mat4 = cgmath::Matrix4<f32>;
type CgPoint = cgmath::Point3<f32>;
type CgVec = cgmath::Vector3<f32>;
type Vector2 = cgmath::Vector2<f32>;
type Vector3 = cgmath::Vector3<f32>;
type Vector4 = cgmath::Vector4<... |
// Copyright 2016 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 combine::parser::range::{range, take_while1};
use combine::parser::repeat::{sep_by};
use combine::parser::Parser;
use combine::stream::{RangeStream, state::State};
use combine::error::ParseError;
// Copy the fn header as is, only change ------------╮
// v
fn tools... |
///! GIT REQ!
mod git;
mod remotes;
use clap::{crate_authors, crate_version, App, AppSettings, ArgMatches, YamlLoader};
use colored::*;
use git2::ErrorCode;
use lazy_static::lazy_static;
use log::{debug, error, info, trace};
use std::io::{self, stdin, stdout, Cursor, Write};
use std::{env, include_str, process};
use t... |
use clap::{Clap, ValueHint};
use futures::future;
use log::error;
use rsplay::{data, scenario, Scenario};
use std::path::PathBuf;
use std::process;
#[derive(Clap, Debug)]
#[clap(author, about, version)]
struct Opts {
#[clap(long, value_hint=ValueHint::FilePath, about = "scenario file path")]
scenario: PathBuf,... |
use crate::enums::{Keyword, Symbol, TokenValue};
use std::iter::Peekable;
use std::str::Chars;
pub type Token = TokenValue;
type LexResult = Result<Token, String>;
pub struct Lexer<'a> {
input: Peekable<Chars<'a>>,
}
/// Implementation of a DFA.
impl<'a> Lexer<'a> {
pub fn new(source: &'a str) -> Self {
... |
//! Create graphene and other substrates for use in molecular dynamics simulations.
extern crate colored;
extern crate dialoguer;
extern crate serde;
extern crate serde_json;
extern crate structopt;
#[macro_use] extern crate structopt_derive;
extern crate grafen;
extern crate mdio;
mod error;
mod output;
mod ui;
us... |
mod with_function;
use proptest::prop_assert_eq;
use proptest::strategy::Strategy;
use crate::erlang::is_function_2::result;
use crate::test::strategy;
#[test]
fn without_function_returns_false() {
run!(
|arc_process| {
(
strategy::term::is_not_function(arc_process.clone()),
... |
use serde::{Deserialize, Serialize};
use serde_json::Result;
use crate::api::message::amount::{Amount, string_or_struct};
use crate::api::message::meta::*;
use std::error::Error;
use std::fmt;
/*
@4.12获得账号交易列表
RequestAccountTxCommand 请求格式
id: u64, //(固定值): 1
command: String, //(固定值): account_tx
acco... |
/// 给定一组非负整数,重新排列它们的顺序使之组成一个最大的整数。
///
/// 示例 1:
///
/// 输入: [10,2]
/// 输出: 210
///
/// 示例 2:
///
/// 输入: [3,30,34,5,9]
/// 输出: 9534330
///
/// 说明: 输出结果可能非常大,所以你需要返回一个字符串而不是整数。
use std::cmp::Ordering;
pub fn largest_number(nums: Vec<i32>) -> String {
let mut v: Vec<String> = nums.into_iter().map(|x| x.to_string()).co... |
use crate::process::DrawProcess;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// This is a frame. It stores the terminal's size in a convenient place.
/// It isn't stored in a grid, as grids are altered when they're split.
/// For examples, s... |
extern crate echo_rust_grpc_proto;
extern crate grpc;
extern crate server;
extern crate tls_api_stub;
fn main() {
let mut server = grpc::ServerBuilder::<tls_api_stub::TlsAcceptor>::new();
server.http.set_port(50051);
server.add_service(echo_rust_grpc_proto::EchoServer::new_service_def(
server::Echo... |
use proconio::{input, marker::Usize1};
fn main() {
input! {
n: usize,
positions: [(Usize1, Usize1); n - 1],
};
let mut bad = vec![vec![false; n]; n];
for (r, c) in positions {
bad[r][c] = true;
for i in 0..n {
bad[i][c] = true;
}
for j in 0..... |
use test_winrt_method_names::*;
use windows as Windows;
use windows::core::*;
use windows::Foundation::*;
use Component::MethodNames::*;
#[implement(Component::MethodNames::IMethodNames)]
struct MethodNames(i64);
#[allow(non_snake_case)]
impl MethodNames {
fn Method(&self) -> Result<()> {
Ok(())
}
... |
use serde::Serialize;
use serde_json::Result;
#[derive(Serialize)]
pub struct Service {
pub id: String,
pub title: String,
pub subtitle: String,
}
impl Service {
pub fn serialize_to_json(self) -> Result<String> {
serde_json::to_string(&self)
}
}
|
#![crate_name="albino-run"]
#![crate_type="bin"]
#![feature(phase)]
#![unstable]
#[phase(plugin, link)] extern crate log;
extern crate getopts;
extern crate whitebase;
extern crate albino;
use getopts::Matches;
use std::os;
use std::io::{IoError, MemReader, MemWriter};
use whitebase::machine;
use whitebase::syntax::... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qplaintextedit.h
// dst-file: /src/widgets/qplaintextedit.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main bl... |
use pyo3::class::basic::CompareOp;
use pyo3::class::*;
use pyo3::prelude::*;
use pyo3::py_run;
mod common;
#[pyclass]
struct UnaryArithmetic {
inner: f64,
}
impl UnaryArithmetic {
fn new(value: f64) -> Self {
UnaryArithmetic { inner: value }
}
}
#[pyproto]
impl PyObjectProtocol for UnaryArithmet... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
// Copyright 2016 Amanieu d'Antras
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://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 t... |
use cm_fidl_translator;
use failure::Error;
use fidl_fuchsia_data as fd;
use fidl_fuchsia_sys2::{
CapabilityType, ChildDecl, ComponentDecl, ExposeDecl, OfferDecl, OfferTarget, Relation,
RelativeId, UseDecl,
};
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
fn main() {
let cm_content = read_c... |
pub struct Solution;
impl Solution {
pub fn divide(dividend: i32, divisor: i32) -> i32 {
let mut dividend = dividend as i64;
let mut divisor = divisor as i64;
let mut negative = false;
if dividend < 0 {
dividend = -dividend;
negative = !negative;
}
... |
use std::prelude::v1::*;
use http_req::uri::*;
use std::ops::Range;
fn remove_spaces(text: &mut String) {
text.retain(|c| !c.is_whitespace());
}
const HTTP_PORT: u16 = 80;
const HTTPS_PORT: u16 = 443;
const TEST_URIS: [&str; 5] = [
"https://user:info@foo.com:12/bar/baz?query#fragment",
"file:///C:/Users/... |
use crate::prelude::*;
use std::sync::{Arc, Mutex};
pub enum ClearValue {
Color([f32; 4]),
Depth(f32, u32),
}
pub struct CustomTarget {
pub usage: VkImageUsageFlagBits,
pub format: VkFormat,
pub clear_on_load: bool,
pub store_on_save: bool,
pub attach_sampler: bool,
pub clear_value: C... |
use apilib::transfer::Transfer;
use serde::Serialize;
use serde::Deserialize;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum TResponse<T: Transfer> {
Ok(T),
Err(u16, String),
}
impl<'de, T: Transfer + Serialize + Deserialize<'de>> TResponse<T> {
pub fn ok(value: T) -> Self {
TResponse::O... |
fn main() {
println!("Hello, world!");
println!("{}", another_function(4));
}
fn another_function(x: i32) -> i32 {
let test = [1,2,3,4];
for i in test.iter() {
println!("{}", i);
}
for j in (1..4).rev() {
println!("{}", j);
}
x + 4
}
|
mod interp;
use interp::LLVMIRInterpreter;
use llvm_ir::Module;
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
match create_module(&args[1]) {
Ok(module) => {
let mut lii = LLVMIRInterpreter::new(module);
match lii.interpret() {
Ok(_) =... |
use std::io::{self, Write};
use varisat_formula::Lit;
use varisat_internal_proof::ProofStep;
/// Prepares a proof step for DRAT writing
fn drat_step(
step: &ProofStep,
mut emit_drat_step: impl FnMut(bool, &[Lit]) -> io::Result<()>,
) -> io::Result<()> {
match step {
ProofStep::AtClause { clause, .... |
use std::collections::BTreeMap;
use std::path::PathBuf;
use std::str::FromStr;
#[cfg(feature = "offline")]
use std::sync::{Arc, Mutex};
use once_cell::sync::Lazy;
use proc_macro2::TokenStream;
use syn::Type;
pub use input::QueryMacroInput;
use quote::{format_ident, quote};
use sqlx_core::connection::Connection;
use s... |
use log::*;
use crate::instruction::{AccountMeta, Instruction};
use crate::instruction_processor_utils::DecodeError;
use crate::pubkey::Pubkey;
use crate::system_program;
use num_derive::FromPrimitive;
use morgan_helper::logHelper::*;
#[derive(Serialize, Debug, Clone, PartialEq, FromPrimitive)]
pub enum SystemError {
... |
use crate::model::{project::Project, user::User};
pub enum MyError {
NotFound,
DatabaseError,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct Msgs {
pub status: i32,
pub message: String,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct UserMsgs {
pub status: i32,
pub message: Strin... |
/*
* @lc app=leetcode.cn id=69 lang=rust
*
* [69] x 的平方根
*
* https://leetcode-cn.com/problems/sqrtx/description/
*
* algorithms
* Easy (34.96%)
* Total Accepted: 28.2K
* Total Submissions: 80.2K
* Testcase Example: '4'
*
* 实现 int sqrt(int x) 函数。
*
* 计算并返回 x 的平方根,其中 x 是非负整数。
*
* 由于返回类型是整数,结果只保留整数的部分... |
use super::ema::series_ema;
use super::sma::{declare_ma_var, wma_func};
use super::tr::tr_func;
use super::VarResult;
use crate::ast::stat_expr_types::VarIndex;
use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType};
use crate::helper::err_msgs::*;
use crate::helper::str_replace;
use c... |
// 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 ... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_create_api(
input: &crate::input::CreateApiInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::serialize::JsonObjectWriter:... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_Foundation")]
pub fn NetDfsAdd(dfsentrypath: super::super::Foundation::PWSTR, servername: super::super::Foundation::PWSTR, sharena... |
pub mod data {
use chrono::{DateTime, Utc};
use vcgencmd::measure_temp;
#[derive(Debug)]
pub struct MonitorData {
date: String,
temperature: String,
}
impl Default for MonitorData {
fn default() -> Self {
MonitorData::new()
}
}
impl MonitorD... |
// Enables `no_coverage` on the entire crate
#![feature(no_coverage)]
#[no_coverage]
fn do_not_add_coverage_1() {
println!("called but not covered");
}
#[no_coverage]
fn do_not_add_coverage_2() {
println!("called but not covered");
}
fn main() {
do_not_add_coverage_1();
do_not_add_coverage_2();
}
|
use fraction::ToPrimitive;
use crate::{effects::*, enums::*, io::*, gp::*, beat::*, key_signature::*};
#[derive(Debug,Clone, PartialEq)]
pub struct Note {
pub value: i16,
pub velocity: i16,
pub string: i8,
pub effect: NoteEffect,
pub duration_percent: f32,
pub swap_accidentals: bool,
pub k... |
#![feature(map_in_place)]
use std::thread;
#[derive(Clone)]
struct Backpack {
weight: u64,
nuggets: Vec<u64>,
}
impl Backpack {
fn new() -> Backpack {
Backpack { weight: 0u64, nuggets: Vec::new() }
}
fn add(&mut self, nugget: u64) {
self.weight = self.weight + nugget;
self.nuggets.push(nugget);
}
}
fn ... |
use regex::Regex;
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs;
fn main() {
let result = solve_puzzle("input");
println!("And the result is {}", result);
}
fn solve_puzzle(file_name: &str) -> u64 {
let data = read_data(file_name);
let mut memory: HashMap<u64, u64> = HashMa... |
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use itertools::Itertools;
use whiteread::parse_line;
fn main() {
let (r, c): (usize, usize) = parse_line().unwrap();
let mut senbeis: Vec<Vec<bool>> = vec![];
for _ in 0..r {
let line: Vec<usize> = parse_line().unwrap();
... |
// Copyright 2022 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 ... |
// Copyright 2019 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, ResultExt},
fidl::encoding::OutOfLine,
fidl_fuchsia_mem::Buffer,
fidl_fuchsia_modular::{
EntityRequest, Enti... |
//! Oasis Contract SDK.
#![cfg_attr(target_arch = "wasm32", feature(wasm_abi))]
#[cfg(target_arch = "wasm32")]
pub mod abi;
pub mod context;
pub mod contract;
pub mod env;
pub mod error;
pub mod event;
pub mod memory;
pub mod storage;
#[cfg(not(target_arch = "wasm32"))]
pub mod testing;
// Re-export types.
pub use oa... |
use super::pool::{Fits, Pool};
use core::{
alloc::{AllocErr, CannotReallocInPlace, Excess, Layout},
cmp,
ptr::{self, NonNull},
slice::SliceIndex,
};
/// Allocator for a generic memory pools layout.
///
/// The trait is supposed to be implemented for an array of pools.
/// [`heap`](crate::heap) macro sh... |
use std::fmt;
use std::fmt::Debug;
use std::io::{Cursor, Read, Write};
use std::fs::{File, OpenOptions};
use std::io;
use std::path::Path;
use byteorder::{ReadBytesExt, WriteBytesExt, LittleEndian};
use gba_mem::Address;
pub const BYTE_WIDTH: u16 = 8;
#[derive(Clone, Copy, Debug)]
pub enum BusWidth {
BW16,
... |
fn main() {
let x: i32 = 10;
let y: u32 = to_u32(x);
println!("{}", y);
}
fn to_u32(v: i32) -> u32 {
//u32::from(v)
v.into()
}
|
use crate::lexer::*;
use crate::parsers::expression::begin::body_statement;
use crate::parsers::expression::expression;
use crate::parsers::expression::method::defined_method_name;
use crate::parsers::expression::method::method_body;
use crate::parsers::expression::method::method_parameter_part;
use crate::parsers::exp... |
//! An ephemeral in-memory file system, intended mainly for unit tests
use super::traits::{OpenOptions, VFile, VMetadata, VPath, VFS};
use async_trait::async_trait;
use futures_lite::{
io::{AsyncRead, AsyncSeek, AsyncWrite},
stream,
};
use std;
use std::cmp;
use std::collections::hash_map::Entry;
use std::coll... |
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;
#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;
fn... |
use std::collections::HashMap;
mod state_transition;
pub struct GameState {
pub stars: HashMap<StarId, Star>,
pub ships: Vec<ShipGroup>,
pub carriers: HashMap<CarrierId, Carrier>,
pub players: HashMap<PlayerId, Player>,
}
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)]
pub struct StarId(pub u32);
... |
#[lambda_attributes::lambda]
fn main() {}
|
#[cfg(all(not(target_arch = "wasm32"), test))]
mod test;
use liblumen_alloc::erts::exception;
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::Term;
use crate::runtime::integer_to_string::decimal_integer_to_string;
#[native_implemented::function(erlang:integer_to_list/1)]
pub fn r... |
#![deny(missing_docs, missing_debug_implementations, warnings)]
#![doc(html_root_url = "https://docs.rs/tokio-executor/0.1.8")]
// Our MSRV doesn't allow us to fix these warnings yet
#![allow(rust_2018_idioms)]
//! Task execution related traits and utilities.
//!
//! In the Tokio execution model, futures are lazy. Whe... |
use crate::Score;
#[derive(Debug, Clone)]
pub struct RecentFiles(Vec<String>);
impl From<Vec<String>> for RecentFiles {
fn from(inner: Vec<String>) -> Self {
Self(inner)
}
}
impl RecentFiles {
pub fn calc_bonus(&self, bonus_text: &str, base_score: Score) -> Score {
if self.0.iter().any(|s... |
// Copyright 2017 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 super::InternalEvent;
use metrics::counter;
#[derive(Debug)]
pub struct ChunkProcessed {
pub byte_size: usize,
}
impl InternalEvent for ChunkProcessed {
fn emit_metrics(&self) {
counter!("k8s_stream_chunks_processed", 1);
counter!("k8s_stream_bytes_processed", self.byte_size as u64);
}... |
#[doc = "Reader of register DC6"]
pub type R = crate::R<u32, super::DC6>;
#[doc = "USB Module 0 Present\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum USB0_A {
#[doc = "1: USB0 is Device Only"]
DEV = 1,
#[doc = "2: USB is Device or Host"]
HOSTDEV = 2,
#[doc = "3... |
use rusoto_core::RusotoError;
use rusoto_secretsmanager::{
SecretsManager,
GetRandomPasswordRequest,
GetRandomPasswordError,
};
use std::time::Duration;
use crate::{
RotatorError,
RotatorResult,
SM_CLIENT,
};
pub fn get_random_password(timeout: Duration) -> RotatorResult<String> {
SM_CLIENT... |
mod cli;
mod rendering;
mod taskmanager;
extern crate prettytable;
extern crate dirs;
use crate::cli::Cli;
use crate::rendering::{
confirm_task_moved, confirm_task_removed, confirm_the_task, greet_the_user, render_all_tasks,
};
use crate::taskmanager::{Status, Task, Tasks};
use chrono::Utc;
use std::fs::OpenOpti... |
//! Regular smart contract.
use near_bindgen::near_bindgen;
use borsh::{BorshDeserialize, BorshSerialize};
#[near_bindgen]
#[derive(Default, BorshDeserialize, BorshSerialize)]
struct Incrementer {
value: u32,
}
#[near_bindgen]
impl Incrementer {
pub fn inc(&mut self, by: u32) {
self.value += by;
... |
use crate::game::{State, Transition};
use crate::render::DrawOptions;
use crate::sandbox::SandboxMode;
use crate::ui::{ShowEverything, UI};
use abstutil::MultiMap;
use ezgui::{hotkey, EventCtx, GfxCtx, ItemSlider, Key, Line, Text};
use geom::Duration;
use map_model::{Map, Traversable};
use sim::{
CarID, DrawCarInpu... |
use std::io;
use std::io::Write;
use std::collections::HashMap;
use std::io::Read;
const TAPE_LEN: usize = 30000;
#[derive(PartialEq, Eq, Hash, Debug)]
enum Bracket {
Open(usize),
Close(usize),
}
fn make_mapping(prog: &str) -> HashMap<Bracket, Bracket> {
let mut stack: Vec<usize> = vec![];
let mut result: Ha... |
//use criterion::Criterion;
//use test_utils;
//
//fn product(c: &mut Criterion) {
// c.bench_function_over_inputs("TabularFactor_product", |b, &size| {
// let nodes_left = test_utils::create_vec_node_index(0, size);
// let factor_left = test_utils::create_factor::<f64, u32>(nodes_left);
//
// ... |
//! Thread-safe task notification primitives.
mod atomic_task;
pub use self::atomic_task::AtomicTask;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.