text stringlengths 8 4.13M |
|---|
// VGA library for BIOS-mode
use prelude::*;
use core::fmt;
use core::intrinsics::{volatile_store, volatile_load};
#[repr(u8)] #[derive(Clone, Copy, PartialEq, Eq)]
pub enum VgaColor {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Magenta = 5,
Brown = 6,
LightGrey = 7,
DarkGrey... |
use std::fs;
use std::collections::VecDeque;
use std::collections::BTreeMap;
struct Computer{
ip: usize,
program: BTreeMap<usize, i64>,
relbase: i64,
input: VecDeque<i64>
}
impl Computer {
fn new(program: BTreeMap<usize, i64>, input: VecDeque<i64>) -> Computer {
Computer { ip: 0, program: ... |
use alloc::boxed::Box;
use collections::vec::Vec;
use core::intrinsics::volatile_load;
use core::mem;
use drivers::io::{Io, Mmio};
use drivers::pci::config::PciConfig;
use arch::context::context_switch;
use fs::KScheme;
use super::{Hci, Packet, Pipe, Setup};
#[repr(packed)]
#[derive(Copy, Clone, Debug, Default)]... |
#[derive(Deserialize)]
pub struct LaunchResponse {
#[serde(rename = "Result")]
pub result: ResultState,
#[serde(rename = "Message")]
pub message: String,
}
#[derive(Debug,PartialEq,Deserialize)]
pub enum ResultState {
Success,
Failure,
}
pub trait Api {
// fn status() -> Option<bool>;
... |
extern crate queues;
use queues::*;
pub struct logger{
buf: queues::CircularBuffer<String>
}
impl logger{
pub fn new() -> Self
{
logger {buf : queues::CircularBuffer::<String>::new(35) }
}
pub fn write(&mut self, message: String)
{
self.buf.add(message);
}
pub fn to_... |
//! The module contains a [`Locator`] trait and implementations for it.
use core::ops::Bound;
use std::{
iter::{self, Once},
ops::{Range, RangeBounds},
};
use crate::{
grid::config::Entity,
grid::records::{ExactRecords, PeekableRecords, Records},
settings::object::{
Column, Columns, FirstC... |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use core::{mem};
use crate::{
kty::{clockid_t, c_int, TIMER_ABSTIME, TFD_NONBLOCK},
syscall::{
clock_... |
use lunatic::channel::{Receiver, Sender};
use puck::{
body::{
mime::{HTML, PLAIN},
Body,
},
Request, Response,
};
use serde::{Deserialize, Serialize};
fn home(_: Request) -> Response {
Response::build()
.header("Content-Type", HTML)
.body(Body::from_string("Hello World!"... |
use anyhow::{anyhow, Context};
use std::{convert::TryInto, fs, path::PathBuf};
use structopt::StructOpt;
use crate::config::{self, Config};
const DEFAULT_CONFIG_PATH: &'static str = ".rl-config";
#[derive(Debug, StructOpt)]
#[structopt(
name = "bracketlib-book",
about = "An implementation of the Bracketlib R... |
//! `FromCast` and `IntoCast` implementations for portable 32-bit wide vectors
#![rustfmt::skip]
use crate::*;
impl_from_cast!(
i8x4[test_v32]: u8x4, m8x4, i16x4, u16x4, m16x4, i32x4, u32x4, f32x4, m32x4,
i64x4, u64x4, f64x4, m64x4, i128x4, u128x4, m128x4, isizex4, usizex4, msizex4
);
impl_from_cast!(
u8x... |
use std::option::Option;
use crate::bknode::BkNode;
use crate::keyquery::KeyQuery;
use crate::metric::Metric;
use crate::Dist;
#[derive(Debug, Clone)]
struct BkFindEntry<'a, N: 'a + BkNode> {
dist: Dist,
node: &'a N,
}
pub struct BkFind<'a, KQ, N: 'a, M>
where
KQ: KeyQuery + Default,
N: 'a + BkNode<... |
#![no_std]
mod font_tbl;
pub use font_tbl::font_tbl; |
mod distance_field;
pub use distance_field::*;
|
fn read_line() -> String {
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.trim_end().to_owned()
}
fn main() {
let n = read_line().parse().unwrap();
let mut ss = Vec::new();
(0..n).for_each(|_| {
let s = read_line().parse().unwrap();
ss.push(s)... |
struct Container(i32, i32);
trait Contains {
type A;
type B;
fn contains(&self, &Self::A, &Self::B) -> bool;
fn first(&self) -> i32;
fn last(&self) -> i32;
}
impl Contains for Container {
type A = i32;
type B = i32;
fn contains(&self, n1: &i32, n2: &i32) -> bool {
(&self.0 ==... |
use crate::utils::formatted_strings::APP_VERSION;
/// Parse CLI arguments, and exit if `--help`, `--version`, or an
/// unknown argument was supplied
pub fn parse_cli_args() {
let args = std::env::args().skip(1);
for arg in args {
match arg.as_str() {
"--help" | "-h" => print_help(),
... |
use std::{cell::RefCell, collections::HashMap, fmt::Display, rc::Rc, time::Instant};
use crate::{
parser::Operator, Block, BlockId, Call, Expr, Expression, ParserState, Span, Statement, VarId,
};
#[derive(Debug)]
pub enum ShellError {
Mismatch(String, Span),
Unsupported(Span),
InternalError(String),
... |
pub const WORDLIST: &'static [&'static str] = &[
"Abakus",
"Abart",
"abbilden",
"Abbruch",
"Abdrift",
"Abendrot",
"Abfahrt",
"abfeuern",
"Abflug",
"abfragen",
"Abglanz",
"abhรคrten",
"abheben",
"Abhilfe",
"Abitur",
"Abkehr",
"Ablauf",
"ablecken",
... |
#[macro_use]
extern crate lazy_static;
extern crate regex;
use std::collections::HashSet;
use std::env;
use std::error::Error;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::result;
use std::str::FromStr;
use regex::Regex;
const HEIGHT: usize = 1000;
const WIDTH: usize = 1000;
#[derive(Debug, Partia... |
/*!
* Sylphrena AI input program - https://github.com/ShardAi
* Version - 1.0.0.0
*
* Copyright (c) 2017 Eirik Skjeggestad Dale
*/
use input::syl_wordgram::Unigram;
use input::syl_wordgram::Bigram;
use std::fs::File;
use std::io::prelude::*;
pub struct Sylnlp{
id: String,
unigrams: Vec<Unigram>,
bigr... |
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::{self};
use std::io::{BufReader, BufWriter};
use std::process;
// syscall version
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
let mut buf_in = BufReader::new(io::stdin());
do_cat(&mut buf_... |
extern crate rand;
use std::io;
use rand::Rng;
fn main() {
let secret = rand::thread_rng()
.get_range(1, 100);
println!("ะทะฐะณะฐะดะฐะฝะฝะพะต ัะธัะปะพ: {}", secret);
println!("ัะณะฐะดะฐะน ัะธัะปะพ");
println!("ะฒะฒะตะดะธัะต ัะธัะปะพ");
let mut s = String::new();
io::stdin()
.read_line(&mut s)
.... |
// http://stackoverflow.com/questions/26945853/a-built-in-object-in-rust
fn main() {
} |
extern crate bitcoinrs_bytes;
extern crate bitcoinrs_net;
use std::env::args;
use bitcoinrs_net::{NetworkType, socket::open_connection};
fn main() {
let first_arg = args().skip(1).next().unwrap();
let handshake = open_connection(first_arg.parse().unwrap(), NetworkType::Main).unwrap();
println!("connecte... |
use std::time::Instant;
const INPUT: &str = include_str!("../input.txt");
fn part1() -> usize {
let mut encoded_count = 0;
let mut decoded_count = 0;
for line in INPUT.lines() {
encoded_count += 2; // quotes at beginning and end
let mut chars = line.chars().skip(1).take(line.len() - 2);
... |
#[doc = "Register `MTLRxQOMR` reader"]
pub type R = crate::R<MTLRX_QOMR_SPEC>;
#[doc = "Register `MTLRxQOMR` writer"]
pub type W = crate::W<MTLRX_QOMR_SPEC>;
#[doc = "Field `RTC` reader - Receive Queue Threshold Control"]
pub type RTC_R = crate::FieldReader;
#[doc = "Field `RTC` writer - Receive Queue Threshold Control... |
use amethyst::{
core::{
Transform,
//SystemDesc
},
//derive::SystemDesc,
ecs::{
Join, ReadStorage, System,
//SystemData, World,
WriteStorage
}
};
use crate::game::*;
pub struct CollisionSystem;
impl<'s> System<'s> for CollisionSystem {
type SystemData = (
WriteStorage< 's,... |
use crate::config::DefaultConfig;
use crate::site::Site;
use crate::site::Site::{Found, Visited};
use std::future::Future;
use std::pin::Pin;
pub trait CrawlConfig {
fn should_crawl_site(&self, url: &str) -> bool;
fn url_extractor(&self, text: &str) -> Vec<String>;
fn network_fetch_text(&self, url: &str) -... |
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[cfg(test)]
mod tests {
use std::ffi::c_void;
use hound;
use id666_rs::ID666;
use super::*;
#[test]
fn it_works() {
unsafe {
l... |
// 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 crate::config::{Configuration, ConfigurationChangeRequest};
use crate::errors::Error;
use crate::log::Log;
use crossbeam::{
channel::{bounded, Receiver, Sender, SendError, RecvError},
select,
};
use crate::raft::Raft;
/// Future is used to represent an action that may occur in the future.
pub trait Futur... |
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-BSD-3-Clause file.
//
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
extern crate criterion;
extern crate linux_loader;
extern crate v... |
pub mod alloc;
pub mod data_structs;
use atag;
use mem::alloc::first_fit::FirstFitAlloc;
// Global var for heap allocator
static mut HEAP_ALLOC: FirstFitAlloc = FirstFitAlloc {begin: 0, end: 0};
pub fn init (mem_tag: atag::AtagMem) {
unsafe {
HEAP_ALLOC = FirstFitAlloc::new(mem_tag.start, mem_tag.size - ... |
use actix::prelude::*;
use kosem_webapi::pairing_messages::*;
use kosem_webapi::{KosemResult, Uuid};
use crate::protocol_handlers::websocket_jsonrpc::WsJrpc;
use crate::role_actors::{HumanActor, PairingActor};
use crate::internal_messages::connection::{ConnectionClosed, RpcMessage};
use crate::internal_messages::pai... |
#[doc = "
Removes the common level of indention from description strings. For
instance, if an entire doc comment is indented 8 spaces we want to
remove those 8 spaces from every line.
The first line of a string is allowed to be intend less than
subsequent lines in the same paragraph in order to account for
instances ... |
use std::fs;
use nom::{
bytes::complete::tag,
character::streaming::{i64 as parse_i64, line_ending},
multi::many1,
IResult,
};
#[derive(Debug)]
struct Point {
x: i64,
y: i64,
}
impl Point {
fn manhattan_distance(&self, other: &Point) -> i64 {
(self.x - other.x).abs() + (self.y - o... |
//! Slicing by value
#![deny(missing_docs)]
#![deny(rust_2018_compatibility)]
#![deny(rust_2018_idioms)]
#![deny(warnings)]
#![no_std]
mod from;
mod sealed;
#[cfg(test)]
mod tests;
mod to;
mod traits;
use core::{ops, slice};
use as_slice::{AsMutSlice, AsSlice};
use stable_deref_trait::StableDeref;
pub use {
fr... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// UsageTopAvgMetricsMetadata : The object containing document metadata.
#[derive(Clone, Debug, Part... |
#![crate_name = "shared"]
#![crate_type = "lib"]
#![feature(zero_one)]
extern crate num;
pub mod triangles;
pub mod infinity;
pub mod primes;
pub mod fibonacci;
|
use std::io::prelude::*;
use http::*;
use std::fs::*;
pub struct FileSystem {
path: String,
}
impl FileSystem {
pub fn new(path: &str) -> FileSystem {
FileSystem { path: path.to_string() }
}
pub fn serve(&mut self, uri: &str, resp: &mut Response) {
let mut full_path = self.path.clone();... |
use std::fs;
enum Instr {
N, S, E, W,
L, R, F,
}
struct Move(Instr, i32);
fn parse(s: &str) -> Vec<Move> {
s.lines()
.map(|l| {
use Instr::*;
let n = l[1..].parse().unwrap();
let i = match &l[..1] {
"N" => N,
"S" => S,
... |
use wiring_rs;
use wiring_rs::thick2ofn as thick2ofn;
use wiring_rs::ofn2thick as ofn2thick;
use serde_json::{Value};
//subclass
//equivalence class (binary + nary)
//disjointclasses
//disjointunion
//
//class constructors
//
//property expression
//
//
fn round_trip(input : &str) -> bool {
//translate thick -> ... |
use std::fs;
use regex::{Regex, Captures};
use std::fmt;
pub fn get_passport_lines(filename: &String) -> Vec<String> {
let contents = fs::read_to_string(filename)
.expect("Something went wrong reading the file");
// normalize the input by replacing only the first occurance of an endline with a space
... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
ApiTokens_List(#[from] api_tokens::li... |
//! The submodule that defines user threads.
use std::net::{ Shutdown, TcpStream };
use std::thread;
use std::thread::JoinHandle;
use protocol;
use state::server::common::{ UserList, SayTx, HearRx };
/// Spawn a user thread.
pub fn spawn(
client: TcpStream,
users: UserList,
say_tx: SayTx,
... |
extern crate web_sys;
/// Implements [Program] to read shader files.
pub mod program;
pub use program::Program;
/// Implements [ProgramWrapper] to load from a Program.
pub mod program_wrapper;
pub use program_wrapper::ProgramWrapper;
|
use rand::distributions::{Distribution, Uniform};
use ray_tracer::camera::Camera;
use ray_tracer::hitable;
use ray_tracer::ray::Ray;
use ray_tracer::vec3::Vec3;
use std::io::{self, Write};
fn color(ray: Ray, world: &[&dyn hitable::Hitable]) -> Vec3 {
if let Some(rec) = hitable::hit(world, ray, 0., std::f32::MAX) {... |
macro_rules! println {
($($arg:tt)*) => ({
use core::fmt::Write;
let _ = write!(&mut ::debug::SerialWriter::get(module_path!(), true), $($arg)*);
})
}
macro_rules! printf {
($($arg:tt)*) => ({
use core::fmt::Write;
let _ = write!(&mut ::debug::SerialWriter::get(module_path!(... |
extern crate getopts;
use getopts::Options;
use std::env;
use std::io;
use std::io::prelude::*;
use std::fs::File;
fn read_file(filename: String) -> Result<String, io::Error> {
let mut file = try!(File::open(filename));
let mut concat = String::new();
try!(file.read_to_string(&mut concat));
Ok(concat... |
// The MD2 Message-Digest Algorithm
// https://tools.ietf.org/html/rfc1319
// The S-table's values are derived from Pi
const S: [u8; 256] = [
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13,
0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, 0x98, 0x93, 0x2B, 0xD9, 0... |
use crate::prelude::*;
pub mod prelude {
pub use super::{ArrayRead, ArrayReadChildren};
}
/// Array read-from-index expression.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ArrayRead {
/// The two child expressions of this array read expression.
pub children: P<ArrayReadChildren>,
/// The b... |
use crate::distribution::{Discrete, DiscreteCDF};
use crate::statistics::*;
use crate::{Result, StatsError};
use rand::Rng;
/// Implements the [Discrete
/// Uniform](https://en.wikipedia.org/wiki/Discrete_uniform_distribution)
/// distribution
///
/// # Examples
///
/// ```
/// use statrs::distribution::{DiscreteUnifo... |
//! # Parsers for parts of the file
use crate::common::{
parser::{parse_crc_node, parse_u32_string},
CRCTreeNode,
};
use super::core::*;
use nom::{
bytes::complete::tag,
combinator::map_res,
multi::{fold_many_m_n, length_count},
number::complete::le_u32,
IResult,
};
use std::collections::... |
extern crate colored;
use colored::*;
mod impel;
fn main() {
println!(
// "{hostname}: {cwd} {vcs}{vim}{pchar} ",
"{hostname}: {cwd} {vcs}{vim}",
hostname = impel::hostname().color("red").bold(),
cwd = impel::working_directory(),
vcs = impel::vcs().color("blue").bold(),
... |
// This file is part of Substrate.
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free S... |
use super::{ConfigAware, TestConfig};
pub struct StandaloneCluster {}
impl StandaloneCluster {
pub fn start() -> Self {
todo!();
}
}
impl ConfigAware for StandaloneCluster {
fn config(&self) -> TestConfig {
todo!();
}
}
impl Drop for StandaloneCluster {
fn drop(&mut self) {
... |
mod ivec2;
mod ivec3;
mod ivec4;
pub use ivec2::{ivec2, IVec2};
pub use ivec3::{ivec3, IVec3};
pub use ivec4::{ivec4, IVec4};
#[cfg(not(target_arch = "spirv"))]
mod test {
use super::*;
mod const_test_ivec2 {
#[cfg(not(feature = "cuda"))]
const_assert_eq!(
core::mem::align_of::<i3... |
#[desc = "Redis bindings."];
#[license = "MIT"];
struct Redis;
// TODO: These types are all wrong, but they are all the types
enum Reply {
Status(~str),
Error(~str),
Integer(int),
Bulk(~str),
MultiBulk(~str),
}
impl Redis {
fn set(&self, key: &str, value: &str) {
println(fmt!("set: %... |
use actix_web::{App, HttpServer};
use log::Level;
mod admin_meta;
mod config;
mod internal_meta;
mod public_transaction;
pub mod response;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
//Initialize the log and set the print level
simple_logger::init_with_level(Level::Warn).unwrap();
HttpSer... |
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
use serde_json::{Value, json};
pub use stardog_function::*;
#[no_mangle]
pub extern fn evaluate(subject: *mut c_char) -> *mut c_char {
let subject = unsafe { CStr::from_ptr(subject).to_str().unwrap() };
let values: Value = serde_json::from_str(subject... |
use log::*;
use tokio::time::Duration;
use crate::network::message::{ClientMessage, Message, ServerMessage};
use crate::network::ws_event::WsEvent;
use crate::network::ws_server;
use crate::server::pong_server::PongServer;
use quicksilver::Timer;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
pub... |
// Copyright (c) 2016, <daggerbot@gmail.com>
// This software is available under the terms of the zlib license.
// See COPYING.md for more information.
use std::any::Any;
use std::borrow::Cow;
use std::char::DecodeUtf16Error;
use std::error;
use std::ffi::NulError;
use std::fmt::{self, Display, Formatter};
use std::nu... |
use std::fmt;
use std::convert::From;
use std::io;
use std::error::Error as StdError;
use std::result;
use nix;
pub type Result<T> = result::Result<T, Error>;
/// An error arising from terminal operations.
///
/// The lower-level cause of the error, if any, will be returned by calling `cause()`.
#[derive(Debug)]
pub... |
use std::num::ParseIntError;
use std::num::ParseFloatError;
#[derive(Debug, Fail)]
pub enum ParseNumberError {
#[fail(display = "{}", _0)]
ParseIntError(ParseIntError),
#[fail(display = "{}", _0)]
ParseFloatError(ParseFloatError),
}
impl From<ParseFloatError> for ParseNumberError {
fn from(error: ... |
#![no_std]
#![feature(in_band_lifetimes)]
pub mod alarm;
pub mod console;
pub mod crc;
pub mod debug_writer;
pub mod isl29035;
pub mod lldb;
pub mod nrf51822;
pub mod process_console;
pub mod rng;
pub mod si7021;
pub mod spi;
|
use crate::commands::list::list_roots;
use crate::config::Config;
use crate::utils;
use dialoguer;
use std::path::PathBuf;
pub fn remove(path: Option<PathBuf>, mut config: Config) -> Result<(), failure::Error> {
if path == None && config.paths.is_empty() {
println!("You are not currently tracking any direc... |
use crate::attestations::{attestations::AttestableBlock, *};
use crate::rewards_and_penalties::rewards_and_penalties::StakeholderBlock;
use helper_functions::beacon_state_accessors::*;
use helper_functions::{
beacon_state_accessors::{get_randao_mix, get_total_active_balance, get_validator_churn_limit},
beacon_s... |
use crate::calendar::Calendar;
use crate::config::TConfig;
use crate::table::{Row, Table, TableState};
use std::cmp::Ordering;
use std::convert::TryInto;
use std::error::Error;
use std::process::Command;
use std::result::Result;
use task_hookrs::date::Date;
use task_hookrs::import::import;
use task_hookrs::status::Ta... |
use std::fs;
use test_case::test_case;
use bitbuffer::{BitRead, BitReadBuffer, BitReadStream, BitWrite, BitWriteStream, LittleEndian};
use std::collections::HashMap;
use tf_demo_parser::demo::header::Header;
use tf_demo_parser::demo::message::Message;
use tf_demo_parser::demo::packet::datatable::SendTableName;
use tf_... |
//! This module contains feature tests: minimalistic tests which check features in isolation
//! and their combination.
mod breaks;
mod dispatch;
mod fleet;
mod format;
mod limits;
mod multjob;
mod pickdev;
mod priorities;
mod relations;
mod reload;
mod skills;
mod timing;
mod work_balance;
|
use futures::channel::mpsc::{unbounded, UnboundedReceiver};
use futures::executor::ThreadPool;
use futures::task::SpawnExt;
use futures::StreamExt;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
// use tokio::runtime::Runtime;
use tokio::sync::{
oneshot::{self, Sender},
watch,
};
use crate::proto:... |
use core::panic;
use std::io::{self, Read};
use bytes::buf::Reader;
use bytes::{Buf, Bytes};
use chunked_bytes::ChunkedBytes;
use lazy_static::lazy_static;
use parquet::data_type::AsBytes;
use parquet::errors::Result;
use parquet::file::reader::{ChunkReader, Length};
use regex::Regex;
use rusoto_core::Region;
use ruso... |
fn main() {
// ## distingush between String and str slice
let mut a: String = String::from("๋๋ ๋๋น์์ ใ
ใ
");
let b: &str = "^_^";
a.push_str(b);
let c: char = '@'; // use '
a.push(c);
let one: &str = "๋๋ ์ฑํ์ด์์";
let two: String = one.to_string();
// Indexing
for c in a.chars() {... |
use emulator_rs;
fn main() {
let mut cpu = emulator_rs::frontend::rv32i::cpu::CPU::new(0,4096);
let entry_point = cpu.load_elf("src/bin/rv32i-sb".to_string());
println!("Entry Point loaded");
println!("{:?}", cpu);
cpu.get_registers().set_pc(entry_point + 0x100);
cpu.run().unwrap();
println... |
mod cons_list;
mod drop;
mod memory_leak;
mod my_box;
mod tree;
fn main() {
drop::drop_main();
my_box::my_box_main();
cons_list::list::list_main();
cons_list::rc_list::list_main();
cons_list::rc_refcell_list::list_main();
memory_leak::main();
tree::main();
}
|
extern crate parser_c;
extern crate walkdir;
use std::fs::read_to_string;
use parser_c::parse_str;
use walkdir::WalkDir;
#[test]
fn eval_smoke() {
for item in WalkDir::new("smoke") {
if let Ok(entry) = item {
if entry.path().extension().map_or(false, |v| v == "c") {
let input =... |
use serde_json;
use std::fs;
use std::io;
use std::path::Path;
use std::path::PathBuf;
use std::collections::HashMap;
struct JsonFile {
stem: String,
content: String,
}
fn get_dir_json(P: &Path) -> io::Result<()> {
let entries = fs::read_dir(P)?
.map(|res| res.map(|e| e.path()))
.map(|path... |
#[doc = "Reader of register BIST_ADDR"]
pub type R = crate::R<u32, super::BIST_ADDR>;
#[doc = "Reader of field `COL_ADDR`"]
pub type COL_ADDR_R = crate::R<u16, u16>;
#[doc = "Reader of field `ROW_ADDR`"]
pub type ROW_ADDR_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Current column address."]
#[inline(a... |
//! Rendering Base
use crate::color::*;
use crate::Pixel;
use crate::Color;
use std::cmp::min;
use std::cmp::max;
/// Rendering Base
///
#[derive(Debug)]
pub struct RenderingBase<T> {
/// Pixel Format
pub pixf: T,
}
impl<T> RenderingBase<T> where T: Pixel {
/// Create new Rendering Base from Pixel Forma... |
/// This type exists for one purpose and one purpose only. To help you ensure you're mutating
/// the correct thing, and not mutating a copy. Put `Copy` types in here to rob them of their `Copy` implementation.
///
/// This wrapper tries to be transparent in every way, of course it can't implement every trait in existe... |
use crate::*;
use detail::constants::UNREACHABLE;
// Represents a tile in the map
pub struct Tile<'a, P: Platform> {
pub image: Option<&'a P::Image>,
pub info: &'a serialization::TileType<'a>,
pub unit: std::cell::Cell<Option<&'a serialization::Unit<'a>>>,
pub remaining_move: std::cell::Cell<numeric_ty... |
// https://blog.rust-lang.org/2015/05/11/traits.html
pub trait Walk {
fn walk( &self ) -> u32;
}
struct Human {
legs: u32,
}
impl Human {
fn eat() {
}
}
struct Lion {
legs: u32,
}
impl Lion {
fn hunt() {
}
}
impl Walk for... |
use std::{convert::TryInto, io};
use tokio::{net::TcpListener, task};
// `u32` (32-bit unsigned int) is used for storing a length of a message.
// Size of `u32`: 4 bytes.
// https://doc.rust-lang.org/std/mem/fn.size_of.html
const MESSAGE_LENGTH_BUFFER_SIZE: usize = 4;
#[tokio::main]
async fn main() -> io::Result<()>... |
use std::env;
use std::fs;
use std::process;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = env::args().collect();
if args.len() != 2 {
println!("Exactly one argument is required; the input file");
process::exit(1);
}
let contents = fs::read_to_string(&arg... |
#[macro_use]
extern crate criterion;
extern crate serde_json;
extern crate slack_api;
use criterion::Criterion;
use slack_api::channels::HistoryResponse;
fn history_1000(c: &mut Criterion) {
let the_json = std::fs::read_to_string("general.txt").unwrap();
c.bench_function("history_1000", move |b| {
b.... |
#[doc = "Register `ISR0` reader"]
pub type R = crate::R<ISR0_SPEC>;
#[doc = "Field `AE0` reader - AE0"]
pub type AE0_R = crate::BitReader;
#[doc = "Field `AE1` reader - AE1"]
pub type AE1_R = crate::BitReader;
#[doc = "Field `AE2` reader - AE2"]
pub type AE2_R = crate::BitReader;
#[doc = "Field `AE3` reader - AE3"]
pub... |
// ===============================================================================
// Authors: AFRL/RQQA
// Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
//
// Copyright (c) 2017 Government of the United State of America, as represented by
// the Secretary of th... |
/// a color in rgba channel format. These should all be in the range 0.0-1.0
/// **Not in 0-255** use `new_from_rgb` or `new_from_rgba`
#[allow(missing_docs)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}
impl Color {
/// returns a new... |
#!/usr/bin/env rustx
use std;
import std::json;
import std::json::Json;
import std::json::Error;
fn main (args: ~[~str]) {
if vec::len(args) != 2 { io::println(~"Usage: ./pp.rs JSON-FILE"); return; }
let result_data: Result<~str, ~str> = io::read_whole_file_str(&path::Path(args[1]));
let data = result::unwr... |
$NetBSD: patch-vendor_nix_src_sys_signal.rs,v 1.2 2023/05/03 22:39:09 he Exp $
Narrow the conditional on mips to only apply to Linux.
--- vendor/nix/src/sys/signal.rs.orig 2023-01-25 01:49:16.000000000 +0000
+++ vendor/nix/src/sys/signal.rs
@@ -1069,7 +1069,7 @@ mod sigevent {
SigevNotify::SigevThrea... |
mod document_file;
mod document_message_handler;
mod layer_panel;
mod movement_handler;
#[doc(inline)]
pub use document_file::LayerData;
#[doc(inline)]
pub use document_file::{AlignAggregate, AlignAxis, DocumentMessage, DocumentMessageDiscriminant, DocumentMessageHandler, FlipAxis};
#[doc(inline)]
pub use document_me... |
pub mod config;
pub mod local;
pub mod loopback;
|
// 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.
//! Testing-related utilities.
use rand::{SeedableRng, XorShiftRng};
/// Create a new deterministic RNG from a seed.
pub fn new_rng(mut seed: u64) -> imp... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// SyntheticsStepType : Step type used in your Synthetic test.
/// Step type used in your Synthetic te... |
fn main() {
proconio::input! {
n: usize,
v: [u32; 2*n],
}
let mut v = v.clone();
let mut s_v = v.clone();
s_v.sort();
// println!("{:?}", v);
// println!("{:?}", s_v);
let mut centor = s_v[n];
// println!("centor {}", centor);
let mut sum:u32 = 0;
let mut j... |
#[doc = "Register `AHB4LPENR` reader"]
pub type R = crate::R<AHB4LPENR_SPEC>;
#[doc = "Register `AHB4LPENR` writer"]
pub type W = crate::W<AHB4LPENR_SPEC>;
#[doc = "Field `GPIOALPEN` reader - GPIO peripheral clock enable during CSleep mode"]
pub type GPIOALPEN_R = crate::BitReader<GPIOALPEN_A>;
#[doc = "GPIO peripheral... |
use std::convert::TryInto;
use std::error::Error;
use zbus::{dbus_interface, fdo};
struct Foo;
#[dbus_interface(name = "com.grahamc.Foo1")]
impl Foo {
fn bar(&self, name: &str, arg: &str) -> String {
format!("Hello {} {}!", name, arg)
}
}
fn main() -> Result<(), Box<dyn Error>> {
let connection =... |
#[macro_use] extern crate log;
#[macro_use] extern crate rustc_serialize;
extern crate log4rs;
extern crate regex;
extern crate win32_bindgen;
use std::collections::HashMap;
use win32_bindgen as bg;
const LOGGER_CONFIG_PATH: &'static str = "local/log.toml";
fn main() {
println!("Loading logger config...");
m... |
use crate::{
configuration::WebsocketSettings,
error::WebsocketError,
message::{ClientMessage, ResultMessage, TaskMessage, WebsocketMessage},
subsystems::{
pc_usage::PcUsageSystem, python_repo::PythonRepoSystem, Subsystem, WebsocketSystem,
},
telemetry::tokio_spawn,
};
use anyhow::Contex... |
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "type")]
#[serde(rename_all = "camelCase")]
pub enum Dimension {
#[serde(rename_all = "camelCase")]
Default {
dimension: String,
output_name: String,
output_type: OutputType,
},
#[serde(r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.