text
stringlengths
8
4.13M
// Copyright (C) 2021 Subspace Labs, Inc. // 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unle...
#[doc = "Register `AFRH` reader"] pub type R = crate::R<AFRH_SPEC>; #[doc = "Register `AFRH` writer"] pub type W = crate::W<AFRH_SPEC>; #[doc = "Field `AFSEL8` reader - Alternate function selection for port x bit y (y = 8..15)"] pub type AFSEL8_R = crate::FieldReader<AFSEL8_A>; #[doc = "Alternate function selection for...
#[doc = "Register `TIM7_DIER` reader"] pub type R = crate::R<TIM7_DIER_SPEC>; #[doc = "Register `TIM7_DIER` writer"] pub type W = crate::W<TIM7_DIER_SPEC>; #[doc = "Field `UIE` reader - Update interrupt enable"] pub type UIE_R = crate::BitReader; #[doc = "Field `UIE` writer - Update interrupt enable"] pub type UIE_W<'a...
pub mod builder; pub mod deserializer; pub mod serializer; pub mod transaction_test;
use crate::symbol::{ value_of_keyword, value_of_annotation }; enum TokenType { ParenL, // ( ParenR, // ) BracketL, // [ BracketR, // ] BraceL, // { BraceR, // } String, // string Identifier, // identifier Number, // number Col...
//! MIPS CP0 Compare register register_rw!(11, 0); // compare
#![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 CdnPeeringPrefixListResult { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec<CdnPee...
use fantoccini::{Client, Locator}; use perseus::wait_for_checkpoint; #[perseus::test] async fn main(c: &mut Client) -> Result<(), fantoccini::error::CmdError> { c.goto("http://localhost:8080").await?; wait_for_checkpoint!("begin", 0, c); let url = c.current_url().await?; assert!(url.as_ref().starts_wit...
use core::position::{Size, HasSize}; use core::cellbuffer::{Attr, CellAccessor}; use ui::core::{ Alignable, HorizontalAlign, VerticalAlign, Widget, Painter, Frame, Button, ButtonResult, find_accel_char_index }; const BALLOT: char = '\u{2610}'; const BALLOT_CHECKED: char = '\u{2611}...
mod console; mod cartridge; pub use console::*; pub use cartridge::*;
use itertools::iproduct; use lazy_static::lazy_static; use std::{ cmp::min, collections::{hash_map::Entry, HashMap}, fmt, }; #[derive(Clone, Copy)] enum Acre { Ground, Trees, Lumberyard, } #[derive(Clone)] struct State(Vec<Vec<Acre>>); struct Counts { trees: usize, lumberyard: usize, ...
use artell_domain::image::{Image, ImageRepository}; use artell_infra::s3::S3ImageRepository; use bytes::Bytes; #[tokio::main] async fn main() { let image = Image::new(Bytes::from( std::fs::read("/Users/takahashiatsuki/Desktop/myself.jpg").unwrap(), )) .unwrap(); S3ImageRepository::new("artell"....
use core::fmt::Debug; use std::{error::Error, sync::Mutex}; use thiserror::Error; // Some crates represent errors using types that do not implement `std::error::Error` or even // `core::fmt::Display`. As a result, we cannot convert them into `anyhow::Error` directly. #[derive(Debug, Error)] #[error("{0:?}")] pub stru...
/* * 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 */ /// HostMuteSettings : Combination of settings to mute a host. #[derive(Clone, Debug, PartialEq, Seri...
pub mod broadphase_collision; pub mod collision_dispatch; pub mod collision_shapes;
// Copyright 2018 Steven Bosnick // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE-2.0 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 accord...
#[doc = "Register `PLL2DIVR` reader"] pub type R = crate::R<PLL2DIVR_SPEC>; #[doc = "Register `PLL2DIVR` writer"] pub type W = crate::W<PLL2DIVR_SPEC>; #[doc = "Field `PLL2N` reader - Multiplication factor for PLL2VCO Set and reset by software to control the multiplication factor of the VCO. These bits can be written o...
use serde_json::{Value}; use serde_json::json; use std::collections::HashMap; //TODO: need to encode literals differntly from named entities? pub fn get_type(ofn: &Value) -> &str { match ofn[0].as_str() { Some("ObjectSomeValuesFrom") => "owl:Restriction", Some("ObjectAllValuesFrom") => "ow...
use scraper::{Html, Selector}; pub struct BookParser { title_selector: Selector, text_selector: Selector, p_selector: Selector, chpaters_selector: Selector, client: reqwest::blocking::Client, stop_words: Vec<&'static str>, } pub struct Chapter { pub name: String, pub link: String, } pub...
// Copyright 2018 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. #![deny(warnings)] extern crate failure; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate fidl; extern crate fidl_fuchsia_dev...
//! Get info on your multiparty direct messages. use rtm::{Message, Mpim, ThreadInfo}; use timestamp::Timestamp; /// Closes a multiparty direct message channel. /// /// Wraps https://api.slack.com/methods/mpim.close #[derive(Clone, Debug, Serialize, new)] pub struct CloseRequest { /// MPIM to close. pub chan...
#[doc = "Register `CFGR` reader"] pub type R = crate::R<CFGR_SPEC>; #[doc = "Register `CFGR` writer"] pub type W = crate::W<CFGR_SPEC>; #[doc = "Field `SW` reader - System clock switch"] pub type SW_R = crate::FieldReader; #[doc = "Field `SW` writer - System clock switch"] pub type SW_W<'a, REG, const O: u8> = crate::F...
//! Game widget. use tui::{ buffer::Buffer, layout::Rect, style::{Color, Style}, widgets::Widget, }; pub struct Game<'vram> { vram: &'vram [u64], } impl<'vram> Game<'vram> { /// Creates a [Game]. pub fn new(vram: &'vram [u64]) -> Self { Self { vram } } /// Gets vram width. pub fn vram_width(...
#[doc = "Register `DMA_LISR` reader"] pub type R = crate::R<DMA_LISR_SPEC>; #[doc = "Field `FEIF0` reader - FEIF0"] pub type FEIF0_R = crate::BitReader; #[doc = "Field `DMEIF0` reader - DMEIF0"] pub type DMEIF0_R = crate::BitReader; #[doc = "Field `TEIF0` reader - TEIF0"] pub type TEIF0_R = crate::BitReader; #[doc = "F...
/* * Copyright 2018 Intel Corporation * * 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 agre...
use std::net::SocketAddr; use chrono::prelude::*; use hydroflow::hydroflow_syntax; use hydroflow::lattices::{Max, Merge}; use hydroflow::util::{UdpSink, UdpStream}; use crate::protocol::EchoMsg; use crate::{GraphType, Opts}; pub(crate) async fn run_client(outbound: UdpSink, inbound: UdpStream, opts: Opts) { // s...
#[macro_export] macro_rules! get { ($handler:expr, $req:expr) => { $handler .client .execute($req.build()?) .await? .error_for_status() }; }
//! Iterators and data structures for transforming parsing information into styled text. // Code based on https://github.com/defuz/sublimate/blob/master/src/core/syntax/highlighter.rs // released under the MIT license by @defuz use std::iter::Iterator; use std::ops::Range; use crate::parsing::{Scope, ScopeStack, Bas...
use std::borrow::Cow; use std::collections::HashSet; use std::sync::{Arc, Mutex}; use itertools::Itertools; use once_cell::sync::Lazy; use sysinfo::{ComponentExt, Cpu, CpuExt, System, SystemExt}; use command_data_derive::*; use discorsd::{async_trait, BotState}; use discorsd::commands::*; use discorsd::errors::BotErr...
use af; use af::Array; use error::HALError; pub fn tanh(x: &Array) -> Array { af::tanh(x).unwrap() } pub fn sigmoid(x: &Array) -> Array { // let exponentiated = x.map(|e| 1.0/(1.0 + af::exp(-1.0 * e))); // exponentiated.unwrap() let denominator = af::add(&1.0f32, &af::exp(&af::mul(&-1.0f32, x, false).unwrap()...
use amiquip::{Connection, Channel, Exchange, Publish, AmqpProperties}; use rand::distributions::{Distribution, Uniform}; use std::thread; use std::time::Duration; pub struct StatusChecker { connection: Option<Connection>, channel: Option<Channel>, host: String, status_queue: String, worker_id: Stri...
extern crate pest; #[macro_use] extern crate pest_derive; use pest::Parser; #[derive(Parser)] #[grammar = "ident.pest"] struct MyParser; fn main() { println!("{:?}", MyParser::parse(Rule::main, "a+1").unwrap()); }
use std::io; fn get_line() -> String { let mut input = String::new(); let stdin = io::stdin(); stdin.read_line(&mut input).unwrap(); input } fn main() { let mut freq = 0; let mut line = get_line(); while line.as_str() != "" { freq = freq + line.trim().parse::<i32>().unwrap(); ...
mod my_mod { fn private_function() { println!("called `my_mod::private_function()`"); } pub fn function() { println!("called `my_mod::function()`"); } // items can access other items in the same module, // even when private pub fn indirect_access() { print!("called ...
use actix::prelude::*; use uuid::Uuid; use crate::{pb::maine::maine_service_client::MaineServiceClient, rpc}; use std::collections::{HashMap, HashSet}; /// Send message to specific room #[derive(Message)] #[rtype(result = "()")] pub struct ClientMessage { pub id: i64, pub msg: String, pub room: String, }...
use super::super::operators::Operator; use super::super::types::Type; use super::expression::{AsCode, Expression, Symbol}; #[derive(Debug, Clone)] pub enum Code { // function FuncDefineOpen(Symbol, Vec<Type>), FuncDefineClose, // declare, assign Alloca(Symbol), Store(Expression, Symbol), // (va...
use cfg_if::cfg_if; cfg_if! { if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), not(feature = "force-soft")))] { #[path = "./x86.rs"] mod platform; cfg_if! { if #[cfg(all(target_feature = "aes", target_feature = "sse2"))] { pub use self::platform::*...
extern crate ctrlc; #[macro_use] extern crate log; extern crate pyo3; extern crate rppal; extern crate failure; use failure::Error; use rppal::gpio::{Gpio, Level, Mode, PullUpDown}; type Result<T> = std::result::Result<T, Error>; /// Wrapper for Python picamera library mod picamera { use pyo3::prelude::*; p...
use rtk::event::{Axis, ButtonState, Event, Key, KeyModState, KeySide}; use rtk::geometry::{Point, Size}; use winit::dpi::{PhysicalPosition, PhysicalSize}; use winit::event::{ElementState, MouseButton, MouseScrollDelta, VirtualKeyCode, WindowEvent}; pub fn translate_event(event: WindowEvent) -> Option<Event> { use ...
use colored::*; use std::fmt::Display; use anyhow::{Context, Result}; use clap::ArgMatches; use log::*; use serde::export::Formatter; use crate::cfg::Cfg; use crate::cli::terminal::emoji; #[derive(Debug)] pub struct Settings { setup: Option<String>, env: Option<String>, } impl Settings { pub fn new() ->...
// 6.1 The Electronic Codebook Mode, (Page-16) // https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf // // NOTE: // ECB 和 CBC 分组模式都无法处理不定长的输入数据, // 需要自己手动为不定长数据按照块密码算法的块大小做对齐工作。 // use crate::blockcipher::{ Aes128, Aes192, Aes256, Camellia128, Camellia192, Camellia256, Rc2FixedS...
#![no_std] use smallvec::SmallVec; pub type NodeIndex = usize; pub type Generation = usize; pub type NodeHandle = (NodeIndex, Generation); pub struct SmallGraph<T> { pub(crate) free: SmallVec<[NodeHandle; 128]>, pub(crate) nodes: SmallVec<[(Generation, Option<T>); 128]>, pub(crate) connections: SmallVec<[...
use std::borrow::Cow; use std::convert::TryFrom; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Result as FmtResult; use pest::error::Error as PestError; use pest::Parser as PestParser; use crate::parser::Parser; use crate::parser::Rule; /// A label somewhere in the program. #[derive(Clone, Debug, Eq,...
use std::fmt; use tokenizer::{Token, Kw, Op}; /* Grammar program := (statement delimiter ?)* delimiter := Newline | Semicolon statement := declaration | expression declaraion := Fn prototype (statement)* End prototype := identifier LParen identlist RParen identlist := Ident (Comma Ident)* | e exp...
#[doc = "Register `CFGR` reader"] pub type R = crate::R<CFGR_SPEC>; #[doc = "Register `CFGR` writer"] pub type W = crate::W<CFGR_SPEC>; #[doc = "Field `PVDL` reader - PVD lock enable bit."] pub type PVDL_R = crate::BitReader; #[doc = "Field `PVDL` writer - PVD lock enable bit."] pub type PVDL_W<'a, REG, const O: u8> = ...
#[macro_use] extern crate serde_derive; extern crate lib_tfidf; extern crate serde; extern crate serde_json; use lib_tfidf::{Document, Tfidf, Token}; use std::cmp::Ordering; use std::collections::HashMap; use std::fs; use std::io::{self, Read}; use std::path::Path; pub type HulthDocumentKeywords = HashMap<String, Ve...
use ::*; pub fn render_loop( stop : Arc<Mutex<bool>>, floor : Arc<Mutex<Floor>>, player : Arc<Mutex<Player>>, dirty_coords : Arc<Mutex<Vec<Coord>>>, monsters : Arc<Mutex<Vec<Monster>>>, ) { let mut screen = &mut stdout().into_raw_mode().unwrap(); out(screen, termion...
static LOL_VALUE : int = 9001; fn main() { let hi = "hi"; let mut count = 0i; while count < 10 { println!("count is {}!", count); count += 1; } println!("{} nub! LOL_VALUE is {}", hi, LOL_VALUE); }
mod shell; mod yaml; pub use shell::*; pub use yaml::*; use web_sys::Node; use yew::prelude::*; use yew::virtual_dom::VNode; use yew_router::agent::RouteRequest; use yew_router::prelude::*; pub trait ToHtml { fn to_html(&self) -> Html; } impl ToHtml for dyn AsRef<str> { fn to_html(&self) -> Html { l...
mod app; use app::App; mod server; use anyhow::Result; use dotenv::dotenv; use std::env; #[tokio::main] async fn main() -> Result<()> { dotenv().ok(); let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let app = App::new(&database_url)?; let server = server::Server::new...
// 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...
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; // --- paritytech --- use pallet_aura::Config; // --- darwinia-network --- use crate::*; frame_support::parameter_types! { pub const MaxAuthorities: u32 = 100_000; } impl Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); type ...
use crate::client::received_buffer::ReceivedBufferRequestSender; use crate::client::topology_control::TopologyAccessor; use crate::client::InputMessageSender; use crate::sockets::websocket::connection::{Connection, ConnectionData}; use log::*; use sphinx::route::DestinationAddressBytes; use std::net::SocketAddr; use to...
use std::fmt::{Display, Formatter}; #[derive(Debug)] pub enum Error { NoStagesDefined, NoLayersDefined, ParseIntError(std::num::ParseIntError), ParseFloatError(std::num::ParseFloatError), VecLengthError(usize), IoError(std::io::Error), //NoneError, } impl Display for Error { fn fmt(&se...
extern crate discord; extern crate postgres; use self::discord::model::{ChannelId, MessageId, PublicChannel, ServerId, User, UserId}; use super::model::{Emoji, CustomEmoji}; use postgres::rows::Rows; pub struct Database { conn: postgres::Connection, } impl Database { pub fn new<T>(params: T) -> postgres::Res...
use std::io::{ self, Write, Cursor }; use byteorder::WriteBytesExt; use crate::writer::Writer; use crate::context::Context; use crate::endianness::Endianness; struct WritingCollector< C: Context, T: Write > { context: C, writer: T } impl< 'a, C: Context, T: Write > Writer< 'a, C > for WritingCol...
macro_rules! try_poll { ($e:expr) => (match $e { Ok(::futures::Async::Ready(Some(t))) => t, Ok(::futures::Async::Ready(None)) => return Ok(::futures::Async::Ready(None)), Ok(::futures::Async::NotReady) => return Ok(::futures::Async::NotReady), Err(e) => return Err(From::from(e)), ...
#[doc = "Register `IDR` reader"] pub type R = crate::R<IDR_SPEC>; #[doc = "Field `IDR3` reader - Port input data (y = 0..15)"] pub type IDR3_R = crate::BitReader<IDR3_A>; #[doc = "Port input data (y = 0..15)\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum IDR3_A { #[doc = "0: Input is l...
use super::{schema::Context, user::UserSchema}; use crate::{ errors::SmileError, models::{comment::Comment, handler::Handler, user::User}, }; use chrono::prelude::*; use diesel::prelude::*; pub trait CommentSchema { fn id(&self) -> &i32; fn content(&self) -> &Option<String>; fn createdAt(&self) -> ...
use crate::sys::unix::net::{new_ip_socket, socket_addr}; use crate::sys::unix::SourceFd; use crate::{event, Interest, Registry, Token}; use std::fmt; use std::io::{self, IoSlice, IoSliceMut, Read, Write}; use std::net::{self, SocketAddr}; use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; pub struct TcpSt...
use std::borrow::Cow; use std::sync::Arc; use command_data_derive::CommandData; use discorsd::{async_trait, BotState}; use discorsd::commands::*; use discorsd::errors::BotError; use discorsd::http::channel::create_message; use discorsd::http::user::UserExt; use discorsd::model::ids::{Id, UserId}; use discorsd::model::...
// Copyright 2021 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under The General Public License (GPL), version 3. // Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed // under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI...
use pyo3::prelude::*; pub fn register_module(py: Python<'_>, parent_module: &PyModule) -> PyResult<()> { let efjc = PyModule::new(py, "efjc")?; super::thermodynamics::py::register_module(py, efjc)?; parent_module.add_submodule(efjc)?; efjc.add_class::<EFJC>()?; Ok(()) } /// The extensible freely-j...
use std::fmt::Debug; use crate::{ artist::ArtistsWithRole, availability::{AudioItemAvailability, Availabilities, UnavailabilityReason}, episode::Episode, error::MetadataError, image::{ImageSize, Images}, restriction::Restrictions, track::{Track, Tracks}, Metadata, }; use super::file::A...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ //! Provides Sender/Receiver implementations for Event Stream codegen. use crate::body::SdkBody; use crate::result::SdkError; use bytes::Bytes; use bytes_utils::SegmentedBuf; use futures_core::Stream; ...
pub fn first_missing_positive(nums: Vec<i32>) -> i32 { let mut nums = nums; 'outer: for i in 0..nums.len() { loop { let j = nums[i]; if j < 1 { continue 'outer } let j = j as usize; if j > nums.len() { continue '...
pub mod apply; pub mod char_index; pub mod id; pub mod joined_by; pub mod span;
struct Solution; /// https://leetcode.com/problems/reverse-integer/ impl Solution { pub fn reverse(x: i32) -> i32 { // Solution::i64(x) Solution::i32_with_check_overflow(x) } /// 0 ms 2 MB fn i64(x: i32) -> i32 { let sign = if x >= 0 { 1 } else { -1 }; let mut rest = (x ...
//! The core library #![warn(missing_docs)] pub mod protocol; #[cfg(feature = "backend")] #[macro_use] extern crate diesel; macro_rules! apis { ($($name:ident => $content:expr,)*) => ( $(#[allow(missing_docs)] pub const $name: &str = $content;)* ) } apis!{ API_URL_V1_CREATE_STEP_PAGE => "v1/step...
use std::cmp::max; use std::collections::HashMap; use super::ast::*; use super::ast::ExprKind::*; /// Utility struct that can track and generate unique IDs and symbols for use in an expression. /// Each SymbolGenerator tracks the maximum ID used for every symbol name, and can be used to /// create new symbols with th...
use crate::utils::file2vec; pub fn day5(filename: &String){ let contents = file2vec::<String>(filename); let contents:Vec<String> = contents.iter().map(|x| x.to_owned().unwrap()).collect(); let max_id = contents.iter().fold(0, |mut max, boarding_pass|{ let id = find_seat(boarding_pass).id(); ...
mod error_pages; mod templates; use perseus::define_app; define_app! { templates: [ crate::templates::index::get_template::<G>(), crate::templates::about::get_template::<G>(), crate::templates::new_post::get_template::<G>(), crate::templates::post::get_template::<G>(), crat...
//! The Parser use std; use std::borrow::ToOwned; use std::collections::LinkedList; use parser::ast::{Expr, ExprNode}; use parser::tokens::{Token, SourceLocation}; use parser::lexer::{Lexer, FileLexer, LexerError}; pub mod util; pub mod tokens; pub mod ast; pub mod lexer; // --- Parser: Error ---------...
use crate::connection::MavConnection; use crate::{read_versioned_msg, write_versioned_msg, MavHeader, MavlinkVersion, Message}; use std::io::Read; use std::io::{self}; use std::net::ToSocketAddrs; use std::net::{SocketAddr, UdpSocket}; use std::str::FromStr; use std::sync::Mutex; /// UDP MAVLink connection pub fn sel...
#[doc = "Register `CNT` reader"] pub type R = crate::R<CNT_SPEC>; #[doc = "Register `CNT` writer"] pub type W = crate::W<CNT_SPEC>; #[doc = "Field `CNT_L` reader - Least significant part of counter value"] pub type CNT_L_R = crate::FieldReader<u16>; #[doc = "Field `CNT_L` writer - Least significant part of counter valu...
/// /// # Examples /// /// ```rust /// use std::convert::TryFrom; /// /// use svm_runtime_ffi::svm_byte_array; /// use svm_types::{Address, Type}; /// /// let ty = Type::Str("@someone address"); /// let addr = Address::of("@someone"); /// /// let bytes: svm_byte_array = (ty, addr).into(); /// assert_eq!(Address::len(),...
use std::ops::Fn; use regex::Regex; use crate::types::{ ITokenizer, Token }; macro_rules! regex { ($re:expr) => { Regex::new($re).unwrap() }; } pub struct Tokenizer { matching_pairs: Vec<(String, Box<dyn Fn(String) -> Token>)>, } impl ITokenizer for Tokenizer { fn new() -> Self { let ...
#[doc = "Register `LIPCR` reader"] pub type R = crate::R<LIPCR_SPEC>; #[doc = "Register `LIPCR` writer"] pub type W = crate::W<LIPCR_SPEC>; #[doc = "Field `LIPOS` reader - Line Interrupt Position"] pub type LIPOS_R = crate::FieldReader<u16>; #[doc = "Field `LIPOS` writer - Line Interrupt Position"] pub type LIPOS_W<'a,...
/*! ```rudra-poc [target] crate = "postscript" version = "0.13.2" [report] issue_url = "https://github.com/bodoni/postscript/issues/1" issue_date = 2021-01-30 rustsec_url = "https://github.com/RustSec/advisory-db/pull/728" rustsec_id = "RUSTSEC-2021-0017" [[bugs]] analyzer = "UnsafeDataflow" bug_class = "UninitExposu...
use std::sync::Arc; use ntex::web::types::{State, Path}; use crate::{AppState, errors::CustomError, models::user::Admin}; /// 删除文章 pub async fn delete_article( _: Admin, id: Path<(u32,)>, state: State<Arc<AppState>>, ) -> Result<String, CustomError> { let db_pool = &state.db_pool; sqlx::query!("...
use std::fmt; use std::fmt::Write; use termion; use termion::color; use xrl::Style; fn get_color(argb_color: u32) -> color::Rgb { let r = ((argb_color & 0x00ff_0000) >> 16) as u8; let g = ((argb_color & 0x0000_ff00) >> 8) as u8; let b = (argb_color & 0x0000_00ff) as u8; color::Rgb(r, g, b) } pub fn se...
use std::io; use std::net::{IpAddr, SocketAddr}; use std::ops::Deref; use std::str::FromStr; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::time::Duration; use domain::base::iana::{Rcode, Rtype}; use domain::base::message::Message; use domain::base::message_builder::{...
use crate::connection_manager::reconnector::ConnectionReconnector; use crate::connection_manager::writer::ConnectionWriter; use futures::channel::{mpsc, oneshot}; use futures::task::Poll; use futures::{AsyncWriteExt, StreamExt}; use log::*; use std::io; use std::net::SocketAddr; use std::time::Duration; use tokio::runt...
extern crate peroxide; fn p2v(p: f64, c: f64, d: f64) -> f64 { return (d + c) / 2.0 + (d - c) * p / 2.0; } pub fn gauss(func: Box<dyn Fn(f64) -> f64>, a: f64, b: f64, num: usize) -> f64 { println!("{}", num); let (x, w) = peroxide::special::legendre::gauss_legendre_table(num); let mut res: f64 = 0...
//extern crate reqwest; use std::io; use std::fs::File; const BASE_URL: &str = "https://nexus.dev.clarabridge.net/content/repositories/public/Clarabridge/FX-windows-x64/1.104.0/"; const MODULE_NAMES: &'static [&'static str] = &["break-detector", "cape", "gazetteer", "morph", "morph5", "morph_tr", "pe", "post-synt...
/* * Slack Web API * * One way to interact with the Slack platform is its HTTP RPC-based Web API, a collection of methods requiring OAuth 2.0-based user, bot, or workspace tokens blessed with related OAuth scopes. * * The version of the OpenAPI document: 1.7.0 * * Generated by: https://openapi-generator.tech *...
use crate::{network::Network, AsId, NetworkError, Prefix, RouterId}; #[test] fn test_simple() { // All weights are 1 // r0 and b0 form a iBGP cluster, and so does r1 and b1 // // r0 ----- r1 // | | // | | // b0 b1 internal // |........|............ // | ...
use std::collections::BTreeMap; pub fn transform(input: &BTreeMap<i32, Vec<String>>) -> BTreeMap<String, i32> { let mut output = BTreeMap::new(); for (points, letters) in input { for letter in letters { output.insert(letter.to_lowercase(), *points); } } output }
use hyper::{Body, Response, StatusCode}; use crate::db; use crate::html; pub enum TerrainOrCharacter { Terrain, Character, } pub fn db_error_page(e: db::DBError) -> Result<Response<Body>, hyper::Error> { match e { db::DBError::FindingTable(_) => internal_server_error(e), db::DBError::Pars...
#[doc = "Register `MISR` reader"] pub type R = crate::R<MISR_SPEC>; #[doc = "Register `MISR` writer"] pub type W = crate::W<MISR_SPEC>; #[doc = "Field `ALRAMF` reader - Alarm A masked flag"] pub type ALRAMF_R = crate::BitReader; #[doc = "Field `ALRAMF` writer - Alarm A masked flag"] pub type ALRAMF_W<'a, REG, const O: ...
use rocket_api::rocket; fn main() { rocket().launch(); }
pub mod bonuses; pub mod camera_control; pub mod destruction; pub mod follow; pub mod game; pub mod health; pub mod player_control; pub mod turn;
//! This crate provides a type `JsOption` that is very similar to the standard //! library's `Option` type except that it has three variants: //! //! * `Some(value)`: Like `Option::Some` //! * `Null`: Explicitly not some value //! * `Undefined`: Implicitly not some value //! //! This type can be useful when you want to...
use std::collections::HashMap; use std::collections::LinkedList; use std::ops::DerefMut; use std::sync::Arc; use std::sync::Mutex; use std::thread; use std::thread::JoinHandle; use futures::BoxFuture; use futures::Future; use futures::Sink; use futures::Stream; use futures::future; use futures::sync::mpsc; use futures...
#[doc = "Register `CSR` reader"] pub type R = crate::R<CSR_SPEC>; #[doc = "Register `CSR` writer"] pub type W = crate::W<CSR_SPEC>; #[doc = "Field `LSION` reader - LSI oscillator enable"] pub type LSION_R = crate::BitReader<LSION_A>; #[doc = "LSI oscillator enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, Par...
use std::iter::Iterator; use std::net::SocketAddr; use hydroflow::util::ipv4_resolve; use crate::flows::bp_flow::bp_flow; use crate::flows::client_state_flow::client_state_flow; use crate::flows::listener_flow::listener_flow; use crate::flows::orig_flow::orig_flow; use crate::flows::push_group_flow::push_group_flow; ...
use std::sync::{ Arc, Mutex }; use crate::film::Film; use crate::math::*; use crate::sampler::CameraSample; #[macro_use] mod macros; mod orthographic; pub use self::orthographic::OrthographicCamera; mod perspective; pub use self::perspective::PerspectiveCamera; pub trait Camera { fn film(&self) -> Arc<Mutex<Fil...
fn main() { let start = 353_096; let end = 843_212; println!("{}", (start..=end).filter(|&i| validate(i)).count()) } fn validate(i: i32) -> bool { let mut head = i / 10; let mut tail = i % 10; let mut adjacent = false; loop { let prev = head % 10; if tail < prev { ...
use config::{AuthConfig, Config, HostConfig, LocationConfig}; use data::{Data, HostData}; use ips::IpBlock; use std::error; use std::path; use std::io::{self, Write}; use std::net::TcpStream; use std::time::Duration; use crossbeam; use rayon::prelude::*; use serde_json; use ssh2; use time; fn fetch_clean_host_data( ...
use std::io::Read; use std::result::Result as RResult; use winfo::WeatherInfo; use hyper::Client; use hyper::header::Connection; ///currently not used pub type Result<T> = RResult<T, WGError>; ///wrapper for String pub type Language = String; ///wrapper for bool pub type Forecast = bool; ///currently not used #[de...