text
stringlengths
8
4.13M
use serde; use serde_json; use std::collections::HashMap; use std::str::FromStr; use super::errors::*; #[derive(Debug, Deserialize)] struct Notification { #[serde(rename = "Message")] message: String, } impl FromStr for AlarmDetails { type Err = serde_json::Error; fn from_str(str: &str) -> JsonResul...
use linkux_server::cli; use std::{env, process}; fn main() { let running_os = env::consts::OS; if running_os != "linux" { eprintln!("Application error: Linkux can only be run on Linux systems"); process::exit(1); } let config = cli::get_run_config(); if let Err(e) = linkux_server...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::cli_state::CliState; use crate::StarcoinOpt; use anyhow::{format_err, Result}; use scmd::{CommandAction, ExecContext}; use starcoin_types::access_path::AccessPath; use starcoin_types::account_address::AccountAddress; use ...
fn main() { let input = include_str!("input.txt"); println!("Answer #1: {}", increment(input)); println!("Answer #2: {}", decrement(input)); } type Instruction = i32; type Index = i32; type InstructionSet = Vec<Instruction>; fn increment(input: &str) -> Index { let mut instruction_set = process(inpu...
use bevy::{ prelude::*, //default bevy }; use crate::{ SessionResource, }; pub struct HudData { counters: Entity, } // A unit struct to help identify the life counter UI component, since there may be many Text components #[derive(Component)] pub struct LifeCounterText; pub fn enter(mut commands: Command...
// Copyright (C) 2018 O.S. Systems Sofware LTDA // // SPDX-License-Identifier: MIT use crate::config; use lapin::{ message::Delivery, options::{ BasicAckOptions, BasicConsumeOptions, BasicNackOptions, ConfirmSelectOptions, ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions, }, ...
extern crate average; fn main() { average::run(); }
// Copyright 2020 The VectorDB Authors. // // Code is licensed under Apache License, Version 2.0. use crate::datums::Datum; use crate::errors::{Error, ExpressionError}; use super::IExpression; #[derive(Debug)] pub struct VariableExpression { pub val: String, } impl VariableExpression { pub fn new(v: impl As...
#![allow(dead_code)] use super::theme::*; use render::Canvas; use math::*; use ui::*; use std::mem::replace; const INDENT: f32 = 10.0; const LINE_HEIGHT: f32 = 20.0; const LINE_PAD_X: f32 = 8.0; pub struct EditorLayout<'a, 'state> { pub state: &'state mut UiState, pub ctx: Context<'a, Canvas>, cursor...
use rocket::local::Client; // initial setup for integration tests #[test] fn it_works() { let rocket = rocket::ignite(); Client::new(rocket).expect("valid rocket instance"); }
use std::collections::hash_map::RandomState; use std::collections::HashMap; use std::hash::{BuildHasher, Hash, Hasher}; use smallvec::SmallVec; pub struct UniqMap<K, V, S = RandomState> { values: HashMap<K, V, S>, lookup: HashMap<u64, SmallVec<[K; 4]>>, } impl<K: Eq + Hash + Clone, V: Eq + Hash> UniqMap<K, V...
use std::collections::HashMap; /* * Software em Rust que conta a quantidade de linhas e palavras (dividido por espaço). * Por padrão o o sotware apenas lê o arquivo texto. * –l só exibe a quantidade de linhas * –w só exibe a quantidade de palavras */ struct Cli { pattern: String, path: std::path::PathBuf, }...
//! Git repository handling for the RustSec advisory DB mod commit; #[cfg(feature = "osv-export")] mod gitpath; #[cfg(feature = "osv-export")] mod modification_time; mod repository; pub use self::{commit::Commit, repository::Repository}; use tame_index::external::gix; #[cfg(feature = "osv-export")] pub use self::{gi...
use super::{EventReceiver}; use super::xstate::{XState}; use super::{IdType, ContextType, EventType}; pub type StatesMap<'s, 'i, 'h, Id, Context, Event> = std::collections::HashMap<Id, &'s XState<'i, 'h, Id, Context, Event>>; pub type ParentsMap<Id> = std::collections::HashMap<Id, Option<Id>>; pub struct MachineStruc...
table! { characters (id) { id -> Integer, name -> Varchar, created_at -> Timestamp, updated_at -> Timestamp, deleted -> Bool, } } table! { movies (id) { id -> Integer, name -> Varchar, released_at -> Timestamp, created_at -> Timestamp,...
use memlib::hacks::interfaces; use memlib::math::{Rotation3, Vector3}; use memlib::memory::{read_memory, Address}; use super::offsets; use crate::sdk::player::Player; pub struct LocalPlayer { base: Address, player: Player, // Store a normal player object so we can call its intrinsic functions } impl LocalPla...
use std::collections::{HashMap, /* VecMap,*/ BTreeMap}; use std::hash::Hash; use std::iter::FromIterator; /// Conversion from an `Iterator` of pairs. pub trait Groupable<K, V> { /// Loops through the entire iterator, grouping all keys into a container /// implementing `FromKeyedIterator` with a container of v...
fn main() { let avcodec_version_major = ffmpeg_sys_next::LIBAVCODEC_VERSION_MAJOR; let avcodec_version_minor = ffmpeg_sys_next::LIBAVCODEC_VERSION_MINOR; let avcodec_version_micro = ffmpeg_sys_next::LIBAVCODEC_VERSION_MICRO; let ffmpeg_version = match avcodec_version_major { 57 => { if avcodec_versio...
use std::any::{TypeId, Any}; impl Message { fn get_message_type_id(&self) -> TypeId { self.get_type_id() } pub fn cast<T: Message + Sized>(self: Box<Message>) -> Option<T> { if self.get_message_type_id() == TypeId::of::<T>() { let res = unsafe { *Box::from_raw(Box::into_raw(sel...
// Copyright (C) 2019 Boyu Yang // // 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 according t...
#[doc = "Register `OPAMP2_CSR` reader"] pub type R = crate::R<OPAMP2_CSR_SPEC>; #[doc = "Register `OPAMP2_CSR` writer"] pub type W = crate::W<OPAMP2_CSR_SPEC>; #[doc = "Field `OPAMP2EN` reader - OPAMP2 enable"] pub type OPAMP2EN_R = crate::BitReader<OPAMP2EN_A>; #[doc = "OPAMP2 enable\n\nValue on reset: 0"] #[derive(Cl...
pub mod parser; pub mod db; pub mod btree; pub mod query_processor; pub mod storage_manager;
#![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 AvailabilityResponse { #[serde(default, skip_serializing_if = "Option::is_none")] pub availability: Option<...
use float_eq::assert_float_eq; use totsu::prelude::*; use totsu::*; type La = FloatGeneric<f64>; type AMatBuild = MatBuild<La>; type AProbQCQP = ProbQCQP<La>; type ASolver = Solver<La>; // #[test] fn test_qcqp1() { let _ = env_logger::builder().is_test(true).try_init(); let n = 2; // x0, x...
use crate::{ArgMatchesExt, ErrorKind, Result}; use clap::{App, Arg, ArgMatches}; use ronor::{Player, PlayerId, Sonos}; pub const NAME: &str = "modify-group"; pub fn build() -> App<'static, 'static> { App::new(NAME) .about("Add or remove logical players to/from a group") .arg(crate::household_arg()) .arg...
#![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 EaSubscriptionMigrationDate { #[serde(rename = "isGrandFatherableSubscription", default, skip_serializing_if = ...
//! # 509. 斐波那契数 //! https://leetcode-cn.com/problems/fibonacci-number/ //! 斐波那契数,通常用 F(n) 表示,形成的序列称为 斐波那契数列 。该数列由 0 和 1 开始,后面的每一项数字都是前面两项数字的和 //! # 解题思路 //! f(n) = f(n-1)+f(n-2) f(0)=0, f(1)=1 pub struct Solution; impl Solution { pub fn fib(n: i32) -> i32 { if n <= 1 { return n; } ...
use itertools::{Itertools, Combinations}; use std::collections::HashMap; use std::ops; use core::cmp::Ordering; fn main() { let mut moons = vec![ Moon { position: Position { x: -2, y: 9, z: -5, }, velocity: Velocity { ...
#[derive(Debug)] pub struct UnionFind { parent: Vec<Option<usize>>, rank: Vec<usize>, } impl UnionFind { pub fn new(size: usize) -> UnionFind { return UnionFind { parent: vec![None; size], rank: vec![0; size], } } pub fn unite(&mut self, x: usize, y: usize) ...
//! This module contains hacks around the weird data formats used by ABB RWS. use serde::Deserializer; use std::convert::TryFrom; pub trait DeserializeThroughStr: Sized { fn deserialize_through_str<'de, D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>; } impl DeserializeThroughStr for usize { fn de...
/// Contains ppm image manipulation pub mod image; /// Contains pixel manipulation pub mod pixel;
use consulator::{run, Result}; #[tokio::main] async fn main() -> Result<()> { run().await }
use std::time::Duration; use crate::{ bson::doc, client::options::ServerAddress, cmap::StreamDescription, operation::{test::handle_response_test, ListIndexes, Operation}, options::{IndexOptions, IndexVersion, ListIndexesOptions, TextIndexVersion}, IndexModel, Namespace, }; #[test] fn build...
// q0006_zigzag_conversion struct Solution; impl Solution { pub fn convert(s: String, num_rows: i32) -> String { if num_rows == 1 { return s; } let mut bufv = vec![]; for _ in 0..num_rows { bufv.push(vec![]); } let mut l = 0; let mut ...
use crate::hal::adc::{Channel, OneShot}; use crate::hal::blocking::delay::DelayUs; use core::marker::PhantomData; use crate::stm32::{ADC1, ADC2, ADC3, ADC3_COMMON}; use crate::delay::Delay; use crate::gpio::gpioa::{PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7}; use crate::gpio::gpiob::{PB0, PB1}; use crate::gpio::gpioc::{...
use std::{ collections::{HashMap, VecDeque}, io::Read, }; fn main() { let mut stdin = std::io::stdin(); let mut buf = String::new(); stdin.read_to_string(&mut buf).unwrap(); let out = solve(&buf); println!("{out}"); } fn solve(input: &str) -> String { let lines = input .lines() .map(|l| { let mut s = l...
//! Handles all x86_64 memory related issues. use memory::{Address, MemoryArea, PageFlags, PhysicalAddress, VirtualAddress}; pub mod address_space_manager; mod paging; pub use self::paging::get_free_memory_size; /// The maximum address of the lower part of the virtual address space. const VIRTUAL_LOW_MAX_ADDRESS: V...
use std::path::PathBuf; use structopt::StructOpt; use grid_vis::GridVis; use starsoldier_visualize::*; #[derive(Debug, StructOpt)] struct Opt { #[structopt(parse(from_os_str))] path_rom: PathBuf, #[structopt(parse(from_os_str))] path_out: PathBuf, } #[derive(Clone, Debug, Copy, Eq, PartialEq)] enu...
#![allow(dead_code)] #![allow(non_camel_case_types)] use super::graph::{Graph, GraphOperation, Operation, Edge}; use super::{Shape as OtherShape, new_id, TensorType, BFloat16, Tensor, AnyTensor, Result}; use num_complex::Complex as OtherComplex; use std::rc::Rc; use std::{f32, f64}; use std::marker::PhantomData; impl ...
use super::{DType, dtype::Msg, core_lib}; #[derive(Debug, Clone, PartialEq)] pub struct Environment { stack: Vec<Vec<u8>>, sp: usize, rt_stack_type: DType, ct_stack_type: DType } impl Environment { pub fn new() -> Self { Self { stack: Vec::with_capacity(0), sp: 0, ...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ use std::fs::File; use std::io::{self, BufReader, Read}; use std::{env, vec}; fn main() -> io::Result<()> { // Retrieve command-line arguments let args: Vec<String> = env::args().collect(); // Check if t...
#[macro_use] extern crate log; use std::thread::sleep; use std::time::Duration; use futures::stream; use rsocket_rust::prelude::*; use rsocket_rust::utils::EchoRSocket; use rsocket_rust::Client; use rsocket_rust_transport_tcp::{ TcpClientTransport, TcpServerTransport, UnixClientTransport, UnixServerTransport, }; ...
fn translate(s: &String) -> String { let split = s.split(" "); let mut cop_spanish = String::new(); for word in split { let mut new_word = String::from(word); let c = new_word.remove(0); new_word.push(c); new_word.push_str("ay"); println!("{}", new_word); cop_...
use super::Config; pub struct View { pub cell_width: f32, base_cell_width: f32, pub y: usize, pub x: usize, precise_y: f64, precise_x: f64, pub capture_cursor: bool, pub cells_on_width: usize, pub cells_on_height: usize, pub board_width: usize, pub board_height: usize, ...
use std::fs::File; use std::io::{BufRead, BufReader}; fn gravity(m1 : &(i64, i64, i64), m2 : &(i64, i64, i64)) -> (i64, i64, i64) { let mut gx = m2.0 - m1.0; if gx != 0 { gx /= (m2.0 - m1.0).abs(); } let mut gy = m2.1 - m1.1; if gy != 0 { gy /= (m2.1 - m1.1).abs(); } let mut...
use std::collections::HashMap; use crate::markdown::attrs::{parse_attrs, Attrs}; use itertools::{Itertools, MultiPeek}; use pulldown_cmark::{html::push_html, Event, Tag}; pub struct QuoteAttrs<'a, I: Iterator<Item = Event<'a>>> { parent: MultiPeek<I>, } impl<'a, I: Iterator<Item = Event<'a>>> QuoteAttrs<'a, I> {...
use itertools::Itertools; use std::fs::File; use std::io::Read; fn solve_part1(input: &[u32]) -> u32 { for (index, num1) in input.iter().enumerate() { for num2 in input[index..].iter() { if num1 + num2 == 2020 { return num1 * num2; } } } unreachable!(...
#[doc = "Register `RSR` reader"] pub type R = crate::R<RSR_SPEC>; #[doc = "Register `RSR` writer"] pub type W = crate::W<RSR_SPEC>; #[doc = "Field `RMVF` reader - Remove reset flag"] pub type RMVF_R = crate::BitReader<RMVF_A>; #[doc = "Remove reset flag\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)...
use super::http::{Methods, Request, Response, StatusCode}; use tokio::fs; pub struct HandleRequest { html_path: String, } impl HandleRequest { pub fn new(html_path: String) -> Self { Self { html_path } } pub async fn read_from_file(&self, file_path: &str) -> Option<String> { let path = f...
const INF: i64 = 1 << 61; use std::collections::BinaryHeap; struct Graph { edges: Vec<Vec<(usize, i64)>>, // adjacent list n: usize } impl Graph { fn new(n: usize) -> Self { Graph { edges: vec![Vec::new(); n], n: n } } fn add_costs(&mut self, from: usize, t...
mod utils; use rcc::{Opt, Program, JIT}; #[test] fn jit_readme() -> Result<(), Box<dyn std::error::Error>> { let _ = env_logger::try_init(); let path = "tests/runner-tests/readme.c"; let readme = std::fs::read_to_string(path)?; let Program { result: jit, .. } = JIT::from_string(readme, Opt::default())...
use std::collections::BTreeMap; use std::mem; use mime::Mime; pub struct Feed { pub title: String, pub id: String, pub entries: Vec<Entry>, } pub struct Meta { pub topic: Option<String>, pub hubs: Vec<String>, } pub struct Entry { pub title: Option<String>, pub id: Option<String>, pu...
use criterion::{criterion_group, criterion_main, Criterion}; use pasture_core::{ containers::{ InterleavedVecPointStorage, PerAttributeVecPointStorage, }, layout::PointType, nalgebra::Vector3, }; use pasture_derive::PointType; use pasture_algorithms::convexhull; use rand::{distributions::Uniform...
use math::{Rect, Point2, Vector2}; pub trait Painter<D> where D: ?Sized { fn paint(&self, draw: &D, rect: Rect<f32>); } pub trait Graphics { type Texture: Copy; type Color: Copy; fn quad(&self, color: Self::Color, rect: Rect<f32>); fn texture(&self, texture: Self::Texture, rect: Rect<f32>); ...
#![allow( unreachable_pub, anonymous_parameters, bad_style, const_err, dead_code, deprecated, illegal_floating_point_literal_pattern, improper_ctypes, late_bound_lifetime_arguments, missing_copy_implementations, missing_debug_implementations, // missing_docs, non_shor...
// Need rework pub fn combination_sum2_hashset(candidates: Vec<i32>, target: i32) -> Vec<Vec<i32>> { use std::collections::HashSet; let mut candidates = candidates; candidates.sort_by(|a, b| (-a).cmp(&(-b))); fn core(c: &[i32], target: i32, prefix: Vec<i32>) -> Vec<Vec<i32>> { if target == 0 { ...
mod state; mod index; mod types; mod file; mod init; mod take; mod data; use std::path; pub use types::{Snapshot, SnapshotId, FileMetadata, SnapshotLocation}; use types::SnapshotBuilder; use std::collections::HashMap; use std::collections::VecDeque; use crate::hash::Hash; // TODO: Refactor snapshots so that it is s...
use sgx_isa::{Attributes, Miscselect}; /// Information about how the sealing key was derived. This /// should be stored alongside the sealed data, so that the enclave /// can rederive the same key later. pub struct SealData { rand: [u8; 16], isvsvn: u16, cpusvn: [u8; 16], // Record attributes and miscs...
use azure_identity::token_credentials::{ClientSecretCredential, TokenCredentialOptions}; use azure_security_keyvault::KeyClient; use std::env; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let client_id = env::var("CLIENT_ID").expect("Missing CLIENT_ID environment variable."); let ...
//! MIPS CP0 EBase register register_rw!(15, 1);
#[macro_use] extern crate nom; use std::fs; use std::env; mod parser; fn main() { // Get log file location from arguments let filename = env::args().nth(1).expect("No filename supplied"); // Load the file into a &str let file_contents = fs::read_to_string(filename).unwrap(); // Run the nom parser...
use std::fmt; use crate::net::error::NetError; use crate::vm::ZKVMError; use rusqlite; use async_zmq::zmq; pub type Result<T> = std::result::Result<T, Error>; #[derive(Debug)] pub enum Error { Foo, CommitsDontAdd, InvalidCredential, TransactionPedersenCheckFailed, TokenAlreadySpent, InputTok...
#[macro_use] extern crate log; use http::Extensions; use serde::{Deserialize, Serialize}; use futures::future::BoxFuture; use trek::middleware::Logger; use trek::middleware::{Cookie, CookiesContextExt, CookiesMiddleware}; use trek::{into_box_dyn_handler, json, Context, Middleware, Resources, Response, Trek}; use tre...
use crate::{ canvas::{Drawable, Frame, Layer}, Primitive, }; use iced_native::Size; use std::{cell::RefCell, marker::PhantomData, sync::Arc}; enum State { Empty, Filled { bounds: Size, primitive: Arc<Primitive>, }, } impl Default for State { fn default() -> Self { Stat...
use std::path::{Path, PathBuf}; use rocket; use rocket::request::Request; use rocket::http::Cookies; use data::{Hunt, Team, ReleasedPuzzle, Correctness, AGuess, AddToData}; use page::{Page, file, xml, redirect, error, not_found, error_msg}; use database::Database; use forms::*; use cookies::{Puzzler}; use expandable_...
use llvm_sys::core::{LLVMInt1Type, LLVMInt8Type, LLVMInt16Type, LLVMInt32Type, LLVMInt64Type, LLVMConstInt, LLVMConstNull, LLVMConstAllOnes, LLVMIntType, LLVMGetIntTypeWidth, LLVMConstIntOfString}; use llvm_sys::prelude::LLVMTypeRef; use std::ffi::{CString, CStr}; use context::ContextRef; use types::traits::AsTypeRef...
extern crate ro_scalar_set; extern crate std; extern crate rayon; extern crate rand; extern crate memmap; #[cfg(feature="gpu")] extern crate ocl; #[cfg(feature="gpu")] use self::ocl::ProQue; #[cfg(feature="gpu")] use self::ocl::Buffer; #[cfg(feature="gpu")] use self::ocl::MemFlags; use std::slice; use memmap::{Mmap...
use ::*; use euclid::{UnknownUnit, point2}; const EPSILON: f32 = 0.001; #[test] fn circles_99() { let data = include!("./regressions/99_circles.txt"); let data = data.iter().map(|&((x1, y1), (x2, y2))| { vec![ point2::<_, UnknownUnit>(x1, y1), point2::<_, UnknownUnit>(x2, y2), ...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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>,...
#[doc = "Reader of register CH8_DBG_CTDREQ"] pub type R = crate::R<u32, super::CH8_DBG_CTDREQ>; #[doc = "Reader of field `CH8_DBG_CTDREQ`"] pub type CH8_DBG_CTDREQ_R = crate::R<u8, u8>; impl R { #[doc = "Bits 0:5"] #[inline(always)] pub fn ch8_dbg_ctdreq(&self) -> CH8_DBG_CTDREQ_R { CH8_DBG_CTDREQ_R...
// 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...
//! Sync actors support //! //! Sync actors could be used for cpu bound behavior. Only one sync actor //! runs within arbiter's thread. Sync actor process one message at a time. //! Sync arbiter can start mutiple threads with separate instance of actor in each. //! Multi consummer queue is used as a communication chann...
// src/tests is a well-known pattern: https://grep.app/search?q=%23%5Btest%5D&filter[path][0]=src/tests/&filter[lang][0]=Rust // // Note that to check that this pattern is properly supported, // you need to run cargo-llvm-cov without --remap-path-prefix flag. // (Our test suite always enables that flag.) use super::*;...
use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::model::prelude::*; use serenity::prelude::*; use serenity::model::channel::ReactionType; use tracing::{error, info}; use kekw_db::{periods, rolls, submissions}; use kekw_db::models::submission::Submission; use crate::DBConnecti...
use super::output::Output; #[derive(Debug, PartialEq)] pub enum Request { Clear(bool), Join(String), Part(String), Quit(Option<String>), ToggleNickList, ClearHistory(usize), SwitchBuffer(usize), NextBuffer, PrevBuffer, Queue(usize, Output), // buffer index Target(usize, ...
//! Lighting calculation. use crate::{input::Shader, parts::Camera}; use arctk::{ geom::{Hit, Ray}, math::Dir3, phys::Crossing, }; /// Calculate the lighting factor. #[inline] #[must_use] pub fn light<T>(shader: &Shader, cam: &Camera, ray: &Ray, hit: &Hit<T>) -> f64 { let light_dir = Dir3::new_normali...
use super::types::get_writer; use duktape::prelude::*; pub(crate) struct WriteFn; impl class::Method for WriteFn { fn argc(&self) -> i32 { 1 } fn call(&self, ctx: &Context, this: &mut class::Instance) -> DukResult<i32> { let writer = get_writer(ctx, this)?; if ctx.is(Type::Undefi...
use super::registry::Registry; use super::subscribe_loop::{ subscribe_loop, ControlCommand, ControlTx, ExitTx, SubscribeLoopParams, }; use super::subscription::Subscription; use crate::data::pubsub; use crate::runtime::Runtime; use crate::transport::Transport; use crate::PubNub; use futures_channel::{mpsc, oneshot}...
pub use self::controllers::*; mod controllers;
#[doc = "Reader of register CONTROL"] pub type R = crate::R<u32, super::CONTROL>; #[doc = "Writer for register CONTROL"] pub type W = crate::W<u32, super::CONTROL>; #[doc = "Register CONTROL `reset()`'s with value 0"] impl crate::ResetValue for super::CONTROL { type Type = u32; #[inline(always)] fn reset_va...
/* * 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 */ /// SyntheticsTestOptionsRetry : Object describing the retry strategy to apply to a Synthetic test. #...
#![allow(dead_code)] pub use crate::read::*; pub use crate::write::*; mod file_utils; pub mod read; pub mod write;
/* * 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. */ extern crate proc_macro; mod expand; mod parse; use proc_macro::TokenStream; use quote::ToTokens;...
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Solution; impl Solution { pub fn preorder_traversal(root: Option<Rc<RefCell<TreeNode>>>) -> Vec<i32> { let mut ans = Vec::new(); Self::dfs(&root, &mut ans); ans } fn dfs(root: &Option<Rc<RefCell<TreeNode>>>...
use crate::lexer::Lexer; use crate::parser::Parser; use crate::semantic_analyser::Analyse; use std::fs::{read, read_to_string}; use std::path::Path; #[test] fn affect() { test("affect"); } #[test] fn boucle() { test("boucle"); } #[test] fn expression() { test("expression"); } #[test] fn max() { test...
#[doc = "Register `VSCR` reader"] pub type R = crate::R<VSCR_SPEC>; #[doc = "Register `VSCR` writer"] pub type W = crate::W<VSCR_SPEC>; #[doc = "Field `EN` reader - EN"] pub type EN_R = crate::BitReader; #[doc = "Field `EN` writer - EN"] pub type EN_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field...
///// chapter 4 "structuring data and matching patterns" ///// program section: // fn main() { let mut numbers: Vec<i32> = Vec::new(); let magic_numbers = vec![7_i32, 42, 47, 45, 54]; numbers.push(magic_numbers[1]); numbers.push(magic_numbers[4]); ///// [42, 54] // println!("{:?}", numbers...
extern crate futures; extern crate reqwest; extern crate scraper; extern crate serde; extern crate serde_json; extern crate tokio; extern crate async_std; use async_std::prelude::*; #[macro_use] extern crate serde_derive; pub trait Timestamp { fn timestamp(&self) -> u64; } impl Timestamp for SystemTime { fn...
// Definition for a binary tree node. // #[derive(Debug, PartialEq, Eq)] // pub struct TreeNode { // pub val: i32, // pub left: Option<Rc<RefCell<TreeNode>>>, // pub right: Option<Rc<RefCell<TreeNode>>>, // } // // impl TreeNode { // #[inline] // pub fn new(val: i32) -> Self { // TreeNode { // val,...
pub mod persistence; pub mod service;
pub struct KMSHelper<'a> { client: KMSClient<'a> } impl<'a> KMSHelper<'a> { /// Creates a new KMS helper pub fn new<P: AWSCredentialsProvider + 'a>(credentials: P, region:&'a Region) -> KMSHelper<'a> { KMSHelper { client: KMSClient::new(credentials, region) } } pub fn list_keys(&mut self) -> Result<...
use std::char; use std::iter::FromIterator; pub fn multiply_strings(num1: String, num2: String) -> String { if num1 == "0" || num2 == "0" { return String::from("0"); } let mut partials: Vec<Vec<char>> = vec![Vec::new(); num1.chars().count()]; let mut carry: u32; let base = 10; for (i, c1) in num1.ch...
use crypto_markets::{fetch_symbols, get_market_types, MarketType}; #[macro_use] mod utils; const EXCHANGE_NAME: &str = "dydx"; #[test] fn fetch_all_symbols() { gen_all_symbols!(); } #[test] fn fetch_linear_swap_symbols() { let symbols = fetch_symbols(EXCHANGE_NAME, MarketType::LinearSwap).unwrap(); asse...
mod tmc { pub struct Tmc2208 { fd: String } impl Tmc2208 { pub fn make_tmc2208(file_descriptor: String) /*-> Self*/ { // TODO: Insert code that opens the file descriptor here and returns a new // tmc struct. - Austi...
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 // // ht...
use azure_identity::token_credentials::{ClientSecretCredential, TokenCredentialOptions}; use azure_security_keyvault::KeyClient; use chrono::prelude::*; use chrono::Duration; use std::env; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let client_id = env::var("CLIENT_ID").expect("Missi...
extern crate controller_rs; extern crate num_complex; extern crate pnet; use pnet::datalink::interfaces; use pnet::datalink::{channel, Channel, ChannelType, Config}; extern crate serde_yaml; use controller_rs::board_cfg::BoardCfg; use serde_yaml::{from_str, Value}; use std::env; use std::fs::File; use std::io::Read; ...
//! Contains structure which provides access to Private section of Coinbase api use futures_util::future::TryFutureExt; use hyper::header::HeaderValue; use hyper::{Body, Method, Request, Uri}; use serde_json; use std::future::Future; use std::time::{SystemTime, UNIX_EPOCH}; use uuid::Uuid; use crate::adapters::{Adapt...
//! This example shows how to use `actix_web::HttpServer::on_connect` to access a lower-level socket //! properties and pass them to a handler through request-local data. //! //! For an example of extracting a client TLS certificate, see: //! <https://github.com/actix/examples/tree/HEAD/rustls-client-cert> use std::io...
use auto_impl::auto_impl; /// This simple trait can be implemented for `Fn` types, but not for `FnMut` or /// `FnOnce` types. The latter two types require a mutable reference to `self` /// or a `self` by value to be called, but `greet()` only has an immutable /// reference. Try creating an auto-impl for `FnMut`: you s...