text
stringlengths
8
4.13M
use crate::error::Error; use tokio::net::{TcpListener, TcpStream}; use tokio::sync::broadcast; use super::read::packet::*; use super::write::packet::{write, HandshakeResponse, LoginDisconnect, Pong}; use crate::util::race::{race, RaceResult}; enum ConnectionResult { Login, ServerListPing, } async fn handle_...
// 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. //! Test utilities for starting a pkgfs server. use { crate::{as_dir, as_file, blobfs::TestBlobFs, ProcessKillGuard}, failure::{Error, ResultExt},...
// 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::key_util::get_input_sequence_for_key_event, crate::pty::Pty, carnelian::{ make_message, AnimationMode, App, Color, FontDes...
// Copyright 2019, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
::windows_sys::core::link ! ( "kernel32.dll""system" #[doc = "*Required features: `\"Win32_Globalization\"`*"] fn CompareStringA ( locale : u32 , dwcmpflags : u32 , lpstring1 : *const i8 , cchcount1 : i32 , lpstring2 : *const i8 , cchcount2 : i32 ) -> i32 ); #[cfg(feature = "Win32_Foundation")] ::windows_sys::core::lin...
use rotate_enum::ShiftEnum; #[derive(ShiftEnum, PartialEq, Clone, Copy)] enum Direction { Up, Left, Down, Right, } #[test] fn test_shift() { let up = Direction::Up; let left = Direction::Left; let down = Direction::Down; let right = Direction::Right; assert!(up.next() == Some(left...
extern crate assert_cli; #[cfg(test)] mod integration { use assert_cli; #[test] fn it_can_find_fixture() { assert_cli::Assert::main_binary() .with_args(&["FIND THIS", "./tests/fixtures"]) .succeeds() .stdout() .contains("FIND THIS") .unwr...
use graph::Graph; use std::hash::Hash; use P87::nodes_by_depth_from; pub fn split_graph<T: Hash + Copy + Eq + Ord>(g: &Graph<T>) -> Vec<Graph<T>> { let mut paths = Vec::<Vec<T>>::new(); let node_vals = g.get_node_values(); // find all depth-first paths for v in node_vals { let is_visited = pat...
use super::id::ConnectionId; /// This component represents a network connection with the given ID #[derive(Debug, Clone, Copy, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Connection { pub id: ConnectionId }
#[doc = "Reader of register ASCR"] pub type R = crate::R<u32, super::ASCR>; #[doc = "Writer for register ASCR"] pub type W = crate::W<u32, super::ASCR>; #[doc = "Register ASCR `reset()`'s with value 0"] impl crate::ResetValue for super::ASCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
extern mod nanomsg; use std::str::*; use nanomsg::*; use std::rt::io::Writer; #[fixed_stack_segment] fn main () { let SOCKET_ADDRESS = "tcp://127.0.0.1:5555"; printfln!("server binding to '%?'", SOCKET_ADDRESS); // create and connect let sockret = NanoSocket::new(AF_SP, NN_PAIR); let mut sock : N...
use ethereum_types::U64; use serde_repr::*; #[derive(Serialize_repr, Eq, Hash, Deserialize_repr, Debug, Copy, Clone, PartialEq)] #[repr(u8)] pub enum TypedTxId { EIP1559Transaction = 0x02, AccessList = 0x01, Legacy = 0x00, } impl TypedTxId { // used in json tets pub fn from_u8_id(n: u8) -> Option<...
extern crate rand; extern crate num; use rand::Rng; const OPEN_BRACKET_STATE: u8 = 1; const CLOSE_BRACKET_STATE: u8 = 2; const NUMBER_STATE: u8 = 3; const OPERATOR_STATE: u8 = 4; const OPERATORS: [char; 4] = ['/', '*', '-', '+']; const OPEN_BRACKET: char = '('; const CLOSE_BRACKET: char = ')'; static OPEN_BRACKET...
use std::{fs, fs::File, io::Write, path::Path}; use log::info; use tera::{Context, Tera}; use crate::{markdown::Markdown, model::*}; pub struct Renderer { tera: Tera, } impl Renderer { pub fn load_from_path(templates: &str) -> Self { let mut tera = match Tera::new(templates.trim_start_matches("./"))...
/* * (c) Copyright IBM Corporation 2021 * * 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 wr...
//! Users can deposit and stake NEAR. In return, they receive STAKE tokens. //! //! In order to issue STAKE tokens to the account, the STAKE token value needs to be computed //! after the deposit and stake request has been confirmed with the staking pool. //! //! Multiple deposit and stake requests are batched together...
// 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 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. //! Common utilities used by directory related tests. //! //! Most assertions are macros as they need to call async functions themselves. As a typical tes...
// 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 crate::gl_wrapper::shader_compilation::{ShaderProgram, ShaderPart}; use std::ffi::CString; use crate::gl_wrapper::texture_2d::Texture2D; #[derive(Clone)] pub struct KernelShader { program: ShaderProgram, } impl KernelShader { fn compile_program() -> ShaderProgram { let vert_shader = ShaderPart::fr...
pub use backend::platform::*; pub mod platform; pub mod regalloc; pub mod x86; mod flow; mod graph; mod interference; mod liveness; #[cfg(test)] mod tests; #[cfg(test)] mod x86tests;
//! Custom error type for all errors types that binsec might encounter use std::error::Error; use std::fmt::{self, Display}; pub type BinResult<R> = Result<R, BinError>; #[derive(Debug)] pub struct BinError(String); impl BinError { pub fn new(msg: &str) -> Self { Self(msg.to_string()) } } impl Displ...
use icell::scoped::{self, ICell}; fn main() { scoped::owner!(owner); let value = ICell::new(10); let x = owner.read(&value); drop(owner); assert_eq!(*x, 10); }
// 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...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DYNAMIC_TIME_ZONE_INFORMATION { pub Bias: i32, pub StandardN...
//! Patience diff algorithm. //! //! * time: `O(N log N + M log M + (N+M)D)` //! * space: `O(N+M)` //! //! Tends to give more human-readable outputs. See [Bram Cohen's blog //! post](https://bramcohen.livejournal.com/73318.html) describing it. //! //! This is based on the patience implementation of [pijul](https://piju...
//! A module for packets shared across the network, plus serialisation / //! deserialisation methods. mod reg; mod game_join; pub use self::reg::RegPacket; pub use self::game_join::GameJoinPacket; use std::{fmt, error}; /// A class for errors when deserialising bytes into a packet. #[derive(Debug, Clone, Copy, Hash...
// Copyright 2018 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 ...
//! Contains TypeInfo,metadata for a type. use std::fmt; use crate::{ marker_type::NonOwningPhantom, sabi_types::{Constructor, MaybeCmp}, std_types::{utypeid::UTypeId, RStr}, type_level::downcasting::GetUTID, InterfaceType, }; /// Metadata about a type. #[derive(Debug, Eq, PartialEq)] #[repr(C)] ...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qurl.h // dst-file: /src/core/qurl.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main bl...
#[macro_export] macro_rules! mk_document( {} => ( $crate::Document::new_without_id() ); { $($key:literal : $value:expr),+ $(,)? } => { { let mut m = $crate::Document::new_without_id(); $( m.insert($key.into(), $crate::Value::from($value)); ...
#![allow(unused_unsafe)] #![allow(dead_code)] use super::com_rc::*; use super::dx_func::*; use super::dx_pub_use::*; use super::unsafe_util::*; use raw_window_handle::*; use winapi::Interface; use winapi::_core::mem; use winapi::_core::ptr; use winapi::ctypes::c_void; use winapi::shared::ntdef::HANDLE; use winapi::sha...
use std::fmt::{Debug, Display, Formatter}; use std::fmt; #[derive(Debug, Clone)] pub struct Adn<T> { pub adn: T, pub score: f32, } impl<T> Adn<T> { pub fn new(adn: T) -> Self { Adn { adn, score: 0_f32 } } } impl<T: Display> Display for Adn<T> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt:...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn parse_http_generic_error( response: &http::Response<bytes::Bytes>, ) -> Result<smithy_types::Error, smithy_json::deserialize::Error> { crate::json_errors::parse_generic_error(response.body(), response.headers()) } pub fn de...
mod wait_event; pub use wait_event::*;
use crate::sparql::eval::StringOrStoreString; use crate::store::numeric_encoder::{ EncodedQuad, EncodedTerm, Encoder, MemoryStrStore, StrContainer, StrLookup, }; use crate::store::StoreConnection; use crate::Result; use std::cell::{RefCell, RefMut}; use std::collections::BTreeSet; pub type EncodedTuple = Vec<Optio...
use crate::{ core::{ channel_list::Channel, channel_list::CHANNEL_HALF, error::Error, refptr::{OpaquePtr, Ref, RefMut}, }, deep::{ deep_frame_buffer::DeepSlice, deep_image_level::{DeepImageLevelRef, DeepImageLevelRefMut}, }, }; use half::f16; use openexr_s...
use std::ops::{Range, RangeBounds, RangeInclusive}; use std::rc::{Rc, Weak}; #[cfg(feature = "regex_grammar")] use crate::mutators::grammar::regex::grammar_from_regex; #[derive(Clone, Debug)] /// A grammar which can be used for fuzzing. /// /// See [the module documentation](crate::mutators::grammar) for advice on ho...
#[doc = "Reader of register SECWM2R1"] pub type R = crate::R<u32, super::SECWM2R1>; #[doc = "Writer for register SECWM2R1"] pub type W = crate::W<u32, super::SECWM2R1>; #[doc = "Register SECWM2R1 `reset()`'s with value 0xff00_ff00"] impl crate::ResetValue for super::SECWM2R1 { type Type = u32; #[inline(always)]...
use std::num::ParseIntError; pub const INPUT: &str = include_str!("../input.txt"); pub fn parse_input(input: &str) -> Result<Vec<u32>, ParseIntError> { let mut sums = vec![]; let mut sum = 0; for line in input.lines() { if line.is_empty() { sums.push(sum); sum = 0; ...
use failure::{format_err, Fallible}; use std::ffi::OsStr; use std::path::Path; use std::process::ExitStatus; use super::{cmd, util}; pub fn run(files: Vec<&str>, stdin: &str) -> Fallible<ExitStatus> { let work_dir = util::dirname(files[0])?; let filename = util::basename(files[0])?; let main_jar = "main_...
extern crate cderive; use std::env; mod cc; // XXX: This is not a good entry point yet pub fn main() { // XXX: This is super gross let mut cyclecollect = cc::CycleCollect; let mut deriver = cderive::Deriver::new(); deriver.register("CycleCollection", &mut cyclecollect); let args = env::args().s...
#![deny(rust_2018_idioms, nonstandard_style, future_incompatible)] #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![cfg_attr(docsrs, feature(doc_auto_cfg))] #![recursion_limit = "128"] use proc_macro::TokenStream; use quote::quote; use syn::DeriveIn...
use std::cell::RefCell; use std::marker::PhantomData; use std::sync::atomic::{ AtomicU64, Ordering, }; use std::sync::Arc; use sourcerenderer_core::graphics::Resettable; use thread_local::ThreadLocal; use crate::buffer::BufferAllocator; use crate::command::VkInnerCommandBufferInfo; use crate::query::VkQueryAl...
// This is purposely empty fn main() {}
pub const SAMPLE_RATE : u32 = 44100; pub const CHUNK_SIZE : usize = 4096; /* This won't create a bug unless people are working with eons of audio. */ pub const TIME_INFINITY : u64 = 0xFFFFFFFFFFFFFFFF;
mod player; pub use self::player::Suit; pub use self::player::Card; pub use self::player::PokerPlayer; #[derive(Debug, PartialEq)] pub struct PokerGame { pub players: Vec<PokerPlayer>, } pub fn parse(raw_players: &str) -> PokerGame { let players: Vec<PokerPlayer> = raw_players .split(" ") .m...
use std::mem; use std::any::type_name; fn type_of<T>(_: T) -> &'static str { type_name::<T>() } fn main() { // types println!("\n--- DATA TYPES ---\n"); // INTEGERS // integers declarations println!("--- Integers\n"); let value = 0; println!("Value: {}", value); println!("S...
//! TNC Commands //! //! All commands are sent from the host to the TNC. //! Commands are accepted when they are echoed back //! and rejected by `FAULT` messages. #![allow(dead_code)] use std::convert::Into; use std::fmt; use std::string::String; use std::vec::Vec; use super::constants as C; use super::constants::{Co...
use std::env; use log::LevelFilter; use anyhow::bail; pub fn init(_level: LevelFilter) -> anyhow::Result<()> { // Initialize logger let mut builder = env_logger::Builder::from_env("LUMEN_DEBUG_LOG"); builder.format_indent(Some(2)); if let Ok(precision) = env::var("LUMEN_LOG_WITH_TIME") { matc...
use std::env; use std::io::Error; use std::process::Command; use node_version::NodeVersion; fn paths_without_avm() -> Vec<String> { let path_env = read_env().unwrap(); strip_avm_paths(split_path(&path_env)) } fn read_env() -> Option<String> { match env::var("PATH") { Ok(val) => Some(val), ...
extern crate byteorder; mod error; mod mqtt; mod read; mod write; mod topic; mod msg; pub use error::{ Error, Result }; pub use msg::{ Message }; pub use mqtt::{ Packet, Connect, Connack, Publish, Subscribe, Suback, Unsubscribe, SubscribeTopic, SubscribeReturnCodes };...
use fern::colors::{Color, ColoredLevelConfig}; pub fn init_logging(){ fern::Dispatch::new() // Perform allocation-free log formatting .format(|out, message, record| { let colors = ColoredLevelConfig::new() .info(Color::Yellow) .error(Color::Red) ...
//! A module implementing an io type backed by the C runtime's file descriptors, i.e. what's //! returned from libc::open, even on windows. use std::{cmp, ffi, io}; #[cfg(windows)] use libc::commit as fsync; #[cfg(windows)] extern "C" { #[link_name = "_chsize_s"] fn ftruncate(fd: i32, len: i64) -> i32; } #[cf...
//! A build dependency for Cargo projects to find the location and compiler flags for linking //! against `libpcap` using the `pcap-config` utility. //! //! This library uses the `pcap-config` utility, which is installed with libpcap, to find the //! location and compiler flags required by cargo for linking to libpcap....
use ndarray::{prelude::*, Array}; use ndarray_rand::{rand_distr::Uniform, RandomExt}; use plotters::prelude::*; use rand::seq::SliceRandom; use rand::thread_rng; use std::{ convert::TryInto, f64::consts::E, fs::{self, File}, io::{Read, Write}, u32, usize, }; struct TrainingData { input: Array1<...
#![feature(unique, unsize, fnbox, fn_traits, unboxed_closures, alloc, heap_api, allocator_api)] /*! Provides thin pointer types to dynamically sized types that implement the `DynSized` trait. By "thin", that means they store the metadata (i.e. slice length or vtable pointer) together with the data, instead of in the po...
use std::env; fn _parens(prefix: String, left: i32, right: i32) { if left == 0 && right == 0 { println!("{}", prefix); } if left > 0 { _parens(prefix.clone() + "(", left - 1, right); } if right > left { _parens(prefix.clone() + ")", left, right - 1); } } fn parens(n: ...
// Copyright 2020 Parity Technologies (UK) Ltd. //! Cumulus test parachain collator #![warn(missing_docs)] #![warn(unused_extern_crates)] mod chain_spec; #[macro_use] mod service; mod cli; mod command; fn main() -> sc_cli::Result<()> { command::run() }
// > Interface with Scylla with Rust NIFs // Copyright 2020 Roland Metivier // // 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...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qradiobutton.h // dst-file: /src/widgets/qradiobutton.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block ...
// 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::{ap::Context, error::Error}, failure::{bail, format_err}, fidl_fuchsia_wlan_mlme as fidl_mlme, wlan_common::mac::{ sel...
use std::collections::HashMap; #[derive(Debug)] pub struct BaseProjectDependencyContainer { pub dependencies: HashMap<String, String> } impl BaseProjectDependencyContainer { pub fn new() -> BaseProjectDependencyContainer { BaseProjectDependencyContainer { dependencies: HashMap::new() } } ...
/* This module generates code to try efficiently convert some arbitrary `T: 'static` into a `Primitive`. It's used by both the `build.rs` script and by the source itself. There are currently two implementations here: - When the compiler version is less than `1.46.0` we check type ids at runtime. This means generating ...
use super::*; use crate::utils::{expr_from_ident, type_from_ident}; pub(super) struct GenericParams<'a> { generics: &'a syn::Generics, type_param_range: StartLen, const_param_range: StartLen, ctokens: &'a CommonTokens<'a>, } impl<'a> GenericParams<'a> { pub(super) fn new( ds: &'a DataStru...
use {TimeSpan, Timer, TimingMethod}; pub(crate) fn start_run(timer: &mut Timer) { timer.set_current_timing_method(TimingMethod::GameTime); timer.start(); timer.initialize_game_time(); timer.pause_game_time(); } pub(crate) fn run_with_splits(timer: &mut Timer, splits: &[f64]) { start_run(timer); ...
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; use crate::tensor::Tensor; use crate::traits::view::View; impl<'a> Add for &'a Tensor { type Output = Tensor; fn add(self, rhs: Self) -> Self::Output { assert_eq!(self.shape(), rhs.shape()); let mut res = self.clo...
use std::collections::VecDeque; use std::io; fn main() { let mut buf = String::new(); io::stdin().read_line(&mut buf).unwrap(); let k: i64 = buf.trim().parse().unwrap(); let mut queue: VecDeque<i64> = VecDeque::new(); for i in 1..10 { queue.push_back(i); } let mut count: i64 = 0; ...
use crate::v0::support::option_parsing::ParseError; use std::convert::TryFrom; #[derive(Debug)] pub struct RefsOptions { /// This can start with /ipfs/ but doesn't have to, can continue with paths, if a link cannot /// be found it's an json error from go-ipfs pub arg: Vec<String>, /// This can be used ...
use super::svm_error::SVMError; use super::extensions::MemoryValue; use super::svm_constants::MEMORY_SIZE_MAX; pub type MemoryArray = [u16; MEMORY_SIZE_MAX]; pub struct Memory { memory: MemoryArray, } impl Memory { pub fn new(data: MemoryArray) -> Memory { Memory { memory: data.clone(), ...
extern crate mqttc; extern crate netopt; #[macro_use] extern crate log; extern crate env_logger; use std::env; use std::process::exit; use std::time::Duration; use netopt::NetworkOptions; use mqttc::{Client, ClientOptions, ReconnectMethod}; fn main() { env_logger::init(); let mut args: Vec<_> = env::args().co...
pub use super::{random_bytes, MAC}; pub use md4::{Digest, Md4}; #[derive(Default)] pub struct SecretPrefixMac { key: Vec<u8>, } impl SecretPrefixMac { pub fn new() -> SecretPrefixMac { SecretPrefixMac { key: random_bytes(rand::random::<u8>() as u32), } } pub fn raw_sign(&s...
#[doc = "Reader of register DIVSCLK"] pub type R = crate::R<u32, super::DIVSCLK>; #[doc = "Writer for register DIVSCLK"] pub type W = crate::W<u32, super::DIVSCLK>; #[doc = "Register DIVSCLK `reset()`'s with value 0"] impl crate::ResetValue for super::DIVSCLK { type Type = u32; #[inline(always)] fn reset_va...
// Copyright 2012 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::client::Client; use crate::torrents::Torrent; use clap::{App, Arg}; mod client; mod consts; mod messages; mod opstream; mod partial; mod peerlist; mod torrents; mod utils; mod worker; #[tokio::main] async fn main() { let matches = App::new("ntorrent") .arg( Arg::with_name("INPUT") ...
/* Copyright (c) 2015, 2016 Saurav Sachidanand 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, modify, merge, publish, di...
extern crate http; extern crate matrix_rocketchat; #[macro_use] extern crate matrix_rocketchat_test; extern crate reqwest; use std::collections::HashMap; use http::Method; use matrix_rocketchat::api::{RequestData, RestApi}; use matrix_rocketchat::errors::*; #[test] fn rest_api_returns_an_error_when_called_with_an_un...
pub fn example6() { let rand_string = "I am random string"; xprintln!("Length: {}", rand_string.len()); let (first, second) = rand_string.split_at(6); xprintln!("First: {} Second: {}", first, second); let mut chars = rand_string.chars(); let mut indiv_char = chars.next(); loop { match indiv_char { So...
#[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::CTRL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w...
// 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 agre...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qkeysequenceedit.h // dst-file: /src/widgets/qkeysequenceedit.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // mai...
use openssl::symm::{Cipher, Crypter, Mode}; use std::collections::HashMap; use crate::xor::xor; const AES_BLOCK_SIZE: usize = 16; pub fn decrypt_aes_ecb(ciphertext: &[u8], key: &[u8]) -> Result<Box<[u8]>, String> { if ciphertext.len() % 16 != 0 { panic!( "decrypt_aes_ecb called with invalid te...
// Copyright 2011 Google Inc. All Rights Reserved. // Copyright 2017 The Ninja-rs Project Developers. All Rights Reserved. // // 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:/...
mod common; #[actix_rt::test] async fn test_healthyness() { let mut server = common::Server::with_uid("movies"); // Check that the server is healthy let (response, status_code) = server.get_health().await; assert_eq!(status_code, 200); assert_eq!(response["status"], "available"); }
use std::collections::{HashMap, HashSet}; use std::hash::{Hash}; fn main() { let mut node_map: HashMap<Node, HashSet<Node>> = HashMap::new(); for line in include_str!("input").lines() { let mut iter = line.split("-"); let node_a: Node = iter.next().unwrap().parse().unwrap(); let node_b...
use petgraph::{ stable_graph::{NodeIndex, StableUnGraph}, visit::{EdgeRef, IntoEdgeReferences}, }; pub type DefaultNodeIdx = NodeIndex<petgraph::stable_graph::DefaultIx>; const FORCE_CHARGE: f32 = 12000.0; const FORCE_SPRING: f32 = 0.3; const FORCE_MAX: f32 = 280.0; const NODE_SPEED: f32 = 7000.0; const DAMP...
use super::{PruneMetrics, QuerierTable, QuerierTableArgs}; use crate::{ cache::CatalogCache, create_ingester_connection_for_testing, parquet::ChunkAdapter, IngesterPartition, }; use arrow::record_batch::RecordBatch; use data_types::ChunkId; use iox_catalog::interface::{get_schema_by_name, SoftDeletedRows}; use ...
test_stdout!(with_key_returns_value, "value\n"); test_stdout!(without_key_returns_undefined, "undefined\n");
use futures_core::future::{Future, FusedFuture}; use futures_core::task::{Context, Poll}; use std::pin::Pin; use pin_utils::{unsafe_pinned, unsafe_unpinned}; /// Combinator that guarantees one [`Poll::Pending`] before polling its inner /// future. /// /// This is created by the /// [`FutureTestExt::pending_once`](supe...
extern crate pizza_ml; extern crate combine; extern crate combine_language; use combine::{Parser, State}; use pizza_ml::parser::{expr, function}; fn main() { let mut expr = expr(); let mut func = function(); println!("Testing the expression parser:"); println!("{:#?}", expr.parse(State::new("{{ hello...
/* * one of the ELISIONS rust compiler has * without this inference, declaration would be fn first_word<'a>(s: &'a str) -> &'a str */ fn first_word(s: &str) -> &str { let bytes = s.as_bytes(); for (i, &item) in bytes.iter().enumerate() { if item == b' ' { return &s[0..i]; } ...
use std::collections::HashSet; fn main() { let mut south_facing = HashSet::new(); let mut east_facing = HashSet::new(); let input: Vec<_> = include_str!("input").lines().collect(); let x_lim = input[0].len(); let y_lim = input.len(); input.into_iter().enumerate().for_each(|(i, row)| { ...
pub use VkLogicOp::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkLogicOp { VK_LOGIC_OP_CLEAR = 0, VK_LOGIC_OP_AND = 1, VK_LOGIC_OP_AND_REVERSE = 2, VK_LOGIC_OP_COPY = 3, VK_LOGIC_OP_AND_INVERTED = 4, VK_LOGIC_OP_NO_OP = 5, VK_LOGIC_OP_XOR = 6, VK_LOGIC_OP_OR = ...
use super::engine_types::game_framework::*; pub struct WorldSystem { world: World } impl WorldSystem { pub fn new(name: &'static str) -> Self { WorldSystem { world: World { name: name.to_string(), systems: Vec::new(), dm: DataManager::new() ...
mod binomial; mod factorial; mod factorial2; mod gamma; pub use factorial::*;
// 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 ...
//! The A-normal form language, with types preserved. //! //! This language makes an explicit distinction between _computations_ and //! _values_, and makes the evaluation indifferent to the order in which //! computations are executed (somewhat like [applicative functors in //! Haskell][applicative-functors]). It does...
#[allow(unused_imports)] use super::{math::*, vertex::*, shader::*, core::*, material::*, texture::*, model::*};
enum Privileges { UserBanned, UserPublic, UserNormal, UserDonor, AdminAccessRAP, AdminManageUsers, AdminBanUsers, AdminSilenceUsers, AdminWipeUsers, AdminManageBeatmaps, AdminManageServers, AdminManageSettings, AdminManageBetaKeys, AdminManageReports, AdminMan...
// 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::{assigned_numbers::find_service_uuid, inspect::*}, fidl_fuchsia_bluetooth_control as control, fuchsia_inspect as inspect, fuchsia_...