text
stringlengths
8
4.13M
#[doc = "Reader of register CIER"] pub type R = crate::R<u32, super::CIER>; #[doc = "Writer for register CIER"] pub type W = crate::W<u32, super::CIER>; #[doc = "Register CIER `reset()`'s with value 0"] impl crate::ResetValue for super::CIER { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
// 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 { char_set::CharSet, failure::{format_err, Error}, font_info::{FontAssetSource, FontInfo, FontInfoLoader}, std::{collections::BTreeSet,...
use near_sdk::{ borsh::{self, BorshDeserialize, BorshSerialize}, }; use std::ops::Add; #[derive( BorshSerialize, BorshDeserialize, Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Default, )] pub struct EpochHeight(pub u64); impl From<u64> for EpochHeight { ...
use crate::{ crypto::{Methods, Provider}, error::ArweaveError, }; use borsh::BorshDeserialize; type Error = ArweaveError; /// Single struct used for chunks and nodes. #[derive(Debug, PartialEq, Clone)] pub struct Node { pub id: [u8; HASH_SIZE], pub data_hash: Option<[u8; HASH_SIZE]>, pub min_byte_r...
extern crate futures; use std::sync::mpsc::channel; use futures::prelude::*; use futures::sync::oneshot; use futures::future::{err, ok}; mod support; use support::*; #[test] fn map() { // Whatever runs after a `map` should have dropped the closure by that // point. let (tx, rx) = channel::<()>(); le...
// This file is part of syslog2. 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/syslog2/master/COPYRIGHT. No part of syslog2, including this file, may be copied, modified, propagated, or distributed except...
pub mod state; pub mod setting;
//! Contains methods for initializing the lua config #![allow(dead_code)] use std::fs::{OpenOptions, File}; use std::env; use std::path::{Path,PathBuf}; use std::io::Result as IOResult; pub const INIT_FILE: &'static str = "init.lua"; pub const INIT_FILE_FALLBACK_PATH: &'static str = "/etc/way-cooler/"; pub const DE...
/* * 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 ...
use std::borrow::Borrow; use std::convert::{Into, TryFrom}; use std::marker::PhantomData; use std::{cmp, fmt, hash, ops}; use unsigned_varint::{decode as varint_decode, encode as varint_encode}; use crate::errors::{DecodeError, DecodeOwnedError}; use crate::hashes::Code; use crate::storage::Storage; // It would be n...
//! A mock implementation of [`NamespaceResolver`]. #![allow(missing_docs)] use std::{ collections::{BTreeMap, HashMap}, sync::Arc, }; use async_trait::async_trait; use data_types::{NamespaceId, NamespaceName, NamespaceSchema}; use parking_lot::Mutex; use super::NamespaceResolver; #[derive(Debug, Default)]...
use std::collections::HashMap; use std::env; use std::ffi::c_void; use std::fs::File; use std::io::{self, Error, Read, Write}; use std::mem; use std::os::windows::io::AsRawHandle; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::ptr; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use std::thr...
pub fn merge_alternately(word1: String, word2: String) -> String { let mut letters_one = word1.chars(); let mut letters_two = word2.chars(); let mut characters = vec![]; for _ in 0..word1.len().max(word2.len()) { if let Some(c) = letters_one.next() { characters.push(c); } ...
// This file is copied from http://github.com/tendermint/abci // NOTE: When using custom types, mind the warnings. // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues //---------------------------------------- // Request types #[derive(Clone, PartialEq, ::prost::Message)] pub struct Re...
/// Blah #[derive(PartialEq)] pub enum HostType { /// Blah Server, /// Blah Client, }
extern crate rustc_serialize; use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable)] pub struct Todo { id: i32, title: String, } fn main() { let obj = Todo { id: 1, title: "Create web".to_string(), }; let enc = json::encode(&obj).unwrap(); println!("{:?}", enc); let dec:...
use alloc::alloc::{AllocError, Allocator, Global, Layout}; use core::cell::UnsafeCell; use core::mem; use core::ptr::{self, NonNull}; use firefly_alloc::heap::Heap; use crate::term::Term; pub struct ProcessHeap { range: *mut [u8], top: UnsafeCell<*mut u8>, } impl ProcessHeap { const DEFAULT_HEAP_SIZE: us...
//! Mappings between variable names use varisat_formula::{lit::LitIdx, Var}; const NO_VAR_IDX: LitIdx = Var::max_count() as LitIdx; /// A mapping from variables to variables. #[derive(Default)] pub struct VarMap { mapping: Vec<LitIdx>, } impl VarMap { /// Look up a variable in the mapping pub fn get(&se...
//#![deny(unused_extern_crates)] extern crate bigneon_api; extern crate dotenv; extern crate log; extern crate log4rs; use bigneon_api::config::{Config, Environment}; use bigneon_api::server::Server; use dotenv::dotenv; fn main() { log4rs::init_file("log4rs.yaml", Default::default()).unwrap(); dotenv().ok(); ...
use crate::codec::{Decode, Encode}; use crate::{remote_type, RemoteEnum, Vector3}; mod button; mod canvas; mod input_field; mod panel; mod rect_transform; mod text; pub use self::button::*; pub use self::canvas::*; pub use self::input_field::*; pub use self::panel::*; pub use self::rect_transform::*; pub use self::te...
#[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::DMAIM { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
use order_and_chaos::{Game, GameStatus, Move, MoveType, Player, Strategy}; #[macro_use] extern crate conrod_core; extern crate conrod_glium; #[macro_use] extern crate conrod_winit; extern crate find_folder; extern crate glium; mod support; use conrod_core::{ color, widget, Borderable, Colorable, Labelable, Posit...
/// Represents a type which can have functions applied to it (implemented /// by default for all types). pub trait ValueExtUnstable { /// Apply a function to `self` **u**n**t**upling `self`. /// /// # Examples /// ``` /// use fntools::unstable::ValueExtUnstable; /// /// let val = (3, 4).appl...
mod toolsbox; #[allow(dead_code)] #[cfg(test)] #[cfg_attr(test, macro_use)] extern crate quickcheck; #[cfg(test)] mod tests { fn reverse<T: Clone>(xs: &[T]) -> Vec<T> { let mut rev = vec![]; for x in xs.iter() { rev.insert(0, x.clone()) } rev } quickcheck! { ...
fn main() { let mut first = 0; let mut second = 1; print!("{} {}", first, second); for _ in 0..8 { let third = first + second; print!(" {}", third); first = second; second = third; } println!(""); }
//! Authenticate request with RustCrypto's HMAC implementation. // WASM extern crate cfg_if; extern crate wasm_bindgen; // RustCrypto extern crate hmac; extern crate sha2; mod utils; use cfg_if::cfg_if; use wasm_bindgen::prelude::*; use hex::FromHex; use hmac::{Hmac, Mac}; use sha2::Sha512; type HmacSha512 = Hmac...
use crate::tests::X; use std::{borrow::Cow, io}; use super::*; fn raw(s: &str) -> io::Result<Cow<[u8]>> { Ok(s.as_bytes().into()) } #[test] fn string_loader_ok() { let raw = raw("Hello World!"); let loaded = StringLoader::load(raw, "").unwrap(); assert_eq!(loaded, "Hello World!"); } #[test] fn stri...
pub mod endpoint; pub mod event; pub mod http; pub mod message; pub mod session_client; pub mod session_server;
use pin_project::pin_project; mod error; mod io; mod spawn; #[pin_project] #[derive(Copy, Clone, Debug)] pub struct Compat<T> { #[pin] inner: T, } impl<T> Compat<T> { pub fn new(inner: T) -> Self { Compat { inner } } } pub(crate) trait LocalFrom<T> { fn from(t: T) -> Self; }
use crate::{ builtins::PyFloat, object::{AsObject, PyObject, PyObjectRef, PyPayload, PyRef, PyResult}, Py, VirtualMachine, }; use num_traits::ToPrimitive; /// Implemented by any type that can be created from a Python object. /// /// Any type that implements `TryFromObject` is automatically `FromArgs`, and ...
/* * Firecracker API * * RESTful public-facing API. The API is accessible through HTTP calls on specific URLs carrying JSON modeled data. The transport medium is a Unix Domain Socket. * * The version of the OpenAPI document: 0.25.0 * Contact: compute-capsule@amazon.com * Generated by: https://openapi-generator.t...
use structopt::StructOpt; #[derive(StructOpt)] pub struct Cli { #[structopt(parse(from_os_str))] pub path: std::path::PathBuf, }
#![deny(clippy::all)] #![allow(dead_code, non_snake_case)] #![feature(proc_macro_hygiene, decl_macro)] use num::{bigint::Sign, BigInt, BigUint, One, Zero}; use rand::{self, RngCore}; pub mod chal18; pub mod chal23; pub mod chal24; pub mod chal28; pub mod chal29; pub mod chal30; pub mod chal31; pub mod chal36; pub mod...
mod oo_blog; mod states_as_types_blog; fn main() { oo_blog(); states_as_types_blog(); } fn oo_blog() { let mut post = oo_blog::Post::new(); post.add_text("I ate a salad for lunch today"); assert_eq!("", post.content()); post.request_review(); post.add_text("This text should be ignored");...
use stb_truetype::FontInfo; use std::borrow::Cow; fn main() { let file = include_bytes!("../fonts/Gudea-Regular.ttf") as &[u8]; let font = FontInfo::new(Cow::Borrowed(file), 0).unwrap(); let vmetrics = font.get_v_metrics(); println!("{:?}", vmetrics); let c = '\\'; let cp = c as u32; let g ...
use crate::ir::*; use crate::{Context, Ptr}; pub type Result<T = (), E = Error> = std::result::Result<T, E>; pub type Error = Box<std::error::Error>; pub fn trans(ir: &IR) -> Result<String> { let mut code = String::new(); let mut context = Context::new(&mut code); Trans::new(&mut context).run(ir)?; O...
use func_plot::{PlotData, Problem}; use plotters::coord::Shift; use plotters::prelude::*; use wasm_bindgen::prelude::*; mod func_plot; mod utils; #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; pub type DrawResult<T> = Result<T, Box<dyn std::error::Error>>; #[wasm_bindgen] pub str...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qpagesize.h // dst-file: /src/gui/qpagesize.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <=...
extern crate futures; mod home; mod dynset; use futures::future::{join_all}; use std::error::Error; use std::fs::File; use std::fmt; use std::io::{Read}; use home::HomeData; use home::Container; use dynset::Dynset; use std::collections::{HashMap, HashSet}; use image::{RgbImage}; use std::fmt::Display; use serde::expor...
#[doc = "Reader of register ROUTEPEN"] pub type R = crate::R<u32, super::ROUTEPEN>; #[doc = "Writer for register ROUTEPEN"] pub type W = crate::W<u32, super::ROUTEPEN>; #[doc = "Register ROUTEPEN `reset()`'s with value 0"] impl crate::ResetValue for super::ROUTEPEN { type Type = u32; #[inline(always)] fn re...
use std::env; fn main() { let staging_dir = env::var("STAGING_DIR").unwrap(); println!( r"cargo:rustc-link-search={}/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib", staging_dir ); }
// 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 dlal_component_base::{component, json, serde_json, Body, CmdResult}; component!( {"in": [], "out": ["audio"]}, ["run_size", "uni"], { amount: f32, amount_dst: f32, smooth: f32, }, { "set": {"args": ["gain", "smooth"]}, }, ); impl ComponentTrait for Component...
use dlal_component_base::{component, json, serde_json, Body, CmdResult}; use std::f32::consts::PI; component!( {"in": [], "out": ["audio"]}, ["run_size", "sample_rate", "uni", "check_audio"], { a: f32, x: f32, y: f32, }, { "set": { "args": [{ ...
#[doc = "Reader of register TAMR"] pub type R = crate::R<u32, super::TAMR>; #[doc = "Writer for register TAMR"] pub type W = crate::W<u32, super::TAMR>; #[doc = "Register TAMR `reset()`'s with value 0"] impl crate::ResetValue for super::TAMR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
use rust_blog::create_user; use rust_blog::establish_connection; use rust_blog::models::User; use rust_blog::schema::users; use clap::{App, Arg}; use diesel::ExpressionMethods; use diesel::QueryDsl; use diesel::RunQueryDsl; fn main() { let connection = establish_connection(); let matches = App::new("Create n...
// 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 ...
#![allow(unused_imports)] #![allow(dead_code)] use common::*; use nom::branch::*; use nom::bytes::complete::*; use nom::character::complete::*; use nom::character::*; use nom::combinator::*; use nom::error::ErrorKind; use nom::multi::*; use nom::sequence::*; use nom::IResult; use nom::{AsChar, InputTakeAtPosition}; #[...
use cw::BLOCK; use std::cmp; use std::collections::HashMap; use std::iter; use std::usize; use word_constraint::WordConstraint; /// A `WordStats` represents word frequency statistics for one or more dictionaries. It contains /// numbers of words satisfying each `WordConstraint` and using these can estimate numbers of ...
fn main() { let list = [1, 2, 3]; let res = list.iter().map(|&x| x * 10); let res2: Vec<_> = list.iter().map(|&x| x * 10).collect(); for &x in list.iter() { println!("{}", x); } for x in res { println!("{}", x); } for &x in res2.iter() { println!("{}", x); } println!("{:?}", list); // println!("{:?...
use rune::{Diagnostics, Options, Sources}; use runestick::{Any, Context, Module, Source, Value, Vm}; use std::sync::Arc; #[derive(Any, Debug, Default)] struct Foo { #[rune(get, set, copy)] number: i64, #[rune(get, set)] string: String, } #[test] fn test_getter_setter() { let mut module = Module::n...
use aoc; use std::cmp; use std::error::Error; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::num::ParseIntError; use std::ops::{AddAssign, SubAssign}; use std::str::FromStr; #[derive(Debug, Clone)] struct Vector { x: i32, y: i32, } #[derive(Debug)] struct Point { pos: Vector,...
// Copyright (c) 2019 Jason White // // 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, merge, publish, d...
use std::env; fn main() { let config_file = env::args() .nth(1) .unwrap_or_else(|| r#"C:\Windows\Temp"#.to_string()); println!("Config file path: {}", config_file); }
#[doc = "Reader of register COMP1_CSR"] pub type R = crate::R<u32, super::COMP1_CSR>; #[doc = "Writer for register COMP1_CSR"] pub type W = crate::W<u32, super::COMP1_CSR>; #[doc = "Register COMP1_CSR `reset()`'s with value 0"] impl crate::ResetValue for super::COMP1_CSR { type Type = u32; #[inline(always)] ...
#[macro_use] extern crate approx; use openaip::{parse, Airspace, AltitudeReference, AltitudeUnit, Category, Geometry}; #[test] fn it_works() { let data: &'static str = r##" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OPENAIP VERSION="d9192d6fa44fc5a0ecc3d84fd84d13e091df511c" DATAFORMAT="1.1"> <AIRSPA...
pub mod scenes; //pub mod objects; //pub mod collisions;
use super::CHUNK_SIZE; use rust_src::{Cost, Path, Point}; use std::collections::HashMap; pub type LinkId = usize; #[derive(Debug)] pub struct InterLink { pub id: LinkId, pub pos: Point, pub chunk: Point, pub walk_cost: Cost, pub is_temp: bool, pub sides: [bool; 4], pub neighbors: [Option<LinkId>; 4], pub edge...
#[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{fmt::Display, str::FromStr}; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[derive(Debug, Clone, Copy, Default)] pub enum ToolChain { Stable, Beta, Nightly, // cargo with no +argument, it can be different from th...
// 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 { crate::{ mod_manager::ModManager, models::Suggestion, story_context_store::{ContextEntity, StoryContextStore}, }, ...
fn main() { let x = 10, y = 20; let z = x + y; assert (z == 30); }
#![feature(decl_macro, proc_macro_hygiene)] #[macro_use] extern crate rocket; #[macro_use] extern crate rocket_okapi; extern crate rocket_contrib; use std::{env}; use std::sync::{Arc, Mutex}; use rocket::State; use rocket_contrib::json::Json; use rocket_okapi::{openapi, routes_with_openapi}; use rocket_okapi::swagge...
use crate::cell::{Cell, UnsafeCell}; use crate::sync::mpsc::{channel, Sender}; use crate::thread::{self, LocalKey}; use crate::thread_local; struct Foo(Sender<()>); impl Drop for Foo { fn drop(&mut self) { let Foo(ref s) = *self; s.send(()).unwrap(); } } #[test] fn smoke_no_dtor() { threa...
use crate::ir::eval::prelude::*; impl IrEval for ir::IrBreak { type Output = (); fn eval(&self, interp: &mut IrInterpreter<'_>, used: Used) -> Result<(), IrEvalOutcome> { let span = self.span(); interp.budget.take(span)?; match &self.kind { ir::IrBreakKind::Ir(ir) => { ...
use std::fs; use std::time::Instant; fn number_of_tree_part_1(biome: Vec<String>, right: usize, down: usize) -> usize { let n: usize = biome.get(0).expect("Need at least one string").len(); let mut it = biome.iter(); it.next(); let mut tree_count = 0; let mut pos: usize = 0; while it.len() > 0...
// Copyright 2017 Dasein Phaos aka. Luxko // // 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 distributed // except a...
use core::time::Duration; use embedded_hal as hal; use num_traits::{AsPrimitive, FromPrimitive}; // 20 milliseconds or 50 Hertz pub const SERVO_PWM_PERIOD: Duration = Duration::from_millis(20); // min duty cycle is 1ms or 5% of period pub const MIN_ANGLE_DUTY: f64 = 0.05; // max duty cycle is 2ms or 10% of period p...
extern crate proc_macro as pm; extern crate proc_macro2 as pm2; #[macro_use] extern crate syn; use syn::{DeriveInput, GenericParam, TypeParam, LifetimeDef}; use syn::punctuated::Punctuated; #[macro_use] extern crate quote; use proc_macro_crate::crate_name; mod controls; mod events; mod layouts; mod shared; mod ui;...
abi_stable_shared::declare_tl_lifetime_types! { repr=usize, attrs=[ derive(Hash), ] } ///////////////////////////////////////////////////////////////////// mod lifetime_counters; pub(crate) use self::lifetime_counters::LifetimeCounters; impl LifetimeRange { pub const DUMMY: Self = Self::from...
extern crate http_parser; use self::http_parser::{HttpParser,HttpParserSettings,HTTP_REQUEST}; fn make_an_http_parser() -> HttpParser { HttpParser::new(HTTP_REQUEST) } #[test] fn curl_get() { fn http_cb(parser_: &HttpParser) -> Result<(), ()> { println!("http_cb"); Ok(()) } fn http_data_cb(parser_: ...
pub mod ast; pub mod from_ir; pub mod to_ir; pub use self::ast::parser::parse; pub use self::to_ir::type_def_to_ir;
use crate::{ aabb::AABB, hittable::{HitRecord, HitTable}, ray::Ray, rtweekend::random_int, vec3::Point3, }; use std::{cmp::Ordering, sync::Arc}; #[derive(Clone)] pub struct BVHNode { left: Arc<dyn HitTable>, right: Arc<dyn HitTable>, bvhbox: AABB, } impl BVHNode { pub fn new( ...
#[derive(PartialEq)] #[derive(Debug)] pub enum Sexpr { List(Box<Vec<Sexpr>>), Integer(i64), Float(f64) }
#![feature(convert)] #![feature(scoped)] #![feature(plugin)] #![plugin(peg_syntax_ext)] #![feature(std_misc)] extern crate window; extern crate glutin_window; extern crate opengl_graphics; extern crate conrod; extern crate event; pub mod ui; pub mod sheet; pub mod parser;
use crate::errors::ServiceError; use crate::models::shop::Shop; use crate::schema::order; use actix::Message; use chrono::NaiveDateTime; use uuid::Uuid; #[derive( Clone, Debug, Serialize, Associations, Deserialize, PartialEq, Identifiable, Queryable, Insertable, )] #[table_name = "o...
use std::collections::{BTreeMap, HashMap, VecDeque}; use std::convert::TryFrom; use std::path::PathBuf; use std::sync::Arc; use firefly_diagnostics::*; use firefly_intern::{symbols, Symbol}; use firefly_parser::Source; use crate::ast::Literal; use crate::evaluator; use crate::lexer::Lexer; use crate::lexer::{DelayedS...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT extern crate gio_sys; extern crate shell_words; extern crate tempdir; use gio_sys::*; use std::env; use std::error::Error; use std::mem::{align_of, size_of}; use std::path::Path; use...
use crate::object::{DecryptReader, Key, CHUNK_LENGTH}; use std::io; use std::io::Read; pub struct QuocoReader<R: Read> { inner: brotli::Decompressor<DecryptReader<R>>, } impl<'a, R: Read> QuocoReader<R> { pub fn new(reader: R, key: &Key) -> Self { // TODO: Once chunked format is supported, we'll have ...
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; const ten97: usize = 1000000007; fn main() { let (n, m): (usize, usize) = parse_line().unwrap(); let mut paths: Vec<Vec<usize>> = vec![vec![]; n + 1]; for _ in 0..m { let (a, b)...
use db::schema::*; #[derive(Queryable, Serialize, AsChangeset)] #[table_name = "category"] #[primary_key(name)] pub struct Category { pub name: String, pub abbr: String, pub description: String, } #[derive(Identifiable, Queryable, Associations, PartialEq, Serialize)] #[table_name = "category_link"] #[belo...
//! Generic data structures and algorithms for collision detection pub use collision::prelude::Primitive; pub use collision::{CollisionStrategy, ComputeBound, Contact}; pub mod broad; pub mod narrow; use std::collections::HashSet; use std::fmt::Debug; use std::hash::Hash; use cgmath::prelude::*; use collision::dbvt...
//给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 // //你可以假设数组中无重复元素。 // //示例 1: // //输入: [1,3,5,6], 5 //输出: 2 // //示例 2: // //输入: [1,3,5,6], 2 //输出: 1 // //示例 3: // //输入: [1,3,5,6], 7 //输出: 4 // //示例 4: // //输入: [1,3,5,6], 0 //输出: 0 // //来源:力扣(LeetCode) //链接:https://leetcode-cn.com/problems/search-insert-...
// 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...
#[doc = r"Value read from the register"] pub struct R { bits: u8, } #[doc = r"Value to write to the register"] pub struct W { bits: u8, } impl super::RXCSRL3 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
// Import from core instead of from std since we are in no-std mode. use core::result::Result; // Import CKB syscalls and structures. // https://nervosnetwork.github.io/ckb-std/riscv64imac-unknown-none-elf/doc/ckb_std/index.html use ckb_std::ckb_types::{bytes::Bytes, prelude::*}; use ckb_std::high_level::{load_cell_da...
mod hashtree; mod rbtree; pub use crate::hashtree::*; pub use crate::rbtree::*;
use crate::action::Action; use crate::action::Action::*; use crate::keycodes::KeyCode::*; use crate::keymatrix::{COLUMNS, ROWS}; /* ,-----------------------------------------------------------------------------. |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| = | Backsp | |--------------------...
use rocket::{http::Status, response::status, Rocket}; use rocket_contrib::json::Json; use serde_json::Value; #[catch(400)] pub fn bad_request() -> status::Custom<Json<Value>> { status::Custom( Status::BadRequest, Json(json!({"error": "Bad Request", "message": "Server cannot process the request"})),...
use oop::avg::AveragedCollection; fn main() { let mut s = AveragedCollection::new(); s.add(12); s.add(20); println!("Average of {:?} is {}", vec![12, 20], s.average()); }
use syntax::{ast, codemap, parse}; use syntax::ext::base; use std::path; use super::Generator; #[macro_use] mod macro_ext; mod parser; mod generator; #[derive(Clone)] pub struct MigrationState { pub path: path::PathBuf } pub fn migration<'cx>(cx: &'cx mut base::ExtCtxt, sp: codemap::Span, tokens: &[ast::TokenTr...
pub trait InputSrcDetector<'a> { fn get_client_srcs(&self) -> Vec<&'a str>; fn get_input_srcs(&self) -> Vec<&'a str>; // Check if the name src is input source for client. // Map the original source to client source name. fn map_client_src<'b>(&self, src: &'b str) -> Option<&'b str>; // Check ...
use core::any::TypeId; use std::{ any::type_name, fmt::Debug, ops::{Deref, DerefMut}, }; use hecs::{Archetype, ColumnBatchBuilder, ColumnBatchType, Component, World as HecsWorld}; // With help from https://github.com/AngelOfSol/fg_engine_v2_work/blob/master/src/roster/world.rs /// An opaque registry that...
extern crate actix; extern crate actix_web; extern crate futures; extern crate serde; extern crate serde_json; extern crate env_logger; extern crate tokio_postgres; #[macro_use] extern crate serde_derive; mod handlers; mod database; mod apps; use actix_web::{HttpRequest, HttpResponse, FutureResponse, http, AsyncRespo...
//! Decode NBT values from files or other readable sources. use std; use super::{Error, Result, Tag, TagType, ListData, CompoundData, Decodable, Compression}; use std::fs::File; use std::io::Read; use std::collections::HashMap; use flate2::read::GzDecoder; fn read_string<R: Read>(reader: &mut R) -> Result<String> ...
#![recursion_limit = "256"] // needed for html! macro expansion #![allow(dead_code)] #![allow(unused_imports)] //#![feature(test)] //extern crate test; #[macro_use] extern crate yew; extern crate num_complex; extern crate serde; extern crate serde_json; extern crate stdweb; #[macro_use] extern crate serde_derive; ...
use types::{BytesOrWideString, c_void}; use SymbolName; pub unsafe fn resolve(_addr: *mut c_void, _cb: &mut FnMut(&super::Symbol)) { } pub struct Symbol; impl Symbol { pub fn name(&self) -> Option<SymbolName> { None } pub fn addr(&self) -> Option<*mut c_void> { None } pub fn fil...
use actix_service::{Service, Transform}; use actix_web::{dev::ServiceRequest, dev::ServiceResponse, web::Data, Error, HttpResponse}; use futures::future::{ok, Ready}; use futures::Future; use serde::Serialize; use std::cell::RefCell; use std::pin::Pin; use std::rc::Rc; use std::task::{Context, Poll}; #[derive(Serializ...
#![allow(bad_style)] #![feature(box_syntax)] // Unfortunately, you currently have to import all four of these. // We're considering what it would look like to make this redundant, // and then you'd only need pest and pest-ast. #[macro_use] extern crate pest_derive; extern crate from_pest; extern crate pest; extern cr...
use ::amethyst::shrev::EventChannel; use ::amethyst::core::timing::Time; use ::amethyst::ecs::*; use ::amethyst::input::*; use serde::Serialize; #[derive(new, Debug, Serialize, Deserialize)] pub struct ManualTimeControl<T> where T: BindingTypes, { pub play_action_key: T::Action, pub stop_action_key: T::...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Context; use glib::GString; use glib::object::IsA; use glib::translate::*; use javascriptcore_sys; use std::fmt; glib_wrapper! { pub struct Exception(Object<javascrip...