text
stringlengths
8
4.13M
/*! Contains the `Value` type that represents a conditional compilation expression's value. */ use WinVersion; use features::{Features, Partitions, WinVersions}; /** Represents a conditional compilation expression's value. Under normal circumstances, this would be synonymous with "an integer". These are not normal c...
thread_local! { static POLL: ::std::cell::RefCell<::mio::Poll> = ::std::cell::RefCell::new(::mio::Poll::new().unwrap()); static EVENT_HANDLERS: ::std::cell::RefCell<::std::collections::BTreeMap<usize, ::std::rc::Rc<dyn Fn(::mio::Event) -> () + 'static>>> = ::std::default::Default::default(); static TIME_CALLBACKS: :...
extern crate alloc; use alloc::string::String; use alloc::vec::Vec; use core::num::NonZeroUsize; #[cfg(feature = "parallel")] use rayon::prelude::*; use subspace_core_primitives::crypto::kzg::{Commitment, Kzg, Polynomial}; use subspace_core_primitives::crypto::{blake2b_256_254_hash_to_scalar, Scalar}; use subspace_cor...
mod shared; use rdisk::{PartitionedDisk, PhysicalDisk}; use shared::*; #[test] fn partitions() { use serde::Deserialize; #[derive(Deserialize)] #[allow(non_snake_case)] struct PartitionInfo { DiskNumber: u32, PartitionNumber: u32, Offset: u64, Size: u64, AccessP...
#[doc = "Register `IDMALAR` reader"] pub type R = crate::R<IDMALAR_SPEC>; #[doc = "Register `IDMALAR` writer"] pub type W = crate::W<IDMALAR_SPEC>; #[doc = "Field `IDMALA` reader - Word aligned linked list item address offset Linked list item offset pointer to the base of the next linked list item structure. Linked lis...
#[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::CLOCKENSTAT { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &...
use pest::Parser; use pest_derive::*; #[derive(Parser)] #[grammar = "assembler.pest"] struct AssemblerParser; use crate::instruction::Instruction; use pest::iterators::Pairs; pub type Error = pest::error::Error<Rule>; pub fn create_program(text: &str) -> Result<Vec<Instruction>, Error> { let mut assembler: Pair...
extern crate time; use std::fs::File; use std::io::prelude::*; use std::io::{BufRead, BufReader}; use std::io::ErrorKind; use std::os::unix::net::UnixStream; use std::path::PathBuf; use std::thread; use std::time::Duration; use config::Config; use itertools::Itertools; use relm_core::Sender; use ::monitor::*; pub s...
use { std::net::{ SocketAddr, TcpListener, TcpStream, }, std::rc::Rc, std::cell::RefCell, std::prelude::v1::*, }; struct Stream { data_stream : Rc<Data>, } struct Data { data : Vec<usize>, } enum Event<T> { Poll(T), //... } trait StreamT { fn poll_event_stream(&self, rcs : Rc<Stream>, ep : fn());//a...
use autorel_chlg::{BreakingInfo, Change, ChangeLog, ChangeType}; #[test] fn markdown_example() { let mut changelog = ChangeLog::default(); changelog += Change { type_: ChangeType::Feature, scope: None, description: "Feature without scope", breaking: BreakingInfo::NotBreaking, ...
use crate::block::{Block, Cid}; use crate::bitswap::Priority; use crate::repo::{Repo, RepoTypes}; use libp2p::PeerId; use std::sync::mpsc::{channel, Sender, Receiver}; pub trait Strategy<TRepoTypes: RepoTypes>: Send + Unpin { fn new(repo: Repo<TRepoTypes>) -> Self; fn process_want(&self, source: PeerId, cid: C...
#[doc = "Reader of register PROC1_INTS3"] pub type R = crate::R<u32, super::PROC1_INTS3>; #[doc = "Reader of field `GPIO29_EDGE_HIGH`"] pub type GPIO29_EDGE_HIGH_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIO29_EDGE_LOW`"] pub type GPIO29_EDGE_LOW_R = crate::R<bool, bool>; #[doc = "Reader of field `GPIO29_LEV...
use crate::geometry::Axial; use crate::terrain::TileTerrainType; use serde::{Deserialize, Serialize}; /// Represents a connection of a room to another. /// Length of the Bridge is defined by `radius - offset_end - offset_start`. /// I choose to represent connections this way because it is much easier to invert them. #...
use std::path::Path; use self::error::Error; use crate::Config; pub mod error; #[cfg(feature = "json")] pub mod json; #[cfg(feature = "toml")] pub mod toml; #[cfg(feature = "yaml")] pub mod yaml; pub fn load<P>(path: P) -> Result<Config, Error> where P: AsRef<Path>, { match path.as_ref().extension() { ...
use crate::Error; use derivative::Derivative; use std::collections::{BTreeMap, BTreeSet}; use typed_index_collection::{CollectionWithId, Id, Idx}; /// The corresponding result type used by the crate. type Result<T, E = Error> = std::result::Result<T, E>; /// A set of `Idx<T>` pub type IdxSet<T> = BTreeSet<Idx<T>>; /...
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. use core::{mem}; use crate::{ kty::{c_int, itimerspec, TFD_TIMER_ABSTIME}, syscall::{close, timerfd_settime, ...
/* * * swarm_service.rs * */ use crate::iot_manager; use crate::message_store; use crate::message_buffer; use crate::avlo::swarm_server::Swarm; use crate::avlo::{IoTProcess, IoTDevice, DeviceGroup, IoTDeviceStatus, SwarmMessage}; use tokio::sync::mpsc; use tonic::{Request, Response, Status}; #[derive(Debug)] pub str...
extern crate clap; extern crate pac; use clap::{Arg, App}; use pac::Pac; use pac::direct::DPac; use std::io::BufReader; use std::fs::File; fn main() { let matches = App::new("PAC File Lister") .version("0.1") .author("Marime Gui") .about("Lists all files inside of a .pac file") .ar...
// =============================================================================== // Authors: AFRL/RQQA // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of th...
/*! ```rudra-poc [target] crate = "parc" version = "1.0.1" [report] issue_url = "https://github.com/hyyking/rustracts/pull/6" issue_date = 2020-11-14 rustsec_url = "https://github.com/RustSec/advisory-db/pull/650" rustsec_id = "RUSTSEC-2020-0134" [[bugs]] analyzer = "SendSyncVariance" bug_class = "SendSyncVariance" r...
mod utils; use wasm_bindgen::prelude::*; use tiny_keccak::{Keccak, Hasher}; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[wasm_bindgen] extern "C" { fn read...
use std::convert::From; use std::io; #[derive(Debug)] pub enum Error { Io(io::Error), Freetype(freetype::Error), Png(lodepng::ffi::Error), UnsupportedFormat, } impl From<io::Error> for Error { fn from(error: io::Error) -> Self { Error::Io(error) } } impl From<freetype::Error> for Erro...
fn print_admiration(name: &str) { println!("Wow, {} really makes you think.", name,); } fn main() { let value = String::new(); print_admiration(value.as_str()); }
//! An iterator over incoming signals. //! //! This provides a higher abstraction over the signals, providing //! the [`SignalsInfo`] structure which is able to iterate over the //! incoming signals. The structure is parametrized by an //! [`Exfiltrator`][self::exfiltrator::Exfiltrator], which specifies what informatio...
//! Defines common interfaces for interacting with statistical distributions //! and provides //! concrete implementations for a variety of distributions. use super::statistics::{Max, Min}; use ::num_traits::{float::Float, Bounded, Num}; pub use self::bernoulli::Bernoulli; pub use self::beta::Beta; pub use self::binom...
use model::person::Person; #[derive(Deserialize, Serialize, Debug)] pub struct PersonView { pub status: i32, pub message: String, pub person: Person, } #[derive(Deserialize, Serialize, Debug)] pub struct PersonListView { pub status: i32, pub message: String, pub person_list: Vec<Person>, }
mod turnip_pattern; use std::collections::HashMap; use regex::{Captures, CaptureNames, Regex}; pub trait Pattern { fn to_regex(&self) -> Regex; fn to_string(&self) -> String; } #[derive(PartialEq, Eq, Debug)] pub enum StepArgument { String(String), } #[derive(Clone, Debug)] pub struct StepPattern { ...
extern crate serde; use crate::api::components::address::geolocation::Geolocation; #[derive(Serialize, Deserialize, Default, Queryable)] pub struct Address { street: String, city: String, state: String, zipcode: i32, building_num: String, geolocation: Option<Geolocation> }
use crate::{BotResult, CommandData, Context}; use std::sync::Arc; #[command] #[short_desc("https://youtu.be/g7VNvg_QTMw&t=29")] #[bucket("songs")] #[no_typing()] async fn startagain(ctx: Arc<Context>, data: CommandData) -> BotResult<()> { let (lyrics, delay) = _startagain(); super::song_send(lyrics, delay, c...
use amethyst::ecs::{Component, DenseVecStorage}; #[derive(Clone, Debug)] pub struct Health { current: u32, max: u32 } impl Component for Health { type Storage = DenseVecStorage<Self>; } impl Health { pub fn new(max: u32) -> Self { Health { current: max, max } ...
use std::borrow::Cow; use std::collections::HashSet; use std::sync::Arc; use itertools::Itertools; use command_data_derive::CommandData; use discorsd::async_trait; use discorsd::BotState; use discorsd::commands::*; use discorsd::errors::BotError; use crate::{avalon, Bot}; use crate::games::GameType; #[derive(Clone,...
use crate::error::RubyError; use crate::vm::*; use fancy_regex::{Captures, Error, Match, Regex}; //#[macro_use] use crate::*; #[derive(Debug)] pub struct RegexpInfo { pub regexp: Regexp, } impl RegexpInfo { pub fn new(regexp: Regex) -> Self { RegexpInfo { regexp: Regexp(regexp), } ...
// Copyright 2015-2016 Brian Smith. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND AND THE AUTHORS DIS...
use exonum::{ api::{self, ServiceApiBuilder, ServiceApiState}, blockchain::{self, BlockProof, TransactionMessage}, crypto::{Hash, PublicKey}, explorer::BlockchainExplorer, helpers::Height, }; use exonum_merkledb::{ListProof, MapProof}; use super::{schema::Schema, SERVICE_ID}; use crate::queue::Queu...
#[doc = "Reader of register LL_CLK_EN"] pub type R = crate::R<u32, super::LL_CLK_EN>; #[doc = "Writer for register LL_CLK_EN"] pub type W = crate::W<u32, super::LL_CLK_EN>; #[doc = "Register LL_CLK_EN `reset()`'s with value 0x26"] impl crate::ResetValue for super::LL_CLK_EN { type Type = u32; #[inline(always)] ...
/*======================================= * @FileName: [1].两数之和.rs * @Description: * @Author: TonyLaw * @Date: 2021-08-26 03:02:33 Thursday * @Copyright: © 2021 TonyLaw. All Rights reserved. =========================================*/ /*======================================= (题目难度:简单) 给定一个整数数组 nums 和...
#![allow(non_snake_case)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] #![allow(clippy::useless_transmute)] #![allow(clippy::too_many_arguments)] #![allow(clippy::missing_safety_doc)] include!(concat!(env!("OUT_DIR"), "/lib.rs"));
use std::io::*; use std::fs::{File, OpenOptions}; use std::path::Path; mod config; mod game; use game::*; use config::*; #[allow(dead_code)] fn main() { let stdin = stdin(); let stdout = stdout(); let config = read_config(&mut BufReader::new(stdin.lock())); let mut board = Board::new(); let debug_...
#[doc = "Reader of register ENABLED1"] pub type R = crate::R<u32, super::ENABLED1>; #[doc = "Reader of field `clk_sys_xosc`"] pub type CLK_SYS_XOSC_R = crate::R<bool, bool>; #[doc = "Reader of field `clk_sys_xip`"] pub type CLK_SYS_XIP_R = crate::R<bool, bool>; #[doc = "Reader of field `clk_sys_watchdog`"] pub type CLK...
use std::fs; mod day03 { use std::collections::{HashMap, HashSet}; pub type ClaimId = i32; #[derive(Debug, PartialEq, Eq, Hash)] pub struct Pos { pub x: i32, pub y: i32, } type ClaimsReport = HashMap<Pos, HashSet<ClaimId>>; pub fn solve_a(input: &str) -> usize { ...
use super::definitions::Filter; use super::definitions::Ordering; use super::DataSource; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "queryType", rename = "scan")] #[serde(rename_all = "camelCase")] pub struct Scan { pub data_source: DataSource, pub intervals: Ve...
use std::fs; use std::path::PathBuf; static ARTIFACT_WRITE_ERROR: &str = "Could not write artifact to file"; pub struct Artifact { pub location: PathBuf, } impl Artifact { pub fn write<S>(&self, content: S) where S: AsRef<str> { let content_bytes = content.as_ref().as_bytes(); fs::wri...
use crate::models::{ComicId, ComicIdInvalidity, Token}; use crate::util::{ensure_is_authorized, ensure_is_valid}; use actix_web::{error, web, HttpResponse, Result}; use actix_web_grants::permissions::AuthDetails; use database::models::{Comic as DatabaseComic, LogEntry}; use database::DbPool; use parse_display::Display;...
#[macro_use] extern crate criterion; use criterion::{BatchSize, Criterion}; use hacspec_dev::prelude::*; use hacspec_lib::prelude::*; fn bench(c: &mut Criterion) { for chunk_size in (10..2000).step_by(500) { c.bench_function(&format!("Seq slice no-copy {}", chunk_size), |b| { b.iter_batched( ...
use std::fs::File; use std::io::BufReader; use std::io::prelude::*; fn next_floor(floor: i32, inst: char) -> i32 { match inst { '(' => floor + 1, ')' => floor - 1, _ => floor, } } fn main() { let file = File::open("input.txt").expect("file not found"); let mut reader = BufReade...
use serde_scan::scan; #[derive(Debug)] struct State { current_marble: Marble, current_marble_idx: usize, next_marble: Marble, num_players: usize, circle: Vec<Marble>, points: Vec<usize>, } type Marble = usize; type Result<T> = std::result::Result<T, std::boxed::Box<dyn std::error::Error>>; fn...
// Copyright 2015 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 ...
#![allow(unused_variables)] #![allow(dead_code)] #![feature(fs_walk)] #![feature(split_off)] #![feature(path_relative_from)] #![feature(convert)] #![feature(path_ext)] // common extern crate rustc_serialize; #[macro_use]extern crate clap; #[macro_use]extern crate log; extern crate fern; extern crate time; // server ext...
use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, }; #[derive(Clone)] pub struct Rename; impl Command for Rename { fn name(&self) -> &str { "re...
#![deny( missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces, unused_qualifications )] //! po2 is a command line application based on Pullover use pullover::{Attachment...
use proc_macro::{self, TokenStream}; use quote::{quote, ToTokens}; use syn::{ parse_macro_input, DataEnum, Data, DeriveInput, Fields }; #[proc_macro_derive(QuickFrom, attributes(quick_from))] pub fn quick_from(input: TokenStream) -> TokenStream { let DeriveInput{ident, data, generics, ..} = par...
//! Advertises this device to Spotify clients in the local network. //! //! This device will show up in the list of "available devices". //! Once it is selected from the list, [`Credentials`] are received. //! Those can be used to establish a new Session with [`librespot_core`]. //! //! This library uses mDNS and DNS-S...
use tui::widgets::{Block, Borders, List, Text, Paragraph, ListState}; use tui::widgets::canvas::{Canvas, Points}; use tui::layout::{Layout, Constraint, Alignment, Direction}; use tui::style::{Style, Color}; use tui::{Frame, backend}; use crossterm::event::KeyCode; use crate::computer::{Computer, SCR_ADDRESS, KBD_ADDRE...
use std::time; #[macro_use] mod util; mod client; mod core; mod endpoints; mod http; mod verify; pub use crate::client::Client; pub use crate::core::{Config, Error, Info, Random, Result}; const MAINNET_CHAIN_HASH: &'static str = "8990e7a9aaed2ffed73dbd7092123d6f289930540d7651336225dc172e51b2ce"; // Trait for Dr...
#[doc = "Register `GINTMSK` reader"] pub type R = crate::R<GINTMSK_SPEC>; #[doc = "Register `GINTMSK` writer"] pub type W = crate::W<GINTMSK_SPEC>; #[doc = "Field `MMISM` reader - Mode mismatch interrupt mask"] pub type MMISM_R = crate::BitReader; #[doc = "Field `MMISM` writer - Mode mismatch interrupt mask"] pub type ...
#![crate_name = "uu_wc"] /* * This file is part of the uutils coreutils package. * * (c) Boden Garman <bpgarman@gmail.com> * (c) Geordon Worley <vadixidav@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use itertools:...
//! Slydot: The Sunrise Event //! ========================= //! //! An original game written in Rust. //! //! Any similarity between this game and *Spybot: The Nightfall Incident* is purely coincidental. extern crate piston; extern crate piston_window; extern crate graphics; extern crate opengl_graphics; extern crate ...
use elements::HmfGen; use bignum::{BigNumber, RealQuadElement}; use flint::fmpq::Fmpq; use flint::fmpz::Fmpz; use std::ops::{AddAssign, MulAssign}; fn diff_mut<T>(res: &mut HmfGen<T>, expt: (usize, usize), f: &HmfGen<T>) where T: BigNumber + From<(i64, u64)> + Clone, { res.set(f); let mut tmp = T::R::defau...
use log::{info, LevelFilter}; use loggest::init; use std::thread; fn main() { let _flush = init(LevelFilter::Info, "example").unwrap(); info!("Main thread"); thread::spawn(move || { info!("A thread"); }) .join() .unwrap(); }
use super::dto; use actix_web::web; use failure::Error; use futures::Future; use r2d2; use r2d2_sqlite; use rusqlite::params; /// Database module /// /// As a takeaway of the talk "Immutable Relational Data" by Richard Feldman /// I decided to include no id values in any of the structs describing data. /// Instead, th...
use serde::{Serialize, Deserialize}; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use crate::routing::MetaBundle; use tokio::sync::mpsc::Sender; pub use self::cla_handle::HandleId as HandleId; pub mod cla_handle; pub mod cla_manager; pub mod stcp_server; pub mod stcp; pub mod loopback; #[derive...
use regex::{RegexSet, SetMatches, SetMatchesIntoIter}; pub struct RegexSetMatches<'a> { iter: SetMatchesIntoIter, patterns: &'a[String], } impl<'a> RegexSetMatches<'a> { pub fn new(set: &'a RegexSet, matches: SetMatches) -> Self { Self { iter: matches.into_iter(), patterns: set.patterns(), } } } imp...
use std::{ fs }; pub fn main() -> Option<bool> { let file_contents = match fs::read_to_string( "./inputs/2020-12-04-aoc-01-input.txt" ) { Ok(c) => c, Err(e) => panic!("{:?}", e) }; let ( valid_passports, invalid_passports ): (Vec<Passport>, Vec<Passport>) = file_con...
use crate::html::Attribute; macro_rules! declare_text_attributes { ($($x:ident, $tag:expr)*) => ($( pub fn $x<Msg>(value: &str) -> Attribute<Msg> { Attribute::Text($tag.to_owned(), value.to_owned()) } )*); ($($x:ident)*) => ($( declare_text_attributes!($x, stringify!($x...
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under both the MIT license found in the * LICENSE-MIT file in the root directory of this source tree and the Apache * License, Version 2.0 found in the LICENSE-APACHE file in the root directory * of this source tree. */ //! A...
use cookie_factory::GenError; use bytes::BytesMut; use futures::{Future, Stream}; use nom::{IResult, Offset}; use std::io; use std::iter::repeat; use std::net::SocketAddr; use std::time::{Duration, Instant}; use tokio; use tokio::net::{TcpListener, TcpStream}; use tokio_io::IoFuture; use tokio_io::codec::{Decoder, Enco...
pub mod runner; //use puck_core::{HashMap, Tick}; use puck_core::app::{App}; use puck_core::event::*; use input::Input; use audio::SoundRender; //use std::hash::Hash; //use std::fmt::Debug; use std::collections::BTreeMap as Map; use {RenderTick, Dimensions}; use render::gfx::{OpenGLRenderer}; // - abstract trait ...
use std::sync::Arc; use num; use crate::prelude::*; use super::Material; use crate::interaction::SurfaceInteraction; use crate::bxdf::{ Bsdf, LambertianReflection, TransportMode }; use crate::texture::Texture; #[derive(Clone, Debug)] pub struct MatteMaterial { kd: Arc<dyn Texture<Spectrum> + Send + Sync>, sigm...
//! Process Stack Pointer #[cfg(cortex_m)] use core::arch::asm; /// Reads the CPU register #[cfg(cortex_m)] #[inline] pub fn read() -> u32 { let r; unsafe { asm!("mrs {}, PSP", out(reg) r, options(nomem, nostack, preserves_flags)) }; r } /// Writes `bits` to the CPU register #[cfg(cortex_m)] #[inline] pu...
use anyhow::{anyhow, Context}; use flate2::bufread::GzEncoder; use flate2::Compression; use log::{debug, info, warn}; use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; use std::fs::File; use std::io::{BufReader, Read}; use std::path::Path; use std::sync::mpsc::channel; use std::time::Duration; pub struct ...
extern crate memmap; use std::fs::OpenOptions; use std::path::PathBuf; use std::fs::File; use memmap::MmapMut; mod sbt_link; //mod sbt_methods; pub use sbt_link::Link; struct LinksDB<T> { links: *mut Link<T>, allocated_links: T, reserved_links: T, free_links: T, first_free_link: T, last_fr...
//https://www.codewars.com/kata/566fc12495810954b1000030 fn nb_dig(n: i32, d: i32) -> i32 { let digit = d.to_string().chars().next().unwrap(); (1..=n).fold(0,|count,n| count + (n * n).to_string().chars().filter(|i| *i == digit).collect::<Vec<char>>().len() as i32) } fn main(){ println!("{}",nb_dig(10,1)); ...
pub fn xorshift32(seed: u32) -> u32 { let y = seed ^ (seed << 13); let y = y ^ (y >> 17); y ^ (y << 15) }
use std::fmt; use self::Msg::*; use super::token::Position; #[derive(Clone, PartialEq, Eq, Debug)] pub enum Msg { Unimplemented, UnknownClass(String), UnknownType(String), UnknownIdentifier(String), UnknownStruct(String), UnknownFunction(String), UnknownField(String, String), UnknownMe...
use backend::{Backend, BackendImpl}; use widget::Widget; pub struct Window(<BackendImpl as Backend>::Window); impl Widget for Window { type Builder = WindowBuilder; fn build(builder: WindowBuilder) -> Self { Window(<BackendImpl as Backend>::Window::build(builder)) } } #[derive(Default)] pub str...
use crate::core::*; use crate::processing::*; use core::ops::Neg; use ndarray::prelude::*; use num_traits::{cast::FromPrimitive, real::Real, Num, NumAssignOps}; use std::marker::Sized; /// Runs the sobel operator on an image pub trait SobelExt where Self: Sized, { /// Type to output type Output; /// Re...
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) // from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70) // DO NOT EDIT use Error; use SocketConnectable; use TlsCertificateFlags; use ffi; use glib; use glib::StaticType; use glib::Value; use glib::object::Downcast; use glib::object:...
// Rhodium allows to create hyper servers as a stack of Handlers. Each Handler has its own handle_request // and handle_response methods // Handlers are executed by order while handling a request, and by the reverse order while handling the response. // The order in which handle_request and handle_response functions ar...
#[doc = "Register `APB1LPENR` reader"] pub type R = crate::R<APB1LPENR_SPEC>; #[doc = "Register `APB1LPENR` writer"] pub type W = crate::W<APB1LPENR_SPEC>; #[doc = "Field `TIM5LPEN` reader - TIM5 clock enable during Sleep mode"] pub type TIM5LPEN_R = crate::BitReader<TIM5LPEN_A>; #[doc = "TIM5 clock enable during Sleep...
#![allow(non_camel_case_types)] #![allow(proc_macro_derive_resolution_fallback)] #![allow(non_snake_case)] #![allow(dead_code)] #![allow(unused_imports)] #[macro_use] extern crate diesel; #[macro_use] extern crate diesel_derive_enum; mod common; mod pg_array; mod nullable; mod rename; mod simple;
use shorthand::ShortHand; #[derive(ShortHand)] #[shorthand(verify(ffn = "Self::verify_field"))] struct Example { field: usize, } fn main() {}
use super::*; use std::cmp::Ord; use std::cmp::Ordering; use std::cmp::PartialOrd; impl Ord for EditorInstallation { fn cmp(&self, other: &EditorInstallation) -> Ordering { self.version.cmp(&other.version) } } impl PartialOrd for EditorInstallation { fn partial_cmp(&self, other: &EditorInstallatio...
#[doc = "Register `OR1` reader"] pub type R = crate::R<OR1_SPEC>; #[doc = "Register `OR1` writer"] pub type W = crate::W<OR1_SPEC>; #[doc = "Field `ETR_RMP` reader - External trigger remap"] pub type ETR_RMP_R = crate::BitReader<ETR_RMP_A>; #[doc = "External trigger remap\n\nValue on reset: 0"] #[derive(Clone, Copy, De...
use std::slice; use std::ffi::{CString, CStr}; use traits::FromRaw; use ::ffi; use ::error::*; pub struct Texture<'a> { raw: &'a ffi::AiTexture, } impl<'a> FromRaw<'a, Texture<'a>> for Texture<'a> { type Raw = *const ffi::AiTexture; #[inline(always)] fn from_raw(raw: &'a Self::Raw) -> Texture<'a> { ...
pub mod running_page; pub mod settings_page;
use gamesession::channel::*; use player::*; use InternalState; use phase::*; use slog::*; pub struct GameSession { phase: EGamePhase, state: InternalState, log: Logger, } impl GameSession { pub fn new() -> GameSession { let root = Logger::root(Discard, o!( "murder.version" => env!(...
use std::sync::MutexGuard; use nia_interpreter_core::{EventLoopHandle, NiaStopListeningCommand}; use nia_protocol_rust::Response; use crate::error::NiaServerError; use crate::error::NiaServerResult; use crate::protocol::NiaGetDefinedActionsResponse; use crate::protocol::NiaGetDefinedMappingsRequest; use crate::proto...
mod client; mod notification; mod notifications_polling; mod notifications_response; pub use self::client::GithubClient; pub use self::client::new as new_client; pub use self::notification::PullRequest;
pub mod render; pub mod math; pub mod render_loop; use wasm_bindgen::prelude::*; use wasm_bindgen::{JsCast}; use web_sys::{WebGl2RenderingContext}; use render::builder::{RenderBuilder}; use render::api::{WebRenderAPI, WebRenderBuffer}; use render_loop::{RenderLoop}; // When the `wee_alloc` feature is enabled, use `we...
//! Warning: incomplete //! //! This is a draft of the constants that you can match against with certain values given inside //! responses. pub enum Source { RISKIQ, PINGLY, DNSRES, KASPERSKY, } impl Source { pub fn string(&self) -> String { match *self { Source::RISKIQ => "ris...
use serde::ser::{Serialize, Serializer}; use super::Axial; impl Serialize for Axial { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { let payload = [self.q, self.r]; <[i32; 2] as Serialize>::serialize(&payload, serializer) } } #[cfg(test...
use std::error::Error; use std::fmt::{Display, Formatter}; #[derive(Debug)] pub struct TreeerErr { errors: Errors } impl Default for TreeerErr { fn default() -> Self { Self { errors: Errors::Unknown } } } impl Display for TreeerErr { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { write!(f, ...
// Copyright 2016 FullContact, Inc // Copyright 2017 Jason Lingle // // 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...
use crate::{BoxFuture, CtxTransaction, Entity, Result}; use std::sync::Arc; pub trait RemovingHandler<E: Entity> { fn handle_removing<'a>( &'a self, trx: &'a mut CtxTransaction<'_>, key: &'a E::Key, track_ctx: &'a E::TrackCtx, ) -> BoxFuture<'a, Result<()>>; } impl<E: Entity, T...
extern crate varint; use std::cmp::Ordering; use std::collections::BTreeMap; use std::collections::HashSet; use std::io::Cursor; use std::rc::Rc; use std::{self, mem, str}; use self::varint::VarintRead; use crate::error::Error; use crate::json_value::JsonValue; use crate::key_builder::KeyBuilder; use crate::query::{...
#[cfg(feature = "profiling")] extern crate cpuprofiler; extern crate env_logger; extern crate ggez; #[macro_use] extern crate log; extern crate rand; extern crate rodio; mod gamestates; mod ai; //mod custom_audio; mod cs; mod game; mod resources; mod rules; mod types; mod utils; use std::env; use ggez::{conf, Cont...
use event; use theme; // Module is not named `ncurses` to avoir naming conflict mod curses; pub use self::curses::NcursesBackend; pub trait Backend { fn init(); fn finish(); fn clear(); fn refresh(); fn has_colors() -> bool; fn init_color_style(style: theme::ColorStyle, foreground: &theme:...
#[macro_use] extern crate bbs; use bbs::prelude::*; use std::collections::BTreeMap; fn main() { let (dpk, sk) = Issuer::new_short_keys(None); let pk = dpk.to_public_key(5).unwrap(); let signing_nonce = Issuer::generate_signing_nonce(); // Send `signing_nonce` to holder // Recipient wants to hide a messag...
mod book; mod config; mod links; mod show; use structopt::StructOpt; #[macro_use] extern crate prettytable; #[derive(Debug, StructOpt)] enum Command { /// Manage established links Links(links::LinkCommand), /// Book hours under aliased service Book(book::BookCommand), /// Create simpl config Co...
//pub fn power(canvas_id: &str, power: i32) -> Result<Chart, JsValue> { // let map_coord = func_plot::draw(canvas_id, power).map_err(|err| err.to_string())?; // Ok(Chart { // convert: Box::new(move |coord| map_coord(coord).map(|(x, y)| (x.into(), y.into()))), // }) //} // use core::f64::consts::PI; us...