text
stringlengths
8
4.13M
use readers::prelude::{Index, IndexIterator}; #[derive(Debug)] pub struct ArrayIndexRefIterator<'a> { // current moving pivot pivot: usize, index: &'a mut [Index], // list of unbounded dimension of the original index unbounded_dims: &'a [usize], // list of indice that we are going to indices: &'a [Vec<us...
extern crate hackishlibsnarkbindings; extern crate sha2; extern crate rand; use sha2::digest::Digest; use sha2::sha2::Sha256; use rand::{Rng,thread_rng}; use std::io::Read; use std::fs::File; use hackishlibsnarkbindings::*; fn get_path(at: usize, tree: &[Vec<u8>]) { unimplemented!() } fn random_digest() -> Vec<...
//! TCP network program example. use std::net::{TcpListener, TcpStream, SocketAddr}; // use std::net::{Ipv4Addr, IpAddr}; pub fn run_server() -> Result<(), Box<dyn std::error::Error>> { // try bind { if let Err(e) = TcpListener::bind("0.0.0.0:22222") { error!("{}", e); return Er...
//! [Problem 008](https://projecteuler.net/problem=8) #[macro_use(problem)] extern crate euler_lib; use euler_lib::problems::set_one::{largest_product_in_series}; use euler_lib::problems::input::{P008}; fn compute(n: u64, s: &'static str) -> u64 { largest_product_in_series(n, s) } fn solve() -> String { compute...
// (c) Copyright 2018 Palantir Technologies Inc. All rights reserved. // // 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 req...
use svm_sdk_alloc::Ptr; use svm_sdk_host::Host; use svm_sdk_types::{Address, Amount, LayerId}; use core::mem::MaybeUninit; /// ### `offset` meaning in this file: /// /// The parameter `offset` here denotes a memory address integer serving as a pointer to a cell /// within the current running WASM instance. Counting i...
use crate::context::CoinsActivationContext; use crate::prelude::*; use crate::standalone_coin::{InitStandaloneCoinActivationOps, InitStandaloneCoinError, InitStandaloneCoinInitialStatus, InitStandaloneCoinTaskHandle, InitStandaloneCoinTaskManagerShared}; use asy...
use std::cmp::{Ord, Ordering::*}; use std::collections::hash_map::DefaultHasher; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::ops::Index; use nohash_hasher::{BuildNoHashHasher, IntMap}; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Id<T> { key: T, } impl<T> Id...
//! `layout.toml` config file for project memory layout. use crate::{ addr, size, HEAP_POOL_SIZE, HEAP_PREFIX_SIZE, STREAM_GLOBAL_RUNTIME_SIZE, STREAM_RUNTIME_SIZE, }; use drone_stream::MIN_BUFFER_SIZE; use eyre::{bail, eyre, Result, WrapErr}; use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use std::p...
// //! Copyright 2020 Alibaba Group Holding Limited. //! //! 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 crate::core::BitView; pub struct EventAttributes(pub(crate) u16); #[allow(non_upper_case_globals)] pub(super) mod bits { pub const SpecialName_bit: usize = 9; pub const RTSpecialName_bit: usize = 10; } impl EventAttributes { pub fn special_name(&self) -> bool { self.0.get_bit(bits::SpecialNam...
use async_trait::async_trait; use protocol::traits::{Context, Gossip, MessageCodec, Priority}; use protocol::{Bytes, ProtocolResult}; use tentacle::secio::PeerId; use tentacle::service::TargetSession; use crate::endpoint::Endpoint; use crate::error::NetworkError; use crate::message::{Headers, NetworkMessage}; use crat...
use super::ctypes::*; extern "C" { pub fn Print(s: *const CHAR16, ...) -> (); pub fn InitializeLib(handle: EFI_HANDLE, table: *const EFI_SYSTEM_TABLE) -> (); }
use std::collections::VecDeque; use std::str::FromStr; // path, next, parts type Queue = VecDeque<(Vec<Part>, usize, Vec<Part>)>; fn main() { let parts = load_parts(); let mut queue: Queue = VecDeque::new(); // initial entries for (index, _) in parts.iter().enumerate().filter(|&(_, ref p)| p.can_conn...
use super::Checksum; use failure::{Error, ResultExt}; use flate2::read::GzDecoder; use git2::{ObjectType, Repository}; use reqwest::Client; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use sha2::{Digest, Sha256}; use std::{fmt, fs, io::BufReader, path::PathBuf, str::FromStr}; use tar::Archive; use...
fn main() { let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); //println!("{}",input); let n = input.trim().parse::<i32>().unwrap(); for _ in 0..n { let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); let inp...
struct Solution; impl Solution { fn max_vowels(s: String, k: i32) -> i32 { let n = s.len(); let s: Vec<char> = s.chars().collect(); let k = k as usize; let mut cur = 0; let mut res = 0; for i in 0..n { if Self::is_vowel(s[i]) { cur += 1; ...
use projectRust::image_struct::Image; use std::path::Path; fn main(){ let pathPPM = Path::new("mandelbrot.ppm"); let pathTXT = Path::new("test.txt"); let img = Image::new_with_file(pathPPM); let imgtxt = Image::new_with_file(pathTXT); img.toString(); }
use actix_web::{get,put,delete,Responder,HttpResponse,web}; #[path="service.rs"] mod service; #[get("/")] async fn index() -> impl Responder { format!("Endpoints: /edges ") } #[get("/edges")] pub async fn list_edges() -> HttpResponse { let edge = service::list_edges().await; HttpResponse::Ok().json(edge)...
use clouseau::parse_query; use clouseau::{query::Context, Queryable, Value}; use std::convert::{TryFrom, TryInto}; #[derive(Debug, Clone, Queryable)] struct NonTransparent(u64); // Transparent, treat the struct as a u64 #[derive(Debug, Clone, Queryable)] #[clouseau(transparent)] struct Transparent1(u64); // Treated ...
#[doc = "Reader of register WF6"] pub type R = crate::R<u8, super::WF6>; #[doc = "Writer for register WF6"] pub type W = crate::W<u8, super::WF6>; #[doc = "Register WF6 `reset()`'s with value 0"] impl crate::ResetValue for super::WF6 { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { ...
//! Definitions of custom errors used in clima use { custom_error::custom_error, std::io, }; custom_error! {pub ProgramError NoPathProvided { } = "No Path Provided", FileNotFound { path: String } = "File not found: {path}", NotRegular { path: String } = "Not a regular file: {path}", Network { s...
// Copyright 2020 The Jujutsu 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
pub mod test_geometry; #[test] pub fn the_dummy_test() { println!("hello there from the dummy test"); assert!(true); }
use crate::video_model::window::Window; #[derive(Debug, Deserialize)] pub struct Platform { status: Option<String>, #[serde(default)] exploitation_windows: Option<Vec<Window>>, remote_id: Option<String>, }
//! Learning about RGB blending: //! how to calculate the color of shapes with <100% opacity. use cairo; use cairo::{Context, ImageSurface, Surface}; use calc_rgb; use cocoa::foundation::NSPoint; use lerp_rgb; use libc::c_void; use old_rand; use gen_rand_f64; use rgb_to_f64; /// Draw a rectangle to the given RGB24/AR...
fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let mut input:Vec<i32> = s.split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect(); input.sort(); let ans = input[2] - input[0]; println!("{}",ans); }
use std::collections::HashMap; #[derive(Clone, Debug)] enum Source { Wire(String), Value(u32), } use self::Source::*; #[derive(Clone, Debug)] enum Connection { Signal(Source, String), Not(Source, String), And(Source, Source, String), Or(Source, Source, String), LShift(Source, Source, Stri...
use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, Data, DeriveInput}; #[proc_macro_derive(PhysicsLayer)] pub fn derive_layer(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); let enum_ident = input.ident; let variants = match &input.data ...
mod irc; mod jenkins; use std::time::Instant; use std::sync::mpsc; use std::sync::Arc; use std::thread; use ::irc::client::prelude::{Client, ClientExt, Command, IrcClient}; use ::irc::proto::message::Message; use ::irc::proto::ChannelExt; use self::irc::IrcListener; use self::jenkins::cache::Name; use self::jenki...
struct Solution; impl Solution { pub fn minimum_length_encoding(words: Vec<String>) -> i32 { let mut set = words .clone() .into_iter() .collect::<std::collections::HashSet<String>>(); for s in words { let cs = s.chars().collect::<Vec<_>>(); ...
pub mod conversions; use std::iter; use std::fmt; use std::default::Default; pub struct DSMatrix<T> { num_rows: u32, num_columns: u32, values: Vec<T>, } pub struct DSMatrixCoordIter { num_rows: u32, num_columns: u32, current_row: u32, current_column: u32, } pub type MatrixOpResult<T> = R...
use magickwand_sys::ExceptionType; #[derive(Debug)] pub enum MagickError { NulError(std::ffi::NulError), Utf8Error(std::str::Utf8Error), NullPointerResult(&'static str), MagickException(ExceptionType, String), } impl std::error::Error for MagickError {} impl std::fmt::Display for MagickEr...
use super::intcode::Intcode; pub fn part1(input: &str) -> Result<u64, String> { let mut intcode: Intcode = input.parse()?; intcode.input_str( " NOT A J NOT B T OR T J NOT C T OR T J AND D J WALK " .trim_start(), ); intcode.run(); println!("{}", intcode.output_string()); matc...
//! This module contains a single helper function #![allow(unsafe_code)] use crate::backend::framebuffer::Framebuffer; use crate::backend::quadrender::setup_quad; use crate::backend::shader::Shader; use crate::backend::shader_strings; use crate::backend::FractalPlatform; use crate::backend::PlatformGL; use crate::bac...
#[derive(Debug, Clone, Default)] pub struct DrawingPart {}
use rand::{Rng, weak_rng}; use rust_crypto::digest::Digest; use util::xor_bytes; use sha1::Sha1; fn valid_mac(key: &[u8], msg: &[u8], mac: &[u8]) -> bool { let mut m = Sha1::new(); let mut out = [0_u8; 20]; m.input(key); m.input(msg); m.result(&mut out); &out == mac } #[test] fn run() { l...
use criterion::{criterion_group, BenchmarkId, Criterion}; const RANGE_OF_VALUES: [usize; 4] = [8, 16, 32, 64]; use stabchain::group::orbit::transversal::simple_transversal::{ transversal, transversal_complete_opt, }; use stabchain::group::Group; use stabchain::perm::actions::SimpleApplication; // Comparing orbit...
pub fn build_proverb(items: Vec<&str>) -> String { let mut proverb_vec: Vec<String> = Vec::new(); let number_of_items = items.len(); let mut has_horse = false; if number_of_items <= 0 { return String::new(); } else { for i in 0..(number_of_items - 1) { if items[i] == "h...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Softwa...
use crate::{Tree, Entity, GenerationalId}; /// Iterator for iterating through the children of an entity. pub struct ChildIterator<'a> { pub tree: &'a Tree, pub current_forward: Option<Entity>, pub current_backward: Option<Entity>, } impl<'a> Iterator for ChildIterator<'a> { type Item = Entity; fn ...
use std::fmt::{self, Display, Formatter}; use std::ops::{Index, IndexMut}; #[derive(Debug, Clone, Copy)] pub enum Opponent { X, O, } #[derive(Debug, Clone, Copy)] pub struct OpponentSpot(pub Option<Opponent>); impl Display for OpponentSpot { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { ...
use crate::Vector2; pub struct PlayerWalkAction { pub direction: Vector2, } pub struct PlayerLookAction { pub direction: Vector2, } pub struct PlayerCastAction { pub cast_position: Vector2, pub target_position: Vector2, }
#![allow(dead_code)] #![allow(unused_imports)] #[macro_use] mod util; use util::*; use_ch!(s1, ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8); use_ch!(s2, ch9, ch10, ch11, ch12, ch13, ch14, ch15, ch16); pub mod s3; use s3::ch17;
use std::error::Error; pub trait Game where Self: Sized, { type State: State<Self>; type Move; type Result; type View; type Error: Error; fn initial_state(&self) -> Self::State; } pub enum ProgressReport<G> where G: Game, { Finished(<G as Game>::Result), InProgress(<G as Game>...
use wasm_bindgen::JsValue; use crate::Result; /// Safely extract a JsValue into a rust String fn extract_string(target: &JsValue) -> Result<String> { target .as_string() .ok_or_else(|| "failed to extract string value".into()) } /// Parse a string JsValue into an i64 pub(crate) fn long(target: &Js...
use bracket_lib::prelude::*; use glsp::{GResult, RGlobal, Val}; use crate::{ api::{set_char, set_console, CommandQueue, GlspCommand}, utils::ss_idx, BG_COLOR, CONSOLE_BG, CONSOLE_UI, }; pub fn bind_gui() -> GResult<()> { glsp::bind_rfn("draw-box", &draw_box)?; glsp::bind_rfn("draw-h-bar", &progres...
pub mod test_dimensional_alignment; pub mod test_value_alignment;
extern crate starlia; use starlia::*; fn main() { }
extern crate crypto; extern crate uuid; use self::crypto::digest::Digest; use self::crypto::sha2::Sha256; use self::uuid::Uuid; use std::collections::hash_map::{HashMap,Values}; use std::fmt; use std::cmp::{min}; pub type Name = Vec<u8>; /// UUIDs are used to uniquely identify a timeline. To generate this, /// the h...
use crate::utils::tree::TreeNode; use std::cell::RefCell; use std::rc::Rc; pub struct Solution {} impl Solution { pub fn max_depth(root: Option<Rc<RefCell<TreeNode>>>) -> i32 { if let Some(real_node) = root { return 1 + Self::max_depth(real_node.as_ref().borrow().left.clone()) ...
use crate::debug; use crate::graphics::{Framebuffer, GraphicsSettings}; use alloc::string::String; use alloc::vec; use alloc::vec::Vec; use psf::Font; use spin::Mutex; // base color, simply white for now const BACKGROUND_COLOR: u32 = 0x000000; const FOREGROUND_COLOR: u32 = 0xffffff; #[derive(Eq, PartialEq, Clone, Cop...
#![feature(float_to_from_bytes)] use chrono::{Datelike, Timelike, Utc, Local}; use std::str; use std::fs::*; use std::fs; use std::fs::OpenOptions; use std::io::prelude::*; use std::path::Path; use std::error::Error; use std::borrow::BorrowMut; use cursive::event::Key; use cursive::direction::Direction; use cursive::e...
#[doc = "Register `MOSI` reader"] pub struct R(crate::R<MOSI_SPEC>); impl core::ops::Deref for R { type Target = crate::R<MOSI_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<MOSI_SPEC>> for R { #[inline(always)] fn from(reader: crate::R<MOSI_SP...
use crate::component::Component; use crate::views::{View, ViewMut}; use core::ops::Not as NotOps; /// Used to filter out components. /// /// Get and iterators will skip entities that have this component. /// Simply add `!` in front of the view reference at iterator creation. /// /// ### Example /// ``` /// use shipy...
mod comment; mod string; mod _char; mod anysymbol; use crate::TokenIterator; use crate::tokens::Token; impl<'a, 'b> TokenIterator<'a, 'b> { #[inline] pub(crate) fn parse_symbol(&mut self, first: char) -> Token<'a, 'b> { let pos = self.token_pos(); let chars = self.peek_3(); let symbol = (first, chars.0, ch...
use yew::prelude::*; use yewtil::NeqAssign; use crate::if_html; use shared::game::{clock::ClockRule, Clock, GameModifier, VisibilityMode}; pub struct ModeList { _link: ComponentLink<Self>, props: Props, } pub enum Msg {} #[derive(Properties, PartialEq, Clone)] pub struct Props { pub mods: GameModifier, ...
use std::{collections::HashMap, fs::read_to_string}; use regex::Regex; thread_local! { static HCL_RE: Regex = Regex::new(r"#[0-9a-f]{6}").unwrap(); static ECL: Vec<String> = vec![ "amb".to_owned(), "blu".to_owned(), "brn".to_owned(), "gry".to_owned(), "grn".to_owned(), ...
mod common; #[cfg(test)] mod authentication_tests { use crate::common; use environment::Environment; use base64::encode; use reqwest::StatusCode; use std::fs::{self, File}; use std::io::Read; use std::process::Child; use std::process::Command; use std::thread; use std::time::D...
#[doc = "Writer for register TASKS_HFCLKAUDIOSTART"] pub type W = crate::W<u32, super::TASKS_HFCLKAUDIOSTART>; #[doc = "Register TASKS_HFCLKAUDIOSTART `reset()`'s with value 0"] impl crate::ResetValue for super::TASKS_HFCLKAUDIOSTART { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use crate::request::{Request, RequestError}; use crate::response::{Response, StatusCode}; pub trait RequestHandler { fn handle(&self, request: &Request) -> Response; fn handle_error(&self, request: &RequestError) -> Response { Response::new(StatusCode::BadRequest, "".to_string()) } }
use std::{fs::File, io::BufReader, io::Read, mem, path::Path, sync::Arc}; use cssparser::{ self, AtRuleType, BasicParseError, BasicParseErrorKind, CowRcStr, DeclarationListParser, ParseError, ParseErrorKind, Parser, ParserInput, RuleListParser, SourceLocation, Token, }; use crate::layout::{Align, Justify}; u...
#![allow(dead_code)] use std::collections::HashMap; use super::player::{DynamicId, PlayerName, StaticId}; pub type DynIdToStaticId = HashMap<DynamicId, StaticId>; pub type StaticIdToName = HashMap<StaticId, PlayerName>; #[derive(Debug, PartialEq, Default)] pub struct IdCache { dyn_id_to_static_id: DynIdToStaticI...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. mod arena; mod block; mod error; mod impls; mod slab; mod value; pub mod from; pub mod rc; pub use arena::Arena; pub use block::{Block...
use iced::{ button, Background, Color, Vector }; #[derive(Debug, Clone, Copy)] pub enum ButtonStyle { Numbers, //1, 2, 3, 4... Operators, //+, -, *, / Characters, //= } impl Default for ButtonStyle { fn default() -> Self { Self::Numbers } } impl button::StyleSheet for ButtonStyle { ...
/** * [0459] Repeated Substring Pattern * * Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000. * * * * Examp...
#[doc = "Description cluster: Address of the PAR register which will be written\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). ...
//! Very simply library that allow compile time checked cast from and to `usize`/`isize` //! //! ``` //! use usize_cast::{IntoUsize, FromUsize, IntoIsize, FromIsize}; //! //! assert_eq!(1u64.into_usize(), 1usize); //! assert_eq!(2i64.into_isize(), 2isize); //! assert_eq!(3i64.into_isize(), 3isize); //! assert_eq!(1u32....
//! Common utilities pub mod starlark; pub const CRATES_IO_INDEX_URL: &str = "https://github.com/rust-lang/crates.io-index"; /// Convert a string into a valid crate module name by applying transforms to invalid characters pub fn sanitize_module_name(name: &str) -> String { name.replace('-', "_") } /// Some char...
// Copyright (c) 2022 PHPER Framework Team // PHPER is licensed under Mulan PSL v2. // You can use this software according to the terms and conditions of the Mulan // PSL v2. You may obtain a copy of Mulan PSL v2 at: // http://license.coscl.org.cn/MulanPSL2 // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WIT...
#![feature(test)] #![feature(bench_black_box)] use colored::*; use std::arch::x86_64::_rdtsc; use std::hint::black_box; use tp_fixedpoint::TpLnFixed; type F = TpLnFixed<20>; fn main() { let args = std::env::args().collect::<Vec<String>>(); let save = if args.len() == 2 { if args[1] == "--save-results"...
/// Sorts an input slice in-place using /// [Bubble sort](https://en.wikipedia.org/wiki/Bubble_sort). /// All kinds of slices can be sorted as long as they implement /// [`PartialOrd`](https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html). /// /// # Examples /// ```rust /// let mut slice = vec![3,2,1,4]; /// sortin...
pub mod msg; pub mod conn;
/// アプリケーション定義のエラー #[derive(Debug, Clone)] pub struct ApplicationError { /// エラーメッセージ pub description: String, } /// ApplicationError に [std::fmt::Display] としての振る舞いを実装します。 impl std::fmt::Display for ApplicationError { /// 文字列表現を返す既定の動作です。 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<...
extern crate specs; pub struct RenderSystem {}
use tiny_skia::*; #[test] fn round_caps_and_large_scale() { let mut paint = Paint::default(); paint.set_color_rgba8(50, 127, 150, 200); paint.anti_alias = true; let path = { let mut pb = PathBuilder::new(); pb.move_to(60.0 / 16.0, 100.0 / 16.0); pb.line_to(140.0 / 16.0, 100.0 /...
pub mod config; pub mod output; pub mod environment; pub mod gpm; pub mod pop; pub mod evolve;
// Copyright 2015-2020 Capital One Services, LLC // // 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 o...
pub mod account; pub mod client; pub mod util; pub mod wallet;
#![allow(unused_imports)] use tracing::{info, warn, debug, error, trace, instrument, span, Level}; use error_chain::bail; use ate::prelude::*; use std::sync::Arc; use url::Url; use std::io::stdout; use std::io::Write; use chrono::Duration; use crate::prelude::*; use crate::helper::*; use crate::error::*; use crate::re...
pub mod auth; pub mod client; #[cfg(test)] mod tests; use auth::username_token::UsernameToken; use schema::soap_envelope; use xmltree::{Element, Namespace, XMLNode}; const SOAP_URI: &str = "http://www.w3.org/2003/05/soap-envelope"; #[derive(Debug)] pub enum Error { ParseError, EnvelopeNotFound, BodyNotFo...
use super::*; pub unsafe extern "C" fn sys_fork() -> i32 { return fork(); } pub unsafe extern "C" fn sys_exit() -> i32 { exit(); return 0; // not reached } pub unsafe extern "C" fn sys_wait() -> i32 { return wait(); return 0; } pub unsafe extern "C" fn sys_kill() -> i32 { let mut pid = 0i32;...
//! The module for delta table state. use super::{ ApplyLogError, CheckPoint, DeltaDataTypeLong, DeltaDataTypeVersion, DeltaTable, DeltaTableConfig, DeltaTableError, DeltaTableMetaData, }; use crate::action::{self, Action}; use crate::delta_config; use chrono::Utc; use object_store::ObjectStore; use serde::{De...
use crate::structs::{AimCoords}; pub fn part2(input: &Vec<(String, i32)>) { let mut coord = AimCoords::new(); for line in input { match &line.0[..] { "forward" => coord.forwards(line.1), "up" => coord.up(line.1), "down" => coord.down(line.1), _ => () ...
//! Interpolating based on healpix data use std::{ fmt::Debug, ops::{Div, Mul}, }; use super::utils::nside2npix; use crate::coordinates::SphCoord; use crate::utils::regulate; use num::traits::{ cast::NumCast, float::{Float, FloatConst}, }; fn ring_above<T>(nside: usize, z: T) -> usize where T: Fl...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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.a...
use super::{MyRecentSwapsUuids, MySwapsFilter}; use async_trait::async_trait; use common::PagingOptions; use derive_more::Display; use mm2_core::mm_ctx::MmArc; use mm2_err_handle::prelude::*; use uuid::Uuid; pub type MySwapsResult<T> = Result<T, MmError<MySwapsError>>; #[cfg_attr(not(target_arch = "wasm32"), allow(de...
/* Copyright © 2020, Jason Ekstrand * * 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,...
// stdlib types pub(crate) use std::{ borrow::Cow, char, cmp::{Ordering, Reverse}, collections::{BTreeMap, BTreeSet, HashMap, HashSet}, convert::{TryFrom, TryInto}, env, ffi::{OsStr, OsString}, fmt::{self, Display, Formatter}, fs::{self, File}, hash::Hash, io::{self, BufRead, BufReader, Cursor, Re...
#[doc = "Register `PEIE` reader"] pub struct R(crate::R<PEIE_SPEC>); impl core::ops::Deref for R { type Target = crate::R<PEIE_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<PEIE_SPEC>> for R { #[inline(always)] fn from(reader: crate::R<PEIE_SP...
use crate::util::*; pub fn go(filename:&str) -> (String,String) { let payload:Vec<u8> = readfile(filename); let payloadstr:String = String::from_utf8(payload).unwrap(); let chars:Vec<char> = payloadstr.chars().collect(); let mut image = Vec::new(); image.resize(25*6,'2'); let mut lowestzeroes=1000000; ...
// 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, lef...
// fn main() { // assert_eq!(makeArrayConsecutive2(vec![6, 2, 3, 8]), 3); // assert_eq!(makeArrayConsecutive2(vec![5, 4, 6]), 0); // assert_eq!(makeArrayConsecutive2(vec![0, 3]), 2); // } #[allow(non_snake_case, dead_code)] fn makeArrayConsecutive2(statues: Vec<i32>) -> i32 { let mut result = 0; le...
extern crate bytes; extern crate futures; extern crate tokio_core; extern crate tokio_io; pub mod execution; mod codec; mod proto; use std::io; use std::path::PathBuf; use futures::Future; use futures::sync::mpsc; use tokio_core::net::TcpStream; use tokio_core::reactor::Handle; use tokio_io::AsyncRead; use codec::Co...
use bevy::prelude::*; use bevy_ldtk::*; use data::action::*; use data::item::*; use data::level::*; use data::prefab::*; use data::sprite::*; use data::turn::*; use lua::script::*; use system::action::*; use system::camera::*; use system::level::*; use system::prefab::*; use system::sprite::*; use system::turn::*; mo...
use egui::{widgets::Label, FontDefinitions, FontFamily, TextStyle}; use std::borrow::Cow; use std::collections::BTreeMap; #[derive(Copy, Clone, PartialEq, Eq)] // We use the text styles not as they are actually intended, as we need // some abnormal font sizes and we can only have font sizes associated with // the text...
use github_webhook::event::{ self, IssueCommentEvent, IssuesEvent, PullRequestEvent, PullRequestReviewCommentEvent, PullRequestReviewEvent, PushEvent, }; pub(crate) mod hidden { pub trait Marker {} } pub mod prelude { pub use super::{ action::TAction, assignee::TAssignee, comment::TComment, co...
use crate::statement::Token; use crate::Span; use core::str::FromStr; use nom::{ bytes::complete::tag_no_case, character::complete::{char, digit1, space0}, combinator::{map, map_res, opt}, multi::many1, sequence::{preceded, separated_pair}, IResult, }; #[derive(Debug, PartialEq, Clone)] pub str...
use std::sync::Arc; use async_trait::async_trait; use super::{CompactionInput, CompactionOutput, CompactionRuntime}; use crate::{ error::Result, format::{Iterator, MergingIterator}, storage::Storage, }; pub struct LocalCompaction { storage: Arc<dyn Storage>, } impl LocalCompaction { pub fn new(s...
use diesel::pg::PgConnection; use r2d2; use r2d2_diesel::connectionManager; use rocket::http::Status; use rocket::request::{self, FromRequest}; use rocket::request::{Outcome, Request, State}; pub fn init_pool(db_url: String) -> Pool { let manager = ConnectionManager::<PgConnection>::new(db_url); r2d2::Pool::...