text
stringlengths
8
4.13M
use std::error::Error; use std::io; use std::io::Write; use std::fs::File; fn main () { match main_real () { Ok (_) => (), Err (error) => { writeln! ( & mut io::stderr (), "{}", error, ).unwrap_or (()); }, }; } fn main_real ( ) -> Result <(), String> { write_metadata ( ).map_err ( ...
extern crate ansi_term; extern crate serde_json; use parse_config::Task; use std::fs; use std::process::Command; use std::process::Output; use std::sync::{Arc, Mutex}; use std::thread; use task_output; use task_output::SerializableOutput; use self::ansi_term::ANSIString; use self::ansi_term::Colour::{Black, Green, Re...
#[doc = "Register `CFGR2` reader"] pub type R = crate::R<CFGR2_SPEC>; #[doc = "Register `CFGR2` writer"] pub type W = crate::W<CFGR2_SPEC>; #[doc = "Field `RXFILTDIS` reader - BMC decoder Rx pre-filter enable The sampling clock is that of the receiver (that is, after pre-scaler)."] pub type RXFILTDIS_R = crate::BitRead...
/* * 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 */ use reqwest; use crate::apis::ResponseContent; use super::{Error, configuration}; /// struct for typ...
#[derive(Debug)] struct Pixel{ r:u8, g:u8, b:u8, } impl IntoIterator for Pixel{ type Item = u8; type IntoIter = PixelIntoIterator; fn into_iter(self) -> Self::IntoIter{ PixelIntoIterator{ pixel:self, index:0, } } } struct PixelIntoItera...
#[doc = "Register `SR` reader"] pub type R = crate::R<SR_SPEC>; #[doc = "Field `CCF` reader - Computation complete flag"] pub type CCF_R = crate::BitReader<CCF_A>; #[doc = "Computation complete flag\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum CCF_A { #[doc = "0: Computation complete...
use super::hit::HitRecord; use super::hit::Hittable; use crate::math::Ray; use std::sync::Arc; pub struct HittableList<T: Hittable + Send + Sync> { objects: Vec<Arc<T>>, } impl<T: Hittable + Send + Sync> HittableList<T> { pub fn add(&mut self, obj: Arc<T>) { self.objects.push(obj); } pub fn n...
extern crate chan; extern crate handlebars; extern crate hyper; extern crate rustc_serialize; extern crate websocket; extern crate walkdir; use std::collections::BTreeMap; use std::default::Default; use std::fs::File; use std::io::{Write, Read}; use std::sync::{Arc, Mutex}; use std::thread; use self::handlebars::Handl...
#![allow(non_snake_case)] #[macro_use] extern crate criterion; use criterion::Criterion; use rand; use rand::Rng; use curve25519_dalek::scalar::Scalar; use merlin::Transcript; use bulletproofs::RangeProof; use bulletproofs::{BulletproofGens, PedersenGens}; static AGGREGATION_SIZES: [usize; 6] = [1, 2, 4, 8, 16, 32...
use std::process::Command; fn main() { Command::new("bash") .args(&["./bin/buildjs.sh"]) .output() .expect("failed to build javascript"); }
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - control register"] pub cr: CR, #[doc = "0x04 - data input register"] pub din: DIN, #[doc = "0x08 - start register"] pub str: STR, #[doc = "0x0c - HASH aliased digest register 0"] pub hra0: HRA0, #[doc = ...
use reqwest::{Client, Response}; pub use reqwest::{Method, RequestBuilder}; use result::{BestbuyError, BestbuyResult}; use serde::Deserialize; use serde_json; pub struct BestbuyClient { http: Client, token: String, } impl BestbuyClient { pub fn new(token: &str) -> Self { Self::with_http_client(token, Client...
pub mod signature; pub mod curie_to_iri; pub mod iri_2_curie; pub mod structural_identity; pub mod parser;
use std::fmt; use strum_macros::{EnumIter, EnumString}; #[derive(Debug, PartialEq, EnumString, EnumIter)] pub enum ContinentCode { None, // ENUM START AF, AS, EU, NA, OC, SA, // ENUM END } impl ContinentCode { pub fn is_none(&self) -> bool { match *self { Co...
use crate::Uncertain; use num_traits::{identities, Float}; use rand_pcg::Pcg32; use std::error::Error; use std::fmt; const STEP: usize = 10; const MAXS: usize = 1000; /// Information about a failed call to [`expect`](Uncertain::expect). /// /// This struct allows introspection of a failed attempt to calculate /// the...
extern crate azul; use std::time::Duration; use azul::{ prelude::*, widgets::{button::Button, svg::*}, }; const SVG: &str = include_str!("../../img/tiger.svg"); #[derive(Debug)] struct MyAppData { cache: SvgCache, layers: Vec<(SvgLayerId, SvgStyle)>, frame_count: u64, } type CbInfo<'a, 'b> = Ca...
use diesel::prelude::*; use super::db_connection::*; use crate::db::models::UserEntity; use crate::db::models::User; use crate::schema::users::dsl::*; pub fn fetch_user_by_email(database_url: &String, input_email: &String) -> Option<UserEntity> { let connection = db_connection(&database_url); let mut users_by_id...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use crypto::Hasher; use utils::{ collections::Vec, ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable, Sli...
// use na::{Vector3}; use na::{Point3}; use macroquad::prelude::*; // mod thing_lines; use crate::thing::Thing; // use std::convert::TryInto; pub fn draw_thing(th: &Thing) { for line in &th.lines { let (i0, i1) = line; let ui0 = *i0 as usize; let ui1 = *i1 as usize; // let pt0: Poin...
// Copyright 2019 Fullstop000 <fullstop1005@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 appli...
#[derive(Debug, Clone)] pub struct Board { pieces: u32, grid: [char; 42] } impl Board { pub fn drop_piece(&mut self, colour:char, position:i32) -> bool { let mut i=position+35; loop { if i<0 { break; } if self.grid[i as usize]=='0' { self.grid[i as usize]=colour; return true; } i-=7;...
use hyper::{header, Body, Method, Request, Response}; use super::routes; use super::util; /// This is our service handler. It receives a Request, routes on its /// path, and returns a Future of a Response. pub async fn service_handler(req: Request<Body>) -> Result<Response<Body>, hyper::Error> { let path_frags = ...
extern crate elevator; extern crate floating_duration; use elevator::buildings::{Building, Building1, Building2, Building3}; use elevator::trip_planning::{FloorRequests, RequestQueue}; use elevator::physics::{ElevatorState, simulate_elevator}; use elevator::motion_controllers::{SmoothMotionController, MotionController...
//! The plic module contains the platform-level interrupt controller (PLIC). //! The plic connects all external interrupts in the system to all hart //! contexts in the system, via the external interrupt source in each hart. //! It's the global interrupt controller in a RISC-V system. use crate::bus::*; use crate::tra...
//! Tests auto-converted from "sass-spec/spec/libsass-todo-issues/issue_1801" #[allow(unused)] use super::rsass; // From "sass-spec/spec/libsass-todo-issues/issue_1801/simple-import-loop.hrx" // Ignoring "simple_import_loop", error tests are not supported yet.
use futures::channel::mpsc; use futures::StreamExt; use log::*; use sphinx::SphinxPacket; use std::net::SocketAddr; use std::time::Duration; use tokio::runtime::Handle; use tokio::task::JoinHandle; pub(crate) struct MixMessage(SocketAddr, SphinxPacket); pub(crate) type MixMessageSender = mpsc::UnboundedSender<MixMessa...
use serde_json::{Value, Map}; pub fn translate_annotations(m : &Map<String, Value>) -> Vec<Value> { let mut annotations = Vec::new(); for (k, v) in m { let property = Value::String(String::from(k)); match v { //traverse list of objects Value::Array(array) => { ...
use actix::prelude::{Message, Recipient}; use drogue_cloud_integration_common::stream::EventStream; use drogue_cloud_service_common::error::ServiceError; use uuid::Uuid; // Service sends the kafka events in this message to WSHandler #[derive(Message)] #[rtype(result = "()")] pub struct WsEvent(pub String); // WsHandl...
//! Rasterizer use crate::POLY_SUBPIXEL_SHIFT; use crate::POLY_SUBPIXEL_SCALE; //use crate::POLY_SUBPIXEL_MASK; use crate::clip::Clip; use crate::scan::ScanlineU8; use crate::cell::RasterizerCell; use crate::paths::PathCommand; use crate::paths::Vertex; //use crate::Rasterize; use crate::VertexSource; use std::cmp:...
#[doc = "Register `C2EMR2` reader"] pub type R = crate::R<C2EMR2_SPEC>; #[doc = "Register `C2EMR2` writer"] pub type W = crate::W<C2EMR2_SPEC>; #[doc = "Field `EM40` reader - Wakeup with event generation Mask on Event input"] pub type EM40_R = crate::BitReader<EM40_A>; #[doc = "Wakeup with event generation Mask on Even...
// Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com> // // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> //! RTSP header definitions. //! //! See [RFC 7826 section 18](https://tools.ietf.org/html/rfc7826#section-18) for the standardized //! headers and their ...
fn sum(a: i32, b: i32) -> i32 { a + b } fn display_result(result: i32) { println!("{:?}", result); } fn main() { let result_sum = sum(6, 999999); display_result(result_sum); }
use std::collections::BTreeMap; fn main() { // my test inputs: 236491 to 713787. let p = all_possibilities(236_491, 713_787); println!("Checking {} possibilities", p.len()); let candidate_pws: Vec<&i32> = p .iter() .filter(|x| has_double(**x) && !has_decreasing_digits(**x)) .co...
use crate::database::*; use crate::ShowResult; use serde::{Deserialize, Serialize}; use std::path::PathBuf; #[derive(Debug, Deserialize, Serialize)] pub struct Show { pub id: i64, pub name: String, pub path: PathBuf, pub episodes: Vec<Episode>, pub name_pattern: Vec<String>, } #[derive(Debug, Dese...
use ring::digest::{digest, Context, SHA256}; use ring::hmac::{sign, Key, HMAC_SHA256}; use std::convert::TryInto; use std::fmt::{Debug, Formatter}; use std::{fmt, mem}; #[derive(Clone)] pub struct ContentSet { /// HOTP generated name pub name: String, /// Current size of the DNS record pub size: usize,...
/* Copyright 2020 <盏一 w@hidva.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 applicable law or agreed to in writing, software distr...
//! Read and write entities. use crate::world::{self, World, ENTITY_COUNT}; use std::io; use std::path::{Path, PathBuf}; /// The name of entity folder. pub const FOLDER: &str = "entities"; /// Gets a list of all entity files. pub fn files(project_folder: &str) -> io::Result<Vec<PathBuf>> { use std::fs::read_dir;...
#[doc = "Reader of register FC0_RESULT"] pub type R = crate::R<u32, super::FC0_RESULT>; #[doc = "Reader of field `KHZ`"] pub type KHZ_R = crate::R<u32, u32>; #[doc = "Reader of field `FRAC`"] pub type FRAC_R = crate::R<u8, u8>; impl R { #[doc = "Bits 5:29"] #[inline(always)] pub fn khz(&self) -> KHZ_R { ...
//! Tests auto-converted from "sass-spec/spec/non_conformant/errors/interpolation" #[allow(unused)] use super::rsass; // From "sass-spec/spec/non_conformant/errors/interpolation/error-1.hrx" // Ignoring "error_1", error tests are not supported yet.
use crate::{ options::{BuildMode, BuildOptions, FuzzDirWrapper}, project::FuzzProject, RunCommand, }; use anyhow::Result; use clap::Parser; #[derive(Clone, Debug, Parser)] pub struct Check { #[command(flatten)] pub build: BuildOptions, #[command(flatten)] pub fuzz_dir_wrapper: FuzzDirWrapp...
use std::fs::*; use std::io::Read; pub enum LoadError { NotFound(String), CouldntOpen(String), } pub fn load_file(file_name: impl Into<String>) -> Result<(std::path::PathBuf, String), LoadError> { let file_name = file_name.into(); let path = std::path::Path::new(&file_name); //.with_extension("rb"); ...
use sqlx::{query_file, query_file_as, Error, PgPool}; use time::OffsetDateTime; use uuid::Uuid; use super::{category::Category, rating::Rating}; /// New image without ID pub struct NewImage { pub title: String, pub description: Option<String>, } pub struct Image { pub id: Uuid, pub created: OffsetDat...
use crate::*; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::path::PathBuf; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Recording { pub device_info: DeviceInfo, #[serde(with = "serde_transaction_map")] pub transactions: HashMap<Rec...
use crate::types::{BoardPosition, PieceType}; use nom; use nom::{bytes::complete::tag, combinator::map_res, IResult}; use std::collections::HashMap; // Brief detour, writing a parser. // A Matrix parser takes input of the following form: // 8 .. .. .B BR .K .. .. .. // 7 .P .. .. .P .. .. .P .. // 6 .. PP .. .. .N Q...
use std::collections::HashMap; use std::collections::hash_map::Entry; use std::fmt; use std::io; use futures::{self, Future, Sink, Stream, Poll, Async, AsyncSink}; use futures::unsync::mpsc; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::codec::{Framed, FramedParts}; use codec::Codec; use message::{Message, Fla...
fn function() { nested::function(); } mod nested { fn function() { very_nested::function(); } mod very_nested { fn function() { very_very_nested::function(); } mod very_very_nested { fn function() {} } } }
pub mod ansi; pub mod pos; pub mod padding;
use crate::{bson::Document, error::Result, options::ClientOptions, Client}; use super::options::AutoEncryptionOptions; /// A builder for constructing a `Client` with auto-encryption enabled. /// /// ```no_run /// # use bson::doc; /// # use mongocrypt::ctx::KmsProvider; /// # use mongodb::Client; /// # use mongodb::er...
use std::cell::RefCell; extern crate num; extern crate primes; #[macro_use] extern crate itertools; // Perform repeated iterations on a single dimension until all the moons are back to their // original state in that dimension. fn simulate(moons: &[RefCell<MoonDimension>]) -> u64 { let moons = moons.to_owned(); ...
#[doc = "Register `AFRCR` reader"] pub type R = crate::R<AFRCR_SPEC>; #[doc = "Register `AFRCR` writer"] pub type W = crate::W<AFRCR_SPEC>; #[doc = "Field `FRL` reader - Frame length. These bits are set and cleared by software. They define the audio frame length expressed in number of SCK clock cycles: the number of bi...
#![feature(asm)] #![feature(naked_functions)] #![allow(dead_code)] #![allow(incomplete_features)] #![feature(const_generics)] #![feature(once_cell)] mod bitflags; mod alloc; mod arch; mod fault; pub mod flexarray; pub mod refs; //pub mod gate; //mod libtwz; pub mod event; pub mod name; pub mod obj; mod persist; pub m...
pub mod sort; pub mod heap; pub mod list;
#[doc = "Register `IPCC_C1SCR` reader"] pub type R = crate::R<IPCC_C1SCR_SPEC>; #[doc = "Register `IPCC_C1SCR` writer"] pub type W = crate::W<IPCC_C1SCR_SPEC>; #[doc = "Field `CHxC` reader - CHxC"] pub type CHX_C_R = crate::FieldReader; #[doc = "Field `CHxC` writer - CHxC"] pub type CHX_C_W<'a, REG, const O: u8> = crat...
use reqwest::Error; use reqwest::header; use reqwest::Client; use crate::suika::product::Response; use crate::suika::product::ResponseCollection; #[tokio::main] pub async fn get() -> Result<ResponseCollection, Error> { let mut headers = header::HeaderMap::new(); headers.insert(header::ACCEPT, header::HeaderVa...
// Copyright 2021-2023 Sebastian Ramacher // SPDX-License-Identifier: Apache-2.0 OR MIT #![no_std] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![doc = include_str!("../README.md")] #![doc( html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg", html_favicon_url = "https://raw.gith...
/// A simple trait for transition between the fetch and processing phases /// of Specs systems. pub trait Gate { /// Transition destination type. type Target; /// Actually pass the gate. This may involve waiting on a ticketed lock. fn pass(self) -> Self::Target; } macro_rules! gate { // use variabl...
use ::Result; extern "C" { pub fn initCfgu() -> Result; pub fn exitCfgu() -> Result; pub fn CFGU_SecureInfoGetRegion(region: *mut u8) -> Result; pub fn CFGU_GenHashConsoleUnique(appIDSalt: u32, hash: *mut u64) -> Result; pub fn CFGU_GetRegionCanadaUSA(value: *mut u8) -> Result; pub fn CFGU_Get...
use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use crate::lib::identity::Identity; use crate::lib::provider::{create_agent_environment, get_network_descriptor}; use crate::lib::root_key::fetch_root_key_if_needed; use anyhow::anyhow; use clap::Clap; use ic_types::principal::Principal as Can...
use std::fmt::Display; use chrono::{DateTime, Utc}; use isocountry::CountryCode; use isolanguage_1::LanguageCode; use itertools::Itertools; use serde::{Deserialize, Serialize}; use crate::{ AlbumSimplified, Category, Client, Error, FeaturedPlaylists, Market, Page, PlaylistSimplified, Recommendations, Response...
fn main() { // 浮動小数点 let x = 2.0; // f64 let y: f32 = 3.0; // f32 // 足し算 let sum = 5 + 10; // 引き算 let difference = 95.5 - 4.3; // 掛け算 let product = 4 * 30; // 割り算 let quotient = 56.7 / 32.2; // 余り let remainder = 43 % 5; // 複合型 let tup: (i32, f64, u8) = (100...
mod create_table_response; mod delete_entity_response; mod delete_table_response; mod get_entity_response; mod insert_entity_response; mod list_tables_response; mod operation_on_entity_response; mod query_entity_response; mod submit_transaction_response; pub use create_table_response::CreateTableResponse; pub use delet...
use std::convert::Infallible; use std::net::SocketAddr; use std::sync::Arc; use tokio::sync::RwLock; use hyper::server::conn::AddrStream; use hyper::{Body, Request, Response, Server, Error}; use hyper::service::{service_fn, make_service_fn}; pub async fn run_proxy(local_port: u16, forward_uri_lock: Arc<RwLock<String>...
use sack::{SackType, SackBacker}; /// The most generic sack collision imaginable. Truly anything is possible /// with enough specialization pub trait Collider<'a, C1, C2, C3, C4, D1, D2, D3, D4, B1, B2, B3, B4, T1, T2, T3, T4> where B1: SackBacker, B2: SackBacker, B3: SackBacker, B4: ...
/* * 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 */ /// SyntheticsWarningType : User locator used. /// User locator used. #[derive(Clone, Copy, Debug, Eq, ...
use crate::{ auth::{Authenticator, UserDetail}, server::{ chancomms::ProxyLoopSender, controlchan::{command::Command, error::ControlChanError, Reply}, ftpserver::options::{PassiveHost, SiteMd5}, session::SharedSession, ControlChanMsg, }, storage::{Metadata, Storag...
use std::fmt::{Debug, Formatter, Result}; use std::ops::{Index, IndexMut}; pub struct Array<T: Clone>(Box<[T]>); impl<T: Clone> Array<T> { pub fn new(value: T, size: usize) -> Self { Array(Box::from(vec![value; size])) } pub fn len(&self) -> usize { self.0.len() } } impl<T: Clone...
use crate::script::{Script, Event, Requirement, Argument, Offset}; use crate::script; use std::iter::Iterator; use std::slice; use std::f32; pub mod variable_ast; use variable_ast::VariableAst; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct ScriptAst { pub block: Block, pub offset: i32, } impl...
use std::fmt; pub struct Enum<'a> { name: &'static str, members: Vec<EnumMember<'a>>, } pub struct EnumMember<'a> { name: &'a str, value: &'a usize, } impl<'a> fmt::Display for Enum<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { const DERIVES: &str = "#[derive(Debug, Copy...
use core::f64::consts::FRAC_PI_2; use crate::coord_plane::LatLonPoint; use crate::one_dim_lines::points_between_exclusive_both_ends; use crate::one_dim_lines::points_between_inclusive; pub fn sphere_coords(num_lines: usize, num_points: usize) -> Vec<LatLonPoint> { merids(num_lines, num_points).iter().copied().chai...
use ast::*; use std::vec::Vec; use std::f64::consts::PI; type Coord = (f64, f64); pub fn interp<F: FnMut(Coord, Coord) -> ()>(stmnts: &Vec<Stmnt>, mut draw_line: F) -> () { let mut coord: Coord = (0.0, 0.0); let mut angle: f64 = 0.0; let mut pen_down = false; for stmnt in stmnts { match *stmnt...
pub fn box_simple_test() { let b = Box::new(5); println!("b = {}", b); let mut b1 = Box::new([1, 2, 3, 4, 5, 6]); b1[0] = 100; println!("b1 = {}", b1[0]); let b2 = Box::new("box_simple_test"); println!("b2 = {}", b2); } enum List { Cons(i32, Box<List>), //Box seems like pointer, so co...
pub type Color = palette::LinSrgba; pub fn black() -> Color { Color::new(0., 0., 0., 1.) } pub fn white() -> Color { Color::new(1., 1., 1., 1.) } pub fn encode_color(color: Color) -> [f32; 4] { let nonlinear = palette::Srgba::from_linear(color); let (r, g, b, a) = nonlinear.into_components(); [r,...
#![feature(proc_macro)] extern crate proc_macro; extern crate proc_macro2; #[macro_use] extern crate synom; extern crate syn; #[macro_use] extern crate quote; extern crate rustfmt_nightly as rustfmt; use proc_macro::TokenStream; use proc_macro2::Term; use syn::*; use quote::Tokens; use quote::ToTokens; use std::str; ...
// Copyright (c) 2021, Roel Schut. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. use std::borrow::{Borrow, BorrowMut}; use gdnative::api::Area2D; use crate::*; use crate::enemy::*; use crate::utils::convert::TryInstanceFrom; use crate::ut...
mod address_compute; mod hasher; mod serialize; pub use serialize::{ DefaultAccountDeserializer, DefaultAccountSerializer, DefaultTemplateDeserializer, DefaultTemplateSerializer, }; #[cfg(feature = "default-memory")] mod memory; #[cfg(feature = "default-memory")] pub use memory::{DefaultMemAccountStore, Defa...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_hyper::StandardClient; use aws_sdk_kms::operation::GenerateRandom; use aws_sdk_kms::{Config, Region}; // snippet-start:[kms.rust.kms-helloworld] /// Creates a random byte string that is cryptog...
use game_rusty::GameRusty; fn main() { let mut m = GameRusty::new(); print!("{:?}", m.next_instruction()) }
use crate::core::{Function, Measurement, PrivacyRelation}; use crate::dist::{MaxDivergence, L1Sensitivity}; use crate::dom::AllDomain; use crate::error::*; use crate::samplers::{SampleBernoulli, SampleGeometric, SampleUniform}; use crate::traits::DistanceCast; use num::{Float, CheckedAdd, CheckedSub, Zero}; pub fn ma...
use std::borrow::Cow; use std::default::Default; use std::fs; use std::mem; use std::sync::Mutex; mod dwarf; use fnv::FnvHashMap as HashMap; use object::{self, Object, ObjectSection, ObjectSegment, ObjectSymbol, ObjectSymbolTable}; use crate::cfi::Cfi; use crate::function::{Function, FunctionDetails, FunctionOffset}...
use lapin::{ExchangeKind, options::{ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions}}; use std::env; #[derive(Clone, Debug)] pub struct ConsumerOptions { pub broker_address: String, pub exchange_name: String, pub exchange_type: ExchangeKind, pub exchange_declare_options: ExchangeDeclareO...
// Copyright (C) 2021 Subspace Labs, Inc. // 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.apache.org/licenses/LICENSE-2.0 // // Unle...
use actix_web::{web, HttpRequest, HttpResponse, }; use actix_files::NamedFile; use std::path::PathBuf; use tera::{Context, Tera}; use futures::future::{join_all, ok as fut_ok, Future, Either}; use std::default::Default; use std::net::IpAddr; use std::process; use std::str::from_utf8; use crate::error::Result; //?com...
extern crate libc; use libc::{c_void, c_int, size_t, c_char};//, c_ulong, c_long, c_uint, c_uchar}; pub type AnimCb = extern fn(data : *mut c_void) -> bool; pub type RustCb = extern fn(data : *mut c_void); pub type PressedCb = extern fn(data : *mut c_void, device : c_int, x : c_int, y : c_int); #[repr(C)] pub struct...
//! Rust library for low-level abstraction of MIPS32 processors #![feature(llvm_asm)] #![no_std] #![deny(warnings)] #![cfg_attr(feature = "inline-asm", feature(llvm_asm))] #[macro_use] extern crate bitflags; pub mod addr; pub mod instructions; pub mod interrupts; pub mod paging; pub mod registers; pub mod tlb;
/******************************************************* * Copyright (C) 2019,2020 Jonathan Gerber <jlgerber@gmail.com> * * This file is part of packybara. * * packybara can not be copied and/or distributed without the express * permission of Jonathan Gerber ******************************************************...
use super::super::components::Position; use specs::Entity; use std::collections::{HashMap, HashSet}; bitflags! { #[derive(Default)] pub struct TileProperties: u16 { const BLOCKED = 1 << 0; } } #[derive(Clone, Default)] struct TileData { properties: TileProperties, entities: HashSet<Entity>...
use bevy::prelude::*; use bevy::window::WindowMode; use bevy::render::camera::Camera; use bevy_tmx::TmxPlugin; fn main() { App::build() .insert_resource(WindowDescriptor { title: "Parallax".to_string(), width: 1024., height: 720., vsync: true, ...
pub mod sixty_four { use crate::XxHash64; use core::hash::BuildHasher; use rand::{self, Rng}; #[derive(Clone)] /// Constructs a randomized seed and reuses it for multiple hasher instances. pub struct RandomXxHashBuilder64(u64); impl RandomXxHashBuilder64 { fn new() -> RandomXxHashB...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 mod chain; mod chain_service; mod consensus; pub use chain::{Chain, ChainReader, ChainWriter, ExcludedTxns}; pub use chain_service::{ChainAsyncService, ChainService}; pub use consensus::{Consensus, ConsensusHeader}; use thiserror::...
use crate::Flags; use regex::{Regex, RegexBuilder}; use std::{fs::Metadata, path::Path}; pub struct Check<'a> { check: PathCheck<'a>, flags: &'a Flags, } impl<'a> Check<'a> { pub fn check(&self, path: &Path, metadata: Option<Metadata>) -> bool { match (&self.flags.size, metadata) { (So...
use std::net::{ TcpListener }; fn main() { let listener = TcpListener::bind("127.0.0.1:8888") .expect("not bound"); println!("127.0.0.1:8888 running"); for stream in listener.incoming() { match stream { Ok(stream) => { println!("new clien...
use std::{str}; use std::error::Error; use error::SimpleError; macro_rules! ret_err { ($e:expr) => { return Err(Box::new(SimpleError::from($e))); } } extern crate pancurses; use pancurses::{ Input, ERR, Window, }; const BANNER: &'static str = r#"=========================================...
/* Copyright 2019-2023 Didier Plaindoux 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...
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1803" #[allow(unused)] use super::rsass; // From "sass-spec/spec/libsass-closed-issues/issue_1803/nested.hrx" // Ignoring "nested", error tests are not supported yet. // From "sass-spec/spec/libsass-closed-issues/issue_1803/shallow.hrx" #[test...
#[doc = "Register `DMAMFBOCR` reader"] pub type R = crate::R<DMAMFBOCR_SPEC>; #[doc = "Field `MFC` reader - Missed frames by the controller"] pub type MFC_R = crate::FieldReader<u16>; #[doc = "Field `OMFC` reader - Overflow bit for missed frame counter"] pub type OMFC_R = crate::BitReader; #[doc = "Field `MFA` reader -...
pub mod category; pub mod comment; pub mod drive; pub mod embed; pub mod handler; pub mod page; pub mod post; pub mod schema; pub mod topic; pub mod user;
#[doc = "Reader of register DDRCTRL_ADDRMAP6"] pub type R = crate::R<u32, super::DDRCTRL_ADDRMAP6>; #[doc = "Writer for register DDRCTRL_ADDRMAP6"] pub type W = crate::W<u32, super::DDRCTRL_ADDRMAP6>; #[doc = "Register DDRCTRL_ADDRMAP6 `reset()`'s with value 0"] impl crate::ResetValue for super::DDRCTRL_ADDRMAP6 { ...
use crate::path; use autorust_openapi::{ AdditionalProperties, MsExamples, OpenAPI, Operation, Parameter, PathItem, Reference, ReferenceOr, Response, Schema, StatusCode, }; use heck::SnakeCase; use indexmap::{IndexMap, IndexSet}; use std::{ ffi::OsStr, fs, path::{Path, PathBuf}, }; /// An API specifica...
mod font; pub mod ui; pub use ui::*; mod hotkey; pub use hotkey::register_hotkey;
use super::Solution; impl Solution { #[allow(dead_code)] pub fn roman_to_int(s: String) -> i32 { let numbers: Vec<i32> = s.chars().map(|ch| { match ch { 'I' => 1, 'V' => 5, 'X' => 10, 'L' => 50, 'C' => 100, ...