text
stringlengths
8
4.13M
#[doc = "Register `SECWM1R1` reader"] pub type R = crate::R<SECWM1R1_SPEC>; #[doc = "Register `SECWM1R1` writer"] pub type W = crate::W<SECWM1R1_SPEC>; #[doc = "Field `SECWM1_PSTRT` reader - SECWM1_PSTRT"] pub type SECWM1_PSTRT_R = crate::FieldReader; #[doc = "Field `SECWM1_PSTRT` writer - SECWM1_PSTRT"] pub type SECWM...
fn main() { println!("Gui example"); }
extern crate mynumber; #[test] fn verify_with_valid_mynumber_returns_ok() { let number = "123456789018"; assert!(mynumber::verify(number).is_ok()); }
// 16.26 Calculator // Does two passes, first executing any multiplications and divisions as soon as // they are seen, and then executing the additions and subtractions in the next // pass. use regex::Regex; enum Ops { Plus, Minus, } #[allow(clippy::trivial_regex)] fn calculator(expr: &str) -> f64 { let...
#![macro_use] use core::default::Default; use core::marker::PhantomData; use core::task::Poll; use embassy::interrupt::InterruptExt; use embassy::util::{AtomicWaker, OnDrop, Unborrow}; use embassy_extras::unborrow; use futures::future::poll_fn; use sdio_host::{BusWidth, CardCapacity, CardStatus, CurrentState, SDStatu...
//! The `interpreter` module contains types and functions useful for interpreting Parallisp. use std::cell::RefCell; use std::error::Error; use std::fmt; use std::iter::once; use std::rc::Rc; use super::Expr; use super::Function; pub mod macros; pub mod stdlib; #[cfg(test)] mod tests; /// `InterpreterError`s are er...
fn main() { let mut x = vec!["Hellow", "world"]; println!("Hello, world"); }
// Copyright 2016 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. //! Bindings for runtime services provided by Zircon extern crate fuchsia_zircon as zircon; extern crate fuchsia_zircon_sys as zircon_sys; extern crate mx...
use std::env; use std::process; use common::load_file; use std::collections::HashMap; fn distance(a: &str, b: &str) -> i32 { a.chars() .into_iter() .zip(b.chars()) .map(|(x, y)| { if x == y { return 0; } 1 }) .fold(0, |acc...
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1527/selector" #[allow(unused)] use super::rsass; // From "sass-spec/spec/libsass-closed-issues/issue_1527/selector/first.hrx" // Ignoring "first", error tests are not supported yet. // From "sass-spec/spec/libsass-closed-issues/issue_1527/sel...
#![recursion_limit="128"] extern crate regex; extern crate proc_macro; extern crate syn; #[macro_use] extern crate quote; use regex::Regex; use proc_macro::TokenStream; use syn::Body; use syn::Ident; use quote::Tokens; enum UavcanType { PrimitiveType, DynamicArray, StaticArray, Struct, } #[proc_mac...
use super::super::common; use crate::{ block::{self, chat::item::Icon, BlockId}, Resource, }; use kagura::prelude::*; pub fn render<'a>( block_field: &block::Field, characters: impl Iterator<Item = &'a BlockId>, resource: &Resource, client_id: &String, ) -> Html { Html::div( Attribu...
#[doc = "Register `ESUR` reader"] pub type R = crate::R<ESUR_SPEC>; #[doc = "Register `ESUR` writer"] pub type W = crate::W<ESUR_SPEC>; #[doc = "Field `FSU` reader - Frame start delimiter unmask This byte specifies the mask to be applied to the code of the frame start delimiter."] pub type FSU_R = crate::FieldReader; #...
#![no_std] #![deny(missing_docs)] //! Utilities for working with I/O streams. extern crate alloc; extern crate bare_io; extern crate byteorder; extern crate uninitialized; extern crate resize_slice; /// An extension for `Read`ing an exact amount of data. pub mod read_exact; mod seek_forward; mod buf_seeker; mod re...
mod dead_code; mod crates; mod cfg; mod custom; #[cfg(test)] mod tests { fn used_function() {} #[allow(dead_code)] fn unused_function() {} fn noisy_unused_function() {} #[test] fn it_works() { used_function(); } }
mod event; pub use event::*; mod mainloop; pub use mainloop::*; mod utils; pub use utils::*;
// Copyright 2013 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 ...
#![doc = include_str!("../README.md")] mod builder; mod codegen; mod grpc_server; mod invocations; mod tonic_ext; pub use builder::{MockBuilder, Mountable, Then}; pub use grpc_server::GrpcServer; pub extern crate http_body; pub extern crate tonic;
mod support; use cubik::server::ServerContainer; use support::msg::AppMessage; use std::time::{Instant, Duration}; use std::thread::sleep; const PORT: u16 = 27020; fn main() { let mut server_container: ServerContainer<AppMessage> = ServerContainer::new(PORT, 10).unwrap(); println!("server listening on port {}", P...
use std::pin::Pin; use std::task::{Context, Poll}; use anyhow::Result; use tower::{Layer, Service}; use tracing::instrument; use super::*; // Layer for Log pub struct LogLayer { remote_service_label: &'static str, } impl LogLayer { pub fn new(remote_service_label: &'static str) -> Self { Self { ...
#![recursion_limit="100"] use std::env; use std::process::exit; extern crate sha2; extern crate blake2; extern crate typenum; extern crate libc; extern crate nix; extern crate rand; extern crate env_logger; extern crate argparse; extern crate quire; extern crate signal; extern crate regex; extern crate scan_dir; exte...
use std::collections::HashMap; const INPUT: &str = include_str!("../input.txt"); const EGGNOG: usize = 150; fn format_input(input: &str) -> Vec<usize> { let mut containers: Vec<usize> = Vec::new(); for line in input.trim().lines() { containers.push(line.parse::<usize>().unwrap()); } containers...
// // Copyright (C) 2020 Abstract Horizon // All rights reserved. This program and the accompanying materials // are made available under the terms of the Apache License v2.0 // which accompanies this distribution, and is available at // https://www.apache.org/licenses/LICENSE-2.0 // // Contributors: // Daniel Send...
#[allow(unused_imports)] use super::util::prelude::*; use super::util::{Pack, PackDepth}; use super::BlockMut; use super::Boxblock; use super::Craftboard; use super::Textboard; block! { [pub Table(constructor, pack)] name: String = String::new(); boxblocks: Vec<BlockMut<Boxblock>> = vec![]; craftboards...
// This file is part of lock-free-multi-producer-single-consumer-ring-buffer. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/lock-free-multi-producer-single-consumer-ring-buffer/master/COPYRIGHT. No part o...
// Controllers for posts pub mod read_post; // pub mod create_post; pub mod show_posts; // pub mod edit_post; // pub mod delete_post;
#![feature(use_extern_macros)] extern crate blake2; // extern crate crypto_mac; extern crate ed25519_dalek; extern crate rand; extern crate time; // pub mod block; pub mod crypto; pub mod hash; pub mod merkleroot; // pub mod transaction;
use crate::vector::Vector3; use sfml::graphics::Color; pub struct Light { pub dir: Vector3, // pub color: Color, // pub intensity: f32, } impl Light { pub fn new(x: f32, y: f32, z: f32) -> Light { Light { dir : Vector3::new(x,y,z).normalize() } } }
#[cfg(test)] mod test; use std::convert::TryInto; use serde::Deserialize; use super::{OperationWithDefaults, Retryability, SingleCursorResult}; use crate::{ cmap::{Command, RawCommandResponse, StreamDescription}, error::{Error, ErrorKind, Result}, operation::aggregate::Aggregate, options::{AggregateO...
use { crate::Result, std::{ env, ffi::OsString, io, iter, os::windows::ffi::{OsStrExt, OsStringExt}, path::PathBuf, slice, }, winapi_local::{shared::minwindef::MAX_PATH, um::fileapi::GetLongPathNameW}, }; pub fn get_temp_dir() -> Result<PathBuf> { let...
//! URL based routing. //! //! Get the URL with [`url()`], and set it however you want to. For example: //! - with an anchor element like `<a href="/some/link">Some link</a>` //! - with [`set_url_path`]. //! //! # Example //! //! ```no_run //! # use silkenweb::{ //! # elements::{button, div, p}, //! # mount, ro...
extern crate libc; extern crate elementary_sys as elm; use std::cmp; use std::ptr; //use libc::{c_void, c_int, c_char, c_ulong, c_long, c_uint, c_uchar, size_t}; use libc::{c_void, c_int, size_t, c_char}; use std::mem; use std::path::{Path, PathBuf}; use std::fs; use std::ffi::{CString, CStr}; use std::str; use std::...
use futures::channel::mpsc; use async_std::{io, task}; use super::io::Writer; use super::scheduler::Scheduler; #[derive(Default)] pub struct Server{} impl Server { pub async fn start(&self) -> Option<()> { let (send, recv) = mpsc::unbounded(); let output = task::spawn(async { let writer = Writer::new(io::...
use crate::{ fun::Fun, property::Property, local::Local }; pub enum Symbol<'a>{ Property(&'a Property), Fun(&'a Fun), Local(&'a Local) }
use log::LevelFilter; use simplelog::{CombinedLogger, TermLogger, Config, TerminalMode, ColorChoice, WriteLogger}; use sync_file::{ReadAt, SyncFile}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpListener; use std::error::Error; use std::fs::File; use std::io::{BufReader, Bytes, Read}; use std::str:...
mod alu; mod arm_instructions; mod memory; mod registers; mod thumb_instructions; pub use memory::{AccessType, Memory, Waitstates}; pub use registers::CpuMode; pub use registers::Registers; use util::bits::Bits as _; /// Function that executes and ARM instruction and returns the number of cycles /// that were requir...
pub const FLAGS_WIDTH_SMALL: f32 = 20.0; pub const FLAGS_WIDTH_BIG: f32 = 37.5; pub const AD: &[u8] = include_bytes!("../../resources/countries_flags/4x3/ad.svg"); pub const AE: &[u8] = include_bytes!("../../resources/countries_flags/4x3/ae.svg"); pub const AF: &[u8] = include_bytes!("../../resources/countries_flags/4...
use std::collections::BTreeMap; use std::sync::Arc; use flux::ast::{Expression, PropertyKey}; use flux::semantic::nodes::CallExpr; use flux::semantic::nodes::Expression as SemanticExpression; use flux::semantic::types::{ BuiltinType, CollectionType, MonoType, Record, }; use flux::semantic::walk::Visitor as Semanti...
#[doc = "Reader of register MDMA_C0IFCR"] pub type R = crate::R<u32, super::MDMA_C0IFCR>; #[doc = "Writer for register MDMA_C0IFCR"] pub type W = crate::W<u32, super::MDMA_C0IFCR>; #[doc = "Register MDMA_C0IFCR `reset()`'s with value 0"] impl crate::ResetValue for super::MDMA_C0IFCR { type Type = u32; #[inline(...
extern crate messenger; extern crate messengerdep; use messenger::Messenger; fn main() { println!("Hello from transitive"); Messenger::new("transitive").deliver(); messengerdep::handler(); }
//! Module for API context management. use hyper; use auth::{Authorization, AuthData}; extern crate slog; /// Request context, both as received in a server handler or as sent in a /// client request. When REST microservices are chained, the Context passes /// data from the server API to any further HTTP requests. #[d...
use std::collections::{HashMap, HashSet}; use std::collections::hash_map::Entry; use std::convert::TryFrom; use std::hash::Hash; use std::ops::AddAssign; use num::{Integer, NumCast, One, Zero}; use num::traits::FloatConst; use crate::core::{DatasetMetric, Function, SensitivityMetric, StabilityRelation, Transformation...
// Copyright 2019, 2020 Wingchain // // 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...
extern crate adafruit_gps; use std::env; use adafruit_gps::{Gps, GpsSentence}; use adafruit_gps::NmeaOutput; fn main() { // Args are baud_rate, port name. let args: Vec<String> = env::args().collect(); let baud_rate = args.get(1).unwrap(); let port = args.get(2).unwrap(); // Open the port that i...
use crate::prelude::*; use scopeguard::defer; pub use crate::backend::glutil::*; pub fn compile_shader_program( gl: &Gl, vs_code: &str, fs_code: &str, ) -> Result<glow::Program, String> { let vs = compile_shader(gl, glow::VERTEX_SHADER, vs_code)?; defer!(unsafe { gl.delete_shader(vs) }); let f...
extern crate httpmock; use httpmock::MockServer; use httpmock::Method::GET; use serde_json::json; use isahc::{prelude::*, Response,Request}; #[test] fn get_emp_test() { // Arrange let server = MockServer::start(); let mock = server.mock(|when, then| { when.method("GET") .path("/emp/2"...
extern crate midir; use std::thread::sleep; use std::time::Duration; use std::io::{stdin, stdout, Write}; use std::error::Error; use midir::MidiOutput; fn main() { match run() { Ok(_) => (), Err(err) => println!("Error: {}", err.description()) } } fn run() -> Result<(), Box<Error>> { let...
type Register = u32; type OP = u8; struct MMVM { pc: Register, sp: Register, a: Register, b: Register, memory: [u8; 2048] } impl MMVM { }
mod file_path; mod sudoku; use std::fs; use std::time::Instant; use sudoku::Board; use sudoku::SolveContext; fn main() { let now = Instant::now(); println!("Solving Sudoku..."); println!(); let sudoku_content = sudoku_content(); let mut callbacks = SolveContext { callback: board_callbac...
#[macro_use] extern crate nom; extern crate pancurses; pub mod blocks; pub mod application; use pancurses::*; use application::application::Application; fn main() { // Creates the main window and initiating ncurses let stdscr: Window = initscr(); // Launches the application let mut app: Application...
use crate::models::{Restaurant, NoIdRestaurant}; use crate::mapper::get_client; use crate::errors::*; use postgres::Row; pub fn find_all_pined_by(community_id: &i32) -> Result<Vec<Restaurant>, ErrCode> { get_client().query( "SELECT r.id, r.vendor, r.place_id, r.name, r.addr, r.lat, r.lng FROM pins LEFT JOI...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use std::error::Error; use std::fmt; use std::fmt::{Debug, Display, Formatter}; use std::str::FromStr; use std::sync::Arc; use http::{HeaderValue, Uri}; use aws_types::region::{Region, SigningRegion};...
mod cleartext_holder; mod enums; mod external_commands; mod password_store; use clap::{App, AppSettings, Arg}; use std::io::Write; use crate::cleartext_holder::CleartextHolderInterface; use crate::enums::RadomskoError; use crate::enums::ShowDestination; use crate::password_store::PasswordStoreInterface; const CLIPBO...
//! Main library for operating the shell #![feature(crate_visibility_modifier)] pub mod ast; pub mod env; pub mod line; pub mod parse; pub mod st; pub mod term; pub mod token;
use std::collections::{HashMap, HashSet}; use nom::{ bytes::complete::tag, character::complete::{char, digit1, space1}, combinator::map, multi::many1, sequence::tuple, IResult, }; const INPUT: &str = include_str!("../inputs/day_16_input"); #[derive(Debug, Clone, Copy, PartialEq, Eq)] struct C...
#[tokio::test] async fn test_tar_file() {} #[tokio::test] async fn test_zip_file() {}
#[macro_use] extern crate serde_json; #[macro_use] extern crate serde_derive; extern crate rmp_serde; extern crate byteorder; extern crate indy; #[macro_use] pub mod utils; use utils::constants::{DID_1}; use utils::setup::{Setup, SetupConfig}; use std::time::Duration; use std::sync::mpsc::channel; use indy::ErrorCode;...
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, http::header, web::{self, Json, Path}}; use base64; use chrono::{DateTime, Utc}; use failure::Error; use rand::{thread_rng, RngCore}; use serde::{Deserialize, Serialize}; use tokio_postgres::{self as postgres, NoTls}; use url::Url; use std::collect...
use crate::{ config::{Configuration, CONFIGURATION}, statistics::StatCommand, utils::{make_request, status_colorizer}, }; use console::{style, Emoji}; use reqwest::{Client, Url}; use serde_json::Value; use std::io::Write; use tokio::sync::mpsc::UnboundedSender; /// macro helper to abstract away repetitive ...
//! This module contains a list of primitives that implement a [`Object`] trait. //! They help to locate a necessary segment on a [`Table`]. //! //! [`Table`]: crate::Table mod cell; mod columns; mod frame; mod rows; mod segment; pub(crate) mod util; use std::{collections::HashSet, marker::PhantomData}; use self::se...
use sys; pub enum BroadphaseInterface { AxisSweep3, DbvtBroadphase, MultiSapBroadphase, SimpleBroadphase, } pub enum Broadphase { DbvtBroadphase(Box<sys::btDbvtBroadphase>), } impl Broadphase { pub fn new(interface_type: BroadphaseInterface) -> Self { match interface_type { ...
use std::net::UdpSocket; use std::fs::File; use std::net::IpAddr; use std::io::Cursor; use std::net::SocketAddr; pub const RRQ: u16 = 1; pub const WRQ: u16 = 2; pub const DATA: u16 = 3; pub const ACK: u16 = 3; pub const ERROR: u16 = 3; pub const OPCODE: usize = 2; pub const PAD: usize = 1; pub const BLOCK_SIZE: usize...
use crate::parse::slice_to_string; use std::fmt; use nom::{ IResult, combinator::map_res, bytes::complete::{take_until, tag} }; #[derive(Debug, PartialEq, Clone)] pub struct SdpSessionName(pub String); impl SdpSessionName { pub fn new<S: Into<String>>(s: S) -> SdpSessionName { SdpSessionNam...
use std::{thread, time, process}; const ONE_SEC: time::Duration = time::Duration::from_secs(1); fn clear_terminal() { process::Command::new("clear").status().expect("can't clear screen"); } fn display_time(x: i16) { let minutes: i16 = x / 60; let seconds: i16 = x % 60; println!("{:02}:{:02}", minute...
// Copyright 2018 PingCAP, Inc. // // 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 i...
#[allow(dead_code)] pub struct Profile { id: u32, user_id: u32, first_name: String, last_name: String, } impl Profile { // Constructor #[allow(dead_code)] pub fn new( id: u32, user_id: u32, first_name: &str, last_name: &str ) -> Profile { Pr...
#![feature(globs)] #![crate_name = "rusty-lisp"] use std::io; use std::rc::Rc; use cons_cell::{Pair, atom, eq, car, cdr, cons}; use parser::{tokenize, build_sexpr, is_balanced, make_atom}; mod cons_cell; mod parser; //read-eval-print fn main() { let mut t = tokenize("((nil nil) (t t))".to_string()); let std_...
fn main() { let mut a = vec![vec![1., 2.], vec![3., 4.]]; let mut b = vec![vec![0., 5.], vec![6., 7.]]; let mut a_ref = &mut a; let a_rref = &mut a_ref; let mut b_ref = &mut b; let b_rref = &mut b_ref; let ab = kronecker_product(a_rref, b_rref); println!("Kronecker product of\n...
#[macro_use] extern crate log; mod debug; mod emulator; mod gpu; mod mem; mod processor; mod util; pub use emulator::gameboy::{Emulator, Gameboy}; pub use mem::cartridge::Cartridge;
use super::{Context, Module, RootModuleConfig}; use crate::configs::status::StatusConfig; use crate::formatter::StringFormatter; /// Creates a module with the status of the last command /// /// Will display the status only if it is not 0 pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { let exit_cod...
// Generated by `scripts/generate.js` use utils::vk_traits::*; /// Wrapper for [VkDeviceDiagnosticsConfigFlagsNV](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDeviceDiagnosticsConfigFlagsNV.html). /// /// Use the macro `VkDeviceDiagnosticsConfigFlags!` as an alternative method to create a s...
mod classifier; mod data; mod fetch; mod helpers; mod parser; mod stats; pub use crate::data::*; pub use crate::fetch::*; pub use crate::stats::*;
// Copyright (c) 2018, Maarten de Vries <maarten@de-vri.es> // // 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 of conditions ...
fn main() { { let xx = 3; let yy = xx; println!("{} {}", xx, yy); } { let xx = 'a'; let yy = xx; println!("{} {}", xx, yy); } { let xx = true; let yy = xx; println!("{} {}", xx, yy); } { let xx = 4.4; let...
use crate::{ error::GenerationError, generation::type_string, // TODO: I wish we weren't comparing types by string, value::{GenericStruct, GenericValue}, }; pub fn valid_identifier(name: &str) -> bool { let good_start = name.starts_with(|c: char| c == '_' || (c.is_ascii() && c.is_alphabetic())); le...
fn main() { let x = 5; let raw = &x as *const i32; let mut y = 10; let raw_mut = &mut y as *mut i32; println!("{:#?}", raw_mut); println!("{:#?}", raw); }
//! A minimalist, safe and fast ECS. //! Composed of two libraries: //! * entity_component //! * world_dispatcher //! //! Planck ECS is a library that brings those two smaller parts together. //! It adds the `maintain` function to world, which takes care of cleaning up //! dead entities after running systems. pub use e...
extern crate failure; use self::failure::Error; use std::path::Path; use std::io::{Cursor, Read, Write, stderr}; const DEFAULT_IPHONE_SDK: &'static str = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"; const DEFAULT_MACOSX_SDK: &'static str = "/Applications/Xcode...
//! This example demonstrates using the [`Margin`] [`TableOption`] to buffer space //! around a [`Table`] display. //! //! * Note how the [`Margin::fill()`] function allows for overriding the default whitespace //! with any [`char`]. use tabled::{ settings::{Margin, Style}, Table, }; fn main() { let data ...
pub mod affine; pub mod caesar; pub mod database; pub mod dictionaries; pub mod simple_attacks; pub mod substitution; pub mod transposition; mod frequency; pub mod vigenere;
//! Sets up CLEO when the library is loaded. #![feature(panic_info_message)] use ctor::ctor; use objc::runtime::Object; use objc::runtime::Sel; use std::os::raw::c_char; mod cheats; mod check; mod controller; mod extras; mod gui; mod hook; mod loader; mod logging; mod menu; mod resources; mod scripts; mod settings; ...
#![feature(plugin, custom_derive, use_extern_macros, decl_macro)] #![plugin(rocket_codegen)] #[macro_use] extern crate lazy_static; extern crate rocket; extern crate ryba_kit; #[macro_use] extern crate ryba_kit_derive; extern crate serde; #[macro_use] extern crate serde_derive; mod context; mod pages; mod users; use...
use gembiler::code_generator::{intermediate, translator}; use std::env; use std::fs::File; use std::io::{Write as _}; use std::fmt::{self, Write as _, Display, Formatter, Debug}; use std::path::Path; use virtual_machine::instruction::InstructionListPrinter; use gembiler::verifier; fn compile<P1: AsRef<Path>, P2: AsRef...
#[doc = "Register `DDRPHYC_ZQ0SR0` reader"] pub type R = crate::R<DDRPHYC_ZQ0SR0_SPEC>; #[doc = "Field `ZCTRL` reader - ZCTRL"] pub type ZCTRL_R = crate::FieldReader<u32>; #[doc = "Field `ZERR` reader - ZERR"] pub type ZERR_R = crate::BitReader; #[doc = "Field `ZDONE` reader - ZDONE"] pub type ZDONE_R = crate::BitReade...
use serde::{Deserialize, Serialize}; use std::cmp::Ordering; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] pub struct Id { pub digit: u64, pub site: i64, } impl Id { pub fn new(digit: u64, site_id: i64) -> Self { Id { digit, site: site_id, } } }...
use std::fmt::{Display, Formatter}; #[derive(Debug, Clone, Eq, PartialEq)] pub struct Comment { value: String, } impl Display for Comment { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { writeln!(f, "#{}", self.value) } } impl Comment { pub fn from_line(line: &String) -> Option<Se...
extern crate typed_arena; use middle::*; use self::typed_arena::Arena as TypedArena; macro_rules! make_arena { ($($name: ident: $ty: ident),+) => { pub struct Arena<'a, 'ast: 'a> { $($name: TypedArena<$ty<'a, 'ast>>,)+ } pub trait Alloc<'a, 'ast> { fn alloc(self, ar...
/* * 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 */ /// CanceledDowntimesIds : Object containing array of IDs of canceled downtimes. #[derive(Clone, Debu...
pub mod ast; pub mod errors; pub mod parser; use pest::Parser; use pest::prelude::StringInput; use self::errors::*; use std::fs::File; use std::io::BufReader; use std::io::Read; use std::path::Path; static NL: u8 = '\n' as u8; static CR: u8 = '\r' as u8; pub fn find_line(path: &Path, pos: (usize, usize)) -> Result<(...
mod cluster_time; mod pool; #[cfg(test)] mod test; use std::{ collections::HashSet, sync::Arc, time::{Duration, Instant}, }; use lazy_static::lazy_static; use uuid::Uuid; use crate::{ bson::{doc, spec::BinarySubtype, Binary, Bson, Document, Timestamp}, cmap::conn::PinnedConnectionHandle, erro...
//! This is the wasm web-gui. //! This file is only compiled for the wasm32 target. #![cfg(target_arch = "wasm32")] #![recursion_limit = "512"] use ascii_hangman_backend::game::State; use ascii_hangman_backend::Backend; use ascii_hangman_backend::HangmanBackend; use ascii_hangman_backend::{AUTHOR, CONF_TEMPLATE, CONF...
use rand::prelude::*; use rand::rngs::SmallRng; use rtlib::util::random_double; use rtlib::vec::{vec3, Vec3}; const N: u64 = 1000000; const SEED: u64 = 0; fn random_cosine_direction(rng: &mut SmallRng) -> Vec3 { let r1 = random_double(rng); let r2 = random_double(rng); let phi = 2.0 * std::f64::consts::PI...
#[macro_use] extern crate anyhow; mod cmd; mod container; mod deps; mod docker; mod fmt; mod image; mod job; mod opts; mod os; mod recipe; mod util; use crate::docker::DockerConnectionPool; use crate::image::{Images, ImagesState}; use crate::job::{BuildCtx, JobCtx, JobResult}; use crate::opts::Opts; use crate::recipe...
use mpd::{Client, Song}; use serenity::{ framework::standard::{macros::command, CommandResult}, http::AttachmentType, model::channel::Message, prelude::*, }; use std::path::Path; #[command] #[description = "Bot will reply with pretty embed containing current music info and cover art of what Phate is li...
use crate::common::*; #[derive(Debug)] pub(crate) struct Set<'src> { pub(crate) name: Name<'src>, pub(crate) value: Setting<'src>, } impl<'src> Keyed<'src> for Set<'src> { fn key(&self) -> &'src str { self.name.lexeme() } }
use std::error::Error; use std::collections::HashMap; use nom::{IResult, number::complete::{be_u8, le_u8, be_i32, le_u32}, }; use tuple::{TupleElements}; use pathfinder_geometry::transform2d::Transform2F; use itertools::Itertools; use indexmap::IndexMap; use crate::{Font, BorrowedFont, Glyph, State, v, R, IResultEx...
pub mod request; pub mod response; mod worker_pool; use std::net::TcpListener; use request::Request; use response::*; use worker_pool::WorkerPool; pub fn start_server(host: String, port: String, handle_connection: fn(Request, Response)) { let address = format!("{}:{}", host, port); let listener = match TcpLi...
use super::Animator; pub struct WaitingAnimator { frames_left: u32, } impl WaitingAnimator { pub fn new(frames: u32) -> Self { Self { frames_left: frames, } } } impl Animator for WaitingAnimator { fn update(&mut self) { self.frames_left = self.frames_left.saturatin...
use diesel::prelude::*; use juniper::{FieldResult}; use crate::domain::model::identity::user::User; use crate::infrastructure::postgres::schema::users::dsl::*; use crate::QueryContext; use uuid::Uuid; pub struct QueryRoot; #[juniper::object(Context = QueryContext)] impl QueryRoot { fn users(context: &QueryContext)...
use assert_cmd::Command; use std::path::PathBuf; fn test_aa_location() -> PathBuf { [env!("CARGO_MANIFEST_DIR"), "..", "shopsite-aa", "tests", "test.aa"].iter().collect() } fn get_cmd() -> Command { Command::cargo_bin("shopsite-aa2json").unwrap() } fn run_test(cmd: &mut Command, expected_output: &str) { let resul...