text
stringlengths
8
4.13M
extern crate json; use std::collections::HashMap; use std::collections::HashSet; /*use std::cell::RefCell; use std::fmt;*/ use std::mem; use algo_tools; /*struct Vertex<'a> { word: String, distance: RefCell<i32>, neighbors: RefCell<Vec<&'a Vertex<'a>>>, } impl<'a> Vertex<'a> { pub fn new(word: &String) -> Vert...
use super::schema::{ ConnectionRequest, ConnectionRequest_Type, ConnectionResponse, ConnectionResponse_Status, StreamUpdate, }; use super::{ convert_procedure_result, recv_msg, send_msg, Connection, ConnectionError, KrpcResult, ResponseError, StreamError, }; use crate::codec::{Decode, Encode}; use std:...
fn main(){ proconio::input!{mut n:u64}; let mut s=String::new(); while n>0{ n-=1; s.insert(0,((n%26)as u8+b'a') as char); n/=26 } println!("{}",s) }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qfontdatabase.h // dst-file: /src/gui/qfontdatabase.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin ...
extern crate clap; extern crate reqwest; extern crate serde; use std::error::Error; use std::process::exit; use clap::{App, Arg, SubCommand}; use vocajeux::*; #[derive(serde::Deserialize)] struct Index { names: Vec<String> } fn index(url: &str) -> Result<Index, reqwest::Error> { let json: Index = reqwest::g...
mod with_arity; use std::convert::TryInto; use proptest::strategy::{Just, Strategy}; use proptest::test_runner::{Config, TestRunner}; use proptest::{prop_assert, prop_assert_eq}; use liblumen_alloc::erts::term::prelude::*; use liblumen_alloc::fixnum; use crate::erlang::make_tuple_3::result; use crate::test::strateg...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type INDClosedCaptionDataReceivedEventArgs = *mut ::core::ffi::c_void; pub type INDCustomData = *mut ::core::ffi::c_void; pub type INDDownloadEngine = *mut ...
use crate::config::Config; use crate::jre::Jre; use crate::util::OsType; use anyhow::Result; use sha1::{Digest, Sha1}; use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; pub struct LibericaJre { os_type: OsType, jre_version: String, } impl LibericaJre { pub fn new(os_type: OsType, config: &C...
use crate::lib::{default_sub_command, file_to_string, parse_isize, Command}; use anyhow::Error; use clap::{value_t_or_exit, App, ArgMatches, SubCommand}; use nom::{ branch::alt, bytes::complete::tag, combinator::map, multi::separated_list1, sequence::{terminated, tuple}, }; use simple_error::SimpleE...
use std::sync::Arc; use datafusion::execution::context::SessionState; use self::{ handle_gapfill::HandleGapFill, influx_regex_to_datafusion_regex::InfluxRegexToDataFusionRegex, }; mod handle_gapfill; mod influx_regex_to_datafusion_regex; pub use handle_gapfill::range_predicate; /// Register IOx-specific logical...
//! Typestate [line protocol] builder. //! //! [line protocol]: https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol //! [special characters]: https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/#special-characters use bytes::BufMut; use std::{ fmt::{self}, marker::Pha...
//! The following is derived from Rust's //! library/std/src/os/windows/raw.rs, //! library/std/src/os/windows/io/raw.rs and //! library/std/src/os/windows/io/socket.rs //! at revision //! 4f9b394c8a24803e57ba892fa00e539742ebafc0. //! //! All code in this file is licensed MIT or Apache 2.0 at your option. mod raw { ...
// 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::constants::FIREBASE_TOKEN_URI; use crate::error::{AuthProviderError, ResultExt}; use crate::http::{HttpRequest, HttpRequestBuilder}; use crate::...
use futures::{Future, Poll}; use rustls::ClientSession; use std::sync::Arc; use tokio::executor::DefaultExecutor; use tokio::net::tcp::TcpStream; use tokio_rustls::{rustls::ClientConfig, Connect, TlsConnector, TlsStream}; use tower_grpc::Request; use tower_h2::client; use tower_service::Service; use tower_util::MakeSer...
use {Uri, Result}; use convert::{HttpTryFrom, HttpTryInto}; use super::{Authority, Scheme, Parts, PathAndQuery}; /// A builder for `Uri`s. /// /// This type can be used to construct an instance of `Uri` /// through a builder pattern. #[derive(Debug)] pub struct Builder { parts: Option<Result<Parts>>, } impl Build...
#![deny(warnings)] #![feature(box_patterns)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_def_site)] extern crate proc_macro; use proc_macro2::Ident; use proc_macro::TokenStream; use quote::{quote, ToTokens}; use syn::parse::{Parse, ParseBuffer}; use syn::spanned::Spanned; use syn::{ parse_macro_inp...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - FDCAN Core Release Register"] pub fdcan_crel: FDCAN_CREL, #[doc = "0x04 - FDCAN Core Release Register"] pub fdcan_endn: FDCAN_ENDN, _reserved2: [u8; 4usize], #[doc = "0x0c - FDCAN Data Bit Timing and Prescaler Regis...
// 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...
// Advent of Code: Day 9 // // We have an encrypted file that's a sequence of numbers. We're trying // to break the encryption and in order to do so, we have to find the // first number in the sequence (after the preamble) that is not the sum // of two of the values in the previous preamble-length window. For the // te...
use arrow::datatypes::DataType; use arrow_flight::{error::FlightError, Ticket}; use arrow_util::assert_batches_sorted_eq; use data_types::{NamespaceId, TableId}; use datafusion::{ prelude::{col, lit}, scalar::ScalarValue, }; use futures::FutureExt; use http::StatusCode; use influxdb_iox_client::table::generated...
// Various tests related to testing how region inference works // with respect to the object receivers. // revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir trait Foo { fn borrowed<'a>(&'a self) -> &'a (); } // Borrowed receiver but two distinct lifetimes, we get an error. fn ...
//! linux_raw syscalls for PIDs //! //! # Safety //! //! See the `rustix::backend` module documentation for details. #![allow(unsafe_code)] #![allow(clippy::undocumented_unsafe_blocks)] use crate::backend::conv::ret_usize_infallible; use crate::pid::{Pid, RawPid}; #[inline] pub(crate) fn getpid() -> Pid { unsafe ...
use std::fs::File; use std::path::Path; use std::path::PathBuf; use structopt::StructOpt; use csv::{Reader, ReaderBuilder}; use serde_json::to_string; pub type Value = serde_json::Value; pub type Map = serde_json::Map<String, Value>; #[async_std::main] async fn main() -> Result<(), csv::Error> { let opt = Opt::f...
/* * MIT License * * Copyright (c) 2018 Clément SIBILLE * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, ...
// 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 ...
// 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 ...
/* * Author: Dave Eddy <dave@daveeddy.com> * Date: January 25, 2022 * License: MIT */ //! `vsv <anything>`. use std::env; use anyhow::{bail, ensure, Context, Result}; use clap::crate_name; use yansi::Color; use crate::utils; use crate::{config, config::Config}; /// Handle `vsv <any-non-matching-command>`. pub ...
use fuzzcheck::DefaultMutator; #[derive(Clone, DefaultMutator)] pub enum X { A(u8), } #[cfg(test)] mod test { use fuzzcheck::Mutator; use super::*; #[test] #[no_coverage] fn test_compile() { let m = X::default_mutator(); let (_value, _): (X, _) = m.random_arbitrary(10.0); ...
use crate::types::*; use neo4rs_macros::BoltStruct; #[derive(Debug, PartialEq, Clone, BoltStruct)] #[signature(0xB1, 0x01)] pub struct Hello { extra: BoltMap, } impl Hello { pub fn new(extra: BoltMap) -> Hello { Hello { extra } } } #[cfg(test)] mod tests { use super::*; use crate::version...
fn sum_elements(a: *const f32, length: u32) -> f32 { let mut result: f32 = 0.0; let mut i = 0; while i <= length - 1 { result += unsafe { *a.offset(i as isize) }; i += 1; } result }
#[doc = "Reader of register PP"] pub type R = crate::R<u32, super::PP>; #[doc = "Reader of field `SC`"] pub type SC_R = crate::R<bool, bool>; #[doc = "Reader of field `NB`"] pub type NB_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - Smart Card Support"] #[inline(always)] pub fn sc(&self) -> SC_R { ...
use crate::commands::{LllCommand, LllRunnable, ReloadDirList}; use crate::context::LllContext; use crate::error::LllError; use crate::history::DirectoryHistory; use crate::window::LllView; #[derive(Clone, Debug)] pub struct ToggleHiddenFiles; impl ToggleHiddenFiles { pub fn new() -> Self { ToggleHiddenFil...
use crate::object::Point; use crate::global::*; use rayon::prelude::*; use super::common_step::*; fn sor_method(grid: &Vec<Point>, even: bool) -> bool { let index = init_index(even); let update : Vec<(f64, bool, usize)> = index.par_iter().map( |i| step(grid, grid[*i].index, true)).collect(); update....
use crate::solver::*; use crate::graph::Primal; use itertools::Itertools; impl Solve for Primal { fn solve(self, td: Decomposition, k: usize, formula: Formula) -> Option<(Assignment, usize)> { // for each variable list the clauses which contain that variable as a positive / negative literal let occurences = formu...
// Number of 1 Bits // https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/584/week-1-february-1st-february-7th/3625/ pub struct Solution; // Cheating #[cfg(disable)] impl Solution { #[allow(non_snake_case)] pub fn hammingWeight(n: u32) -> i32 { n.count_ones() as _ } } ...
pub mod apis; pub mod applications; pub mod sso;
// Copyright 2019 Stichting Organism // // 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...
use game_lib::serde::{Deserialize, Serialize}; use semver::{Version, VersionReq}; use std::path::PathBuf; #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(crate = "game_lib::serde")] pub struct ModuleManifest { pub id: String, pub version: Version, pub entry: PathBuf, #[serd...
use euclid::*; // use euclid::TypedPoint2D as Point; use cgmath::Vector2; type V2 = (f32, f32); #[derive(Copy, Clone, Serialize)] pub struct Point { pos: V2, vel: V2, rad: f32, mass: f32, } js_serializable!(Point); pub type Objs = Vec<Point>; const G: f32 = -9.8; static mut P_COUNT: isize = 0;...
pub trait Draw { fn draw(&self); } pub struct Button { width: usize } impl Draw for Button { fn draw(&self) { println!("drawing button {}", self.width); } } pub struct Screen<T: Draw> { pub components: Vec<T>, } impl<T> Screen<T> where T: Draw { pub fn run(&self) { for c...
//! Defines usage types for memory bocks. //! See `Usage` and implementations for details. use memory::Properties; /// Memory usage trait. pub trait Usage { /// Comparable fitness value. type Fitness: Copy + Ord; /// Get runtime usage value. fn value(self) -> UsageValue; /// Get comparable fitne...
// SPDX-License-Identifier: MIT // Copyright (c) 2021-2022 brainpower <brainpower at mailbox dot org> use std::fmt; use std::process::ExitCode; use std::process::Termination; use crate::CheckArg; use crate::RC; impl Termination for RC { fn report(self) -> ExitCode { ExitCode::from(self as u8) } } impl fmt::Display...
pub mod configuration; pub mod error; pub mod handlers; pub mod macros; pub mod service; use { error::{Error, ErrorKind, Result}, hyper::{Body, Request}, lazy_static::lazy_static, serde::{Deserialize, Serialize}, slog::Logger, std::collections::HashMap, }; pub mod log { use { lazy_...
// 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. use std::sync::Arc; use failure::Error; use fidl::endpoints::{create_proxy, ClientEnd}; use fidl_fuchsia_developer_tiles as tiles; use fidl_fuchsia_ui_app...
fn main() { static COUNT: i32 = 100; let x = 0; let mut y = 0; y += 1; let z: i32 = 50; println!("x={}, y={}, z={}", x, y, z); println!("{}", COUNT * (y + 3)); }
fn main() { let _s1 = String::new(); // unused, just for init method let data = "This is some data we might store in a string; \ but it could be byte code.\nThis UTF-8 encoded string has the Display trait."; println!("{}", &data); // ref to retain scope // need mut here if we want to pu...
pub mod floor; pub mod wall; pub mod character; pub mod player;
//! Utilities for manipulating audio buffers. use audio_core::Translate; use audio_core::{Channels, ChannelsMut}; /// Copy from the buffer specified by `from` into the buffer specified by `to`. /// /// Only the common count of channels will be copied. pub fn copy<I, O, T>(from: I, mut to: O) where I: Channels<T>,...
#[doc = "Reader of register APB_FZ1"] pub type R = crate::R<u32, super::APB_FZ1>; #[doc = "Writer for register APB_FZ1"] pub type W = crate::W<u32, super::APB_FZ1>; #[doc = "Register APB_FZ1 `reset()`'s with value 0"] impl crate::ResetValue for super::APB_FZ1 { type Type = u32; #[inline(always)] fn reset_va...
use std::io::Write; #[macro_use] extern crate serde_derive; use serde::{Serialize, Serializer}; use std::sync::atomic::{AtomicUsize, Ordering}; pub trait Metric { /// Adds `value` to the current counter. fn add(&self, value: usize); /// Increments by 1 unit the current counter. fn inc(&self) { ...
extern crate aoc; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::io::{self, BufReader}; fn main() -> Result<(), io::Error> { let arg = aoc::get_cmdline_arg()?; let reader = BufReader::new(File::open(arg)?); let mut twos = 0; let mut threes = 0; let lines = r...
pub(crate) mod de; pub(crate) mod ser; pub mod time; mod to_hana; pub use to_hana::ToHana;
use super::*; #[derive(Clone)] pub struct Variable { pub name: String } impl Variable { pub fn as_expression(&self) -> Expression { Expression::Variable(self.clone()) } pub fn to_expression(self) -> Expression { Expression::Variable(self) } } impl Evaluate for Variable { fn e...
use types::{int_t, size_t, char_t}; use consts::fcntl::{O_RDONLY}; use core::raw::Repr; use core::intrinsics::size_of; use core::ops::Drop; use posix::unistd::{close, read}; use posix::fcntl::{open}; pub struct FD { fd: int_t, } impl FD { pub fn raw(&self) -> int_t { self.fd } } impl Drop for ...
#[macro_use] extern crate criterion; extern crate geo; use criterion::Criterion; use geo::prelude::*; use geo::LineString; fn criterion_benchmark(c: &mut Criterion) { c.bench_function("convex hull f32", |bencher| { let points = include!("../src/algorithm/test_fixtures/norway_main.rs"); let line_st...
pub struct Model { } impl Model { fn new(path: &str) -> Model { } }
use super::*; use rustls::Session; use std::io::Write; /// A wrapper around an underlying raw stream which implements the TLS or SSL /// protocol. #[derive(Debug)] pub struct TlsStream<IO> { pub(crate) io: IO, pub(crate) session: ClientSession, pub(crate) state: TlsState, #[cfg(feature = "early-data")...
use rocket_contrib::json::{Json, JsonValue}; use merkletree_rs::{db, MerkleTree, TestValue, Value}; use crate::client_call::{SplitSet, MessageBlock}; use reqwest; use reqwest::Response; use std::io::{Read}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct AdContent { ...
use std::path::{Path, PathBuf}; use serde::Deserialize; use toml; use crate::error::{Detail, Result}; use crate::security; use crate::security::ed25519; pub const DIR_SECURITY: &str = "security"; pub const DEFAULT_IDENTITY_METHOD: &str = "private_key"; pub struct Context<'ctx> { dir: Box<&'ctx Path>, settings: ...
mod material; pub use material::*; mod colored; pub use colored::*; mod select; mod combine; #[cfg(test)] pub mod test;
// Copyright 2020 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. // Error type for wrapping errors known to an `ffx` command and whose occurrence should // not a priori be considered a bug in ffx. // TODO(57592): conside...
use { super::Collider, crate::terrain::{ChunkMap, Vox, WorldVec}, vek::{Aabb, Vec3}, }; pub struct TerrainDetector<'a> { collider: Collider, chunk_map: &'a ChunkMap, near_offsets: Vec<[i32; 3]>, } impl<'a> TerrainDetector<'a> { pub fn try_new(collider: Collider, chunk_map: &'a ChunkMap) ->...
// auto generated, do not modify. // created: Wed Jan 20 00:44:03 2016 // src-file: /QtQuick/qquickimageprovider.h // dst-file: /src/quick/qquickimageprovider.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // m...
use crate::utils; use macro_utils::*; use std::io::{Read, Write}; use std::str::FromStr; use yaserde::{YaDeserialize, YaSerialize}; #[derive(Default, PartialEq, Debug, UtilsTupleSerDe)] pub struct ContentType(pub String); //generated file #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde( ...
use std::error::Error; use std::io::Write; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use super::command::GuanCommand; use crate::pipeline::Pipeline; pub struct LsStagesArgs { pub pipeline_file_path: String, } pub struct LsStagesCommand { args: LsStagesArgs, } impl LsStagesComma...
use actix_web::{get, HttpRequest, HttpResponse, Responder}; #[get("/health")] pub async fn get_health(_req: HttpRequest) -> impl Responder { HttpResponse::NoContent() } #[cfg(test)] mod tests { use super::get_health; use actix_web::{http::StatusCode, test, App}; #[actix_rt::test] async fn test_ge...
pub struct Solution; impl Solution { pub fn my_atoi(str: String) -> i32 { let chars = str.chars().skip_while(|&c| c == ' '); let (chars, sign) = { let mut chars = chars.peekable(); if chars.peek() == Some(&'+') { chars.next(); (chars, 1) ...
use signal::Signal; use order::{OrderBuilder, OrderKind}; use order::policy::{OrderPolicy, OrderPolicyError}; pub struct MarketOrderPolicy {} impl MarketOrderPolicy { pub fn new() -> MarketOrderPolicy { MarketOrderPolicy {} } } impl OrderPolicy for MarketOrderPolicy { fn create_order(&self, signa...
#![recursion_limit = "256"] use log::info; use std::sync::Arc; use structopt::StructOpt; use tower_lsp::{LspService, Server}; mod completion; mod definition; mod diagnostics; mod format; mod server; mod sources; #[cfg(test)] mod support; use server::Backend; #[derive(StructOpt, Debug)] #[structopt(name = "veridian",...
mod physics; pub use physics::*; use specs::prelude::*; use specs::{System, WriteStorage, ReadStorage}; use crate::ecs::components::*; use crate::ecs::resources::*; use nalgebra_glm::{vec2, Mat4, vec3}; use nalgebra::{Vector3, Matrix4}; use glfw::{Key, WindowEvent}; use ncollide3d::shape::{ShapeHandle, Cuboid}; use n...
use super::{Channel, Colorspace}; #[derive(Debug, Copy)] pub struct ColorL<T> { pub l: T, } impl<T: Clone> Clone for ColorL<T> { fn clone(&self) -> ColorL<T> { ColorL { l: self.l.clone() } } } impl<T: Channel> ColorL<T> { pub fn new_l(l: T) -> ColorL<T> { ColorL { l: l } } } impl...
pub use article::Article; pub use language_site::LanguageSite; pub use section::Section; pub use site::{Site, SiteConfig}; pub use site_index::{ArticleSearchIndex, DisambiguationSearchIndex, SearchIndex}; mod article; mod language_site; mod section; mod site; mod site_index;
use opcode::*; use std::trie::*; use std::ptr::*; use libjit::*; use std::to_bytes::*; use std::hash::*; /** * Represents a basic block. * http://en.wikipedia.org/wiki/Basic_block */ #[Deriving(Hash)] struct BasicBlock { /// Basic blocks that control can flow to this one from. prev_blocks: ~[@mut BasicBlock...
extern crate hack; use std::io::Read; use std::path::{Path}; use std::collections::{HashMap}; use hack::instruction::*; use hack::Word; fn main() { let file = std::env::args().nth(1).unwrap(); let lines = read_all_lines(&file); // let lines: Vec<String> = lines.into_iter().filter(|l| !l.starts_with("//") &...
//! Defines data structures which represent an InfluxQL //! statement after it has been processed use crate::error; use crate::plan::rewriter::ProjectionType; use datafusion::common::Result; use influxdb_influxql_parser::common::{ LimitClause, MeasurementName, OffsetClause, OrderByClause, QualifiedMeasurementName,...
use std::{borrow::Cow, fmt}; #[derive(Debug)] pub struct KafkaMessage<'a> { pub topic: Cow<'a, str>, pub partition: i32, pub offset: i64, pub key: Option<Cow<'a, [u8]>>, pub value: Option<Cow<'a, [u8]>>, } impl<'a> KafkaMessage<'a> { pub fn into_offset(self) -> KafkaOffset<'a> { KafkaO...
#![cfg_attr(feature = "unstable", feature(test))] pub mod sort;
#![feature(associated_consts)] pub mod store;
use serde_json::{json, Value}; use morgan::verifier::new_validator_for_tests; use morgan_client::rpc_client::RpcClient; use morgan_client::rpc_request::RpcRequest; use morgan_tokenbot::drone::run_local_drone; use morgan_interface::bpf_loader; use morgan_wallet::wallet::{process_command, WalletCommand, WalletConfig}; us...
//! Future-aware synchronization //! //! This module, which is modeled after `std::sync`, contains user-space //! synchronization tools that work with futures, streams and sinks. In //! particular, these synchronizers do *not* block physical OS threads, but //! instead work at the task level. //! //! More information a...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qaccessibleplugin.h // dst-file: /src/gui/qaccessibleplugin.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main bloc...
pub mod issue22; pub mod issue37; pub mod issue39;
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qline.h // dst-file: /src/core/qline.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main ...
pub mod a2s; pub mod q3m; pub mod q3s; use crate::models::TProtocol; use std::collections::HashMap; pub fn make_default_protocols() -> HashMap<String, TProtocol> { let mut out = HashMap::new(); let q3s_proto = TProtocol::from(q3s::ProtocolImpl::default()); let q3m_proto = TProtocol::from(q3m::ProtocolIm...
// Copyright 2018 Kyle Mayes // // 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...
use egraph_dataset::dataset_1138_bus; use ndarray::prelude::*; use petgraph::{graph::node_index, prelude::*}; use petgraph_algorithm_shortest_path::*; fn run<F>(f: F) where F: Fn(&UnGraph<(), ()>) -> Array2<f32>, { let graph: UnGraph<(), ()> = dataset_1138_bus(); let actual = f(&graph); let expected = ...
/* History Holds the memory of each set of rounds - a double list of choices. makes it easy to get the last set of results and add a new result. we separate the history data from the strategy implementation in order to allow strategies to play against themselves without colliding data. */ use choice::*; pub struct Hi...
use super::*; use as_derive_utils::spanned_err; use quote::ToTokens; use syn::{WhereClause, WherePredicate}; use crate::utils::{LinearResult, SynResultExt}; /// Parses and prints the syntactically valid where clauses in object safe traits. #[derive(Debug, Default, Clone, PartialEq, Eq)] pub(crate) struct MethodWhe...
//! Tests the latency model. use crate::PerfModelTest; use telamon::device::{ArgMap, Context}; use telamon::helper::{Builder, Reduce, SignatureBuilder}; use telamon::ir; use telamon::search_space::{Action, DimKind, InstFlag, Order}; /// Tests the latency of an empty loop. pub struct EmptyLoop; impl EmptyLoop { co...
use std::io::Read; use iron::prelude::*; use iron::request::Body; use iron::{status, Handler}; use serde_json; use api::MatrixApi; use config::Config; use errors::*; use handlers::matrix::Dispatcher; use log::{self, IronLogger}; use middleware::AccessToken; use models::{ConnectionPool, Events}; /// Transactions is a...
//! Tests auto-converted from "sass-spec/spec/values/identifiers/escape" #[allow(unused)] use super::rsass; #[allow(unused)] use rsass::precision; // Ignoring "normalize", start_version is 3.7. // Ignoring "script", start_version is 3.7.
extern crate rand; extern crate portaudio; extern crate hound; pub mod clock; pub mod consts; pub mod synth; pub mod events; pub mod device; pub mod effects; pub mod conversions; pub mod sampler; pub mod files; use clock::*; use device::*; use std::rc::Rc; pub fn render_audio(clock: Rc<Clock>, master: Rc<StereoEmitt...
use std::{fs, thread, time}; use regex::Regex; fn read_file(filename: &str) -> Vec<(String, String)> { let mut file_string = fs::read_to_string(filename).expect("Couldn't read file..."); let mut packets: Vec<(String, String)> = Vec::new(); let mut line_cache: Vec<&str> = Vec::new(); for line in file_s...
use crate::buf::{Buf, Channel, ChannelMut, Channels, ChannelsMut, ExactSizeBuf}; /// A chunk of another buffer. /// /// See [Buf::chunk]. pub struct Chunk<B> { buf: B, n: usize, len: usize, } impl<B> Chunk<B> { /// Construct a new limited buffer. pub(crate) fn new(buf: B, n: usize, len: usize) -> ...
//! //! Types a functionality for handling Canvas and Widget theming. //! use canvas; use color::{Color, black, white}; use position::{Margin, Padding, Position, HorizontalAlign, VerticalAlign}; use rustc_serialize::{json, Encodable, Decodable}; use std::borrow::ToOwned; use std::error::Error; use std::fs::File; use s...
#[cfg(test)] mod test_block_chain;
use std::fs::read_to_string; fn main() { for noun in 0..100 { for verb in 0..100 { let (mut prog, mut pos) = (read_to_string("in2.txt").unwrap().trim_end().split(',').map(|int| int.parse::<i32>().unwrap()).collect::<Vec<_>>(), 0); prog[1] = noun; prog[2] = verb; loop { match prog[pos] { 1 =>...
use super::components::*; use commons::math::*; use ggez::graphics::Color; use ggez::{GameError, GameResult}; use myelin_geometry::Polygon; use nalgebra::{Point2, Vector2}; use rand::prelude::StdRng; use rand::{thread_rng, Rng, SeedableRng}; use serde::{Deserialize, Serialize}; use specs::prelude::*; use specs::{World...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::SCGCTIMER { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R...
use super::{sort_by_cost_weight_ratio, Item, Problem, Solution, SolverTrait, ratio}; use arrayvec::ArrayVec; use itertools::izip; #[derive(Debug, Clone)] pub struct TabuSearchSolver { pub memory_size: usize, pub iterations: usize, } fn cost_weight(state: &[bool], items: &[Item]) -> (u32, u32) { state ...