text
stringlengths
8
4.13M
use embed_resource; fn main() { embed_resource::compile("shasum-windows-manifest.rc"); }
fn palindromic(n: i32) -> bool { let s = n.to_string().into_bytes(); for i in 0..s.len()/2 { if s.get(i) != s.get(s.len() - i - 1) { return false; } } return true; } fn main() { let mut m = 0; for x in 100..999 { for y in x..999 { if palindromic(x*y) { if x*y > m { ...
//! Starknet utilises a custom Binary Merkle-Patricia Tree to store and organise its state. //! //! From an external perspective the tree is similar to a key-value store, where both key //! and value are [Felts](Felt). The difference is that each tree is immutable, //! and any mutations result in a new tree with a new ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub const DISPID_DOM_ATTRIBUTE: u32 = 117u32; pub const DISPID_DOM_ATTRIBUTE_GETNAME: u32 = 118u32; pub const DISPID_DOM_ATTRIBUTE_SPECIFIED: u32 = 119u32; pub ...
use data; use data::to_json; use http::server::{ResponseWriter, Request}; use http::method::{Get, Put, Delete, Post}; use http::status::{Status, NotFound, MethodNotAllowed}; pub fn dispatch_path(path: &~str, r: &Request, w: &mut ResponseWriter) { if path[0] != '/' as u8 { warn2!("Request to {} invalid", ...
extern crate paillier; #[cfg(not(feature="keygen"))] fn main() { println!("*** please run with 'keygen' feature ***") } #[cfg(feature="keygen")] fn main() { use paillier::*; use paillier::core::*; // generate a fresh keypair let keypair = Paillier::keypair(); // choose type of encryption ...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_add_layer_version_permission( input: &crate::input::AddLayerVersionPermissionInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_...
use crate::base::curve::{ secp256k1::J256k1 }; use crate::wallet::wallet::WalletType; #[derive(Debug, Clone)] pub struct Keypair { pub private_key: String, //hex string pub public_key: String, //hex string } impl Keypair { pub fn new(private_key: String, public_key: String) -> Self { Keypair ...
use async_trait::async_trait; use bytes::BytesMut; use std::io::Error as IoError; use tokio::fs::File; use tokio::io::AsyncReadExt; #[async_trait] pub trait LineReader { /// Read a single line and return it (terminator included) async fn read_line(&mut self) -> Result<String, IoError>; /// Read exactly `n...
#[doc = "Reader of register DBTP"] pub type R = crate::R<u32, super::DBTP>; #[doc = "Reader of field `DSJW`"] pub type DSJW_R = crate::R<u8, u8>; #[doc = "Reader of field `DTSEG2`"] pub type DTSEG2_R = crate::R<u8, u8>; #[doc = "Reader of field `DTSEG1`"] pub type DTSEG1_R = crate::R<u8, u8>; #[doc = "Reader of field `...
use juniper::{graphql_scalar, Value}; struct Scalar; #[graphql_scalar(to_output_with = Scalar::to_output)] type CustomScalar = Scalar; impl Scalar { fn to_output(&self) -> Value { Value::scalar(0) } } fn main() {}
use std::fs; use std::collections::HashSet; // use std::collections::BTreeMap; struct Tile<'a> { number: usize, map: Vec<Vec<char>>, variant: HashSet<Vec<Vec<char>>>, right: Option<&'a Tile<'a>>, left: Option<&'a Tile<'a>>, top: Option<&'a Tile<'a>>, bottom: Option<&'a Tile<'a>>, } impl<'a...
use super::CacheBackend; /// Generic test set for [`Backend`]. /// /// The backend must NOT perform any pruning/deletions during the tests (even though backends are allowed to do that in /// general). pub fn test_generic<B, F>(constructor: F) where B: CacheBackend<K = u8, V = String>, F: Fn() -> B, { test_...
// Copyright 2021 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 ...
// Copyright 2022 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 ...
use crate::wasapi::Error; use std::marker; use std::ops; use std::slice; use windows_sys::Windows::Win32::CoreAudio as core; /// A typed mutable data buffer. pub struct BufferMut<'a, T> { pub(super) tag: ste::Tag, pub(super) render_client: &'a mut core::IAudioRenderClient, pub(super) data: *mut T, pub(...
/* * SNES to CD-i Controller Adapter * * Use any old SNES controller as a joypad on your CD-i console using just an STM32F103 "blue pill" * development board. * * This could stand to be updated to reflect newer Rust practices, having been written in 2018 * before stabilization of async, and before a whole lot of...
#[cfg(test)] pub mod tests { use crate::attribute::Attribute; use crate::handler::{Handler, HandlerResult}; use crate::meta_information; use crate::meta_information::MetaInformation; use std::fs::File; use std::io::Read; /// Implementation of Handler that collects the attributes and data f...
use std::fmt::{Display, Formatter}; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; use crate::number_traits::{Float, Zero}; pub type Vector3f = Vector3<f32>; pub type Vector4f = Vector4<f32>; macro_rules! struct_vec { ($name:ident : $display_fmt:literal, ($($dim:ident : $TY:...
use proptest::prop_assert_eq; use proptest::test_runner::{Config, TestRunner}; use crate::erlang::is_function_1::result; use crate::test::strategy; use crate::test::with_process_arc; #[test] fn without_function_returns_false() { run!( |arc_process| strategy::term::is_not_function(arc_process.clone()), ...
use crate::{Payer, PrimaryTableIndexExt, TableCursor, TableIndex}; use eosio::{ AccountName, PrimaryTableIndex, ReadError, ScopeName, Table, WriteError, }; /// TODO docs pub struct SingletonIndex<T: Table>(PrimaryTableIndex<T>); impl<T: Table> SingletonIndex<T> { /// TODO docs #[inline] pub fn new<C, ...
// 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. //! Implements a slab-like data structure that uses a salted index #![deny(missing_docs)] use rand::Rng; use std::collections::BinaryHeap; use std::fmt; ...
use anyhow::Result; pub mod factory; #[cfg(any(feature = "plantuml-ssl-server", feature = "plantuml-server"))] pub mod server; pub mod shell; pub trait Backend { /// Render a PlantUML string to file and return the diagram URL path to this /// file (as a String) for use in a link. /// # Arguments /// *...
#![feature(optin_builtin_traits)] extern crate xpsupport_sys; use std::sync::Arc; use std::error; use std::fmt; use std::mem; use std::cell::UnsafeCell; use std::time::{Duration, Instant}; use std::marker::PhantomData; // extern crate parking_lot; pub use self::select::{Select, Handle}; use self::select::StartResu...
//! Initialize working directories and assert on how they've changed #[cfg(feature = "path")] use crate::data::{NormalizeMatches, NormalizeNewlines, NormalizePaths}; /// Working directory for tests #[derive(Debug)] pub struct PathFixture(PathFixtureInner); #[derive(Debug)] enum PathFixtureInner { None, Immuta...
fn main() { fn plus(x: i32) -> i32 { x + 2 } println!("{}", plus(1)); println!("{}", times(2)); } fn times(x: i32) -> i32 { x * 3 }
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - PWM Master Control"] pub ctl: CTL, #[doc = "0x04 - PWM Time Base Sync"] pub sync: SYNC, #[doc = "0x08 - PWM Output Enable"] pub enable: ENABLE, #[doc = "0x0c - PWM Output Inversion"] pub invert: INVERT, ...
pub fn add_to_waitlist() { println!("add"); }
// SPDX-License-Identifier: (MIT OR Apache-2.0) use time::OffsetDateTime; use super::both_endian::{both_endian16, both_endian32}; use super::date_time::date_time; use crate::Result; use nom::combinator::{map, map_res}; use nom::multi::length_data; use nom::number::complete::le_u8; use nom::IResult; use std::str; bit...
use std::sync::{Arc, Mutex}; use crate::config::Config; use crate::signals::mqtt::{MqttInterfaceIn, MqttInterfaceOut}; use crate::signals::order::dev_mgmt::SessionManager; use crate::skills::hermes::{HermesApiIn, HermesApiOut}; use crate::tts::TtsData; use anyhow::Result; use lily_common::communication::*; use rumqtt...
use crate::field::HasVariants; use anyhow::anyhow; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; use std::str::FromStr; use tracing::trace; #[derive(Debug, Deserialize, Serialize, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub enum Currency { Canadian, American, Chinese, E...
use std::io::Read; fn read<T: std::str::FromStr>() -> T { let token: String = std::io::stdin() .bytes() .map(|c| c.ok().unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().unwrap() } fn main() { let...
use alloc::{boxed::Box, collections::VecDeque, sync::Arc}; use core::any::Any; use spin::Mutex; use rcore_fs::vfs::*; /// mice device pub struct InputMiceInode { data: Arc<Mutex<VecDeque<[u8; 3]>>>, } const MAX_QUEUE: usize = 32; impl InputMiceInode { /// Create a mice INode pub fn new() -> Self { ...
use std::marker::PhantomData; use crate::{SaveToStatsFolder, Sensor}; /// The result of [`sensor.map(..)`](crate::SensorExt::map) pub struct MapSensor<S, ToObservations, F> where S: Sensor, F: Fn(S::Observations) -> ToObservations, { sensor: S, map_f: F, _phantom: PhantomData<ToObservations>, } i...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qscrollarea.h // dst-file: /src/widgets/qscrollarea.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block be...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "Gaming_Input_Custom")] pub mod Custom; #[cfg(feature = "Gaming_Input_ForceFeedback")] pub mod ForceFeedback; #[cfg(feature = "Gaming_Input_Preview")] pub mod Preview; #[link(name = "window...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "ApplicationModel_SocialInfo_Provider")] pub mod Provider; #[repr(transparent)] #[doc(hidden)] pub struct ISocialFeedChildItem(pub ::windows::core::IInspectable); unsafe impl ...
use crate::{database::Database, utils::LspPositionConversion}; use candy_frontend::{ ast_to_hir::AstToHir, mir::{Body, Expression, Mir, VisibleExpressions}, module::Module, }; use candy_vm::fiber::Panic; use extension_trait::extension_trait; use lsp_types::{Diagnostic, DiagnosticSeverity}; use std::mem; #[...
//! Provide a representation for type constructor selections. use crate::types::Class; use crate::types::Primitive; use crate::types::Type; use crate::pat; use crate::pat::Pattern; #[derive(Clone, Debug, PartialEq, Eq)] pub enum Constructor { ClassConstructor { num_fields: usize }, True, False, Num(i3...
use crate::Counter; use num_traits::{One, Zero}; use std::hash::Hash; use std::ops::{Sub, SubAssign}; impl<I, T, N> Sub<I> for Counter<T, N> where I: IntoIterator<Item = T>, T: Hash + Eq, N: PartialOrd + SubAssign + Zero + One, { type Output = Self; /// Consume `self` producing a `Counter` like `...
extern crate sphinx; use sphinx::crypto; use sphinx::header::delays; use sphinx::route::NodeAddressBytes; use sphinx::route::{Destination, DestinationAddressBytes, Node}; use sphinx::SphinxPacket; use std::time::Duration; use sphinx::test_utils::fixtures::hkdf_salt_fixture; const NODE_ADDRESS_LENGTH: usize = 32; cons...
// // Sysinfo // // Copyright (c) 2017 Guillaume Gomez // use libc::{self, c_char, CTL_NET, NET_RT_IFLIST2, PF_ROUTE, RTM_IFINFO2}; use std::ptr::null_mut; use sys::ffi; use NetworkExt; /// Contains network information. pub struct NetworkData { old_in: u64, old_out: u64, current_in: u64, current_ou...
// 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 { failure::Error, fidl_fuchsia_netemul_guest::{CommandListenerEvent, CommandListenerEventStream}, fuchsia_zircon as zx, futures::TryStr...
use crate::token::{Keyword, Location, Token, Tokens}; use anyhow::{anyhow, Result}; pub struct Stream { iter: std::iter::Peekable<std::vec::IntoIter<Token>>, } // Token Stream impl Stream { pub fn new(tokens: Tokens) -> Stream { let iter = tokens.tokens.into_iter().peekable(); Stream { iter }...
use crate::logic::models::ground_tile::GroundTile; use crate::logic::models::ground_vertex::GroundVertex; use crate::logic::schema::ground_tiles_vertexes_with_deleted; #[derive(Insertable)] #[table_name = "ground_tiles_vertexes_with_deleted"] pub struct GroundTileVertexInput { tile_id: i64, vertex_id: i64, } ...
use std::io::Read; fn read<T: std::str::FromStr>() -> T { let token: String = std::io::stdin() .bytes() .map(|c| c.ok().unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().unwrap() } fn main() { let...
// This file is part of linux-epoll. 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/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
use std::fs::File; use std::io::{BufRead, BufReader, Error, ErrorKind, Read}; use std::time::Instant; use intcode::*; fn read<R: Read>(io: R) -> Result<Vec<i64>, Error> { let br = BufReader::new(io); br.lines() .map(|line| line.unwrap()) .next() .unwrap() .split(',') .m...
use std::proto::Protocol; #[repr(packed)] #[derive(Clone, Copy, Debug)] pub struct PartitionProtoInfoMbr { pub boot: u8, pub chs_start: [u8; 3], pub ty: u8, pub chs_end: [u8; 3], pub start_lba: u32, pub lba_size: u32, } #[repr(packed)] #[derive(Clone, Copy)] pub struct PartitionProtoInfoGpt { ...
use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll, Waker}; struct FutureState<R> { waker: Option<Waker>, data: Option<R>, } unsafe impl<R> Send for FutureState<R> {} pub struct ThreadFuture<R> { state: Arc<Mutex<FutureState<R>>>, } unsafe impl<R> Send for ThreadFuture<R> {} ...
use std::io::Write as _; use std::{error, fs, io}; #[derive(serde::Deserialize)] struct Config { parameters: Parameters, } #[derive(serde::Deserialize)] struct Parameters { dimension: usize, number: u8, } fn main() -> Result<(), Box<dyn error::Error>> { println!("cargo:rerun-if-changed=config/src/lib...
extern crate proc_macro; use proc_macro::TokenStream; use proc_macro2::{Span, TokenTree}; use proc_macro_error::abort_call_site; use quote::{format_ident, quote}; use std::{iter::FromIterator, str::FromStr}; use syn::{ parse_macro_input, punctuated::Punctuated, Attribute, Data, DeriveInput, Fields, Ident, Lit, ...
#![allow(dead_code)] use crate::get_acpi_table; pub use acpi::{ interrupt::{InterruptModel, InterruptSourceOverride, IoApic, Polarity, TriggerMode}, Acpi, }; use alloc::vec::Vec; use lazy_static::*; use spin::Mutex; pub struct AcpiTable { inner: Acpi, } lazy_static! { static ref ACPI_TABLE: Mutex<Optio...
mod conflicts; mod constants; mod readset; mod utils; mod version; mod writeset; /// Transactional system errors pub mod errors; /// Transaction management definitions pub mod transact; /// Transactional variable definitions pub mod vars; /// Prelude of transactional system pub mod prelude { pub use super::transa...
extern crate rl_sys; use rl_sys::readline; use rl_sys::history::listmgmt; fn evaluate(input: String) -> String { String::from("hello there") } fn main() { loop { let output: String = match readline::readline("") { Ok(Some(s)) => evaluate(s), Ok(None) => break, // user entere...
/* Copyright 2019 Supercomputing Systems AG 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 ag...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qfileselector.h // dst-file: /src/core/qfileselector.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begi...
extern crate proconio; use proconio::input; fn main() { input! { a: i32, mut b: i32, mut c: i32, k: i32, } let mut cnt = 0; while a >= b { b = b * 2; cnt += 1; } while b >= c { c = c * 2; cnt += 1; } println!("{}", if cnt <...
///! Generates a list of implementations for a matrix multiplication ///! kernel and writes a list with the lists of actions defining the ///! implementations to a dump file use log::{debug, warn}; use std::fs; use std::path::PathBuf; use structopt::StructOpt; use telamon::codegen; use telamon::explorer::{self, local_s...
fn takes_ownership(x: String) { println!("{}", x); } fn gives_ownership(x: String) -> String { println!("{}", x); x } fn make_copy(x: i32) { println!("{}", x); } //所有权 fn main() { //字符串字面量,是不可变的 let x = "test"; //字符串变量 let mut y = String::from("hello"); y.push_str(",world"); ...
pub struct Keyboard {} impl Keyboard { pub fn new() -> Keyboard { Keyboard {} } pub fn is_pressed(&self, _key: u8) -> bool { // TODO false } pub fn is_released(&self, _key: u8) -> bool { // TODO true } pub fn wait_key(&self) -> u8 { // TODO...
pub mod avx2_m256x2_u64; pub mod avx2_m256x8_m256;
use serde::*; use crate::util; #[derive(Debug, Serialize, Deserialize, Clone)] pub enum Scope { Read, } #[derive(Debug, Serialize, Deserialize, Clone)] pub enum TokenType { Bearer, } #[derive(Debug, Serialize, Deserialize, Clone)] pub struct AccessToken { access_token: String, expires_in: i32, s...
extern crate cc; extern crate cpp_build; fn main() { cc::Build::new() .file("wrappers/framework.cpp") .compile("xpedite_target"); cpp_build::build("examples/life.rs"); }
use async_graphql::*; use chrono::{DateTime, Utc}; use futures_util::stream::Stream; #[tokio::test] pub async fn test_object() { /// Haha #[derive(Description, Default)] struct MyObj; #[Object(use_type_description)] impl MyObj { async fn value(&self) -> i32 { 100 } ...
//! An ffi-safe equivalent of `std::any::TypeId`. //! //! No types coming from different dynamic libraries compare equal. use std::{ any::TypeId, hash::{Hash, Hasher}, mem, sync::atomic::AtomicUsize, }; use crate::{sabi_types::MaybeCmp, EXECUTABLE_IDENTITY}; //////////////////////////////////////////...
//! Connection Event Parser //! //! The `ConnEventParser` is a state machine which consumes //! a stream of `Event`s from the TNC. Events which are relevant //! to ARQ connections are composited into `ConnectionStateChange` //! messages. The remaining events are discarded. use std::convert::Into; use std::string::Stri...
use std::str::FromStr; use std::fmt::{Debug, Formatter}; use std::cmp::Ordering; use std::ops::{Add, Sub, Mul, Div}; use parser::faces::Function; use super::num::Num; use super::num::Integer; use super::num::Float; use parser::faces::FnFunction; #[derive(Debug)] pub enum Lexem { Letter(String), Op(Operand), ...
pub use metadata::*; // metadata mod metadata { /// The version of the application (should be in sync with `Cargo.toml`) pub const VERSION: &str = "2.1.0"; /// The name of the program pub const NAME: &str = "Nextlaunch"; /// The program author pub const AUTHOR: &str = "Thomas B. <tom.b.2k2@gm...
fn main(){ let mut mutable = 9; mutable += 1; println!("{mutable}"); let immutable = 8; // immutable += 2; }
use crate::market::Order; use crate::types::{OrderEventType, SimpleResult}; use core::cell::RefCell; use anyhow::{anyhow, Result}; use crossbeam_channel::RecvTimeoutError; use rdkafka::client::ClientContext; use rdkafka::config::ClientConfig; use rdkafka::error::{KafkaError, RDKafkaErrorCode}; use rdkafka::producer::{...
use std::collections::{HashMap, HashSet}; use std::collections::{hash_map, hash_set}; use std::error::Error; use std::fmt; use std::iter; use std::rc::Rc; /// An actor identifier is unique per use case diagram. #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct ActorId(pub usize); impl fmt...
use std::io; fn fib(n: u32) -> u32{ if n==1||n==0{ 1 }else { fib(n-1) + fib(n-2) } } fn main() { println!("Enter a number: "); let mut num = String::new(); io::stdin().read_line(&mut num).expect("Failed to read"); let num = match num.trim().parse(){ Ok(num) => num, Err(_) => 0, }; let x = { fib(...
//! The reluctant doubling Luby sequence. //! //! This sequence is [A182105](https://oeis.org/A182105). /// Infinite iterator yielding the Luby sequence. pub struct LubySequence { u: u64, v: u64, } impl Default for LubySequence { fn default() -> LubySequence { LubySequence { u: 1, v: 1 } } } ...
// Copyright 2021 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 ...
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug, Clone)] pub struct VkAccelerationStructureInfoNV { pub sType: VkStructureType, pub pNext: *const c_void, pub r#type: VkAccelerationStructureTypeNV, pub flags: VkBuildAccelerationStructureFlagBitsNV, pub insta...
//! Code generation for `#[graphql_interface]` macro. use std::mem; use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::{ext::IdentExt as _, parse_quote, spanned::Spanned}; use crate::common::{ diagnostic, field, parse::{self, TypeExt as _}, path_eq_single, rename, scalar, SpanContainer, }; ...
#![cfg_attr(feature = "clippy", feature(plugin))] #![cfg_attr(feature = "clippy", plugin(clippy))] #![cfg_attr(feature = "clippy", warn(enum_glob_use))] #![cfg_attr(feature = "clippy", warn(if_not_else))] #![cfg_attr(feature = "clippy", warn(string_add))] #![cfg_attr(feature = "clippy", warn(string_add_assign))] #![war...
use domain_patterns::models::ValueObject; use std::convert::TryFrom; use crate::value_objects::ValidationError; use crate::errors::{Error, Result}; #[derive(Clone, PartialEq)] pub enum Category { Music, Funny, Technology, Memes, } impl std::fmt::Display for Category { fn fmt(&self, f: &mut std::fm...
extern crate jlib; use jlib::wallet::wallet::{ Wallet, WalletType }; use jlib::wallet::builder::generate_wallet; fn main() { let wallet: Wallet = generate_wallet(WalletType::SM2P256V1); println!("new wallet : {:#?}", wallet); }
use nom::alpha; use nom::types::CompleteStr; use crate::assembler::label_parsers::label_declaration; use crate::assembler::Token; named!(pub directive <CompleteStr, Token>, ws!( do_parse!( tag!(".") >> d: alpha >> ( Token::Directive{ na...
// 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 decisionengine::datasource::DecisionDataInputNode; use decisionengine::datasource::DecisionDataRequestHandler; use decisionengine::datasource::DecisionDataset; use decisionengine::nodes::NodeResult; #[derive(Serialize, Deserialize, Clone)] pub struct ApplicationDataV1 { first_name: String, last_name: Strin...
//! Camera image example. //! //! This example demonstrates how to use the built-in cameras to take a picture and display it to the screen. use ctru::prelude::*; use ctru::services::cam::{Cam, Camera, OutputFormat, ShutterSound, ViewSize}; use ctru::services::gfx::{Flush, Screen, Swap}; use ctru::services::gspgpu::Fra...
//! Unix-related types needed to deal with polling. #[doc(inline)] pub use ::nix::poll::PollFlags;
use std::mem; use windows_sys::Windows::Win32::CoreAudio as core; use windows_sys::Windows::Win32::Multimedia as mm; use super::ClientConfig; /// Trait implemented for types which can be used to feed the output device. pub unsafe trait Sample: Copy { /// The mid level (silent) level of a sample. const MID: Se...
use proc_macro2; use syn; use field::*; use model::*; use util::*; pub fn derive(item: syn::DeriveInput) -> Result<proc_macro2::TokenStream, Diagnostic> { let model = Model::from_item(&item)?; let (_, ty_generics, _) = item.generics.split_for_impl(); let mut generics = item.generics.clone(); generics...
use std::fmt; // strum::IntoEnumIterator is required for Color::iter(), but produces unused import warning #[allow(unused_imports)] use strum::IntoEnumIterator; use crate::core::color::{Color, HasColor, Colors}; /// ManaType is used to represent a single type of Mana #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone,...
// Copyright 2017, Reizner Evgeniy <razrfalcon@gmail.com>. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> /*! *color-thief-rs* is a [color-thief](https://github.com/lokesh/color-thief) algorithm ...
#![cfg_attr(not(feature = "std"), no_std)] cfg_if::cfg_if! { if #[cfg(feature = "std")] { } else { extern crate alloc; } } pub mod traits; #[cfg(not(feature = "std"))] pub mod chain; #[cfg(feature = "std")] pub mod mock;
use gatt::characteristics as ch; use gatt::services as srv; use gatt::{CharacteristicProperties, Registration}; pub(crate) fn add(registration: &mut Registration<super::Token>) { registration.add_primary_service(srv::GENERIC_ACCESS); // Device Name registration.add_characteristic(ch::DEVICE_NAME, "btknmle...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ /// Formatting values into the query string as specified in /// [httpQuery](https://awslabs.github.io/smithy/1.0/spec/core/http-traits.html#httpquery-trait) use smithy_types::Instant; use std::fmt::Debu...
use std::mem; #[repr(C)] #[derive(Debug, Clone)] pub struct VkClearColorValue([u32; 4]); impl VkClearColorValue { #[inline] pub fn as_float32(&self) -> &[f32; 4] { unsafe { mem::transmute(&self.0) } } #[inline] pub fn as_int32(&self) -> &[i32; 4] { unsafe { mem::transmute(&self.0)...
#[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "kernel32.dll""system" #[doc = "*Required features: `\"Win32_System_Console\"`, `\"Win32_Foundation\"`*"] fn AddConsoleAliasA ( source : ::windows_sys::core::PCSTR , target : ::windows_sys::core::PCSTR , exename : ::windows_sys::core::PCSTR ) -> super::su...
#[doc = r"Value read from the register"] pub struct R { bits: u16, } #[doc = r"Value to write to the register"] pub struct W { bits: u16, } impl super::DMACTL7 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
use std::str::from_utf8_unchecked; use protobuf_iter::*; use super::node::Node; use super::way::Way; use super::relation::Relation; use super::dense_nodes::DenseNodesParser; const NANO: f64 = 1.0e-9; #[derive(Clone)] pub struct PrimitiveBlock<'a> { pub stringtable: Vec<&'a str>, iter: MessageIter<'a>, pu...
use crate::stdio_server::input::{AutocmdEventType, PluginEvent}; use crate::stdio_server::plugin::{ClapAction, ClapPlugin, PluginId}; use crate::stdio_server::vim::Vim; use anyhow::Result; use matcher::WordMatcher; use std::collections::HashMap; use std::fmt::Debug; use std::path::{Path, PathBuf}; use utils::read_lines...
use cell; use {CoreResult, Pattern, StashIndexable, TerminalPattern, RuleSet, Sym, SymbolTable, NodePayload}; use pattern; use helpers::BoundariesChecker; use rule::{Rule, TerminalRule, Rule1, Rule2, Rule3, Rule4, Rule5, Rule6, RuleProductionArg}; use rule::RuleResult; pub struct RuleSetBuilder<StashValue: NodePaylo...
use std; use na::*; use math::*; use renderer::*; use alga::general::*; use std::rc::Rc; use std::cell::RefCell; use num::PrimInt; pub struct Octree<T> { parent : Option<Rc<RefCell<Octree<T>>>>, children : Option < Vec < Option< Rc<RefCell<Octree<T>>> > > >, //None or always of size 8 status : u8, //...
// Copyright 2021 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 ...