text stringlengths 8 4.13M |
|---|
use std::error::Error;
use http::Request;
use lambda_runtime::{Context, error::HandlerError, lambda};
use lambda_utils::apigateway::ApiGatewayRequest;
use lambda_utils::apigateway::ApiGatewayResponse;
use http::header::HeaderValue;
use tokio::runtime::Runtime;
fn main() -> Result<(), Box<dyn Error>> {
let runti... |
// 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(crate) mod actor_key;
pub(crate) mod actor_packet_writer;
pub(crate) mod actor_record;
pub(crate) mod mut_handler;
pub(crate) mod server_actor_manager;
pub(crate) mod server_actor_message;
pub(crate) mod server_actor_mutator;
|
use crate::util::color::Color;
use crate::util::rng::get_rng;
use rand::Rng;
use serde::{Deserialize, Serialize};
use std::f64;
use std::ops::{Add, AddAssign, Div, Mul, Sub};
const EPSILON: f64 = 0.00001;
trait Clamp01 {
fn clamp01(self) -> Self;
}
impl Clamp01 for f64 {
fn clamp01(self) -> Self {
se... |
use proc_macro::TokenStream;
use quote::quote;
use crate::{
args,
utils::{get_crate_name, get_rustdoc, GeneratorResult},
};
pub fn generate(desc_args: &args::Description) -> GeneratorResult<TokenStream> {
let crate_name = get_crate_name(desc_args.internal);
let ident = &desc_args.ident;
let (impl_... |
use crate::sim::*;
// it just finds where the cdf crosses 0.5 or whatever
pub struct CdfBisect {
bisect_point: f64,
earliest_bug_seen: usize,
}
impl CdfBisect {
pub fn new(s: &SimulationState, bisect_point: f64) -> Self {
Self {
bisect_point,
// never test the last commit
... |
use wasm_bindgen::prelude::*;
const KEY: &str = "draco.examples.local_storage";
#[derive(Debug)]
pub struct LocalStorage {
value: String,
}
impl LocalStorage {
fn new() -> Self {
LocalStorage {
value: Self::storage()
.get_item(KEY)
.expect("get_item")
... |
use jni::objects::GlobalRef;
use wasi_common::WasiCtx;
pub(crate) struct StoreData {
pub wasi: Option<WasiCtx>,
pub java_data: Option<GlobalRef>,
}
|
#![deny(clippy::all)]
pub mod cbc;
pub mod ctr;
pub mod ecb;
pub mod padding;
#[derive(Debug)]
pub enum Mode {
ECB,
CBC,
CTR,
}
/// Represents a cipher
pub trait Cipher {
fn encrypt(&self, key: &[u8], msg: &[u8]) -> Vec<u8>;
fn decrypt(&self, key: &[u8], ct: &[u8]) -> Vec<u8>;
}
/// Instantiate a... |
pub mod article;
pub mod file_stores;
pub mod item_name;
pub mod price;
pub mod shop;
|
// error-pattern: can't refer to a module as a first-class value
mod m1 {
mod a {
}
}
fn main(vec[str] args) {
log m1.a;
}
|
// 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 ... |
#[doc = "Reader of register APB1SECSR1"]
pub type R = crate::R<u32, super::APB1SECSR1>;
#[doc = "Reader of field `LPTIM1SECF`"]
pub type LPTIM1SECF_R = crate::R<bool, bool>;
#[doc = "Reader of field `OPAMPSECF`"]
pub type OPAMPSECF_R = crate::R<bool, bool>;
#[doc = "Reader of field `DACSECF`"]
pub type DACSECF_R = crat... |
use crate::{
charactermeta::CharacterDirection, damage::Destroyer, delayedremove::DelayedRemove,
};
use specs_physics::{PhysicsBodyBuilder, PhysicsBody,
nphysics::object::BodyStatus,
nalgebra::{Vector3},
PhysicsColliderBuilder,
PhysicsCollider,
colliders::Shape,
};
use amethyst::{core::Transform... |
#[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::*;
#[native_implemented::function(erlang:tuple_size/1)]
pub fn result(process: &Process, tuple: Term) -> exception::Result<Term> {
let ... |
use std::{
collections::{HashMap, VecDeque},
io, mem,
path::{Path, PathBuf},
sync::Arc,
};
use abi_stable::{
external_types::crossbeam_channel::{self, RReceiver, RSender},
library::{lib_header_from_path, LibraryError, LibrarySuffix, RawLibrary},
sabi_trait::prelude::TD_Opaque,
std_types... |
mod with_trap_exit_flag;
use super::*;
#[test]
fn without_supported_flag_errors_badarg() {
run!(
|arc_process| {
(
Just(arc_process.clone()),
unsupported_flag_atom(),
strategy::term(arc_process.clone()),
)
},
|(arc_pro... |
// 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 {
fidl::endpoints::ServerEnd,
fidl_fuchsia_io::{DirectoryProxy, NodeMarker, DIRENT_TYPE_SERVICE, INO_UNKNOWN},
fuchsia_vfs_pseudo_fs as fvfs... |
use crate::{RegisterBits, Register};
use core::marker;
/// A 16-bit timer.
pub trait Timer16 : Sized {
/// The first compare register.
/// For example, OCR0A.
type CompareA: Register<T=u16>;
/// The second compare register.
/// For example, OCR0B.
type CompareB: Register<T=u16>;
/// The c... |
#[cfg(feature = "bindings")]
mod error {
use cbindgen::Error as BindgenError;
#[cfg(feature = "ctests")]
use cc::Error as CcError;
use std::{env::VarError, error, fmt, io};
#[allow(unused)]
#[derive(Debug)]
pub enum Error {
Bindgen(BindgenError),
#[cfg(feature = "ctests")]
... |
if k == 0 {
return head
}
// 3 components:
// - head: remaining list
// - k_group: current accumulating group, targeting k elements
// - prev_tail: tail of already processed part of list
//
// Basic idea:
// Take nodes from head, prepend the node to k_group, so after doing it k times,
// k_group will be the reve... |
use super::{Gesture, MouseButtonCode, VirtualKeyCode};
use num_traits::FromPrimitive;
use serde::{ser::SerializeStruct, Deserialize, Deserializer, Serialize};
use smart_default::SmartDefault;
use std::{convert::TryFrom, fmt};
/// Describes the current event type. Users can make most events freely, though
/// special c... |
// 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.
///! Serves ClientStateUpdate listeners.
///!
use {
fidl_fuchsia_wlan_policy as fidl_policy,
futures::{channel::mpsc, prelude::*, select, stream::F... |
#![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 DesktopWindowTarget(pub ::windows::core::IInsp... |
//! Display vector graphics in your application.
use crate::{layout, Element, Hasher, Layout, Length, Point, Size, Widget};
use std::{
hash::Hash,
path::{Path, PathBuf},
};
/// A vector graphics image.
///
/// An [`Svg`] image resizes smoothly without losing any quality.
///
/// [`Svg`] images can have a cons... |
use data_types::{NamespaceId, PartitionKey, SequenceNumber, TableId};
use generated_types::influxdata::iox::wal::v1::sequenced_wal_op::Op;
use metric::U64Counter;
use mutable_batch_pb::decode::decode_database_batch;
use observability_deps::tracing::*;
use std::time::Instant;
use thiserror::Error;
use wal::{SequencedWal... |
fn main() {
let mut sum = 0;
let n = 1000;
let mut i = 1;
while i < n {
if i % 3 == 0 || i%5 == 0 {
sum += i;
}
i+=1;
}
println!("Sum = {}", sum);
}
|
// 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 ... |
pub use VkCompareOp::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum VkCompareOp {
VK_COMPARE_OP_NEVER = 0,
VK_COMPARE_OP_LESS = 1,
VK_COMPARE_OP_EQUAL = 2,
VK_COMPARE_OP_LESS_OR_EQUAL = 3,
VK_COMPARE_OP_GREATER = 4,
VK_COMPARE_OP_NOT_EQUAL = 5,
VK_COMPARE_OP_GRE... |
use glyph_bbox::dataset as GlyphDataSet;
use htmlescape as escape;
use liquid;
use rust_embed::RustEmbed;
use simple_icons;
#[derive(RustEmbed)]
#[folder = "assets/badges"]
struct Asset;
#[derive(Debug, Deserialize)]
pub struct SvgBadgeInput {
pub title: String,
pub text: Option<String>,
pub title_colour:... |
use crate::{linalg::Vct, Flt};
use std::default::Default;
use std::ops::{Mul, Rem};
/*
y
|
|
|
o--------x
/
/
z
*/
macro_rules! df {
() => {
Default::default()
};
}
#[cfg_attr(rustfmt, rustfmt_skip)]
#[derive(Copy, Clone, Debug, Default)]
pub struct Mat {
pub m00: Flt, pub m01: ... |
// 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.
#[cfg(test)]
mod tests {
use rand::Rng;
use std::env::current_exe;
use std::io::{Read, Write};
use std::process::{Child, Command, Stdio};... |
// Copyright 2018 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 ... |
#[doc = "Reader of register TBPR"]
pub type R = crate::R<u32, super::TBPR>;
#[doc = "Writer for register TBPR"]
pub type W = crate::W<u32, super::TBPR>;
#[doc = "Register TBPR `reset()`'s with value 0"]
impl crate::ResetValue for super::TBPR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
use anyhow::Result;
use itertools::Itertools;
use std::collections::HashSet;
fn part1(input: &[String]) -> usize {
input
.split(|line| line.is_empty())
.map(|group| {
group
.iter()
.flat_map(|line| line.chars())
.collect::<HashSet<_>>()
... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Software Pulse Register"]
pub swpulse: SWPULSE,
#[doc = "0x04 - Software Level Register"]
pub swlevel: SWLEVEL,
#[doc = "0x08 - I/O Routing Pin Enable Register"]
pub routepen: ROUTEPEN,
_reserved3: [u8; 4usize],... |
#[doc = "Reader of register SACKCTL"]
pub type R = crate::R<u32, super::SACKCTL>;
#[doc = "Writer for register SACKCTL"]
pub type W = crate::W<u32, super::SACKCTL>;
#[doc = "Register SACKCTL `reset()`'s with value 0"]
impl crate::ResetValue for super::SACKCTL {
type Type = u32;
#[inline(always)]
fn reset_va... |
//! Internal implementation details of usbd-hid.
extern crate proc_macro;
extern crate usbd_hid_descriptors;
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::quote;
use syn::{parse, parse_macro_input, ItemStruct, Field, Fields, Type, Expr, Path};
use syn::{Result, Token, ExprAssign, ExprPath, Pat, PatSl... |
use core::{cmp, convert, marker, ops};
/// A value that a register can store.
///
/// All registers are either `u8` or `u16`.
pub trait RegisterValue : Copy + Clone +
ops::BitAnd<Output=Self> +
ops::BitAndAssign +
ops::BitOr<Output=Self> +
ops::BitOrAssign +
... |
//! CBOR serialisation tooling
use std::io::Write;
use error::Error;
use len::{Len, LenSz, StringLenSz, Sz};
use result::Result;
use types::{Special, Type};
pub trait Serialize {
fn serialize<'a, W: Write + Sized>(
&self,
serializer: &'a mut Serializer<W>,
) -> Result<&'a mut Serializer<W>>;
}... |
use crate::cpu::Cpu;
use crate::opcode::addressing_mode::{AddRegister, AddressMode};
use crate::opcode::*;
pub struct Jmp {
opcode: u8,
// Absolute or Indirect.
mode: AddressMode,
}
impl Jmp {
pub fn new(opcode: u8, cpu: &Cpu) -> Option<Self> {
let pc = cpu.program_counter as usize;
l... |
#[derive(Clone)]
pub struct Card {
pub id: String,
pub uri: String,
pub scryfall_uri: String,
pub rulings_uri: String,
pub name: String,
pub cmc: f64,
pub color_identity: Vec<String>,
pub type_line: String,
pub layout: String,
pub set_name: String,
pub rarity: String,
pu... |
//! Utilities used for serializing/deserializing sequencer REST API related data.
use num_bigint::BigUint;
use pathfinder_common::{
BlockNumber, CallParam, ConstructorParam, EthereumAddress, GasPrice, L1ToL2MessagePayloadElem,
L2ToL1MessagePayloadElem, TransactionSignatureElem, TransactionVersion,
};
use primi... |
pub mod logging;
pub mod frame_clock;
|
use log::debug;
use std::cell::RefCell;
use crate::query::Connection;
use crate::{Odbc, OdbcError};
thread_local! {
static DB: RefCell<Option<Connection>> = RefCell::new(None);
}
/// Access to thread local connection.
///
/// Provided closure will receive the `Connection` object and may return it for reuse by an... |
//! Alacritty - The GPU Enhanced Terminal.
#![warn(rust_2018_idioms, future_incompatible)]
#![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use)]
#![cfg_attr(feature = "cargo-clippy", deny(warnings))]
pub mod ansi;
pub mod config;
pub mod event;
pub mod event_loop;
pub mod grid;
pub mod index;
pub mod sele... |
#[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::SCGCGPIO {
#[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::borrow::Cow;
use std::collections::HashMap;
use std::convert::TryInto;
use std::sync::Arc;
use futures_core::future::BoxFuture;
use futures_util::TryFutureExt;
use crate::connection::{Connect, Connection};
use crate::executor::Executor;
use crate::postgres::protocol::{
Authentication, AuthenticationMd5,... |
pub type PFN_vkVoidFunction = extern "system" fn() -> ();
// create dummy
pub extern "system" fn vkVoidFunction() -> () {}
|
#![feature(link_args)]
#![no_main]
#[link_args = "-s MODULARIZE=1 -s EXPORT_NAME='LiveSplitCore' -Oz -s TOTAL_MEMORY=33554432 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN_METHOD='native-wasm'"]
extern "C" {}
extern crate livesplit_core_capi;
pub use livesplit_core_capi::*;
|
use crate::event::Button;
impl Button {
pub(crate) fn to_raw(&self) -> u16 {
use Button::*;
match *self {
A => 0x0130,
B => 0x0131,
Back => 0x0116,
Base => 0x0126,
Base2 => 0x0127,
Base3 => 0x0128,
Base4 => 0x0129,... |
#[doc = "Reader of register OUT_CTRL"]
pub type R = crate::R<u8, super::OUT_CTRL>;
#[doc = "Writer for register OUT_CTRL"]
pub type W = crate::W<u8, super::OUT_CTRL>;
#[doc = "Register OUT_CTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::OUT_CTRL {
type Type = u8;
#[inline(always)]
fn reset... |
// 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 ... |
pub mod base;
pub mod computer;
mod util;
|
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use fibers::sync::mpsc;
use futures::{Async, Future, Poll, Stream};
use {Error, ErrorKind, Result, WatchMask, Watcher, WatcherEvent};
use internal_inotify::{Inotify, WatchDecriptor};
use w... |
fn main() {
let _four = IpAddrKind::V4;
let _six = IpAddrKind::V6;
route(IpAddrKind::V4);
route(IpAddrKind::V6);
let _loopback = IpAddrS {
kind: IpAddrKind::V6,
address: String::from("::1"),
};
let _home = IpAddr::V4(String::from("127.0.0.1"));
let _home_e = IpAddrEnha... |
use alloc::alloc::Layout;
use core::iter::{ExactSizeIterator, Iterator};
use core::marker::PhantomData;
use core::mem;
use core::ptr;
use core::slice;
use core::sync::atomic;
use core::usize;
use super::{Arc, ArcInner};
/// Structure to allow Arc-managing some fixed-sized data and a variably-sized
/// slice in a sing... |
use libc::{c_int,c_uchar,c_ulonglong};
use std::rand::Rng;
use serialize::{Encodable,Encoder,Decodable,Decoder};
use std::slice::MutableCloneableVector;
use super::randombytes::rng;
pub static KEYBYTES: uint = 32;
pub static NONCEBYTES: uint = 24;
pub static ZEROBYTES: uint = 32;
pub static BOXZEROBYTES: uint = 16;
#... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn parse_http_generic_error(
response: &http::Response<bytes::Bytes>,
) -> Result<smithy_types::Error, smithy_json::deserialize::Error> {
crate::json_errors::parse_generic_error(response.body(), response.headers())
}
pub fn de... |
use std::fmt;
use header;
use header::shared;
/// The `Accept-Encoding` header
///
/// The `Accept-Encoding` header can be used by clients to indicate what
/// response encodings they accept.
#[derive(Clone, PartialEq, Show)]
pub struct AcceptEncoding(pub Vec<shared::QualityItem<shared::Encoding>>);
deref!(AcceptEnc... |
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
pub enum Error {
Failed,
}
impl From<libk4a_sys::k4a_result_t> for Error {
fn from(result: libk4a_sys::k4a_result_t) -> Self {
match result {
libk4a_sys::k4a_result_t::K4A_RESULT_FAILED => Error::Failed,
_ => unreachable!(),
... |
use ::bytes::Bytes;
use ::errors::Error;
use ::futures::future::BoxFuture;
use ::futures::sink::BoxSink;
use ::futures::stream::BoxStream;
pub type BoxMqttFuture<T> = BoxFuture<T, Error>;
pub type BoxMqttSink<T> = BoxSink<T, Error>;
pub type BoxMqttStream<T> = BoxStream<T, Error>;
pub type SubItem = (String, Bytes);
... |
/*
给你一个链表,每 k 个节点一组进行翻转,请你返回翻转后的链表。
k 是一个正整数,它的值小于或等于链表的长度。
如果节点总数不是 k 的整数倍,那么请将最后剩余的节点保持原有顺序。
示例 :
给定这个链表:1->2->3->4->5
当 k = 2 时,应当返回: 2->1->4->3->5
当 k = 3 时,应当返回: 3->2->1->4->5
说明 :
你的算法只能使用常数的额外空间。
你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/reverse-nodes-in-k-grou... |
/*!
A tree-view control is a window that displays a hierarchical list of items
*/
use winapi::shared::minwindef::{WPARAM, LPARAM};
use winapi::um::winuser::{WS_VISIBLE, WS_DISABLED, WS_TABSTOP};
use winapi::um::commctrl::{HTREEITEM, TVIS_EXPANDED, TVIS_SELECTED, TVS_SHOWSELALWAYS, TVITEMW};
use crate::win32::window_he... |
//! The rectangle shape tool
use druid::{
Color, Env, EventCtx, KbKey, KeyEvent, MouseEvent, PaintCtx, Point, Rect, RenderContext,
TextLayout,
};
use crate::cubic_path::CubicPath;
use crate::design_space::DPoint;
use crate::edit_session::EditSession;
use crate::mouse::{Drag, Mouse, MouseDelegate, TaggedEvent}... |
extern crate minifb;
extern crate cpal;
extern crate futures;
#[macro_use]
extern crate clap;
extern crate combine;
extern crate rustual_boy_core;
extern crate rustual_boy_middleware;
mod argparse;
#[macro_use]
mod logging;
mod command;
mod cpal_driver;
mod emulator;
mod system_time_source;
mod wave_file_buffer_... |
// This file is part of linux-epoll. 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/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
use crate::tuples::Tuple4D;
use crate::matrices::Mat;
pub struct Transformation {
pub transformation: Mat
}
impl Transformation {
pub fn view(from: Tuple4D, to: Tuple4D, up: Tuple4D) -> Transformation {
let fwd = to.sub(&from).normalized();
let up_norm = up.normalized();
let left = fw... |
extern crate semver;
#[macro_use]
extern crate structopt;
use structopt::StructOpt;
mod filter_versions;
#[derive(StructOpt)]
#[structopt(name = "semver-cli", about = "Prints valid versions sorted by SemVer precedence")]
struct Opt {
#[structopt(short = "r", long = "range")]
range: Option<String>,
#[str... |
pub use rust::Rust;
mod rust;
pub enum TypeSection {
Line(String),
Indent(Vec<TypeSection>),
}
fn print(sections: Vec<TypeSection>, indent_size: usize, current_indent: usize) -> String {
let mut output = String::new();
for s in sections {
match s {
TypeSection::Line(line) => {
... |
use input_i_scanner::{scan_with, InputIScanner};
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
let n = scan_with!(_i_i, usize);
let s: Vec<char> = scan_with!(_i_i, String).chars().collect();
let mut ans = 0;
for i in 0..(n - 2) {
if s[i] !... |
//! Create fake blockchain data for test purposes
use crate::Storage;
use pathfinder_common::{BlockHeader, StateUpdate};
use rand::Rng;
use starknet_gateway_types::reply::transaction as gw;
pub type StorageInitializer = Vec<StorageInitializerItem>;
pub type StorageInitializerItem = (
BlockHeader,
Vec<(gw::Tra... |
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(unused_assignments)]
#![allow(unused_mut)]
use std::path;
// use util::html;
// use util::format;
use util_rust::group::Grouper;
use std::fmt::Write;
use std::collections::BTreeMap;
use connectedtext::*;
use simple::*;
//#[macro_use... |
/// LineBytes
/// You want to read a file line by line.
/// That file isn't UTF8, so you cannot read into a string or use `.lines()`.
// This little library solves that problem.
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
|
use crate::Client;
use shiplift::{builder::NetworkCreateOptionsBuilder, NetworkCreateOptions};
/// Abstraction of a Docker network
pub struct Network {
id: String,
client: Client,
}
impl Network {
/// Return a Future which resolves to a new Network.
pub async fn new(name: impl AsRef<str>) -> Result<Se... |
use nom::types::CompleteByteSlice as Input;
use value::Unit;
named!(pub unit<Input, Unit>,
alt_complete!(
// Distance units, <length> type
value!(Unit::Em, tag!("em")) |
value!(Unit::Ex, tag!("ex")) |
value!(Unit::Ch, tag!("ch")) |
value!(Unit::Rem, tag!("r... |
//use serde::de::{self, Visitor};
use serde::{Deserialize, Serialize};
//use std::fmt;
//use std::marker::PhantomData;
//use std::str::FromStr;
use std::vec::Vec;
//use void::Void;
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Pair {
pub success: bool,
pub data: V... |
use crate::rule::{engine::composition::GraphId, MatchGraph};
use crate::tokenizer::Tokenizer;
use crate::utils::regex::SerializeRegex;
use enum_dispatch::enum_dispatch;
use serde::{Deserialize, Serialize};
#[enum_dispatch]
#[derive(Serialize, Deserialize)]
pub enum Filter {
NoDisambiguationEnglishPartialPosTagFilt... |
use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::io::Buf;
use crate::postgres::types::raw::sequence::PgSequenceDecoder;
use crate::postgres::{PgData, PgRawBuffer, PgValue, Postgres};
use crate::types::Type;
use byteorder::BigEndian;
pub struct PgRecordEncoder<'a> {
buf: &'a mut PgRawBuffe... |
use std::thread::{sleep, spawn};
use tracy_client::*;
#[global_allocator]
static GLOBAL: ProfiledAllocator<std::alloc::System> =
ProfiledAllocator::new(std::alloc::System, 100);
fn fib(i: u16) -> u64 {
let span = Span::new(&format!("fib({})", i), "fib", file!(), line!(), 100);
let result = match i {
... |
pub mod wavelet;
pub trait Sequence {}
|
use demo_macro::print_things;
print_things!();
fn main() {
println!("Hello, world!");
}
|
#[doc = "Reader of register BMCMPR6"]
pub type R = crate::R<u32, super::BMCMPR6>;
#[doc = "Writer for register BMCMPR6"]
pub type W = crate::W<u32, super::BMCMPR6>;
#[doc = "Register BMCMPR6 `reset()`'s with value 0"]
impl crate::ResetValue for super::BMCMPR6 {
type Type = u32;
#[inline(always)]
fn reset_va... |
#![feature(arbitrary_self_types)]
#![feature(crate_in_paths)]
#![feature(crate_visibility_modifier)]
#![feature(in_band_lifetimes)]
#![feature(existential_impl_trait)]
#![feature(underscore_lifetimes)]
#![feature(universal_impl_trait)]
mod drop_thunk;
mod test;
pub mod layer1;
use crate::drop_thunk::DropThunk;
/// ... |
#[doc = "Reader of register TIMCCR2"]
pub type R = crate::R<u32, super::TIMCCR2>;
#[doc = "Writer for register TIMCCR2"]
pub type W = crate::W<u32, super::TIMCCR2>;
#[doc = "Register TIMCCR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::TIMCCR2 {
type Type = u32;
#[inline(always)]
fn reset_va... |
// 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 ... |
use alloc::string::String;
use alloc::vec::Vec;
use core::fmt::{Debug, Formatter};
use core::marker::PhantomData;
use core::ops::{Deref, DerefMut};
#[repr(C)]
pub struct UserPtr<T, P: Policy> {
ptr: *mut T,
mark: PhantomData<P>,
}
pub trait Policy {}
pub trait Read: Policy {}
pub trait Write: Policy {}
pub en... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::helper::{get_unix_ts, is_global};
use crate::message_processor::{MessageFuture, MessageProcessor};
use crate::net::{build_network_service, SNetworkService};
use crate::{NetworkMessage, PeerEvent, PeerMessage};
use actix::... |
// 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.
extern crate network_manager_cli_lib as network_manager_cli;
use failure::{format_err, Error, ResultExt};
use fidl::endpoints::{Proxy, ServiceMarker};
use... |
pub mod device_wsi;
pub mod instance_wsi;
pub mod physical_device_properties2;
pub mod prelude;
|
use core::result::Result::Ok;
use nom::branch::{alt, permutation};
use nom::bytes::complete::tag;
use nom::character::complete::{alphanumeric1, line_ending, space0, space1};
use nom::combinator::recognize;
use nom::error::{context, VerboseError};
use nom::multi::{many0, many1};
use nom::sequence::{pair, terminated, tup... |
#[doc = "Reader of register RPR1"]
pub type R = crate::R<u32, super::RPR1>;
#[doc = "Writer for register RPR1"]
pub type W = crate::W<u32, super::RPR1>;
#[doc = "Register RPR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::RPR1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
fn main() {
let memory: Vec<i32> = vec![1, 2, 3];
let mut mem1 = memory.clone();
mem1[1] = 2;
let mut mem2 = memory.clone();
println!("{}", mem2[1])
}
|
pub struct Solution;
impl Solution {
pub fn get_skyline(buildings: Vec<Vec<i32>>) -> Vec<Vec<i32>> {
if buildings.is_empty() {
return Vec::new();
}
let mut res = Vec::new();
let mut pts: List = None;
for b in buildings {
let (l, r, h) = (b[0], b[1], b... |
use log::{error, info};
use std::error::Error;
use std::io::{Read, Write};
use std::net::TcpStream;
use std::path::Path;
use std::{fmt, fs};
/// Request-Line = Method SP Request-URI SP HTTP-Version CRLF
struct Request<'a> {
method: &'a str,
uri: &'a Path,
http_version: &'a str,
}
impl<'a> fmt::Display fo... |
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::match_function_call;
use clippy_utils::paths::FUTURE_FROM_GENERATOR;
use clippy_utils::source::{position_before_rarrow, snippet_block, snippet_opt};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::intravisit::FnKind;
use rustc_... |
use crate::raw_volume::RawVolume;
use crate::region::Region;
use crate::sampler::Sampler;
use crate::volume::{PositionError, Volume};
use crate::voxel::Voxel;
use vek::vec3::Vec3;
pub struct RawVolumeSampler<'a, T>
where
T: Voxel,
{
data: &'a Vec<T>,
valid_region: Region,
x_pos: i32,
y_pos: i32,
... |
// Copyright 2018 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 ... |
#![feature(destructuring_assignment)]
#![feature(map_into_keys_values)]
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
pub use self::newomegaranked::NewOmegaRanked;
pub use self::newomegaranked::PlayerDefence;
/// The logic for all ranked fights between players. Connected to Fight Management
/// in o... |
// Convenient reexports for internal uses.
pub(crate) use errno::prelude::*;
pub(crate) use std::sync::Arc;
cfg_if::cfg_if! {
if #[cfg(feature = "sgx")] {
pub(crate) use std::prelude::v1::*;
pub(crate) use std::sync::{SgxMutex as Mutex, SgxRwLock as RwLock, SgxMutexGuard as MutexGuard};
} else ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.