text stringlengths 8 4.13M |
|---|
// Helper function to help derive the year month interval for a iso-8601
// compliant string.
pub fn get_year_month_interval(years: i32, months: i32, days: i32) -> String {
if years != 0 && months != 0 && days != 0 {
format!("P{:#?}Y{:#?}M{:#?}D", years, months, days)
} else if years != 0 && months != ... |
use std::collections::HashMap;
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
fn main() {
let f = File::open("input").unwrap();
let f = BufReader::new(&f);
let lines = f.lines();
let mut m: Vec<Vec<char>> = lines.map(|l| l.unwrap().chars().collect()).collect();
let mut carts = ve... |
pub fn check(word: &str) -> bool {
if word.is_empty() {
return true;
}
let filtered: String = word.to_lowercase().chars().filter(|c| c.is_alphabetic()).collect();
let unique = |x: char, word: &str| word.find(x).unwrap() == word.rfind(x).unwrap();
let filteredcount = filtered.chars().filter(|&x| unique(x,filtered... |
use std::fmt;
use chrono::offset::Utc;
use chrono::DateTime;
use json::json;
use reqwest::Client;
use serde::{Deserialize, Serialize};
use crate::error::AuthError;
#[allow(unused)]
pub(crate) const TLS_CERTS: &[u8] = include_bytes!("../../roots.pem");
const AUTH_ENDPOINT: &str = "https://oauth2.googleapis.com/token... |
/// Functionality having to do with receiving "InputSignals" from peripherals.
use arduino_uno::adc::Adc;
use super::JoyStickSignal;
/// An enumeration of the possible "InputSignals".
pub enum InputSignal {
JoyStick(JoyStickSignal)
}
/// This trait signifies that the peripheral device can read "InputSignals".
p... |
use core::marker::Sync;
use core::ops::{Drop, Deref, DerefMut};
use core::fmt;
use core::option::Option::{self, None, Some};
use core::default::Default;
use core::mem::ManuallyDrop;
use spin::{Mutex, MutexGuard};
use held_interrupts::{HeldInterrupts, hold_interrupts};
use stable_deref_trait::StableDeref;
use owning_re... |
use crate::attribute::Attribute;
use crate::handler::{Handler, HandlerResult};
/// Implements the Handler trait that forward each function call to each
/// handler in its list of handlers
#[derive(Default)]
pub struct TeeHandler<'t> {
/// the Handlers to forward function calls to
pub handlers: Vec<&'t mut dyn ... |
struct Solution {}
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct ListNode {
pub val: i32,
pub next: Option<Box<ListNode>>,
}
impl ListNode {
#[inline]
fn new(val: i32) -> Self {
ListNode { next: None, val }
}
}
impl Solution {
pub fn add_two_numbers(
l1: Option<Box<ListNod... |
use crate::error;
use crate::plan::expr_type_evaluator::TypeEvaluator;
use crate::plan::field::{field_by_name, field_name};
use crate::plan::field_mapper::{field_and_dimensions, FieldTypeMap};
use crate::plan::ir::{DataSource, Field, Interval, Select, SelectQuery, TagSet};
use crate::plan::var_ref::{influx_type_to_var_... |
use super::{Image, Color};
use std::io::{self, Read, Write, Seek};
const FULL_HEADER_SIZE: usize = 54;
const IMAGE_OFFSET: usize = FULL_HEADER_SIZE;
const DATA_HEADER_SIZE: usize = 40;
const BPP: i16 = 24;
const PIXELS_PER_METER: usize = 2835;
pub fn write_bmp<W: Write>(image: &Image<Color>, writer: &mut W)
... |
use std::collections::BTreeMap;
use crossterm::style::{style, Attribute, Color};
use pueue::state::State;
use pueue::task::Task;
/// This is a simple small helper function with the purpose of easily styling text,
/// while also prevent styling if we're printing to a non-tty output.
/// If there's any kind of styling... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
use std::default::Default;
use crate::components::input::text_input_modal::TextInputModal;
use crate::core::model::MainWindow;
use yew::prelude::*;
use yew::services::ConsoleService;
pub enum Msg {
Exit,
ShowNewPrefab,
ShowNewProject,
}
#[allow(dead_code)]
pub struct NavBar {
import_prefab_modal: Te... |
fn main() {
windows::core::build_legacy! {
Windows::Win32::Foundation::{CloseHandle, GetLastError, BSTR, RECT, WIN32_ERROR},
Windows::Win32::Gaming::HasExpandedResources,
Windows::Win32::Graphics::Direct2D::CLSID_D2D1Shadow,
Windows::Win32::Graphics::Direct3D11::D3DDisassemble11Trace... |
//! Windows Common Item Dialog
//! Win32 Vista
mod utils;
mod file_dialog;
mod message_dialog;
mod thread_future;
|
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
fn main() {
println!("{:?}", mystruct{ _bitfield_1: mystruct::new_bitfield_1(0, // a
0, // b
0, // c
0, // d
0), // e
f: 0,
g: 0, });
}
|
use crate::image_searcher::{GoogleImageSeacher, ImageSearcher, RapidApiImageSeacher};
use serde::Deserialize;
use serenity::{
async_trait,
model::{channel::Message, gateway::Ready},
prelude::*,
};
use std::path::Path;
use thiserror::Error;
mod image_searcher;
#[derive(Error, Debug)]
pub enum ImageBotError... |
#[doc = "Reader of register SRCR2"]
pub type R = crate::R<u32, super::SRCR2>;
#[doc = "Reader of field `GPIOA`"]
pub type GPIOA_R = crate::R<bool, bool>;
#[doc = "Reader of field `GPIOB`"]
pub type GPIOB_R = crate::R<bool, bool>;
#[doc = "Reader of field `GPIOC`"]
pub type GPIOC_R = crate::R<bool, bool>;
#[doc = "Reade... |
use diesel::{self, prelude::*};
use rocket_contrib::json::Json;
use crate::aulas_model::{AulasCC, AulasFull, InsertableAula};
use crate::schema;
use crate::DbConn;
#[post("/aulas/<id_professor>", data = "<aulas>")]
pub fn create_aulas(
conn: DbConn,
aulas: Json<Vec<InsertableAula>>,
id_professor: i32,
) ... |
//! Test command for verifying the unwind emitted for each function.
//!
//! The `unwind` test command runs each function through the full code generator pipeline.
#![cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use craneli... |
pub mod core;
pub mod manager;
#[macro_export]
macro_rules! export_plugin {
($register:expr) => {
#[doc(hidden)]
#[no_mangle]
pub static plugin_declaration: $crate::core::PluginDeclaration =
$crate::core::PluginDeclaration {
register: $register,
};
... |
pub mod ppm;
pub mod png;
use crate::vec3::Vec3;
use core::ops::{Index, IndexMut};
pub struct Image {
width : usize,
height : usize,
pixels : Vec<Vec3>
}
impl Index<(usize,usize)> for Image {
type Output = Vec3;
fn index(&self, idx: (usize,usize)) -> &Vec3 {
&self.pixels[idx.1 * self.widt... |
use std::path::{ Path, PathBuf };
use std::io;
use super::{ CacheDirImpl, CacheDirOperations };
impl CacheDirOperations for CacheDirImpl {
fn create_app_cache_dir(_: &Path, _: &Path) -> io::Result<PathBuf> {
Err(io::Error::new(io::ErrorKind::NotFound,
"[Application Cache]: This ... |
mod extend;
mod parse;
pub use extend::*;
pub use parse::*;
|
use diesel::result::Error;
use crate::HttpResponse;
use actix_web::http::StatusCode;
use serde::Serialize;
pub enum ServiceError {
Client {
message: String
},
Server {
message: Option<String>
},
NotFound,
Unauthorized
}
#[derive(Serialize)]
pub struct ErrorBody {
pub messag... |
use crate::{FunctionData, Instruction, Location, Label, Value, Map, FlowGraph};
pub struct MemoryToSsaPass;
fn rewrite_memory_to_ssa(function: &mut FunctionData, pointer: Value, start_label: Label,
flow_incoming: &FlowGraph, undef: Value) {
let mut load_aliases = Vec::new();
let mut d... |
use std::collections::HashSet;
use crate::{Push, TypeHash};
/// Filter is applied to each pixel of rendered picture.
pub trait Filter: Push + TypeHash + 'static {
fn inst_name() -> String;
fn source(cache: &mut HashSet<u64>) -> String;
}
|
fn main() {
assert_eq!(1, (1..10).step_by(1).filter(|i| i < &5).take(1).count());
}
|
#[allow(unused_imports)]
#[macro_use]
extern crate maplit; // for hashmap macro for writing hashmap literals in tests
#[macro_use]
extern crate itertools;
extern crate strsim;
extern crate array_tool;
use std::fs;
use std::io;
use std::io::Read;
use std::collections::HashMap;
use strsim::hamming;
use itertools::Ite... |
pub mod decrypt {
use crate::pgr::pgr::pgr_function;
pub fn decrypt (cypher_text : &[u8], key_string : &[u8]) -> Vec<u8> {
let mut xor: Vec<u8> = Vec::new();
for n in 0..cypher_text.len() {
xor.push(cypher_text[n] ^ key_string[n]);
}
xor.to_vec()
}
} |
use tuber_core::asset::Store;
use tuber_core::input::State;
use tuber_graphics::Graphics;
pub struct EngineContext {
pub graphics: Option<Graphics>,
pub asset_store: Store,
pub input_state: State,
}
|
use input_i_scanner::InputIScanner;
use std::cmp::Reverse;
use std::collections::BinaryHeap;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
... |
// Copyright 2015 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 ... |
use crate::fetchSpotStage::BlobFetchStage;
use crate::blockBufferPool::Blocktree;
#[cfg(feature = "chacha")]
use crate::chacha::{chacha_cbc_encrypt_ledger, CHACHA_BLOCK_SIZE};
use crate::clusterMessage::{ClusterInfo, Node};
use crate::connectionInfo::ContactInfo;
use crate::gossipService::GossipService;
use crate::pack... |
use std::{fs::File, io::BufWriter};
use crate::read::{self, MafWriter, RecordCounter};
pub struct Counts {
pub n_samples: u32,
pub n_records: u32,
}
pub fn count_samples_and_records(input: &str) -> crate::Result<Counts> {
let mut vcf_reader = read::get_vcf_reader(input)?;
let n_samples = vcf_reader.h... |
use ggez::{GameResult, Context};
use ggez::graphics::{Drawable, Point2, Vector2};
use vector;
pub fn draw_centered<D: Drawable>(
ctx: &mut Context,
drawable: &D,
size: Vector2,
dest: Point2,
rotation: f32,
) -> GameResult<()> {
drawable.draw(ctx, dest - vector::rotate(size, rotation) / 2.0, ro... |
use super::*;
mod with_timer;
#[test]
fn without_timer_returns_false() {
crate::test::without_timer_returns_false(result);
}
|
//! The `rpc_service` module implements the Solana JSON RPC service.
use crate::{
cluster_info::ClusterInfo, commitment::BlockCommitmentCache, rpc::*,
storage_stage::StorageState, validator::ValidatorExit,
};
use jsonrpc_core::MetaIoHandler;
use jsonrpc_http_server::{
hyper, AccessControlAllowOrigin, Close... |
extern crate aoc;
use std::cmp::Ordering;
use std::collections::hash_map::Entry;
use std::collections::{BinaryHeap, HashMap, HashSet};
use std::fmt;
use std::fs::File;
use std::io::prelude::*;
use std::io::{self, BufReader};
#[derive(Debug, PartialEq, Eq, Hash)]
struct Step(char);
impl Step {
fn work_time(&self)... |
use std::io;
mod game;
mod dice;
fn select_index(table: &Vec<i16>, current_player: &char) -> usize{
let ok;
game::print_table(&table);
print!("Introduceti piesa de mutat: ");
io::Write::flush(&mut io::stdout()).expect("flush failed!");
let mut input = String::new();
io::stdin().read_line(&mut input).expect("... |
//! Convert the source item stream to a parallel iterator and run the filtering in parallel.
use crate::{to_clap_item, FilterContext};
use anyhow::Result;
use parking_lot::Mutex;
use printer::{println_json_with_length, DisplayLines, Printer};
use rayon::iter::{Empty, IntoParallelIterator, ParallelBridge, ParallelItera... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::fmt;
use std::rc::Rc;
#[derive(Debug, Clone)]
enum ValueBind {
Vb(String, VarValue), /* type, value*/
}
impl ValueBind {
pub fn get_type(&self) -> String {
match self {
ValueBind::Vb(t, _) => t.... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
pub fn CloseHandle(hobject: HANDLE) -> BOOL;
pub fn CompareObjectHandles(hfirstobjecthandle: HANDLE, hsecondobjecthandle: HANDLE) -> BOOL;
pub fn Dup... |
use std::{
ffi::{OsStr, OsString},
os::windows::ffi::{OsStrExt, OsStringExt},
};
pub trait ToWideString {
fn to_wide(&self) -> Vec<u16>;
fn to_wides_with_nul(&self) -> Vec<u16>;
}
impl<T> ToWideString for T
where
T: AsRef<OsStr>,
{
fn to_wide(&self) -> Vec<u16> {
self.as_ref().encode_wi... |
use std::ffi::CString;
use cql_bindgen::CassCollection as _CassCollection;
use cql_bindgen::cass_collection_new;
use cql_bindgen::cass_collection_free;
use cql_bindgen::cass_collection_append_int32;
use cql_bindgen::cass_collection_append_int64;
use cql_bindgen::cass_collection_append_float;
use cql_bindgen::cass_coll... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
pub mod github;
pub mod openvsx;
pub mod vscodemarketplace;
use pulldown_cmark::{Event, Options, Parser, Tag};
use tempfile::Builder;
use color_eyre::{
eyre::{eyre, Report, Result, WrapErr},
Section,
};
use std::{fs::File, io::copy, process::Command};
pub async fn get_hash(url: &str) -> Result<String> {
... |
use crate::error::{ErrMode, ErrorKind, Needed, ParserError};
use crate::stream::Stream;
use crate::trace::trace;
use crate::*;
/// Return the remaining input.
///
/// # Example
///
/// ```rust
/// # use winnow::prelude::*;
/// # use winnow::error::ErrorKind;
/// # use winnow::error::InputError;
/// use winnow::combina... |
use secp256k1::key::{ SecretKey, PublicKey };
use secp256k1::Secp256k1;
use crate::base::curve::{entropy, scalar_multiple};
use hex;
//TODO::需要进行重构!!!
static PRE_PRIVATE_KEY: &'static str = "00";
pub struct J256k1 {}
impl J256k1 {
pub fn build_keypair_str(seed: &String) -> Result<(String, String), &'static str> {... |
// Copyright 2021 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 actix::prelude::*;
use actix::{
Addr,
Actor,
StreamHandler,
fut
};
use actix_web::{web, Error, HttpRequest, HttpResponse};
use actix_web_actors::ws;
use serde_json::Value;
use crate::worker_state::WorkerState;
use crate::messages::{
WorkerWsConnect,
JobStatusUpdate
};
pub fn websocket_rout... |
use crate::*;
use crate::visit::VisitorMut;
use std::collections::HashMap;
pub fn post_process(package: &mut Package) {
let mut names = HashMap::new();
for (id, extern_) in &package.externs {
match extern_ {
Extern::Proc(name, _) => { names.insert(name.clone(), (*id, false)); },
... |
// Copyright (c) 2018-2020 Ministerio de Fomento
// Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC)
// 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 ... |
//! Captures UDP packets
use std::{
sync::Arc,
time::{Duration, Instant},
};
/// UDP listener server that captures UDP messages (e.g. Jaeger spans)
/// for use in tests
use parking_lot::Mutex;
use tokio::{net::UdpSocket, select};
use tokio_util::sync::CancellationToken;
/// Maximum time to wait for a message... |
use pathfinder_common::{BlockHash, BlockNumber, EthereumChain, StateCommitment};
use primitive_types::{H160, H256, U256};
use stark_hash::Felt;
pub mod core_addr {
use const_decoder::Decoder;
pub const MAINNET: [u8; 20] = Decoder::Hex.decode(b"c662c410C0ECf747543f5bA90660f6ABeBD9C8c4");
pub const TESTNET:... |
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
use std::fmt;
use std::os::raw::c_char;
use wallets_macro::{DlCR, DlDefault, DlStruct};
use wallets_types::{Address, ChainShared, Error, TokenShared, Wallet,TokenAddress};
pub use crate::chain::*;
pub use crate::chain_btc::*;
pub use crate::chain_eee::*;
pu... |
use crate::handler::default::*;
use crate::handler::query::*;
use actix_files as fs;
use actix_web::http::{header, Method, StatusCode};
use actix_web::{error, web, HttpRequest, HttpResponse};
use std::io;
pub fn config_app(cfg: &mut web::ServiceConfig) {
cfg.service(favicon)
// register simple route, handl... |
fn main()
{
let x = "blah";
foo(x);
}
fn foo(x: &str)
{
println!("{}", x);
}
|
module.exports = {
testEnvironment: 'node'
};
|
// 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.
use crate::switchboard::base::{
ConfigurationInterfaceFlags, SettingRequest, SettingResponse, SettingResponseResult,
SettingType, SetupInfo, Switch... |
use diesel;
use diesel::result::Error;
use diesel::ExpressionMethods;
use diesel::QueryDsl;
use diesel::RunQueryDsl;
use r2d2_redis::redis::Commands;
use uuid::Uuid;
use crate::cache;
use crate::db;
use crate::models::users::{NewUser, User};
use crate::schema::users;
use crate::schema::users::dsl::*;
pub struct Filte... |
use pathfinder_common::{BlockId, CallParam, ContractAddress, EntryPoint, EthereumAddress};
use crate::context::RpcContext;
use crate::v02::method::call::FunctionCall;
use crate::v02::types::reply::FeeEstimate;
use crate::v03::method::estimate_message_fee::EstimateMessageFeeError;
#[derive(serde::Deserialize, Debug, P... |
// This file is part of syslog2. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/syslog2/master/COPYRIGHT. No part of syslog2, including this file, may be copied, modified, propagated, or distributed except... |
use std::sync::Mutex;
fn main() {
let me = Mutex::new(5);
{
let mut num = me.lock().unwrap();
*num = 6;
}
println!("me = {:?}", me);
println!("Hello, world!");
}
|
type Observer = Box<Fn(&Observable)>;
trait Observable {
fn add_observer(&mut self, o: Observer) -> ();
fn notify_observers(&self) -> ();
fn get_state(&self) -> i32;
}
fn basic_observer(o: &Observable) {
println!("Observable state change: {}", o.get_state());
}
struct Particle {
pos: i32,
... |
//! Docstring!
use bio::io::fasta;
use rust_htslib::bcf;
use rust_htslib::bcf::header::HeaderView;
use rust_htslib::bcf::record::GenotypeAllele;
use rust_htslib::bcf::Read;
use std::collections::HashMap;
use std::fs::File;
use std::io::Write;
use std::str;
use failure::{Error, Fail, ResultExt};
//use rust_htslib::bcf... |
fn abs(a: i32) -> i32 {
let b = a >> 31;
return (b ^ a) - b;
}
fn min(a: i64, b: i64) -> i64 {
return b ^ ((a ^ b) & -((a < b) as i64));
}
fn main() {
println!("{:?}", abs(9));
println!("{:?}", min(1, 2));
println!("{:?}", min(2, 1));
println!("{:?}", min(2, -1));
println!("{:?}", mi... |
#![no_main]
#![no_std]
extern crate panic_halt;
extern crate stm32l4xx_hal as hal;
use mocca_matrix_rtic::prelude::*;
use smart_leds::{brightness, RGB8};
use ws2812::Ws2812;
use core::fmt::Write;
use embedded_graphics::{fonts, pixelcolor, prelude::*, style};
use hal::{
device::I2C1,
gpio::gpioa::PA0,
gpi... |
table! {
book (id) {
id -> Integer,
title -> Varchar,
author -> Varchar,
is_published -> Bool,
}
}
|
use thiserror::Error;
use solana_program::program_error::ProgramError;
#[derive(Error, Debug, Copy, Clone)]
pub enum StakingError {
#[error("Invalid Instruction")]
InvalidInstruction,
#[error("NotRentExempt")]
NotRentExempt,
#[error("Deserialized account is not an SPL Token mint")]
ExpectedMin... |
pub(crate) use symtable::make_module;
#[pymodule]
mod symtable {
use crate::{
builtins::PyStrRef, compiler, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
};
use rustpython_codegen::symboltable::{
Symbol, SymbolFlags, SymbolScope, SymbolTable, SymbolTableType,
};
use std::... |
pub use counttoken::analysis::usertoken;
pub use std::collections::BTreeMap;
pub use std::collections::HashMap;
fn main() {
let _ = usertoken::statistic_tokens();
}
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "ApplicationModel_UserActivities_Core")]
pub mod Core;
#[link(name = "windows")]
extern "system" {}
pub type IUserActivityContentInfo = *mut ::core::ffi::c_void;
pub type UserActivity = *mu... |
use self::events as ev;
use crate::twin::Twin;
use crate::twin::{mk_publish_request, tag_with_id};
use actyx_sdk::service::{EventService, PublishResponse};
use actyx_sdk::{tag, Event, Payload, TagSet};
pub mod events;
#[derive(Clone, Debug, PartialEq)]
pub struct LaunchpadTwinState {
pub id: String,
pub curren... |
use crate::{runtime::Runtime, ast::nodes::VariableDeclaration};
pub fn parse_variable_declaration(runtime: &mut Runtime, declaration: &VariableDeclaration) {
for variable in declaration.declarations.iter() {
let name = variable.id.name.clone();
let literal = variable.init.clone();
runtime.... |
use super::*;
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
use std::fmt;
use std::ops::{Add, AddAssign, Div, Mul, Neg, Rem, Sub, SubAssign};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct fmx_FixPt {
_address: u8,
}
#[cfg_attr(target_os = "macos", link(kind = "framework", name = "FMWrapper"))]
#... |
/// An example of a client/server agnostic WebSocket that takes input from stdin and sends that
/// input to all other peers.
///
/// For example, to create a network like this:
///
/// 3013 ---- 3012 ---- 3014
/// \ |
/// \ |
/// \ |
/// \ |
/// \ |
/// \ |
/// ... |
use crate::ast::Ranged;
use crate::lexer::*;
use crate::parsers::expression::argument::{comma, indexing_argument_list};
use crate::parsers::expression::logical::operator_or_expression;
use crate::parsers::expression::operator_expression;
use crate::parsers::token::literal::string::{double_quoted_string, single_quoted_s... |
use std::{sync::Arc, time::Duration};
use backoff::{Backoff, BackoffConfig};
use data_types::TableId;
use iox_catalog::interface::Catalog;
use super::TableMetadata;
use crate::deferred_load::DeferredLoad;
/// An abstract provider of a [`DeferredLoad`] configured to fetch the
/// catalog [`TableMetadata`] of the spec... |
pub(crate) use decl::make_module;
#[pymodule(name = "dis")]
mod decl {
use crate::vm::{
builtins::{PyCode, PyDictRef, PyStrRef},
bytecode::CodeFlags,
compiler, PyObjectRef, PyRef, PyResult, TryFromObject, VirtualMachine,
};
#[pyfunction]
fn dis(obj: PyObjectRef, vm: &VirtualMac... |
// specialised n choose k that tries not to overflow a u64 on larger numbers
pub fn n_choose_k(n: u64, k: u64) -> u64 {
// n!/(k!*(n-k)!)
// we assume n-k > k
let mut n_on_n_sub_k_fact: u64 = 1;
let mut k_fact = Vec::new();
for i in 2..k + 1 {
k_fact.push(i);
}
// calculate n_on_n_su... |
use P70::str_to_tree;
use P72::*;
pub fn main() {
let tree = str_to_tree("afg^^c^bd^e^^^");
println!("{:?}", postorder(&tree));
}
|
use actix_web::http;
use actix_web::http::header::{HeaderMap, HeaderName, HeaderValue};
use actix_web::http::{Method, StatusCode};
use actix_web::{client, web, Error, HttpMessage, HttpRequest, HttpResponse};
use std::net::SocketAddr;
use std::time::Duration;
// use std::future::Future;
// use futures_core::stream::St... |
// resources.rs
//
// Copyright (c) 2019, Univerisity of Minnesota
//
// Author: Bridger Herman (herma582@umn.edu)
//! A collection of functions for asynchrously loading resources (shaders,
//! meshes, materials, textures, etc.) from the server
//!
//! Heavy inspiration from Wasm Bindgen Fetch Example
use js_sys::{Ar... |
pub trait Scalar: PartialEq + Copy + Default {}
impl<T: PartialEq + Copy + Default> Scalar for T {}
|
// Copyright (c) 2017 Martijn Rijkeboer <mrr@sru-systems.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or dis... |
use crate::operators::Operator;
pub struct Token(pub f64, pub Operator);
pub trait Tokens {
fn eval(&self) -> f64;
fn create(&mut self, num: f64, operator: Operator);
fn create_at(&mut self, i: usize, num: f64, operator: Operator);
}
impl Tokens for Vec<Token> {
fn eval(&self) -> f64 {
let m... |
extern crate termion;
use termion::input::TermRead;
use termion::event::Key;
use termion::raw::IntoRawMode;
use std::io;
use std::process;
mod kubectl;
mod state;
use state::{State, Event, Pod, Pods};
use anyhow::Result;
use std::sync::{Arc,Mutex};
use std::sync::mpsc::channel;
fn handle_input(state: Arc<Mutex<S... |
#[doc = "Reader of register RPR1"]
pub type R = crate::R<u32, super::RPR1>;
#[doc = "Writer for register RPR1"]
pub type W = crate::W<u32, super::RPR1>;
#[doc = "Register RPR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::RPR1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
//! Load animations and sprites from a ron file.
use amethyst::{
assets::{AssetStorage, Loader},
config::Config,
prelude::*,
renderer::{ImageFormat, Sprite, SpriteSheet, /*SpriteSheetHandle,*/ Texture, /*TextureMetadata*/
sprite::SpriteSheetHandle, SpriteRender,
},
};
use regex::Regex;
use ... |
use crate::{
context::RpcContext,
v02::types::{reply::FeeEstimate, request::BroadcastedTransaction},
};
use pathfinder_common::BlockId;
use super::common::prepare_handle_and_block;
#[derive(serde::Deserialize, Debug, PartialEq, Eq)]
pub struct EstimateFeeInput {
request: Vec<BroadcastedTransaction>,
b... |
use std::{
fs::File,
io::{BufReader, BufWriter},
path::PathBuf,
};
use chrono::Utc;
use parking_lot::Mutex;
use serde::{Deserialize, Serialize};
use steamworks::PublishedFileId;
#[derive(Serialize, Deserialize)]
struct AddWorkshopEntry {
id: PublishedFileId,
name: Option<String>,
}
#[derive(Serialize, Deseriali... |
// Builder for printing Candy values.
use itertools::{EitherOrBoth, Itertools};
use num_bigint::BigInt;
use std::{borrow::Cow, ops::Sub};
pub enum FormatValue<'a, T: Copy> {
Int(Cow<'a, BigInt>),
Tag { symbol: &'a str, value: Option<T> },
Text(&'a str),
List(&'a [T]),
Struct(Cow<'a, Vec<(T, T)>>),... |
use self::{
close::Close, create::Create, echo::Echo, negotiate::Negotiate, query_info::QueryInfo,
session_setup::SessionSetup, tree_connect::TreeConnect,
};
pub mod close;
pub mod create;
pub mod echo;
pub mod negotiate;
pub mod query_info;
pub mod session_setup;
pub mod tree_connect;
/// The request type de... |
#[cfg(any(
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "sha"),
all(target_arch = "aarch64", target_feature = "neon", target_feature = "crypto"),
))]
mod shani;
#[cfg(any(
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "sha"),
all(target_arch = "aarch64... |
// Copyright 2013-2015 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-MI... |
// 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.
use {
crate::{
action_match::query_action_match,
models::{Action, AddModInfo, Intent, Suggestion},
story_context_store::Context... |
// Copyright 2015 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 ... |
//! MuSug Process Context
use crate::PublicKey;
use bacteria::Transcript;
use mohan::dalek::scalar::Scalar;
/// The context for signing - can either be a Multikey or Multimessage context.
pub trait MuSigContext {
/// Takes a mutable transcript, and commits the internal context to the transcript.
fn commit(&se... |
use crate::utils::create_return_with_default;
use swc_core::{
common::{Spanned, DUMMY_SP},
ecma::{ast::*, transforms::testing::test, visit::*},
plugin::{plugin_transform, proxies::TransformPluginProgramMetadata},
};
mod utils;
pub struct ReactDemoVisitor;
/**
* implement `VisitMut` trait for transform `export`... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.