text
stringlengths
8
4.13M
use crate::hittable::{aabb::Aabb, HitRecord, Hittable, Hittables}; use crate::ray::{face_normal, Ray}; use crate::vec::Vec3; use rand::rngs::SmallRng; use std::sync::Arc; #[derive(Debug, Clone)] pub struct Translate { pub object: Arc<Hittables>, pub offset: Vec3, } impl Translate { pub fn new(object: Arc<...
use std::env; use std::error; use std::ffi::OsStr; use std::path::Path; use wallpaper_windows_shobjidl::desktop_wallpaper; static USAGE: &'static str = r#"Usage: wallpaper-shobjidl - get wallpaper wallpaper-shobjidl [path] - set wallpaper "#; fn main() -> Result<(), Box<dyn error::Error>> { let...
mod new_transaction; mod new_validated_block; pub use new_transaction::new_transaction; pub use new_validated_block::new_validated_block;
//! Cuticula provides convenient and universal Machine Learning Transformer //! for non-numeric data types such as: `Strings`, `Images` and `Audio`. #![feature(plugin)] #![plugin(clippy)] extern crate image as image_lib; extern crate murmurhash3 as murmur3; pub use image::Image; pub use word::Word; pub use transformer...
mod iterinfo; mod monthinfo; mod yearinfo; pub use iterinfo::IterInfo; mod poslist; pub use poslist::build_poslist; mod easter; mod masks; use crate::datetime::{get_weekday_val, DTime, Time}; use crate::options::*; use crate::utils::{includes, not_empty}; use chrono::prelude::*; use chrono::Duration; pub fn decremen...
#[allow(unused_imports)] #[macro_use] extern crate limn; mod util; use limn::prelude::*; fn main() { let window_builder = glutin::WindowBuilder::new() .with_title("Limn image demo") .with_min_dimensions(100, 100); let app = util::init(window_builder); resources().image_loader.load_image("...
use crate::{ dispose::Dispose, hex::{ pointer::HexPointer, render::renderer::HexRenderer, shape::cubic_range::CubicRangeShape, }, world::RhombusViewerWorld, }; use amethyst::{ecs::prelude::*, prelude::*}; use rand::{thread_rng, Rng}; use rhombus_core::hex::{ coordinates::{ axial::Axi...
#[macro_use] extern crate debug_rs; fn main() { debug!(666, 33, "aaa"); debug!(vec![1, 2, 3]); }
use std::collections::HashMap; use std::fs::File; use std::io::BufReader; use xml::reader::{EventReader, XmlEvent}; /// Pathref contains the special pathRef string syntax #[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] struct PathRef { ref_type: String, target_parent: String, target_type: String, } #[deri...
// file: max_parabole.rs // // Copyright 2015-2017 The RsGenetic Developers // // 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 std; use std::slice; use std::ptr; use std::marker::PhantomData; use std::cmp; use std::io::Cursor; use std::collections::VecDeque; use bytes::Buf; use bytes::BufMut; use bytes::BigEndian; use bytes::ByteOrder; use bincode; use mio; use serde::Serialize; use serde::de::DeserializeOwned; use iovec::IoVec; cons...
/* This is part of mktcb - which is under the MIT License ********************/ use snafu::{ResultExt, OptionExt}; use std::path::PathBuf; use crate::error::Result; use crate::error; use log::*; /// Retrieve the last path component of an URL, as a PathBuf pub fn url_last(url: &url::Url) -> Result<PathBuf> { let ...
pub fn nyt_archive_urls() -> Vec<String> { let mut urls = vec![]; for i in 1853..2019 { for j in 1..=12 { let url = format!( "https://api.nytimes.com/svc/archive/v1/{}/{}.json?api-key={}", i, j, crate::keys::NYT_KEY.to_string() ...
use actix::{Actor, ActorContext, Addr, Handler, Message, StreamHandler}; use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer, Resource}; use actix_web_actors::ws; use serde::Deserialize; use std::{ collections::HashMap, sync::{Arc, Mutex}, }; #[derive(Deserialize)] struct PathCha...
use hyper; use hyper::{Client, Url}; use hyper::status::StatusCode; use serde_json; use serde_json::Deserializer; use ::sources::GithubSource; #[derive(Deserialize, Debug)] pub struct Package { pub name: String, pub url: String } #[derive(Debug)] pub enum PackageError { Http(hyper::Error), HttpStatus(...
// 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. extern crate fidl; extern crate fidl_fidl_examples_echo; extern crate failure; extern crate fuchsia_app as component; extern crate fuchsia_async as async; ...
//! ## Data for the [`Character` component](https://docs.lu-dev.net/en/latest/components/004-character.html) use serde::{Deserialize, Serialize}; #[derive(Default, Debug, PartialEq, Deserialize, Serialize)] /// Data for the [`Character` component][c004] /// /// [c004]: https://docs.lu-dev.net/en/latest/components/004-...
/* MIT License Copyright (c) 2017 Frederik Delaere 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, publis...
use super::{ Expr, ExprValue, UnaryOp, BinOp, IfExpr }; use crate::parser::token::Token; use std::borrow::Borrow; #[derive(Clone, Debug)] pub struct BasicExpr<'a> { token: Token<'a>, value: ExprValue<BasicExpr<'a>> } impl<'a> Expr for BasicExpr<'a> {} impl<'a> BasicExpr<'a> { pub fn...
// FIXED fn foo<T: Copy>(v: &[T], idx: &[usize]) { let _ = idx.iter().map(|_| v[0]); } fn main() {}
mod vm; mod compiler; #[cfg(test)] mod tests { use crate::vm::{*, Instruction::*}; #[test] fn vm_works() { let code = [PushI(1)]; let mut vm = VmState::new(&code); let res = vm.run(); assert_eq!(res, Ok(())); assert_eq!(vm.get_int(0), Ok(1)); } #[test] fn vm_adds() { let code = [P...
//! Protection Buffer Size //! //! To protect the data channel as well, the PBSZ command, followed by the PROT command //! sequence, MUST be used. The PBSZ (protection buffer size) command, as detailed //! in [RFC-2228], is compulsory prior to any PROT command. //! //! For FTP-TLS, which appears to the FTP application ...
mod api; mod app; fn main() { if let Err(error) = app::run() { eprintln!("{}", error); std::process::exit(1); } }
use piston_window::*; use std::thread; use std::sync::mpsc; use std::time::Duration; use rand::{thread_rng, Rng}; use self::object::*; pub mod object; const MAXINUM: u32 = 10; const TIME_LIMIT: u64 = 2000; const MAX_EPISODE: u32 = 100; const BATCH_SIZE: u32 = 200; pub struct Environment { reward: f64, episod...
use super::{Backend, Component, State}; use tui::{ layout::Rect, style::{Modifier, Style}, text::{Span, Spans}, widgets::{Block, Borders, Paragraph}, Frame, }; pub struct HelpBar; const MENU_ITEMS: [&str; 4] = ["Select", "Filter", "Delete", "Quit"]; impl Component for HelpBar { fn render_to(f...
/*! * Rust bindings for [LevelDB](https://code.google.com/p/leveldb/), a fast and * lightweight key/value database library from Google. * * Warning: Some portions of this library are still unsafe to use, in that it * is possible to call methods from LevelDB with stale pointers, or otherwise * cause memory-unsafet...
use std::ops::{Index, IndexMut}; use std::fmt::Debug; use std::slice; use std::iter; const ORDER: usize = 4; // Must be at least 2 const BRANCHING_FACTOR: usize = ORDER - 1; #[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash)] struct InnerIdx(usize); #[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, Pa...
fn multiply(a:i32, b:i32) -> i32 { return a * b; }
#[cfg(feature = "test-util")] use std::sync::atomic::AtomicBool; use std::{ any::TypeId, collections::HashMap, fmt::Debug, sync::{ atomic::{AtomicU32, Ordering}, Arc, }, }; use async_lock::Mutex; use async_trait::async_trait; use bonsaidb_core::{ connection::{Database, ServerCon...
use std::env; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::process; fn seat_val(line: &str) -> u32 { let row = u32::from_str_radix(&line[0..7].replace("F", "0").replace("B", "1"), 2).unwrap(); let col = u32::from_str_radix(&line[7..10].replace("L", "0").replace("R", "1"), 2).unw...
use super::*; use chrono::*; pub mod report_new_symptoms { use super::*; #[derive(Serialize, Deserialize, Debug)] pub struct Req<'a> { #[serde(borrow)] symptoms: Vec<&'a str>, #[serde(borrow)] case_id: &'a str, } #[derive(Serialize, Deserialize, Debug)] pub str...
mod renderer; pub use renderer::*; mod renderer2d; pub use renderer2d::*; mod ortho_camera; pub use ortho_camera::*; mod quad; pub use quad::*;
use proconio::input; use std::collections::HashMap; fn main() { input! { n: u8, s: [String; n], } let mut map = HashMap::new(); for c in "indeednow".chars() { let count = map.entry(c).or_insert(0); *count += 1; } for si in s.iter() { let mut si_map = HashM...
// Copyright 2018-2019 Mozilla // // 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 in writing, sof...
use crate::lapoint::LazPoint; pub trait LazFilter { fn apply(&self, point: &LazPoint) -> bool; } pub struct IntensityFilter { pub min: Option<u16>, pub max: Option<u16>, } impl LazFilter for IntensityFilter { fn apply(&self, point: &LazPoint) -> bool { if let Some(imax) = self.max { ...
use serde::{Deserialize, Serialize}; #[derive(PartialEq, Debug, Clone, Copy, Serialize, Deserialize)] pub struct Position(pub usize, pub usize); impl Default for Position { fn default() -> Self { Self(0, 0) } } // impl std::fmt::Display for Position{ // fn fmt(&self, f: &mut std::fmt::Formatter<'_...
use crate::linefile::LineFile; use crate::notebook::parse; use serde::Deserialize; use std::error::Error; #[derive(Debug)] pub struct Page { pub metadata: Metadata, pub linefile: LineFile, } impl Page { pub fn load(path: &str, id: &str) -> Result<Page, Box<dyn Error>> { let page_path = format!("{}...
use oxygengine::prelude::*; #[derive(Debug, Copy, Clone)] pub struct Lifetime(pub Scalar); impl Component for Lifetime { type Storage = VecStorage<Self>; }
#![allow(dead_code)] use super::devkit; use super::memory::TestMemory; use arm::{Cpu, CpuMode, Isa}; /// An opcode that is actually an undefined instruction that is /// used for signaling the end of execution in ARM mode. const ARM_END_OPCODE: u32 = 0xF777F777; /// An opcode that is used to signal the end of executi...
use super::*; impl IndexBuilder for PostgresQueryBuilder { fn prepare_table_index_expression(&self, create: &IndexCreateStatement, sql: &mut SqlWriter) { self.prepare_index_prefix(create, sql); write!(sql, "KEY ").unwrap(); self.prepare_index_name(&create.index.name, sql); // self...
// See README for example gdb commands to generate logs for this program. // TODO: This ccurrently assumes if an object is not moved in a GC it dies, which is not correct. // E.g. an object in the oldest generation is not moved in minor GCs. // TODO: The gdb script below does not print x->x when compacting GC skips a...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ use std::cmp::Ordering; use bit_vec::BitVec; pub trait BitVecExtension { fn resize(&mut self, new_len: usize, value: bool); } impl BitVecExtension for BitVec { fn resize(&mut self, new_len: usize, value: bo...
pub fn is_keyword(s: &str) -> bool { return s == "def" || s == "else" || s == "for" || s == "if" || s == "in" || s == "return" || s == "view" }
extern crate aesti; #[macro_use] extern crate arrayref; extern crate bytes; extern crate clap; extern crate cookie_factory; extern crate data_encoding; extern crate ed25519_dalek; extern crate env_logger; extern crate flate2; #[macro_use] extern crate futures; extern crate itertools; #[macro_use] extern crate lazy_stat...
/// Rendering logic. pub fn render_vec<'a, II>(xs: II, max: f64) -> String where II: IntoIterator<Item = &'a f64>, { let mut r = String::new(); for x in xs.into_iter() { let p = *x / max; r.push(float_bar(p)); } r } const BARS: [char; 8] = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█']; ...
//! Parsers for applying parsers multiple times /// `separated_list!(I -> IResult<I,T>, I -> IResult<I,O>) => I -> IResult<I, Vec<O>>` /// separated_list(sep, X) returns Vec<X> will return Incomplete if there may be more elements #[macro_export] macro_rules! separated_list( ($i:expr, $sep:ident!( $($args:tt)* ), $su...
fn main() { // creating a new, empty string let s = String::new(); // this is same as line 9? // This is a &static str type let data = "initial contents"; println!("data: {}", data); let data_two = String::from("initial contents"); let s = data.to_string(); println!("s: {}", s); ...
fn main() { // s is not yet valid, hasn't been declared // hardcoded into final executable let s = "hello"; // s is valid from this point forward, comes into scope // do stuff with s // allocated on the heap (at runtime) let mut t = String::from("hello"); // allocate more heap memory ...
use crate::test::spec::unified_runner::run_unified_tests; #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] async fn run_unified() { run_unified_tests(&["versioned-api"]).await; }
#[cfg(test)] use super::super::failpoints::Failpoints; use super::commit_log::CommitLog; use super::error::Error; use super::file_system::{FileKind, FileSystem, OpenMode, SeriesDir}; use super::index::Index; use std::collections::HashMap; use std::sync::{Arc, Mutex}; pub struct SeriesEnv { dir: Arc<SeriesDir>, ...
use std::{path::Path, str}; use failure::{ Fail, }; use crate::parse::{Parse, ParseError}; /// Represents all shell builtins. #[derive(Clone, Debug)] pub enum Builtin<'a> { Clear, Cd(&'a Path), Exit, } #[derive(Clone, Debug, Fail)] pub enum CdError { #[fail(display = "cd: no path provided")] N...
mod fixtures; use assert_cmd::prelude::*; use assert_fs::fixture::TempDir; use fixtures::{port, server, tmpdir, Error, TestServer}; use regex::Regex; use rstest::rstest; use std::io::{BufRead, BufReader}; use std::process::{Command, Stdio}; #[rstest] #[case(&["-i", "12.123.234.12"])] #[case(&["-i", "::", "-i", "12.12...
#[doc = "Register `TAFCR` reader"] pub type R = crate::R<TAFCR_SPEC>; #[doc = "Register `TAFCR` writer"] pub type W = crate::W<TAFCR_SPEC>; #[doc = "Field `TAMP1E` reader - Tamper 1 detection enable"] pub type TAMP1E_R = crate::BitReader; #[doc = "Field `TAMP1E` writer - Tamper 1 detection enable"] pub type TAMP1E_W<'a...
use crate::error::{Error, Result}; use crate::objectify::ObjectifyErrorKind; use crate::sexpr::{Sexpr, TrackedSexpr}; use crate::source::SourceLocation; use crate::symbol::Symbol; use SourceLocation::NoSource; pub fn scan_out_defines(body: TrackedSexpr) -> Result<TrackedSexpr> { let uninit: TrackedSexpr = Sexpr::U...
#[doc = "Register `SR` reader"] pub type R = crate::R<SR_SPEC>; #[doc = "Register `SR` writer"] pub type W = crate::W<SR_SPEC>; #[doc = "Field `BSY` reader - Busy"] pub type BSY_R = crate::BitReader<BSYR_A>; #[doc = "Busy\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum BSYR_A { #[doc = ...
//! Pokemon type /// Pokemon type #[derive(PartialEq, Eq, Clone, Copy, Hash, Debug)] #[derive(serde::Serialize, serde::Deserialize)] pub enum Type { Normal = 0x00, Fighting = 0x01, Flying = 0x02, Poison = 0x03, Ground = 0x04, Rock = 0x05, Bug = 0x06, Ghost = 0x07, Steel = 0x08, Mystery...
fn main() { proconio::input! { a: i32, b: i32, c: i32, } let mut x = 1; while c * x < a { x += 1; } println!("{}", if c * x <= b {c * x} else {-1}); }
// Copyright 2018 Dmitry Tantsur <divius.inside@gmail.com> // // 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 ap...
use failure::Error; pub fn line() -> Result<(), Error> { Ok(()) }
use super::{SourcePos, Span}; use nom::error::ErrorKind; use nom::{Finish, IResult}; use std::fmt; /// An error encountered when parsing sass. /// /// This contains an error message (currently just a String, and often /// not very descriptive) and informaion on where in the parsed data /// the error occured. #[derive(...
pub fn global_sso() -> Option<String> { // try fetching global SSO url std::env::var("SSO_URL").ok() }
#[cfg(test)] #[path = "../../../../tests/unit/solver/mutation/ruin/cluster_removal_test.rs"] mod cluster_removal_test; use super::*; use crate::algorithms::dbscan::{create_clusters, Cluster, NeighborhoodFn}; use crate::algorithms::geometry::Point; use crate::construction::heuristics::InsertionContext; use crate::model...
use super::parse::IOrder::*; use super::parse::*; use nom::IResult; use std::convert::TryInto; use std::fs::File; use std::io::Write; use std::io::{BufRead, BufReader}; use std::str::from_utf8; pub fn readfile(filename: &str) -> Vec<String> { let mut lines = Vec::new(); let file = File::open(filename).unwrap()...
pub mod exec_nix_store; pub mod parsing; use super::tree::{Path, Tree, TreePathMap}; use std::path::PathBuf; use std::str::FromStr; /// This corresponds to a nix store path. /// /// ``` /// use nix_query_tree_viewer::nix_query_tree::NixQueryDrv; /// /// let nix_query_drv = /// NixQueryDrv::from("/nix/store/qy93dp...
use anyhow::{bail, Result}; use std::net::{SocketAddr, ToSocketAddrs}; use structopt::StructOpt; use tokio::{ io, net::{TcpListener, TcpStream}, }; use tokio_stream::wrappers::TcpListenerStream; use tracing::debug; mod broadcast_stream; mod connection; mod coordinator; use connection::tokio_connection; use coo...
use core::ptr; use crate::RcCounter; /// The metadata stored inside the vector (in-line). #[repr(C)] pub struct RcMeta<TCounter: RcCounter> { /// The pointer to the vector. pub vec_ptr: *const u8, /// the capacity of the vector. pub capacity: usize, /// the reference counter. pub counter: TCou...
//! Transport from Dummy Source to Arrow2 Destination. use crate::destinations::arrow2::{Arrow2Destination, Arrow2DestinationError, Arrow2TypeSystem}; use crate::sources::dummy::{DummySource, DummyTypeSystem}; use crate::typesystem::TypeConversion; use chrono::{DateTime, NaiveDate, NaiveDateTime, Utc}; use thiserror::...
use std::io::BufReader; use std::io::prelude::*; use std::fs::File; use std::collections::HashSet; fn main() { let data = read_file(); let passes: HashSet<usize> = data.iter() .map(|string| seat_id(parse_boarding_pass(string.to_string()))) .collect::<HashSet<usize>>(); let min = passes.it...
use crate::lib::config::get_config_dfx_dir_path; use crate::lib::error::DfxResult; use anyhow::bail; use atty::Stream; use std::fs::File; use std::include_str; use std::path::PathBuf; pub fn get_telemetry_config_root() -> DfxResult<PathBuf> { let root = get_config_dfx_dir_path()?.join("telemetry"); if !root.e...
use std::collections::HashMap; use std::collections::HashSet; use std::fmt; use crate::ticket::Ticket; pub struct Rule { pub targets : Vec<String>, pub sources : Vec<String>, pub command : Vec<String>, } /* When a rule is first parsed, it goes into this struct, the targets, sources and command are s...
use crate::name_resolution::{DictEntry, TopLevelContext}; use crate::rustspec::*; use crate::typechecker::pure_carrier; use core::iter::IntoIterator; use heck::SnakeCase; use lazy_static::lazy_static; use pretty::RcDoc; use regex::Regex; use rustc_span::DUMMY_SP; use std::collections::HashMap; use std::sync::atomic::{A...
use std::cmp::PartialEq; pub mod band; pub mod linear; /// ScaleKind represents supported scales. #[derive(Debug, PartialEq)] pub enum ScaleKind { Band, Linear, } /// Scale represents an axis scale that is used in views and chart. pub trait Scale<T> { /// Scale the provided domain value for a scale range...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// FormulaAndFunctionMetricQueryDefinition : A formula and functions metrics query. #[derive(Clone, ...
mod external_serialization; mod fpfs; mod serialization; mod tg; mod tg_tools; mod types; mod utils; pub use fpfs::Fpfs; pub use tg::TgConnection;
// These lines define a function in Rust. The main function is special: it's // the beginning of every Rust program. The first line says "I'm declaring a // function named main which takes no arguments and returns nothing." If there // were arguments, they would go inside (( and )), and because we aren't // returnin...
#![allow(non_snake_case)] #[allow(unused_imports)] use std::io::{self, Write}; #[allow(unused_imports)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; #[allow(unused_imports)] use std::cmp::{max, min, Ordering}; macro_rules! input { (source = $s:expr, $($r:tt)*) => { let...
use std::marker::PhantomData; use combine::primitives::{Parser, SourcePosition, Positioner}; use combine::primitives::{Info, ParseError, Consumed, Error}; use combine::primitives::Stream as StreamTrait; use super::{Stream, State, Result}; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum TokenType { Css, ...
$NetBSD: patch-vendor_termios-0.3.1_src_lib.rs,v 1.1 2020/10/17 13:39:45 maya Exp $ NetBSD support, already upstream in termios 0.3.2 --- ../vendor/termios-0.3.1/src/lib.rs.orig 2018-03-26 21:22:45.000000000 +0000 +++ ../vendor/termios-0.3.1/src/lib.rs @@ -99,6 +99,10 @@ //! cfsetspeed(termios, termios::os::open...
use crate::parser::parse_error::DateTimeParseError; use crate::validation::time::{End, Start}; use chrono::prelude::*; pub fn start(string: &str) -> Result<Start, DateTimeParseError> { Ok(Start::new(string_to_local_date(string)?)) } pub fn end(string: &str) -> Result<End, DateTimeParseError> { Ok(End::new(str...
struct Solution; use std::cmp::max; /// https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ impl Solution { /// 12 ms 2.9 MB pub fn max_profit(prices: Vec<i32>) -> i32 { if prices.len() <= 1 { return 0; } let mut max_profit = 0; let mut min_price = *prices...
pub mod s3; pub mod web_server;
#![allow(dead_code)] mod instruction; mod opcode; use memory::Memory; use util::*; #[derive(RustcDecodable, RustcEncodable, Copy, Clone, Debug, Default)] pub struct Registers { r1: u16, r2: u16, r3: u16, r4: u16, r5: u16, sp: u16, pc: u16, cf: bool, of: bool, zf: bool, sf...
use std::{fs, path::Path}; // fn read_input_lines<P, T>(path: P, transformer: fn(&str) -> T) -> std::io::Result<Vec<T>> where P: AsRef<Path>, { let mut input: Vec<T> = vec![]; let contents = fs::read_to_string(path).unwrap(); for line in contents.lines() { input.push(transformer(line)); } ...
#[doc = "Reader of register RCC_APB4DIVR"] pub type R = crate::R<u32, super::RCC_APB4DIVR>; #[doc = "Writer for register RCC_APB4DIVR"] pub type W = crate::W<u32, super::RCC_APB4DIVR>; #[doc = "Register RCC_APB4DIVR `reset()`'s with value 0x8000_0000"] impl crate::ResetValue for super::RCC_APB4DIVR { type Type = u3...
fn main() { proconio::input! { a: i64, b: i64, } // if a == 0 { // println!("{}", f(b)); // }else{ // } println!("{}", f(b) ^ f(a-1)); // let mut ss = 0; // for i in a..=b{ // ss = ss ^ i; // } // println!("{}", ss); } fn f(a: i64) -> i64 { l...
use core::convert::TryInto; use sha2::{Digest, Sha256}; use subspace_core_primitives::{crypto, Sha256Hash, SHA256_HASH_SIZE}; /// Derives a single object blob of a given size from given seed and index, which is intended to be /// used as pre-genesis object (blockchain seed data) pub fn from_seed<S: AsRef<[u8]>>(seed: ...
#![feature(prelude_import)] #![no_std] #[prelude_import] use std::prelude::v1::*; #[macro_use] extern crate std as std; #[macro_use] extern crate inherit; struct AStruct {} fn main() {} fn a_func() {}
mod builder_test; mod compact_table; mod extended_table_test; mod index_test; mod iter_table; mod pool_table; mod table_test;
// Copyright 2017 Parity Technologies (UK) Ltd. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, mer...
table! { comments (id) { id -> Int4, post_id -> Int4, text -> Text, } } table! { memo_tag_rels (id) { id -> Int8, tag_id -> Int8, memo_id -> Int8, created_at -> Nullable<Timestamp>, updated_at -> Nullable<Timestamp>, } } table! { memo...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Certificate { #[serde(flatten)] pub resource: Resource, #[serde(default, skip_serializing_if = "Option:...
#![allow(dead_code)] pub const INTERRUPT_TABLE_BASE: usize = ::memory::MEMORY_SIZE; pub const INTERRUPT_TABLE_LENGTH: usize = 64; pub const INTERRUPT_TABLE_SIZE: usize = 2 * INTERRUPT_TABLE_LENGTH; #[derive(RustcEncodable, RustcDecodable, Clone, Debug, Default)] pub struct Idt { data: Box<[u8]>, } impl Idt { ...
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. #![feature(allocator_api)] use std::alloc::Layout; use std::borrow::Cow; use std::hash::Hash; use std::hash::Hasher; use std::io::Rea...
//! This module defines the `Architecture` enum, and all the instructions declared for each //! architecture. //! //! Code for instruction matching is generated by a Python script during the build. #![allow(non_upper_case_globals)] use builder::{Builder, Value, ValueKind}; use emit::Emitter; use std::fmt::{self, Dis...
pub fn compute() -> stretch::result::Layout { stretch::node::Node::new( stretch::style::Style { size: stretch::geometry::Size { width: stretch::style::Dimension::Points(500f32), height: stretch::style::Dimension::Points(200f32), ..Default::default(...
//! The procedural macro for vulkano's shader system. //! Manages the compile-time compilation of GLSL into SPIR-V and generation of assosciated rust code. //! //! # Basic usage //! //! ``` //! mod vs { //! vulkano_shaders::shader!{ //! ty: "vertex", //! src: " //! #version 450 //! //! layout(locati...
mod globals; mod player; use gdnative::prelude::*; fn init(handle: InitHandle) { handle.add_class::<globals::Globals>(); handle.add_class::<player::Player>(); } godot_gdnative_init!(); godot_nativescript_init!(init); godot_gdnative_terminate!();
#[cfg(test)] mod tests; use regex::Regex; use crate::{ web::scraping::{Find, FindNext, Html, Text}, net::url::{Url, PathError}, util::bytes, }; pub use crate::web::scraping::Error; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Metadata { // On private files, the track id is an image. It's not worth do...
macro_rules! parser { ($name:ident : $fun:ident -> $out:ty) => ( #[allow(non_camel_case_types)] pub struct $name; impl NomParser for $name { type Output = $out; fn parse2(data: &[u8])-> crate::ParseResult<Self::Output> { $fun(data).map_err(FontError::f...
//! Schannel is a pure-Rust wrapper to provide SSL functionality under windows by using schannel, which //! removes the requirement of openssl. #[macro_use] extern crate log; extern crate winapi; extern crate crypt32; extern crate secur32; extern crate rustc_serialize; #[cfg(feature = "hyper")] extern crate hyper; #...