text
stringlengths
8
4.13M
#[doc = "Register `SR` reader"] pub type R = crate::R<SR_SPEC>; #[doc = "Register `SR` writer"] pub type W = crate::W<SR_SPEC>; #[doc = "Field `TEF` reader - Transfer error flag"] pub type TEF_R = crate::BitReader; #[doc = "Field `TEF` writer - Transfer error flag"] pub type TEF_W<'a, REG, const O: u8> = crate::BitWrit...
use std::thread::sleep; use std::time::{Duration, Instant}; fn main() { let start_time = Instant::now(); let d = Duration::from_secs(1); sleep(d); let elapsed_duration = start_time.elapsed(); println!("{} elapsed.", elapsed_duration.as_micros()); }
use nix::unistd::*; use nix::unistd::ForkResult::*; use nix::sys::signal::*; use nix::sys::wait::*; use libc::exit; #[test] fn test_wait_signal() { match fork() { Ok(Child) => pause().unwrap_or(()), Ok(Parent { child }) => { kill(child, SIGKILL).ok().expect("Error: Kill Failed"); as...
pub mod cast_slice; pub mod colour; pub mod geometry; pub mod image_data; #[macro_use] pub mod resources; #[macro_use] pub mod shadervalue; #[macro_use] pub mod shader; #[macro_use] pub mod item; pub mod item_graphics_pipeline; pub mod mainloop_gl_glutin; pub mod anchors; pub mod vec2; pub mod rect; pub mod basicitems;...
#[derive(Debug, Deserialize, PartialEq, Eq)] pub enum OutputKind { #[serde(rename = "file")] File, #[serde(rename = "packet")] Packet, #[serde(rename = "audio_metadata")] AudioMetadata, #[serde(rename = "video_metadata")] VideoMetadata, }
use azure_core::AppendToUrlQuery; use std::borrow::Cow; #[derive(Debug, Clone, PartialEq)] pub struct Filter<'a>(Cow<'a, str>); impl<'a> Filter<'a> { pub fn new(s: impl Into<Cow<'a, str>>) -> Self { Self(s.into()) } } impl<'a> AppendToUrlQuery for Filter<'a> { fn append_to_url_query(&self, url: &...
use std::io::{self, Error, ErrorKind}; use std::net::IpAddr; use std::sync::Arc; use std::time::{Duration, Instant}; use crate::asynk::client::Client; use crate::asynk::message::Message; use crate::asynk::subscription::Subscription; use crate::smol::{prelude::*, Timer}; use crate::{Headers, Options}; const DEFAULT_FL...
mod theme; mod i3config; use std::io; use std::fs; use std::process; const THEMES_DIR: &str = "themes"; /// Apply a theme to a specified i3wm configuration file /// /// * `config` - Path to configuration file /// * `theme` - Path to theme to be applied /// pub fn change(config: &str, theme: &str) { let path = ...
pub mod emitter; pub mod environment;
use std::collections::HashMap; use bonsaidb_core::schema::{CollectionName, Schematic}; use nebari::{ io::fs::StdFile, tree::{Root, TreeRoot, UnversionedTreeRoot, VersionedTreeRoot}, }; use crate::{ database::document_tree_name, views::{ view_document_map_tree_name, view_entries_tree_name, view...
#![allow(non_camel_case_types)] #![deny(warnings)] #![doc(html_root_url = "https://docs.rs/lmdb-sys/0.8.0")] extern crate libc; #[cfg(unix)] #[allow(non_camel_case_types)] pub type mode_t = ::libc::mode_t; #[cfg(windows)] #[allow(non_camel_case_types)] pub type mode_t = ::libc::c_int; pub use constants::*; pub use f...
use std::io; fn main() { const GOLDEN_RATIO: f64 = 1.61803398874989484820; let mut number = String::new(); loop { println!("Enter fibonacci sequence index"); io::stdin().read_line(&mut number) .expect("Failed to read line"); let number: i32 = match number.trim().parse...
use std::net::SocketAddr; use iced::{Application, Clipboard, Command, Text}; fn main() { TCPDemo::run(iced::Settings::default()); } #[derive(Debug)] enum Message_E { ListenerStatus(tcp::ListenerStatus_E), ReceiverStatus(tcp::ReceiverStatus_E), None, } struct TCPDemo { // Holds new connections ...
fn fac(n: i32) -> i32 { if n <= 1 { 1 } else { n * fac(n - 1) } } fn sum_fact(mut n: i32) -> i32 { let mut sum = 0; while n > 0 { sum += fac(n % 10); n /= 10; } return sum; } fn main() { let mut sum = 0; for x in 3..3000000 { let mut s = 0; if x == sum_fac...
extern crate hyper; extern crate rustc_serialize; extern crate getopts; use getopts::Options; use std::env; mod header; mod mashape; use std::io::Read; use hyper::Client; use rustc_serialize::json; use std::thread; use hyper::header::Connection; use hyper::header::ConnectionOption; use mashape::CurrencyResponse; use ...
use alloc::arc::{Arc, Weak}; use alloc::boxed::Box; use collections::{Vec, VecDeque}; use core::cmp; use fs::{KScheme, Resource}; use sync::WaitQueue; use system::error::{Error, ENOENT, Result}; pub struct Pty { id: usize, input: WaitQueue<u8>, output: WaitQueue<Vec<u8>> } impl Pty { fn new(id: u...
#[derive(Debug, Copy, Clone)] struct PeriodicWithOffsets { period: u64, offset_from_sync: u64, first_sync: u64 } impl PeriodicWithOffsets { fn find_first_sync(&self, other: &PeriodicWithOffsets) -> u64 { let mut x1 = self.first_sync; let mut progress = 0; while x1 < self.offset...
//! This program is mainly intended for generating the dumps that are compiled in to //! syntect, not as a helpful example for beginners. //! Although it is a valid example for serializing syntaxes, you probably won't need //! to do this yourself unless you want to cache your own compiled grammars. //! //! An example o...
// Copyright 2015-2021 Brian Smith. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAI...
#[doc = "Reader of register ETH_MACRxQC0R"] pub type R = crate::R<u32, super::ETH_MACRXQC0R>; #[doc = "Writer for register ETH_MACRxQC0R"] pub type W = crate::W<u32, super::ETH_MACRXQC0R>; #[doc = "Register ETH_MACRxQC0R `reset()`'s with value 0"] impl crate::ResetValue for super::ETH_MACRXQC0R { type Type = u32; ...
//! Traits used to define Bus-related method behavior use crate::{ bus::{client::responses, urls::URLs}, error::Error, requests::{Fetch, Request as WMATARequest}, Date, RadiusAtLatLong, Route, Stop, }; use async_trait::async_trait; #[async_trait] pub trait NeedsRoute: Fetch { async fn positions_alo...
use crate::KvsEngine; use crate::{KvsError, Result}; use std::path::PathBuf; pub struct SledStore { sled: sled::Db, } impl SledStore { pub fn open(path: impl Into<PathBuf>) -> Result<SledStore> { let mut path: PathBuf = path.into(); path.push("sled-data"); Ok(SledStore { sl...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - OTFDEC control register"] pub cr: CR, _reserved1: [u8; 0x1c], #[doc = "0x20 - OTFDEC region x configuration register"] pub r1cfgr: R1CFGR, #[doc = "0x24 - OTFDEC region x start address register"] pub r1startaddr...
mod common; mod series; mod upgrade; mod airdrop; mod appcontract;
use std::mem; use std::sync::Arc; use byteorder::{ByteOrder, LittleEndian}; use crate::varint::varint_decode32; use crate::BytesView; #[derive(Clone)] pub struct Block<A> { data: BytesView<A>, restart_offset: u64, } impl<A: AsRef<[u8]>> Block<A> { pub fn init(data: BytesView<A>) -> Option<Block<A>> { ...
fn main() { let string_var = "hello_world".to_string(); //let vec_var = string_var.into_vec(); //println!("{:?}", vec_var); }
/// Iterator over all files in a given folder. Returns paths relative to that given folder. /// Directories are _not_ returned, only the files they contain. pub struct RelativeFiles { root: std::path::PathBuf, worklist: Vec<std::fs::DirEntry>, } impl RelativeFiles { pub fn open<P>(folder: P) -> Self wh...
use xstate; #[derive(Debug)] pub struct Context { pub button_press_counter: u32, } impl xstate::ContextType for Context {} #[derive(Debug)] pub enum Event { PushButton, Abort, TaskDone(xstate::TaskOutput), TaskError(xstate::TaskError), } impl xstate::EventType for Event { fn task_done(res: xst...
// 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...
//! # Strum //! //! Strum is a set of macros and traits for working with //! enums and strings easier in Rust. //! //! # Documentation //! //! The documentation for this crate is found in the `strum` crate. #![recursion_limit = "128"] extern crate heck; #[macro_use] extern crate syn; #[macro_use] exter...
//! Alphatization source transform //! This transform makes sure all variable names are unique within the source. use super::SourceTransformer; use crate::error::{ErrorKind, Result}; use crate::object::{ListBuilder, Object}; use crate::runtime::Symbol; use crate::SchemeExpression; use std::collections::HashMap; use st...
#![feature(plugin)] #![plugin(rocket_codegen)] extern crate simplehttpserver; extern crate rocket; extern crate rocket_contrib; extern crate serde; use std::env; use std::process; use rocket::config::{Config, Environment}; use rocket_contrib::Template; use simplehttpserver::{Directory, Response, generic_handler}; #...
#[doc = "Register `CR` reader"] pub type R = crate::R<CR_SPEC>; #[doc = "Register `CR` writer"] pub type W = crate::W<CR_SPEC>; #[doc = "Field `ADEN` reader - ADEN"] pub type ADEN_R = crate::BitReader<ADENR_A>; #[doc = "ADEN\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ADENR_A { #[do...
use ir::Constant; pub struct ConstantArray<'ctx>(Constant<'ctx>); impl_subtype!(ConstantArray => Constant); impl<'ctx> ConstantArray<'ctx> { }
use rand; use rand::Rng; mod intersection; pub use self::intersection::{ Intersection, EntryExit }; use vector::Vector3; #[derive(Debug)] pub struct Ray { pub origin: Vector3, pub direction: Vector3 } impl Ray { // https://math.stackexchange.com/questions/13261/how-to-get-a-reflection-vector#...
extern crate rand; extern crate sfml; extern crate fishies; use fishies::window; use fishies::state; use fishies::input; use fishies::display; use sfml::system::{Vector2f, Clock,Time,sleep}; fn main () -> () { let (mut window, mut view) = window::create(1200, 700); let mut input = input::InputManager::defaul...
use super::{CNAME_REVISION, CNAME_ROWID, CNAME_VERSION_NUMBER}; use crate::sqlite::sqlite_rowid::SqliteRowid; use apllodb_immutable_schema_engine_domain::{ row::pk::{apparent_pk::ApparentPrimaryKey, full_pk::revision::Revision}, version::version_number::VersionNumber, vtable::VTable, }; use apllodb_shared_c...
use ordered_float::OrderedFloat; pub fn mean(list: &[f64]) -> f64 { list.iter().sum::<f64>() / list.len() as f64 } pub fn var(list: &[f64], ddof: f64) -> f64 { let mean = mean(list); list.iter().map(|x| (x - mean).powi(2i32)).sum::<f64>() / (list.len() as f64 - ddof) } pub fn std(list: &[f64], ddof: f64)...
use std::{env, fs}; type Input = Vec<Vec<u32>>; fn main() { let args: Vec<String> = env::args().collect(); if args.get(1).is_none() { panic!("Supply a file to run against"); } let content = fs::read_to_string(args.get(1).unwrap()).expect("Reading file went wrong"); let lines: Vec<&str> = ...
//! Contains the `Error` and `Result` types that `mongodb` uses. use std::{ any::Any, collections::{HashMap, HashSet}, fmt::{self, Debug}, sync::Arc, }; use bson::Bson; use serde::{Deserialize, Serialize}; use thiserror::Error; use crate::{bson::Document, options::ServerAddress, sdam::TopologyVersion...
use std::collections::{HashMap, HashSet}; fn main() -> std::io::Result<()> { let input = std::fs::read_to_string("examples/7/input.txt")?; let mut rules: HashMap<&str, HashSet<&str>> = HashMap::new(); for line in input.lines() { let mut x = line.split("contain"); let container = x.next().un...
use crate::{ast, ast::*, Guid}; use core::prefab::{PrefabNumber, PrefabValue}; use petgraph::{ algo::{has_path_connecting, toposort}, Direction, Graph, }; use std::{ collections::{BTreeMap, HashMap}, ops::{Deref, DerefMut}, sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard}, }; const VERSION: u...
extern crate ring; extern crate crypto; #[macro_use] extern crate log; extern crate env_logger; use ring::{digest, hmac, pbkdf2}; use crypto::aes; use crypto::buffer::{WriteBuffer, ReadBuffer, BufferResult}; #[derive(Debug)] struct Encryption { serial_num: Vec<u8>, iv: Vec<u8>, hmac: Vec<u8>, keys: Ve...
use std::sync::{Arc, mpsc, Mutex}; use std::thread; pub type Job = Box<FnBox + Send + 'static>; pub trait FnBox { fn call_box(self: Box<Self>); } impl<F: FnOnce()> FnBox for F { fn call_box(self: Box<F>) { (*self)() } } pub enum Message { NewJob(Job), Terminate } /// Worker struct for T...
use clap; use hyper; use serde_json; use std::io; use std::num; use std::result; #[derive(Debug)] pub enum FdownError { BadConfig(String), BadFormat(String), Clap(clap::Error), Hyper(hyper::Error), Io(io::Error), MissingUrl(String), ParseIntError(num::ParseIntError), SerdeJson(serde_json::Error), #[...
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; extern crate rocket_contrib; mod helper; use std::result::Result; use std::collections::HashMap; use std::sync::Mutex; use std::io::Error; use rocket::State; use rocket::response::{Redirect, NamedFile}; use rocket::request::{FromForm, For...
// use code::algorithms; // use code::data_structures; fn main() { println!("Hello world!"); }
enum AtomicRecoveryList<'a> { Create(Vec<&'a str>), Store(Vec<&'a str>), Replace(Vec<&'a str>), } struct AtomicRecovery; impl AtomicRecovery { /// Checks to see if the operations that were under way are recoverable fn can_restore(sw_count: usize, sc_count: usize, cw_count: usize, cc_count: usize, rw_c...
#[doc = "Register `GTZC1_MPCBB2_SECCFGR0` reader"] pub type R = crate::R<GTZC1_MPCBB2_SECCFGR0_SPEC>; #[doc = "Register `GTZC1_MPCBB2_SECCFGR0` writer"] pub type W = crate::W<GTZC1_MPCBB2_SECCFGR0_SPEC>; #[doc = "Field `SEC0` reader - Security configuration for block y Unprivileged write to this bit is ignored if PRIVy...
/// tests for OptionBool extern crate optional; use optional::OptionBool; use std::convert::Into; #[test] fn test_eq_ne() { assert!(OptionBool::SomeTrue == OptionBool::SomeTrue); assert!(OptionBool::SomeFalse != OptionBool::SomeTrue); assert!(OptionBool::None != OptionBool::SomeFalse); assert!(&...
#[derive(Debug, Clone, PartialEq, Eq)] pub struct ScrollConfig { width: u32, margin_right: i32, speed: i32, } impl ScrollConfig { pub fn new() -> Self { Self { width: 4, margin_right: 5, speed: 30, } } pub fn width(&self) -> u32 { sel...
//! This project is used for explaining the FFT operation using ARM CMSIS-DSP //! library functions. Here we have a digital input signal, sum of two //! sinusoidal signals with different frequencies. The complex form of this //! signal is represented with s_complex array in main.c file. Frequency //! components of this...
use serde::{Deserialize, Serialize}; use tracing::{error, instrument}; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Pokemon { name: String, pub description: String, pub habitat: String, #[serde(rename = "isLegendary")] pub is_legendary: bool, } impl Pokemon { pub async fn get...
#![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 ContainerHostMapping { #[serde(rename = "containerHostResourceId", default, skip_serializing_if = "Option::is_n...
#![no_main] use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &str| { solp::parse(data); });
use std::thread; use std::time::Duration; fn main() { if false { let i = 10; let r = 7; gen_workout(i, r); } let mut v = vec![1, 2, 3]; for i in v.iter_mut() { *i += 10; } println!("v = {:?}", v); let s: u32 = v.iter().sum(); println!("sum = {:?}", s); ...
use std::fs; use std::fmt; use itertools::iproduct; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum State { Open, Occupied, Floor, } #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Part { Part1, Part2, } impl State { pub fn parse(c: char) -> State{ match c { 'L...
pub trait Codec { fn decode(&mut self); fn encode(&mut self); }
use paradocs::*; #[tokio::test] async fn test_crate_root() { let client = DocsClient::default(); let document = client.get_document("tokio", "tokio").await.unwrap(); eprintln!("{:#?}", document); } #[tokio::test] async fn test_module() { let client = DocsClient::default(); let document = client.ge...
/* * 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. */ use std::future::Future; use std::mem; use std::pin::Pin; use std::slice; use std::task::Context; u...
use { quickcheck_macros::quickcheck, proptest::{prelude::*, collection::vec}, smu_huffman::{compress, decompress}, }; #[quickcheck] fn roundtrip(bytes: Vec<u8>) -> bool { bytes == decompress(&compress(&bytes)) } proptest! { #[test] fn roundtrip_prop(bytes in vec(any::<u8>(), 0..10_000)) { ...
extern crate env_logger; extern crate libgb; #[macro_use] extern crate log; use std::env; use libgb::Gameboy; fn main() { let mut builder = env_logger::Builder::new(); if let Ok(config) = env::var("GB_LOG") { builder.parse(&config); } builder.init(); let mut gb = Gameboy::new(); if l...
use anyhow::{anyhow, Result}; use crossbeam_channel::Sender; use std::ffi::OsString; use std::fs::File; use std::io::Read; use std::io::Write; use std::path::PathBuf; use std::{borrow::Cow, path::Path, time::SystemTime}; use std::{fs, str::FromStr}; use lsp_types::*; use serde::{Deserialize, Deserializer, Serialize}; ...
use delay::Delay; use std::time::Duration; const RETRY_PAUSE: Duration = Duration::from_millis(200); const MAX_RETRY_PAUSE: Duration = Duration::from_secs(1); pub fn waiter_with_exponential_backoff() -> Delay { Delay::builder() .exponential_backoff_capped(RETRY_PAUSE, 1.4, MAX_RETRY_PAUSE) .build(...
use std::collections::VecDeque; pub struct FloorRequests { pub requests: VecDeque<u64> } pub trait RequestQueue { fn add_request(&mut self, req: u64); fn add_requests(&mut self, reqs: &Vec<u64>); fn pop_request(&mut self) -> Option<u64>; } impl RequestQueue for FloorRequests { fn add_request(&mut self...
/* 一个struct中的多重实现 */ #![allow(dead_code)] trait A { fn say(self) -> String; } trait B { fn say(self) -> String; } struct S; // 实现trait A impl A for S { fn say(self) -> String { format!("S say: A") } } // 实现trait B impl B for S { fn say(self) -> String { format!("S say: B") ...
/* Copyright (c) 2023 Uber Technologies, Inc. <p>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 <p>http://www.apache.org/licenses/LICENSE-2.0 <p>Unless required by applicable law or agreed to...
#[doc = "Reader of register CONN_EXT_INTR_MASK"] pub type R = crate::R<u32, super::CONN_EXT_INTR_MASK>; #[doc = "Writer for register CONN_EXT_INTR_MASK"] pub type W = crate::W<u32, super::CONN_EXT_INTR_MASK>; #[doc = "Register CONN_EXT_INTR_MASK `reset()`'s with value 0"] impl crate::ResetValue for super::CONN_EXT_INTR...
use crate::{ binary::{Encoder, ReadEx}, errors::Result, types::{ column::{ column_data::{ArcColumnData, BoxColumnData}, list::List, ArcColumnWrapper, ColumnData, ColumnFrom, ColumnWrapper, }, HasSqlType, Marshal, SqlType, StatBuffer, Unmarshal, Val...
#![allow(non_upper_case_globals)] use std::str::FromStr; use bitflags::bitflags; use crate::util::CowUtils; bitflags! { pub struct MapsetTags: u32 { const Farm = 1; const Streams = 2; const Alternate = 4; const Old = 8; const Meme = 16; const HardName = 32; ...
use futures; #[macro_use] extern crate log; #[macro_use] extern crate prost_derive; use tokio; use tower_grpc; use tower_h2; use actix::prelude::*; pub mod kv { include!(concat!(env!("OUT_DIR"), "/kv.rs")); } mod db_actor; use crate::kv::{ server, DeleteRequest, DeleteResponse, GetRequest, GetResponse, Scan...
#[feature(struct_variant)]; #[feature(managed_boxes)]; use std::os; use std::io::fs::File; use std::option::Option; mod scanner; enum Gate { And, Or } pub enum Node { Leaf { value: bool }, Interior { gate : Gate, changeable : bool, left : ~Node, right : ...
#![deny(warnings, rust_2018_idioms)] mod level; mod tasks; mod uptime; use self::uptime::Uptime; use linkerd2_error::Error; use std::{env, str}; use tokio_trace::tasks::TasksLayer; use tracing::Dispatch; use tracing_subscriber::{ fmt::{format, Layer as FmtLayer}, layer::Layered, prelude::*, }; const ENV_...
extern crate hyper; use std::ptr; use event; const BASE_URL: &'static str = "https://www.warcraftlogs.com"; pub struct WCLIterator { report_id: String, fight_id: u32, client: hyper::Client, buf: Vec<event::Event>, buf_idx: usize, segment_id: u32, err: bool, } impl WCLIterator { fn new...
use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Span, Value}; use terminal_size::{terminal_size, Height, Width}; #[derive(Clone)] pub struct TermSize; impl Command for TermSize { fn name(&self) -> &...
use bpaf::Bpaf; use std::io::{self, Write}; use std::net::{IpAddr, Ipv4Addr}; use std::sync::mpsc::{channel, Sender}; use tokio::net::TcpStream; use tokio::task; // Max IP Port. const MAX: u16 = 65535; // Address fallback. const IPFALLBACK: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); // CLI Argume...
macro_rules! replace { { $result: expr, $( $key:expr => $value:expr ),* } => { replace!( $result, $( $key => $value, )* ) }; { $result: expr, $( $key:expr => $value:expr, )* } => ({ let a = $result.clone(); $( a = str::replace(&a, $key, $value); ...
//! Pretty, human-readable printing of [`proc_macro2::Span`]s. /// Helper struct which displays the span as `path:row:col` for human reading/IDE linking. /// Example: `hydroflow\tests\surface_syntax.rs:42:18`. pub struct PrettySpan(pub proc_macro2::Span); impl std::fmt::Display for PrettySpan { fn fmt(&self, f: &m...
#[macro_use] pub mod macros; pub mod derivable_custom_traits; mod error; pub mod test_utils; pub use error::EditorError; pub use macros::*;
#[allow(unused_imports)] use super::prelude::*; type Input = (u32, u32); pub fn input_generator(input: &str) -> Input { let mut words = input.split('-'); ( words.next() .expect("Invalid input") .parse::<u32>() .expect("Cannot parse as a positive integer"), wo...
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) // from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70) // DO NOT EDIT use Icon; use ffi; use glib; use glib::StaticType; use glib::Value; use glib::object::Downcast; use glib::object::IsA; use glib::signal::SignalHandlerId; use glib...
use std::borrow::Cow; /// Tabled a trait responsible for providing a header fields and a row fields. /// /// It's urgent that `header` len is equal to `fields` len. /// /// ```text /// Self::headers().len() == self.fields().len() /// ``` pub trait Tabled { /// A length of fields and headers, /// which must be ...
use std::iter::Iterator; use tui::buffer::Buffer; use tui::layout::{Corner, Rect}; use tui::style::Style; use tui::widgets::{Block, Widget}; use crate::format::*; pub struct Notification<'b> { content: &'b rumqtt::client::Notification, } impl Notification<'_> { pub fn new(content: &rumqtt::client::Notificat...
use actix::prelude::*; #[derive(Message)] #[rtype(result = "()")] pub struct Info { pub info: crate::participants::viewer_folder::viewer_structs::Info, } #[derive(Message)] #[rtype(result = "()")] pub struct GameOpened {} #[derive(Message)] #[rtype(result = "()")] pub struct GameClosed {} #[derive(Message)] #[rtyp...
use anyhow::{anyhow, Result}; use parse_wiki_text::{Configuration, Node}; fn get_content(cell: &parse_wiki_text::TableCell) -> Option<String> { return Some(if let Node::Text{value,..} = cell.content.get(0)? { value.to_string() } else { String::new() }); } fn count(cells: &Vec<parse_wiki_te...
#[doc = "Register `MCR` reader"] pub type R = crate::R<MCR_SPEC>; #[doc = "Register `MCR` writer"] pub type W = crate::W<MCR_SPEC>; #[doc = "Field `MODE1` reader - DAC Channel 1 mode"] pub type MODE1_R = crate::FieldReader<MODE1_A>; #[doc = "DAC Channel 1 mode\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, Partial...
use libc::fallocate; use serde::{Deserialize, Deserializer}; use std::{ fs::OpenOptions, io, os::unix::io::AsRawFd, path::Path, process::Command, sync::{Arc, Mutex, MutexGuard}, }; use tempfile::{NamedTempFile, TempPath}; // All tests use the same loopback device interface and so can tread on ...
use hydroflow::assert_graphvis_snapshots; use hydroflow::util::collect_ready; use multiplatform_test::multiplatform_test; #[multiplatform_test] pub fn test_diff_timing() { // An edge in the input data = a pair of `usize` vertex IDs. let (pos_send, pos_recv) = hydroflow::util::unbounded_channel::<usize>(); ...
use core::{ convert::TryInto, ops::{Deref, Index, IndexMut}, ptr::NonNull, }; use tinyvec::TinyVec; use fermium::{SDL_PixelFormat, SDL_Surface}; use crate::{sdl_get_error, PixelFormat, PixelFormatEnum, SdlError}; /* Some day maybe support SDL_CreateRGBSurfaceFrom and SDL_CreateRGBSurfaceWithFormatFrom, but th...
pub mod responses { use std::fmt; use serde::Deserialize; use serde_json as json; #[derive(Deserialize, Debug)] pub struct AuthResponse { pub session: SessionResponse, } /// Response to an Authentication request. /// /// Contains a Session Key and the username of the au...
use serde::{Deserialize, Serialize}; use chrono::{Utc}; use std::{fmt::{self, Display, Formatter}, convert::{From}}; /// Message that is sent to/from websocket /// /// { /// sender: "stoner", /// recipients: [ /// "whammo" /// ], /// body: "How are you doing?", /// event_type: Messag...
//! Module with the common definitions for the //! [fields](https://github.com/typesense/typesense/blob/v0.19.0/include/field.) //! available in Typesense. use serde::{Deserialize, Serialize}; mod field_type; pub use field_type::*; /// Struct used to represent a [field](https://github.com/typesense/typesense/blob/v...
// Example code from this blog post about calling Rust from Ruby: // http://blog.skylight.io/bending-the-curve-writing-safe-fast-native-gems-with-rust/ use std::num::pow; pub struct Point { x: int, y: int } struct Line { p1: Point, p2: Point } impl Line { pub fn length(&self) -> f64 { let xdiff = self.p1.x - ...
use crate::connection::AxisScale; use crate::estimate::Statistic; use crate::plot::{ FilledCurve, Line, LineCurve, PlottingBackend, Points, Rectangle as RectangleArea, Size, VerticalLine, }; use crate::report::{BenchmarkId, ValueType}; use plotters::prelude::*; use std::path::PathBuf; mod distributions; mod hi...
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641 fn main() -> anyhow::Result<()> { embuild::build::LinkArgs::output_propagated("ESP_IDF") }
#[doc = "Reader of register CFG"] pub type R = crate::R<u32, super::CFG>; #[doc = "Writer for register CFG"] pub type W = crate::W<u32, super::CFG>; #[doc = "Register CFG `reset()`'s with value 0"] impl crate::ResetValue for super::CFG { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use crate::search::{result::explain::Explain, Hit}; use fnv::FnvHashMap; /// SearchResult` is the result form a search, without the document itself /// /// A search will return a `SearchResult`, it will contain everything to build /// the final `SearchResultWithDoc`. #[derive(Serialize, Deserialize, Default, Clone, De...
use crate::utils::onclick_event; use maud::{html, Markup}; use rustimate_core::poll::PollStatus; pub(crate) fn modals() -> Markup { html!( div#add-member-modal uk-modal? { div.uk-modal-dialog.uk-modal-body { h2.uk-modal-title { "Add Member" } "I'm working on it, for now just copy/paste the...
#[no_mangle] pub extern fn physics_single_chain_ufjc_log_squared_thermodynamics_isotensional_asymptotic_end_to_end_length(number_of_links: u8, link_length: f64, link_stiffness: f64, force: f64, temperature: f64) -> f64 { super::end_to_end_length(&number_of_links, &link_length, &link_stiffness, &force, &temperatu...
use ferris_base; mod utils; #[test] fn transforms_objects() { let start = vec![ "......Fe....", "......==....", "..🦀Ro......", "Fe==U ......", ]; let inputs = vec![ferris_base::core::direction::Direction::RIGHT]; let end = vec![ "......Fe....", "......=...