text
stringlengths
8
4.13M
use nalgebra::Scalar; use crate::{Pose, PoseCovariance}; pub trait OdometryModel<N: Scalar + Copy> { fn update_all(&self, dt: N, poses: &mut [Pose<N>]) { for pose in poses { *pose = self.update_one(dt, *pose); } } fn update_one(&self, dt: N, pose: Pose<N>) -> Pose<N>; } pub tr...
use crate::impl_pnext; use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug)] pub struct VkBufferCreateInfo { pub sType: VkStructureType, pub pNext: *const c_void, pub flags: VkBufferCreateFlagBits, pub size: VkDeviceSize, pub usage: VkBufferUsageFlagBits, p...
use crate::{ event::{self, Event}, sinks::util::{ encoding::{EncodingConfig, EncodingConfiguration}, StreamSink, }, topology::config::{DataType, SinkConfig, SinkContext, SinkDescription}, }; use async_trait::async_trait; use futures::pin_mut; use futures::stream::{Stream, StreamExt}; use...
use futures::{future, try_ready, Future, Poll}; use linkerd2_error::Error; pub type Data = hyper::body::Chunk; pub type Response = http::Response<Payload>; pub type ResponseFuture = Box<dyn Future<Item = Response, Error = Error> + Send + 'static>; pub struct BoxedService<A>( Box< dyn tower::Service< ...
use crate::raw::{flann_index_t, FLANNParameters}; use std::fmt::Debug; use std::os::raw::{c_int, c_uint}; pub unsafe trait Indexable: Clone + Debug + Default { type ResultType: Clone + Debug + Default; unsafe fn build_index( dataset: *mut Self, rows: c_int, cols: c_int, speedup...
//! https://github.com/lumen/otp/tree/lumen/lib/edoc/src use super::*; test_compiles_lumen_otp!(edoc); test_compiles_lumen_otp!(edoc_data); test_compiles_lumen_otp!(edoc_doclet); test_compiles_lumen_otp!(edoc_extract); test_compiles_lumen_otp!(edoc_layout); test_compiles_lumen_otp!(edoc_lib); test_compiles_lumen_otp!...
#![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] #[macro_use] extern crate log; use core::convert::TryInto; use core::convert::TryFrom; use move_vm::data::ExecutionContext; use sp_std::prelude::*; use codec::{FullCodec, FullEncode}; use frame_support::{decl_module, decl_storage, dispatch}; use f...
#![feature(external_doc)] use ema_rs::EMA; use ta_common::traits::Indicator; #[doc(include = "../README.md")] pub struct PPO { short_period: u32, long_ema: EMA, short_ema: EMA, index: u32, } impl PPO { pub fn new(short_period: u32, long_period: u32) -> PPO { Self { short_perio...
mod math_lib; fn main() { println!("Sum of two number using module along with main.rs {} " , math_lib::basic::sum(50,50)); }
#![deny(warnings)] use tokio::fs::File; use tokio_util::codec::{BytesCodec, FramedRead}; use hyper::service::{make_service_fn, service_fn}; use hyper::{Body, Method, Request, Response, Result, Server, StatusCode}; static INDEX: &str = "examples/send_file_index.html"; static NOTFOUND: &[u8] = b"Not Found"; #[tokio:...
pub struct Solution; impl Solution { pub fn is_perfect_square(num: i32) -> bool { if num == 1 { return true; } let num = num as i64; let mut a = 1; let mut b = num; while b - a != 1 { let c = (a + b) / 2; if c * c <= num { ...
use std::convert::TryInto; use std::sync::Arc; use liblumen_alloc::erts::message::Message; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use liblumen_alloc::erts::timeout::{ReceiveTimeout, Timeout}; use lumen_rt_core::process::current_process; use lumen_rt_core::time::monoton...
use proc_macro2::TokenStream; use quote::ToTokens; use std::cell::RefCell; /// Used to more easily implement ToTokens. pub struct ToTokenFnMut<F> { func: RefCell<F>, } impl<F> ToTokenFnMut<F> where F: FnMut(&mut TokenStream), { pub fn new(f: F) -> Self { Self { func: RefCell::new(f), ...
extern crate engine; extern crate simple_logger; use std::env; fn main() { simple_logger::init().unwrap(); let exe = env::current_exe().unwrap(); let root = exe.parent().unwrap(); let runner = engine::Builder::create(root.to_path_buf()).build(); let result = runner.run(); match result { ...
fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let xy: Vec<(i64, i64)> = (0..n) .map(|_| { let x: i64 = rd.get(); let y: i64 = rd.get(); (x, y) }) .collect(); let m: usize =...
//! Shared types (e.g. for a domain name) //! //! This module defines basic types, that are necessary throughout `dynonym` but unavailable in the //! [standard library][std]. Sometimes, equivalent types are present in third-party crates but we //! try to avoid them in order to provide a stable API. In case, the equival...
use sodiumoxide::crypto::*; fn use_box_basic () { let (ourpk, oursk) = box_::gen_keypair(); // normally theirpk is sent by the other party let (theirpk, theirsk) = box_::gen_keypair(); let nonce = box_::gen_nonce(); let plaintext = b"some data"; let ciphertext = box_::seal(plaintext, &nonce, &t...
use std::fmt::{self, Debug, Write}; use std::ops::{Index, IndexMut}; use itertools::Itertools; use unicode_width::UnicodeWidthChar; use super::{Bounds, Color, Coordinates, Size}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Cell { pub c: Option<char>, pub color: Option<Color>, } impl Default for Cell {...
// 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. //! System service for managing cellular modems #![feature(async_await, await_macro, futures_api, arbitrary_self_types)] #![deny(warnings)] use { fai...
// An example that demonstrates a basic 2D lighting effect extern crate nalgebra; extern crate ncollide2d; extern crate quicksilver; use nalgebra::{zero, Isometry2}; use ncollide2d::query::{Ray, RayCast}; use quicksilver::{ Result, geom::{Rectangle, Vector}, graphics::{Color, GpuTriangle, Mesh, Vertex}, ...
use crate::{ fmx_Data, fmx_DataVect, fmx_ExprEnv, fmx_ExtPluginType, fmx__fmxcpt, fmx_ptrtype, write_to_u16_buff, AllowedVersions, ApplicationVersion, Data, DataVect, ExprEnv, ExternStringType, ExternVersion, FMError, FM_ExprEnv_RegisterExternalFunctionEx, FM_ExprEnv_RegisterScriptStep, FM_ExprEnv_UnReg...
pub mod error; pub use self::error::*; mod ppm; mod image; #[cfg(feature="gui")] mod gui; mod buckets; pub use self::buckets::*; use scene::*; use vec3::*; use std::fs::File; use std::path::Path; pub trait Output { fn begin(&mut self) -> Result<()> {Ok(())} fn put_pixel(&mut self, x: u32, y: u32, color: &Vec3...
//! Valiu Liquidity Network - Node mod chain_spec; mod cli; mod command; mod rpc; mod service; fn main() -> sc_cli::Result<()> { command::run() }
#![feature(trait_alias)] #![feature(extended_key_value_attributes)] #![feature(type_alias_impl_trait)] #![allow(dead_code)] pub mod filters; pub mod odometry; pub mod sensor_models; mod datatypes; mod utils { pub mod collect_vec; pub mod fmap; pub mod gaussian; pub mod searcher_util; } pub use datat...
use serde::Serialize; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn add(a: u32, b: u32) -> u32 { a + (b * 2) } #[wasm_bindgen] #[derive(Serialize)] pub struct Movie { title: String, description: String, pub rating: f32, } #[wasm_bindgen] impl Movie { #[wasm_bindgen(getter)] pub fn titl...
use std::{ fmt::{Display, Formatter, Result as FmtResult}, ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign}, }; #[derive(Copy, Clone)] pub struct Vec3([f64; 3]); impl Vec3 { #[inline] pub const fn new(a: f64, b: f64, c: f64) -> Vec3 { Vec3([a, b, c]) ...
use crate::prelude::*; #[derive(NativeClass)] #[inherit(Node)] pub struct DodgeTheCreepsInstance { engine: RPopsEngine<Renderables>, } #[methods] impl DodgeTheCreepsInstance { fn _init(owner: Node) -> Self { let mut instance = DodgeTheCreepsInstance { engine: RPopsEngine::<Renderables>::new(owner) }; ...
use ggez::{self, GameResult, graphics}; use gui; const CAPTURE_MESSAGE: &'static str = "You were captured!"; pub struct CaptureGui; impl gui::Gui for CaptureGui { fn update(&mut self, _mouse_x: f32, _mouse_y: f32) -> GameResult<()> { Ok(()) } fn draw(&mut self, ctx: &mut ggez::Context, font: &gr...
mod structure; mod function; mod scene; mod object; pub use scene::Scene; pub use object::Object; use std::env; fn main() { let args: Vec<String> = env::args().collect(); match args.len() { 1 => { eprintln!("Usage: {} scene.json", args[0]); }, _ => { let mut sce...
pub fn diff(f: &dyn Fn(f64)->f64, x: f64, h: f64) -> f64 { return (f(x+h)-f(x-h))/(2.0*h); } pub fn diffn(n: u32, f: &dyn Fn(f64)->f64, x: f64, h: f64) -> f64 { if n==0 { return f(x); }else if n==1 { return diff(f,x,h); }else{ return (diffn(n-1,f,x+h,h)-diffn(n-1,f,x-h,h))/(2....
use std::fmt; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; pub struct MemoryStats { allocated: Bytes, resident: Bytes, } impl MemoryStats { pub fn current() -> MemoryStats { jemalloc_ctl::epoch::advance().unwrap(); MemoryStats { allocated:...
use std::collections::HashSet; use std::sync::Arc; use chrono::{Duration, Utc}; use true_layer::{Client as TrueLayerClient, Transaction}; use crate::{db, Db}; const FIVE_MINS: std::time::Duration = std::time::Duration::from_secs(300); pub fn start_worker(db: Db, true_layer: Arc<TrueLayerClient>) { tokio::task::...
use crow::Context; use crow_anim::AnimationStorage; use crate::{ config::GameConfig, data::Components, environment::{World, WorldData}, input::InputState, save::SaveData, systems::Systems, time::Time, }; pub struct Ressources { pub input_state: InputState, pub time: Time, pub ...
fn get_type_name<T>(_: &T) -> String { String::from(format!("{:?}", std::any::type_name::<T>())) } fn hello_world() -> String { "Hello World".to_string() } fn main() { let s: String = hello_world(); println!("{}", &s); let t = get_type_name(&s); println!("typeof \"{}\" -> {}", &s, &t); }
use std::collections::HashSet; use std::iter::FromIterator; use std::sync::mpsc::channel; use std::time::Duration; use timely::dataflow::channels::pact::Pipeline; use timely::dataflow::operators::Operator; use declarative_dataflow::binding::Binding; use declarative_dataflow::plan::{Hector, Implementable, Union}; use ...
use super::Square88; use itertools::*; pub const ALL_SQUARES: Square88 = Square88(0); pub const UNDEFINED_SQUARE: Square88 = Square88(0xFF); pub const A8: Square88 = Square88(0x0); pub const B8: Square88 = Square88(0x1); pub const C8: Square88 = Square88(0x2); pub const D8: Square88 = Square88(0x3); pub const E8: Squ...
pub struct Adjacent<I> { position: (usize, usize), h: usize, w: usize, direction: I, } impl<I> Adjacent<I> where I: Iterator<Item = (isize, isize)>, { pub fn new(position: (usize, usize), h: usize, w: usize, direction: I) -> Self { Self { position, h, ...
// 栈(Stack)与堆(Heap) // 在 Rust 这样的系统编程语言中,值位于栈上海市堆上在更大程度上影响力语言的行为以及为何必须做出这样的抉择 // 栈和堆都是代码在运行时可供使用的内存,但是它们的结构不同,栈以放入值的顺序存储值并以相反顺序取出值, // 这叫做 后进先出(last in, first out),想象跌盘子,在顶部增加,从顶部拿走 // 增加数据叫做 进栈(pushing onto the stack),移除数据叫做 出栈(popping off the stack) // 栈的操作是十分快速的,这主要得益于它存取数据的方式:因为数据存取的位置总是在栈顶而不需要寻找一个位置存放或读取 // 另一个让操作...
extern crate navitia_model; extern crate serde_json; use navitia_model::collection::{Collection, Idx, Id}; use navitia_model::relations::IdxSet; use navitia_model::{GetCorresponding, PtObjects}; fn get<T, U>(idx: Idx<T>, collection: &Collection<U>, objects: &PtObjects) -> Vec<String> where U: Id<U>, IdxSet<T>...
use crate::{CoordinateType, Line, LineString, MultiPolygon, Polygon, Rect, Triangle}; use num_traits::Float; use crate::algorithm::winding_order::twice_signed_ring_area; /// Signed planar area of a geometry. /// /// # Examples /// /// ``` /// use geo::polygon; /// use geo::algorithm::area::Area; /// /// let mut polyg...
#[cfg(feature = "nightly")] pub use proc_macro::Diagnostic; use proc_macro2::{Span, TokenStream}; pub trait EmitErrorExt { fn emit_error(self) -> TokenStream; } impl EmitErrorExt for Result<TokenStream, Error> { fn emit_error(self) -> TokenStream { self.unwrap_or_else(Error::emit) } } #[cfg(featu...
extern crate serde; mod test_utils; // use flexi_logger::LoggerHandle; use hdbconnect_async::{HdbResult, HdbReturnValue, HdbValue}; // use log::{debug, info}; #[tokio::test] async fn test_051_management_console() -> HdbResult<()> { let connection = test_utils::get_authenticated_connection().await?; let mut ...
use std::ops::{Deref, DerefMut}; use n3_machine_ffi::{Program, Query, Result, WorkHandler}; pub trait PyMachine { fn is_running(&self) -> bool; fn py_spawn(&mut self, program: &mut Program, handler: &WorkHandler) -> Result<()>; fn py_terminate(&mut self) -> Result<()>; } pub trait ProcessMachine<P>: Py...
use super::*; pub fn consumable<IEVec: AsRef<Vec<ItemEffect>>>( name: &str, size: usize, effects: IEVec, ) -> ConsumableBuilder { ConsumableBuilder { consumable: Consumable { size, effects: effects.as_ref().clone(), name: name.to_owned(), max_uses...
/// Useful functionality for command-line interfaces. /// /// Features CLI prompts, colored & stacked outputs. #[cfg(feature = "cli")] pub mod cli; /// Regroupment of system utilities, filesystem stuff, and portable wrappers around platform-specific /// functionality. #[cfg(feature = "sys")] pub mod sys; #[cfg(test)]...
use std::iter::Peekable; #[test] fn peekable_test() { let mut chars = "carlos23Lande5".chars().peekable(); assert_eq!(parse_string(&mut chars), "carlos"); assert_eq!(chars.next(), Some('2')); assert_eq!(chars.next(), Some('3')); assert_eq!(parse_string(&mut chars), "Lande"); assert_eq!(chars....
#[doc = "Reader of register FTSR2"] pub type R = crate::R<u32, super::FTSR2>; #[doc = "Writer for register FTSR2"] pub type W = crate::W<u32, super::FTSR2>; #[doc = "Register FTSR2 `reset()`'s with value 0"] impl crate::ResetValue for super::FTSR2 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use test_winrt_classes::*; use windows::core::*; use Component::Classes::*; use Component::Interfaces::*; #[test] fn static_class() -> Result<()> { assert!(Static::Method()? == 0); assert!(Static::Property()? == 0); assert!(Static::ReadOnly()? == 0); Static::SetProperty(123)?; assert!(Static::Metho...
use crate::derive_stable_abi_from_str as derive_sabi; use abi_stable_shared::test_utils::must_panic; use as_derive_utils::test_framework::Tests; /// For testing that adding #[repr(C)] makes the derive macro not panic. const RECTANGLE_DEF_REPR: &str = r##" pub struct Rectangle { x:u32, y:u32, ...
use ndarray::prelude::*; use petgraph::visit::{EdgeRef, IntoEdgeReferences, IntoNodeIdentifiers}; use petgraph_drawing::{Drawing, DrawingIndex}; use std::collections::HashMap; pub fn ideal_edge_lengths<G>( graph: G, coordinates: &Drawing<G::NodeId, f32>, d: &Array2<f32>, ) -> f32 where G: IntoEdgeRefer...
extern crate lzf; use lzf::compress; use lzf::decompress; fn main() { let lorem = "\r\n\r\n\r\n\r\n ALICE'S ADVENTURES IN WONDERLAND\r\n"; println!("lorem.len: {}", lorem.len()); let compressed = compress(lorem.as_bytes()).unwrap(); println!("l: {}", compressed.len()); let decompr...
extern crate num_bigint; extern crate num_traits; extern crate hex; extern crate rand; extern crate openssl; use num_bigint::BigUint; use num_bigint::*; use num_traits::*; use openssl::symm::{decrypt, Cipher, Crypter, encrypt}; use num_bigint::Sign::*; use rand::Rng; pub struct Dh { pub private_key: BigInt, p...
use std::{ future::Future, pin::Pin, task::{Context, Poll}, time::Duration, }; use pin_project_lite::pin_project; use crate::{ actor::Actor, clock::{sleep, Instant, Sleep}, fut::ActorStream, }; pin_project! { /// Stream for the [`timeout`](super::ActorStreamExt::timeout) method. #...
use vec3::Vec3; use num_traits::Float; use util::*; #[derive(Debug)] #[allow(non_snake_case)] pub struct Ray<T: Float> { A: Vec3<T>, B: Vec3<T>, /// Timestamp of when this ray was fired. t: f64, } impl<T: Float> Ray<T> { pub fn new(a: Vec3<T>, b: Vec3<T>) -> Ray<T> { Ray { A: a...
// Translated from C to Rust. The original C code can be found at // https://github.com/ulfjack/ryu and carries the following license: // // Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy ...
#[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "dwmapi.dll""system" #[doc = "*Required features: `\"Win32_Graphics_Dwm\"`, `\"Win32_Foundation\"`*"] fn DwmAttachMilContent ( hwnd : super::super::Foundation:: HWND ) -> ::windows_sys::core::HRESULT ); #[cfg(feature = "Win32_Foundation")] ::windows_targe...
mod utils; use std::mem; use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; // If want to print the message to console, use log! extern c...
// 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::path::Path; use regex::Regex; use chrono::NaiveDate; use util; include!(concat!(env!("OUT_DIR"), "/post.rs")); fn extract_data_from_filename(filename: &str) -> (&str, &str, u8) { let re = Regex::new(r"^(\d{4}-\d{2}-\d{2})-(\d{3})-(.+)$").unwrap(); let cap = re.captures(filename).unwrap(); let dat...
// Copyright 2020 - 2021 Alex Dukhno // // 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...
//! https://github.com/lumen/otp/tree/lumen/lib/dialyzer/src use super::*; test_compiles_lumen_otp!(dialyzer); test_compiles_lumen_otp!(dialyzer_analysis_callgraph); test_compiles_lumen_otp!(dialyzer_behaviours); test_compiles_lumen_otp!(dialyzer_callgraph); test_compiles_lumen_otp!(dialyzer_cl); test_compiles_lumen_...
fn main() { proconio::input!{k:u64,a:u64,b:u64}; for i in a..=b{ if i%k==0{ println!("OK"); return } } println!("NG") }
extern crate hyper; extern crate serde; extern crate serde_json; extern crate futures; extern crate uuid; extern crate hyper_tls; extern crate postgres; extern crate crypto; extern crate rustc_serialize as serialize; use crypto::digest::Digest; //use crypto::sha2::Sha256; use serialize::base64::{STANDARD, ToBase64}; ...
use move_vm::data::Oracle; #[derive(Clone, Copy, Default)] pub struct DummyOracle; impl Oracle for DummyOracle { fn get_price(&self, _ticker: &str) -> Option<u128> { None } }
use std::fs::File; use std::io::{BufRead, BufReader}; use std::collections::HashMap; fn main() { println!("Part 1 checksum is: {}", part_1()); println!("Part 2 correct box ids: {:?}", part_2()); } fn part_1() -> i32 { let filename = "src/input.txt"; let mut pairs = 0; let mut triplets = 0; l...
// Copyright 2012 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 D3PCR2L"] pub type R = crate::R<u32, super::D3PCR2L>; #[doc = "Writer for register D3PCR2L"] pub type W = crate::W<u32, super::D3PCR2L>; #[doc = "Register D3PCR2L `reset()`'s with value 0"] impl crate::ResetValue for super::D3PCR2L { type Type = u32; #[inline(always)] fn reset_va...
#[macro_use] extern crate rouille; use std::io; fn main() { // This example demonstrates how to handle HTML forms. // Note that like all examples we only listen on `localhost`, so you can't access this server // from another machine than your own. println!("Now listening on localhost:8000"); rou...
use ffi::cfhost::*; pub struct Host { host_ref: CFHostRef } impl Host { fn new_with_name(host_name: &str) { } }
use std::any::Any; use crate::Mutator; /// A [`FilterMutator`] provides a way to filter values outputted by a mutator. /// Given any [`Mutator<Value=T>`] and a function [`Fn(&T) -> bool`] it creates /// a new mutator which can generate all the values of `T` the underlying /// mutator can, except those for which the f...
use core::Material;
use chrono::{DateTime, Utc}; use mongodb::bson::oid::ObjectId; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::convert::TryFrom; #[derive(Serialize, Deserialize, Debug, Clone)] struct Quantity { #[serde(skip_serializing_if = "Option::is_none")] value: Option<Value>, #[serde(skip_serial...
// Copyright (c) 2018-2022 Ministerio de Fomento // Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC) // 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 ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type DnssdRegistrationResult = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DnssdRegistrationStatus(pub i32); impl DnssdRegistrationStatus { ...
use std::collections::HashMap; #[derive(Clone, Debug, Eq, PartialEq)] pub struct GuardRule { pub origin: String, pub ty: RuleType, pub level: RuleLevel, pub scope: RuleScope, pub expr: Expr, pub ops: Vec<Operator>, pub assert: RuleAssert } #[derive(Clone, Debug, Eq, PartialEq)] pub enum La...
use crate::homogeneous::Homogeneous; use ndarray::{Array, Array2, ArrayBase, ArrayView1, ArrayView2, Axis, Data, LinalgScalar, Ix1, Ix2, stack}; pub trait Transform<A, D, Rhs> { fn transform(&self, points0: &Rhs) -> Array<A, D>; } macro_rules! impl_transform { (for $($d:ty),+) => { $(imp...
use candy_frontend::{ cst::{Cst, CstKind, UnwrapWhitespaceAndComment}, module::{Module, ModuleDb}, position::PositionConversionDb, rcst_to_cst::RcstToCst, }; use enumset::EnumSet; use lsp_types::{self, SemanticToken}; use crate::semantic_tokens::{SemanticTokenType, SemanticTokensBuilder}; pub fn seman...
// use simdeez::*; #![cfg(target_arch = "x86_64")] use std::arch::x86_64::*; // DP high components and caller ignores returned high components #[inline] pub fn hi_dp_ss(a: __m128, b: __m128) -> __m128 { unsafe { // 0 1 2 3 -> 1 + 2 + 3, 0, 0, 0 let mut res: __m128 = _mm_mul_ps(a, b); // ...
use std::io::Read; pub fn format(index: usize, link: &str) -> String { format!("[{}]:{}", index + 1, link) } pub fn convert<R, F>(mut reader: R, formatter: F) -> String where R: Read, F: Fn(usize, &str) -> String, { let mut is_codeblock = false; let mut is_hiperlink = false; let mut collected_...
// Copyright 2020-2021, The Tremor Team // // 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 agr...
use crate::{ dag::{ResolveError, UnexpectedResolved}, Block, Error, Ipfs, IpfsTypes, }; use async_stream::stream; use cid::Cid; use futures::stream::Stream; use ipfs_unixfs::file::{visit::IdleFileVisit, FileReadFailed}; use std::borrow::Borrow; use std::ops::Range; /// IPFS cat operation, producing a stream of...
use async_trait::async_trait; use rbatis::crud::CRUDTable; use mav::{ChainType, NetType, WalletType, CTrue}; use mav::kits::sql_left_join_get_b; use mav::ma::{Dao, MBtcChainToken, MBtcChainTokenDefault, MBtcChainTokenShared, MWallet, MBtcChainTokenAuth}; use crate::{Chain2WalletType, ChainShared, ContextTrait, deref_...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qcommandlineparser.h // dst-file: /src/core/qcommandlineparser.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main ...
// 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 agre...
use std::collections::{HashMap, HashSet}; use std::sync::mpsc; use message; pub enum Message { ClientConnected(mpsc::Sender<message::Message>, u64), ClientGone(u64), MessageReceived(message::Message), } pub struct Dispatcher { pub tx: mpsc::Sender<Message>, input: mpsc::Receiver<Message>, clie...
/*! # Ruby Parser - a library for parsing Ruby syntax ruby-parser is a library that provides the APIs needed to lex the Ruby programming language's syntax into a stream of tokens. ## Parser combinators This library is provided as a set of parser combinator functions, powered by [nom](https://docs.rs/nom/). All of th...
use std::thread; fn main() { let thread_1 = thread::spawn(|| { "Hello" }); thread::sleep(std::time::Duration::from_millis(100)); let thread_2 = thread::spawn(|| { "Rust" }); println!("{:?}", thread_2.join().unwrap()); println!("{:?}", thread_1.join().unwrap()); }
pub struct GameState { map: Map::Map, } impl GameState { pub fn update(&mut self) { } }
use smash::*; use smash::hash40; use smash::lib::lua_const::*; use smash::lua2cpp::L2CFighterCommon; use acmd::{acmd, acmd_func}; use smash::app::lua_bind::*; use smash::lib::L2CValueType; use smash::phx::Vector3f; use smash::phx::Hash40; #[acmd_func( battle_object_category = BATTLE_OBJECT_CATEGORY_FIGHTER, ba...
use super::*; #[test] fn with_small_integer_subtrahend_with_underflow_returns_big_integer() { with_process(|process| { let minuend = process.integer(SmallInteger::MIN_VALUE); let subtrahend = process.integer(SmallInteger::MAX_VALUE); assert!(subtrahend.is_smallint()); let result =...
#[macro_use] use super::*; fn walk<F: Fn(&mut Term, usize)>(term: &mut Term, cutoff: usize, f: &F) { match term { Term::Var(_) => { f(term, cutoff); } Term::Abs(t2) => walk(t2, cutoff + 1, f), Term::App(t1, t2) => { walk(t1, cutoff, f); walk(t2, c...
use std::convert::From; use nabi; #[repr(C)] pub struct AbiResult(u64); impl From<AbiResult> for nabi::Result<u32> { fn from(res: AbiResult) -> nabi::Result<u32> { nabi::Error::demux(res.0) } }
use grass::algorithm::AssumeSorted; grass::grass_query! { let a = open("data/a.bed"); let g = open("data/test.genome"); // The invert operator assume the genome size is INF, thus we need to intersect with // the genome size file, so that we can limit the result not larger than the genome size inters...
pub mod data; use std::process::{Command, Stdio}; use std::io::{Write}; use itertools::{Itertools}; fn thruster_signal(data: &str, path: &str, phase: i32, signal: i32) -> i32 { let mut result = Command::new(path) .args(&[data]) .stdin(Stdio::piped()) .stdout(Stdio::piped()) .spawn().expect("Unable to start ...
#[doc = "Reader of register PP"] pub type R = crate::R<u32, super::PP>; #[doc = "EEPROM Size\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u16)] pub enum SIZE_A { #[doc = "0: 64 bytes of EEPROM"] _64 = 0, #[doc = "1: 128 bytes of EEPROM"] _128 = 1, #[doc = "3: 256 bytes of E...
extern crate hyper; extern crate multipart; use std::io; use hyper::server::{Handler, Server, Request, Response}; use hyper::status::StatusCode; use hyper::server::response::Response as HyperResponse; use multipart::server::hyper::{Switch, MultipartHandler, HyperRequest}; use multipart::server::{Multipart, Ent...
//! This module describes the negotiate contexts. //! The SMB2_NEGOTIATE_CONTEXT structure is used by the SMB2 NEGOTIATE Request //! and the SMB2 NEGOTIATE Response to encode additional properties. //! The server MUST support receiving negotiate contexts in any order. use rand::{ distributions::{Distribution, Stan...
//! Example program drawing circles on a page. #[macro_use] extern crate simple_pdf; use simple_pdf::graphicsstate::Color; use simple_pdf::units::{Points, UserSpace}; use simple_pdf::Pdf; use std::f32::consts::PI; use std::io; /// Create a `circles.pdf` file, with a single page containg a circle /// stroked in black,...
mod game; pub use self::game::Suit; pub use self::game::Card; pub use self::game::PokerPlayer; pub use self::game::PokerGame; pub fn parse(raw_games: &str) -> Vec<PokerGame> { raw_games .lines() .map(str::trim) .filter(|line| !line.is_empty()) .map(game::parse) .collect() ...
use crate::datastructure::DataStructure; use crate::shader::shaders::{emittance, map_uv}; use crate::shader::Shader; use crate::util::ray::Ray; use crate::util::rng::get_rng; use crate::util::vector::Vector; use rand::Rng; use std::f64; #[derive(Debug)] pub struct VMcShader { air_density: f64, particle_reflect...