text
stringlengths
8
4.13M
#[derive(Debug, Fail)] pub enum HashEngineError { // #[fail(display = "RwLock Poison")] // RwLockPoisonError, #[fail(display = "Key: `{:?}`, not found", k)] KeyNotFound { k: Vec<u8> }, #[fail(display = "File: `{}`, not found", path)] FileNotFound { path: String }, #[fail(display = "Mer...
use std::collections::HashSet; use std::fmt; use common::InputReader; #[derive(Debug)] enum Heading { East, North, West, South, } #[derive(Debug)] struct Walker { x: i32, // + east, - west y: i32, // + north, - south heading: Heading, locations: HashSet<(i32, i32)>, bunny_hq: Opti...
static mut PTR: *mut u8 = 0 as *mut _; fn fun1(x: &mut u8) { unsafe { PTR = x; } } fn fun2() { // Now we use a pointer we are not allowed to use let _x = unsafe { *PTR }; //~ ERROR: /read access .* tag does not exist in the borrow stack/ } fn main() { let mut val = 0; let val = &mut v...
//! # Test shell for Monotronian extern crate monotronian; use std::io::Write; struct Output; impl std::fmt::Write for Output { fn write_str(&mut self, s: &str) -> Result<(), std::fmt::Error> { print!("{}", s); Ok(()) } } fn main() -> Result<(), std::io::Error> { let mut parser = monotr...
use mongodb::{Client, bson::{Document, doc}, options::FindOptions}; use rocket::{State, futures::TryStreamExt, http::Status, serde::{Deserialize, Serialize}}; use crate::{DbOptions, models::{entities::post::Post, schemas::{error_schema::{ErrorMessage, HFError}, response_schema::HFResponse}}, utils::HFResult}; #[deriv...
use std::{collections::HashMap, net::SocketAddr, sync::Arc}; use tokio::net::UdpSocket; use tokio::sync::mpsc; use udp_chat::{ChatNotifyPacket, Packets, MAX_PACKET_SIZE}; struct Users { users: HashMap<SocketAddr, User>, } impl Users { fn new() -> Self { Self { users: HashMap::new(), ...
use serde::{Deserialize, Serialize}; use readers::prelude::Value; #[derive(Serialize, Deserialize, Debug)] pub struct LiteralProp { pub predicate_id: usize, pub value: Value, }
/* * Represents an object that is a solid part of the map, hence not moving, eventhough it may be * animated. */ extern crate sdl2; use self::sdl2::render::{Texture, Renderer}; use self::sdl2::rect::Rect; use std::rc::Rc; use graphics::TextureManager; pub struct StaticObject { texture: Rc<Texture>, // The posit...
//! Test clustering behavior. mod fixtures; use std::time::Duration; use actix::prelude::*; use actix_raft::metrics::{RaftMetrics, State}; use futures::sync::oneshot; use fixtures::{ RaftTestController, Node, setup_logger, dev::{ExecuteInRaftRouter, RaftRouter, Register}, }; /// Basic lifecycle tests for a...
extern crate svm_sdk_mock as svm_sdk; use svm_sdk_mock::host::MockHost; use svm_sdk_mock::storage::MockStorage; use trybuild::TestCases; fn pass(t: &TestCases, test: &'static str) { MockHost::reset(); MockStorage::clear(); t.pass(test); } fn compile_fail(t: &TestCases, test: &'static str) { MockHos...
#![allow(clippy::derive_partial_eq_without_eq)] use onvif as tt; use validate::Validate; use yaserde_derive::{YaDeserialize, YaSerialize}; #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] #[yaserde( prefix = "trp", namespace = "trp: http://www.onvif.org/ver10/replay/wsdl" )] pub struct GetServ...
extern crate tokio_service; extern crate futures; #[macro_use] extern crate hyper; extern crate tokio_hyper as http; use tokio_service::Service; use futures::{Async, Future, finished, BoxFuture}; use std::thread; use std::time::Duration; #[derive(Clone)] struct MyService; impl Service for MyService { type Reque...
pub mod c_binding_extern;
extern crate num_traits; extern crate ndarray; #[macro_use] extern crate linxal; extern crate lapack; use ndarray::{Array, Ix2}; use linxal::svd::{SVD}; use linxal::types::{LinxalScalar, c32, c64}; use num_traits::{One}; /// Identity matrix SVD pub fn svd_test_identity<T: SVD>() { const N: usize = 100; let m:...
use super::HtmlEngine; use maple_core::prelude::*; use maple_macro::view; use maple_stdui::prelude::Panel; use maple_stdweb::*; impl View<HtmlEngine, HtmlEngine> for Panel { type InputContext = DefaultContext; type OutputContext = DefaultContext; type Renderable<C: Renderable<HtmlEngine> + 'static> = impl ...
use std::ops::{Add, Sub, Mul, Neg, AddAssign}; use image::Rgb; pub const INFINITY: f32 = 10_000_000.; #[derive(Debug, Clone, Copy)] pub struct Vector<T> { pub x: T, pub y: T, pub z: T, } pub type VectorF = Vector<f32>; pub const ZERO_VECTOR: &VectorF = &VectorF { x: 0., y: 0., z: 0., }; pub...
/*! Encoding conversion support. */ use std::fmt; pub mod mb_x_wc; #[cfg(target_os="linux")] pub mod linux; #[cfg(target_os="linux")] pub use self::linux as os; #[cfg(target_os="windows")] pub mod windows; #[cfg(target_os="windows")] pub use self::windows as os; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub en...
use crate::hitable::{HitRecord, Hitable}; use crate::material::Material; use crate::ray::Ray; use crate::util::Vec3f; pub struct Sphere { pub center: Vec3f, pub radius: f64, pub material: Material, } impl Sphere { pub fn new(center: Vec3f, radius: f64, material: Material) -> Sphere { Sphere { ...
//! Example 'direct-cursor' //! //! Explore cursor functions in direct mode //! // utility macro: sleep for $ms milliseconds macro_rules! sleep { ($ms:expr) => { std::thread::sleep(std::time::Duration::from_millis($ms)); }; } // utility macro: convert the String $s to *mut CString macro_rules! cstring...
// https://leetcode.com/problems/largest-divisible-subset/ // Given a set of distinct positive integers nums, return the largest subset answer such that // every pair (answer[i], answer[j]) of elements in this subset satisfies: // answer[i] % answer[j] == 0, or // answer[j] % answer[i] == 0 // If there are multipl...
//! Somewhere Between Unit and Integration Tests use crate::server; use crate::commands; use crate::args; use structopt::StructOpt; use serde_json::json; #[test] pub fn test_read_write_disk() { let mut opt = args::Arguments::from_args(); opt.path = std::path::PathBuf::from("test-databases"); let server...
/* Scalar and compound types are always stored on the STACK. The Stack is FIFO, */ fn scalar_variables() { let random_variable: u32 = 12; // random_variable value will be stored in the Stack } fn create_string() { let mut s = String::from("hello"); // Creates a String object from a literal, in this c...
pub enum Enum2 { A, B, }
//! A Web client to Fetcher Web UI //! //! use std::io::Read; use url::{Url, ParseError}; use hyper; use hyper::client::response::Response; use hyper::header::ContentType; use hyper::mime::Mime; use hyper::header::Connection; use hyper::header::ConnectionOption; use serde_json; use clients::{Client, SeriesData, Prov...
use crate::damage::{DamageInstance, DamageResult, DamageType}; use enum_map::{enum_map, EnumMap}; use serde::Serialize; use std::fmt::Display; #[derive(Clone, Copy, Serialize, Debug)] pub enum BodyPartLayerType { Skin, Muscle, Bone, Flesh, Artery, } impl Default for BodyPartLayerType { fn default...
pub mod schema; pub mod db_connection; pub mod routes;
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::rc::Rc; use ocaml::caml; use ocamlpool_rust::utils::{block_field, str_field}; use oxidized::relative_path::RelativePath; use p...
#[macro_use] extern crate serde_derive; extern crate serde_json; use serde_json as json; #[derive(Debug, Deserialize)] #[serde(deny_unknown_fields)] struct FooCommon { name: String, version: String, } #[derive(Debug, Deserialize)] #[serde(deny_unknown_fields, tag = "type")] enum Foo { #[serde(rename = "foo1")]...
use clap::{App, Arg}; use url::Url; use http::method::Method; #[derive(Debug)] pub struct Config { pub url: Url, pub method: Method, } pub fn parse() -> Config { let default_method: Method = Default::default(); let matches = App::new("hypha") .author(crate_authors!()) .version(crate_v...
use crate::rayt::*; // ScatterInfo struct ScatterInfo { ray: Ray, albedo: Color, pdf_value: f64, } impl ScatterInfo { fn new(ray: Ray, albedo: Color, pdf_value: f64) -> Self { Self { ray, albedo, pdf_value } } } // Textures trait Texture: Sync + Send { fn value(&self, u: f64, v: f64...
use super::{Anchor, AnchorInner, Engine}; use std::panic::Location; pub mod cutoff; pub mod map; pub mod map_mut; pub mod refmap; pub mod then; /// A trait automatically implemented for tuples of Anchors. /// /// You'll likely want to `use` this trait in most of your programs, since it can create many /// useful Anch...
use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::PathBuf; use structopt::StructOpt; type Position = (isize, isize); #[derive(Debug, Clone, Copy)] enum Direction { Right(isize), Up(isize), } #[derive(Debug, Clone, Copy)] struct Segment { origin: Position, direction: D...
use smartcore::dataset::iris::load_dataset; // DenseMatrix wrapper around Vec use smartcore::linalg::naive::dense_matrix::DenseMatrix; // ndarray use ndarray::Array; // Imports for KNN classifier use smartcore::math::distance::Distances; use smartcore::neighbors::knn_classifier::*; // Imports for Logistic Regression us...
use std::str::FromStr; use regex::Regex; use common::{BadInput, InputReader}; enum Instruction { Rect(usize, usize), RotateRow(usize, usize), RotateCol(usize, usize), } impl FromStr for Instruction { type Err = BadInput; fn from_str(line: &str) -> Result<Self, Self::Err> { use Instructi...
/** * Wrapper methods for numeric type casts */ pub trait NumConv { pure fn to_u8(&self) -> u8; pure fn to_u16(&self) -> u16; pure fn to_u32(&self) -> u32; pure fn to_u64(&self) -> u64; pure fn to_uint(&self) -> uint; pure fn to_i8(&self) -> i8; pure fn to_i16(&self) ->...
use anyhow::Result; use clap::Parser; /// Print the textual form of a WebAssembly binary. #[derive(Parser)] pub struct Opts { #[clap(flatten)] io: wasm_tools::InputOutput, /// Whether or not to print binary offsets intermingled in the text format /// as comments for debugging. #[clap(short, long)]...
use argh::FromArgs; use glfw::Modifiers; use luminance::blending::{Equation, Factor}; use luminance::context::GraphicsContext as _; use luminance::pipeline::{BoundTexture, PipelineState}; use luminance::pixel::{NormRGBA8UI, NormUnsigned}; use luminance::render_state::RenderState; use luminance::shader::program::{Progra...
use std::fmt::{self, Write}; use aglet_text::Span; use colored::{Color, Colorize}; use crate::Pretty; use crate::Result; use crate::Writer; const DEFAULT_COLOR: Color = Color::White; const PARAMETER_COLOR: Color = Color::TrueColor { r: 150, g: 150, b: 150, }; /// Printer for an abstract syntax tree /// ...
use crate::prelude::*; use crate::compiler::Compiler; use super::{Vm, Round}; use quote::{Tokens}; use std::mem; use std::iter::once; use proc_macro2::{Term, Span}; struct Syn { tokens: Tokens, stored: usize, inputs: Vec<Term> } impl Syn { pub fn new() -> Syn { Syn { tokens: Tokens:...
pub mod buffers; pub mod picker; mod matcher; mod status; use std::{borrow::Cow, path::PathBuf, rc::Rc}; use zi::{ components::text::{Text, TextProperties}, Background, Callback, Component, ComponentExt, ComponentLink, Foreground, Layout, Rect, ShouldRender, Style, }; use self::{ buffers::{BufferEntr...
// Copyright (c) 2016 Arav Singhal. use std::path::Path; use std::io; use std::rc::Rc; use std::collections::BTreeMap; pub struct FileCache { pub files: BTreeMap<String, Rc<String>>, } impl FileCache { pub fn file_exists(&self, path: &Path) -> bool { self.files.contains_key(&path.to_str().unwrap_or...
pub mod prelude { pub use { {{traits}} }; }
//! //! # CRD traits //! //! Trait for CRD Spec/Status definition //! mod crd; pub mod metadata; pub mod options; pub use self::crd::Crd; pub use self::crd::CrdNames; pub use self::crd::GROUP; pub use self::crd::V1; pub trait Status: Sized{} /// Kubernetes Spec pub trait Spec: Sized { type Status: Status; ...
// Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license use toml::Value; use lumol_core::energy::{CoulombicPotential, Ewald, SharedEwald, Wolf}; use lumol_core::System; use log::{info, warn}; use super::read_restriction; use crate::{InteractionsInput, Error, FromToml, ...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // 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.a...
use crate::read; use itertools::Itertools; struct Chunk { data: String, } impl Chunk { fn verify(&self, flag_finish: bool) -> String { let mut vec_roll = Vec::with_capacity(self.data.len()); for itr_char in self.data.chars() { if [')', ']', '}', '>'].contains(&itr_char) { let stack_last = *vec_roll.last(...
extern crate env_logger; #[macro_use] extern crate log; #[macro_use] extern crate error_chain; extern crate futures; extern crate hyper; extern crate structopt; #[macro_use] extern crate structopt_derive; extern crate rand; extern crate sse; extern crate tokio; extern crate tokio_timer; use std::sync::{atomic, Arc}; u...
use facade_attr::facade; #[facade] mod sub1; #[facade(hide)] mod sub2;
use super::{bytes_to_uint32, Checksum, Entry, IndexError}; use crate::{ id, lockfile::{LockError, Lockfile}, workspace, }; use bytes::{BufMut, Bytes, BytesMut}; use sorted_vec::SortedSet; use std::{ collections::{HashMap, HashSet}, fs::{File, OpenOptions}, io, path::PathBuf, }; const VERSIO...
mod file; mod hetzner; mod mock; use act_zero::{Actor, ActorResult, Addr}; use async_trait::async_trait; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use std::net::IpAddr; use crate::node::discovery::NodeDiscoveryState; use crate::AppConfig; use crate::{cloud_init, config, hetzner_cloud}; use act...
struct Solution; impl Solution { pub fn fizz_buzz(n: i32) -> Vec<String> { (1..=n) .map(|n| { if n < 5 { if n == 3 { return String::from("Fizz"); } else { return n.to_string(); ...
//! Parallel iterator types for [arrays] (`[T; N]`) //! //! You will rarely need to interact with this module directly unless you need //! to name one of the iterator types. //! //! [arrays]: https://doc.rust-lang.org/std/primitive.array.html use crate::iter::plumbing::*; use crate::iter::*; use crate::slice::{Iter, I...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct NdmpSettingsPreferredIpCreateParams { #[serde(rename = "data_subnets")] pub data_subnets: Vec <crate::models::NdmpSettingsPreferredIpDataSubnet>, /// Either cluster or a network subnet defined in OneFS. ...
// * This file is part of the uutils coreutils package. // * // * (c) KokaKiwi <kokakiwi@kokakiwi.net> // * (c) Jian Zeng <anonymousknight86@gmail.com> // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. /* last synced with: who...
/// The font data here must be in the same order as the `Char` enum. This is /// based the cp850-8x16 font from FreeBSD. See /// http://web.mit.edu/freebsd/head/share/syscons/fonts/cp850-8x16.fnt. It /// has been modified to include Teletext 'sixels' (block graphic glyphs) /// instead of the usual extended ASCII charac...
use structopt::StructOpt; /// Command line arguments to be parsed by StructOpt #[derive(Debug, StructOpt, Clone)] #[structopt(about = "Starts an ACI Server")] #[structopt(version = crate::version::BUILD_VERSION)] #[structopt(rename_all = "kebab-case")] pub struct Arguments { #[structopt(flatten)] pub verbose: ...
use crate::Bus; use crate::Error; pub mod bank; pub mod config; use crate::bus::memory_map::*; pub use bank::*; pub use config::*; use std::sync::Mutex; /// Controls the GPIO pins on a MATRIX device. #[derive(Debug)] pub struct Gpio<'a> { bus: &'a Bus, /// Current setting of each pin's mode (binary representat...
use sp_runtime_interface::runtime_interface; #[runtime_interface] trait Test { fn foo() {} #[cfg(feature = "bar-feature")] fn bar() {} #[cfg(not(feature = "bar-feature"))] fn qux() {} } fn main() { test::foo(); test::bar(); test::qux(); }
//Copyright 2020 EinsteinDB Project Authors & WHTCORPS Inc. Licensed under Apache-2.0. use tuplespaceInstanton::data_lightlike_key; use ekvproto::meta_timeshare::Brane; use violetabft::StateRole; use violetabftstore::interlock::{BraneInfo, BraneInfoAccessor}; use violetabftstore::store::util::{find_peer, new_peer}; us...
//! Implements the CRC32c "combine" function, which calculates the CRC32c of two byte streams //! concatenated together using their individual CRC32c values (plus the length of the second byte //! stream). //! //! This module is essentially a line-by-line translation of ZLIB's CRC "combine" function //! implementation ...
use std::io::stdin; fn celcius_to_fahrenheit(c_number: f32) -> f32 { (c_number * 9.0 / 5.0) + 32.0 } fn main() { println!("Celcius to Fahrenheit converter!\n Type ':q' to exit"); loop { println!("Enter a number:"); let mut number_to_convert = String::new(); stdin() ....
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use thi...
fn main() { let mut s = String::from("hello"); println!("before the call, {}", s); { let r1 = &mut s; change(r1); println!("after the call, {}", r1); } { println!("between the calls, {}", s); let mr1 = &s; // immutable reference println!("between ...
//! events a `Term` could return pub use crate::key::Key; #[derive(Debug)] pub enum Event { Key(Key), Resize { width: usize, height: usize, }, Restarted, #[doc(hidden)] __Nonexhaustive, }
// Copyright 2021 The Jujutsu 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
//! nip object implementation use failure::Error; use futures::Stream; use git2::{Blob, Commit, ObjectType, Odb, OdbObject, Oid, Tag, Tree}; use ipfs_api::IpfsClient; use tokio::runtime::current_thread; use std::{collections::BTreeSet, io::Cursor}; use crate::{ constants::{NIP_HEADER_LEN, NIP_PROTOCOL_VERSION}, ...
/* Copyright 2013 10gen Inc. * * 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 in writi...
#[doc = "Register `EVENTS_EDSTOPPED` reader"] pub struct R(crate::R<EVENTS_EDSTOPPED_SPEC>); impl core::ops::Deref for R { type Target = crate::R<EVENTS_EDSTOPPED_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<EVENTS_EDSTOPPED_SPEC>> for R { #[inli...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 0x24], #[doc = "0x24 - Acquire SPI semaphore"] pub tasks_acquire: TASKS_ACQUIRE, #[doc = "0x28 - Release SPI semaphore, enabling the SPI slave to acquire it"] pub tasks_release: TASKS_RELEASE, _reserved2: [u8; 0xd8...
extern crate mpv; extern crate serial; // use mpv::mpv; use std::env; use std::path::Path; use std::thread::sleep_ms; use std::thread::spawn; use std::sync::mpsc; use std::io; use std::time; use std::io::prelude::*; use serial::prelude::*; // fn interact<T: SerialPort>(port: &mut T) -> io::Result<()> { // try!(port...
struct Solution; use util::*; impl Solution { fn trim_bst(root: TreeLink, l: i32, r: i32) -> TreeLink { if let Some(node) = root.clone() { let mut node = node.borrow_mut(); let left = node.left.take(); let right = node.right.take(); if node.val > r { ...
//! An events loop on Win32 is a background thread. //! //! Creating an events loop spawns a thread and blocks it in a permanent Win32 events loop. //! Destroying the events loop stops the thread. //! //! You can use the `execute_in_thread` method to execute some code in the background thread. //! Since Win32 requires ...
use crate::Mesh; // Do I just want to make Meshes as a trait and then light as a separate array in the scene? // It might be much easier // Mesh trait which exposes geometry, material and children and then we can have InstancedMesh, AnimatedMesh, whatever pub struct Scene<'a> { pub meshes: Vec<&'a Mesh>, //pub...
// self explanitory. Unit is not prime fn prime_factors(n : u64) -> Vec<u64> { let mut num = n; let mut factors = Vec::new(); while num != 1 { if num % 2 == 0{ factors.push(2); num /= 2; continue; } if num % 3 == 0 { factors.push(3); num /= 3; continue; } for i in (1..).map(|x| x * 6) { ...
use async_trait::async_trait; use mm2_err_handle::prelude::MmError; use mm2_net::transport::slurp_url_with_headers; use serde::de::DeserializeOwned; use crate::{FileMetadata, GitCommons, GitControllerError, RepositoryOperations}; const GITHUB_CLIENT_USER_AGENT: &str = "mm2"; pub struct GithubClient { api_address...
use chrono::NaiveDate; use finmind::crawler; use finmind::schema::{Data, Dataset}; #[cfg(test)] use tokio_test::block_on; #[test] fn test_taiwan_stock_price_blocking_pass() { let res = crawler::request_blocking(( Dataset::TaiwanStockPrice, "0050".to_owned().to_owned(), NaiveDate::from_ymd(...
use fwupd_dbus::{Client, Signal}; use std::{ error::Error, process, sync::{ atomic::{AtomicBool, Ordering}, Arc, }, thread, time::Duration, }; fn main() { if let Err(why) = main_() { let mut error = format!("error: {}", why); let mut cause = why.source(); ...
use async_trait::async_trait; use common::{now_ms, PagingOptionsEnum}; use db_common::sqlite::rusqlite::types::FromSqlError; use derive_more::Display; use lightning::ln::{PaymentHash, PaymentPreimage}; use secp256k1v24::PublicKey; use serde::{Deserialize, Serialize}; use std::str::FromStr; use uuid::Uuid; #[derive(Clo...
//@revisions: stack tree //@[tree]compile-flags: -Zmiri-tree-borrows unsafe fn test(mut x: Box<i32>, y: *const i32) -> i32 { // We will call this in a way that x and y alias. *x = 5; std::mem::forget(x); *y //~[stack]^ ERROR: weakly protected //~[tree]| ERROR: /read access through .* is forbidd...
use either::Either; pub trait State { type Id; fn state() -> Self::Id; } pub trait Step { type SomeState; type Context; type Input; type ThisState; type NextState: Into<Self::SomeState>; type Error; fn step( self, game: &mut Self::Context, input: Self::Inp...
use std::cmp; use ::expr::Expr; #[cfg(test)] mod spec; #[derive(PartialEq,Debug,Clone,Eq,Hash)] pub enum Condition { One(u8), // ascii encoded char Class(Vec<u8>), // list of valid ascii encoded chars Any, None } impl Condition { pub fn one(c: char) -> Condition { Condition::One(Self::t...
//! An implementation of bases. use super::*; use std::collections::BTreeSet; use std::collections::{HashMap, HashSet}; use failure; use failure::Fail; /// A set of arrow effects. #[derive(Clone, Debug, Default, PartialEq)] pub struct ArrEffSet(BTreeSet<ArrEff>); /// A basis. #[derive(Clone, Debug, Default, Partia...
pub(crate) mod generated; use crate::descriptor::OneofDescriptorProto; use crate::reflect::file::index::OneofIndices; use crate::reflect::file::FileDescriptorImpl; use crate::reflect::oneof::generated::GeneratedOneofDescriptor; use crate::reflect::FieldDescriptor; use crate::reflect::FileDescriptor; use crate::reflect...
use crate::error::*; use crate::listener::Listener; use crate::manifest::Config; use crate::tararchive::Archive; use md5::Digest; use std::collections::HashMap; use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; use zopfli::{self, Format, Options}; /// Generates an uncompressed tar archive and hashes of ...
use std::process::*; fn submit_octave(code: String) -> (String, String) { let process = match Command::new("/usr/bin/octave").arg("-q").arg("--eval") .arg(format!("{}", code)) .stdout(Stdio::piped()).stderr(Stdio::piped()) ...
use std::cell::RefCell; use std::future::Future; use std::mem; use std::pin::Pin; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use std::thread_local; use std::time::{Duration, Instant}; use futures::future::{ok, Ready}; use crate::pool::Dependencies; use...
// 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 serde::{Deserialize, Serialize}; use std::time::SystemTime; #[derive(Serialize, Deserialize)] pub struct Messages { pub message: String, pub from: String, pub date: Option<SystemTime>, pub room_date: Option<SystemTime>, }
pub mod moead; pub mod nsga2;
pub struct Trie { bits: Vec<u128>, links: Vec<Vec<usize>>, in_dict: Vec<bool>, } impl Trie { pub fn new() -> Self { Self { bits: vec![0], links: vec![vec![]], in_dict: vec![false], } } pub fn insert(&mut self, s: &[u8]) { let mut u = 0;...
use cocoa::base::{ id, class }; pub struct Color { id: id, } impl Color { pub fn red() -> Color { Color { id: unsafe{ msg_send![class("NSColor"), redColor] } } } pub fn green() -> Color { Color { id: unsafe{ msg_send![class("NSColor"), greenColor] } } } pub fn system_gray() -...
// Copyright (C) 2021 Scott Lamb <slamb@slamb.org> // SPDX-License-Identifier: MIT OR Apache-2.0 //! Fixed-size audio sample codecs as defined in //! [RFC 3551 section 4.5](https://datatracker.ietf.org/doc/html/rfc3551#section-4.5). use std::num::NonZeroU32; use bytes::Bytes; use super::CodecItem; #[derive(Debug)]...
extern crate mitte_amd64; extern crate memmap; use std::fs::File; use std::io::{self, Read, Write, Cursor, Stdin, Stdout}; use std::mem; use mitte_amd64::Emit; use mitte_amd64::reg::*; use mitte_amd64::{word_ptr, qword_ptr}; use mitte_amd64::label::{BindLabel, Label}; use memmap::{Mmap, Protection}; fn main() { ...
use crate::instructions::base::bytecode_reader::BytecodeReader; use crate::instructions::base::instruction::{ConstantPoolInstruction, Instruction}; use crate::runtime::frame::Frame; use crate::oops::constant_pool::Constant::FieldReference; use crate::instructions::references::ResolveFieldRef; pub struct GetField(Const...
#[derive(Debug, Deserialize)] pub struct Configuration { pub sources: Vec<Source> } #[derive(Debug, Deserialize)] pub struct Source { pub name: String, #[serde(rename="type")] pub source_type: SourceType, pub url: String, pub query: String } #[derive(Debug, Deserialize)] pub enum SourceType { ...
use std::sync::Arc; use actix_web::{get, web, HttpResponse}; use mysql::{prelude::Queryable, Row, Params, params}; use serde::Serialize; use crate::env::AppData; use crate::error::{HttpResult, Error}; use log::warn; #[derive(Serialize)] struct DescribeResponse { active: bool, user_id: Option<...
use super::super::{EccPoint, EccScalarFixed, FixedPoints, FIXED_BASE_WINDOW_SIZE, H, NUM_WINDOWS}; use crate::utilities::{decompose_word, range_check}; use arrayvec::ArrayVec; use ff::PrimeField; use halo2_proofs::{ circuit::{AssignedCell, Layouter, Region, Value}, plonk::{ConstraintSystem, Constraints, Error,...
use actix_web::{get, web, HttpRequest, HttpResponse}; use mysql::{prelude::Queryable, Row, Params, params}; use serde::Serialize; use crate::env::AppData; use std::sync::Arc; use crate::error::{HttpResult, Error}; #[derive(Serialize)] struct DescribeResponse { active: bool, name: Option<Str...
use crate::config::ForumConfig; use cookie; use encoding_rs::WINDOWS_1251; use reqwest::header::{HeaderMap, CONTENT_TYPE, COOKIE, SET_COOKIE}; use reqwest::{Client, ClientBuilder, Proxy, RedirectPolicy, StatusCode}; use scraper::element_ref::ElementRef; use scraper::{Html, Selector}; use std::ops::Deref; use std::rc::R...
#[macro_export] macro_rules! canio_ok { ($read_name:ident : $($buf:literal),* $(,)? = $write_name:ident : $expr:expr) => { #[test] pub fn $read_name() { let actual = ::rakrs_io::CanIo::read(::std::io::Cursor::new(::std::vec![$($buf),*])) .expect("Panic reading correct dat...