text stringlengths 8 4.13M |
|---|
#[cfg(feature = "nalgebra_math")]
/// Only if nalgebra_math feature is enabled
pub use crate::math::nalgebra::*;
#[cfg(feature = "nalgebra_glm_math")]
/// Only if nalgebra_math feature is enabled
pub use crate::math::nalgebra_glm::*;
#[cfg(feature = "native_math")]
/// Only if native_math feature is enabled
pub use c... |
#[doc = "Reader of register MEMRMP"]
pub type R = crate::R<u32, super::MEMRMP>;
#[doc = "Writer for register MEMRMP"]
pub type W = crate::W<u32, super::MEMRMP>;
#[doc = "Register MEMRMP `reset()`'s with value 0"]
impl crate::ResetValue for super::MEMRMP {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
// 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 mod api_key;
pub mod error;
pub mod header;
pub mod record;
use rskafka_wire_format::error::ParseError;
use rskafka_wire_format::prelude::*;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct BrokerId(pub(crate) i32);
impl WireFormatParse for BrokerId {
fn parse(input: &[u8]) -> IResult<&[u8], Sel... |
// 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, ResultExt};
use fidl::endpoints::{create_endpoints, ClientEnd};
use fidl_fuchsia_mediaplayer::TimelineFunction;
use fidl_fuchsia_media... |
// Copyright 2012-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-MI... |
use shipyard::Component;
use wasm_bindgen::JsCast;
use web_sys::{Window, Document, HtmlElement, HtmlCanvasElement, WebGlRenderingContext};
use wasm_bindgen::prelude::*;
use awsm_web::window::get_window_size;
use awsm_web::webgl::{
get_webgl_context_1,
WebGlContextOptions,
};
use std::rc::Rc;
use std::cell::Re... |
use crate::Region;
use game_lib::bevy::{
asset as bevy_asset,
core::{self as bevy_core, Byteable},
prelude::*,
reflect::TypeUuid,
render::{
self as bevy_render,
renderer::{RenderResource, RenderResources},
},
};
#[derive(Clone, Debug, RenderResources, TypeUuid)]
#[uuid = "ffa702... |
// 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.
#[macro_use]
pub mod testing;
mod banjo_library;
mod cc_prebuilt_library;
mod cc_source_library;
mod common;
mod dart_library;
mod device_profile;
mod docu... |
// use std::{path::Path, fs::File, io::BufReader};
// use mp4::{Mp4Reader, Mp4Box, Result};
// #[derive(Debug, Clone, PartialEq, Default)]
// pub struct Box {
// pub name: String,
// pub size: u64,
// pub summary: String,
// pub indent: u32,
// }
// pub fn get_boxes(file: File) -> Result<Vec<Box>> {
/... |
//! Utilities used during the initial setup
use crate::Pool;
use actix_web::middleware::Logger;
use blake2::{Blake2b, Digest};
use diesel::{
r2d2::{self, ConnectionManager},
sqlite::SqliteConnection,
};
use std::{env, path::PathBuf};
#[cfg(not(feature = "dev"))]
use dirs;
#[cfg(feature = "dev")]
use dotenv;
#... |
use crate::event::{LogEvent, Value};
use bytes::{Bytes, BytesMut};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub enum MergeStrategy {
Discard,
Sum,
Max,
Min,
Array,
Concat,
}
//---------... |
use super::super::{Model, Var, EqXY, NeqXY, EqXYC, NeqXYC, EqXC, NeqXC};
use super::{NeqXYCxy};
#[test]
fn neqxycxy_does_propagate() {
let m = Model::new();
let x = Var::new(m.clone(), -2, 255, "x");
let y = Var::new(m.clone(), 10, 10, "y");
NeqXYCxy::new(m.clone(), x.clone(), y.clone(), -11);
asse... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use rocket::response::NamedFile;
extern crate diesel;
#[macro_use] extern crate serde_derive;
use rocket_contrib::templates::Template;
use std::path::{Path, PathBuf};
#[derive(Serialize)]
struct TemplateContext {
items: Vec<&'static str>... |
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: usize = rd.get();
let s: String = rd.get();
let s: Vec<char> = s.chars().collect();
let total: u64 = 1_000_000_000_0;
if n == 1 {
println!("{}", if s[0] == '0' { total } else { total * 2 ... |
use std::ops::Range;
use std::str::FromStr;
use firefly_diagnostics::{ByteOffset, SourceIndex, SourceSpan};
use firefly_intern::Symbol;
use firefly_number::{Float, FloatError, Integer};
use firefly_parser::{Scanner, Source};
use crate::util::escape_stm::{EscapeStm, EscapeStmAction};
use super::errors::LexicalError;... |
use juniper::{graphql_scalar, InputValue, ScalarValue, Value};
struct ScalarSpecifiedByUrl;
#[graphql_scalar(
specified_by_url = "not an url",
with = scalar,
parse_token(i32),
)]
type Scalar = ScalarSpecifiedByUrl;
mod scalar {
use super::*;
pub(super) fn to_output<S: ScalarValue>(_: &ScalarSpec... |
pub fn combinations<T: Copy>(k: usize, li: &[T]) -> Vec<Vec<T>> {
fn comb_rec<T: Copy>(k: usize, rem: &[T], acc: &Vec<T>) -> Vec<Vec<T>> {
if k == 1 {
rem.into_iter()
.map(|&x| {
let mut acc2 = acc.clone();
acc2.push(x);
... |
use crate::Space::*;
use std::collections::HashMap;
enum Space {
Floor,
Empty,
Occupied,
}
fn get_input() -> HashMap<(i64, i64), Space> {
let mut map = HashMap::new();
include_str!("../input.txt")
.lines()
.enumerate()
.for_each(|(y, line)| {
line.chars().enume... |
use neon::prelude::*;
use manifest::StreamType;
use ::MANIFEST;
/// # Arguments
/// None
///
/// # Return
/// A string containing the loaded manifest's root node ID.
///
/// # Exceptions
/// Throws if there is no loaded manifest.
pub fn get_root_node_id(mut cx: FunctionContext) -> JsResult<JsString> {
if let ... |
#![feature(nll)]
pub mod scheme;
use scheme::interpreter::Interpreter;
fn main() {
let mut interp = Interpreter::new();
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
interp.run_once(&args[1]);
} else {
interp.run_repl();
}
}
|
mod back_of_house {
//公有结构体
pub struct Breakfast {
//公有字段 toast
pub toast: String,
//私有字段 seasonal_fruit
seasonal_fruit: String,
}
impl Breakfast {
//添加关联方法
pub fn summer(toast: &str) -> Breakfast {
Breakfast {
toast: Strin... |
use crate::model::*;
use crate::util;
use std::collections::VecDeque;
use std::fmt::Write;
use std::io::{copy, Read, Seek};
use std::path::{Path, PathBuf};
use std::vec::Vec;
use hyper;
use hyper_rustls;
use id3;
use log;
use select::document::Document;
use select::predicate::{Class, Name, Predicate};
use tempfile;
u... |
pub struct Handler {}
impl Handler {
pub fn new() -> Handler {
Handler {}
}
}
|
#![crate_name="albino"]
#![crate_type="bin"]
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
extern crate whitebase;
extern crate albino;
use std::os;
use std::io::process::{Command,InheritFd,ExitStatus,ExitSignal};
fn main() {
debug!("executing; cmd=albino; args={}", os::args());
let (cmd, arg... |
pub struct Physics {
pub x: f32,
pub y: f32,
pub vx: f32,
pub vy: f32,
}
pub fn inertia(dt: f32, physics: &mut Physics)
{
physics.x = position_wrapped_horizontal(physics.x, physics.vx, dt);
physics.y = position_wrapped_vertical (physics.y, physics.vy, dt);
}
fn position_wrapped_horizontal(x... |
extern crate byteorder;
use std::*;
use self::byteorder::*;
pub struct Sha256 {
working_hash: [u32; 8],
total_data_len: u64,
tmp_data: [u8; 64],
tmp_data_len: usize,
hash: [u8; 32],
}
const K256: [u32; 64] = [
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5... |
use super::control_handle::ControlHandle;
use crate::win32::{window_helper as wh, window::build_notice};
use crate::NwgError;
const NOT_BOUND: &'static str = "Notice is not yet bound to a winapi object";
const UNUSABLE_NOTICE: &'static str = "Notice parent window was freed";
const BAD_HANDLE: &'static str = "INTERNAL... |
use super::core::*;
use super::editor::*;
use super::notebook::*;
use super::super::host::*;
use desync::Desync;
use std::sync::*;
///
/// A script host for Gluon scripts
///
/// See [https://gluon-lang.org] for details on this language.
///
pub struct GluonScriptHost {
/// The core is used to execute the scrip... |
/// Describes the types instruction and operands can take.
use crate::ir;
use serde::{Deserialize, Serialize};
use std::fmt;
use utils::*;
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Serialize, Deserialize)]
/// Values and intructions types.
pub enum Type {
/// Type for integer values, with a fixed number of... |
pub struct Solution;
impl Solution {
pub fn add_digits(num: i32) -> i32 {
let mut num = num;
while num >= 10 {
let mut tmp = 0;
while num > 0 {
tmp += num % 10;
num /= 10;
}
num = tmp;
}
num
}
}
#[t... |
// 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... |
extern crate serialize;
extern crate flate2;
extern crate curl;
extern crate tar;
use self::flate2::reader::GzDecoder;
use std::io::{BufReader, IoResult};
use self::tar::Archive;
use self::curl::http;
pub enum DowntarError {
HttpError,
UntarError
}
fn untar_stream (stream: BufReader, dest: &Path) -> IoResult<()>... |
#[doc = "Reader of register IER"]
pub type R = crate::R<u32, super::IER>;
#[doc = "Writer for register IER"]
pub type W = crate::W<u32, super::IER>;
#[doc = "Register IER `reset()`'s with value 0"]
impl crate::ResetValue for super::IER {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use anyhow::{bail, Result};
use glacier::{TestResult, Outcome};
use rayon::prelude::*;
fn main() -> Result<()> {
let failed = glacier::test_all()?
.filter(|res| {
if let Ok(test) = res {
eprint!("{}", test.outcome_token());
test.outcome() != Outcome::ICEd
... |
// 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::{format_err, Error, Fail};
use fidl_fuchsia_auth::AuthProviderStatus;
use fidl_fuchsia_web::NavigationControllerError;
/// An extension trait... |
// 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 ... |
//! Persistent fs backed repo.
//!
//! Consists of [`FsDataStore`] and [`FsBlockStore`].
use crate::error::Error;
use async_trait::async_trait;
use std::fs::File;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::Semaphore;
use super::{BlockRm, BlockRmError, Column, DataStore, Lock, LockError, RepoCid};
/... |
use serial::SerialPort;
use std::env;
use std::io::{Read, Write};
use std::net::UdpSocket;
const SETTINGS: serial::PortSettings = serial::PortSettings {
baud_rate: serial::Baud115200,
char_size: serial::Bits8,
parity: serial::ParityNone,
stop_bits: serial::Stop1,
flow_control: serial::FlowNone,
};
... |
//! This module contains code that "unpivots" annotated
//! [`RecordBatch`]es to [`Series`] and [`Group`]s for output by the
//! storage gRPC interface
use arrow::{
self,
array::{downcast_array, Array, BooleanArray, DictionaryArray, StringArray},
compute,
datatypes::{DataType, Int32Type, SchemaRef},
... |
pub mod structs;
pub fn new_command(command: structs::CommandType, data: &str) -> structs::Command {
structs::Command {
command: command,
data: String::from(data)
}
}
|
use {
crate::{
controls::{ControlBindings, PlayerControlBundle},
state::MainMenuState,
systems::{CubeSystem, ViewBobbingSystem},
terrain::render::ChunkRenderMesherSystem,
ui::CursorGrabBundle,
},
rough::{
amethyst::{
self,
assets::Prefa... |
use chrono::Duration;
use histogram::Histogram;
use request_result::RequestResult;
pub struct RunInfo {
/// Number of requests successfully completed
pub requests_completed: usize,
pub duration: Duration,
pub histogram: Histogram,
/// Number of failed requests
pub num_failed_requests: usize,
}
... |
#![allow(unused_variables)]
#![allow(unused_imports)]
use std::env;
fn main()
{
let args: env::Args = env::args();
println!("test");
}
|
#![feature(ascii_ctype)]
use std::ascii::AsciiExt;
pub fn rotate(s: &str, shift: u8) -> String {
s.chars().map(|c| rotate_char(c, shift)).collect()
}
fn rotate_char(c: char, shift: u8) -> char {
if !c.is_ascii_alphabetic() {
return c;
}
let offset = if c.is_ascii_lowercase() { 97 } else { 65 ... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Globalization_Collation")]
pub mod Collation;
#[cfg(feature = "Globalization_DateTimeFormatting")]
pub mod DateTimeFormatting;
#[cfg(feature = "Globalization_Fonts")]
pub mod... |
use std::path::PathBuf;
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, PrintDiagnosticsPlugin},
math::{vec2, vec3, vec4},
prelude::*,
render::{
camera::{Camera, OrthographicProjection, PerspectiveProjection, WindowOrigin},
pipeline::{DynamicBinding, PipelineDescriptor, PipelineSpe... |
use crate::stdio_server::input::{PluginAction, PluginEvent};
use crate::stdio_server::plugin::{Action, ActionType, ClapAction, ClapPlugin, PluginId};
use crate::stdio_server::vim::Vim;
use anyhow::{anyhow, Result};
#[derive(Debug, Clone)]
pub struct SystemPlugin {
vim: Vim,
}
impl SystemPlugin {
pub const ID:... |
pub use VkGeometryFlagsNV::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkGeometryFlagsNV {
VK_GEOMETRY_OPAQUE_BIT_NV = 0x0000_0001,
VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV = 0x0000_0002,
}
use crate::SetupVkFlags;
#[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub... |
use crate::reader::get_lines;
#[derive(Debug)]
enum Error {
Unmatched(char, char),
Missing(Vec<char>),
}
fn get_error_score_for_line(line: &str) -> Option<u64> {
if let Err(Error::Unmatched(expected, _found)) = parse_line(line) {
match expected {
'>' => Some(25137),
'}' => ... |
/// Main modules to perform the low-level operations
/// described in the Olin specs. In particular the basic
/// "actions": open, read, write, close, flush on files.
///
/// Modules:
/// * sys
/// * err
/// * log
/// * env
/// * runtime
/// * startup
/// * time
/// * stdio
/// * random
///
/// The ```Resource``` struc... |
pub struct Solution;
impl Solution {
pub fn is_number(s: String) -> bool {
let mut iter = s.chars().peekable();
consume_spaces(&mut iter);
consume_sign(&mut iter);
let mut has_digits = consume_digits(&mut iter);
if consume_point(&mut iter) {
has_digits |= consume... |
// Copyright 2018 Parity Technologies (UK) Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, mer... |
use gameboy;
use cart;
const WRAM_SIZE: usize = 0xDFFF - 0xC000 + 1;
const VRAM_SIZE: usize = 0x9FFF - 0x8000 + 1;
const XRAM_SIZE: usize = 0xBFFF - 0xA000 + 1;
const HRAM_SIZE: usize = 0xFFFE - 0xFF80 + 1;
const IO_SIZE: usize = 0xFF7F - 0xFF01 + 1;
use std::ops::{Index, IndexMut, Range};
pub struct Memory {
cou... |
use core::fmt;
use std::io;
use serde::{de, ser};
// derive nothing here by now
pub struct Error {
err: Box<ErrorImpl>,
}
pub type Result<T> = core::result::Result<T, Error>;
struct ErrorImpl {
code: ErrorCode,
index: usize, // index == 0: index is not necessary
}
pub(crate) enum ErrorCode {
Messag... |
use crate::blog::Blog;
use crate::shared::path_title;
use crate::tag::Tag;
use std::collections::HashMap;
use std::str;
use std::string::String;
// Currently just index of a blog or tag in vector
pub type BlogHandle = usize;
pub type TagHandle = usize;
// Construction procedure:
// BlogCluster construction
// Add ta... |
pub mod nacp;
pub mod nxo;
pub mod pfs0;
pub mod romfs;
pub mod npdm;
mod utils;
|
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkMacOSSurfaceCreateInfoMVK {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkMacOSSurfaceCreateFlagBitsMVK,
pub pView: *const c_void,
}
impl VkMacOSSurfaceCreateInfoMVK {
// T... |
//! Task notification.
#[macro_use]
mod poll;
mod spawn;
pub use self::spawn::{Spawn, LocalSpawn, SpawnError};
#[doc(hidden)]
pub mod __internal;
pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
|
use super::super::types::DBConnection;
use super::super::ClientExtra;
pub fn get(conn: &DBConnection, node_name: &str) -> postgres::Result<Option<ClientExtra>> {
ctrace!("Query client extra by name {}", node_name);
let rows = conn.query("SELECT * FROM client_extra WHERE name=$1;", &[&node_name])?;
if rows... |
use std::fmt;
use std::ops::{
Add,
AddAssign,
Div,
DivAssign,
Index,
Mul,
MulAssign,
Neg,
Sub,
};
use crate::util::{random_double, random_double_range};
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Vec3(f64, f64, f64);
pub type Point3 = Vec3;
pub type Color = Vec3;
impl Ve... |
//! Массив этажей
//!
//! Каждый элемент массива - отдельный этаж, со всеми графическими элементами
mod beam;
mod column;
mod diagram;
mod f_beam;
mod f_slab;
mod found;
mod lean_on_slab;
mod load;
mod node;
mod openings;
mod part;
mod pile;
mod poly;
mod sec;
mod sigs_raw;
mod slab;
mod unification_found;
mod unificat... |
// 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 (c) 2017 Martijn Rijkeboer <mrr@sru-systems.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or dis... |
// 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 ... |
use crate::backend::c;
/// A signal number for use with [`kill_process`], [`kill_process_group`],
/// and [`kill_current_process_group`].
///
/// [`kill_process`]: crate::process::kill_process
/// [`kill_process_group`]: crate::process::kill_process_group
/// [`kill_current_process_group`]: crate::process::kill_curren... |
//!
//! Create `enum` objects
//!
//!
//! Example
//! -------
//! ```
//! use proffer::*;
//!
//! let e = Enum::new("Foo")
//! .add_variant(Variant::new("A"))
//! .add_variant(Variant::new("B").set_inner(Some("(T)")).to_owned())
//! .add_generic(Generic::new("T"))
//! .to_owned();
//!
//! let src_code =... |
#[macro_use]
mod macros;
mod core;
pub use crate::core::TestDir;
|
/* multi-line comment */
// fn is keyword for function
// main is a mandatory function name, similar to C, C++, Java
// repl.it can be used as a web-based compiler to avoid having to compile on your computer each time
// play.rust-lang.org is also provided by the creators of Rust as a sandbox
fn main () {
printl... |
#![allow(non_upper_case_globals)]
use Word;
// Destination opcodes
const OPCODE_DST_Null : Word = 0b000;
const OPCODE_DST_M : Word = 0b001;
const OPCODE_DST_D : Word = 0b010;
const OPCODE_DST_MD : Word = 0b011;
const OPCODE_DST_A : Word = 0b100;
const OPCODE... |
use semver;
use url;
use url::Url;
use std::fmt;
use std::fmt::{Show,Formatter};
use serialize::{
Encodable,
Encoder,
Decodable,
Decoder
};
use util::{CargoError, FromError};
trait ToVersion {
fn to_version(self) -> Option<semver::Version>;
}
impl ToVersion for semver::Version {
fn to_version... |
use std::fmt;
use std::io;
use std::path::{Path, PathBuf};
use crate::platform::traits::*;
use crate::units::{ElectricPotential, Energy, Power, Ratio, ThermodynamicTemperature};
use crate::{Error, Result, State, Technology};
use super::sysfs::{fs, DataBuilder, InstantData, Scope, Type};
pub struct SysFsDevice {
... |
#[doc = "Reader of register FLTCR"]
pub type R = crate::R<u32, super::FLTCR>;
#[doc = "Writer for register FLTCR"]
pub type W = crate::W<u32, super::FLTCR>;
#[doc = "Register FLTCR `reset()`'s with value 0"]
impl crate::ResetValue for super::FLTCR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
/*
The following bug was in Rule v0.5.12.
This bug is fixed in v0.6 but is incompatible with past releases.
For easier reading we're using the Grammer API.
We add two new rules:
grammer.add("block", "(<stmt>( <stmt>)*)?", Some(Box::new(block)));
grammer.add("root", " <block> ", Some(Box::... |
use aws_lambda_events::{
encodings::Body,
event::apigw::{
ApiGatewayProxyRequest, ApiGatewayProxyResponse,
},
};
use http::HeaderMap;
use lambda_runtime::{handler_fn, Context, Error};
#[tokio::main]
async fn main() -> Result<(), Error> {
dbg!("cold start");
let handler_fn = handler_fn(handl... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Win32_Storage_Packaging_Appx")]
pub mod Appx;
#[cfg(feature = "Win32_Storage_Packaging_Opc")]
pub mod Opc;
|
#![feature(c_variadic)]
#![feature(sgx_platform)]
pub mod file;
pub mod thread;
pub mod mutex;
pub mod other;
|
#[cfg(feature = "libm")]
#[allow(unused_imports)]
use num_traits::Float;
pub(crate) trait FloatEx {
/// Returns a very close approximation of `self.clamp(-1.0, 1.0).acos()`.
fn acos_approx(self) -> Self;
}
impl FloatEx for f32 {
#[inline(always)]
fn acos_approx(self) -> Self {
// Based on http... |
// 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... |
// pathfinder/path-utils/src/cubic.rs
//
// Copyright © 2017 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file m... |
//! File system with block support
//!
//! Create a filesystem that only has a notion of blocks, by implementing the [`FileSysSupport`] and
//! the [`BlockSupport`] traits together (you have no other choice, as the first one is a supertrait of the second).
//!
//! [`FileSysSupport`]: ../../cplfs_api/fs/trait.FileSysSup... |
use core::marker;
use {Async, Poll};
use stream::Stream;
/// A stream which is just a shim over an underlying instance of `Iterator`.
///
/// This stream will never block and is always ready.
#[derive(Debug)]
#[must_use = "streams do nothing unless polled"]
pub struct IterOk<I, E> {
iter: I,
_marker: marker::... |
#[doc = "Reader of register FIFOCTL"]
pub type R = crate::R<u32, super::FIFOCTL>;
#[doc = "Writer for register FIFOCTL"]
pub type W = crate::W<u32, super::FIFOCTL>;
#[doc = "Register FIFOCTL `reset()`'s with value 0"]
impl crate::ResetValue for super::FIFOCTL {
type Type = u32;
#[inline(always)]
fn reset_va... |
use std::str;
fn main() {
let x: &[u8] = &[b'c', b'l', b'i', b'f', b'f'];
let stack_str: &str = str::from_utf8(x).unwrap();
println!("{}", stack_str);
}
|
use openxr::{
vulkan::SessionCreateInfo, ApplicationInfo, EnvironmentBlendMode, ExtensionSet, FormFactor,
FrameStream, FrameWaiter, Instance as OpenXRInstance, Session, SystemId, SystemProperties,
ViewConfigurationProperties, ViewConfigurationType, ViewConfigurationView, Vulkan,
};
use utilities::prelude::... |
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at ... |
#![allow(warnings)]
#![feature(link_args)]
#![feature(link_args)]
#[link_args = "-s EXPORTED_FUNCTIONS=['_exec']"]
#[macro_use]
extern crate dump;
#[macro_use]
extern crate stdweb;
extern crate euclid;
extern crate cgmath;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
mod sim;
use sim::*;
use s... |
mod camera;
mod hitable_list;
mod material;
mod ray;
mod sphere;
mod vec3;
use crate::camera::Camera;
use crate::hitable_list::HitableList;
use crate::material::{Lambertian, Metal};
use crate::ray::Ray;
use crate::sphere::Sphere;
use crate::vec3::Vec3;
use rand::random;
use std::fs::File;
use std::io::{BufWriter, Wri... |
use crate::OutputChannel;
use crate::error::*;
use super::{RUNTIME};
use log::{error};
use nitox::{commands::*, NatsClient};
use futures::{prelude::*, future};
use prometheus::{IntCounter, Histogram};
pub struct NatsOutput {
subject: String,
nats_client: NatsClient,
msg_send_histogram: Histogram,
sen... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qsizepolicy.h
// dst-file: /src/widgets/qsizepolicy.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block be... |
use lettre::smtp::authentication::{Credentials, Mechanism};
use lettre::{SendableEmail, SmtpClient, SmtpTransport, Transport};
use lettre_email::EmailBuilder;
pub fn send_email(
email: &String,
name: &String,
subject: &String,
body: &String,
email_address: &String,
email_password: &String,
... |
use std::fmt;
/// http://paulbourke.net/dataformats/ply/
pub mod standard_formats {
use super::{PlyFormat, PlyFormatVersion};
pub const ASCII_10: PlyFormat = PlyFormat::Ascii(PlyFormatVersion::get(1, 0));
}
pub struct PlyFileHeader {
pub format: PlyFormat,
pub elements: Vec<PlyElementDescriptor>,
}
#[derive(C... |
use nalgebra_glm as glm;
pub enum CameraDirection {
Forward,
Backward,
Left,
Right,
}
pub struct Camera {
pub position: glm::Vec3,
right: glm::Vec3,
pub front: glm::Vec3,
up: glm::Vec3,
world_up: glm::Vec3,
speed: f32,
sensitivity: f32,
yaw_degrees: f32,
pitch_degre... |
//! dbase is rust library meant to read and write
//!
//! # Reading
//!
//! To Read the whole file at once you should use the [read](fn.read.html) function.
//!
//! Once you have access to the records, you will have to `match` against the real
//! [FieldValue](enum.FieldValue.html)
//!
//! # Examples
//!
//! ```
//! us... |
use std::env::args;
use std::fs::File;
use std::io::{BufWriter, Result, Write};
use grass::algorithm::AssumeSorted;
use grass::algorithm::SortedIntersect;
use grass::properties::Serializable;
use grass::records::{Bed3, Bed4};
use grass::{chromset::LexicalChromRef, LexicalChromSet, LineRecordStreamExt};
fn main() -> ... |
mod logfile;
mod iter;
pub use self::logfile::*;
|
use super::*;
#[derive(Clone)]
pub struct Assignment {
var: Variable,
constant: Constant
}
impl Assignment {
pub fn new(var: Variable, c: Constant) -> Assignment {
Assignment {
var: var,
constant: c,
}
}
pub fn variable(&self) -> &Variable {
&self.v... |
use crate::game_data::locale;
use chrono::Duration;
use itertools::Itertools;
use serde::Deserialize;
use serde_with::{serde_as, CommaSeparator, DisplayFromStr, DurationSeconds, StringWithSeparator};
#[serde_as]
#[derive(Debug, Deserialize)]
pub struct ItemSpecifier {
pub name: String,
#[serde_as(as = "Display... |
#[doc = "Reader of register CR"]
pub type R = crate::R<u32, super::CR>;
#[doc = "Writer for register CR"]
pub type W = crate::W<u32, super::CR>;
#[doc = "Register CR `reset()`'s with value 0"]
impl crate::ResetValue for super::CR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
//! Defines functionality for the property tag interface of the BCM2837 mailbox system.
//!
//! There is some documentation on the various tags that are supported by this interface on the
//! [Raspberry Pi Wiki], along with information which defines most of the implementation used in
//! this module.
//!
//! Currently ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.