text
stringlengths
8
4.13M
ApBegin(RS,CLSID_TODOLISTAPP) WndBegin(TODOLIST_WND_TODOLIST) WdgBegin(CLSID_VTMMENU,ToDoListVtmMenu) VtmCreateMenuRC({IMG_NULL_ID, TXT_LTL_N_TODO_LIST, WDG_MENU_TYPE_NORMAL, WDG_MENU_ITEM_TYPE_IMAGETEXT_IMAGE, WDG_MENU_CHECK_STYLE_NONE, 0, 0, 0}) WdgEnd(CLSID_VTMMENU,ToDoListVtmMenu) ...
// Copyright 2012 Google Inc. // Copyright 2020 Yevhenii Reizner // // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use super::Scalar64; #[cfg(all(not(feature = "std"), feature = "no-std-float"))] use tiny_skia_path::NoStdFloat; pub fn push_valid_ts(s: &[f64], ...
mod fast_input; use fast_input::FastInput; use std::collections::{HashSet}; mod union_find; use union_find::UnionFind; use std::io::{prelude::*, stdout, BufWriter}; struct Canvas { map: Vec<u16>, length: usize, height: usize, parts: UnionFind, roots: HashSet<usize>, moves: Vec<...
use crate::utils::ToSimpleString; use std::cmp::PartialEq; use std::fmt; use std::ops::{Index, IndexMut}; #[derive(Debug, PartialEq)] pub enum TokenType { Id(String), // ([a-z|A-Z|_])([a-z|A-Z|_|0-9])* Number(u64), // [0-9][0-9]* Type(String), If, // 'if' Else, // 'else' For, // 'for' ...
use std::pin::Pin; use std::task::{Context, Poll}; /// This adapts from `hyper` IO traits to the ones in Tokio. /// /// This is currently used by `h2`, and by hyper internal unit tests. #[derive(Debug)] pub(crate) struct Compat<T>(pub(crate) T); pub(crate) fn compat<T>(io: T) -> Compat<T> { Compat(io) } impl<T> ...
#[doc = "Register `PCFA` reader"] pub struct R(crate::R<PCFA_SPEC>); impl core::ops::Deref for R { type Target = crate::R<PCFA_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<PCFA_SPEC>> for R { #[inline(always)] fn from(reader: crate::R<PCFA_SP...
use alloc::borrow::Cow; use crate::read::{ self, Architecture, CompressedData, FileFlags, Relocation, Result, SectionFlags, SectionIndex, SectionKind, Symbol, SymbolIndex, SymbolMap, }; use crate::Endianness; /// An object file. pub trait Object<'data, 'file>: read::private::Sealed { /// A segment in the ...
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // Contributed by Matt Brubeck // Contributed by TeXitoi // Inspired by Mr Ledrug's C version and thestinger's rust-gmp #![allow(non_camel_case_types)] use std::os::raw::{c_int, c_ulong, c_void}; use std::mem::uninitialized; use s...
// We can use the Result enum to handle recoverable errors, like trying to write // to a file that doesn't exist. use std::fs::File; use std::io; use std::io::ErrorKind; use std::io::Read; // This way we manually handle errors and return early if there's an error reading // the file. fn read_username_from_file() -> R...
use chrono::{self, DateTime, Local}; use chrono_humanize::{Accuracy, HumanTime, Tense}; use rocket_dyn_templates::tera::{Error, Result, Value}; use std::collections::HashMap; pub fn humanise(value: &Value, _: &HashMap<String, Value>) -> Result<Value> { let input = match value { Value::String(string) => Ok(...
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "LTC Mode Register (PublicKey) LTC Mode Register (non-PKHA/non-RNG use)"] pub ltc0: LTC0_UNION, _reserved1: [u8; 4usize], #[doc = "0x08 - LTC Key Size Register"] pub ltc0_ks: LTC0_KS, _reserved2: [u8; 4usize], #[doc = ...
use anyhow::Error; use escargot::CargoBuild; use std::result; use std::process::{Command, Output}; pub type TResult = result::Result<(), Error>; pub type Result<T> = result::Result<T, Error>; pub const DOCKER_IMAGE: &str = "debian:buster-slim"; pub const INST_BIN: &str = "/usr/bin/dau"; pub const TESTUSER: &str = "...
use crate::{ database::{Actor as DbActor, OAuthApplication, Object as DbObject}, error::Error, format_uuid, state::ArcState, }; use async_trait::async_trait; use axum::response::IntoResponse; use itertools::Itertools; use serde::Serialize; use tranquility_types::{ activitypub::{Activity, Actor, Obje...
use std::env; use std::fs::File; use std::io::{BufRead, BufReader, Result}; use std::path::Path; fn main() -> Result<()> { let root = env::var("ROOT").unwrap(); let path = root.to_string() + "/2018/day1/input"; let file = File::open(&Path::new(&path))?; let mut numbers: Vec<i32> = vec![]; for line ...
#![no_main] #![no_std] #[allow(unused_imports)] use panic_semihosting; use cortex_m_semihosting::{debug, hprintln}; use rtfm::app; #[cfg(feature = "52810")] use nrf52810_hal as hal; #[cfg(feature = "52832")] use nrf52832_hal as hal; #[cfg(feature = "52840")] use nrf52840_hal as hal; #[app(device = crate::hal::ta...
use crate::linear_space::LinearSpace; use crate::utils::HasLen; use num_traits::Float; use std::ops::{Add, Mul, Sub}; use std::ops::{Index, IndexMut}; #[derive(Clone)] pub struct McmcVec<T, V>(pub V) where T: Float, V: Clone + IndexMut<usize, Output = T> + HasLen + Sized; impl<'a, T, V> Add<&'a McmcVec<T, V>>...
pub fn reverse(input: &str) -> String { let mut ret : String = String::new(); for c in input.chars() { println!("char is {}", c); ret.insert(0, c); } return ret; }
pub type SessionIndex = u32; pub type MiningPower = u128; pub trait MiningPowerBuilder<AccountId> { fn add_mining_power(target: &AccountId, power: MiningPower); fn add_session_total_mining_power(power: MiningPower); }
use serde::{Deserialize, Deserializer}; fn null_to_default<'de, D, T>(d: D) -> Result<T, D::Error> where D: Deserializer<'de>, T: Default + Deserialize<'de>, { let opt = Option::deserialize(d)?; let val = opt.unwrap_or_else(T::default); Ok(val) } pub struct FeedEvent { pub id: Uuid, #[serd...
//use util::Point; use crate::util::{gcd, Point}; use std::collections::HashMap; fn simplify(x: i32, y: i32) -> (i32, i32) { let divisor = gcd(x as i64, y as i64).abs(); (x / divisor as i32, y / divisor as i32) } // Using the same function for part 1 and part 2, so this needs to // return all other asteroids ...
use super::fs; use super::transpiler; use anyhow::Error; use regex::Regex; pub struct Transpiler {} impl Transpiler { pub fn new() -> Self { Self {} } } lazy_static! { static ref ERROR_REGEX: Regex = Regex::new(r"^(\s*)([^\s]*?)\s*:?=(.*)\?").expect("Invalid regex"); static ref MAP_RE...
use error_chain::error_chain; error_chain! { types { AteError, AteErrorKind, ResultExt, Result; } links { BusError(super::BusError, super::BusErrorKind); ChainCreationError(super::ChainCreationError, super::ChainCreationErrorKind); CommitError(super::CommitError, super::Comm...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct HardwareStatus { #[serde(rename = "status")] pub status: Option<Vec <crate::models::HardwareStatusStatusItem>>, }
use crate::{error::HresultExt, util::Service, AimpString, Result}; use iaimp::{ComInterface, ComPtr, ComRc, CorePath, IAIMPCore, IUnknown, IID}; use std::mem::MaybeUninit; pub static CORE: Service<Core> = Service::without_lock(); #[derive(Debug, Clone)] pub struct Core(ComPtr<dyn IAIMPCore>); impl Core { pub(cra...
use crate::visual::glfw::Glfw; use crate::visual::vector::Mat4; use std::ffi::{c_void, CString}; use std::mem::size_of; use std::ptr::{null, null_mut}; use std::slice; use crate::visual::generated::gl; use crate::visual::generated::gl::types::{GLchar, GLint, GLuint}; use crate::visual::generated::gl::Gles2; use super...
use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum Status { Pass, Fail, Error, } #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct TestResult { pub name: String, pub status: Status, p...
//! Helpers for dealing with time, especially in relation to systemd use std::convert::TryInto; use chrono::{DateTime, TimeZone, Utc}; use libc; /// Converts a timestamp represented as microseconds since the UTC UNIX epoch to a `DateTime`. pub fn from_timestamp_usecs(usecs: u64) -> DateTime<Utc> { Utc.timestamp_n...
use std::iter::repeat; use std::str::FromStr; use rand::thread_rng; use super::alloy::Alloy; use super::error::LatticeError; use super::mask::Mask; use super::site::Site; use super::util::Axis; use super::vertex::Vertex; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct Lattice...
mod common; mod entries; mod help; pub mod page; pub mod util; pub mod widgets; use common::*; use entries::draw_entries; use help::draw_help; pub use page::{draw_disconnected_page, draw_page}; use util::terminal_too_small; pub use util::{clean_terminal, prepare_terminal, Rect}; use widgets::{ContextMenuWidget, Volume...
pub mod frame; mod local_vars; pub mod operand_stack; pub mod slot; mod stack; pub mod thread;
#[cfg(test)] extern crate hamcrest; extern crate regex; extern crate term; mod tap; use std::io::{self, BufRead}; use tap::{TapHarness, TestState}; // flag to disable colorized output fn main() { let stdin = io::stdin(); let stdin_lines = stdin.lock().lines(); let mut term = term::stdout().unwrap(); ...
extern crate rand; use std::{io}; use self::rand::OsRng; pub fn os_rng() -> bool { match OsRng::new() { Ok(_) => true, Err(mut err) => { if let Some(err) = err.take_cause() { if let Some(err) = err.downcast_ref::<io::Error>() { if err.kind() == io::...
use crate::{ algebra::{Matrix4, Vector3}, math::{aabb::AxisAlignedBoundingBox, plane::Plane}, visitor::{Visit, VisitResult, Visitor}, }; use nalgebra::Point3; #[derive(Copy, Clone, Debug, PartialEq)] pub struct Frustum { /// 0 - left, 1 - right, 2 - top, 3 - bottom, 4 - far, 5 - near planes: [Plane...
#[aoc_generator(day25)] fn parse_input(input: &str) -> (u64, u64) { let mut lines = input.lines(); ( lines.next().unwrap().parse::<u64>().unwrap(), lines.next().unwrap().parse::<u64>().unwrap(), ) } #[aoc(day25, part1)] fn part1(input: &(u64, u64)) -> u64 { let subject_num = 7; xfor...
use super::{Domain, ValueType, Var}; use crate::counting_sat::{Lit, CSAT}; use crate::csp::CSP; use crate::fd::{Reify, FD}; use std::collections::HashMap; use std::ops::Index; use std::time::{Duration, Instant}; impl ValueType for usize {} pub fn roadtrip(vcount: usize, edges: &[(usize, usize, u32)]) -> (Vec<usize>, ...
//! Different iterators to retry using mod constant; mod exponential; mod immediate; pub use constant::*; pub use exponential::*; pub use immediate::*;
#[macro_use] extern crate glium; mod event; mod event_controller; mod shifter_mode; #[macro_use] pub mod macros; mod intermediate_state; mod parent; mod polyshapes; mod receiver; mod renderer; mod shapes; mod state; mod state_controller; mod state_shifter; mod state_transition; mod traits; mod types; pub mod utils; mo...
use std::collections::hash_map::HashMap; fn count_chars(box_id: &str) -> HashMap<char, i32> { let mut map = HashMap::new(); for c in box_id.chars() { *map.entry(c).or_insert(0) += 1; } map } fn hamming_distance(str1: &str, str2: &str) -> i32 { // Assumes str1 and str2 are equal length ...
use std::collections::HashMap; fn fib(n: u8) -> u32 { if n == 1 || n == 2 { return 1; } fib(n - 1) + fib(n - 2) } fn memoized_fib(n: u8, mut memo: &mut HashMap<u8, u128>) -> u128 { if memo.contains_key(&n) { return memo[&n] } if n == 1 || n == 2 { return 1; } let fib_num = memoized_fib(...
use dotenv::dotenv; #[cfg(test)] use mocktopus::macros::*; #[derive(Debug)] pub enum ConfigValidationError { Io(std::io::ErrorKind), MixedEnv(String), DotenvParsing(String), } #[cfg_attr(test, mockable)] fn dotenv_wrapper() -> dotenv::Result<std::path::PathBuf> { dotenv() } pub fn validate_config(env...
use std::collections::VecDeque; use std::time::{Duration, Instant, SystemTime}; // Measures Frames Per Second (FPS). pub struct FPSCounter { last_second_frames: VecDeque<Instant>, last_display: SystemTime, } impl FPSCounter { // Creates a new FPSCounter. pub fn new() -> FPSCounter { FPSCounter...
use std::collections::HashMap; use noodles_bgzf as bgzf; use super::{ bin::{self, Chunk}, Bin, ReferenceSequence, }; const WINDOW_SIZE: u32 = 16384; #[derive(Debug, Default)] pub struct Builder { bin_builders: HashMap<u32, bin::Builder>, intervals: Vec<bgzf::VirtualPosition>, } impl Builder { p...
#![feature(asm, start)] #![no_std] extern crate zinc; extern crate zinc_macro; #[zinc_macro::zinc_main] fn main() { use zinc::hal::mem_init::{init_data, init_stack}; init_data(); unsafe { init_stack() }; unsafe { asm!("nop") } }
use hackrfone::{ iq_to_cplx_f32, // build this example with "--features num-complex" num_complex::Complex32, // build this example with "--features num-complex" HackRfOne, RxMode, UnknownMode, }; use std::{ sync::mpsc::{self, TryRecvError}, thread, }; fn main() { let mut radio: ...
pub use self::neuralnetwork::NeuralNetwork; // pub use self::neuralblock::NeuralBlock; pub use self::layer::*; pub use self::learnertraits::*; pub use self::activation_layer::*; mod neuralnetwork; // mod neuralblock; mod layer; mod learnertraits; mod activation_layer;
use std::collections::BinaryHeap; #[derive(Debug)] pub struct HighScores<'a> { scores: &'a[u32], } impl<'a> HighScores<'a> { pub fn new(scores: &'a [u32]) -> Self { HighScores { scores } } pub fn scores(&self) -> &[u32] { self.scores } pub fn latest(&self)...
/// The font data here must be in the same order as the `Char` enum. This is /// the cp850-8x16 font from FreeBSD. See /// http://web.mit.edu/freebsd/head/share/syscons/fonts/cp850-8x16.fnt /// /// The compilation of software known as FreeBSD is distributed under the /// following terms: /// /// Copyright (c) 1992-2014...
// Copyright (c) IxMilia. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. use std::fmt; use std::fmt::{ Debug, Formatter, }; use ::CodePairValue; /// The basic primitive of a DXF file; a code indicating the type of the data ...
#![feature(io)] #![feature(core)] use tgaimage::Image; use model::Model; use render::Renderer; mod tgaimage; mod geom; mod vec; mod model; mod render; mod zbuffer; fn main() { let width = 800; let height = 800; let mut img = Image::new(width, height, 3); let model = Model::new("african_head.obj").unw...
use std::io::*; use util::Scanner; fn main() { std::thread::Builder::new() .stack_size(1048576) .spawn(solve) .unwrap() .join() .unwrap(); } fn solve() { let cin = stdin(); let cin = cin.lock(); let mut sc = Scanner::new(cin); let n: usize = sc.read(); ...
extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate libc; use self::libc::{c_char}; use std::ffi::{CStr, CString}; use db::tables::schema::{todosettings}; #[derive( Serialize, Deserialize, Debug, Default, PartialEq, Queryable, AsChangeset, Identifiable, )] #[table_name = "todosett...
use std::{convert::TryInto, fmt, ops}; /// Liquid's native date only type. #[derive( Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize, )] #[serde(transparent)] pub struct Date { #[serde(with = "friendly_date")] pub(crate) inner: DateImpl, } type DateImpl = tim...
use failure::Fallible; fn main() { println!("Fibonacci series"); loop { println!("Enter position for Fibo series"); match read_number() { Ok(n) => println!("the {}th fibo number is {}", n, fibo(n)), Err(e) => println!("error: {}", e), } } } fn read_number() ...
use crate::event::{DragEvent, EventListener, EventState, ZoomEvent}; use crate::map::Map; use std::cell::RefCell; use std::rc::Rc; use winit::event::MouseButton; #[derive(Default)] pub struct DefaultMapControl { map: Option<Rc<RefCell<Map>>>, handlers: HandlerIds, } #[derive(Debug, Default)] struct HandlerIds...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct Digest { pub room_id: u64, pub member_id: u64, pub outbound: Bundle, pub inbound: Bundle } #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct ...
// Code by Johannes Schickling <schickling.j@gmail.com>, // https://github.com/schickling/rust-examples/tree/master/snake-ncurses // minor revisions accoring to changed rust-spedicifactions were made in // order to successfully compile the code, game.rs and main.rs were // merged into specialcrate.rs. Code was publishe...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Softwa...
/* * @lc app=leetcode id=35 lang=rust * * [35] Search Insert Position * * https://leetcode.com/problems/search-insert-position/description/ * * algorithms * Easy (41.10%) * Total Accepted: 482.6K * Total Submissions: 1.2M * Testcase Example: '[1,3,5,6]\n5' * * Given a sorted array and a target value, r...
use anyhow::{ensure, Result}; use async_trait::async_trait; use crate::node::store::iface::DynUserStore; pub struct UserService { store: DynUserStore, } impl UserService { pub fn new(store: DynUserStore) -> Self { Self { store } } } #[async_trait] impl interface::UserManagement for UserService {...
//! Game of Life //! //! Rules: //! //! Any live cell with fewer than two live neighbours dies, as if by underpopulation. //! Any live cell with two or three live neighbours lives on to the next generation. //! Any live cell with more than three live neighbours dies, as if by overpopulation. //! Any dead cell w...
use mio::{Events, Token}; use super::{Platform, EventSource, EventHandler}; pub struct EventSources<P: Platform> { poll: mio::Poll, slab: slab::Slab<P::Source>, } #[derive(Debug)] pub enum Error { Mio(std::io::Error), } impl From<std::io::Error> for Error { fn from(err: std::io::Error) -> Self { Erro...
use crate::{app, opts}; use anyhow::{Context, Result}; use std::time::Duration; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, sync::mpsc::*, }; pub async fn run_server<P: AsRef<std::path::Path>>(evt_send: UnboundedSender<app::DaemonCommand>, socket_path: P) -> Result<()> { let socket_path = socket_path.a...
use crate::error::Error; use async_trait::async_trait; use sqlx::PgPool; use time::OffsetDateTime; use uuid::Uuid; pub mod connection { use sqlx::PgPool; use std::future::Future; pub fn init_pool(db_url: &'_ str) -> impl Future<Output = Result<PgPool, sqlx::Error>> + '_ { PgPool::connect(db_url) ...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use starcoin_crypto::keygen::KeyGen; use starcoin_types::account::Account; use starcoin_types::account_address::AccountAddress; pub use starcoin_types::transaction::auth...
fn main() { println!("Hello Carge Rust world!"); }
use ethkey::{public_to_address, Public}; use web3::types::H520; pub use ethkey::Address; pub fn address_from_pubkey_uncompressed(bytes: H520) -> Address { // Skip the first byte of the uncompressed public key. let public = Public::from_slice(&bytes[1..]); public_to_address(&public) } #[cfg(test)] mod tes...
// https://leetcode.com/problems/maximum-score-of-a-good-subarray/ // You are given an array of integers nums (0-indexed) and an integer k. // The score of a subarray (i, j) is defined as min(nums[i], nums[i+1], ...,nums[j]) * (j - i + 1). // A good subarray is a subarray where i <= k <= j. // Return the maximum possi...
extern crate rustdds; extern crate serde; extern crate mio; extern crate mio_extras; extern crate byteorder; extern crate termion; use rustdds::{ serialization::{CDRSerializerAdapter, CDRDeserializerAdapter}, dds::{ DomainParticipant, qos::QosPolicies, data_types::ReadCondition, With_Key_DataReader, data_t...
#![allow(dead_code)] use std::future::Future; use std::pin::Pin; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; use bytes::Bytes; use http_body_util::{BodyExt, Full}; use hyper::server; use tokio::net::{TcpListener, TcpStream}; use hyper::service::service_fn; use hyper::{body::Incoming as In...
#[macro_use] extern crate serde_derive; mod bip32_child; mod crypto_ctx; mod global_hd_ctx; mod hw_client; mod hw_ctx; mod hw_error; pub mod hw_rpc_task; pub mod privkey; mod shared_db_id; mod standard_hd_path; mod xpub; #[cfg(target_arch = "wasm32")] mod metamask_ctx; // Uncomment this to finish MetaMask login. #[cf...
use serde::Deserialize; use crate::{data::yamlhelper, util::types::WaitlistCategory}; use eve_data_core::{Fitting, TypeDB, TypeError, TypeID}; use super::variations; struct CategoryData { categories: Vec<WaitlistCategory>, rules: Vec<(TypeID, String)>, } lazy_static::lazy_static! { static ref CATEGORY_...
/* * ORY Hydra * * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. * * The version of the OpenAPI document: v1.10.6 * * Generated by: https://openapi-generator.tech */ use reqwest; use crate::apis::ResponseContent; use super::{Error, configuration}; ///...
// Copyright 2020 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 ...
pub mod recursive_tree_list; pub mod tree_list;
use did_url::DID; use url::Url; use crate::document::Document; use crate::error::Result; use crate::lib::*; use crate::service::Service; use crate::utils::DIDKey; use crate::utils::Object; use crate::utils::Value; use crate::verification::Method; use crate::verification::MethodRef; /// A `DocumentBuilder` is used to ...
/*! A logger that routes logs to an imgui window. Supports both standalone mode (hook into your ui yourself), and an amethyst-imgui system (automatically rendered every frame). # Setup Add this to your `Cargo.toml` ```toml [dependencies] imgui-log = "0.1.0" ``` # Basic Example ```no_run // Start the logger let log...
// filesystem block size. pub const BLOCK_SIZE: u32 = 4096;
use crate::entity::user::*; // use actix_web::{Result}; pub fn insert(new_user: User){ User::insert(new_user); } pub fn find_all() -> Vec<User> { User::find_all() } pub fn find_by_id(id : i32) -> User { User::find_by_id(id) }
use array::Array; use std::f64::consts::E; impl<T> Array<T> where T: Copy + Into<f64> { /// Applies logarithm with given base on elements from given array and creates new array #[inline] pub fn log(&self, base: f64) -> Array<f64> { return super::apply(&self, |value: &T| f64::log(value.clone().into...
mod client; mod connection; mod channel; mod port; mod packet; use crate::ibc_logic::validate_channel_identifier; use crate::ibc_logic::{ channel as IbcLogicChannel, client as IbcLogicClient, connection as IbcLogicConnection, packet as IbcLogicPacket, port as IbcLogicPort, }; use lazy_static::lazy_static; use ...
use mapper::Mapper; struct FirstSource { room_id: u32, name: String, } struct SecondSource { user_id: u32, } #[derive(Mapper)] #[from(FirstSource, SecondSource)] struct Destination { #[mapper(use_fields = [room_id, user_id])] id: u32, } fn main() { let first = FirstSource { room_id: ...
use chrono::{DateTime, Utc, Duration}; // Returns a Utc DateTime one billion seconds after start. pub fn after(start: DateTime<Utc>) -> DateTime<Utc> { let gig_sec = Duration::seconds(10f64.powi(9i32) as i64); match start.checked_add_signed(gig_sec) { Some(s) => return s, None => panic!("Could ...
use egg::{define_language, Applier, EGraph, ENode, Id, Metadata, Var}; use log::{debug, info, trace}; use std::collections::HashMap; pub mod rewrites; type DomainIdValue = u32; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum DomainId { Complement(Box<DomainId>), DomainId(DomainIdValue), } type StrandId ...
use std::{ collections::HashSet, path::PathBuf, sync::{Arc, Mutex}, }; use eyre::Result; use crate::downloader; use crate::item::Item; use crate::metadata::{self, Metadata}; #[derive(Debug, Default, Copy, Clone)] pub struct Stats { downloaded: usize, skipped: usize, errored: usize, } struct ...
struct Color { red: u8 // 0 -2555 green: u8 blue: u8 } fn main_11(){ //color: red, green, blue let bg = Color{red: 255, green: 70, blue: 15}; println!("{},{},{}",bg.red,bg.green, bg.blue); }
//! Conversions between Rust and **MySQL** types. //! //! # Types //! //! | Rust type | MySQL type(s) | //! |---------------------------------------|------------------------------------------------------| //! | `bool` | TI...
#![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(clippy::all)] #[allow(dead_code)] pub mod bindings; pub use bindings::*;
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 0x04], #[doc = "0x04..0x24 - Description collection: Captures the EPIN\\[n\\].PTR and EPIN\\[n\\].MAXCNT registers values, and enables endpoint IN n to respond to traffic from host"] pub tasks_startepin: [TASKS_STARTEPIN; 8], ...
pub mod core; fn main() { let mut input: [u32; 6] = [2, 3, 6, 5, 1, 100]; core::bubble_sort(&mut input, core::SortMethod::Desc); }
#![allow(unused_imports)] use proconio::{fastout, input, marker::*}; #[fastout] fn main() { input! { ccc: Chars }; if ccc[0] == ccc[1] && ccc[0] == ccc[2] { println!("Won") } else { println!("Lost") } }
use core::{ fmt, ops::{Add, Div, Mul, Sub}, }; use typenum::{Diff, Integer, Sum}; /// Trait implemented for [`Dimensions`]. /// Mostly needed to simplify bound and write /// ``` /// # use typed_phy::DimensionsTrait; /// # trait Trait {} /// impl<U: DimensionsTrait> Trait for U { /// /* ... */ /// } /// ``...
// Copyright 2020 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::config::nuconfig::NuConfig; use std::fmt::Debug; #[derive(PartialEq, Debug)] pub enum AutoPivotMode { Auto, Always, Never, } pub trait HasTableProperties: Debug + Send { fn pivot_mode(&self) -> AutoPivotMode; fn header_alignment(&self) -> nu_table::Alignment; fn header_color(&self) ...
#[doc = "Register `L0PPF` reader"] pub struct R(crate::R<L0PPF_SPEC>); impl core::ops::Deref for R { type Target = crate::R<L0PPF_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<L0PPF_SPEC>> for R { #[inline(always)] fn from(reader: crate::R<L0P...
use crate::schema::props_key_categories; use chrono::NaiveDateTime; use serde::{Serialize,Deserialize}; #[derive(Queryable, Identifiable,Serialize,Deserialize, Debug, Clone)] #[primary_key(item_id)] #[table_name = "props_key_categories"] pub struct PropsKeyCategory { pub item_id: i64, pub chest_item_id: i64, ...
use std::collections::HashSet; use std::fs; fn main() { let numbers = fs::read_to_string("input/1.txt") .expect("input file must be exist") .lines() .map(|x| x.parse::<isize>().unwrap()) .collect::<Vec<isize>>(); let sum = 2020; println!("==============PART-1============"); ...
fn main() { println!("Chapter 4 Booleans"); } fn can_drive(name: &str, age: u32) -> bool { (name != "Michael" && age >= 16) || (age >= 18) } fn can_see_movie(age: i32, parents_permit: bool) -> bool { (age >= 17) || (age >= 13 && parents_permit) } #[cfg(test)] mod tests { use super::*; #[test] ...
use std::{mem, num, ptr}; use libc::{c_int, c_void}; use ffi::highgui::*; use image::Image; pub fn wait_key(delay: int) -> int { unsafe { cvWaitKey(delay as i32) as int } } pub struct Trackbar<'a> { name: String, window: String, on_change: Option<|uint|: 'a>, } impl<'a> Trackbar<'a> { pub fn position(&self...
// Hello, welcome to my lexer. Please like and subscribe use crate::Token; static SPACE: &str = " \t"; // Rules: A-Z,a-z fn is_id_1st(c: char) -> bool { c >= 'A' && c <= 'z' } // A-Z or 0-9 fn is_id(c: char) -> bool { is_id_1st(c) || (c >= '0' && c <= '9') } pub fn lex(text: &str) -> Vec<Token> { use Token::*; ...
pub mod fill; use std::fmt; use wasm_bindgen::prelude::*; extern crate web_sys; //macro_rules! log { //( $( $t:tt )* ) => { //web_sys::console::log_1(&format!( $( $t )* ).into()); //} //} #[wasm_bindgen] pub struct Layer { x: i32, y: i32, width: u32, height: u32, tile_width: u32, tile_height: ...