text
stringlengths
8
4.13M
use shorthand::ShortHand; #[derive(ShortHand)] struct Example { #[shorthand(enable(forward))] // valid value_0: String, #[shorthand(enable(forward(doc)))] // valid value_1: String, #[shorthand(disable(forward(doc)))] // valid value_2: String, #[shorthand(enable(forward("")))] // invalid ...
extern crate spatialos_sdk_sys; pub(crate) mod ptr; pub mod worker;
use std::collections::HashSet; fn divide(mut n: i64) -> Vec<i64> { let mut d = vec![]; while n > 0 { d.push(n % 10); n /= 10; } return d; } fn main() { let mut n = 1; loop { let x: HashSet<Vec<i64>> = (1..=6).map(|p| n * p) .map(|x| divide(x)) ....
use std::ops::Bound; use chrono::{DateTime, Utc}; use sqlx::postgres::{types::PgRange, PgConnection}; use svc_agent::AgentId; use uuid::Uuid; use serde_derive::{Deserialize, Serialize}; //////////////////////////////////////////////////////////////////////////////// #[allow(dead_code)] #[derive(Clone, Debug)] pub s...
//! This example demonstrates using the [`Merge`] [`TableOption`] to clarify //! redundancies in a [`Table`] display. //! //! * Note how a custom theme is applied to give the [`Merged`](Merge) cells //! a unique look. //! //! * Merge supports both [`Merge::vertical()`] and [`Merge::horizontal()`]. use tabled::{ se...
use super::model::*; /// SendTransferOptions /// /// * `threads` - Optionally specify the number of threads to use for PoW. This is ignored if `local_pow` is false. /// * `inputs` - Optionally specify which inputs to use when trying to find funds for transfers /// * `reference` - Optionally specify where to start sear...
// This file is part of Bit.Country // Copyright (C) 2020-2021 Bit.Country. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Fou...
pub struct Triangle { x: u64, y: u64, z: u64, } impl Triangle { pub fn build(sides: [u64; 3]) -> Option<Triangle> { match (sides[0], sides[1], sides[2]) { (0, _, _) => None, (_, 0_, _) => None, (_, _, 0) => None, (x, y, z) if x + y >= z && y + z >...
use actix_web::{ HttpResponse, web, }; use super::super::{ service, response, request, }; pub fn index(payload: web::Query<request::job::Index>) -> HttpResponse { let domain_jobs = &service::job::index( payload.page, payload.page_size, ); response::job_index::response(do...
use serde::{Deserialize, Serialize}; use serde_yaml::from_str; use std::fmt::{self, Display, Formatter}; #[derive(Serialize, Deserialize, Clone, Debug)] pub struct Template { pub image: String, pub name: String, pub description: String, pub public: bool, pub runtime: Option<RuntimeConfiguration>, }...
use std::path::Path; use std::fs::File; use std::io::Read; use yaml_rust::{Yaml, YamlLoader}; use cocaine::service::tvm::Grant; pub const GATHER_INTERVAL_SECS: u64 = 60; #[derive(Debug)] pub struct Config { pub gather_interval: u64, pub ticket_expire_sec: Option<i64>, pub secure: Option<Secure>, } #...
use crate::headers::from_headers::*; use crate::prelude::*; use crate::resources::Database; use crate::ResourceQuota; use azure_core::headers::{continuation_token_from_headers_optional, session_token_from_headers}; use azure_core::{collect_pinned_stream, prelude::*, Request, Response}; use chrono::{DateTime, Utc}; #[...
use std::ffi::CStr; use ash::version::DeviceV1_0; use ash::vk; use crate::vulkan::descriptor::DescriptorSetLayout; use crate::vulkan::pipeline_layout::PipelineLayout; use crate::vulkan::shader_module::ShaderModule; use crate::vulkan::{Device, VkError}; pub struct ComputePipeline { set_layouts: Vec<DescriptorSetL...
use std::fmt; #[derive(Debug, PartialEq, Clone)] pub enum AST { File(Vec<AST>), Error, Expr(Expression), Import(String), Record(String, Option<Vec<String>>, Vec<PrimitiveType>), Typedef { name: String, type_names: Option<Vec<String>>, variants: Option<Vec<TypeKind>>, ...
use super::{ConnectionError, Request, Subscribe, Subscription}; use crate::rpc::{Rpc, RpcResponse, SubscriptionRequest}; use serde::de::DeserializeOwned; pub struct Connection<T: Request> { pub(super) transport: T, // subscription uses this field id_pool: std::collections::VecDeque<usize>, } impl<T> Connecti...
use SafeWrapper; use ir::{User, Instruction, Value, TerminatorInst, Block}; use sys; /// An indirect branch. pub struct IndirectBrInst<'ctx>(TerminatorInst<'ctx>); impl<'ctx> IndirectBrInst<'ctx> { /// Creates a new indirect branch. pub fn new(address: &Value, destinations: &[&Block]) -> Self {...
// General //pub mod bigint; pub mod aggregate; pub mod carbon; pub mod config; pub mod consul; pub mod errors; pub mod management; pub mod peer; pub mod raft; pub mod server; pub mod stats; pub mod task; pub mod udp; pub mod util; use std::collections::HashMap; use std::io; use std::str::FromStr; use std::sync::atomi...
#[doc = "Register `PCROP2ASR` reader"] pub type R = crate::R<PCROP2ASR_SPEC>; #[doc = "Register `PCROP2ASR` writer"] pub type W = crate::W<PCROP2ASR_SPEC>; #[doc = "Field `PCROP2A_STRT` reader - PCROP2A area start offset, bank2"] pub type PCROP2A_STRT_R = crate::FieldReader<u16>; #[doc = "Field `PCROP2A_STRT` writer - ...
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the F...
use super::regex::Regex; use super::*; fn annotate_words(line: &str) -> Vec<(usize, &str)> { line.split(" ") .scan(0, |acc, word| { let res = Some((*acc, word)); *acc = *acc + word.len() + 1; res }) .filter(|(_, word)| !word.is_empty()) .collect::...
use crate::helpers; use crate::prelude::*; use crate::runtime; use crate::types::TransferFileMeta; use std::path::PathBuf; use std::sync::Arc; use tokio::fs::File; use tokio::net::TcpStream; pub fn send_file(mut cx: FunctionContext) -> JsResult<JsUndefined> { let config = cx.argument::<JsObject>(0)?; let ref_...
mod alpha2; pub use alpha2::Alpha2; mod alpha3; pub use alpha3::Alpha3; mod alpha3b; pub use alpha3b::Alpha3b; #[cfg(feature = "language-info")] mod info; #[cfg(feature = "language-info")] pub use info::Info;
#![allow(clippy::absurd_extreme_comparisons)] extern crate oxygengine_procedural as procedural; mod data_aggregator; use data_aggregator::*; use minifb::{Key, KeyRepeat, MouseMode, Scale, Window, WindowOptions}; use procedural::prelude::*; use std::f64::consts::PI; const SIZE: usize = 100; const ALTITUDE_LIMIT: Sca...
mod image; mod ppm; pub use self::image::*; pub use self::ppm::*;
pub mod application; pub mod benchmark_command_listener; pub mod benchmarker; pub mod build_container; pub mod build_image; pub mod build_network; pub mod simple; pub mod verifier;
// rust-hwid // (c) 2020 tilda, under MIT license //! Get a "Hardware ID" for the host machine. This is a UUID //! which is intended to uniquely represent this entity. use thiserror::Error; /// Possible failure cases for [get_id()]. #[derive(Debug, Error)] pub enum HwIdError { /// Could not detect a hardware id....
extern crate tungstenite; extern crate url; extern crate native_tls; mod connection_error; mod connection; mod connection_wss; use crate::connection::{ConnectionEvent, Connection}; use crate::connection_wss::ConnectionWss; fn main() { let mut con = ConnectionWss::with_std_tcp_stream(); con.connect("wss://127...
use ::*; pub fn run_script(script: &str) { let script = CString::new(script).unwrap(); unsafe { emscripten_run_script(script.as_ptr()); } } pub fn run_script_i32(script: &str) -> i32 { let script = CString::new(script).unwrap(); unsafe { emscripten_run_script_int(script.as_ptr()) as i32 } ...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorDetails { #[serde(default, skip_serializing_if = "Option::is_none")] pub code: Option<String>, #[s...
extern crate tempdir; use tempdir::TempDir; fn main() { TempDir::new("control").unwrap(); }
#[doc = "Register `MPCBB2_VCTR18` reader"] pub type R = crate::R<MPCBB2_VCTR18_SPEC>; #[doc = "Register `MPCBB2_VCTR18` writer"] pub type W = crate::W<MPCBB2_VCTR18_SPEC>; #[doc = "Field `B576` reader - B576"] pub type B576_R = crate::BitReader; #[doc = "Field `B576` writer - B576"] pub type B576_W<'a, REG, const O: u8...
use super::atom::common::Common; use super::atom::{ btn::{self, Btn}, text::Text, }; use super::molecule::modal::{self, Modal}; use super::organism::modal_resource::{self, ModalResource}; use crate::arena::{ block, resource::{self, LoadFrom}, ArenaMut, BlockKind, BlockMut, BlockRef, }; use crate::li...
use std::collections::HashSet; use std::env; fn knot_hash(lengths: &Vec<u8>) -> Vec<u8> { let mut list: Vec<u8> = (0..=255).collect(); let len = list.len(); let mut pos = 0usize; let mut skip_size = 0; for _i in 0..64 { for &length in lengths { let length = length as usize; ...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ErrorBase { #[serde(default, skip_serializing_if = "Option::is_none")] pub code: Option<String>, #[serd...
use crate::Value; extern "C" { pub fn caml_main(argv: *const *const i8); pub fn caml_startup(argv: *const *const i8); pub fn caml_shutdown(); pub fn caml_named_value(name: *const i8) -> *const Value; }
use std::borrow::Cow; use std::fs; use std::io; use std::path::{Path, PathBuf}; use typed_builder::TypedBuilder; #[non_exhaustive] #[derive(Debug, Clone, TypedBuilder)] pub struct Request<'a> { pub repo_path: Cow<'a, Path>, } #[non_exhaustive] #[derive(Debug, Clone, Default, TypedBuilder)] pub struct PartialRequ...
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![no_std] #![cfg_attr(feature = "stdbuild", feature(libc))] extern crate libc; include!("bindings.rs");
//! Memory map for STM32F30X microcontrollers #![deny(missing_docs)] #![deny(warnings)] #![no_std] extern crate volatile_register; #[allow(missing_docs)] pub mod btim; #[allow(missing_docs)] pub mod dbgmcu; #[allow(missing_docs)] pub mod gpio; #[allow(missing_docs)] pub mod gptim; #[allow(missing_docs)] pub mod i2c;...
fn main() { tonic_build::configure() .compile( &[ "proto/api/agents.proto", "proto/api/login.proto", "proto/api/routers.proto", "proto/api/tunnels.proto", "proto/api/users.proto", "proto/api/permissio...
use std::mem; use crate::*; pub fn place_clues <'a> ( line: & 'a Line, clues: & 'a [LineSize], ) -> CluesPlacerIter <'a> { CluesPlacer::new (line, clues).into_iter () } #[ derive (Default) ] pub struct CluesPlacer <'a> { cache: Cache, stack: Vec <Frame <'a>>, line: & 'a Line, clues: & 'a [LineSize], starte...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod billing_accounts { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub a...
use crate::protos::cao_commands::TakeRoomCommand; use anyhow::Context; use caolo_sim::prelude::*; use thiserror::Error; use tracing::{info, trace}; use uuid::Uuid; #[derive(Debug, Error)] pub enum TakeRoomError { #[error("Target room already has an owner")] Owned, #[error("Maximum number of rooms ({0}) own...
//! Utilities for *entities* in ECS. use slotmap::{new_key_type, SlotMap}; new_key_type! { /// Unique identifier of the *entity* of ECS. pub struct Entity; } /// Storage for all entities of ECS. pub type EntityStorage = SlotMap<Entity, ()>;
use clap::{App, Arg, ArgMatches, SubCommand}; pub(crate) fn get_matches<'a>() -> ArgMatches<'a> { App::new(rustimate_core::APPNAME) .version("0.0.20") .author(clap::crate_authors!()) .about("Starts the HTTP server and (optionally) opens a webview") .arg( Arg::with_name("config") .short(...
pub mod buffer; pub mod data; pub mod linalg; pub mod shader;
#![no_std] #![feature(test)] #[macro_use] extern crate digest; extern crate sha2ni; bench!(sha2ni::Sha256);
fn main(){ let k = String::from("Hi"); let b = String::from("!"); let z = k + &b; println!("{}", z); }
// Copyright 2019 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 { anyhow::{anyhow, Context as _, Error}, fidl_fuchsia_update::{ CheckOptions, CommitStatusProviderMarker, CommitStatusProviderProxy, In...
use std::collections::HashMap; use std::env; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::io::BufRead; //TODO: Clean strings from some chars //TODO: Stems words! //TODO: Refactor code //TODO: Data Augmentation //TODO: Add different data sets //TODO: Add documentation //TODO: Add mea...
//! Example domains for Canrun collections use crate::lmap::LMap; use crate::lvec::LVec; canrun::domain! { pub Collections { i32, LMap<i32, i32>, LVec<i32> } }
use crate::{ config::CategoryIcon, models::{Category, CategoryKind}, tools::slugify, }; use chrono::{DateTime, FixedOffset}; use hashbrown::HashMap; use lazy_static::*; use regex::{Captures, NoExpand, Regex}; lazy_static! { static ref TRAILING_SPACE: Regex = Regex::new(r"[\r\n\s]*$").unwrap(); stat...
use diesel::types::*; use chrono::NaiveDateTime; #[derive(QueryableByName,Serialize)] pub(crate) struct TypedSalary { #[sql_type = "Text"] pub type_: String, #[sql_type = "Int8"] pub avg_salary: i64, } #[derive(QueryableByName,Serialize)] pub(crate) struct AvgSalary{ #[sql_type = "Int...
//! Anti Grain Geometry - Rust implementation //! //! Originally derived from version 2.4 of [AGG](http://antigrain.com) //! //! This crate implments the drawing / painting 2D algorithms developed in the Anti Grain Geometry C++ library. Quoting from the author in the documentation: //! //! > **Anti-Grain Geometry** is ...
/*! ```rudra-poc [target] crate = "through" version = "0.1.0" [report] issue_url = "https://github.com/gretchenfrage/through/issues/1" issue_date = 2021-02-18 rustsec_url = "https://github.com/RustSec/advisory-db/pull/850" rustsec_id = "RUSTSEC-2021-0049" [[bugs]] analyzer = "UnsafeDataflow" bug_class = "PanicSafety"...
use from_file::FromFile; use presets::m2::module_meta_data::ModuleData; use presets::m2::requirejs_config::RequireJsClientConfig; #[derive(Serialize, Deserialize, Default)] pub struct SeedData { pub rjs_client_config: RequireJsClientConfig, pub req_log: Vec<ModuleData>, } impl FromFile for SeedData {}
use super::Sha256; #[cfg(target_arch = "x86")] use core::arch::x86::*; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; // Intel® Architecture Instruction Set Extensions ProgrammingReference // // CHAPTER 8 INTEL® SHA EXTENSIONS // https://software.intel.com/sites/default/files/managed/07/b7/319433-023.pdf ...
use serde::{Deserialize, Serialize}; use syn; #[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq)] pub struct Signature { pub name: String, } pub fn syn_sig_to_reduced(sig: &syn::Signature) -> Signature { Signature { name: format!("{}", sig.ident), } }
use crate::bundle_producer_election_solver::BundleProducerElectionSolver; use crate::domain_bundle_proposer::DomainBundleProposer; use crate::parent_chain::ParentChainInterface; use crate::utils::OperatorSlotInfo; use crate::BundleSender; use codec::Decode; use domain_runtime_primitives::DomainCoreApi; use sc_client_ap...
// Copyright 2018 Google 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 in...
use crate::components::wiring; use crate::components::NANDGate; pub struct XORGate { pub input1: wiring::Wire, pub input2: wiring::Wire, pub output: wiring::Wire, nand1_layer1: NANDGate, nand1_layer2: NANDGate, nand2_layer2: NANDGate, nand1_layer3: NANDGate, } impl Default for XORGate { ...
use core::{mem, ptr}; use winapi::ctypes::c_void; use error_code::SystemError; use crate::SysResult; const GHND: winapi::ctypes::c_uint = 0x42; const BYTES_LAYOUT: alloc::alloc::Layout = alloc::alloc::Layout::new::<u8>(); #[cold] #[inline(never)] pub fn unlikely_empty_size_result<T: Default>() -> T { Default::...
fn format_song() -> String { return String::new(); } fn main() { let gift_1 = "A partridge in a pear tree"; let gift_2 = "Two turtle doves"; let gift_3 = "Three French hens"; let gift_4 = "Four calling birds"; let gift_5 = "Five gold rings"; let gift_6 = "Six geese a laying"; let gift_7...
fn main() { let target = std::env::var("TARGET").unwrap(); if target.contains("-ios") { println!("cargo:rustc-link-lib=framework=UIKit"); println!("cargo:rustc-link-lib=framework=WebKit"); } }
use crate::{ components::player::{ActionType, PlayerType}, config, engines::{Engine, EngineData, EngineTransition}, utils, }; use amethyst::core::math::Vector2; use rand::{thread_rng, Rng}; use rand_distr::StandardNormal; pub struct Basic; impl Basic { pub fn new() -> Self { Basic } } ...
use std::fs::File; use std::io::Write; pub fn mov(des: &str, src: &str, f: &mut File) { write!(f, " ").expect("asm mov: Unable to write to the file."); write!(f, "mov {}, {}\n", des, src).expect("asm: Unable to write to the file."); } pub fn ret(f: &mut File) { write!(f, " ").expect("asm ret: stat_return...
#![allow(unused)] use std::{ error::Error, io::{self, BufRead, Read, Write}, }; fn main() -> Result<(), Box<dyn Error>> { let mut buffer = String::new(); let mut buff = Vec::new(); let mut stdin = io::stdin(); stdin.read_line(&mut buffer)?; io::stdin().lock().read_until(b'\n', &mut buff)?; ...
extern crate tch; use std::f64::consts::PI; use tch::{kind, Tensor}; use crate::{Distribution, TensorUtil}; fn _batch_mv(bmat: &Tensor, bvec: &Tensor) -> Tensor { bmat.matmul(&bvec.unsqueeze(-1)).squeeze1(-1) } fn _batch_mahalanobis(bl: &Tensor, bx: &Tensor) -> Tensor { let n = bx.size().last().unwrap().clone...
use std::fs::File; use std::io::Read; use std::path::Path; fn main() { let mut f = File::open(Path::new("input/day12.txt")).unwrap(); let mut s = String::new(); f.read_to_string(&mut s).ok(); let input = parse_input(&s.trim()); let (p1, p2) = solve(input); println!("Part 1: {}, Part 2: {}", p1,...
use bson::RawDocumentBuf; use crate::{ cmap::{conn::PinnedConnectionHandle, Command, RawCommandResponse, StreamDescription}, concern::WriteConcern, cursor::CursorSpecification, error::{Error, Result}, operation::{CursorBody, Operation, RunCommand}, options::RunCursorCommandOptions, selectio...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ use darling::FromMeta; use heck::CamelCase; use quote::format_ident; use syn::parse::Parse; use syn...
/* * 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 */ /// WidgetTimeWindows : Define a time window. /// Define a time window. #[derive(Clone, Copy, Debug, Eq...
use crate::address_bus::PpuAddressBus; use crate::cpu; #[macro_use] use derive_serialize::Serialize; use std::cell::Cell; mod bg_state; mod palette; mod sprite_state; #[cfg(test)] mod test; #[derive(Serialize, Debug)] pub struct Ppu { cycle_count: i32, current_scanline: i16, current_scanline_dot: u16, ...
use ruma_events_macros::event_content_enum; event_content_enum! { name: InvalidEvent, events: [ "m.not.a.path", ] } event_content_enum! { name: InvalidEvent, events: [ "not.a.path", ] } fn main() {}
pub mod config { use r2d2_sqlite::SqliteConnectionManager; pub struct MyConfig { pub server_address: String, pub server_port: u16, pub sqlite_manager: SqliteConnectionManager, } impl MyConfig { pub fn new() -> Self { let mut settings = config::Config::default(...
use std::{error::Error as Err, fmt}; #[derive(Debug)] pub enum Error { /// The private_key field in the [Service Account Key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) /// is invalid and cannot be parsed #[cfg(feature = "jwt")] InvalidKeyFormat, /// Unable to deseria...
/// An enum to represent all characters in the Tifinagh block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Tifinagh { /// \u{2d30}: 'ⴰ' LetterYa, /// \u{2d31}: 'ⴱ' LetterYab, /// \u{2d32}: 'ⴲ' LetterYabh, /// \u{2d33}: 'ⴳ' LetterYag, /// \u{2d34}: 'ⴴ' LetterYaghh...
pub mod config; pub mod environment; pub mod files;
use crate::import::*; use crate::process::registry::{ProcessRegistry, Register, Unregister}; use crate::node::NodeController; use crate::util::RpcMethod; use actix::dev::{ContextParts, Mailbox, ContextFut, AsyncContextParts, ToEnvelope, Envelope, RecipientRequest}; use actix::Handler; use std::pin::Pin; use crate::{M...
use actix_web::{post,web,HttpResponse,Responder}; use log::info; use serde::{Serialize,Deserialize}; use std::process::Command; #[derive(Debug,Deserialize, Serialize)] pub struct Request{ commands : String, } #[derive(Debug,Deserialize,Serialize)] pub struct Response{ result: bool, } #[post("/execute")] pub...
use napi::*; use crate::image::{Image, ImageData}; use crate::pattern::Pattern; use crate::sk::*; #[repr(u8)] enum ImageKind { ImageData, Image, } impl From<u32> for ImageKind { fn from(value: u32) -> Self { match value { 0 => Self::ImageData, 1 => Self::Image, _ => Self::Image, } }...
pub mod gridstore;
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Project { #[serde(default, skip_serializing_if = "Option::is_none")] pub id: Option<String>, #[serde(de...
use crate::{ input::{ mouse::{EditorMouseState, MouseKeys, ScrollDelta, ViewportPosition}, InputPreprocessorMessage, ModifierKeys, }, message_prelude::{Message, ToolMessage}, tool::ToolType, Editor, }; use graphene::color::Color; /// A set of utility functions to make the writing of editor test more declarati...
#[derive(Debug)] enum UsState{ Alabama, Alaska, Vermont, } enum Coin { Penny, Nickel, Dime, Quarter(UsState), } fn value_in_cents(coin: Coin) -> u32 { match coin{ Coin::Penny => { println!("Lucky penny"); 1 }, Coin::Nickel => 5, C...
pub mod delay; pub mod peak_level_detector;
// q0216_combination_sum_iii struct Solution; // impl Solution { // pub fn combination_sum3(k: i32, n: i32) -> Vec<Vec<i32>> { // if (1+k)*k / 2 > n { // return vec![]; // } // if k == 1 { // if n > 0 && n < 10 { // return vec![vec![n]]; // ...
mod lunch; //use lunch::menu; //use lunch::menu::dinner; use lunch::menu::{self,dinner}; fn main() { println!("We need Food"); lunch::menu::dinner(); menu::dinner(); dinner(); // idiomatic path } // Library // Github Account // Git install // Smart Git/ Git command (terminal) // firstwelcome clone //...
use diesel::prelude::*; use diesel::r2d2::{ConnectionManager, Pool}; use tonic::Status; use tracing::instrument; use crate::api::permission_request::IdOrName; use crate::api::PermissionData; use crate::schema::permissions; use crate::schema::permissions::dsl::*; use crate::storage::helpers::sql_err_to_grpc_error; #[d...
use serde_json::Value; use util::{JsonType, JsonValueExt}; use errors::{ErrorKind, ValidationError}; use schema::{Context, Schema, SchemaBase}; /// Schema for JSON arrays like `[1, 2, 3]`. #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] #[serde(deny_unknown_fields)] pub struct Array...
mod tokens; mod scanner; mod symbols; #[macro_use] extern crate derive_more; use std::env::args; use std::process::exit; use std::fs::File; use std::io::prelude::Read; use std::io; use std::io::BufRead; use scanner::Scanner; fn run(source: String) -> bool { let scanner = Scanner::new(source); let tokens = scann...
// Copyright 2018 Mohammad Rezaei. // // 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 distributed // except accordin...
use std::env; fn main() { println!("cargo:rustc-link-search=native=./clib"); println!("cargo:libdir=./clib"); }
use crate::{ widget, widget::{ unit::image::{ImageBoxAspectRatio, ImageBoxMaterial, ImageBoxNode, ImageBoxSizeValue}, utils::Transform, }, widget_component, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct ImageBoxProps { #[...
use super::in_game::InGameScreen; use super::screen::Screen; use crate::player::check_multiple_pressed; use quicksilver::geom::Rectangle; use quicksilver::geom::Transform; use quicksilver::graphics::Font; use quicksilver::graphics::FontStyle; use quicksilver::graphics::Image; use quicksilver::input::Key; use quicksilv...
#[macro_use] extern crate detour; extern crate winapi; use std::ptr::null_mut; use winapi::shared::{ minwindef::LPVOID, ntdef::LPCWSTR, windef::HWND, }; static_detour! { static MessageBoxWHook: unsafe extern "system" fn(HWND, LPCWSTR, LPCWSTR, u32) -> i32; } type MessageBoxW = unsafe extern "system" ...
//! Library of KCP on Tokio extern crate bytes; #[macro_use] extern crate futures; extern crate kcp; extern crate mio; #[macro_use] extern crate tokio_core; extern crate tokio_io; extern crate rand; extern crate time; #[macro_use] extern crate log; use time::Timespec; pub use self::config::{KcpConfig, KcpNoDelayConf...
// This is based on example 3, but adds in highlighting visible tiles. // // Comments that duplicate previous examples have been removed for brevity. ////////////////////////////////////////////////////////////// rltk::add_wasm_support!(); use rltk::prelude::*; extern crate rand; use crate::rand::Rng; #[derive(Parti...
use crate::cell::CellValue; use crate::{Board, Cell, ConstraintGroup, Puzzle}; use bitflags::bitflags; use bitvec::prelude::*; #[derive(Default)] struct Status { row_status: BitVec, column_status: BitVec, } bitflags! { #[derive(Default)] struct Options: u8 { const AUTO_CROSS_COMPLETED = 0b0001...
use crate::glyph::GlyphStore; pub struct Size { width: i32, height: i32 } impl Size { pub fn new(width: i32, height: i32) -> Self { Size { width, height, } } } pub struct Point { inline: i32, block: i32, } impl Point { pub fn new(inline: i32, block...
use super::tokens::Token; use super::errors::*; use super::common::ImmutableString; /// Converts text into a stream of tokens. pub struct Scanner { pos: usize, line_number: usize, token_start: usize, token_start_line: usize, chars: Vec<char>, // todo: use an iterator instead? current_token: Opt...