text
stringlengths
8
4.13M
struct LogMessageParams { type: i32, // messagetype message: String, } impl Notification for LogMessageParams { method = "window/logMessage"; }
// Copyright 2017 tokio-jsonrpc Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://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 accord...
use glam::Vec3; pub struct Light(Vec3); impl Light { pub fn new(pos: Vec3) -> Self { Light(pos) } pub fn get_pos(&self) -> Vec3 { self.0.clone() } pub fn set_pos(&mut self, pos: Vec3) { self.0 = pos; } }
use std::{borrow::Borrow, mem}; use super::*; use crate::{Error, Result}; /// Persistent array using rope-data-structure. pub struct Vector<T> where T: Sized, { len: usize, root: Ref<Node<T>>, auto_rebalance: bool, leaf_cap: usize, } impl<T> Clone for Vector<T> { fn clone(&self) -> Vector<T> ...
use bigdecimal::{BigDecimal, Zero}; use chrono::{Datelike, Local, NaiveDate}; use diesel::prelude::*; use crate::apps::index_response::Data; use crate::db::{ models::{Budget, SerializedBudget}, pagination::*, schema::budgets_budget, DatabaseQuery, PooledConnection, }; use crate::errors::DbResult; pub ...
#![feature(arbitrary_self_types, futures_api, pin)] use std::sync::mpsc::{sync_channel, SyncSender}; use std::future::{Future, FutureObj}; use std::mem::PinMut; use std::sync::{Arc, Mutex}; use std::task::{ Context, Executor, local_waker_from_nonlocal, Poll, SpawnObjError, Wake, }; struct Exe...
#![cfg_attr(not(feature = "std"), no_std)] pub mod weights; use weights::WeightInfo; #[cfg(test)] mod mock; #[cfg(test)] mod tests; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::DispatchResult, ensure, traits::{Currency, ExistenceRequirement, Get, Imbalance, OnUnbalanced, Wi...
use error::CommandResult; use source::Source; use ident::Ident; use asset::Asset; #[derive(Debug)] pub struct ReceivedAsset { pub uuid: String, pub md5: String, pub mime: String, pub name: Option<String>, pub source: Source, pub tags: Option<Vec<String>> } pub trait DataBackend { type Asse...
//! Responses from any call to the Cosmos API. #![allow(missing_docs)] mod create_collection_response; mod create_reference_attachment_response; mod create_slug_attachment_response; mod create_stored_procedure_response; mod create_trigger_response; mod create_user_defined_function_response; mod delete_attachment_resp...
use crate::{random_id, JsObject}; use js_sys::Array; use sainome::Ref; use wasm_bindgen::{prelude::*, JsCast}; #[derive(Clone)] pub enum PropertyValue { None, Num(f64), Str(String), Children(Vec<Property>), } #[derive(Clone)] pub struct Property { id: u128, name: String, is_selected_to_sho...
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers}; use rustyline::{error::ReadlineError, Editor}; pub fn read_key() -> crossterm::Result<KeyEvent> { loop { match event::read()? { Event::Key(key_event) => { return Ok(key_event); } _ => (...
use std::cell::RefCell; use std::rc::Rc; mod symbol_table; use crate::evaluator::objects; use crate::parser::ast; use crate::vm::{bytecode, opcode}; pub use symbol_table::SymbolTable; mod preludes { pub use super::super::preludes::*; } use preludes::*; #[derive(Debug, Clone, Default)] struct CompilationScope ...
use std::time::{ SystemTime }; pub fn get_id() -> String { SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap() .as_millis() .to_string() }
// 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 ...
#![feature(crate_visibility_modifier)] #[macro_use] pub mod binary_stream; pub mod binary;
#[doc = "Register `D3CCIPR` reader"] pub type R = crate::R<D3CCIPR_SPEC>; #[doc = "Register `D3CCIPR` writer"] pub type W = crate::W<D3CCIPR_SPEC>; #[doc = "Field `LPUART1SEL` reader - LPUART1 kernel clock source selection"] pub type LPUART1SEL_R = crate::FieldReader<LPUART1SEL_A>; #[doc = "LPUART1 kernel clock source ...
use crate::commands::wallet::wallet_update; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use clap::Clap; use ic_types::Principal; /// Deauthorize a wallet custodian. #[derive(Clap)] pub struct DeauthorizeOpts { /// Principal of the custodian to deauthorize. custodian: String, } ...
//! A widget for plotting a BassCalc graph //! Based on https://github.com/PistonDevelopers/conrod/blob/master/src/widget/plot_path.rs use conrod::{Color, Colorable, Positionable, Scalar, Sizeable, Widget}; use conrod::{widget, utils}; use parameters::Parameters; use functions::{BassFnData, bass_fn_point}; /// A widg...
#[macro_use] extern crate log; mod support; use self::support::*; #[test] fn inbound_sends_telemetry() { let _ = env_logger::try_init(); info!("running test server"); let srv = server::new().route("/hey", "hello").run(); let mut ctrl = controller::new(); let reports = ctrl.reports(); let pro...
/* * 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 */ /// TimeseriesWidgetDefinitionType : Type of the timeseries widget. /// Type of the timeseries widget. ...
#![allow(dead_code)] #![allow(unused_imports)] use mongodb::{ bson, bson::{doc, Bson}, // bson::document::Document, error::Result, Client }; use std::env; use futures_util::StreamExt; // use futures::future::join_all; // use futures::join; use futures::try_join; use futures::future::try_join_all; u...
use log::{debug, error}; use std::collections::HashMap; use std::fmt; use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::Arc; use async_trait::async_trait; use futures::future::Future; use nvim_rs::{create::Spawner, neovim::Neovim, Handler}; use rmpv::Value; use crate::nvim_gio::GioWriter; use crate::t...
use getopts::{Matches, Options}; use std::fs::File; use std::{env, io, process}; use vigenere::Config; fn main() { let args = env::args().collect::<Vec<String>>(); let mut opts = Options::new(); opts.optflag("h", "help", "print this help manu"); opts.optflag("d", "decipher", "decipher the message inst...
use super::deserialize::{ adjust_mods, str_to_datetime, str_to_f32, str_to_maybe_datetime, str_to_maybe_f32, }; use crate::{ util::{osu::ModSelection, CountryCode}, }; use chrono::{DateTime, Utc}; use rosu_v2::prelude::{GameMode, GameMods, Grade, RankStatus, Username}; use serde::{de::Error, Deserialize, Dese...
//! ```cargo //! [dependencies] //! rboehm = { git = "https://github.com/softdevteam/rboehm" } //! ``` extern crate rboehm; use rboehm::gc::Gc; use rboehm::BoehmAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: BoehmAllocator = BoehmAllocator; #[derive(Clone)] struct S { x: usize, } fn main() { let mu...
use crate::base::message_types::{ArchivedRkyvGenericResponse, RkyvGenericResponse}; use crate::base::ErrorCode; use rkyv::AlignedVec; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; use std::net::{IpAddr, SocketAddr}; pub fn response_or_error(buffer: &AlignedVec) -> Result<&ArchivedRkyvGe...
fn calculate_length(s: String) -> (String, usize) { let length = s.len(); (s, length) } fn calculate_length_with_reference(s: &String) -> usize { s.len() } //fn change_string(s: &String) { // s.push_str(" University"); //} // argument as &mut reference fn change_string_mut(s: &mut String) -> String { ...
pub mod shader; pub mod shader_program; pub mod texture; pub mod texture_builder; pub mod uniform;
use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct DeleteParams { #[serde(default)] #[serde(skip_serializing_if = "Option::is_none")] pub preconditions: Option<Preconditions>, } #[derive(Clone, Default, Debug, Seriali...
/// An enum to represent all characters in the Duployan block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Duployan { /// \u{1bc00}: '𛰀' LetterH, /// \u{1bc01}: '𛰁' LetterX, /// \u{1bc02}: '𛰂' LetterP, /// \u{1bc03}: '𛰃' LetterT, /// \u{1bc04}: '𛰄' LetterF, ...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::collections::HashSet; use std::str::FromStr; use std::sync::Arc; use anyhow::anyhow; use anyhow::Error; use ascii::AsciiString...
use std::path::PathBuf; use std::process::exit; #[macro_use] extern crate diesel; use failure::Fail; use structopt::StructOpt; use structopt::clap::AppSettings; #[macro_use] mod db; mod command; mod correction; mod delay; mod dictionary; mod errors; mod loader; mod pager; mod parser; mod path; mod screen; mod str_u...
// Creates and error for the current crate, aliases Result to use the new error and defines a from! macro to use for converting to // the local error type. /// # Example /// ``` /// use std::fs; /// use simpl::err; /// /// err!(ExampleError, /// { /// Io@std::io::Error; /// }); /// /// fn main() -> Resu...
// Copyright 2021 The Matrix.org Foundation C.I.C. // // 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...
//! Solutions to the challenges in Set 1. use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; use attacks; use challenges::{ChallengeResults, ChallengeResultsBuilder}; use utils::block::{BlockCipher, Algorithms, OperationModes, PaddingSchemes}; use utils::data::Data; use utils::metrics; use uti...
#![no_std] #![no_main] extern crate panic_semihosting; extern crate cortex_m_rt as rt; extern crate cortex_m_semihosting as sh; #[macro_use(entry, exception)] extern crate microbit; use core::fmt::Write; use rt::ExceptionFrame; use sh::hio; use microbit::hal::prelude::*; use microbit::hal::serial; use microbit::hal...
//! Übertool - the universal math format converter. #[cfg(feature = "mathml")] extern crate xmltree; pub mod ast; pub mod error; pub mod format;
use super::*; use std::io::Cursor; use std::thread; use std::time::Duration; #[test] fn test_connection() { const TEST_DATA: &[u8; 5] = b"12345"; thread::spawn(move|| { // Start up the server Networked::new(Cursor::new(&TEST_DATA[..]), ("127.0.0.1", 4000)) .unwrap() .li...
#![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] #![allow(non_snake_case)] // Silence warning: "`extern` block uses type `u128`, which is not FFI-safe" #![allow(improper_ctypes)] include!(concat!(env!("OUT_DIR"), "/kernel_bindings_generated.rs"));
//! Interrupt Descriptor Table functionalitity #![no_std] #![feature(abi_x86_interrupt)] #![feature(global_asm)] #![feature(asm)] /// Calls the load IDT function, loading the table into the cpu pub fn init_idt() { IDT.load(); } use coop::keyboard; use coop::mouse; use lazy_static::lazy_static; use memory::active...
// solution to r/dailyprogrammer challenge #290 [Intermediate] Blinking LEDs // https://www.reddit.com/r/dailyprogrammer/comments/5as91q/20161102_challenge_290_intermediate_blinking_leds/ // port of the c++ version use std::fs::File; use std::io::prelude::*; use std::collections::HashMap; /* grammar of our mini progr...
#[doc = "Reader of register RCC_MP_AHB6ENSETR"] pub type R = crate::R<u32, super::RCC_MP_AHB6ENSETR>; #[doc = "Writer for register RCC_MP_AHB6ENSETR"] pub type W = crate::W<u32, super::RCC_MP_AHB6ENSETR>; #[doc = "Register RCC_MP_AHB6ENSETR `reset()`'s with value 0"] impl crate::ResetValue for super::RCC_MP_AHB6ENSETR ...
use super::*; use std::sync::Arc; use tokio::sync::Mutex; use util::Error; use waitgroup::WaitGroup; #[tokio::test] async fn test_random_generator_collision() -> Result<(), Error> { let test_cases = vec![ ( "CandidateID", 0, /*||-> String { generate_cand_id() ...
/* * 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 */ /// WidgetTime : Time setting for the widget. #[derive(Clone, Debug, PartialEq, Serialize, Deserializ...
use perseus::{link, t}; use sycamore::prelude::Template as SycamoreTemplate; use sycamore::prelude::*; pub static COPYRIGHT_YEARS: &str = "2021"; #[component(NavLinks<G>)] pub fn nav_links() -> SycamoreTemplate<G> { template! { // TODO fix overly left alignment here on mobile li(class = "m-3 p-1")...
#[path = "../error.rs"] mod error; #[path = "../requests/mod.rs"] mod requests; #[path = "../trace.rs"] mod trace; #[path = "../vtubers.rs"] mod vtubers; use chrono::{DateTime, Utc}; use reqwest::Client; use sqlx::PgPool; use std::env; use tracing_appender::rolling::Rotation; use crate::error::Result; use crate::vtub...
pub fn run() { let age: u8 = 28; let check_id: bool = true; // if/Slse if age >= 21 && check_id { println!("What do you wants drink "); } else if age <= 18 && check_id { println!("You can not get drink"); } // Shorthand if let is_of_age = if age > 21 { true } else { ...
use crate::matcher::Matcher; use crate::name_generator::{NameGenerator, NameGeneratorError}; use std::error::Error; use std::fmt::Display; use std::fs::{read_dir, rename}; use std::path::Path; use std::{fmt, io}; #[cfg(test)] use mockiato::mockable; #[derive(Debug)] pub(crate) enum RenamerError { IoError(io::Erro...
#![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 operations { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub async f...
pub mod indexing; pub mod init; pub mod validate;
use ggez::Context; use ggez::graphics::{Canvas,MeshBuilder,DrawMode,DrawParam,Rect,Color,set_canvas,draw}; use ggez::nalgebra::Point2; use crate::common::{Point,randrange}; pub struct Background { canvas: Canvas, stars: Vec<Star>, } struct Star { pos: Point, speed: f32, } impl Star { fn new(pos: ...
use ipfs::{Block, Ipfs, IpfsOptions, TestTypes}; use std::convert::TryInto; use futures::{FutureExt, TryFutureExt}; fn main() { let options = IpfsOptions::<TestTypes>::default(); env_logger::Builder::new().parse_filters(&options.ipfs_log).init(); tokio::runtime::current_thread::block_on_all(async move { ...
// 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. //! Manages services // In case we roll the toolchain and something we're using as a feature has been // stabilized. #![allow(stable_features)] // TODO(dp...
#[doc = "Reader of register FMC_CSQCFGR1"] pub type R = crate::R<u32, super::FMC_CSQCFGR1>; #[doc = "Writer for register FMC_CSQCFGR1"] pub type W = crate::W<u32, super::FMC_CSQCFGR1>; #[doc = "Register FMC_CSQCFGR1 `reset()`'s with value 0"] impl crate::ResetValue for super::FMC_CSQCFGR1 { type Type = u32; #[i...
//! Time Series definitions //! use chrono::prelude::{UTC, DateTime}; use chrono::TimeZone; #[derive(Debug, PartialEq)] pub struct DataPoint { index: DateTime<UTC>, value: f64 } #[derive(Debug, PartialEq)] pub struct TimeSeries { data: Vec<DataPoint>, } impl DataPoint { pub fn new(idx: DateTime<UT...
// Copyright 2020 The Grin 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 agree...
use crate::utils::translators; fn encode_hex_vec(buf: Vec<u32>) -> String { let mut buf_size = 0; let mut byte_buf: u32 = 0; let mut encoded: String = String::new(); for b in buf { buf_size += 1; byte_buf |= b; if buf_size == 6 { let encoding = encode_match(byte_bu...
pub mod euler_library; pub mod tests;
use chrono::NaiveDateTime; use uuid::Uuid; use models; // Create #[derive(Debug, Serialize)] pub struct CreateResponse { id: Uuid, data: CreateResponseData, } impl CreateResponse { pub fn new(room: &models::Room) -> CreateResponse { CreateResponse { id: room.id, data: Cre...
use unftp_sbe_fs::ServerExt; #[tokio::main] pub async fn main() { pretty_env_logger::init(); let addr = "127.0.0.1:2121"; let server = libunftp::Server::with_fs(std::env::temp_dir()); println!("Starting ftp server on {}", addr); server.listen(addr).await.unwrap(); }
use crate::display::DisplayWith; use crate::grammar::Grammar; use crate::grammar::NonterminalIndex; use crate::grammar::RuleIndex; use crate::grammar::TerminalIndex; use crate::utility::vec_with_size; use serde::Deserialize; use serde::Serialize; use std::fmt; use std::iter; use std::ops; #[derive(Serialize, Deseriali...
#[doc = "Reader of register INTS"] pub type R = crate::R<u32, super::INTS>; #[doc = "Reader of field `EP_STALL_NAK`"] pub type EP_STALL_NAK_R = crate::R<bool, bool>; #[doc = "Reader of field `ABORT_DONE`"] pub type ABORT_DONE_R = crate::R<bool, bool>; #[doc = "Reader of field `DEV_SOF`"] pub type DEV_SOF_R = crate::R<b...
use std::sync::{Arc, Mutex}; use std::net::{TcpListener, TcpStream}; use std::error::Error; use std::io::Write; use chrono::prelude::*; use logging::MessageType; pub(crate) struct StreamPackage{ stream: TcpStream, time_stamp: DateTime<Utc>, //Check out time libraries, } pub(crate) struct StreamQueue{ pac...
use failure::Error; fn first_answer() { let mut board: Vec<usize> = vec![3, 7]; let mut elf1 = 0; let mut elf2 = 1; let mut digits: Vec<usize> = Vec::new(); let after = 768071; while board.len() < after + 10 { let score1 = board[elf1]; let score2 = board[elf2]; let mut...
#[doc = "Register `CR1` reader"] pub type R = crate::R<CR1_SPEC>; #[doc = "Register `CR1` writer"] pub type W = crate::W<CR1_SPEC>; #[doc = "Field `LPMS` reader - Low-power mode selection These bits select the low-power mode entered when CPU enters deepsleep mode. 1XX: Shutdown mode"] pub type LPMS_R = crate::FieldRead...
#![doc = include_str!("../README.md")] use anyhow::{anyhow, Context, Result}; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::path::PathBuf; use std::{env, fs}; /// Holds the contents of tree-sitter's configuration file. /// /// The file typically lives at `~/.config/tree-sitter/config.json`, but...
use gtk::glib; use gtk::prelude::*; use sysinfo::{Pid, PidExt, Process, ProcessExt}; use crate::utils::format_number; use std::cell::Cell; use std::collections::HashMap; use std::rc::Rc; #[allow(dead_code)] pub struct Procs { pub left_tree: gtk::TreeView, pub scroll: gtk::ScrolledWindow, pub current_pid...
// Pasts // // Copyright (c) 2019-2020 Jeron Aldaron Lau // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // https://apache.org/licenses/LICENSE-2.0>, or the Zlib License, <LICENSE-ZLIB // or http://opensource.org/licenses/Zlib>, at your option. This file may not be // copied, modified, or distr...
use std::fmt::{self, Debug, Error, Formatter}; use std::{error, result}; pub type Id = String; #[derive(PartialEq, Eq, Ord, Hash, PartialOrd, Copy, Clone)] pub enum Op2 { LT, GT, LTE, GTE, Eq, Add, Sub, Mul, And, Or, Impl, Iff, } #[derive(PartialEq, Eq, Hash, Debug, Co...
use std::{ convert::TryFrom, fmt::Debug, ops::{Deref, DerefMut}, }; use crate::{ restriction::Restrictions, util::{impl_deref_wrapped, impl_try_from_repeated}, }; use librespot_core::date::Date; use librespot_protocol as protocol; use protocol::metadata::SalePeriod as SalePeriodMessage; #[derive...
#[doc = "Reader of register TEMP_CFGR1"] pub type R = crate::R<u32, super::TEMP_CFGR1>; #[doc = "Writer for register TEMP_CFGR1"] pub type W = crate::W<u32, super::TEMP_CFGR1>; #[doc = "Register TEMP_CFGR1 `reset()`'s with value 0"] impl crate::ResetValue for super::TEMP_CFGR1 { type Type = u32; #[inline(always...
// Copyright (C) 2021 Subspace Labs, Inc. // SPDX-License-Identifier: GPL-3.0-or-later // 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 Foundation, either version 3 of the License, or // (at your option)...
//! Weechat Configuration module use libc::{c_char, c_int}; use std::collections::HashMap; use std::ffi::CStr; use std::os::raw::c_void; use std::ptr; use crate::config_options::{ BooleanOption, ColorOption, ConfigOption, IntegerOption, OptionDescription, OptionPointers, OptionType, StringOption, }; use crate...
use crate::{ kzg10, multiset::{multiset_equality, quotient_poly, MultiSet}, transcript::TranscriptProtocol, }; use ark_bls12_381::{Bls12_381, Fr}; use ark_poly::{ polynomial::univariate::DensePolynomial as Polynomial, EvaluationDomain, Polynomial as Poly, Radix2EvaluationDomain, UVPolynomial, }; use...
// error-pattern:ran out of stack // Test that the task fails after hiting the recursion limit fn main() { main(); }
//! # riff //! //! `riff` provides utility methods for reading and writing RIFF-formatted files, //! such as Microsoft Wave, AVI or DLS files. use std::fmt; use std::io::Read; use std::io::Write; use std::io::Seek; use std::io::SeekFrom; use std::convert::TryInto; /// A chunk id, also known as FourCC #[derive(Partia...
use crate::account::responses::ListBlobsByTagsResponse; use crate::core::prelude::*; use azure_core::headers::add_optional_header; use azure_core::prelude::*; use std::convert::TryInto; #[derive(Debug, Clone)] pub struct FindBlobsByTagsBuilder<'a> { client: &'a StorageClient, expression: String, lease_id: ...
#![allow(dead_code)] use veccentric::Fecc; use std::time::Instant; use pixels::{Error, Pixels, SurfaceTexture}; use winit::{ dpi::LogicalSize, event::{Event, VirtualKeyCode}, event_loop::{ControlFlow, EventLoop}, window::WindowBuilder, }; use winit_input_helper::WinitInputHelper; pub const WIDTH: u32...
//! GLL Grammar state and SPPF structure /// Re-exported `petgraph` structs to avoid requiring dependency of generated code on it. pub use petgraph::{dot::Dot, Directed, Graph}; use petgraph::{ graph::{EdgeReference, NodeIndex}, visit::EdgeRef, }; use std::collections::{BTreeMap, BTreeSet}; use std::fmt::{Debu...
#![feature(test)] extern crate test; #[cfg(test)] mod benchmarks;
use std::fmt; use std::fmt::Debug; use serde::de; use serde::de::Deserialize; use serde::de::Deserializer; use serde::de::MapAccess; use serde::de::SeqAccess; use serde::de::Visitor; use serde::ser::Serialize; use serde::ser::SerializeStruct; use serde::ser::Serializer; pub type MortonCode = u32; pub type MortonValue...
fn main() { // 型を複数持つタプルが作れるというか、複数の型の値を扱うための機能 let a: (isize, f64, &str) = (1, 1.0, "abc"); println!("{},{},{}", a.0, a.1, a.2); //println!("{:?},{:?},{:?}", a[0], a[1], a[2]); }
/* * 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 */ /// FormulaAndFunctionQueryDefinition : A formula and function query. #[derive(Clone, Debug, PartialE...
use crate::prelude::*; #[derive(Debug)] struct DespawnCommand(pub Entity); pub fn despawn_entities_system(world: &mut World) { let entities = world .query::<&DespawnCommand>() .into_iter() .map(|(_, cmd)| cmd.0) .collect::<Vec<_>>(); despawn_entities(world, entities); } fn de...
use std::fmt::{Display,Formatter}; use std::sync::mpsc::Sender; use std::sync::{Arc,Mutex}; use std::thread; use std::time::SystemTime; use std::time::Duration; use Payload; use sensor_lib::TempHumidityValue; use linux_hal::{I2cdev, Delay}; use linux_hal::i2cdev::linux::LinuxI2CError; use htu21d::HTU21D; use htu21d:...
// Copyright © 2019 Cormac O'Brien. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish,...
use std::io; use std::str::FromStr; use crate::base::Part; pub fn part1(r: &mut dyn io::Read) -> Result<String, String> { solve(r, Part::One) } pub fn part2(r: &mut dyn io::Read) -> Result<String, String> { solve(r, Part::Two) } fn solve(r: &mut dyn io::Read, part: Part) -> Result<String, String> { let ...
use regex::Regex; use std::env; use std::fs; fn main() { let args: Vec<String> = env::args().collect(); let filename = &args[1]; let contents = fs::read_to_string(filename).expect("Something went wrong reading the file"); let lines: Vec<&str> = contents.lines().collect(); let mut bags = Vec::new(...
use super::{ apis::alpha_vantage, clock, config, strategies, trading::{Account, Broker, PriceData}, }; pub struct BacktestBroker { capital: f64, } impl Broker for BacktestBroker { fn capital(&mut self, _time: clock::LocalDateTime) -> f64 { self.capital } fn unsettled_cash(&self) -...
#![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 OperationDisplay { #[serde(default, skip_serializing_if = "Option::is_none")] pub provider: Option<String>,...
pub mod animation; pub mod collision; pub mod input; pub mod objects; pub mod screen; pub mod sprite; pub mod text; pub mod texture;
use serde::Deserialize; use serde::Serialize; #[derive(Serialize, Deserialize, Debug)] pub struct SubscribeBody { pub id: String, // Your channel ID. pub uri: String, // Ex: "https://mydomain.com/notifications". Your receiving URL. pub token: Option<String>, // Ex: "target=myApp-myCalend...
extern crate dmbc; extern crate exonum; pub mod utils; use exonum::blockchain::Transaction; use exonum::crypto::{PublicKey, SecretKey}; use exonum::encoding::serialize::FromHex; use dmbc::currency::assets::{AssetBundle, AssetId}; use dmbc::currency::transactions::builders::transaction; #[test] fn capi_transfer_fees...
extern crate bincode; extern crate num; extern crate rand; extern crate rustfft; use self::bincode::rustc_serialize::{decode_from, encode_into}; use self::bincode::SizeLimit; use self::rustfft::algorithm::Radix4; use self::rustfft::num_complex::Complex; use self::rustfft::num_traits::Zero; use self::rustfft::FFT; use ...
pub(crate) mod v4 { use lazy_static::lazy_static; use reqwest::Client; use std::time::Duration; use super::ApiError; const GITHUB_API_V4_URL: &str = "https://api.github.com/graphql"; const USER_AGENT: &str = "giss"; lazy_static! { pub static ref CLIENT: Client = Client::builder() ...
// Copyright 2020 The RustExample Authors. // // Code is licensed under Apache License, Version 2.0. use anyhow::Result; pub static APP_USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"; pub static GET_URL_INTERVAL:u64 = 2; trait Index { ...
use backend::{color, Color}; use widget::Widget; use Event; pub trait App { type UI: Widget; type MyEvent: Send; fn widget(&self) -> Self::UI; // TODO need an enum for this fn handle_event(&mut self, Event<Self::MyEvent>) -> Result<(), Option<String>>; fn style(&self, &str) -> (Option<Box<Color...
use hlist::*; use ty::{ Infer, TmPre, infer, }; use ty::op::{ Eval, Thunk, }; /// Partially apply a thunk to an argument or evaluate a constant /// (i.e., operation symbol) #[rustc_on_unimplemented = "`{Fx}` cannot be applied to `{Self}`"] pub trait AppEval<M, FxDTy, Fx>: TmPre<FxDTy> where F...
pub(crate) use ser::TychoSerializer; pub(crate) mod ser; pub(crate) mod seq; pub(crate) mod variant; pub(crate) mod map; pub(crate) mod struct_;
//! Traits needed in order to implement a riddle compatible platform //! system. //! //! If you are consuming `riddle` directly, there should be no need to use this module. mod window; pub use window::*;