text
stringlengths
8
4.13M
use std::fs::File; use std::io::prelude::*; fn main() { // The 'Result' value returned by write_all is ignored. let mut f1 = File::create("/sys/class/gpio/export").unwrap(); f1.write_all(b"0"); let mut f2 = File::create("/sys/class/gpio/gpio0/direction").unwrap(); f2.write_all(b"out"); ...
use std::io; use futures::prelude::*; use tokio::prelude::*; use bytes::BytesMut; pub struct Forwarder<F, T> { from: F, to: T, buffer: BytesMut, } impl<F, T> Forwarder<F, T> where F: AsyncRead, T: AsyncWrite, { pub fn new(from: F, to: T) -> Self { Forwarder { from: from, ...
use std::num::Num; pub fn poop<T: Num>(i: T) -> T { i * i }
#[repr(C,packed)] pub struct PartitionTableStruct { pub bootIndicator : u8, /* Boot flags */ pub startingHead : u8, /* Starting head */ pub startingSector : u8, /* Starting sector */ pub startingCylinder : u8, /* Starting cylinder */ ...
// Copyright 2019 The vault713 Developers // // 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 a...
use rppal::gpio::Level; use rppal::gpio::Gpio; use std::sync::mpsc::{channel, Sender}; use std::thread::{sleep, JoinHandle}; use std::time::Duration; const SOFTPWM_PERIOD_US: u64 = 100; /// Software PWM object #[allow(dead_code)] struct SoftPWM { thread: JoinHandle<()>, setval_tx: Sender<u64>, end_tx: Sender<b...
#![allow(unused_imports)] #![allow(dead_code)] #![allow(unused_variables)] use serde::{Serialize, Deserialize}; use sodiumoxide; use std::any::type_name; use serde_json::Result; use std::collections::HashMap; #[derive(Serialize, Deserialize, Debug)] enum MyRequest { ReqCryptoBoxGenKeypair, ReqCryptoBoxGenNonce...
use std::fs::{self, DirEntry}; use std::path::Path; use std::io; pub fn get_entries(root: &String, recur: bool) -> io::Result<Vec<DirEntry>> { let mut entries: Vec<DirEntry> = Vec::new(); let path = Path::new(root); match recur { true => try!(walk(path, &mut entries)), false => try!(explore...
use super::*; use serenity::framework::standard::macros::group; #[group("General")] #[commands(cmd_buttons, cmd_dropdowns)] pub struct General; #[group("Bot Utilities")] #[commands(cmd_ping)] pub struct BotUtils;
#![feature(async_await)] use lambda::{lambda, LambdaCtx}; type Err = Box<dyn std::error::Error + Send + Sync + 'static>; #[lambda] #[runtime::main] async fn main(event: String, ctx: LambdaCtx) -> Result<String, Err> { let _ = ctx; Ok(event) }
extern crate gnuplot; extern crate interp_util; use std::f64; use gnuplot::*; use interp_util::*; fn polynomial_error(x0: f64, pts: &Vec<f64>) -> f64 { let mut res = 0.0; for i in 0..pts.len() { let mut tmp = 1.0; for j in 0..pts.len() { if j != i { tmp = tmp * (x...
extern crate libc; use std::rc::Rc; use std::vec; use std::ptr; use self::libc::{c_int}; use git2; use git2::repository::{Repository}; use git2::repository; use git2::oid::{GitOid,ToOID}; use git2::error::{GitError, get_last_error}; pub type GitOff = i64; pub mod opaque { pub enum Blob {} } extern { fn git_...
// 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...
extern crate serde; extern crate serde_json; extern crate reqwest; use serde::{Deserialize, Serialize}; const url: &str = "https://coronavirus-19-api.herokuapp.com/countries/"; #[derive(Deserialize, Debug)] struct Country { country: String, cases: i32, todayCases: i32, deaths: i32, todayDeaths: i...
#[cfg(test)] mod tests { use pygmaea::token_type::TokenType; fn setup_input() -> String { "let five = 5; let ten = 10; let add = fn(x, y){ x + y; }; let result = add(five, ten); !-/*5; 5 < 10 > 5; if (5 < 10) { return tru...
use crate::ast::stat_expr_types::{ Block, Condition, Exp, ForRange, FunctionCall, FunctionDef, IfThenElse, RefCall, Statement, TupleNode, VarIndex, }; pub struct CtxIdParser { ctxid: i32, } impl CtxIdParser { pub fn new() -> CtxIdParser { CtxIdParser { ctxid: 0 } } fn parse_func_call<...
use std::{ collections::HashMap, convert::TryFrom, io::Result as IoResult, }; use asap::{ generator::Generator, validator::{Validator, ValidatorBuilder}, claims::{Aud, ExtraClaims}, }; #[cfg(feature = "alloc")] use alloc; use log; use magic_crypt::MagicCrypt; use once_cell::sync::OnceCell; use serde::{Serialize...
// error-pattern:refutable pattern tag xx { xx(int); yy; } fn main() { let @{x:xx(x), y} = @{x: xx(10), y: 20}; assert x + y == 30; }
use std::io; use std::io::{Cursor, Error, ErrorKind, Read}; use byteorder::{LittleEndian, ReadBytesExt}; use crate::rdb::{read_zip_list_entry, read_zm_len, Field, Item, RDBDecode}; /// 迭代器接口的定义(迭代器方便处理大key,减轻内存使用) /// /// 后续再看怎么优化代码 pub(crate) trait Iter { fn next(&mut self) -> io::Result<Vec<u8>>; } // 字符串类型的...
//macro_rules! log { // ($msg:expr) => {{ // let state: i32 = get_log_state(); // if state > 0 { // println!("log({}): {}", state, $msg); // } // }}; //} pub const MIN_POSITIVE: f64 = 0.0000000000000001;//std::f64::MIN_POSITIVE pub fn avg(numbers: &[f64]) -> f64 { let sum: f6...
use core::fmt; use core::str::FromStr; use anyhow::anyhow; /// Represents the original encoding of a binary /// /// In the case of `Raw`, there is no specific encoding and /// while it may be valid Latin-1 or UTF-8 bytes, it should be /// treated as neither without validation. #[derive(Debug, Clone, Copy, PartialEq, ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IGraphicsCaptureItemInterop(pub ::windows::cor...
use spatialos_sdk_sys::worker::*; use std::ptr; pub const PASSTHROUGH_VTABLE: Worker_ComponentVtable = Worker_ComponentVtable { component_id: 0, user_data: ptr::null_mut(), command_request_free: None, command_request_copy: None, command_request_deserialize: None, command_request_serialize: None...
//! F-BLEAU is a tool for estimating the leakage of a system about its secrets //! in a black-box manner (i.e., by only looking at examples of secret inputs //! and respective outputs). It considers a generic system as a black-box, //! taking secret inputs and returning outputs accordingly, and it measures //! how much...
// 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. //! Implementation of Generator thread and Generator trait. //! //! Generator thread accept a set of serializable arguments. use { crate::common_operat...
//! Renders static files in resource directory use std::path::Path; use actix_web::web::ServiceConfig; use crate::rest::AppState; pub fn register_servlets(config: &mut ServiceConfig, state: &AppState) { let res_dir = Path::new(&state.config.resource_dir); let static_dir = res_dir.join("static"); config...
// 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 ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type FindAllAccountsResult = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct FindAllWebAccountsStatus(pub i32); impl FindAllWebAccountsStatus { ...
/* * This file is part of the uutils coreutils package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use std::io::{Result, Error}; use ::libc; use uucore::c_types::{c_passwd, getpwuid...
use sdl2::GameControllerSubsystem; use sdl2::controller::Button; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::pixels::PixelFormatEnum; use std::time::{Duration, Instant}; use std::env; use anyhow::Result; use crate::gbc::Emu; pub const WIDTH: usize = 160; pub const HEIGHT: usize = 144; pub const DEP...
use crate::logger::logger::Error; use crate::parser::parser; use crate::parser::parser::Parser; use crate::typecheck::ast_typecheck; /// Typecheck object pub struct TypeCheckModule<'a> { pub parser: Parser<'a>, pub symtab: ast_typecheck::TypeCheckSymbTab<'a>, } impl<'a> TypeCheckModule<'a> { /// Return ne...
use ws::{connect, CloseCode}; use std::rc::Rc; use std::cell::Cell; use serde_json::{Value}; use crate::base::misc::util::downcast_to_string; use crate::api::config::Config; use crate::api::order_books::data::{ RequestOrderBookCommand, RequestOrderBookResponse, OrderBookSideKick, OrderBookItem }; pub...
use gifski::Collector; use crate::error::*; pub trait Source: Send { fn total_frames(&self) -> u64; fn collect(&mut self, dest: Collector) -> BinResult<()>; }
use serde::{Deserialize, Serialize}; use super::code::CodeData; use super::graph::Graphs; use super::{ArrangeId, Compact, CompactContext, Decompact, DecompactContext}; use crate::ast; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct ExternCode { ty: ast::ExternNodeType, data: CodeData, } impl Compa...
use proptest::prelude::*; use normalize_newlines::normalize_newlines; #[test] fn test_normalize_newlines() { fn check(before: &str, after: &str, ok: bool) { let mut actual = before.to_string(); assert_eq!(normalize_newlines(&mut actual).is_ok(), ok); assert_eq!(actual.as_str(), after); ...
#[cfg(feature = "parking_lot")] use parking_lot as sync; #[cfg(not(feature = "parking_lot"))] use std::sync; pub(crate) use sync::{RwLockReadGuard, RwLockWriteGuard}; #[cfg(feature = "parking_lot")] #[inline] fn wrap<T>(param: T) -> T { param } #[cfg(not(feature = "parking_lot"))] #[inline] fn wrap<T>(param: sy...
#![allow(dead_code)] // TODO: lots of unused stuff use std::fs::File; use std::io; use std::io::{BufReader, BufWriter}; use std::path::{Path, PathBuf}; use std::cmp::{min,max}; use self::undo_stack::Operation::*; use self::undo_stack::UndoStack; use ropey::{Rope, RopeSlice, iter}; use string_utils::char_count; use ut...
//! # Compile-Time Compiler That Compiles Forth to Trait Expressions //! //! "We all know Rust's trait system is Turing complete, so tell me, why aren't we exploiting //! this???" - [Nathan Corbyn](https://github.com/doctorn/trait-eval) //! //!``` //! #![recursion_limit = "256"] //! #[macro_use] extern crate fortraith;...
use crate::ir::{self, Adaptable}; use indexmap::IndexMap; use serde::Serialize; use std; use std::borrow::Borrow; use std::fmt; use utils::*; /// Generic trait for sets. pub trait SetRef<'a> { /// Returns the set definition. fn def(&self) -> &'a SetDef; /// Returns the argument of the set, if any. fn ...
//! Caputre network traffic use etherparse::*; use std::collections::HashMap; use std::str::FromStr; use std::sync::mpsc; use pcap::{Capture, Device, Packet}; use crate::packet::{Direction, PoePacket}; use crate::Error; // listens on all interfaces and searches for packets to/from port 20481, if found shuts down al...
mod kobo; mod remarkable; pub use self::remarkable::remarkable_parse_device_events; pub use self::kobo::kobo_parse_device_events; use device::CURRENT_DEVICE; extern crate libc; use fnv::FnvHashMap; use std::mem; use std::slice; use std::thread; use std::io::Read; use std::fs::File; use std::sync::mpsc::{self, Sender, ...
use std::{sync::Arc, time::Duration}; use async_trait::async_trait; use generated_types::{ influxdata::iox::gossip::v1::{gossip_message::Msg, GossipMessage}, prost::Message, }; use parking_lot::Mutex; use test_helpers::timeout::FutureTimeout; use super::traits::SchemaBroadcast; #[derive(Debug, Default)] pub ...
use std::collections::HashMap; use std::fmt; use std::fs::File; use std::ffi::OsStr; use std::io::Read; use std::io::Seek; use std::io::SeekFrom; use std::ops::Range; use std::sync::Arc; use fs2::FileExt; use fuser; use indexmap::IndexMap; use sanitize_filename; use serde_json; use mirakc_core::config::*; use mirakc_...
pub use VkSwapchainCreateFlagsKHR::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkSwapchainCreateFlagsKHR { VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 0x0000_0001, VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 0x0000_0002, VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR = 0x000...
// 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 ...
extern crate nom; use nom::{ branch::alt, bytes::complete::{tag, take_while, take_until}, character::complete::{alphanumeric1, char, multispace0, space0}, multi::separated_list0, sequence::{preceded, separated_pair, terminated}, IResult }; use crate::domains::function_signature::{ Applicat...
//! # Pipeline //! //! Defines an upgrade pipeline that can be used to upgrade and gitify single //! WordPress plugins. use fs_extra; use std::{ fs::write, path::PathBuf }; use config::RuntimeConfig; use git::Git; use wordpress::{Plugin, WpCli, get_plugin_version}; /// Data for an upgrade pipeline. pub stru...
// 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::{format_err, Error, ResultExt}; use fidl::endpoints; use fidl_fuchsia_wlan_common as fidl_common; use fidl_fuchsia_wlan_device_service::Device...
pub(crate) use _collections::make_module; #[pymodule] mod _collections { use crate::{ atomic_func, builtins::{ IterStatus::{Active, Exhausted}, PositionIterInternal, PyGenericAlias, PyInt, PyTypeRef, }, common::lock::{PyMutex, PyRwLock, PyRwLockReadGuard, PyR...
//! Blinks an LED #![deny(unsafe_code)] #![deny(warnings)] #![no_std] #![no_main] extern crate cortex_m; #[macro_use] extern crate cortex_m_rt as rt; extern crate cortex_m_semihosting as sh; extern crate panic_semihosting; extern crate stm32l4xx_hal as hal; use crate::hal::delay::Delay; use crate::hal::rcc::{PllConfi...
pub fn four_bytes_at_offset(block: &[u8], offset: usize) -> u32 { let first: u32 = block[offset] as u32; let second: u32 = block[offset + 1] as u32; let third: u32 = block[offset + 2] as u32; let fourth: u32 = block[offset + 3] as u32; (first | second << 8 | third << 16 | fourth << 24) } pub fn two...
use bytes::Bytes; use crate::error::Error; use crate::io::BufExt; use crate::mssql::{MssqlColumn, MssqlTypeInfo}; #[derive(Debug)] pub(crate) struct Row { pub(crate) column_types: Vec<MssqlTypeInfo>, pub(crate) values: Vec<Option<Bytes>>, } impl Row { pub(crate) fn get( buf: &mut Bytes, n...
pub fn find_amount_of_possible_passwords() -> u32 { let min = 284639; let max = 748759; let mut amount = 0; for num in min..max { if meets_criteria_part1(num) { amount = amount + 1; } } amount } pub fn find_possible_passwords() -> u32 { let min = 284639; let max = 748759; let mut amount...
use super::chal39::{RsaKeyPair, RsaPubKey}; use super::mod_inv; use num::{traits::Pow, BigUint, FromPrimitive, One, Zero}; use std::cmp; use std::fmt; use std::thread; use std::time::Duration; #[allow(clippy::many_single_char_names, non_snake_case)] /// Implementation of BB'98 CCA padding oracle attack, returns the de...
use crate::color::Color; use crate::coord::{CanvasCoordinate, ScreenCoordinate}; use crate::traits::Converts; use pixels::{Error, Pixels, SurfaceTexture}; use std::iter::Iterator; use winit::dpi::LogicalSize; use winit::window::{Window, WindowBuilder}; pub(crate) const DEFAULT_WIDTH: usize = 1000; pub(crate) const DEF...
use crate::cplane_api::CPlaneApi; use crate::cplane_api::DatabaseInfo; use crate::ProxyState; use anyhow::bail; use tokio_postgres::NoTls; use rand::Rng; use std::io::Write; use std::{io, sync::mpsc::channel, thread}; use zenith_utils::postgres_backend::Stream; use zenith_utils::postgres_backend::{PostgresBackend, Pr...
use crate::challenges::Challenge; use crate::InputError; use crate::ResultHashMap; use crate::file_lines_to_string_vec; use crate::binary_partitioner; pub fn challenge() -> Challenge { return Challenge::new( max_seat_id, my_seat_id, String::from("resources/binary_partitioning_seats.txt"), ...
use std::error::Error; use std::time; use aws_lambda_events::event::s3::{S3Event, S3EventRecord}; use aws_lambda_events::event::sqs::SqsEvent; use backoff::{ExponentialBackoff, Operation}; use lambda_runtime::{error::HandlerError, lambda, Context}; use log::{error, info, warn}; use rusoto_core::Region; use rusoto_lamb...
use std::cell::UnsafeCell; use std::rc::Rc; use rpds::{rbt_set, RedBlackTreeSet}; use firefly_diagnostics::*; use firefly_intern::{symbols, Ident}; use firefly_pass::Pass; use firefly_syntax_base::*; use super::Known; use crate::{passes::FunctionContext, *}; /// Phase 2: Annotate variable usage /// /// Step "forwar...
use hyper::client::Client; use hyper::header::ContentType; use hyper::status::StatusCode; use util::{read_body_to_string, read_url, run_example}; #[test] fn display_form() { run_example("form_data", |port| { let url = format!("http://localhost:{}/", port); let s = read_url(&url); assert!(s....
use serde::Serialize; use codec::{Encode, Decode}; use nix::sys::stat::stat; use std::path::Path; use crate::error::{MinerError, Result}; #[derive(Clone)] pub struct IpfsClient { uri: String, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Encode, Decode)] pub struct Stat { pub hash: String, /...
struct TrivialNewtype(Vec<u8>); fn test() { let bare_vec = vec![1u8, 2, 3]; let newtype_vec = TrivialNewtype(vec![1u8, 2, 3]); let placeholder = 12; } fn main() { test() }
use std::collections::HashMap; pub fn anagrams_for<'a>(target: &'a str, candidates: &[&'a str]) -> Vec<&'a str> { let mut target_char_map = HashMap::new(); for letter in target.chars() { let letter = char_to_lowercase(letter.clone()); let ct = target_char_map .entry(letter.cl...
use r2r; use std::cell::RefCell; use std::collections::HashMap; use std::env; use std::rc::Rc; use std::thread; use std::time::Duration; use std::io; use failure::Error; use termion::event::Key; use termion::input::MouseTerminal; use termion::raw::IntoRawMode; use termion::screen::AlternateScreen; use tui::backend::...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // 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 ...
use crate::io::{self, *}; use alloc::string::String; use core::fmt::{self, Write}; use cortex_m::interrupt; use stm32f1xx_hal::pac::USART1; use stm32f1xx_hal::serial::{Rx, Tx}; static mut STDOUT: Option<Stdout<Tx<USART1>>> = None; static mut STDIN: Option<Stdin<Rx<USART1>>> = None; pub fn use_rx1(rx: Rx<USART1>) { ...
use std::collections::HashMap; use std::net::{SocketAddr, UdpSocket}; use std::sync::{Arc, mpsc, Mutex, MutexGuard}; use std::thread; use serde::{Deserialize, Serialize}; use saoleile_derive::NetworkEvent; use crate::event::NetworkEvent; use crate::event::core::ShutdownEvent; use self::cleanup_thread::network_inter...
use curses; use {Error, Event, Key}; use super::Screen; #[allow(dead_code)] pub struct Input<'a> { screen: &'a mut Screen, } impl<'a> Input<'a> { #[inline] pub unsafe fn wrap(screen: &mut Screen) -> Input { Input { screen: screen } } } impl<'a> Input<'a> { #[inline] pub fn event(&mut self) -> Option<Event> ...
use amethyst::{ core::Transform, core::timing::Time, ecs::{Entities, System, WriteStorage, Read, ReadExpect}, renderer::SpriteRender, }; use specs_physics::{PhysicsBody, PhysicsBodyBuilder, nphysics::object::BodyStatus}; use crate::spriteanimationloader::SpriteAnimationStore; use crate::delayedremove::D...
use input_i_scanner::InputIScanner; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),...
/*! Asymmetric key-based signing utility functions. # Examples ## If the data is valid, `verify` should return true. ``` use libsodacrypt::sign::*; let seed = gen_seed().unwrap(); let (sign_pub, sign_priv) = keypair_from_seed(&seed).unwrap(); let sig = sign(b"hello", &sign_priv).unwrap(); assert!(verify(b"hello", &s...
use serde::{Deserialize, Serialize}; use serde_json::{Value}; #[derive(Debug, Serialize, Deserialize, PartialEq, Clone)] pub struct Sample { path: String, vuint: Option<u64>, vint: Option<i64>, vfloat: Option<f64>, vstr: Option<String>, vbool: Option<bool>, } impl Sample { pub fn new...
fn main() { // イミュータブルな変数 let x = 1 + 2; //ここで1+2というデータのラベルくんをxとしよう // ミュータブルな変数に束縛できる。 let mut y = x; //ここでmutなyくんが登場。今はxのデータと同じ場所を参照している。 // 注意として、xくんはイミュータブルなのでもう一度データの上に立ったら移動することができない。 // しかしyくんは走り回ることができるのである。 y = 5; //ここで、yくんはx=3というデータの上から5というデータの上に走って移動したのだ! // さらにイミュータブルな変数に束縛でき...
extern crate bytebeat; use bytebeat::Program; use bytebeat::encode::{Color, EncoderConfig}; const WIDTH: usize = 640; const HEIGHT: usize = 360; const BG_HEIGHT: usize = 256; const WV_HEIGHT: usize = HEIGHT - BG_HEIGHT; const FPS: usize = 15; pub fn generate_video(code: &Program, fname: &str) { let hz = code.hz(...
extern crate cc; fn link_dylib(lib: &str) { println!("cargo:rustc-link-lib=dylib={}", lib); } fn link_static(lib: &str) { println!("cargo:rustc-link-lib=static={}", lib); } fn add_search_path(p: &str) { println!("cargo:rustc-link-search={}", p); } fn main() { add_search_path("/usr/local/lib"); ...
pub use VkPipelineVertexInputStateCreateFlags::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkPipelineVertexInputStateCreateFlags { VK_PIPELINE_VERTEX_INPUT_STATE_CREATE_NULL_BIT = 0, } use crate::SetupVkFlags; #[repr(C)] #[derive(Clone, Copy, Eq, PartialEq, Hash)] pub struct VkPipelineV...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)]...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_PointOfService_Provider")] pub mod Provider; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fm...
#![cfg(feature="inclnum")] extern crate num; use rand; // use num; // use self::num; use super::traits::*; impl Samplable for num::bigint::BigInt { fn sample_below(upper: &Self) -> Self { use self::num::bigint::{ToBigInt, RandBigInt}; let mut rng = rand::OsRng::new().unwrap(); rng.gen_bi...
fn main() { let mut vect: Vec<i32> = Vec::new(); vect.push(6); vect.push(124); println!("{:?}", vect); println!(); let mut vect_inferred = vec![1, 2, 3]; let third_element = &vect_inferred[2]; // gives reference -- you want it to crash if out of bounds let a = vect_inferred[2]; // copi...
use ndarray::{arr1, Array1, Array2, ArrayBase, Data, Ix1, Ix2}; use crate::gradient::{sobel_x, sobel_y}; use crate::interpolation::Interpolation; pub struct ImageGradient { gx: Array2<f64>, gy: Array2<f64> } impl ImageGradient { pub fn new<S: Data<Elem = f64>>(image: &ArrayBase<S, Ix2>) -> Self { ...
use crate::label_slice::LabelSlice; use crate::name::{Name, NameRelation}; use std::{marker::PhantomData, mem}; use crate::domaintree::flag::Color; use crate::domaintree::node::{connect_child, get_sibling, Node, NodePtr}; use crate::domaintree::node_chain::NodeChain; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub e...
// error-pattern: expecting fn main() { let x.y[int].z foo; }
/// /// Module for parsing postgresql.conf file. /// /// NOTE: This doesn't implement the full, correct postgresql.conf syntax. Just /// enough to extract a few settings we need in Zenith, assuming you don't do /// funny stuff like include-directives or funny escaping. use anyhow::{anyhow, bail, Context, Result}; use l...
use signal_hook::iterator::Signals; use std::error::Error; use std::thread::{self, sleep}; use std::time::Duration; fn main() -> Result<(), Box<dyn Error>>{ let signals = Signals::new(&[ signal_hook::SIGINT, signal_hook::SIGTERM, ])?; thread::spawn(|| { loop { println!("...
#[doc = r"Value read from the register"] pub struct R { bits: u8, } #[doc = r"Value to write to the register"] pub struct W { bits: u8, } impl super::TXTYPE6 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
extern crate serde; extern crate walkdir; use std::error::Error; use std::fs::File; use std::io; use std::io::prelude::*; use std::io::BufReader; use std::io::BufWriter; use std::path::Path; use std::path::PathBuf; use byteorder::*; use self::walkdir::WalkDir; // first few defs to deal with files generated from C v...
//! Mii Selector applet. //! //! This applet opens a window which lets the player/user choose a Mii from the ones present on their console. //! The selected Mii is readable as a [`Mii`](crate::mii::Mii). use crate::mii::Mii; use bitflags::bitflags; use std::{ffi::CString, fmt}; /// Index of a Mii on the [`MiiSelector...
use crate::crawler::video_crawler::craw_video_splider; use rand::random; use rocket::http::Status; use rocket::Route; use rocket_contrib::json::JsonValue; #[get("/video/entries?<count>")] fn get_video_entries(count: usize) -> Result<JsonValue, Status> { match craw_video_splider() { Ok(video_list) => { ...
// // deal/mod.rs // pub mod types; use accounts::types::{CurrentUser, CurrentUser::*}; use db::Conn; use deals::types::Deal; use deals::types::*; use diesel::prelude::*; use result::{Error, Payload, Response}; use validator::Validate; /// Get deals pub fn get_deals(query: Option<DealsQuery>, user: CurrentUser, conn:...
/* * Copyright 2020 Fluence Labs Limited * * 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 a...
use crate::smb2::{header, requests}; pub const DEFAULT_BUFFER: &[u8; 42] = b"\x5c\x00\x5c\x00\x31\x00\x39\x00\x32\x00\x2e\x00\x31\x00\x36\x00\ \x38\x00\x2e\x00\x30\x00\x2e\x00\x31\x00\x37\x00\x31\x00\x5c\x00\ \x73\x00\x68\x00\x61\x00\x72\x00\x65\x00"; pub const DEFAULT_PATH_OFFSET: &[u8; 2] = b"\x48\x00"; pub con...
/* * Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. * * To flip an image horizontally means that each row of the image is reversed. * For example, flipping [1, 1, 0] horizontally results in [0, 1, 1]. * * To invert an image means that each 0 is rep...
use llvm_sys::*; use llvm_sys::prelude::*; use llvm_sys::core as llvm; use super::*; pub struct Builder { pub ptr: LLVMBuilderRef } impl_llvm_ref!(Builder, LLVMBuilderRef); impl Builder { pub fn position_at_end(&mut self, basic_block: LLVMBasicBlockRef) { unsafe { llvm::LLVMPositionBuilde...
use euclid::*; use std::collections::HashMap; use std::fmt; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; enum AoC {} fn lines_from_file(filename: impl AsRef<Path>) -> Vec<String> { let file = File::open(filename).expect("no such file"); let buf = BufReader::new(file); buf.lin...
use crate::{Module, Trait}; use crypto::types::ModuloOperations; use num_bigint::BigUint; use num_traits::{One, Zero}; use sp_std::vec::Vec; /// all functions related to zero-knowledge proofs in the offchain worker impl<T: Trait> Module<T> { /// zips vectors a and b. /// performs component-wise operation: x = ...
pub mod commands; pub mod config; pub mod error; pub mod read; pub mod stats; pub mod transform; pub type Result<T, E = error::Error> = std::result::Result<T, E>;
extern crate hex; extern crate openssl; mod utils; use std::io::prelude::*; use std::fs::File; use openssl::memcmp::eq; use utils::*; fn main() { let strings = lines_from_file("data.txt"); let mut hex = Vec::new(); for i in 0..strings.len(){ hex.push(hex::decode(&strings[i]).unwrap()); } ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type CurrencyFormatter = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct CurrencyFormatterMode(pub i32); impl CurrencyFormatterMode { pub cons...
use crate::app::analysis::commit_analysis::ShortCommit; use crate::domain::git::coco_tag::CocoTag; #[allow(dead_code)] pub struct GitSuggest { tags: Vec<CocoTag>, commits: Vec<ShortCommit>, } impl GitSuggest { /// count git tag interval for insight of release /// also same to publish interval /// ...