text stringlengths 8 4.13M |
|---|
use self::{stack_trace::StackFrameKey, utils::IdMapping, variable::VariablesKey};
use super::vm_state::VmState;
mod memory;
mod scope;
mod stack_trace;
mod utils;
mod variable;
pub struct PausedState {
pub vm_state: VmState,
stack_frame_ids: IdMapping<StackFrameKey>,
variables_ids: IdMapping<VariablesKey>... |
fn main(){
//struct
struct Point {
x:i32,
y:i32,
}
let mut point = Point{ x: 3, y: 3};
point.x = 1;
point.y = 2;
println!("point.x = {} , point.y = {}.", point.x, point.y);
//tuple struct
struct Color(u8,u8,u8);
let android_green = Color(0xa4,0xc6,0x39);
l... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[cfg(feature = "Security_Authentication_Identity_Core")]
pub mod Core;
#[cfg(feature = "Security_Authentication_Identity_Provider")]
pub mod Provider;
#[link(name = "windows")]
extern "system" {}
pub type... |
use crate::psrc::{Endpoint, Mode, Parcel, Purpose};
use crate::PopDat;
use abstutil::Timer;
use geom::{Distance, Duration, LonLat, PolyLine, Polygon, Pt2D};
use map_model::{BuildingID, IntersectionID, LaneType, Map, PathRequest, Position};
use sim::{DrivingGoal, Scenario, SidewalkSpot, SpawnTrip, TripSpec};
use std::co... |
fn puzzle1(input: Vec<String>) -> i32 {
return 0;
}
fn puzzle2(input: Vec<String>) -> i32 {
return 0;
}
#[cfg(test)]
mod tests {
use crate::template::{puzzle1, puzzle2};
use crate::utils;
struct Puzzle1Test {
test_data: Vec<String>,
expected_result: i32,
}
... |
use libc::c_int;
/// Values for the FLAG argument to the user function passed to `ftw' and 'nftw'.
/// Regular file.
#[allow(unused)]
pub const FTW_F: c_int = 0;
/// Directory.
#[allow(unused)]
pub const FTW_D: c_int = 1;
/// Unreadable directory.
#[allow(unused)]
pub const FTW_DNR: c_int = 2;
/// Unstatable file.
#[a... |
use itertools::Itertools;
use whiteread::parse_line;
fn main() {
let (n, p, q): (usize, usize, usize) = parse_line().unwrap();
let aa: Vec<usize> = parse_line().unwrap();
let mut ans = 0;
for a in aa.into_iter().combinations(5) {
let tmp = (((((a[0] * a[1]) % p) * a[2]) % p) * ((a[3] * a[4]) %... |
//! Thread pool for blocking operations
use std::fmt;
use derive_more::Display;
use futures::sync::oneshot;
use futures::{Async, Future, Poll};
use parking_lot::Mutex;
use threadpool::ThreadPool;
/// Env variable for default cpu pool size
const ENV_CPU_POOL_VAR: &str = "ACTIX_CPU_POOL";
lazy_static::lazy_static! {
... |
use state::context::Action;
use state::context::Context;
use state::context::Effects;
use objects::player::Player;
pub type Idx = u32;
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub struct Pixel (pub Icon, pub Color);
impl Pixel {
pub fn empty() -> Pixel {
return Pixel(Icon::Empty, Color(255, 2... |
use std::env;
use std::process;
use clap::{App, Arg, SubCommand};
fn main() {
let matches = App::new("Simple key:value store")
.version("0.1")
.author("Ivan <ivanalejandro0@gmail.com>")
.about("Simple store for data in key:value shape")
.subcommand(
SubCommand::with_name... |
use std::process::Command;
fn main() {
let cmd = Command::new("unrar")
.args(&["lb", "/home/susilo/Documents/eBooks/Rust/Packt.The.Complete.Rust.Programming.Reference.Guide.1838828109.rar"])
.output();
// .expect("Gagal menjalankan compiler");
// unrar x -xNamaFile -c-
match cm... |
use crate::{crh::FieldBasedHash, signature::FieldBasedSignatureScheme, CryptoError, Error, compute_truncation_size};
use algebra::{Field, PrimeField, Group, UniformRand, ProjectiveCurve,
convert, leading_zeros, ToBits, ToConstraintField, ToBytes, FromBytes};
use std::marker::PhantomData;
use rand::Rng;
us... |
// 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 proconio::input;
fn gcd(a: u64, b: u64) -> u64 {
if b == 0 {
a
} else {
gcd(b, a % b)
}
}
fn solve(n: u64, d: u64, k: u64) {
let g = gcd(n, d);
let x = (k - 1) / (n / g);
let ans = x + ((k - 1) % (n / g)) * d;
println!("{}", ans % n);
}
fn main() {
input! {
... |
#[doc = "Reader of register CALCTRL"]
pub type R = crate::R<u32, super::CALCTRL>;
#[doc = "Writer for register CALCTRL"]
pub type W = crate::W<u32, super::CALCTRL>;
#[doc = "Register CALCTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::CALCTRL {
type Type = u32;
#[inline(always)]
fn reset_va... |
pub mod default_alloc;
|
use dlal_component_base::{component, err, json, serde_json, Body, CmdResult};
use midir::{MidiInput, MidiInputConnection};
use multiqueue2::{MPMCSender, MPMCUniReceiver};
const MSG_CAP: usize = 3;
fn new_midi_in() -> MidiInput {
MidiInput::new("midir test input").expect("MidiInput::new failed")
}
component!(
... |
use std::env;
use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
fn main() {
let args: Vec<String> = env::args().collect();
let filename: &str = &args[1];
let file = File::open(filename).unwrap();
let mut reader = BufReader::new(file);
let mut buf: [u8; 2880] = [0; 2880];
... |
fn main() {
let contents = std::fs::read_to_string("./res/input.txt").expect("Could not read file");
let count: usize = contents.lines().collect::<Vec<&str>>().iter().map(|&l| {
return l.split(['-',' ',':'].as_ref()).collect::<Vec<&str>>();
}).filter(|elem| {
return (elem.get(4).... |
#[doc = "Reader of register PC"]
pub type R = crate::R<u32, super::PC>;
#[doc = "Reader of field `HS`"]
pub type HS_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - High-Speed Capable"]
#[inline(always)]
pub fn hs(&self) -> HS_R {
HS_R::new((self.bits & 0x01) != 0)
}
}
|
// 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 ... |
//
// intersection.rs
// Copyright (C) 2019 Malcolm Ramsay <malramsay64@gmail.com>
// Distributed under terms of the MIT license.
//
use std::f64::consts::PI;
use anyhow::Error;
use criterion::BenchmarkId;
use criterion::{criterion_group, criterion_main, Criterion};
use crystal_packing::traits::*;
use crystal_packin... |
//! Parses the references made by classes from their compiled bytcode.
use std::collections::HashSet;
use lazy_static::lazy_static;
use noak;
use noak::descriptor::{MethodDescriptor, TypeDescriptor};
use noak::reader::AttributeContent;
use noak::reader::attributes::annotations::{Annotation, ElementValue};
use noak::r... |
#[doc = "Reader of register DADDR"]
pub type R = crate::R<u32, super::DADDR>;
#[doc = "Writer for register DADDR"]
pub type W = crate::W<u32, super::DADDR>;
#[doc = "Register DADDR `reset()`'s with value 0"]
impl crate::ResetValue for super::DADDR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Sel... |
//! Data-driven reference test framework for warding
//! against breaking changes.
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde;
pub mod gpu;
pub mod raw;
#[cfg(feature = "gl")]
pub fn init_gl_surface() -> gfx_backend_gl::Surface {
use gfx_backend_gl::glutin;
let events_loop = glutin::even... |
use std::fs;
use users::mock::{Groups, Users};
use users::UsersCache;
use crate::config::{LllColorTheme, LllConfig};
use crate::context::LllContext;
use crate::fs::{LllDirEntry, LllDirList};
use crate::window;
use crate::THEME_T;
pub const ERR_COLOR: i16 = 240;
pub const EMPTY_COLOR: i16 = 241;
const MIN_WIN_WIDTH... |
use embedded_graphics::{
mono_font::{MonoFont, MonoTextStyle},
prelude::PixelColor,
};
use embedded_gui::{
state::WidgetState,
widgets::{
background::{Background, BackgroundProperties},
border::{Border, BorderProperties},
button::Button,
fill::{Center, FillParent, Horizon... |
#[macro_use]
extern crate log;
mod item;
mod queue;
mod segment;
mod state;
pub use queue::Queue;
|
mod search_engine;
use matcher::{ExactMatcher, InverseMatcher};
use rayon::prelude::*;
use std::ops::{Index, IndexMut};
use types::{CaseMatching, ExactTerm, InverseTerm};
pub use self::search_engine::{CtagsSearcher, GtagsSearcher, QueryType, RegexSearcher};
/// Matcher for filtering out the unqualified usages earlie... |
use std::{ops::ControlFlow, sync::Arc};
use async_channel::RecvError;
use backoff::Backoff;
use data_types::{CompactionLevel, ParquetFileParams};
use iox_catalog::interface::{get_table_columns_by_id, CasFailure, Catalog};
use iox_query::exec::Executor;
use iox_time::{SystemProvider, TimeProvider};
use metric::Duration... |
pub fn flood_fill(mut image: Vec<Vec<i32>>, sr: i32, sc: i32, new_color: i32) -> Vec<Vec<i32>> {
let u = |i: i32| i as usize;
let i = |x: usize| x as i32;
let start_color = image[u(sr)][u(sc)];
if start_color == new_color {
return image;
}
let (width, height) = (image.len(), image[0].... |
use ggez::{graphics, input, Context, event::EventHandler, GameResult};
use ggez::graphics::Color;
use super::{
TIME_STEP,
simulation::{astro::Astro, Simulation},
ui::{self, ui_manager::UIManager},
utils::vector2::Vector2F,
};
pub struct GameState {
is_paused: bool,
time_step: f32,
simulati... |
use crate::{
handle_error, Error, ErrorResponse, Result, Tarkov, GAME_VERSION, LAUNCHER_ENDPOINT,
LAUNCHER_VERSION, PROD_ENDPOINT,
};
use actix_web::client::Client;
use actix_web::http::StatusCode;
use flate2::read::ZlibDecoder;
use log::debug;
use serde::{Deserialize, Serialize};
use std::io::Read;
#[derive(D... |
extern crate tcod;
use self::tcod::console::{Root};
use self::tcod::input::KeyCode;
use game::Game;
//Types that implement this trait will handle their own updating and rendering
pub trait Updates {
fn update(&mut self, KeyCode, &Game);
fn render(&self, &mut Root);
}
|
use std::collections::HashMap;
use std::sync::Arc;
use bevy::prelude::{Commands, Entity, EventReader, Events, ResMut};
use quinn::{IncomingUniStreams, crypto::rustls::TlsSession, generic::RecvStream};
use tokio::{
stream::StreamExt,
sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel}
};
use tra... |
use super::*;
use proptest::strategy::Strategy;
#[test]
fn without_list_or_bitstring_second_returns_second() {
run!(
|arc_process| {
(
strategy::term::is_list(arc_process.clone()),
strategy::term(arc_process.clone())
.prop_filter("second cann... |
use proconio::input;
use proconio::marker::Chars;
fn main() {
input! {
s: Chars,
};
for c in "0123456789".chars() {
if !s.contains(&c) {
println!("{}", c);
return;
}
}
unreachable!();
}
|
use std::collections::VecDeque;
use input_i_scanner::InputIScanner;
use join::Join;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
... |
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qtextedit.h
// dst-file: /src/widgets/qtextedit.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main block begin ... |
#[doc = "Reader of register CR2"]
pub type R = crate::R<u32, super::CR2>;
#[doc = "Writer for register CR2"]
pub type W = crate::W<u32, super::CR2>;
#[doc = "Register CR2 `reset()`'s with value 0"]
impl crate::ResetValue for super::CR2 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use object::{ProcessRef};
use nabi::{Result, Error};
use nebulet_derive::nebulet_abi;
#[nebulet_abi]
pub fn physical_map(phys_address: u64, count: u32, process: &ProcessRef) -> Result<u32> {
let mut instance = process.instance().write();
let memory = &mut instance.memories[0];
memory.physical_map(phys_add... |
use diesel::{self, prelude::*};
use rocket_contrib::json::Json;
use crate::niveis_ensino_model::{InsertableNiveisEnsino, NiveisEnsino, UpdatableNiveisEnsino};
use crate::schema;
use crate::DbConn;
#[post("/niveis_ensino", data = "<niveis_ensino>")]
pub fn create_niveis_ensino(
conn: DbConn,
niveis_ensino: Js... |
//! Elliptic Curve Digital Signature Algorithm
//!
//! <https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm>
pub mod p256;
pub mod p384;
mod signing_key;
mod verifying_key;
pub use self::{signing_key::SigningKey, verifying_key::VerifyingKey};
pub use ::ecdsa::{der, elliptic_curve::PrimeCurve, Si... |
//! # Rhusics physics library
//!
//! A physics library.
//! Uses [`cgmath`](https://github.com/brendanzab/cgmath/) for all computation.
//!
//! Features:
//!
//! * Two different broad phase collision detection implementations:
//! * Brute force
//! * Sweep and Prune
//! * Narrow phase collision detection using GJK... |
use std::rc::Rc;
use interpreter::{Value, EvalResult};
pub fn add(args: Vec<Rc<Value>>) -> EvalResult {
let mut res = Value::Int(0);
for arg in args {
res = match (res, arg.as_ref()) {
(Value::Int(a), &Value::Int(b)) => Value::Int(a + b),
(Value::Real(a), &Value::Int(b)) => Value::Real(a + (b as f64)),
(V... |
#[macro_use]
extern crate pretty_assertions;
include!("standard_assertion.rs");
|
/*
Copyright 2020 Timo Saarinen
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 writing, software
d... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u8,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u8,
}
impl super::RXCSRL5 {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'... |
extern crate rusty_markov_chain;
use rusty_markov_chain::Markov;
fn main() {
let mut markov = Markov::new();
//let string = String::from("the theremin is theirs or is it not theirs");
//let string1 = String::from("to be or not to be that is the question");
//markov.chain(string1, 3);
//l... |
use std::fs::File;
use std::result::Result;
use std::io::Error;
fn open_file() -> Result<(), Error> {
try!(File::create("hoge"));
Ok(())
}
fn main() {
let foo = open_file();
}
|
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
pub const ADDRESS_TYPE_IANA: u32 = 0u32;
pub const ADDRESS_TYPE_IATA: u32 = 1u32;
pub const CHANGESTATE: u32 = 4u32;
pub const CLIENT_TYPE_BOOTP: u32 = 2u32;
pub const CLIENT_TYPE_DHCP: u32 =... |
use serde::Deserialize;
use super::helpers::deserealize_currency;
/// Информация о виртуальном итеме покупки
/// https://developers.xsolla.com/ru/api/v2/getting-started/#api_param_webhooks_payment_purchase_virtual_items
#[derive(Debug, Deserialize)]
pub struct VirtualItem{
pub sku: String,
pub amount: i32
}
/... |
pub struct Solution;
impl Solution {
pub fn missing_number(nums: Vec<i32>) -> i32 {
let n = nums.len() as i32;
let mut total = 0;
for i in 0..=n {
total ^= i;
}
for i in nums {
total ^= i;
}
total
}
}
#[test]
fn test0268() {
f... |
use anyhow::Result;
use clap::{App, AppSettings, ArgMatches};
pub static DEFAULT_CLAP_SETTINGS: &[AppSettings] = &[
AppSettings::DontCollapseArgsInUsage,
AppSettings::UnifiedHelpMessage,
];
pub enum ParameterGroup {
Encoder = 0,
Classifier = 1,
EncoderNoWeightDecay = 2,
ClassifierNoWeightDecay... |
extern crate rustrip;
extern crate regex;
extern crate rand;
use std::env::args;
use std::io::{stdin, Read};
use regex::Regex;
use rand::distributions::{IndependentSample, Range};
fn gen_pass(min: usize, max: usize) -> String {
let mut buf = String::new();
let mut rng = rand::weak_rng();
let ascii_range: Range<... |
// Setup ctdb for high availability NFSv3
extern crate ipnetwork;
extern crate pnet;
use std::io::{Read, Write};
use std::net::IpAddr;
use std::str::FromStr;
use self::ipnetwork::{IpNetworkError, IpNetwork, Ipv4Network, Ipv6Network};
use self::pnet::datalink::{interfaces, NetworkInterface};
#[derive(Debug, Eq, Parti... |
use crate::common::token_parser;
use crate::types::MetricType;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::character::complete::not_line_ending;
use nom::character::complete::{newline, space0, space1};
use nom::combinator::{map, opt};
#[cfg(test)]
use nom::error::ErrorKind;
use nom::sequence::{delimit... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[doc(hidden)]
pub struct ISyndicationAttribute(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for ISyndicationAttribute {
type Vtable = I... |
// 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... |
use std::io::{Read, Result as IOResult};
use crate::lump_data::{LumpData, LumpType};
use crate::PrimitiveRead;
pub struct Face {
pub plane_index: u16,
pub size: u8,
pub is_on_node: bool, // u8 in struct
pub first_edge: i32,
pub edges_count: i16,
pub texture_info: i16,
pub displacement_info: i16,
pub su... |
/*
* Copyright © 2019-today Peter M. Stahl pemistahl@gmail.com
*
* 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 a... |
use crate::{
core::{
cppstd::CppString,
error::Error,
refptr::{OpaquePtr, Ref, RefMut},
},
deep::{
deep_image::{DeepImageRef, DeepImageRefMut},
deep_image_channel::{
DeepChannelF16Ref, DeepChannelF16RefMut, DeepChannelF32Ref,
DeepChannelF32RefM... |
use rocket_contrib::json::Json;
use crate::model::*;
type Id = TableId;
type Table = Machine;
#[post("/machine", data = "<obj>")]
pub fn insert(conn: crate::db::Database, obj: Json<Table>) -> Json<ObjResult<Table>> {
Json(obj.insert(&conn).into())
}
#[get("/machine/<id>")]
pub fn get(conn: crate::db::Database, ... |
use bellman::groth16::*;
use pairing::*;
use pairing::bls12_381::{Fr, FrRepr, Bls12};
use bellman::*;
use rand::thread_rng;
use jubjub::*;
use base::*;
use convert::*;
use std::fs::File;
struct B2Ccircuit<'a> {
generators: &'a [(Vec<Fr>, Vec<Fr>)],
j: &'a JubJub,
//r_cm
rcm: Assignment<Fr>,
//v... |
use crate::{dir_utils::default_subdir, ConfigBootstrap, LOG_TARGET};
use config::Config;
use log::{debug, info};
use multiaddr::{Multiaddr, Protocol};
use std::{fs, path::Path};
//------------------------------------- Main API functions --------------------------------------//
pub fn load_configurat... |
use clap::{Arg, ArgMatches, SubCommand, App};
pub fn get<'a>() -> ArgMatches<'a> {
App::new("som")
.version("0.1")
.author("Maciej Śniegocki <m.w.sniegocki@gmail.com")
.subcommand(SubCommand::with_name("train-img")
.arg(Arg::with_name("config")
.long("config")
.short("c")
.t... |
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::unnecessary_mut_passed)]
use sp_std::vec::Vec;
use frame_support::Parameter;
//use serde::{Deserialize, Serialize};
//use pallet_massbit::WorkerStatus;
// Here we declare the runtime API. It is implemented it the `impl` bl... |
use std::io::{self, BufRead, Read};
#[derive(PartialEq, Debug, Copy, Clone)]
struct Rule {
letter: char,
first: usize,
second: usize,
}
fn parse_line(line: String) -> (Rule, String) {
let tokens: Vec<String> = line.split("-").map(|val| val.to_string()).collect();
let min = tokens[0].parse::<usize>... |
/*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... |
use crate::heap::*;
pub unsafe extern "C" fn rt_lookup_property(
heap: *mut Heap,
obj: *mut u8,
key: *mut u8,
insert: bool,
) -> isize {
let map = HObject::map_s(obj);
let space = (*(map as *mut HMap)).space();
let mask = HObject::mask(obj);
let is_array = HValue::get_tag(obj) == HeapT... |
use clap::{crate_authors, crate_description, crate_version, App, AppSettings, Arg, SubCommand};
pub fn build_cli() -> App<'static, 'static> {
App::new("miner")
.version(crate_version!())
.author(crate_authors!())
.about(crate_description!())
.setting(AppSettings::SubcommandRequired... |
use time::{format_description::FormatItem, macros::format_description, PrimitiveDateTime};
use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value};
const PRIMITIVE_DATE_TIME_FORMAT: &[FormatItem<'_>] =
format_description!("[year]-[month]-[day]T[hour]:[minute]:[second].[subsecond]");
/// A local... |
use super::process::abort_with_message;
use libc::{c_int, c_void, memcpy, size_t};
use wasmer_runtime_core::Instance;
/// emscripten: _emscripten_memcpy_big
pub extern "C" fn _emscripten_memcpy_big(
dest: u32,
src: u32,
len: u32,
instance: &mut Instance,
) -> u32 {
debug!(
"emscripten::_ems... |
#![cfg_attr(feature = "no_std", feature(no_std, core))]
#![cfg_attr(feature = "no_std", no_std)]
#![allow(non_camel_case_types)]
extern crate libc;
#[cfg(feature = "no_std")]
extern crate core;
pub mod scancode;
pub mod keycode;
pub mod audio;
pub mod clipboard;
pub mod controller;
pub mod cpuinfo;
pub mod event;
pu... |
//! Crate für einfache Matrix berechnungen und so
/// Matrixmultiplikation
pub fn matrix_mul(a: &Vec<i32>,b: &Vec<i32>,l: usize,m: usize,n: usize) -> Vec<i32>{
// l -> Zeilen von Matrix a
// m -> Spalten von Matrix a bzw. Spalten von Matrix b
// n -> Spalten von Matrix b
let r = l * n; //Anzahl der ... |
use crate::utils::get_current_directory;
use serde::Deserialize;
use std::{collections::HashMap, fs};
#[derive(Clone, Debug, Deserialize)]
pub struct PageTexts {
pub title: String,
pub description: String,
}
#[derive(Clone, Debug, Deserialize)]
pub struct HeaderTexts {
pub nav_home: String,
pub nav_pr... |
pub mod bitset;
pub mod common;
pub mod control;
pub mod dict;
pub mod dyn_;
pub mod floating;
pub mod fraction;
pub mod functional;
pub mod list;
pub mod maybe;
pub mod numeric;
pub mod stepper;
pub mod tuple;
|
use failure::Error;
use serde_json;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::io::Write;
use std::path::Path;
use std::time::SystemTime;
use typemap::Key;
static CONFIG_NAME: &'static str = "boogie_points.json";
pub struct UsersInfo;
impl UsersInfo {
pub fn load() -> Result<Hash... |
#[doc = "Reader of register AFRH"]
pub type R = crate::R<u32, super::AFRH>;
#[doc = "Writer for register AFRH"]
pub type W = crate::W<u32, super::AFRH>;
#[doc = "Register AFRH `reset()`'s with value 0"]
impl crate::ResetValue for super::AFRH {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Typ... |
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0.
use crate::hash::HashBits;
#[cfg(not(feature = "test-hash"))]
#[test]
fn test_hash() {
use crate::hash::hash;
let h1 = hash("abcd");
let h2 = hash("abce");
let first = [184_u8, 123, 183, 214, 70, 86, 205, 79];
let second = [5, 245,... |
use janus::Statuser;
use ops_core::{async_trait, CheckResponse, Checker};
const ACTION: &str = "Troubleshoot Janus";
/// Checks a Janus backend is healthy.
pub struct JanusChecker<S>
where
S: Statuser + Send + Sync,
{
statuser: S,
impact: String,
}
impl<S> JanusChecker<S>
where
S: Statuser + Send + S... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[cfg(feature = "Win32_Foundation")]
#[inline]
pub unsafe fn AcquireDeveloperLicense<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0) -> ::windo... |
use std::collections::VecDeque;
use std::convert::TryFrom;
use std::fmt::Display;
use std::fs;
use std::path::Path;
use std::sync::Arc;
use firefly_diagnostics::{CodeMap, SourceSpan};
use firefly_intern::Symbol;
use firefly_parser::{FileMapSource, Scanner, Source};
use crate::lexer::{AtomToken, SymbolToken, TokenConv... |
use std::rc::Rc;
use crate::ray::Ray;
use crate::vec3::{Point3, Vec3};
use crate::material::Material;
use crate::aabb::AABB;
pub struct HitRecord {
pub p: Point3,
pub normal: Vec3,
pub material: Rc<dyn Material>,
pub t: f32,
pub u: f32,
pub v: f32,
pub is_front_face: bool,
}
pub trait Hit... |
use P41::*;
pub fn main() {
for (n, p1, p2) in goldbach_list_limited(1, 2000, 50) {
println!("{} = {} + {}", n, p1, p2);
}
}
|
use std::{
pin::Pin,
task::{Context, Poll},
};
use futures_core::{ready, stream::Stream};
use log::error;
use pin_project_lite::pin_project;
use crate::{
actor::{Actor, ActorContext, ActorState, AsyncContext, SpawnHandle},
fut::ActorFuture,
};
/// Stream handling for Actors.
///
/// This is helper tr... |
//! Ports of macros in
//! <https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/result.h>
use crate::Result;
/// Checks whether a result code indicates success.
pub fn R_SUCCEEDED(res: Result) -> bool {
res >= 0
}
/// Checks whether a result code indicates failure.
pub fn R_FAILED(res: Result) -... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
mod account_proof;
pub use account_proof::AccountProof;
|
// 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 word_counter;
mod spell_checker;
pub fn clean_line(input: &str) -> String {
input
.trim()
.chars()
.filter(|&a| is_valid_symbol(a))
.collect()
}
fn is_valid_symbol(c: char) -> bool {
c == '-' ||
c == '\'' ||
c.is_alphabetic() ||
c.is_whitespace()
}
fn main() {
}
#[cfg(test)]
... |
use std::str::FromStr;
use firefly_diagnostics::*;
use firefly_intern::Symbol;
use firefly_number::{Float, Integer};
use firefly_parser::{Scanner, Source};
use firefly_syntax_erl::LexicalError;
use super::{LexicalToken, Token};
pub struct Lexer<S> {
scanner: Scanner<S>,
token: Token,
token_start: SourceI... |
use node::Node;
use states::State;
pub struct ListBegin {
pub node: Node
}
impl State for ListBegin {
fn transfer(&self, node: State) -> State {
return node;
}
fn extract(&self) -> Node {
return self.node;
}
}
pub struct ListEnd {
pub node: Node
}
impl State for ListEnd {
... |
/*
Make sure we can spawn tasks that take different types of
parameters. This is based on a test case for #520 provided by Rob
Arnold.
*/
use std;
import std::str;
type ctx = chan[int];
fn iotask(cx: ctx, ip: str) { assert (str::eq(ip, "localhost")); }
fn main() { let p: port[int] = port(); spawn iotask(cha... |
use crate::{SMResult, AST};
pub fn expand(expr: &AST) -> SMResult<AST> {
match expr {
_ => unimplemented!(),
}
}
pub fn expand_logical(expr: &AST) -> SMResult<AST> {
match expr {
_ => unimplemented!(),
}
}
pub fn expand_piecewise(expr: &AST) -> SMResult<AST> {
match expr {
... |
use std::str::from_utf8;
use std::io::{Acceptor, Listener};
use std::io::net::ip::SocketAddr;
use std::from_str::from_str;
use std::io;
use std::io::{TcpListener, TcpStream};
use std::sync::Arc;
struct Hook {
stream: TcpStream,
interest: String,
function: String,
id: String
}
fn handle_sensor(mut stream: TcpS... |
use crate::generated::game::*;
use spatialos_sdk::worker::entity::Entity as WorkerEntity;
use spatialos_sdk::worker::entity_builder::EntityBuilder;
use spatialos_specs::*;
use specs::prelude::*;
pub struct ClientBootstrap {
pub has_requested_player: bool,
}
impl<'a> System<'a> for ClientBootstrap {
type Syste... |
use std::prelude::v1::*;
extern crate rust_base58;
use serde_derive;
use std::fmt;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Error {
repr: Repr,
}
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::R... |
//! Serial numbers.
//!
//! This module define a type [`Serial`] that wraps a `u32` to provide
//! serial number arithmetics.
//!
//! [`Serial`]: struct.Serial.html
use std::{cmp, fmt, hash, str};
//------------ Serial --------------------------------------------------------
/// A serial number.
///
/// Serial numb... |
use sdl2::rect::Rect;
use sdl2::render::Texture;
pub struct Player<'a> {
pos: Rect,
texture: Texture<'a>,
}
impl<'a> Player<'a> {
//Create a new instance of player struct
pub fn create(pos: Rect, texture: Texture<'a>) -> Player {
Player { pos, texture }
}
pub fn x(&self) -> i32 {
self.pos.x()
}... |
use bigdecimal::BigDecimal;
use num_bigint::BigInt;
use num_rational::BigRational;
use num_traits::Pow;
use core::ops::{Add, Div, Mul, Sub};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum MmNumber {
BigDecimal(BigDecimal),
BigRational(BigRational),
}
impl std::fmt::Display for MmN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.