text
stringlengths
8
4.13M
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
use std::hash::Hash; use db_dump::crates; use serde::{Deserialize, Serialize}; use crate::config::Category; #[derive(Debug, Clone)] pub struct CategoryData { pub category: Category, /// UNIQUE /// and taken from [`categories::Row`]. pub slug: String, pub crates: Vec<CrateData>, } #[derive(Debug,...
use std::env; pub struct Options { pub is_short: bool, pub level: u32, } pub fn options() -> Options { let args = env::args(); parse_args(args) } fn parse_args(args: env::Args) -> Options { let mut is_short = false; let mut level_placeholder = ""; let argv: Vec<String> = args.collect(); ...
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; fn main() { let n: usize = parse_line().unwrap(); let mut paths: Vec<Vec<usize>> = vec![vec![]; n + 1]; for _ in 0..n - 1 { let (a, b): (usize, usize) = parse_line().unwrap(); ...
use super::*; use alloc::boxed::Box; use core::marker::PhantomData; ///Specified which type of dfs order we want. In order/pre order/post order. trait DfsOrder: Clone { fn split_mut<T>(nodes: &mut [T]) -> (&mut T, &mut [T], &mut [T]); fn split<T>(nodes: &[T]) -> (&T, &[T], &[T]); } ///Pass this to the tree fo...
use super::*; pub(crate) fn string(i: &[u8]) -> Result<Cow<str>> { is_not::<_, _, ParserError<'_>>("\x00")(i) .map(|(i2, s)| (&i2[1..], String::from_utf8_lossy(s))) .map_err(|_| Err::Error(ParserError(i, ParserErrorKind::StringOverflow))) } use nom::error::ParseError; pub(crate) fn be_usize<'a, E: ...
// SPDX-License-Identifier: (MIT OR Apache-2.0) use std::collections::HashMap; use std::ffi::OsStr; use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use fuser::{ReplyAttr, ReplyData, ReplyDirectory, ReplyEmpty, ReplyEntry, ReplyOpen, Request}; use libc::{EISDIR, ENOTDIR}; use std::time::Duration; use iso9660:...
extern crate specs; use specs::prelude::*; use crate::{CanMelee, CombatStats, GameLog, Name, SuffersDamage, TakesTurn, WantsToMelee}; pub struct MeleeCombatSystem; impl<'a> System<'a> for MeleeCombatSystem { type SystemData = ( WriteExpect<'a, GameLog>, WriteStorage<'a, WantsToMelee>, Re...
use crate::errors::*; pub fn read_dec_1(i: u8) -> Result<u8> { if !(0x30..=0x39).contains(&i) { Err(Error::UnexpectedByteInDecNum(i)) } else { Ok(0x0F & i) } } pub fn read_dec_4(i: &[u8]) -> Result<usize> { if i.len() < 4 { return Err(Error::UnexpectedEofInDecNum); } le...
use std::path::Path; use parity_wasm::{ deserialize_file, elements::{ExportEntry, ExportSection, External, ImportSection, Internal, Module}, serialize_to_file, }; pub fn rename_file_imported_functions<P, FR>(file_name: P, mut func_renamer: FR) where P: AsRef<Path> + std::fmt::Debug, FR: Fn(&[&str]...
#[derive(PartialEq)] pub enum Class { IN, CH, HS, None, Wildcard, Unassigned(u16), Private(u16), Reserved(u16), } impl std::fmt::Display for Class { fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { match self { Class::IN => write!(fmt, "IN"), ...
use efflux::prelude::*; /// The struct which implements the `Reducer` trait for PageRank. /// Should only be called once. pub struct AggregateReducer; /// A PageRank combiner. /// Emits the initial PageRank data for each out-link received. /// Also emits the list of out-links. impl Reducer for AggregateReducer { ...
#[doc = "Reader of register FCMISC"] pub type R = crate::R<u32, super::FCMISC>; #[doc = "Writer for register FCMISC"] pub type W = crate::W<u32, super::FCMISC>; #[doc = "Register FCMISC `reset()`'s with value 0"] impl crate::ResetValue for super::FCMISC { type Type = u32; #[inline(always)] fn reset_value() ...
//! Configuration of git-global. //! //! Exports the `Config` struct, which defines the base path for finding git //! repos on the machine, path patterns to ignore when scanning for repos, the //! location of a cache file, and other config options for running git-global. use std::fs::{remove_file, File}; use std::io::...
/* * Module: twofish * Autor: Piotr Pszczółkowski (piotr@beesoft.pl) * Date: 5/05/2019 * * Copyright (c) 2019, Piotr Pszczółkowski * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistrib...
fn split_volume_sample( a: f32, c: f32, // opacity and colour of original sample zf: f32, zb: f32, // front and back of original sample z: f32, // position of split ) -> ((f32, f32), (f32, f32)) { // Given a volume sample whose front and back are at depths zf and zb // respectively, split t...
use std::mem::size_of; struct EmptyStruct; fn main() { println!("{}", size_of::<EmptyStruct>()); // 0 assert_eq!(size_of::<EmptyStruct>(), 0); }
#![allow(non_snake_case)] #![cfg(test)] use std::collections::HashMap; #[test] fn Creating_map_of_char_u32() { let counts = "ABCDE" .chars() .map(|c| (c, 0_i32)) .collect::<HashMap<_, _>>(); } #[test] fn Creating_map_of_u32_str_1() { let vec = vec![("One", 1u32), ("Two", 2u32), ("Thr...
use crate::matrices::MatrixProperties::*; use crate::vectors::Vector3::*; use std::ops; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Matrix33 { pub m00: f64, pub m01: f64, pub m02: f64, pub m10: f64, pub m11: f64, pub m12: f64, pub m20: f64, pub m21: f64, pub m22: f64...
use futures::Future; use SpawnError; /// A value that executes futures. /// /// The [`spawn`] function is used to submit a future to an executor. Once /// submitted, the executor takes ownership of the future and becomes /// responsible for driving the future to completion. /// /// The strategy employed by the executo...
use std::io; use anyhow::Result; use nexers::db; #[cfg(feature = "jemallocator")] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; fn main() -> Result<()> { let conn = rusqlite::Connection::open("maven.db")?; conn.execute_batch(db::SCHEMA)?; db::ingest(io::stdin().lock(...
#[cfg(feature = "sources-http")] mod http; #[cfg(feature = "sources-socket")] mod tcp; #[cfg(all(unix, feature = "sources-socket"))] mod unix; #[cfg(feature = "sources-http")] pub use self::http::{ErrorMessage, HttpSource}; #[cfg(feature = "sources-socket")] pub use tcp::{SocketListenAddr, TcpSource}; #[cfg(all(unix,...
pub mod ctype; pub mod stdio; pub mod errno; pub mod string; pub mod time;
//= { //= "output": { //= "2": [ //= "", //= true //= ], //= "1": [ //= "", //= true //= ] //= }, //= "children": [ //= { //= "output": { //= "2": [ //= "", //= true //= ], //= "1": [ //= "", //= true...
//! A wrapper around AWS S3 client library `rust_s3` to be used a relish storage. use std::path::Path; use anyhow::Context; use s3::{bucket::Bucket, creds::Credentials, region::Region}; use crate::{relish_storage::strip_workspace_prefix, S3Config}; use super::RelishStorage; const S3_FILE_SEPARATOR: char = '/'; #[...
/* Gordon Adam 1107425 Struct that represents the data field of a resource. Depending on the resource type, different types of data are stored within this struct */ use std::default; use std::io::BufReader; #[deriving(Default,Clone,Show)] pub struct Data { pub label: Vec<Vec<u8>>, // This is hold seperate st...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_Adc_Provider")] pub mod Provider; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::GPCFG { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
pub mod currency_token; pub mod guards; pub mod types;
pub struct Camera { pub view: [[f32; 4]; 4], pub perspective: [[f32; 4]; 4], } impl Camera { pub fn new(position: &[f32; 3], direction: &[f32; 3]) -> Camera{ return Camera { view: view_matrix(position, direction, &[0.0, 1.0, 0.0]), perspective: { let aspect_r...
// 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 ...
#[cfg(feature = "image")] pub mod image;
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const ALLOC_LOG_CONF: u32 = 2u32; pub const BASIC_LOG_CONF: u32 = 0u32; pub const BOOT_LOG_CONF: u32 = 3u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, pack...
extern crate futures; extern crate stream_combinators; extern crate tokio; extern crate tokio_stdin; use futures::stream::{once, Stream}; use stream_combinators::FilterFoldStream; use tokio_stdin::spawn_stdin_stream_unbounded; const NEWLINE: u8 = '\n' as u8; fn main() { // Print stdin line-by-line let prog =...
use crate::geom::hittable::Hittable; use crate::image::image::Image; use crate::raycasting::ray::Ray; use crate::renderer::camera::Camera; use crate::types::{normal3f_to_rgb8, vector3f_to_rgb8, rgb8_to_vector3f}; use crate::types::{Rgb8, Size2i, Vector2i, Vector3f, scale_rgb8, PointwiseSqrtExt }; use rand::Rng; use std...
#[macro_use] extern crate nom; use std::str; #[derive(Debug)] enum Method { GET, POST, } #[derive(Debug)] struct Request { method: Method, url: String, version: String, } named!(parse_method_v1, alt!(tag!("GET") | tag!("POST"))); named!(parse_method_v2<&[u8], &str>, alt!(map_res!(tag!("G...
// This enum is only referenced in macros and macro definations. When macros // get resolved it will remove the references to the enum in the generated // code. This has the effect of making the enum unused from the compiler's // point of view. #[allow(dead_code)] pub enum Log { Cpu, GamePad, Ic, Vip, Vs...
#[cfg(test)] mod test { use crate::data_structures::binary_search_tree::{BinarySearchTree}; #[test] fn basics() { } }
// 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. use failure::{format_err, Error, ResultExt}; use fidl_fuchsia_hardware_ethernet as zx_eth; use fidl_fuchsia_inspect_deprecated as inspect; use fidl_fuchsia...
use std::env; // scenes - these effectively act as separate games pub mod awaiting_opponent; pub mod pong; // pong game logic, ui, and rollback networking pub mod title_screen; // title screen buttons and scene switching logic // screen that polls the server waiting for an opponent to join // utility functions - thes...
#[macro_use] extern crate serde_derive; extern crate serde; use fxoanda_serdes::*; use chrono::prelude::*; use std::str::FromStr; #[derive(Debug, Serialize, Deserialize)] pub struct TradeClientExtensionsModifyRejectTransaction { /// The ID of the Trade who's client extensions are to be modified. /// format: T...
use clap::{crate_description, crate_name, crate_version, App, Arg}; use morgan::clusterMessage::{Node, FULLNODE_PORT_RANGE}; use morgan::connectionInfo::ContactInfo; use morgan::cloner::Replicator; use morgan::socketaddr; use morgan_interface::signature::{read_keypair, Keypair, KeypairUtil}; use std::process::exit; use...
use regex::Regex; use std::fs; fn main() { let result = solve_puzzle(); println!("And the result is: {}", result); } fn solve_puzzle() -> usize { let data = read_lines(); data.iter().filter(|x| is_valid(x)).count() } struct ParsedLine { first: u32, second: u32, letter: char, password:...
use std::any::Any; use std::ops::{Bound, RangeBounds}; use crate::mutators::integer::binary_search_arbitrary_u32; use crate::{DefaultMutator, Mutator, MutatorExt}; const INITIAL_MUTATION_STEP: u64 = 0; // quickly written but inefficient implementation of a general mutator for char // // does not lean towards any par...
use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize, Eq, Ord, PartialEq, PartialOrd)] pub struct Price { pub shop_id: String, pub value: usize, //en centimes pour 1 unité (Kg, L) pub unit: String, } #[derive(Debug, FromForm)] pub struct PriceForm { pub shop_id: String, ...
extern crate uptime_lib; use std::fmt; struct CompoundTime { w: usize, d: usize, h: usize, m: usize, s: usize, } macro_rules! reduce { ($s: ident, $(($from: ident, $to: ident, $factor: expr)),+) => {{ $( $s.$to += $s.$from / $factor; $s.$from %= $factor; ...
#[doc = "Reader of register CSR"] pub type R = crate::R<u32, super::CSR>; #[doc = "Writer for register CSR"] pub type W = crate::W<u32, super::CSR>; #[doc = "Register CSR `reset()`'s with value 0"] impl crate::ResetValue for super::CSR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
pub mod level; pub mod level_loader; use amethyst::ecs::{ Entities, Entity, Join, ReadStorage, World, WorldExt, WriteStorage, }; pub use level::Level; use crate::components::prelude::*; use crate::resources::prelude::*; use crate::savefile_data::prelude::*; use crate::settings::prelude::*...
use std::{ error, fmt::{self, Display, Formatter}, }; #[derive(Debug)] #[cfg_attr(test, derive(PartialEq))] pub enum Error { InvalidInput { token: String, position: usize, }, InvalidOpcode { opcode: i64, position: usize, }, MissingParameter { paramete...
extern crate coinbase_pro_rs; extern crate serde_json; mod common; use coinbase_pro_rs::structs::reqs; use coinbase_pro_rs::*; use common::delay; use coinbase_pro_rs::structs::reqs::{OrderTimeInForce, OrderTimeInForceCancelAfter}; static KEY: &str = "9eaa4603717ffdc322771a933ae12501"; static SECRET: &str = "RrLe...
use failure::Error; use geometry::{Placement, Point, Rectangle, Rotation::*}; use problem::{Problem, Variant}; use std::fmt::{self, Formatter}; use std::iter; use std::result; use std::str::FromStr; use std::time::Duration; type Result<T, E = Error> = result::Result<T, E>; #[derive(Clone, Debug, PartialEq)] pub struc...
use codespan_reporting::diagnostic::{Diagnostic, Label}; use crate::{ ast::Program, lexer::{LexicalError, Location, Token, TokenKind}, }; lalrpop_mod!(pub grammar); // synthesized by LALRPOP #[derive(Debug, Clone)] pub struct SyntaxError<'source>( lalrpop_util::ParseError<Location<'source>, TokenKind<'so...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::object::IsA; use glib::translate::*; use glib::GString; use libc; use std::fmt; use webkit2_webextension_sys; use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DO...
use log::debug; use log::error; use log::info; use std::env; use std::fs; use std::io::{stdin, stdout, Result as SimpleResult, Write}; use std::os::unix; use std::path::Path; use std::result::Result; use structopt::StructOpt; use thiserror::Error; use crate::common; #[derive(Debug, PartialEq, StructOpt)] pub struct A...
extern crate quicksilver; use quicksilver::input::Keyboard; use quicksilver::input::Key; use quicksilver::input::ButtonState; const KEY_LIST: &[Key] = &[Key::Key1, Key::Key2, Key::Key3, Key::Key4, Key::Key5, Key::Key6, Key::Key7, Key::Key8, Key::Key9, Key::Key0, Key::A, Key::B, Key::C, Key::D, Key::E, Key::F, Key:...
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
use crate::{Cons, Nil}; pub trait Extend<T> { type Output; fn extend(self, val: T) -> Self::Output; } impl<A, H, T> Extend<T> for Cons<A, H> where H: Extend<T>, { type Output = Cons<A, H::Output>; fn extend(self, val: T) -> Self::Output { Cons(self.0, self.1.extend(val)) } } impl<T>...
use crate::bot::components::create_launch_components; use crate::bot::embeds::{create_apod_embed, create_basic_embed, create_launch_embed}; use crate::models::apod::Apod; use crate::models::launch::Launch; use serenity::Result; use serenity::{ async_trait, builder::CreateEmbed, client, model::prelude::{...
use std::io::{stdin, BufRead}; fn main() { let stdin = stdin(); let mut iterator = stdin.lock().lines(); let str = iterator .next() .unwrap() .unwrap(); println!("{}", str.chars().count()); }
//! Colors used for drawing to a Cairo buffer use std::convert::From; /// Color to draw to the screen, including the alpha channel. /// NOTE: At this point, the parsed colors return the colors red and blue switched. /// This is due to a bug in WLC, causing the colors to be switched when drawing. /// Example: "00FF000...
use vec3::*; #[derive(Debug)] pub struct Onb { axis: [Vec3<f64>; 3] } impl Onb { pub fn new() -> Onb { Onb { axis: [Vec3::zero(), Vec3::zero(), Vec3::zero()] } } pub fn new_from_w(n: &Vec3<f64>) -> Onb { let w = n.unit_vector(); let a; if w.x.abs() >...
extern crate bytes; extern crate byteorder; extern crate futures; extern crate tokio_core; extern crate tokio_io; extern crate tokio_proto; extern crate tokio_service; use std::str; use std::io::{self, Error, Write, Read}; use std::net::TcpStream; use std::thread; use std::time::Duration; use bytes::{BigEndian, Buf, ...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::batch::WriteBatch; use crate::storage::{ColumnFamilyName, InnerStore, WriteOp}; use crate::VEC_PREFIX_NAME; use anyhow::{bail, format_err, Error, Result}; use logger::prelude::*; use rocksdb::{ CFHandle, ColumnFamilyO...
#[doc = "Reader of register MACQTxFCR"] pub type R = crate::R<u32, super::MACQTXFCR>; #[doc = "Writer for register MACQTxFCR"] pub type W = crate::W<u32, super::MACQTXFCR>; #[doc = "Register MACQTxFCR `reset()`'s with value 0"] impl crate::ResetValue for super::MACQTXFCR { type Type = u32; #[inline(always)] ...
// Copyright (C) 2020, Cloudflare, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list...
/* * @lc app=leetcode id=725 lang=rust * * [725] Split Linked List in Parts */ // Definition for singly-linked list. // #[derive(PartialEq, Eq, Clone, Debug)] // pub struct ListNode { // pub val: i32, // pub next: Option<Box<ListNode>> // } // // impl ListNode { // #[inline] // fn new(val: i32) -> Self { /...
use super::File; use futures::{Future, Poll}; use std::io; /// Future returned by `File::try_clone`. /// /// Clones a file handle into two file handles. /// /// # Panics /// /// Will panic if polled after returning an item or error. #[derive(Debug)] pub struct CloneFuture { file: Option<File>, } impl CloneFutur...
use tuber::engine::state::State; use tuber::engine::Result; use tuber::engine::TuberRunner; use tuber::engine::{Engine, EngineSettings}; use tuber::WinitTuberRunner; fn main() -> Result<()> { env_logger::init(); let engine = Engine::new(EngineSettings { application_title: None, initial_state: S...
extern crate kvm_ioctls; extern crate vm_memory; use vm_memory::*; use kvm_ioctls::*; use kvm_bindings::*; use std::{str, process}; fn main() { println!("Hello, world!"); test_vm() } fn test_vm() { // This example based on https://lwn.net/Articles/658511/ // next, don't load a simple binary, load a ...
use crate::accounts_db::{ get_paths_vec, AccountInfo, AccountStorage, AccountsDB, ErrorCounters, InstructionAccounts, InstructionLoaders, }; use crate::accounts_index::{AccountsIndex, Fork}; use crate::append_vec::StoredAccount; use crate::message_processor::has_duplicates; use bincode::serialize; use hashbrown...
use std::io::stdin; struct Game { current_room: usize, inventory: Vec<Item>, rooms: Vec<Room> } impl Game { fn room(&self) -> &Room { &self.rooms[self.current_room] } fn room_mut(&mut self) -> &mut Room { &mut self.rooms[self.current_room] } fn exits(&self) { ...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::IF2MCTL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
use winapi::um::winnt::*; #[repr(u32)] pub enum ProcessAccessMask { Terminate = PROCESS_TERMINATE, CreateThread = PROCESS_CREATE_THREAD, SetSessionId = PROCESS_SET_SESSIONID, VmOperation = PROCESS_VM_OPERATION, VmRead = PROCESS_VM_READ, VmWrite = PROCESS_VM_WRITE, DupHandle = PROCESS_DUP_HA...
// 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 thiserror::Error; use crate::direction::Direction; use crate::op::*; pub trait Game { fn is_second_round(&self) -> bool; fn stage(&self) -> u8; // 面 (1..=16) fn hero_x(&self) -> u8; fn hero_y(&self) -> u8; fn rand(&mut self) -> u8; fn try_shoot_aim(&mut self, x: u8, y: u8, speed_mask: u...
//! Messages that can be emitted by contracts. /// Messages can be emitted by contracts and are processed after the contract execution completes. #[non_exhaustive] #[derive(Clone, Debug, cbor::Encode, cbor::Decode)] pub enum Message { /// Calls an arbitrary runtime method handler in a child context with an optiona...
//! Sequencer related error types. use serde::{Deserialize, Serialize}; /// Sequencer errors. #[derive(Debug, thiserror::Error)] pub enum SequencerError { /// Starknet specific errors. #[error(transparent)] StarknetError(#[from] StarknetError), /// Errors directly coming from reqwest #[error(transp...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::HB16TIME2 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R...
use anyhow::{self, Context}; use std::fs; use std::thread; use ggez::{self, ContextBuilder, GameResult}; use ggez::conf::{WindowSetup, WindowMode}; use ggez::event::{self, EventHandler}; use ggez::graphics::{self, Rect}; use ggez::input::keyboard::{KeyCode, KeyMods}; use ggez::timer; use tinyfiledialogs; use crate::ch...
//! Win32-specific implementations and API extensions. pub(crate) mod ffi; pub(crate) mod imp; // Required re-exports pub(crate) use imp::spawn_window; pub(crate) type WindowRepr = imp::WindowImpl; // Bonus pub use ffi::{HINSTANCE, HMONITOR, HWND}; pub use imp::{this_hinstance, WindowExt, WindowBuilderExt};
//use yew::services::console::ConsoleService; pub struct App { selected: i32, message: String, } pub enum Msg { Select(i32), StartFetch, FinishFetch(String), } impl yew::Component for App { type Message = Msg; type Properties = (); fn create(_: &yew::Context<Self>) -> Self { A...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_Geolocation_Geofencing")] pub mod Geofencing; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: cor...
mod episode; mod podcast; use structopt::StructOpt; use threadpool::ThreadPool; #[derive(Debug, StructOpt)] #[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))] #[structopt( name = "Podder", about = "An app to download your podcasts, fast and easy" )] struct Cli { #[structopt( ...
use crate::ConnectParams; use tokio::{ io::{BufReader, BufWriter}, net::{ tcp::{OwnedReadHalf, OwnedWriteHalf}, TcpStream, }, }; // An plain async tcp connection #[derive(Debug)] pub struct AsyncPlainTcpClient { params: ConnectParams, reader: BufReader<OwnedReadHalf>, writer: Bu...
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub mod dna; pub mod dna4; pub mod dnax; // mod util {} use std::os::raw::c_char; #[inline] fn to_ptrs(forward: &str) -> (*const c_char, *const c_char) { let size = forward.len(); let begin = forward.as_ptr() as *const c_char; let end = unsafe { begin.offset(size as isize) }; (begin, end) } #[in...
use crate::image::Image; pub use crate::prelude::*; use fltk_sys::valuator::*; use std::{ ffi::{CStr, CString}, mem, os::raw, }; /// Creates a slider widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Slider { _inner: *mut Fl_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Cr...
// 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...
extern crate machine; pub fn main() { machine::run() }
//! `hermit-abi` is small interface to call functions from the unikernel //! [RustyHermit](https://github.com/hermitcore/libhermit-rs). #![no_std] #![allow(nonstandard_style)] #![allow(clippy::missing_safety_doc)] #![allow(clippy::result_unit_err)] pub mod errno; pub mod tcplistener; pub mod tcpstream; use core::ffi...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qstandarditemmodel.h // dst-file: /src/gui/qstandarditemmodel.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main bl...
//! Implements P-256 keys use ring::{ error, rand, signature::{ EcdsaKeyPair, KeyPair, VerificationAlgorithm, ECDSA_P256_SHA256_ASN1, ECDSA_P256_SHA256_ASN1_SIGNING, }, }; use rustls::internal::msgs::codec::{Codec, Reader}; /// p-256 public key #[derive(Debug, Clone, Ord, PartialOrd, Eq, Pa...
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug)] pub struct VkShaderModuleCreateInfo { pub sType: VkStructureType, pub pNext: *const c_void, pub flags: VkShaderModuleCreateFlagBits, pub codeSize: usize, pub pCode: *const u32, } impl VkShaderModuleCreateIn...
use std::collections::HashMap; use std::fs::File; use std::io::BufWriter; use std::io::Write; // Trait system needs to allow for graph construction. // Main data structure holds basic data, like node // looks. // start with the root node. Add the node to the stack. // Get the node at the top of the stack. For each o...
mod common; use std::str::FromStr; use std::string::ToString; use self::common::*; use rusty_git::object::{self, ObjectData}; use rusty_git::repository::Repository; #[test] fn reading_tag_produces_same_result_as_libgit2() { run_test_in_new_repo(|path| { git_tag(path, "mytag", Some("my message")); ...
/* @author: xiao cai niao @datetime: 2019/12/04 */ use actix_web::web; use crate::storage::rocks::{DbInfo, CfNameTypeCode, KeyValue, PrefixTypeCode}; use std::{time, thread}; use crate::ha::procotol::{MysqlState}; use std::error::Error; use crate::ha::nodes_manager::CheckState; use crate::storage::opdb::{HaChangeLog, H...
//! This module provides a reference implementation of [`QueryNamespace`] for use in testing. //! //! AKA it is a Mock use crate::{ exec::{ stringset::{StringSet, StringSetRef}, Executor, ExecutorType, IOxSessionContext, }, pruning::prune_chunks, QueryChunk, QueryChunkData, QueryComplet...
use ordered_vec_map::{InsertionResult, OrderedVecMap, RemovalResult}; use std::cmp::{min, max, Ord, Ordering}; use typeahead::{Parse, RemapType, Typeahead}; // TODO Handle noremap (key,value) by surrounding value with non-input-able // keys, so if it gets put in the typeahead, it cannot possibly be remapped. // This w...
pub fn u32_from_pcm8(data: u8) -> u32 { (data as u32) << 24 } pub fn u32_from_pcm16(data: u16) -> u32 { (data as u32) << 16 } pub fn u32_from_pcm32(data: u32) -> u32 { data } pub fn u32_from_ieee(data: f32) -> u32 { // TODO 0 } pub fn u32_from_alaw(data: u8) -> u32 { // TODO 0 } pub f...
use crate::order::Order; use std::sync::Mutex; /// A threadsafe FIFO queue to store unprocessed messages arriving from traders. pub struct Queue { items: Mutex<Vec<Order>>, } impl Queue { pub fn new() -> Queue { Queue { items: Mutex::new(Vec::<Order>::new()), } } // New orders are pushed to the end of...