text
stringlengths
8
4.13M
// Copyright 2019, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
#[macro_use] extern crate slog; use hyper_tls::HttpsConnector; /// Short hand for our HTTPS enabled outbound HTTP client. type HttpClient = hyper::Client<HttpsConnector<hyper::client::HttpConnector>>; pub mod db; pub mod error; pub mod github; pub mod rest; pub mod settings;
use na::{Point4}; pub type Color = Point4<f32>; #[derive(Debug)] pub struct Material { ambient: Color, diffuse: Color, specular: Color, specular_power: f32, reflection: f32 } impl Material { pub fn new() -> Material { Material { ambient: Color::new(0.0, 0.0, 0.0, 0.0), ...
#![feature(test)] #![cfg_attr(test, deny(warnings))] extern crate futures; extern crate test; extern crate tokio_sync; type Medium = [usize; 64]; type Large = [Medium; 64]; mod tokio { use futures::{future, Async, Future, Sink, Stream}; use std::thread; use test::{self, Bencher}; use tokio_sync::mpsc...
use std::fs; use std::io; use std::io::prelude::*; use std::os::unix::fs::PermissionsExt; /// Encodes any byte stream with uuencoding. #[derive(Debug)] pub struct Encoder<T: Read> { /// File name, displayed in the output header. pub filename: String, /// Permissions mode, displayed in the output header; ...
#[doc = "Reader of register CR2"] pub type R = crate::R<u32, super::CR2>; #[doc = "Writer for register CR2"] pub type W = crate::W<u32, super::CR2>; #[doc = "Register CR2 `reset()`'s with value 0"] impl crate::ResetValue for super::CR2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use std::io; use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use futures::{Async, AsyncSink, Poll, Sink, StartSend, Stream}; use tokio::net::UdpSocket; use tokio_io::codec::{Decoder, Encoder}; use bytes::{BufMut, BytesMut}; /// A unified `Stream` and `Sink` interface to an underlying `UdpSocket`, using /// the ...
use rune::ast; use rune::macros; use rune::{quote, Parser, Spanned, TokenStream}; use runestick::SpannedError; /// Implementation for the `stringy_math!` macro. pub(crate) fn stringy_math(stream: &TokenStream) -> runestick::Result<TokenStream> { let mut parser = Parser::from_token_stream(stream); let mut outp...
use std::error; use std::fs; use cgmath::{InnerSpace, Vector3}; use image::DynamicImage; use log::debug; use crate::geometry::Triangle; use crate::render::Renderer; pub struct Face { pub vertex: u32, pub texture: u32, pub normal: u32, } pub struct Object { pub faces: Vec<Vec<Face>>, pub vertices...
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. use crate::lexer::preproc...
#[derive(Debug, PartialEq, Eq)] enum NestedInteger { Int(i32), List(Vec<NestedInteger>), } struct Solution {} impl Solution { fn sum(nested_integer: &NestedInteger, depth: i32) -> i32 { match nested_integer { NestedInteger::Int(i) => i * depth, NestedInteger::List(l) => { ...
extern crate kdtree_na; extern crate nalgebra; extern crate num_traits; use std::sync::atomic::{AtomicUsize, Ordering}; use nalgebra::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use nalgebra::{storage::Storage, vector, DVector, Dim, Matrix, Norm, SimdComplexField, Vector2}; use num_traits::Z...
use super::*; #[test] fn with_binary_encoding_atom_that_does_not_exist_errors_badarg() { // :erlang.term_to_binary(:non_existent_0) tried_to_convert_to_an_atom_that_doesnt_exist(vec![ 131, 100, 0, 14, 110, 111, 110, 95, 101, 120, 105, 115, 116, 101, 110, 116, 95, 48, ]); } #[test] fn with_binary_e...
//! Abstracts kernels so we can build generic methods to test them. //! Kernel also defines a function generate_dump that is used to dump the list of actions taken for //! a specific implementation of a kernel, which in turn allows to run tests on this specific //! implementation. generate_dump is only used in binary s...
use crate::instruction::Instruction; use std::collections::VecDeque; pub fn parse(bytes: &[u8]) -> VecDeque<Instruction> { let mut instructions = VecDeque::with_capacity(bytes.len()); for b in bytes { if let Some(i) = parse_byte(*b) { instructions.push_back(i); } } instruc...
#[doc = "Reader of register MPCBB1_VCTR52"] pub type R = crate::R<u32, super::MPCBB1_VCTR52>; #[doc = "Writer for register MPCBB1_VCTR52"] pub type W = crate::W<u32, super::MPCBB1_VCTR52>; #[doc = "Register MPCBB1_VCTR52 `reset()`'s with value 0xffff_ffff"] impl crate::ResetValue for super::MPCBB1_VCTR52 { type Typ...
use super::RectTransform; use crate::codec::{Decode, Encode}; use crate::{remote_type, RemoteEnum, RemoteObject, Vector3}; remote_type!( /// A text label. object UI.Text { properties: { { RectTransform { /// Returns the rect transform for the text. /// ...
// Copyright 2023 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 ...
//Definition for a binary tree node. #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn new(val: i32) -> Self { TreeNode { val, left...
use ::{ grammar, translate, PegCompiler }; fn compile(src: &str) -> PegCompiler { let mut compiler = PegCompiler::new(); let file = compiler.codemap.add_file("input.test".into(), src.into()); let ast_items = grammar::items(&file.source(), file.span).unwrap(); translate::Grammar::from_ast(&mut compiler, ast_items)...
use std::time::Duration; use alacritty_config_derive::ConfigDeserialize; use alacritty_terminal::config::Program; use alacritty_terminal::term::color::Rgb; #[derive(ConfigDeserialize, Clone, Debug, PartialEq, Eq)] pub struct BellConfig { /// Visual bell animation function. pub animation: BellAnimation, ...
// Copyright 2018 Steve Smith (tarkasteve@gmail.com). 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...
use xshell::{Shell, cmd}; fn main() { let sh = Shell::new().unwrap(); let stdout = cmd!(sh, "echo hello world").read().unwrap(); print!("{}\n", stdout) }
use super::Intersects; use super::aabb::{Aabb2, Aabb3}; use cgmath::{Point, Point2, Point3}; use cgmath::{Vector3, Vector2}; #[test] fn test_aabb2_collide() { let a = Aabb2::new(Point2::new(0f32, 0.), Point2::new(1f32, 1.)); let table = [(Point2::new(0.9f32, 0.9f32), true), ...
//! A library for generating prime numbers using a segmented sieve. mod iterator; mod segsieve; mod segment; mod sieve; mod wheel; pub use sieve::{Sieve, SieveIterator};
use std::fmt; use base32; pub struct Sequence { // TODO: make private pub fields: Vec<Vec<Field>>, } #[derive(Clone)] pub struct Field { pub note: Note, pub cmd: Command, } #[derive(Clone)] pub enum Note { On(u8), Off, Hold, } #[derive(Clone)] pub struct Command { pub id: u8, pub ...
pub mod model; pub use model::*; pub mod spotify;
use std::env; use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>> where P: AsRef<Path>, { let file = File::open(filename)?; Ok(io::BufReader::new(file).lines()) } fn main() { let args: Vec<String> = env::args...
use crate::cli; use crate::fs; pub fn run() { let masses: Vec<usize> = fs::read_lines(cli::aoc_filename("aoc_2019_01.txt"), |l| { l.parse::<usize>().unwrap() }) .unwrap(); let fuel: usize = masses.iter().map(needed_fuel).sum(); println!("Fuel needed: {}", fuel); let fuel: usize = mas...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use std::convert::TryInto; use anyhow::*; use liblumen_alloc::atom; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::{Monitor, Process}; use liblumen_alloc::erts::term::prelude::*; use crate::erlang::node_0; use crate::runtime::context:...
//! A self balancing binary tree use std::cmp::{Ord, Ordering, max}; use std::mem::replace; use std::collections::VecDeque; struct AvlNode<K: Ord, V> { key: K, val: V, height: i32, left: AvlTree<K,V>, right: AvlTree<K,V> } /// A map based on a binary tree that self balances using the AVL algorith...
use crate::{ objects::{Cube, Object}, Result, }; use std::path::Path; use winit::{dpi::PhysicalSize, window::Window}; pub mod pipeline; pub mod texture; pub use texture::Texture; pub struct Renderer { surface: wgpu::Surface, _adapter: wgpu::Adapter, pub device: wgpu::Device, pub queue: wgpu::Q...
//! A channel for sending a single message between asynchronous tasks. use loom::{ futures::task::{self, Task}, sync::atomic::AtomicUsize, sync::CausalCell, }; use futures::{Async, Future, Poll}; use std::fmt; use std::mem::{self, ManuallyDrop}; use std::sync::atomic::Ordering::{self, AcqRel, Acquire}; u...
//! Load MP3 files use crate::audio::GenericMusicStream; use std::{io, iter::Peekable}; use simplemad::{self, Decoder, MadFixed32, SimplemadError}; /// Lazy iterator over audio samples from an MP3 struct MP3Samples<R: io::Read + Send> { decoder: Peekable<simplemad::Decoder<R>>, current_samples: Option<Vec<V...
pub const EXPECTED_TOTAL_WORDS: usize = 6; pub const EXPECTED_TOTAL_LINES: usize = 3; pub const EXPECTED_UNIQUE_WORDS: usize = 3; pub const EXPECTED_ERROR: &str = "test error"; pub fn new_wordcount() -> wordcount_core::WordCount { wordcount_core::WordCount { total: EXPECTED_TOTAL_WORDS, lines: EXPE...
pub mod dom; pub mod drag; pub mod focus; pub mod gamepad; pub mod history; pub mod keyboard; pub mod mouse; pub mod pointer; pub mod progress; pub mod socket; pub mod slot; pub mod touch;
#[repr(C)] #[derive(Copy, Clone, Debug, Default)] pub struct VkExtent2D { pub width: u32, pub height: u32, }
use std::time::{Instant}; #[derive(Debug)] struct Node { value: u32, next: Option<Box<Node>> } fn main() { let INPUT = "469217538"; let len = INPUT.len(); let mut next_cup_vec = Vec::new(); next_cup_vec.resize((len+1) as usize, 0); let input_vec: Vec<_> = INPUT.chars().map(|x| x.to_st...
// 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...
use serde::Deserialize; use serde_json as json; use std::fs::{self, File}; use std::io::Read; use std::path::Path; use alacritty_terminal::ansi; use alacritty_terminal::config::Config; use alacritty_terminal::event::{Event, EventListener}; use alacritty_terminal::grid::{Dimensions, Grid}; use alacritty_terminal::inde...
//! Provides the `Installer` type, which represents a provisioned Node installer. use std::fs::{rename, File}; use std::path::PathBuf; use std::string::ToString; use super::{Distro, Fetched}; use catalog::NodeCollection; use distro::error::DownloadError; use fs::ensure_containing_dir_exists; use node_archive::{self, ...
//! Wrapper of [`tokio::process::Command`]. use crate::process::process_output; use std::path::Path; use tokio::process::Command; /// Executes the command and redirects the output to a file. pub async fn write_stdout_to_file<P: AsRef<Path>>( cmd: &mut Command, output_file: P, ) -> std::io::Result<()> { le...
extern crate bigint; extern crate block; extern crate evm; extern crate evm_network_classic; extern crate evm_stateful; extern crate hexutil; extern crate trie; #[macro_use] extern crate lazy_static; use bigint::{Address, Gas, U256}; use block::TransactionAction; use evm::{AccountChange, HeaderParams, SeqTransactionVM...
// 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. // Read kernel logs, convert them to LogMessages and serve them. use crate::logs::logger; use byteorder::{ByteOrder, LittleEndian}; use fidl_fuchsia_logge...
use std::env; use n3_machine_ffi::{MachineId, MachineIdSet, WorkId}; pub fn parse_ids() -> Option<MachineIdSet> { let mut args = env::args().skip(1); let work: WorkId = args.next()?.parse().unwrap(); let primary: MachineId = args.next()?.parse().unwrap(); Some(MachineIdSet { work, pr...
use serde::Deserialize; use serde_json::Value; use crate::apis::flight_provider::raw_models::airline_code_raw::AirlineCodeRaw; use crate::apis::flight_provider::raw_models::airport_instance_info_raw::AirportInstanceInfoRaw; use crate::apis::flight_provider::raw_models::airport_instance_position_raw::AirportInstancePos...
pub mod rpc; #[macro_use] extern crate log; extern crate morgan_interface; #[cfg(test)] #[macro_use] extern crate serde_json;
use std::io::{self, BufRead}; use std::process; mod game; fn ask() -> String { println!("Your guess (one letter please)?"); let stdin = io::stdin(); let result = stdin.lock().lines().next().unwrap().unwrap().trim_end().to_string(); result } fn main() { let thumbs_up = "\u{1F44D}"; let red_x = ...
use proc_macro2::TokenStream; use quote::{format_ident, quote, ToTokens}; use syn::{ braced, parse::{Lookahead1, Parse, ParseStream}, token::Brace, Expr, Ident, Path, Token, Type, }; #[derive(Debug)] pub struct Element { open_tag: OpenTag, children: Vec<Node>, close_tag: Option<CloseTag>, }...
#[macro_use] extern crate log; use futures::sync::mpsc; use futures::{future, Future, Sink, Stream}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; use tokio::executor::DefaultExecutor; use tokio::net::TcpListener; use tokio_rustls::{ rustls::{AllowAnyAuthenticatedClient, RootCertStore, ServerConfig},...
use alloc::vec::Vec; pub unsafe fn deallocate<T>(ptr: *mut T, capacity: usize) { let _vec: Vec<T> = Vec::from_raw_parts(ptr, 0, capacity); // Let it drop. }
use cql_ffi::statement::CassStatement; use cql_bindgen::CassPrepared as _CassPrepared; use cql_bindgen::cass_prepared_free; use cql_bindgen::cass_prepared_bind; //use cql_bindgen::cass_prepared_parameter_name; //use cql_bindgen::cass_prepared_parameter_data_type; //use cql_bindgen::cass_prepared_parameter_data_type_by...
use input_i_scanner::InputIScanner; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),...
use std::{collections::HashMap, sync::Arc}; use tokio::{ fs::File, io::{AsyncRead, AsyncWrite}, sync::mpsc::Sender, }; use crate::{ config::Config, fs, fs::FileInfo, sync::file_events_buffer::FileEventsBuffer, sync::SyncEvent, IronCarrierError, }; use crate::network::streaming::{FileReceiver, File...
// `without_binary_errors_badarg` in unit tests // `with_utf8_binary_without_base_errors_badarg` in unit tests test_stdout!(with_binary_with_integer_in_base_returns_integer, "2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n"); // `wit...
//!Game rounds logic mod operating_round; mod priv_auction; mod stock_round; pub use operating_round::OperatingRound; pub use priv_auction::PrivAuction; pub use stock_round::StockRound;
#[doc = "Reader of register APB1RSTR"] pub type R = crate::R<u32, super::APB1RSTR>; #[doc = "Writer for register APB1RSTR"] pub type W = crate::W<u32, super::APB1RSTR>; #[doc = "Register APB1RSTR `reset()`'s with value 0"] impl crate::ResetValue for super::APB1RSTR { type Type = u32; #[inline(always)] fn re...
use crate::round; pub struct Game { pub controller: round::Controller, } impl Game { pub fn welcome(&self) { println!("1 2 3 "); println!("4 5 6 "); println!("7 8 9 "); } pub fn playing(&self) -> bool { self.controller.has_next_round() } pub fn play(&mut self)...
#[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 0x83"] impl crate::ResetValue for super::CR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const CLSID_DeviceIoControl: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x12d3e372_874b_457d_9fdf_73977778686c); #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn...
use crossbeam; use std::sync::Arc; use std::fs::{self, File}; use std::io::{self, Read}; use std::path::Path; use std::collections::HashMap; use std::ffi::OsStr; use liquid::Value; use walkdir::WalkDir; use document::Document; pub fn build(source: &Path, dest: &Path, layout_str: &str, posts_str: &str) -> io::Result<(...
#![allow(unused_imports)] use std::path::Path; mod utils; use utils::read_file; mod solutions; use solutions::a::main as solve; #[test] fn a() { let v = file!(); let base_path = Path::new(v); let file_stem = base_path.file_stem().unwrap(); let file_parent = base_path.parent().unwrap(); let input...
mod hid; pub use hid::*;
use ggez::graphics as ggraphics; use ggez::input::mouse::MouseButton; use ggez::*; use std::env; use std::path; use torifune::core::Clock; use torifune::core::Updatable; use torifune::device; use torifune::graphics::object as tobj; use torifune::graphics::object::*; use torifune::graphics::drawable::*; use torifune::nu...
//! # dynonym - The API documentation //! //! Welcome to the `dynonym` API documentation! //! //! This document is a technical reference for developers using `dynonym` as library crate. //! Since `dynonym` is mainly used as an application, you're probably more interested in a user //! guide. In that case, please have a...
//! `refs` or the references of dag-pb and other supported IPLD formats functionality. use crate::ipld::{decode_ipld, Ipld}; use crate::{Block, Ipfs, IpfsTypes}; use async_stream::stream; use cid::{self, Cid}; use futures::stream::Stream; use std::borrow::Borrow; use std::collections::HashSet; use std::collections::Ve...
pub mod test_helpers; mod file_finder_test_suite_walkdir { use crate::test_helpers::*; use hackscanner_lib::file_finder::walkdir::FileFinder; use hackscanner_lib::file_finder::FileFinderTrait; #[test] fn find_files_test() { let rules = get_rules_multiple_results(); let matches = Fi...
pub extern crate image; pub extern crate vecmath; use image::Rgb; use vecmath::Vector3; pub type Vecf = Vector3<f32>; pub type Color = Rgb<u8>; pub mod scene; pub mod view;
pub mod clamp; pub mod logger; pub mod path; pub mod uv; pub use self::clamp::*; pub use self::logger::setup_logger; pub use self::path::cargo_path; pub use self::uv::*;
// calculater module to perform all kind of calculations mod calculater { // sub module for arthmetic_operations pub mod arthmetic_opertions { pub fn add (input_1: f32, input_2: f32) -> f32 { let result = input_1 + input_2; result } } } fn main() { let variable_1 = 11.2; let variable_2 =...
extern crate structopt; use example::player::*; use example::player_connection::*; use example::{connection_handler::*, opt::*}; use spatialos_sdk::worker::connection::Connection; use spatialos_specs::*; use specs::prelude::*; use std::thread; use std::time::Duration; use structopt::StructOpt; fn main() { let opt...
pub mod float_to_string; use std::convert::TryInto; use std::sync::atomic::AtomicUsize; use std::sync::Arc; use num_bigint::BigInt; use num_traits::Num; use proptest::strategy::{Just, Strategy}; use proptest::test_runner::{Config, TestCaseResult, TestRunner}; use proptest::{prop_assert, prop_assert_eq}; use liblu...
use fs2::FileExt; use std::fs::File; use std::io::{self, Read, Seek, SeekFrom, Write}; pub(crate) struct FileLock { f: File, } impl FileLock { pub(crate) fn exclusive(f: File) -> io::Result<Self> { f.lock_exclusive()?; Ok(FileLock { f }) } pub(crate) fn file(&self) -> &File { ...
use actix_web::HttpRequest; use bcrypt::{DEFAULT_COST, hash, verify}; use chrono::prelude::*; use common::Error; use jsonwebtoken as jwt; use serde::{Deserialize, Serialize}; use crate::models; const DEFAULT_USER_TOKEN_EXP: i64 = 60 * 60 * 2; // Two hours. /// Generate a bcrypt hash of the given password string. pub...
use crate::assets::database::AssetsDatabase; use specs::{System, Write}; pub struct AssetsSystem; impl<'s> System<'s> for AssetsSystem { type SystemData = Option<Write<'s, AssetsDatabase>>; fn run(&mut self, data: Self::SystemData) { if let Some(mut data) = data { data.process(); ...
#[macro_use] use psistats::{ ReporterFunction, ReporterInitFunction, ReporterConfig }; use psistats::PluginRegistrar; use psistats::PsistatsReport; use psistats::PluginError; use psistats::FunctionType; mod memory; extern "C" fn register(registrar: &mut Box<dyn PluginRegistrar + Send>) { registrar.register_plugi...
use amethyst::{GameData, SimpleState, SimpleTrans, StateData, StateEvent, Trans}; use amethyst::assets::{Handle, Loader, AssetStorage}; use amethyst::core::ecs::{Entity, WorldExt, World, Builder}; use amethyst::input::{is_close_requested, is_key_down, VirtualKeyCode}; use amethyst::renderer::{SpriteSheet, Texture, Imag...
use nalgebra as na; use na::{allocator::Allocator, RealField, DimName, Point, VectorN, DefaultAllocator}; /// Given a vector of `D`-dimensional points in `N`, returns the centroid. /// When no points, returns the origin. Safe to use with INF and NaNs. pub fn get_centroid<N, D>(points: &Vec<Point<N, D>>) -> Point<...
use crate::dto::Link; use crate::http::Http; use crate::parser::{Html, Links, Paging}; use std::convert::TryFrom; use crate::config::Config; use std::sync::{mpsc, Arc}; use std::thread; use std::collections::HashMap; use crate::http::CurlHttp; use std::cmp::min; #[derive(Debug)] pub enum Command { Query { query: S...
// every T implicity as T: Sized, and the ? undoes this default struct Foo<T: ?Sized> { f: T, }
#[macro_use] extern crate clap; use color_eyre::eyre::Result; use hecs::World; use smol::future; use std::{ collections::VecDeque, net::SocketAddr, sync::{Arc, RwLock}, time::{Duration, Instant}, }; use crate::{ constants::*, cvars::{set_cli_cvars, Config, NetConfig}, networking::Networkin...
use std::borrow::BorrowMut; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use rbatis_core::convert::StmtConvert; use crate::ast::ast::RbatisAST; use crate::ast::node::node::{create_deep, do_child_nodes, print_child, SqlNodePrint}; use crate::ast::node::node_type::NodeType; use crate::engine::ru...
use crate::ast::*; use std::collections::HashMap; pub(crate) trait Visitor { fn visit_binder(&mut self, _: &mut Option<usize>, _: &mut String) {} fn visit_expression(&mut self, _: &mut Expression) {} fn leave_expression(&mut self, _: &mut Expression) {} fn visit_reference(&mut self, _: &mut Option<usi...
use smartcore::dataset::*; // DenseMatrix wrapper around Vec use smartcore::linalg::naive::dense_matrix::DenseMatrix; // K-Means use smartcore::cluster::kmeans::{KMeans, KMeansParameters}; // DBSCAN use smartcore::cluster::dbscan::{DBSCANParameters, DBSCAN}; // PCA use smartcore::decomposition::pca::{PCAParameters, PCA...
/* origin: FreeBSD /usr/src/lib/msun/src/e_asinf.c */ /* * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. bus...
#[doc = "Reader of register CFGR2"] pub type R = crate::R<u32, super::CFGR2>; #[doc = "Writer for register CFGR2"] pub type W = crate::W<u32, super::CFGR2>; #[doc = "Register CFGR2 `reset()`'s with value 0"] impl crate::ResetValue for super::CFGR2 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use std::collections::HashMap; mod network { pub trait SockUtilTrait { fn connect(host: String, port: usize, b_async: bool, local_ip: String, local_port: usize) -> usize; fn listen(port: usize, local_ip: String, back_log: usize) -> usize; fn bind_udp_sock(port: usize, local_ip: String) -> u...
//! Iterating over set flag values. use crate::{Flag, Flags}; /// An iterator over a set of flags. /// /// Any bits that don't correspond to a valid flag will be yielded /// as a final item from the iterator. pub struct Iter<B: 'static> { inner: IterNames<B>, done: bool, } impl<B: Flags> Iter<B> { /// Cr...
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. use hashbrown::{hash_map,...
use wasc::compile; use wasc::context; use wasc::gcc; fn main() -> Result<(), Box<dyn std::error::Error>> { // Usage of wasc: // // wasc // --gcc [GCC binary] // -p --platform [PLATFORM] // -s --save // -v --verbose // --wasm [WAVM binary] // source [WASM/WA(S...
use std::ptr; use libc::c_int; use curses; use {Error, Result, Attributes as Attr}; use super::Window; pub struct Attributes<'a> { window: &'a mut Window<'a>, } impl<'a> Attributes<'a> { #[inline] pub unsafe fn wrap<'b>(window: &'b mut Window<'b>) -> Attributes<'b> { Attributes { window: window } } } impl<'a>...
use log::{self, debug}; use aws_sdk_dynamodb::Client; use aws_sdk_dynamodb::{error::PutItemError, output::PutItemOutput, types::SdkError}; use crate::types::Storable; pub async fn store_database_item( table_name: &str, data: &impl Storable, client: &Client, ) -> Result<PutItemOutput, SdkError<PutItemErro...
use wce_formats::binary_reader::BinaryReader; use wce_formats::blp::BLP; use wce_formats::MapArchive; use crate::globals::MAP_MINIMAP; use crate::OpeningError; pub struct MinimapFile { minimap: BLP } impl MinimapFile { pub fn read_file(map: &mut MapArchive) -> Result<Self, OpeningError>{ let file = ...
use super::text_doc::TextDoc; use jsonrpc_core::request::Notification; use jsonrpc_core::Params; use lsp_types::*; use pine::ast::input::StrRange; use std::collections::HashMap; use std::sync::mpsc::Sender; pub struct PineServer<'a> { init_params: Option<InitializeParams>, text_docs: HashMap<Url, TextDoc<'a>>,...
use actix_web::{http::StatusCode, FromRequest, HttpResponse, Json, Path, Query}; use bigneon_api::controllers::events; use bigneon_api::controllers::events::*; use bigneon_api::models::PathParameters; use bigneon_api::models::*; use bigneon_db::models::*; use chrono::prelude::*; use serde_json; use support; use support...
pub use VkImageUsageFlags::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkImageUsageFlags { VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x0000_0001, VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x0000_0002, VK_IMAGE_USAGE_SAMPLED_BIT = 0x0000_0004, VK_IMAGE_USAGE_STORAGE_BIT = 0x0000_0008, VK_I...
#[path = "math/random_integer_1.rs"] pub mod random_integer_1; use super::*;
// // web.rs // pub mod controllers; pub mod cors; pub mod error; pub mod guards; pub mod types; use self::controllers::*; use db::{create_pool, Pool}; use rocket::Rocket; pub fn build() -> Rocket { rocket::ignite() .manage(Pool(create_pool())) .mount( "/", routes![ ...
// @author shailendra.sharma use std::ops::Range; use std::slice::Iter; use arrayvec::ArrayVec; use crate::bit_page::BitPage; pub enum BitPageActiveBitsIterator { AllZeroes, AllOnes { range: Range<usize> }, Some { iter: Box<dyn Iterator<Item = usize>> }, } impl<'a> Iterator for BitPageActiveBitsIterator...
// This example demonstrates a use-case where a lifetime in the owner is required. use std::borrow::Cow; use self_cell::self_cell; type Ast<'a> = Vec<&'a str>; self_cell!( struct AstCell<'input> { owner: Cow<'input, str>, #[covariant] dependent: Ast, } ); impl<'input> AstCell<'inpu...