text stringlengths 8 4.13M |
|---|
//! Integral range values.
use std::ops;
/// An integral range.
pub type Range = ops::Range<u32>;
|
use anyhow::*;
use image::GenericImageView;
use std::path::Path;
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use crate::asset::{Handle, Assets};
#[derive(Debug)]
pub struct Texture {
pub texture: wgpu::Texture,
pub view: wgpu::TextureView,
pub sampler: wgpu::Sampler,
}
im... |
//! Used to test file I/O functions in Rust.
use std::io::Write;
use std::{fs, io};
fn main() -> io::Result<()> {
let mut file = io::BufWriter::new(fs::File::create("test.txt")?);
println!("going to write: \"hi there\\n\"");
file.write_all(b"hi there\n")?;
println!("going to write: \"hi there\\nmy n... |
use super::byteslice::ByteSliceExt;
#[derive(Clone, Copy)]
pub enum MatchResult {
Unmatched,
Matched {
reduced_offset: u16,
match_len: usize,
match_len_expected: usize,
match_len_min: usize,
}
}
#[derive(Clone, Copy)]
pub struct Bucket {
head: u16,
node_part1: [u32;... |
#![macro_use]
pub mod hid;
pub mod result;
pub mod service;
|
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let x = 5;
let y = &x;
assert_eq!(5, x);
assert_eq!(5, *y);
}
#[test]
fn it_works_2() {
let x = 5;
let y = Box::new(x);
assert_eq!(5, x);
assert_eq!(5, *y);
}
... |
extern crate gl;
pub mod shader;
pub mod program;
pub mod color;
pub mod math;
pub mod rendertarget;
pub mod mesh;
pub use self::mesh::{Mesh,MeshBuilder};
pub use self::program::{GraphicsPipeline,PipelineBuilder};
pub use self::math::Vec2;
pub use self::color::Color;
pub use self::shader::{Shader, Uniform};
pub use s... |
use cpu::register::Register;
use cpu::CPU;
/// Move a value from register to register
///
/// # Cycles
///
/// * To/from register M: 7
/// * Other: 5
///
/// # Arguments
/// * `cpu` - The cpu to perform the move in
/// * `to` - The register to move the value to
/// * `from` - The register to move the value from
///
pu... |
use std::{
collections::HashSet,
marker::PhantomData,
};
use crate::{prelude::*, material::*};
#[derive(Clone, Debug, Default)]
pub struct TestMaterial<T: 'static> {
phantom: PhantomData<T>,
}
impl<T> TestMaterial<T> {
pub fn new() -> Self {
Self { phantom: PhantomData }
}
}
impl<T> Mate... |
use std::{error, fmt};
/// Error that can happen when encoding some bytes into a multihash.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum EncodeError {
/// The requested hash algorithm isn't supported by this library.
UnsupportedType,
/// The input length is too large for the hash algorithm.
Un... |
use std::path::PathBuf;
use bytes::Bytes;
use tokio;
use flyte::{local::LocalFilesystem, local::LocalFilesystemBuilder, Filesystem, FilesystemChain};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let strict_fs = LocalFilesystemBuilder::new()
.with_prefix("secret".into())
.with_directory_... |
//! Standard encryption and decryption.
use super::*;
/// Encryption key that may be shared publicly.
#[derive(Debug,Clone)]
pub struct EncryptionKey<I> {
pub n: I, // the modulus
nn: I, // the modulus squared
}
impl<I> ::traits::EncryptionKey for EncryptionKey<I> {}
impl<'kp, I> From<&'kp Keypair<I>> ... |
//! Provides methods for gathering net informations,
//!
use super::{result::*, util::*};
use sigar_sys::*;
use std::error::Error as stdError;
use std::ffi::{CStr, CString};
use std::net;
use std::os::raw::{c_int, c_ulong};
// C: sigar_net_info_get
/// net info
#[derive(Debug)]
pub struct Info {
pub default_gatew... |
pub mod drawing;
pub mod hexlife;
pub mod power;
use crate::prelude::*;
pub trait App {
fn new() -> Self;
fn tick(&mut self, led_data: &mut [RGB8; NUM_LEDS]);
}
|
//! Testing helpers.
pub mod addresses {
pub mod alice {
use crate::address::Address;
pub fn address() -> Address {
Address::from_bech32("oasis1qrec770vrek0a9a5lcrv0zvt22504k68svq7kzve").unwrap()
}
}
pub mod bob {
use crate::address::Address;
pub fn ad... |
use crate::exchange::order_processing::JsonOrder;
use crate::exchange::queue::Queue;
use crate::controller::Task;
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
use std::sync::Arc;
/// A simple tcp server that listens for incoming messages asynchronously. Each message
/// is parsed from a JSON into ... |
//! This module contains the set of software rendering tools used for this application.
//! Text rendering, simple shape, and bitmap rendering is provided here.
//!
//! This module contains functions that draws directly to the provided canvas.
//! All draw calls are done directly using the cpu. If you wish to use the... |
use crate::Register;
use once_cell::sync::Lazy;
use std::{collections::HashMap, fmt};
/// The table that is used to lookup the format of a given opcode.
///
/// 1: R format
/// 2: I format
/// 3: J format
const FORMAT_TABLE: Lazy<HashMap<u8, u8>> = Lazy::new(|| {
let mut map = HashMap::new();
map.insert(0b0000... |
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use syn::{
braced,
parse::{Parse, ParseStream, Result},
punctuated::Punctuated,
Ident, ItemEnum, Token, Type,
};
#[derive(Debug, PartialEq)]
pub(crate) struct State {
pub state_name: Ident,
pub state_type: Type,
}
impl Parse for State... |
pub mod enums;
pub mod process;
pub mod core;
|
use rand::{seq::SliceRandom, SeedableRng};
/// 6t5-15t4+10t3.
fn fade(t: f32) -> f32 {
t * t * t * (10.0 + t * (6.0 * t - 15.0))
}
pub fn make_permutation<R: SeedableRng + rand::RngCore>(rand: &mut R) -> Vec<u8> {
let mut p: Vec<u8> = (0..255u8).collect();
p.shuffle(rand);
for i in 0..p.len() {
... |
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate tokio_core;
use ex_api;
use ex_api::Api;
use ex_api::ApiCall;
use ex_api::exchanges::BitThumb;
use net_client::Client;
pub struct TradingMachine {
connection: Client,
exchange: BitThumb,
api: ApiCall,
}
impl TradingMachine {
... |
pub mod lib_table
{
pub mod lib_sub_mod
{
pub fn table(data:u32)
{
println!("We are in lib.rs");
for value in 1..=10
{
println!{"{} x {} = {}",data,value,data*value};
}
... |
use crate::no_slog::log_via_log_crate;
use crate::sample_module::{log_debug_mode, log_global};
use slog::{o, slog_info};
use slog_kickstarter::SlogKickstarter;
use slog_scope::set_global_logger;
use std::env;
fn main() {
// initialize a root logger
let root_logger = SlogKickstarter::new("logging-example")
... |
/*
* @lc app=leetcode.cn id=26 lang=rust
*
* [26] 删除排序数组中的重复项
*
* https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/description/
*
* algorithms
* Easy (43.07%)
* Total Accepted: 95.7K
* Total Submissions: 221.4K
* Testcase Example: '[1,1,2]'
*
* 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返... |
//! messages.
use std::any::TypeId;
use actix::{dev::ToEnvelope, prelude::*};
use crate::{
broker::{ArbiterBroker, RegisteredBroker, SystemBroker},
msgs::*,
};
/// The `BrokerSubscribe` trait has functions to register an actor's interest in different
/// messages.
pub trait BrokerSubscribe
where
Self: Ac... |
use apilib::transfer::Transfer;
use serde::Serialize;
use serde::Deserialize;
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct TRequest<T: Transfer> {
pub value: T,
}
impl<T: Transfer> TRequest<T> {
pub fn new(value: T) -> Self {
TRequest { value }
}
}
impl<'de, T: Transfer + Serialize ... |
use crate::army_setups_manager::ArmySetupsManager;
use crate::ca_game::{get_ca_game_title, GameSelector};
use crate::central_panel_state::{AppState, CentralPanelState};
use crate::resources_panel;
use eframe::{egui, epi};
/// We derive Deserialize/Serialize so we can persist app state on shutdown.
#[cfg_attr(feature =... |
use crate::video::pixel::Pixel;
use crate::video::FrameInfo;
#[cfg(feature = "y4m-decode")]
mod y4m;
#[cfg(feature = "y4m-decode")]
pub use self::y4m::*;
/// A trait for allowing metrics to decode generic video formats.
///
/// Currently, y4m decoding support using the `y4m` crate is built-in
/// to this crate. This... |
#[doc = "Reader of register RCC2"]
pub type R = crate::R<u32, super::RCC2>;
#[doc = "Writer for register RCC2"]
pub type W = crate::W<u32, super::RCC2>;
#[doc = "Register RCC2 `reset()`'s with value 0"]
impl crate::ResetValue for super::RCC2 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
// 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 fidl_fuchsia_net as fidl;
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub struct IpAddress(pub std::net::IpAddr);
impl std::fmt::Display for IpAddre... |
use std::{cmp::Reverse, collections::BinaryHeap};
use proconio::{
input,
marker::{Bytes, Usize1},
};
fn main() {
input! {
n: usize,
a: [u64; n],
s: [Bytes; n],
q: usize,
uv: [(Usize1, Usize1); q],
};
let mut g = vec![vec![]; n];
for i in 0..n {
... |
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#[macro_use]
mod macros;
pub mod arbitrary;
#[allow(dead_code)]
pub mod vr_invariants;
#[allow(dead_code)]
pub mod op_invariants;
#[allow(dead_code)]
pub mod scheduler;
#[allow(dead_code)]
mod model;
pub use self::m... |
use na::{Matrix4, Vector3};
use nalgebra as na;
use nalgebra_glm as glm;
use sepia::app::*;
use sepia::buffer::*;
use sepia::camera::*;
use sepia::shaderprogram::*;
use sepia::vao::*;
const ONES: &[GLfloat; 1] = &[1.0];
#[rustfmt::skip]
const VERTEX_POSITIONS: &[GLfloat; 108] =
&[
-0.25, 0.25, -0.25,
... |
extern crate toml;
extern crate collections;
use std::io;
use std::io::{File, Open, ReadWrite};
use std::io::fs::PathExtensions;
use std::collections::treemap::TreeMap;
use self::action::Action;
pub mod action;
#[deriving(PartialEq, Show)]
pub enum Direction {
Do,
Undo
}
pub struct Config {
pub actions... |
// 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.
//! ril-ctl is used for interacting with devices that expose the standard
//! Fuchsia RIL (FRIL)
//!
//! Ex: ril-ctl
//!
//! or
//!
//! Ex: ril-ctl -d /dev... |
#![no_main]
#![feature(start)]
extern crate olin;
use blake2::{Blake2b, Digest};
use olin::{entrypoint, log};
entrypoint!();
fn main() -> Result<(), std::io::Error> {
let json: &'static [u8] = include_bytes!("./bigjson.json");
let yaml: &'static [u8] = include_bytes!("./k8sparse.yaml");
for _ in 0..8 {
... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_operation_associate_admin_account(
input: &crate::input::AssociateAdminAccountInput,
) -> Result<smithy_http::body::SdkBody, smithy_types::Error> {
let mut out = String::new();
let mut object = smithy_json::ser... |
// Copyright 2021 Chiral Ltd.
// Licensed under the Apache-2.0 license (https://opensource.org/licenses/Apache-2.0)
// This file may not be copied, modified, or distributed
// except according to those terms.
//! Cycle related operations
//!
use super::orbit_ops;
use super::graph;
/// Extend on edge in the graph, st... |
use super::Part;
use crate::codec::{Decode, Encode};
use crate::{remote_type, RemoteEnum, RemoteObject};
remote_type!(
/// A wheel. Includes landing gear and rover wheels. Obtained by calling `Part::wheel()`. Can be
/// used to control the motors, steering and deployment of wheels, among other things.
object SpaceCent... |
use crate::{
app::{
config::{self, Rgba},
sample::{create_sample_plume, create_sample_sounding, Sample},
AppContext, AppContextPointer, ZoomableDrawingAreas,
},
coords::{
convert_pressure_to_y, convert_y_to_pressure, DeviceCoords, ScreenCoords, ScreenRect,
TPCoords, X... |
fn main() {
let om_mat: f32 = 907.0;
let tm_mat: f32 = 1050.0;
let om_fsc: f32 = 918.0;
let tm_fsc: f32 = 1100.0;
let div_1: f32 = om_mat/tm_mat;
let div_2: f32 = om_fsc/tm_fsc;
let perc_mat = div_1 * 100.0;
let perc_fsc = div_2 * 100.0;
println!("Percentage (Matric) = {}", perc_mat)... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
use javascriptcore_sys;
use std::fmt;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum CheckSyntaxMode {
Script,
... |
use super::expm1f;
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn tanhf(mut x: f32) -> f32 {
/* x = |x| */
let mut ix = x.to_bits();
let sign = (ix >> 31) != 0;
ix &= 0x7fffffff;
x = f32::from_bits(ix);
let w = ix;
let tt = if w > 0x3f0c9f54 {
/* |x| > log(3)/2 ... |
#![feature(bool_to_option, clamp)]
// #![allow(dead_code)]
// #![allow(unused_imports)]
mod base_types;
mod canvas;
pub use base_types::*;
pub use canvas::*;
|
use std::collections::HashSet;
#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]
struct Location {
facing: i32,
x: i32,
y: i32
}
impl Location {
fn movement(&mut self, direction: String) {
let turn = direction.chars().next();
let steps_string = &direction[1..direction.len()];
let steps = steps_st... |
pub type IAccessibleWinSAT = *mut ::core::ffi::c_void;
pub type IInitiateWinSATAssessment = *mut ::core::ffi::c_void;
pub type IProvideWinSATAssessmentInfo = *mut ::core::ffi::c_void;
pub type IProvideWinSATResultsInfo = *mut ::core::ffi::c_void;
pub type IProvideWinSATVisuals = *mut ::core::ffi::c_void;
pub type IQuer... |
#[doc = r" Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 1536usize],
#[doc = "0x600 - Address of first instruction to replace."]
pub replaceaddr: [REPLACEADDR; 8],
_reserved1: [u8; 96usize],
#[doc = "0x680 - Relative address of patch instructions."]
pub patchaddr: [PATC... |
use std::env;
use std::process;
use rand::Rng;
use std::fmt;
#[derive(Debug)]
struct Config {
secret: u32,
n: u32,
k: u32,
}
#[derive(Debug)]
struct Secret {
fx: Vec<u128>,
points: Vec<(u128, u128)>,
}
fn main() {
//Create config struct
let config = Config::new(env::args()).unwrap_or_els... |
// 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 {
super::typeface::TypefaceAndLangScore,
fidl_fuchsia_fonts::{Slant, TypefaceQuery, Width, WEIGHT_MEDIUM, WEIGHT_NORMAL},
};
/// Selects betwe... |
pub type Item = (Vec<Row>, Vec<Col>);
pub enum Row {
Upper,
Lower,
}
pub enum Col {
Upper,
Lower,
}
#[aoc_generator(day5)]
pub fn input_generator(input: &str) -> Vec<Item> {
input
.lines()
.map(|line| {
let (rows, cols) = line.split_at(7);
(
... |
use std::time::Instant;
use std::io::Read;
use std::fs::File;
use turbo_ir as ir;
extern "win64" fn read_char() -> u8 {
std::io::stdin()
.bytes()
.next()
.unwrap_or(Ok(0))
.unwrap_or(0)
}
extern "win64" fn print_char(ch: u8) {
print!("{}", ch as char);
}
fn main() {
let i... |
use rand::prelude::*;
use std::cmp::Ordering;
use crate::hitable::*;
use crate::ray::*;
use crate::vec3::*;
#[derive(Clone, Copy, Debug)]
pub struct Aabb {
pub min: Vec3,
pub max: Vec3,
}
impl Aabb {
pub fn new(min: Vec3, max: Vec3) -> Self {
Self { min, max }
}
#[allow(dead_code)]
pub fn slower_hit... |
#![allow(clippy::comparison_chain)]
#![allow(clippy::collapsible_if)]
use std::cmp::Reverse;
use std::cmp::{max, min};
use std::collections::{BTreeSet, HashMap, HashSet};
use std::fmt::Debug;
use itertools::Itertools;
use whiteread::parse_line;
const ten97: usize = 1000_000_007;
/// 2の逆元 mod ten97.割りたいときに使う
const in... |
use std::io::{ErrorKind, Read};
use std::iter::{FromIterator, FusedIterator};
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum Literal {
String(String),
Character(char),
Integer(String),
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum Delimeter {
Braces,
Brackets,
Parethesis... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Media_Protection_PlayReady")]
pub mod PlayReady;
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt ::... |
use crate::config::Diff2HtmlConfig;
use crate::parse;
use crate::printers::{FileListPrinter, LineByLinePrinter, SideBySidePrinter};
static CSS: &'static str = include_str!("../templates/css.hbs");
pub struct PagePrinter {
config: Diff2HtmlConfig,
}
impl PagePrinter {
pub fn new(config: Diff2HtmlConfig) -> Pa... |
use crate::engine::Engine;
use crate::hooks::hw;
mod sampling;
mod simple;
pub use self::sampling::SamplingConverter;
pub use self::simple::SimpleConverter;
pub trait FPSConverter {
/// Updates the FPS converter state. The converter may capture one frame using the provided
/// closure.
fn time_passed<F>(&... |
//! Client helpers for writing end to end ng tests
use arrow::{datatypes::SchemaRef, record_batch::RecordBatch};
use data_types::{NamespaceId, TableId};
use dml::{DmlMeta, DmlWrite};
use futures::TryStreamExt;
use http::Response;
use hyper::{Body, Client, Request};
use influxdb_iox_client::{
connection::Connection,... |
use super::ema::ema_func;
use super::sma::{declare_ma_var, wma_func};
use super::tr::tr_func;
use super::VarResult;
use crate::ast::stat_expr_types::VarIndex;
use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType};
use crate::helper::err_msgs::*;
use crate::helper::str_replace;
use cra... |
pub mod block;
pub mod chain;
pub mod consensus;
pub mod controller;
pub mod proof_of_work;
pub mod viewmodel;
use chain::Chain;
use std::sync::RwLock;
use uuid::Uuid;
use actix_web::{web, App, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let chain = web::Data::new(RwLock::new(Chain::n... |
/*
* Copyright 2019 The Exonum Team
*
* 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... |
// Copyright 2022 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 ... |
pub(crate) mod cpu_set;
pub(crate) mod syscalls;
pub(crate) mod types;
pub(crate) mod wait;
|
use std::time::Duration;
use smithay::{
backend::{
renderer::{
damage::OutputDamageTracker, element::surface::WaylandSurfaceRenderElement,
gles::GlesRenderer,
},
winit::{self, WinitError, WinitEvent, WinitEventLoop, WinitGraphicsBackend},
},
output::{Mode, Ou... |
use helium_console::{oauth2, ttn};
use oauth2::{prelude::SecretNewType, AccessToken, AuthorizationCode};
use reset_router::{Request, RequestExtensions, Response};
use serde_derive::{Deserialize, Serialize};
pub async fn auth(req: Request) -> Result<Response, Response> {
#[derive(Serialize, Debug)]
pub struct R... |
fn main() {
tonic_build::configure()
.build_server(false)
.compile(&["protos/helloworld.proto"], &["protos"])
.unwrap();
}
|
use crate::target::Target;
pub struct FileTarget {
target: String,
remove: bool,
input_file: String,
output_file: String,
}
impl FileTarget {
pub fn new(target: &str, remove: bool, input_file: &str, output_file: &str) -> FileTarget {
let input_file = String::from(input_file);
let ou... |
fn contains_zero(values: &[i32]) -> bool {
values.iter().any(|v| {
v == &0
})
}
fn main() {
assert!(!contains_zero(&[1, 2, 3, 4, 5]));
assert!(contains_zero(&[0, 2, 3, 4, 5]));
assert!(contains_zero(&[1, 2, 0, 4, 5]));
assert!(contains_zero(&[1, 2, 3, 4, 0]));
}
|
#![allow(unused_variables)]
extern crate simplemad;
extern crate portaudio;
#[macro_use]
extern crate error_chain;
use portaudio as pa;
use simplemad::Decoder;
use std::fs::File;
use std::io;
use std::env;
const INTERLEAVED: bool = true;
error_chain! {
foreign_links {
PortAudio(pa::Error);
Io(io... |
use math::big::{self, Int};
use strconv::NumErrorCause;
mod helper;
use helper::is_big_int_normalized as is_normalized;
lazy_static::lazy_static! {
static ref BITWISE_TESTS: Vec<BitwiseTest> = vec![
BitwiseTest::new("0x00", "0x00", "0x00", "0x00", "0x00", "0x00"),
BitwiseTest::new("0x00", "0x01", "0x00", ... |
/**
* Copyright © 2019
* Sami Shalayel <sami.shalayel@tutamail.com>,
* Carl Schwan <carl@carlschwan.eu>,
* Daniel Freiermuth <d_freiermu14@cs.uni-kl.de>
*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published... |
struct S {}
fn borrow_obj() -> S {
let s = S {};
s
//*s
}
#[test]
fn test_borrow() {
borrow_obj();
}
|
pub mod uni{
pub mod section{
pub fn section_name(){
println!("This is section 4B");
}
}
}
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)]
pub struct IMLOperatorAttributes(pub ::windows::core::IUn... |
use numpy::{IntoPyArray, PyArray1};
use pyo3::prelude::{pyclass, pymethods, pymodule, Py, Python, PyObject, PyModule, PyResult};
use pyo3::type_object::PyTypeObject;
use crate::camera::CameraParameters;
#[pyclass]
#[derive(Clone)]
pub struct PyCameraParameters {
pub inner: CameraParameters
}
#[pymethods]
impl PyC... |
use super::*;
use reqwest::Client as ReqwestClient;
use std::collections::HashMap;
use std::time::Duration;
#[derive(Debug, Deserialize, Serialize)]
pub struct Config {
key: String,
base_url: String,
request_timeout: u64,
}
const DEFAULT_BASE_URL: &str = "https://console.helium.com";
const DEFAULT_TIMEOUT... |
// 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::marker::PhantomData;
#[cfg(feature = "sgx")]
use std::prelude::v1::*;
#[cfg(not(feature = "sgx"))]
use std::sync::{Arc, Mutex, RwLock};
#[cfg(feature = "sgx")]
use std::sync::{Arc, SgxMutex as Mutex, SgxRwLock as RwLock};
use crate::event::waiter::{Waiter, WaiterQueue};
use crate::file::tracker::SeqRdTracker;... |
use std::cmp::Ordering;
use std::mem;
// courtesy of https://stackoverflow.com/a/28294764
fn swap<T>(x: &mut [T], i: usize, j: usize) {
let (lo, hi) = match i.cmp(&j) {
// no swapping necessary
Ordering::Equal => return,
// get the smallest and largest of the two indices
Ordering::... |
use arci::JointTrajectoryClient;
use arci_urdf_viz::create_joint_trajectory_clients;
use k::{Chain, Isometry3};
use log::info;
use openrr_client::{
create_collision_check_clients, create_ik_clients, CollisionCheckClient, IkClient,
};
use std::{collections::HashMap, sync::Arc, time::Duration};
use tokio::sync::Mutex... |
use rust_tools::bench::Bench;
use crate::mcts_tree::mcts_tree::M2;
use crate::mcts_tree::mcts_indextree::M1;
// pub const TREE_SIZE: usize = 10_000;
pub const TREE_SIZE: usize = 20;
pub const BRANCH_FACTOR: usize = 2;
pub trait MCTS<T> {
fn select_from(&mut self, node: &T) -> T;
fn expand(&mut self, node: &T... |
/*
* max_value(s, α, β)
* if terminal(s) return U(s)
* v = -∞
* for c in next_states(s)
* v' = min_value(c, α, β)
* if v' > v, v = v'
* if v' ≥ β, return v
* if v' > α, α = v'
* return v
*
* min_value(s, α, β)
* if terminal(s) return U(s)
* v = ∞
* for c in next_states(s)
* ... |
mod game_message;
mod out_message;
mod ws_client_message;
pub mod messages {
pub use super::game_message::*;
pub use super::out_message::*;
pub use super::ws_client_message::*;
}
|
//! Pretty printing
use syntax::ast::{Expr, Expr_};
use syntax::codemap::Source;
/// Pretty prints an expression
pub fn expr(expr: &Expr, source: &Source) -> String {
let mut string = String::new();
expr_(&mut string, expr, source);
string
}
fn expr_(string: &mut String, expr: &Expr, source: &Source) {
... |
use std::marker::PhantomData;
use super::resource::{Fetch, FetchMut, Resource, Resources};
pub trait System<'a> {
type SystemData: SystemData<'a>;
fn run(&mut self, data: Self::SystemData);
}
pub trait SystemData<'a> {
fn fetch(res: &'a Resources) -> Self;
}
impl<'a, T: ?Sized> SystemData<'a> for Phant... |
mod hash_maps;
mod strings;
mod vectors;
fn main() {
vectors::main();
println!();
strings::main();
println!();
hash_maps::main();
}
|
use crate::{Valuable, Value};
pub trait Listable {
fn len(&self) -> usize;
fn iter(&self, f: &mut dyn FnMut(&mut dyn Iterator<Item = Value<'_>>));
}
impl<T: Valuable> Listable for [T] {
fn len(&self) -> usize {
<[T]>::len(self)
}
fn iter(&self, f: &mut dyn FnMut(&mut dyn Iterator<Item = ... |
use std::env;
use adventofcode::Config;
mod day01;
mod day02;
mod day03;
mod day04;
mod day05;
mod day06;
mod day07;
mod day08;
mod day09;
mod day10;
mod day11;
mod measure;
fn main() {
let config = Config::new(env::args()).unwrap_or_else(|err| {
eprintln!("Problem parsing arguments: {}", err);
s... |
use super::{pure::PurenessInsights, OptimizeMir};
use crate::{
error::CompilerError,
id::IdGenerator,
mir::{Body, Expression, Id, VisibleExpressions},
TracingConfig,
};
use rustc_hash::FxHashSet;
use std::ops::{Deref, DerefMut};
pub struct Context<'a> {
pub db: &'a dyn OptimizeMir,
pub tracing:... |
use crate::vm::{
builtins::PyListRef,
function::ArgSequence,
stdlib::{os::OsPath, posix},
{PyObjectRef, PyResult, TryFromObject, VirtualMachine},
};
use nix::{errno::Errno, unistd};
#[cfg(not(target_os = "redox"))]
use std::ffi::CStr;
#[cfg(not(target_os = "redox"))]
use std::os::unix::io::AsRawFd;
use ... |
extern crate xmlparser as xml;
#[macro_use] mod token;
use token::*;
test!(cdata_01, "<p><![CDATA[content]]></p>",
Token::ElementStart("", "p"),
Token::ElementEnd(ElementEnd::Open),
Token::Cdata("content"),
Token::ElementEnd(ElementEnd::Close("", "p"))
);
test!(cdata_02, "<p><![CDATA[&ing]]></p>",... |
use serde::Serialize;
pub mod config_instruction;
pub mod config_processor;
const CONFIG_PROGRAM_ID: [u8; 32] = [
3, 6, 74, 163, 0, 47, 116, 220, 200, 110, 67, 49, 15, 12, 5, 42, 248, 197, 218, 39, 246, 16,
64, 25, 163, 35, 239, 160, 0, 0, 0, 0,
];
morgan_interface::morgan_program_id!(CONFIG_PROGRAM_ID);
pu... |
use crate::assets::prefab::Prefab;
use crate::core::transform::Transform;
use crate::gameplay::collision::BoundingBox;
use crate::gameplay::health::{Health, Shield};
use crate::gameplay::physics::DynamicBody;
use crate::gameplay::player::{Player, Stats, Weapon};
use crate::gameplay::trail::Trail;
use crate::render::par... |
use std::collections::HashMap;
struct Solution;
impl Solution {
pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
let mut myhash:HashMap<i32, i32> = HashMap::new();
for (index, &num) in nums.iter().enumerate() {
let target_to_check = target - num;
if myhash.contai... |
#![crate_type = "lib"]
#![crate_type = "rlib"]
#![crate_type = "dylib"]
#![crate_name = "ntrumls"]
// Coding conventions
#![deny(non_upper_case_globals)]
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
//#![warn(missing_docs)]
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
... |
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
#[ink::contract]
mod PubCommentsChain {
//参评者信息
#[ink(storage)]
pub struct Participant {
evaScore: f32,
forecastBoxOffice: u64,
participantfee: u64,
participantRankScore u64,
}
//每场电影评定活动信息
#[ink... |
// 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 std::time::Duration;
use fuchsia_criterion::{criterion, FuchsiaCriterion};
fn fibonacci(n: u64) -> u64 {
match n {
0 => 1,
1 => 1... |
use register::*;
use shared::*;
use instructions::*;
use mmu;
use std::rc::*;
use std::cell::*;
use std::boxed::Box;
use log;
pub struct Cpu {
///CPU register
register: CpuRegister,
///stupid hack way to not increment PC after jumping
jumped: bool,
///are we halted for interrupts?
halted: boo... |
use file_reader;
const INPUT_FILENAME: &str = "input.txt";
fn main() {
let input_str = match file_reader::file_to_vec(INPUT_FILENAME) {
Err(_) => {
println!("Couldn't turn file into vec!");
return;
},
Ok(v) => v,
};
// Vec is (number of people, answers comb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.