commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
a5330f292e9a1ace1b4eba26760184e82d2234f2 | src/bin/csv-check.rs | src/bin/csv-check.rs | /* 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 std::env;
use std::fs::File;
use std::path::Path;
extern crate csv_checker;
fn report_errors_for_file(file: ... | /* 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 std::env;
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
extern crate csv_checker;
fn repor... | Use a buffered reader (much, much, much faster) | Use a buffered reader (much, much, much faster)
| Rust | mpl-2.0 | tie-rack/csv-checker |
3de703e65c6c449ba380b9c825fc95a828cb45da | src/mod.rs | src/mod.rs | pub use std::collections::{HashSet, HashMap};
mod graph;
mod traversal;
mod tree;
fn main() {
}
| pub use std::collections::{HashSet, HashMap};
use graph::{Graph, Ungraph, Digraph};
mod graph;
mod traversal;
mod tree;
fn main() {
let mut g = Ungraph::new();
println!("{}", g);
g.add_node('a');
g.add_node('b');
g.add_node('c');
println!("{}", g);
g.add_edge(0, 1);
g.add_edge(0, 2);
... | Add some basic tests in main | Add some basic tests in main
| Rust | mit | nham/gymnosporangium |
b41b158bc4c0e3dbf1bdee2ff18e5f7336a3e3e2 | euclidean.rs | euclidean.rs | // Using structs to represent 2D points
// and calculating the Euclidean distance between them
mod pointutils {
pub struct Point {
pub x: f64,
pub y: f64,
}
pub fn euclidean(point_a: Point, point_b: Point) -> f64 {
0.0
}
}
fn main() {
let point_a: pointutils::Point = po... | // Using structs to represent 2D points
// and calculating the Euclidean distance between them
mod pointutils {
use std::num::pow;
pub struct Point {
pub x: f64,
pub y: f64,
}
pub fn euclidean(point_a: Point, point_b: Point) -> f64 {
let value_sq = pow((point_a.x - point_b.x)... | Add pow and sqrt functions, return actual result | Add pow and sqrt functions, return actual result
| Rust | bsd-2-clause | ambidextrousTx/ToyRustPrograms |
7934bf9eb7784962d5af8f96258756fc480d4c22 | tests/small-stack.rs | tests/small-stack.rs | // Regression test for https://github.com/servo/html5ever/issues/393
//
// Create a dynamic atom − causing initialization of the golbal hash map −
// in a thread that has a small stack.
//
// This is a separate test program rather than a `#[test] fn` among others
// to make sure that nothing else has already initialize... | // Regression test for https://github.com/servo/html5ever/issues/393
//
// Create a dynamic atom − causing initialization of the global hash map −
// in a thread that has a small stack.
//
// This is a separate test program rather than a `#[test] fn` among others
// to make sure that nothing else has already initialize... | Fix warning and typo in small stack regression test | Fix warning and typo in small stack regression test
| Rust | apache-2.0 | servo/string-cache |
5f994583ba95e40b53bb06f49549b03119f78f94 | sha1/build.rs | sha1/build.rs | extern crate cc;
fn main() {
let asm_path = if cfg!(target_arch = "x86") {
"src/x86.S"
} else if cfg!(target_arch = "x86_64") {
"src/x64.S"
} else {
"src/generic.c"
};
cc::Build::new()
.file(asm_path)
.opt_level(3)
.compile("sha1-round");
}
| extern crate cc;
fn main() {
let asm_path = if cfg!(target_os = "macos") {
"src/generic.c"
} else if cfg!(target_arch = "x86") {
"src/x86.S"
} else if cfg!(target_arch = "x86_64") {
"src/x64.S"
} else {
"src/generic.c"
};
cc::Build::new()
.file(asm_path)... | Disable asm sha1 rounds on OSX | Disable asm sha1 rounds on OSX
| Rust | isc | Luminarys/synapse,Luminarys/synapse,Luminarys/synapse |
f748914b33547866dccca8569d31a890915ecbf8 | src/node.rs | src/node.rs | use std::collections::HashMap;
use edge;
pub type Index = usize;
pub struct Node {
pub identifier: String,
pub attributes: Option<HashMap<String, String>>,
pub first_outgoing_edge: Option<edge::Index>,
}
| use std::collections::HashMap;
use edge;
pub type Index = usize;
pub struct Node {
pub identifier: String,
pub attributes: Option<HashMap<String, String>>,
pub first_outgoing_edge: Option<edge::Index>,
}
impl Node {
pub fn equal(&self, node: Node) -> bool {
self.identifier == node.identifier ... | Add basic total equality matcher for Node | Add basic total equality matcher for Node
Fuzzy matcher to come later, which will be more useful.
| Rust | mit | charlieegan3/graph_match |
fbec376eedd5f6ac39ae629d9ffcd216ff37e0a6 | test/add.rs | test/add.rs | #![feature(custom_attribute, rustc_attrs)]
#![allow(dead_code, unused_attributes)]
#[rustc_mir]
#[miri_run]
fn foo() -> i32 {
let x = 1;
let y = 2;
x + y
}
fn main() {}
| #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run(expected = "Int(1)")]
fn ret() -> i32 {
1
}
#[miri_run(expected = "Int(3)")]
fn add() -> i32 {
1 + 2
}
#[miri_run(expected = "Int(3)")]
fn indirect_add() -> i32 {
let x = 1;
let y = 2;
x + y
}
fn main() {}
| Add more tests. Remove unecessary attributes. | Add more tests. Remove unecessary attributes.
| Rust | apache-2.0 | graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,rust-lang/miri,aidancully/rust,tsion/miri,GBGamer/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,rust-lang/miri,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,rust-lang/miri,graydon/rust,graydon/rust,rust-lang/mi... |
dfdf8093ebbd4145864995627b812780de52f902 | exercises/conversions/as_ref_mut.rs | exercises/conversions/as_ref_mut.rs | // AsRef and AsMut allow for cheap reference-to-reference conversions.
// Read more about them at https://doc.rust-lang.org/std/convert/trait.AsRef.html
// and https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively.
// I AM NOT DONE
// Obtain the number of bytes (not characters) in the given argument
// ... | // AsRef and AsMut allow for cheap reference-to-reference conversions.
// Read more about them at https://doc.rust-lang.org/std/convert/trait.AsRef.html
// and https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively.
// I AM NOT DONE
// Obtain the number of bytes (not characters) in the given argument
// ... | Enable a test and improve per clippy's suggestion. | Enable a test and improve per clippy's suggestion. | Rust | mit | carols10cents/rustlings,carols10cents/rustlings |
9b5b542bc807f7bd6370495946867efad29b541d | rust/hamming/src/lib.rs | rust/hamming/src/lib.rs | pub fn hamming_distance<'a, 'b>(a: &'a str, b: &'a str) -> Result<usize, &'b str> {
if a.len() != b.len() {
return Err("Length is not same");
}
let max = a.len();
let mut ai = a.chars();
let mut bi = b.chars();
let mut count = 0;
for _ in 0..max {
if ai.next() != bi.next(... | pub fn hamming_distance(a: &str, b: &str) -> Result<usize, &'static str> {
if a.len() != b.len() {
return Result::Err("Length is not same");
}
let count = a.chars()
.zip(b.chars())
.filter(|&(an, bn)| an != bn)
.count();
Result::Ok(count)
}
| Use a smart way stolen from others | Use a smart way stolen from others
I like functional programming style now
| Rust | bsd-2-clause | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism |
6511e908d78f26e671770fb3150878ae13bf51fb | src/main.rs | src/main.rs | extern crate lp_modeler;
use lp_modeler::operations::{LpOperations};
use lp_modeler::problem::{LpProblem, LpObjective};
use lp_modeler::solvers::*;
use lp_modeler::variables::{LpInteger};
fn main() {
let ref a = LpInteger::new("a");
let ref b = LpInteger::new("b");
let ref c = LpInteger::new("c");
... | extern crate lp_modeler;
use lp_modeler::operations::{LpOperations};
use lp_modeler::problem::{LpProblem, LpObjective};
use lp_modeler::solvers::*;
use lp_modeler::variables::{LpInteger};
fn main() {
let ref a = LpInteger::new("a");
let ref b = LpInteger::new("b");
let ref c = LpInteger::new("c");
... | Add some ideas in comment | Add some ideas in comment
| Rust | mit | tvincent2/rust-lp-modeler,jcavat/rust-lp-modeler |
9d295f841219962d234b7fcfd217c007e9adf0c8 | src/main.rs | src/main.rs | extern crate serialize;
extern crate rustbox;
extern crate docopt;
extern crate rdit;
use docopt::Docopt;
#[cfg(not(test))] use rdit::Editor;
static USAGE: &'static str = "
Usage: rdit [<filename>]
rdit --help
Options:
-h, --help Show this message.
";
#[deriving(Decodable, Show)]
struct Args {
... | extern crate serialize;
extern crate rustbox;
extern crate docopt;
extern crate rdit;
use docopt::Docopt;
#[cfg(not(test))] use rdit::Editor;
static USAGE: &'static str = "
Usage: rdit [<filename>]
rdit --help
Options:
-h, --help Show this message.
";
#[deriving(Decodable, Show)]
struct Args {
... | Fix editor not starting on osx | Fix editor not starting on osx
| Rust | mit | jadnohra/iota,crespyl/iota,gchp/iota |
ff6ba4dca04bca8850d79b1fb453386092f4e2d8 | src/example_algorithms.rs | src/example_algorithms.rs | use {MultiDeciderImpl, TypedDecider, ImpliedDeciderImpl, MultiDecider, Decider, Decision, Result};
use std::time::Instant;
impl Decider for Allower {}
impl MultiDecider for Allower {}
#[derive(Copy, Clone)]
/// The most naive implementation of a rate-limiter ever: Always
/// allows every cell through.
/// # Example
... | use {MultiDeciderImpl, TypedDecider, ImpliedDeciderImpl, MultiDecider, Decider, Decision, Result};
use std::time::Instant;
impl Decider for Allower {}
impl MultiDecider for Allower {}
#[derive(Default, Copy, Clone)]
/// The most naive implementation of a rate-limiter ever: Always
/// allows every cell through.
/// #... | Make clippy happy: Derive Default for Allower | Make clippy happy: Derive Default for Allower
| Rust | mit | antifuchs/ratelimit_meter |
b8971265c3b3722c06afc1d40a936bc26b6fa526 | gfx.rs | gfx.rs | //
// sprocketnes/gfx.rs
//
// Copyright (c) 2013 Mozilla Foundation
// Author: Patrick Walton
//
use ppu;
use core::uint::range;
use sdl::sdl::{InitTimer, InitVideo};
use sdl::sdl;
use sdl::video::{DoubleBuf, HWSurface, Surface};
use sdl::video;
const SCREEN_WIDTH: uint = 320;
const SCREEN_HEIGHT: uint = 240;
pub ... | //
// sprocketnes/gfx.rs
//
// Copyright (c) 2013 Mozilla Foundation
// Author: Patrick Walton
//
use ppu;
use core::uint::range;
use sdl::sdl::{InitTimer, InitVideo};
use sdl::sdl;
use sdl::video::{DoubleBuf, HWSurface, Surface};
use sdl::video;
const SCREEN_WIDTH: uint = 256;
const SCREEN_HEIGHT: uint = 240;
pub ... | Fix screen size and optimize blitting a bit | Fix screen size and optimize blitting a bit
| Rust | mit | steveklabnik/sprocketnes,beni55/sprocketnes,bgourlie/sprocketnes,benklebe/sprocketnes,pcwalton/sprocketnes,jonas-schievink/sprocketnes |
7c43631cd03cb9864751e78ca063182edefe3473 | src/main.rs | src/main.rs | // File with main method. Can be used to start the generator without
// including it as a library from an external program.
mod map_generator;
fn main() {
let mut height_map: Vec<int> = Vec::from_fn(1600, |_| 0);
let number_of_drop_points = 5;
let min_particles = 100;
let max_particles = 400;
let number_of_... | // File with main method. Can be used to start the generator without
// including it as a library from an external program.
mod map_generator;
fn main() {
let size = 40;
let number_of_drop_points = 5;
let min_particles = 100;
let max_particles = 400;
let number_of_passes = 4;
let particle_stability_radius ... | Create drop points for each pass | Create drop points for each pass
| Rust | mit | gilles-leblanc/potential-dangerzone,gilles-leblanc/potential-dangerzone |
44d7dda61cecc2327f0a1d2c93a7337de38b78d8 | src/main.rs | src/main.rs | #![feature(core)]
#![feature(old_io)]
#![feature(old_path)]
extern crate crc64;
use crc64::crc64;
use std::env;
use std::old_io::{BufferedReader, File};
fn main() {
let mut args = env::args();
let (len,_) = args.size_hint();
let prog = args.next().unwrap();
if len == 1 {
println!("Usage: {} [... | #![feature(core)]
extern crate crc64;
use crc64::crc64;
use std::env;
use std::path::Path;
use std::io::{Read,BufReader};
use std::fs::File;
pub fn main() {
let mut args = env::args();
let (len,_) = args.size_hint();
let prog = args.next().unwrap();
if len == 1 {
println!("Usage: {} [list of ... | Use stable io and path modules | Use stable io and path modules
| Rust | bsd-3-clause | badboy/crc64-rs |
4e0903c049fd4a1ad7638a4c4c4a6ef32e11af31 | src/parse.rs | src/parse.rs | use command::Command;
pub fn parse(s: &str) -> Vec<Command> {
let mut vec = Vec::new();
for c in s.chars() {
let command = match c {
'.' => Some(Command::Output),
',' => Some(Command::Input),
'<' => Some(Command::LeftShift),
'>' => Some(Command::RightShif... | use command::Command;
pub fn parse(s: &str) -> Vec<Command> {
let mut vec = Vec::new();
for c in s.chars() {
let command = match c {
'.' => Some(Command::Output),
',' => Some(Command::Input),
'<' => Some(Command::LeftShift),
'>' => Some(Command::RightShif... | Add parsing rules for Jump tokens | Add parsing rules for Jump tokens
| Rust | mit | nafarlee/thoughtfuck |
98c250adcf78f14d6d901c9b966cda4cf10f1509 | src/bool.rs | src/bool.rs | #[derive(Clone, Copy)]
pub struct True;
#[derive(Clone, Copy)]
pub struct False;
const TRUE: True = True;
const FALSE: False = False;
impl True {
pub const fn not<'a>(&'a self) -> &'a False { &FALSE }
pub const fn and<'a, T>(&'a self, other: &'a T) -> &'a T { other }
pub const fn or<'a, T>(&'a self, _: &'... | #[derive(Clone, Copy)]
pub struct True;
#[derive(Clone, Copy)]
pub struct False;
impl True {
pub const fn not<'a>(&'a self) -> &'a False { &False }
pub const fn and<'a, T>(&'a self, other: &'a T) -> &'a T { other }
pub const fn or<'a, T>(&'a self, _: &'a T) -> &'a True { &True }
}
impl False {
pub con... | Remove `TRUE` and `FALSE` constants | Remove `TRUE` and `FALSE` constants
| Rust | apache-2.0 | nvzqz/static-assertions-rs |
3a8a29bfcadbc1a9d40b5977b8179e262042f96e | src/main.rs | src/main.rs | struct Philosopher {
name: String
}
impl Philosopher {
fn new(name: &str) -> Philosopher {
Philosopher {
name: name.to_string()
}
}
}
fn main() {
let p1 = Philosopher::new("Judith Butler");
let p2 = Philosopher::new("Gilles Deleuze");
let p3 = Philosopher::new("Karl... | struct Philosopher {
name: String
}
impl Philosopher {
fn new(name: &str) -> Philosopher {
Philosopher {
name: name.to_string()
}
}
fn eat(&self) {
println!("{} is done eating.", self.name);
}
}
fn main() {
let p1 = Philosopher::new("Judith Butler");
le... | Add `eat()` method to `Philosopher` | Add `eat()` method to `Philosopher`
| Rust | mit | juliangrosshauser/dining_philosophers |
3cf0a70cb1489154eb7ac712abfc36e452107c0a | src/main.rs | src/main.rs | use compiler::Lexer;
use std::old_io::{BufferedReader, IoErrorKind};
use std::old_io::fs::File;
use std::os;
mod compiler;
#[allow(dead_code)]
fn main() {
let args = os::args();
let file_name = match args.get(1) {
Some(v) => v,
None => panic!("Must provide file to tokenize"),
};
print... | #![feature(env)]
#![feature(io)]
#![feature(os)]
#![feature(path)]
#![feature(unicode)]
use compiler::Lexer;
use std::env;
use std::old_io::fs::File;
use std::old_io::{BufferedReader, IoErrorKind};
mod compiler;
#[allow(dead_code)]
fn main() {
let mut args = env::args();
let file_name = match args.nth(1).and... | Fix or silence all warnings | Fix or silence all warnings
| Rust | mit | jtdowney/som-rust,jtdowney/som.rs |
8c39c51cf250a5b84552e7e1510876149bc3bc8d | examples/postgres/getting_started_step_1/src/lib.rs | examples/postgres/getting_started_step_1/src/lib.rs | #[macro_use]
extern crate diesel;
extern crate dotenv;
pub mod models;
pub mod schema;
use diesel::prelude::*;
use dotenv::dotenv;
use std::env;
pub fn establish_connection() -> PgConnection {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
PgConnection::es... | #[macro_use]
extern crate diesel;
extern crate dotenv;
pub mod models;
pub mod schema;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use dotenv::dotenv;
use std::env;
pub fn establish_connection() -> PgConnection {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must ... | Align getting started example imports with repo | Align getting started example imports with repo
While the prelude imports `PgConnection`, it's a confusing mis-match for beginners.
Fixes #1758 | Rust | apache-2.0 | diesel-rs/diesel,sgrif/diesel,sgrif/diesel,diesel-rs/diesel |
de208b33554d720007d95db9924ca3dd3cfc5b7f | src/sys/mod.rs | src/sys/mod.rs | #[cfg(unix)]
pub use self::unix::{
pipe, set_nonblock, Event, EventedFd, Events, Io, Selector, SysEvent, TcpListener, TcpStream,
UdpSocket, Waker,
};
#[cfg(unix)]
pub mod unix;
#[cfg(windows)]
pub use self::windows::{
Binding, Event, Events, Overlapped, Selector, SysEvent, TcpListener, TcpStream, UdpSocke... | //! Module with system specific types.
//!
//! `SysEvent`: must be a type alias for the system specific event, e.g.
//! `kevent` or `epol_event`.
//! `Event`: **must be** a `transparent` wrapper around `SysEvent`, i.e. the
//! type must have `#[repr(transparent)]` with only `SysEvent` as
//! ... | Document the requirements for Event and SysEvent in sys | Document the requirements for Event and SysEvent in sys
| Rust | mit | carllerche/mio,murarth/mio,carllerche/mio |
52447a47ad543fc215908bf20604aa60fd22318f | src/client_handler.rs | src/client_handler.rs | use chattium_oxide_lib::json::FromJsonnable;
use chattium_oxide_lib::ChatMessage;
use hyper::server::{Request, Response};
use hyper::status::StatusCode;
use hyper::method::Method;
use std::io::Read;
pub fn handle_client(req: Request, mut res: Response) {
let mut req = req;
*res.status_mut() = match req.method {
M... | use chattium_oxide_lib::json::FromJsonnable;
use chattium_oxide_lib::ChatMessage;
use hyper::server::{Request, Response};
use hyper::status::StatusCode;
use hyper::method::Method;
use std::io::Read;
pub fn handle_client(req: Request, mut res: Response) {
let mut req = req;
*res.status_mut() = match req.method {
M... | Include client IP in UnprocessableEntity error | Include client IP in UnprocessableEntity error
| Rust | mit | nabijaczleweli/chattium-oxide-server,nabijaczleweli/chattium-oxide-server,nabijaczleweli/chattium-oxide-server |
21fa21859b93733638c226a91caabfd65c8204f0 | libimagtodo/src/delete.rs | libimagtodo/src/delete.rs | // Needed for reading a Json File
// extern crate rustc_serialize;
// use rustc_serialize::json::Json;
// use std::fs::File;
// use std::io::Read;
use uuid::Uuid;
use libimagstore::store::Store;
use libimagstore::storeid::IntoStoreId;
use module_path::ModuleEntryPath;
use error::{TodoError, TodoErrorKind};
/// With... | use uuid::Uuid;
use libimagstore::store::Store;
use libimagstore::storeid::IntoStoreId;
use module_path::ModuleEntryPath;
use error::{TodoError, TodoErrorKind};
/// With the uuid we get the storeid and then we can delete the entry
pub fn deleteFunc(uuid: Uuid, store : &Store) -> Result<(),TodoError> {
// With the ... | Change the Error handling and remove unsed code | Change the Error handling and remove unsed code
| Rust | lgpl-2.1 | matthiasbeyer/imag,matthiasbeyer/imag,mario-kr/imag,mario-kr/imag |
0f966268ab459e8451ec47ffd8e3027fdafccc5d | argparse/test_optional.rs | argparse/test_optional.rs | use parser::ArgumentParser;
use super::StoreOption;
use test_parser::{check_ok,check_err};
#[test]
fn test_opt() {
let mut val = None;
let mut ap = ArgumentParser::new();
ap.refer(&mut val)
.add_option(["-s", "--set"], box StoreOption::<int>,
"Set string value");
assert_eq!(val, None);
... | use parser::ArgumentParser;
use super::StoreOption;
use test_parser::{check_ok,check_err};
#[test]
fn test_opt() {
let mut val = None;
let mut ap = ArgumentParser::new();
ap.refer(&mut val)
.add_option(["-s", "--set"], box StoreOption::<int>,
"Set int value");
assert_eq!(val, None);
c... | Add a test for StoreOption::<String> | Add a test for StoreOption::<String>
| Rust | mit | marvelm/rust-argparse,TimNN/rust-argparse,tailhook/rust-argparse,SamuelMarks/rust-argparse |
b11e64b8f31c124104a1104a30f1c152f6c88785 | src/combos.rs | src/combos.rs | use cards::Card;
// All these functions need reverse sorted vectors of Cards
pub fn has_pair(card_vec: &Vec<&Card>) -> bool {
let mut prev: &Card = card_vec[0];
for card in card_vec.iter().skip(1) {
if *card == prev {
return true;
}
prev = *card
}
return false;
}
| use cards::Card;
// All these functions need reverse sorted vectors of Cards
pub fn has_pair(card_vec: &Vec<&Card>) -> bool {
has_set(2, card_vec)
}
fn has_set(set_size: u8, card_vec: &Vec<&Card>) -> bool {
let mut prev: &Card = card_vec[0];
let mut count: u8 = 1;
for card in card_vec.iter().skip(1) {... | Make a general has_set function to make has_pair general | Make a general has_set function to make has_pair general
| Rust | mit | JelteF/pokers |
47fc24bd8f48032c259f3573b4836dffae048ea3 | src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs | src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs | // xfail-test FIXME #6257
// Copyright 2013 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 ... | // Copyright 2013 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 updated local declaration syntax. | Use updated local declaration syntax.
| Rust | apache-2.0 | pythonesque/rust,sae-bom/rust,nwin/rust,krzysz00/rust,dwillmer/rust,stepancheg/rust-ide-rust,pythonesque/rust,AerialX/rust,bombless/rust,rohitjoshi/rust,jashank/rust,servo/rust,miniupnp/rust,mitsuhiko/rust,rprichard/rust,AerialX/rust,Ryman/rust,GBGamer/rust,reem/rust,0x73/rust,defuz/rust,ruud-v-a/rust,nham/rust,cllns/r... |
21d02a285521f2dcf3ce2983898fb663c62366c5 | src/common.rs | src/common.rs | // 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 https://mozilla.org/MPL/2.0/.
pub const NB_CHAR: char = ' '; // non breaking space
pub const NB_CHAR_NARROW: char = '\u{202F}'; // narrow non brea... | // 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 https://mozilla.org/MPL/2.0/.
pub const NB_CHAR: char = ' '; // non breaking space
pub const NB_CHAR_NARROW: char = '\u{202F}'; // narrow non brea... | Remove is_whitespace function as no longer used | Remove is_whitespace function as no longer used
| Rust | mpl-2.0 | lise-henry/crowbook-text-processing |
edc8a714a4b5bb452f6deb2b00f5c397e039d231 | src/memory.rs | src/memory.rs | pub struct Memory {
addr:[u8; 0xffff]
}
impl Memory {
pub fn new() -> Memory {
Memory {
addr: [0; 0xffff]
}
}
pub fn store(&mut self, addr: usize, data: u8) -> Result<(), &'static str> {
if addr > 0xffff {
Err("memory address out of bounds")
} else {
self.addr[addr] = data;
... | pub struct Memory {
addr:[u8; 0xffff]
}
const ADDRESSABLE_MEMORY: usize = 0xFFFF;
impl Memory {
pub fn new() -> Memory {
Memory {
addr: [0; ADDRESSABLE_MEMORY]
}
}
pub fn store(&mut self, addr: usize, data: u8) -> Result<(), &'static str> {
if addr > ADDRESSABLE_MEMORY {
Err("memory a... | Use const instead of hardcoded value | Use const instead of hardcoded value
| Rust | mit | bgourlie/rs-nes,bgourlie/rs-nes,bgourlie/rs-nes |
947d4ddb90a334b40a00a7429e7ceb5587097436 | saddle-points/src/lib.rs | saddle-points/src/lib.rs | pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
let mut row_max = vec![Vec::new(); input.len()];
let mut col_min: Vec<Vec<(usize, u64)>> = vec![Vec::new(); input[0].len()];
for (row, values) in input.iter().enumerate() {
for (col, &value) in values.iter().enumerate() {
... | pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
let mut row_max = vec![None; input.len()];
let mut col_min = vec![(None, Vec::new()); input[0].len()];
for (row, values) in input.iter().enumerate() {
for (col, &value) in values.iter().enumerate() {
if row_max[row].... | Clean up solution for Saddle Points | Clean up solution for Saddle Points
| Rust | mit | attilahorvath/exercism-rust |
4b06b352ad0ef85e2a68634cc9ecae5e22d890a4 | 2019/src/d9.rs | 2019/src/d9.rs | extern crate adventofcode;
use adventofcode::d2::{Error, Parser, Program};
use std::io;
use std::io::BufRead;
fn program_for(inp: &str, v: Vec<i64>) -> Vec<i64> {
let mut p = Program::new(Parser::parse(&inp));
p.run(&mut v.into_iter())
.collect::<Result<Vec<_>, Error>>()
.unwrap()
}
fn main() ... | extern crate adventofcode;
use adventofcode::d2::{Error, Parser, Program};
use std::io;
use std::io::BufRead;
fn program_for(inp: &str, v: Vec<i64>) -> Vec<i64> {
let mut p = Program::new(Parser::parse(&inp));
p.run(&mut v.into_iter())
.collect::<Result<Vec<_>, Error>>()
.unwrap()
}
fn main() ... | Add part 2 of day 9 2019. | Add part 2 of day 9 2019.
Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
| Rust | mit | bk2204/adventofcode-work,bk2204/adventofcode-work |
3dbd26c18a786334a98bc81b0986bfdf2d485272 | src/pages.rs | src/pages.rs | use handlebars_iron::{Template, HandlebarsEngine};
use serde_json::builder::ObjectBuilder;
use serde_json::value::Value;
use iron::prelude::*;
use iron::status;
use router::Router;
use helpers::value_to_json;
use content;
pub fn make_simple_content(title: String, content: String) -> Value {
return ObjectBuilder::... | use handlebars_iron::{Template, HandlebarsEngine};
use serde_json::builder::ObjectBuilder;
use serde_json::value::Value;
use iron::prelude::*;
use iron::status;
use router::Router;
use helpers::value_to_json;
use content;
pub fn make_simple_content(title: String, content: String) -> Value {
return ObjectBuilder::... | Fix returning twice with something non-existant. | Fix returning twice with something non-existant.
| Rust | isc | Nightfall/MCMUCH-Rust-Website |
67509a4bf1acb3715fc12ee6f76b058b274e8c54 | src/render_pipeline_state.rs | src/render_pipeline_state.rs | use cocoa::base::id;
pub struct RenderPipelineState(id);
| use cocoa::base::id;
pub struct RenderPipelineState(id);
impl_from_into_raw!(RenderPipelineState, of protocol "MTLRenderPipelineState");
| Add from/into/as raw impls for RenderPipelineState | Add from/into/as raw impls for RenderPipelineState
| Rust | apache-2.0 | burtonageo/metl |
f6a766c2de73197a5db7ed2349f2133e5c4a0b0c | src/codegen/sys/mod.rs | src/codegen/sys/mod.rs | use codegen::generate_single_version_file;
use env::Env;
mod build;
mod cargo_toml;
pub mod ffi_type;
mod fields;
mod functions;
mod lib_;
mod statics;
mod tests;
pub fn generate(env: &Env) {
generate_single_version_file(env);
lib_::generate(env);
build::generate(env);
let crate_name = cargo_toml::gen... | use codegen::generate_single_version_file;
use env::Env;
mod build;
mod cargo_toml;
pub mod ffi_type;
mod fields;
mod functions;
mod lib_;
mod statics;
mod tests;
pub fn generate(env: &Env) {
generate_single_version_file(env);
lib_::generate(env);
build::generate(env);
let crate_name = cargo_toml::gen... | Fix invalid crate name generation | Fix invalid crate name generation
| Rust | mit | GuillaumeGomez/gir,GuillaumeGomez/gir,EPashkin/gir,gtk-rs/gir,gtk-rs/gir,gtk-rs/gir,EPashkin/gir,GuillaumeGomez/gir |
a03f6af6dd476a8ac19496a4c0d118e16249396e | examples/httpbin.rs | examples/httpbin.rs | #![feature(associated_consts)]
#![feature(use_extern_macros)]
#[macro_use]
extern crate tapioca;
infer_api!(httpbin, "https://raw.githubusercontent.com/OJFord/tapioca/master/tests/schemata/httpbin.yml");
use httpbin::basic_auth__user__hunter_2 as basic_auth;
use basic_auth::get::OpAuth::HttpBasic;
static USER: &str... | #![feature(associated_consts)]
#![feature(use_extern_macros)]
#[macro_use]
extern crate tapioca;
infer_api!(httpbin, "https://raw.githubusercontent.com/OJFord/tapioca/master/tests/schemata/httpbin.yml");
use httpbin::basic_auth__user__hunter_2 as basic_auth;
use basic_auth::get::OpAuth::HttpBasic;
static USER: &str... | Improve example as a demo | Improve example as a demo
| Rust | mit | OJFord/tapioca |
6afe4b94ced4e1e7353ef0ce043bf3c5253e7fbc | src/handler.rs | src/handler.rs | //!Request handlers.
use context::Context;
use response::Response;
use std::sync::Arc;
///A trait for request handlers.
pub trait Handler: Send + Sync + 'static {
///Handle a request from the client. Panicking within this method is
///discouraged, to allow the server to run smoothly.
fn handle_request(&se... | //!Request handlers.
use std::borrow::Cow;
use context::Context;
use response::Response;
use std::sync::Arc;
///A trait for request handlers.
pub trait Handler: Send + Sync + 'static {
///Handle a request from the client. Panicking within this method is
///discouraged, to allow the server to run smoothly.
... | Add a description method to Handler | Add a description method to Handler | Rust | mit | kvikas/rustful,kvikas/rustful |
2ac1b3d9b240b222fcf15fa11981dbfcf650fa8c | src/vspace/window.rs | src/vspace/window.rs | use core::intrinsics::transmute;
pub unsafe trait VSpaceWindow<'a> {
fn base(&self) -> usize;
fn size(&self) -> usize;
unsafe fn make<T>(&self) -> &'a T {
unimplemented!()
}
/* Passing in a window to describe the window you want to create
* is a little backwards, but it provides the ni... | use core::intrinsics::transmute;
use core::num::Wrapping;
pub unsafe trait VSpaceWindow<'a> {
fn base(&self) -> usize;
fn size(&self) -> usize;
unsafe fn make<T>(&self) -> &'a T {
unimplemented!()
}
/* Passing in a window to describe the window you want to create
* is a little backward... | Allow over/underflow to happen in vspace range checking | Allow over/underflow to happen in vspace range checking
| Rust | mit | AdrianDanis/R4,AdrianDanis/R4 |
cdf6323451751752c69ed41a8d48018dc2d7b7cf | src/heap_lazy.rs | src/heap_lazy.rs | // Copyright 2016 lazy-static.rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accor... | // Copyright 2016 lazy-static.rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accor... | Use associated constant to make Lazy's fields private. | Use associated constant to make Lazy's fields private.
This is to patch an obscure soundness hole.
With the fields public, it is possible to for a consumer crate to access and call the std::sync::Once without assigning the correct value to the pointer in the tuple's first field, making it possible to later deref a nu... | Rust | apache-2.0 | rust-lang-nursery/lazy-static.rs,Kimundi/lazy-static.rs |
c3f17ba82f8680f4219293466f8185d5f8c2e4a4 | src/context.rs | src/context.rs | use super::gl_lib as gl;
use super::buffer::{ArrayBufferBinder, ElementArrayBufferBinder};
pub struct Context {
pub array_buffer: ArrayBufferBinder,
pub element_array_buffer: ElementArrayBufferBinder
}
impl Context {
pub unsafe fn current_context() -> Self {
Context {
array_buffer: Arr... | use super::gl_lib as gl;
use super::buffer::{ArrayBufferBinder, ElementArrayBufferBinder};
use super::program::{ProgramBinder};
pub struct Context {
pub array_buffer: ArrayBufferBinder,
pub element_array_buffer: ElementArrayBufferBinder,
pub program: ProgramBinder
}
impl Context {
pub unsafe fn curren... | Add a `ProgramBinder` field to `Context` | Add a `ProgramBinder` field to `Context`
| Rust | apache-2.0 | kylewlacy/glitter,kylewlacy/glitter |
4fd200e94abd33a57ac820d29b84df86b6757803 | src/lib.rs | src/lib.rs | extern crate hyper;
extern crate json;
mod request;
mod response;
pub use request::Request;
pub use response::Response;
pub use response::Codes;
pub type Result = hyper::Result<Response>;
pub type Error = hyper::error::Error;
pub fn get(url: &str) -> Result {
Request::default().get(url)
}
pub fn post(url: &str... | //! requests - HTTP client library with simple API.\
//! If you have used Python requests module you will find the API familiar.
//!
//! # Quick Start
//!
//! ```rust
//! extern crate hyper;
//! extern crate requests;
//! let response = requests::get("http://httpbin.org/get").unwrap();
//! assert_eq!(response.url(), "h... | Add very basic crate doc | Add very basic crate doc
| Rust | mit | imp/requests-rs |
a13c747c7cbae78ac716f600df50a8a465776d57 | src/lib.rs | src/lib.rs | //! Implementation of the Micro Transport Protocol.[^spec]
//!
//! [^spec]: http://www.bittorrent.org/beps/bep_0029.html
// __________ ____ ____
// /_ __/ __ \/ __ \/ __ \
// / / / / / / / / / / / /
// / / / /_/ / /_/ / /_/ /
// /_/ \____/_____/\____/
//
// - Lossy UDP socket for testing purposes: send and r... | //! Implementation of the Micro Transport Protocol.[^spec]
//!
//! [^spec]: http://www.bittorrent.org/beps/bep_0029.html
// __________ ____ ____
// /_ __/ __ \/ __ \/ __ \
// / / / / / / / / / / / /
// / / / /_/ / /_/ / /_/ /
// /_/ \____/_____/\____/
//
// - Lossy UDP socket for testing purposes: send and r... | Remove compiler directives merged into the latest Rust. | Remove compiler directives merged into the latest Rust.
| Rust | apache-2.0 | benjaminbollen/rust-utp,dirvine/rust-utp |
e60c3d6fda5e2b9ac3ef179d4cb08f0a37a695b4 | src/lib.rs | src/lib.rs | //! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! // tests/test.rs
//!
//! #[test]
//! fn do_some_test() {
//! // Get a content of 'tests/fixtures/hello.obj'
//! let content: String = fixture("hello.obj");
//!
//! /* Do whatever you want with it */
//! }
//! ```
#![un... | //! A dead-simple test helper for rust.
//!
//! Example
//! --------
//!
//! ```rust
//! // tests/test.rs
//!
//! #[test]
//! fn do_some_test() {
//! // Get a content of 'tests/fixtures/hello.obj'
//! let content: String = fixture("hello.obj");
//!
//! /* Do whatever you want with it */
//! }
//! ```
#![un... | Add bear logo to docs | doc: Add bear logo to docs
| Rust | bsd-2-clause | simnalamburt/bear |
58f7391660e599ac9fea55a218ccaa91fa80b05f | src/macros.rs | src/macros.rs | // Copyright (c) 2017-2018 Rene van der Meer
//
// 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,... | // Copyright (c) 2017-2018 Rene van der Meer
//
// 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,... | Add macro to initialize arrays with non-Copy types | Add macro to initialize arrays with non-Copy types
| Rust | mit | golemparts/rppal |
d1195277fe201abf236ae89b0943a0e2a2f11f07 | src/lib.rs | src/lib.rs | mod error;
pub mod load;
pub mod memory;
pub mod cpu_stat;
use std::fs;
use std::io;
use std::io::Read;
use std::path::Path;
use std::result;
pub use error::ProbeError;
pub type Result<T> = result::Result<T, error::ProbeError>;
#[inline]
fn file_to_string(path: &Path) -> io::Result<String> {
let mut file = try!... | mod error;
pub mod load;
pub mod memory;
pub mod cpu_stat;
use std::fs;
use std::io;
use std::io::Read;
use std::path::Path;
use std::result;
pub use error::ProbeError;
pub type Result<T> = result::Result<T, error::ProbeError>;
#[inline]
fn file_to_string(path: &Path) -> io::Result<String> {
let mut file = try!... | Use functional style in file_to_buf_reader | Use functional style in file_to_buf_reader
| Rust | mit | appsignal/probes-rs |
b799710f51363e89291ba81e925c1c217036e1c1 | tests/src/legacy_sizing.rs | tests/src/legacy_sizing.rs | use cairo;
use librsvg::{rsvg_convert_only::LegacySize, CairoRenderer};
use crate::utils::load_svg;
#[test]
fn just_viewbox_uses_viewbox_size() {
let svg = load_svg(
br#"<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 200"/>
"#,
)
.unwrap();
... | use cairo;
use librsvg::{rsvg_convert_only::LegacySize, CairoRenderer};
use crate::utils::load_svg;
#[test]
fn just_viewbox_uses_viewbox_size() {
let svg = load_svg(
br#"<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 200"/>
"#,
)
.unwrap();
... | Test for no intrinsic size at all | Test for no intrinsic size at all
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/595>
| Rust | lgpl-2.1 | GNOME/librsvg,GNOME/librsvg,GNOME/librsvg,GNOME/librsvg |
bf6b23db8b5ce4868d7ac7303519fb8f51499707 | main.rs | main.rs | #[allow(ctypes)];
#[no_std];
#[no_core];
mod zero;
enum Color {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Pink = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
... | #[allow(ctypes)];
#[no_std];
#[no_core];
mod zero;
enum Color {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Pink = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
... | Update for new closure syntax | Update for new closure syntax
| Rust | apache-2.0 | ryanra/RustOS,RustOS-Fork-Holding-Ground/RustOS,YangFan789/fanmi-os,thesam/rOSt,thesam/rOSt,smkell/rustboot,tempbottle/rustboot,tempbottle/rustboot,charliesome/rustboot,smkell/rustboot,charliesome/rustboot |
6bb48f53f4899e3bb77d461533c869cd00e76468 | libimagstore/src/store.rs | libimagstore/src/store.rs | use std::result::Result as RResult;
use std::string;
pub use entry::Entry;
pub use error::StoreError;
pub type Result<T> = RResult<T, StoreError>;
pub type LockedEntry = SingleUseLock<Entry>;
pub trait Store {
fn create(&self, entry : Entry) -> Result<()>;
fn retrieve(&self, id : string) -> Result<LockedEntr... | use std::result::Result as RResult;
use std::string;
pub use entry::Entry;
pub use error::StoreError;
pub use single_use_lock::SingleUseLock;
pub type Result<T> = RResult<T, StoreError>;
pub type LockedEntry = SingleUseLock<Entry>;
pub trait Store {
fn create(&self, entry : Entry) -> Result<()>;
fn retrieve(... | Add missing inclusion of SingeUseLock type | Add missing inclusion of SingeUseLock type
| Rust | lgpl-2.1 | matthiasbeyer/imag,mario-kr/imag,matthiasbeyer/imag,mario-kr/imag |
b686b9e02f81bda3e382e0586cb6594520dad208 | build.rs | build.rs | #![deny(warnings)]
extern crate cmake;
use std::env;
fn main() {
let dst = cmake::Config::new("src").build();
println!("cargo:rustc-link-search=native={}/lib\n\
cargo:rustc-link-lib=static=brotli\n\
cargo:rustc-link-lib=static=woff2\n\
cargo:rustc-link-lib=static=ot... | #![deny(warnings)]
extern crate cmake;
use std::env;
fn main() {
let dst = cmake::Config::new("src").build();
println!("cargo:rustc-link-search=native={}/lib\n\
cargo:rustc-link-lib=static=brotli\n\
cargo:rustc-link-lib=static=woff2\n\
cargo:rustc-link-lib=static=ot... | Switch to libc++ on OS X | Switch to libc++ on OS X
| Rust | bsd-3-clause | servo/fontsan,servo/fontsan,servo/fontsan |
bca1dfc7088f85a8dfdeb87243b3fe221f7b6577 | libra_node/src/main.rs | libra_node/src/main.rs | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use executable_helpers::helpers::{
setup_executable, ARG_CONFIG_PATH, ARG_DISABLE_LOGGING, ARG_PEER_ID,
};
use signal_hook;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
fn register_signals(term: Arc<AtomicBool>... | // Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use executable_helpers::helpers::{
setup_executable, ARG_CONFIG_PATH, ARG_DISABLE_LOGGING, ARG_PEER_ID,
};
use signal_hook;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
fn register_signals(term: Arc<AtomicBool>... | Fix ordering argument for term | [LibraNode] Fix ordering argument for term
Use acquire/release instead of relaxed.
| Rust | apache-2.0 | aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,libra/libra,libra/libra,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core |
8b611b0e742db771059573eb3acafc6ff6ffb384 | blog/src/lib.rs | blog/src/lib.rs | pub struct Post {
state: Option<Box<State>>,
content: String
}
impl Post {
pub fn new() -> Post {
Post {
state: Some(Box::new(Draft {})),
content: String::new()
}
}
pub fn add_text(&mut self, text: &str) {
self.content.push_str(text);
}
}
trait ... | pub struct Post {
state: Option<Box<State>>,
content: String
}
impl Post {
pub fn new() -> Post {
Post {
state: Some(Box::new(Draft {})),
content: String::new()
}
}
pub fn add_text(&mut self, text: &str) {
self.content.push_str(text);
}
pub ... | Add content method for Draft | Add content method for Draft
| Rust | mit | pgrzesik/learning-rust |
fca2a7b7bdd1d3159b1c654655514aac53a8c6d4 | src/empty_state_machine.rs | src/empty_state_machine.rs | //
// Copyright 2016 Andrew Hunter
//
// 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... | //
// Copyright 2016 Andrew Hunter
//
// 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... | Implement Clone for the empty state machine | Implement Clone for the empty state machine
| Rust | apache-2.0 | Logicalshift/concordance |
a56508ee7822ad6fd474d96010fefb9200200c8a | src/stdout_writer.rs | src/stdout_writer.rs |
use std::io;
use std::io::{Write};
const ERR_ENCODED_DATA_NOT_UTF8 : &'static str = r#"ERROR: Encoded data isn't printable.
The encoded data couldn't be encoded to valid utf8 and so couldn't be printed to the screen.
Use the "-o" option to write the output directly to a file instead."#;
pub struct StdoutWriter;
i... |
use std::io;
use std::io::{Write};
const ERR_ENCODED_DATA_NOT_UTF8 : &'static str = r#"ERROR: Encoded data isn't printable.
The encoded data couldn't be encoded to valid utf8 and so couldn't be printed to the screen.
Use the "-o" option to write the output directly to a file instead."#;
pub struct StdoutWriter;
i... | Fix issue with extra newline being appended to input read from stdin | Fix issue with extra newline being appended to input read from stdin
| Rust | mit | gavynriebau/xor |
6f2e50caea91426f4baac282905a3ba5d64adcbd | test/arrays.rs | test/arrays.rs | #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run]
fn empty_array() -> [u16; 0] {
[]
}
#[miri_run]
fn big_array() -> [u16; 5] {
[5, 4, 3, 2, 1]
}
#[miri_run]
fn array_array() -> [[u8; 2]; 3] {
[[5, 4], [3, 2], [1, 0]]
}
#[miri_run]
fn index_unsafe() -> i32 {
let a = [0... | #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run]
fn empty_array() -> [u16; 0] {
[]
}
#[miri_run]
fn big_array() -> [u16; 5] {
[5, 4, 3, 2, 1]
}
#[miri_run]
fn array_array() -> [[u8; 2]; 3] {
[[5, 4], [3, 2], [1, 0]]
}
#[miri_run]
fn index_unsafe() -> i32 {
let a = [0... | Add slice iterator for-loop test. | Add slice iterator for-loop test.
| Rust | apache-2.0 | graydon/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,tsion/miri,rust-lang/miri,rust-lang/miri,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,rust-lang/miri,aidancully/rust,ru... |
6a3a8a9e1d7f4a0ed44cd91609bea9465917ebe2 | src/component/component.rs | src/component/component.rs | use std::rc::*;
use std::ops::*;
use super::super::tree::*;
pub type PublisherRef = Box<Publisher>;
pub type ConsumerRef = Box<Consumer>;
///
/// A publisher reports changes to a tree
///
pub trait Publisher {
///
/// Publishes a change to the consumers of this component
///
fn publish(&mut self, cha... | use std::rc::*;
use std::ops::*;
use super::super::tree::*;
pub type PublisherRef = Box<Publisher>;
pub type ConsumerRef = Box<Consumer>;
///
/// A publisher reports changes to a tree
///
pub trait Publisher {
///
/// Publishes a change to the consumers of this component
///
fn publish(&mut self, cha... | Put the consumer callback function into a type - box it so it can be moved around without cloning | Put the consumer callback function into a type - box it so it can be moved around without cloning
| Rust | apache-2.0 | Logicalshift/tame-tree |
93f04acb8ac87e54e5f12babfaf9c6b8bc3a3c92 | tests/list_parser_tests.rs | tests/list_parser_tests.rs | extern crate robin_core;
#[macro_use]
extern crate pest;
#[cfg(test)]
mod parser_tests {
use robin_core::parser::{ExpressionParser, Rule};
#[test]
fn parse_an_empty_list() {
parses_to!(
parser: ExpressionParser,
input: "()",
rule: Rule::list_literal,
... | extern crate robin_core;
#[macro_use]
extern crate pest;
#[cfg(test)]
mod parser_tests {
use robin_core::parser::{ExpressionParser, Rule};
#[test]
fn parse_an_empty_list() {
parses_to!(
parser: ExpressionParser,
input: "()",
rule: Rule::list_literal,
... | Add new tests for symbol lists | Add new tests for symbol lists
| Rust | apache-2.0 | Willifme/robin_core,Willifme/robin_core,Willifme/robin_core |
8852be91539bf92e27ad13b2b3d3cb79a3d72f67 | proto/simplepattern_test.rs | proto/simplepattern_test.rs | use simplepattern;
use simplepattern::SimplePattern;
#[test]
fn root_url_matches_only_root() {
let p=SimplePattern::new("/");
assert!(p.matches("/").is_match);
assert!(!p.matches("/foo").is_match);
assert!(!p.matches("/foo/bar").is_match);
}
#[test]
fn raw_routes_match_urls() {
let p=SimplePatte... | use simplepattern;
use simplepattern::SimplePattern;
#[test]
fn root_url_matches_only_root() {
let p=SimplePattern::new("/");
assert!(p.matches("/").is_match);
assert!(!p.matches("/foo").is_match);
assert!(!p.matches("/foo/bar").is_match);
}
#[test]
fn raw_routes_match_urls() {
let p=SimplePatte... | Add test for route parameters | Add test for route parameters
| Rust | bsd-3-clause | Earlz/rustymvc,tempbottle/rustymvc |
2c8f71bda431e6eb80366798ced49c7a38883725 | tests/test_backtrace.rs | tests/test_backtrace.rs | // FIXME: needs to be updated to provide_ref/request_ref API.
// https://github.com/rust-lang/rust/pull/99431
#![cfg(any())]
#[rustversion::not(nightly)]
#[ignore]
#[test]
fn test_backtrace() {}
#[rustversion::nightly]
#[test]
fn test_backtrace() {
use anyhow::anyhow;
let error = anyhow!("oh no!");
let _... | #[rustversion::not(nightly)]
#[ignore]
#[test]
fn test_backtrace() {}
#[rustversion::nightly]
#[test]
fn test_backtrace() {
use anyhow::anyhow;
let error = anyhow!("oh no!");
let _ = error.backtrace();
}
| Revert "Disable backtrace test until converted to provider API" | Revert "Disable backtrace test until converted to provider API"
This reverts commit e55761e27b05de6d5f9dc583285d26cf77831fba.
| Rust | apache-2.0 | dtolnay/anyhow |
e94b2e79fe63f1fd182d8dc9c860a1d6158828a6 | rust/strprintf/src/lib.rs | rust/strprintf/src/lib.rs | #[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
| macro_rules! fmt {
( $format:expr ) => {
$format
};
}
#[cfg(test)]
mod tests {
#[test]
fn returns_first_argument_if_it_is_the_only_one() {
let input = "Hello, world!";
assert_eq!(fmt!(input), input);
}
}
| Make Rust strprintf::fmt work for one argument | Make Rust strprintf::fmt work for one argument
| Rust | mit | newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,newsboat/newsboat,newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat,newsboat/newsboat,der-lyse/newsboat |
ae77936224fa814e9a438838d4c7a7ca548553a5 | src/main.rs | src/main.rs | use std::env;
use std::process;
extern crate fish;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() < 2 {
println!("Usage: {} <fish script>\n", args[0]);
process::exit(1);
}
// let codebox = fish::CodeBox::load_from_string("2*n;");
let codebox = match fish::Cod... | use std::env;
use std::process;
extern crate fish;
fn main() {
let args: Vec<_> = env::args().collect();
if args.len() < 2 {
println!("Usage: {} <fish script>\n", args[0]);
process::exit(1);
}
// let codebox = fish::CodeBox::load_from_string("2*n;");
let codebox = match fish::Cod... | Print final line feed when exiting normally | Print final line feed when exiting normally
| Rust | mit | noirotm/fishr,noirotm/fishr |
2f5df69a39e52380cb52590f54a0a2e89af65aa9 | src/mainpage_generator.rs | src/mainpage_generator.rs | use horrorshow::prelude::*;
use scripts::Script;
pub struct MainPageHtml {
pub html_string: String,
}
impl MainPageHtml {
pub fn new(scripts: Vec<Box<Script>>) -> MainPageHtml {
MainPageHtml {
html_string: html! {
: raw!("<!DOCTYPE html>");
html {
... | use horrorshow::prelude::*;
use scripts::Script;
pub struct MainPageHtml {
pub html_string: String,
}
impl MainPageHtml {
pub fn new(scripts: Vec<Box<Script>>) -> MainPageHtml {
MainPageHtml {
html_string: html! {
: raw!("<!DOCTYPE html>");
html {
... | Make generated mainpage a little more mobile-friendly | Make generated mainpage a little more mobile-friendly
| Rust | mit | pingzing/articulator |
d3b584fd7cc9436b4e4858d84f4519a97147defc | tests/lsb_release_test.rs | tests/lsb_release_test.rs | extern crate regex;
#[path="../src/lsb_release.rs"]
mod lsb_release;
#[path="../src/utils.rs"]
mod utils;
fn file() -> String {
"
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy
".to_string()
}
fn arch_file() -> String {
"
LSB Version: 1.4
Distributor ID: Arch
Descripti... | extern crate regex;
#[path="../src/lsb_release.rs"]
mod lsb_release;
#[path="../src/utils.rs"]
mod utils;
fn file() -> String {
"
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy
".to_string()
}
fn arch_file() -> String {
"
LSB Version: 1.4
Distributor ID: Arch
Descripti... | Test that rolling release is recognized correctly | test: Test that rolling release is recognized correctly
| Rust | mit | schultyy/os_type |
27857a2ae6a36f96c5aba5383c93daeb38796e09 | lucet-idl/tests/example.rs | lucet-idl/tests/example.rs | use lucet_idl;
use std::fs::File;
use std::io::prelude::*;
use std::process::Command;
use tempfile::TempDir;
#[test]
fn compile_and_run() {
let mut source = String::new();
File::open("tests/example.idl")
.expect("open example.idl")
.read_to_string(&mut source)
.expect("read example.idl"... | use lucet_idl;
use std::fs::File;
use std::io::prelude::*;
use std::process::Command;
use tempfile::TempDir;
#[test]
fn compile_and_run() {
let mut source = String::new();
File::open("tests/example.idl")
.expect("open example.idl")
.read_to_string(&mut source)
.expect("read example.idl"... | Revert "lucet-idl: disable last part of test" | Revert "lucet-idl: disable last part of test"
This reverts commit a6c987ce9d85ecf95ded474977b427888c52288d.
| Rust | apache-2.0 | fastly/lucet,fastly/lucet,fastly/lucet,fastly/lucet,fastly/lucet |
99f3e623960c43ad203a6f85cad63bcc2df2e78e | alga/src/lib.rs | alga/src/lib.rs | // Copyright 2013-2014 The Algebra Developers.
//
// 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... | // Copyright 2013-2014 The Algebra Developers.
//
// 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... | Add macro_use for the decimal crate. | Add macro_use for the decimal crate.
| Rust | apache-2.0 | sebcrozet/alga,sebcrozet/alga |
0a5de3459b74fb698f2294a979f7a0fef9e66b6b | futures/tests/inspect.rs | futures/tests/inspect.rs | #![feature(pin, arbitrary_self_types, futures_api)]
#[macro_use]
extern crate futures;
use futures::executor::block_on;
use futures::future;
use futures::prelude::*;
#[test]
fn smoke() {
let mut counter = 0;
{
let work = future::ready::<i32>(40).inspect(|val| { counter += *val; });
assert_eq... | #![feature(pin, arbitrary_self_types, futures_api)]
use futures::executor::block_on;
use futures::future;
use futures::prelude::*;
#[test]
fn smoke() {
let mut counter = 0;
{
let work = future::ready::<i32>(40).inspect(|val| { counter += *val; });
assert_eq!(block_on(work), 40);
}
as... | Remove unused macro use warning | Remove unused macro use warning
| Rust | apache-2.0 | alexcrichton/futures-rs |
c15bd76f70be575cb4922be6d7b10348d9123ec3 | mockall_examples/src/lib.rs | mockall_examples/src/lib.rs | // vim: tw=80
//#![deny(missing_docs)]
//! Examples of mock objects and their generated methods.
//!
//! This crate only exists to document the autogenerated methods of the
//! [`Mockall`](https://docs.rs/mockall/latest/mockall)
//! crate. You should never depend on this crate.
//
#[cfg(doc)]
use mockall::*;
/// A ... | // vim: tw=80
#![deny(missing_docs)]
//! Examples of mock objects and their generated methods.
//!
//! This crate only exists to document the autogenerated methods of the
//! [`Mockall`](https://docs.rs/mockall/latest/mockall)
//! crate. You should never depend on this crate.
//
#[cfg(doc)]
use mockall::*;
/// A ba... | Add a use of mock! in mockall_examples | Add a use of mock! in mockall_examples
| Rust | apache-2.0 | asomers/mockall,asomers/mockall |
f5612767660bde68cb52ea840c91ab43c41f8f1d | src/lib.rs | src/lib.rs | /*
* Cymbalum, Molecular Simulation in Rust
* Copyright (C) 2015 Guillaume Fraux
*
* 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/
*/
//! **cymbalum** is a molecul... | /*
* Cymbalum, Molecular Simulation in Rust
* Copyright (C) 2015 Guillaume Fraux
*
* 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/
*/
//! **cymbalum** is a molecul... | Add a bunch of warning lints | Add a bunch of warning lints
| Rust | bsd-2-clause | Luthaf/cymbalum,g-bauer/lumol,g-bauer/lumol,Luthaf/cymbalum,antoinewdg/lumol,g-bauer/lumol,antoinewdg/lumol,antoinewdg/lumol |
210e755ac88edf24c103c9e0c4fe232728ba772e | src/peg/main.rs | src/peg/main.rs | #[feature(globs)];
#[feature(managed_boxes)];
use std::str;
use std::io::stdout;
use std::io::fs::File;
use std::os;
use peg::{compile_grammar};
use codegen::RustWriter;
mod peg;
mod codegen;
mod grammar;
fn main() {
let args = os::args();
let source_utf8 = File::open(&Path::new(args[1])).read_to_end();
let sourc... | #[feature(globs)];
#[feature(managed_boxes)];
use std::str;
use std::io::{stdout,stderr};
use std::io::fs::File;
use std::os;
use peg::{compile_grammar};
use codegen::RustWriter;
mod peg;
mod codegen;
mod grammar;
fn main() {
let args = os::args();
let source_utf8 = File::open(&Path::new(args[1])).read_to_end();
... | Print error message on parse failure. | Print error message on parse failure.
| Rust | mit | jsgf/rust-peg,daramos/rust-peg,tempbottle/rust-peg,loganmhb/rust-peg,a-wortman/rust-peg,tempbottle/rust-peg,kevinmehall/rust-peg,daramos/rust-peg,kevinmehall/rust-peg,loganmhb/rust-peg,a-wortman/rust-peg,jsgf/rust-peg |
efe3527551ab2bd2fec6b27422b96c89953f6d45 | src/io/operations/mod.rs | src/io/operations/mod.rs | //! I/O operations for Rust
//!
//! To be completed
pub mod reader;
pub mod writer;
| //! I/O operations for Rust
//!
//! To be completed
pub mod reader;
pub mod writer;
#[cfg(test)]
mod test {
use super::reader::Reader;
use super::writer::Writer;
use std::io::Cursor;
impl Writer for Cursor<Vec<u8>> {
}
impl Reader for Cursor<Vec<u8>> {
}
#[test]
fn test_rea... | Test reading and writing signed and unsigned bytes on a Cursor<Vec<u8>> | Test reading and writing signed and unsigned bytes on a Cursor<Vec<u8>>
| Rust | apache-2.0 | Techern/Netherrack |
354f4961704c23eb5ac711254e20fa3a7a4fd38a | src/classifier.rs | src/classifier.rs | use std::collections::HashMap;
use model::Model;
pub struct Classifier {
models: HashMap<String, Model>
}
impl Classifier {
pub fn new() -> Classifier {
Classifier { models: HashMap::new() }
}
pub fn train(&mut self, text: &str, name: &str) {
let model = Model::build_from_text(text... | use std::collections::HashMap;
use model::Model;
pub struct Classifier {
models: HashMap<String, Model>
}
impl Classifier {
pub fn new() -> Classifier {
Classifier { models: HashMap::new() }
}
pub fn train(&mut self, text: &str, name: &str) {
let model = Model::build_from_text(text... | Use the standard min_by_key method | Use the standard min_by_key method
…instead of custom, shitty implementation
| Rust | apache-2.0 | despawnerer/langid-rs |
c457b32bf4f234b40bd6714db8e5cdb792167e32 | src/templates.rs | src/templates.rs | macro_rules! toml_template {
($name: expr) => {
format_args!(
r##"
[package]
name = "{0}-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies.{0}]
path = ".."
[dependencies.libfuzzer-sys]
git = "https:... | macro_rules! toml_template {
($name: expr) => {
format_args!(
r##"
[package]
name = "{0}-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.2"
[dependencies.{0}]
path = ".."
# P... | Use the published version of libfuzzer-sys, not git | Use the published version of libfuzzer-sys, not git
| Rust | apache-2.0 | rust-fuzz/cargo-fuzz |
059a142e016393baf3f5a0b807ae61d0cd999491 | src/metrics/mod.rs | src/metrics/mod.rs | // 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Metrics
use st... | // 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 http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Metrics
use st... | Remove unsafe impl Send+Sync on Metric. | Remove unsafe impl Send+Sync on Metric.
| Rust | apache-2.0 | chridou/rust-metrics,cstorey/rust-metrics,waywardmonkeys/rust-metrics,chridou/rust-metrics,cstorey/rust-metrics,waywardmonkeys/rust-metrics |
e6235da7f5d9c2056a3b572587f2af5fcdb48100 | benches/terminator.rs | benches/terminator.rs | use criterion::*;
use ion_shell::parser::Terminator;
use std::time::Duration;
const TEXT: &str = include_str!("test.ion");
const EOF: &str = include_str!("herestring.ion");
fn criterion_benchmark(c: &mut Criterion) {
c.bench(
"terminator-throughput",
ParameterizedBenchmark::new(
"termi... | use criterion::*;
use ion_shell::parser::Terminator;
use std::time::Duration;
const TEXT: &str = include_str!("test.ion");
const EOF: &str = include_str!("herestring.ion");
fn criterion_benchmark(c: &mut Criterion) {
c.bench(
"terminator-throughput",
ParameterizedBenchmark::new(
"termi... | Reduce time taken by benchmark | Reduce time taken by benchmark
| Rust | mit | redox-os/ion,redox-os/ion,redox-os/ion |
c841593a679fa7bf9b70a52157e8c39c8d7a3262 | crates/css-engine/src/lib.rs | crates/css-engine/src/lib.rs |
pub use selector::*;
pub use theme::*;
pub mod prelude;
mod selector;
mod theme;
| /*!
This crate provides functions to load a css files as theme and access it properties with
selectors.
This crate depends on the orbtk_utils crate.
# Example
Basic usage of the tree:
```rust,no_run
use orbtk_css_engine::prelude::*;
let mut theme = Theme::create_from_path("theme.css").build();
let selector = Se... | Add description to theme crate. | Add description to theme crate.
| Rust | mit | redox-os/orbtk |
e5fe78a27412da808d387713782868930ab158e0 | src/demux/mod.rs | src/demux/mod.rs | // Copyright 2015 Ilkka Rauta
//
// 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 ... | // Copyright 2015 Ilkka Rauta
//
// 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 ... | Add skeleton version of demux device. | Add skeleton version of demux device.
| Rust | apache-2.0 | irauta/linuxdvb,irauta/linuxdvb |
4558c9d062e28ce114317b953a7f1256a8867441 | src/net/eth/callbacks.rs | src/net/eth/callbacks.rs | //! Useful callbacks used by ethernet's specific filter
| //! Useful callbacks used by ethernet's specific filter
use boxed::Box;
use net::Packet;
use net::defs::{Rule, EthernetRule, EtherType, ETHERTYPE_IPV4, ETHERTYPE_IPV6};
use net::conn::filter::{SpecificCallbacks, GenericFilterTrait};
use net::ipv4::Ipv4GenericFilter;
use super::defs::Header;
/// Defines specific ... | Add definition of type EthernetCallbacks | net/eth: Add definition of type EthernetCallbacks
| Rust | mit | uni-rs/uni.rs |
c0d4ab69d66ee3d68565681709b53b87a815ba0f | src/config.rs | src/config.rs | #[derive(Deserialize)]
pub struct Config {
hostname: String,
username: String,
password: String,
} | #[derive(Deserialize)]
pub struct Config {
pub hostname: String,
pub username: String,
pub password: String,
}
impl Config {
pub fn hostname(&self) -> &String {
&self.hostname
}
pub fn username(&self) -> &String {
&self.username
}
pub fn password(&self) -> &String {
... | Change property scope to public | :art: Change property scope to public
| Rust | mit | dorayakikun/alfred_jira_workflow |
55e37f9f02af4eec5c52413e3219bef838beadab | src/libcore/num/int_macros.rs | src/libcore/num/int_macros.rs | #![doc(hidden)]
macro_rules! doc_comment {
($x:expr, $($tt:tt)*) => {
#[doc = $x]
$($tt)*
};
}
macro_rules! int_module {
($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
($T:ident, #[$attr:meta]) => (
doc_comment! {
concat!("The small... | #![doc(hidden)]
macro_rules! doc_comment {
($x:expr, $($tt:tt)*) => {
#[doc = $x]
$($tt)*
};
}
macro_rules! int_module {
($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]););
($T:ident, #[$attr:meta]) => (
doc_comment! {
concat!("The small... | Add examples to int macros | Add examples to int macros
| Rust | apache-2.0 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust |
ec6fccd34c30003a7ebf4e7a9dfe4e31f5b76e1b | crates/core_arch/src/mips/mod.rs | crates/core_arch/src/mips/mod.rs | //! MIPS
// Building this module (even if unused) for non-fp64 targets such as the Sony
// PSP fails with an LLVM error. There doesn't seem to be a good way to detect
// fp64 support as it is sometimes implied by the target cpu, so
// `#[cfg(target_feature = "fp64")]` will unfortunately not work. This is a
// fairly c... | //! MIPS
// Building this module (even if unused) for non-fp64 targets fails with an LLVM
// error.
#[cfg(target_feature = "fp64")]
mod msa;
#[cfg(target_feature = "fp64")]
pub use self::msa::*;
#[cfg(test)]
use stdarch_test::assert_instr;
/// Generates the trap instruction `BREAK`
#[cfg_attr(test, assert_instr(brea... | Use fp64 detection instead of OS blacklist | Use fp64 detection instead of OS blacklist
| Rust | apache-2.0 | rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch,rust-lang/stdarch |
676bb463840c9d5bef87cdd7fe99528d23ec603d | src/vector.rs | src/vector.rs | //! Less used details of `CxxVector` are exposed in this module. `CxxVector`
//! itself is exposed at the crate root.
pub use crate::cxx_vector::{Iter, IterMut};
#[doc(no_inline)]
pub use crate::CxxVector;
#[doc(inline)]
pub use crate::Vector;
| //! Less used details of `CxxVector` are exposed in this module. `CxxVector`
//! itself is exposed at the crate root.
pub use crate::cxx_vector::{Iter, IterMut};
#[doc(inline)]
pub use crate::Vector;
#[doc(no_inline)]
pub use cxx::CxxVector;
| Make rustdoc Re-exports section show external-facing type name | Make rustdoc Re-exports section show external-facing type name
| Rust | apache-2.0 | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx |
6edd2d2a5968dbea1e4c11c725ee4ec2ecff95a0 | syntax/improper.rs | syntax/improper.rs | use self::ImproperCtype::*;
use crate::syntax::atom::Atom::{self, *};
use crate::syntax::{Type, Types};
use proc_macro2::Ident;
pub enum ImproperCtype<'a> {
Definite(bool),
Depends(&'a Ident),
}
impl<'a> Types<'a> {
// yes, no, maybe
pub fn determine_improper_ctype(&self, ty: &Type) -> ImproperCtype<'... | use self::ImproperCtype::*;
use crate::syntax::atom::Atom::{self, *};
use crate::syntax::{Type, Types};
use proc_macro2::Ident;
pub enum ImproperCtype<'a> {
Definite(bool),
Depends(&'a Ident),
}
impl<'a> Types<'a> {
// yes, no, maybe
pub fn determine_improper_ctype(&self, ty: &Type) -> ImproperCtype<'... | Add a void ptr cast for extern type aliases containing Rust-native types | Add a void ptr cast for extern type aliases containing Rust-native types
| Rust | apache-2.0 | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx |
c10d5935a29ce47e34cb6369e228edc3834733cc | 27_message_passing/src/main.rs | 27_message_passing/src/main.rs | use std::thread;
use std::sync::mpsc;
use std::time::Duration;
fn main() {
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let vals = vec![
String::from("Hello there"),
String::from("Hello there 2"),
String::from("Hello there 3"),
String::from("H... | use std::thread;
use std::sync::mpsc;
use std::time::Duration;
fn main() {
let (tx, rx) = mpsc::channel();
let cloned_tx = tx.clone();
thread::spawn(move || {
let vals = vec![
String::from("Hello there"),
String::from("Hello there 2"),
String::from("Hello there... | Add second thread sending messages | Add second thread sending messages
| Rust | mit | pgrzesik/learning-rust |
3f0eac2c7848a95e84f965e1225e2110da7ae0fa | test/basic.rs | test/basic.rs | #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run(expected = "Int(1)")]
fn ret() -> i32 {
1
}
#[miri_run(expected = "Int(-1)")]
fn neg() -> i32 {
-1
}
#[miri_run(expected = "Int(3)")]
fn add() -> i32 {
1 + 2
}
#[miri_run(expected = "Int(3)")]
fn indirect_add() -> i32 {
... | #![feature(custom_attribute)]
#![allow(dead_code, unused_attributes)]
#[miri_run(expected = "Int(1)")]
fn ret() -> i32 {
1
}
#[miri_run(expected = "Int(-1)")]
fn neg() -> i32 {
-1
}
#[miri_run(expected = "Int(3)")]
fn add() -> i32 {
1 + 2
}
#[miri_run(expected = "Int(3)")]
fn indirect_add() -> i32 {
... | Add a more complicated arithmetic test. | Add a more complicated arithmetic test.
| Rust | apache-2.0 | graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,rust-lang/miri,GBGamer/rust,tsion/miri,graydon/rust,aidancully/rust,rust-lang/miri,rust-lang/miri,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,rust-lang/miri,aidancully/rust,GBGamer/ru... |
00792493ef65da150ce5d3e4cc7c15660ce1b54a | tests/run-pass/file_manipulation.rs | tests/run-pass/file_manipulation.rs | // ignore-windows: File handling is not implemented yet
// compile-flags: -Zmiri-disable-isolation
use std::fs::{File, remove_file};
use std::io::{Read, Write};
fn main() {
let path = "./tests/hello.txt";
let bytes = b"Hello, World!\n";
// Test creating, writing and closing a file (closing is tested when ... | // ignore-windows: File handling is not implemented yet
// compile-flags: -Zmiri-disable-isolation
use std::fs::{File, remove_file};
use std::io::{Read, Write};
fn main() {
let path = "./tests/hello.txt";
let bytes = b"Hello, World!\n";
// Test creating, writing and closing a file (closing is tested when ... | Add tests for non-existing files | Add tests for non-existing files
| Rust | apache-2.0 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri,tsion/miri |
020f1b3f160a1facf54355278af14cbf6a1613fd | src/lib.rs | src/lib.rs | #![crate_type = "lib"]
#![warn(missing_docs)]
//! Synchronization primitives based on spinning
#![cfg_attr(feature = "asm", feature(asm))]
#![cfg_attr(feature = "core_intrinsics", feature(core_intrinsics))]
#![cfg_attr(feature = "const_fn", feature(const_fn))]
#![no_std]
#[cfg(test)]
#[macro_use]
extern crate std;
... | #![crate_type = "lib"]
#![warn(missing_docs)]
//! Synchronization primitives based on spinning
#![cfg_attr(feature = "asm", feature(asm))]
#![cfg_attr(feature = "core_intrinsics", feature(core_intrinsics))]
#![cfg_attr(feature = "const_fn", feature(const_fn, const_unsafe_cell_new, const_atomic_usize_new))]
#![no_std... | Fix build on rustc nightly-2017-09-16 | Fix build on rustc nightly-2017-09-16
| Rust | mit | mvdnes/spinlock-rs,mvdnes/spin-rs |
3720514ab70a219152ebc7297f2462b47cdb07c8 | examples/str/str.rs | examples/str/str.rs | #![feature(collections)]
#![feature(core)]
fn main() {
// (all the type annotations are superfluous)
// A reference to a string allocated in read only memory
let pangram: &'static str = "the quick brown fox jumps over the lazy dog";
println!("Pangram: {}", pangram);
// Iterate over words in revers... | #![feature(collections)]
#![feature(core)]
#![feature(str_words)]
fn main() {
// (all the type annotations are superfluous)
// A reference to a string allocated in read only memory
let pangram: &'static str = "the quick brown fox jumps over the lazy dog";
println!("Pangram: {}", pangram);
// Itera... | Add in new feature gate | Add in new feature gate
| Rust | apache-2.0 | sohan99/rust-by-example,narutosanjiv/rust-by-example,zhjh1209/rust-by-example,MatejLach/rust-by-example,narutosanjiv/rust-by-example,youprofit/rust-by-example,nodakai/rust-by-example,rwaldron/rust-by-example,realcr/rust-by-example,rwaldron/rust-by-example,shaleh/rust-by-example,jinyuanxie/rust-by-example-cn,chriskrycho... |
bc8d5157345afb9be37c2e56ec8e284f8dab48ce | benches/strings.rs | benches/strings.rs | #![feature(test)]
extern crate indolentjson;
extern crate test;
use indolentjson::strings::*;
use test::Bencher;
#[bench]
fn noop_escape(b: &mut Bencher) {
b.iter(|| {
escape_bytes(b"test")
});
}
#[bench]
fn escape_controls(b: &mut Bencher) {
b.iter(|| {
escape_bytes(b"\t\n\r\\")
})... | #![feature(test)]
extern crate indolentjson;
extern crate test;
use indolentjson::strings::*;
use test::{black_box, Bencher};
#[bench]
fn noop_escape(b: &mut Bencher) {
let test_string = black_box(b"test");
b.bytes = test_string.len() as u64;
b.iter(|| { escape_bytes(test_string) });
}
#[bench]
fn esc... | Add a couple more benchmarks, add bytes count so that we get more meaningless numbers | Add a couple more benchmarks, add bytes count so that we get more meaningless numbers
| Rust | apache-2.0 | NegativeMjark/indolentjson-rust |
f9b8e90c08e190f25fdfa97b6c8131dd2d1805a6 | src/crypto/mod.rs | src/crypto/mod.rs | pub mod der;
pub mod rsa;
/// Helper function to encrypt mysql password using a public key loaded from a server.
pub fn encrypt(pass: &[u8], key: &[u8]) -> Vec<u8> {
let pub_key = self::rsa::PublicKey::from_pem(key);
let rng = ::rand::OsRng::new().unwrap();
let pad = self::rsa::Pkcs1OaepPadding::new(rng);
... | pub mod der;
pub mod rsa;
/// Helper function to encrypt mysql password using a public key loaded from a server.
///
/// It will use OAEP padding, so MySql versions prior to 8.0.5 are not supported.
pub fn encrypt(pass: &[u8], key: &[u8]) -> Vec<u8> {
let pub_key = self::rsa::PublicKey::from_pem(key);
let rng ... | Clarify MySql versions, supported by crypto::encrypt function | Clarify MySql versions, supported by crypto::encrypt function
| Rust | apache-2.0 | blackbeam/rust_mysql_common,blackbeam/rust_mysql_common |
c5cb73710af9a949f9878b503188e9648d6d858e | src/lints/function_arg_count.rs | src/lints/function_arg_count.rs | //! Check that functions don't accept an "excessive" number of arguments.
use syntax::ast::{Block, FnDecl, NodeId};
use syntax::codemap::Span;
use syntax::visit::FnKind;
use rustc::lint::{Context, LintArray, LintPass};
const MAX_ARGS_DEFAULT: usize = 6;
const MAX_ARGS_FOR_CLOSURE: usize = 4;
declare_lint!(FN_ARG_LI... | //! Check that functions don't accept an "excessive" number of arguments.
use syntax::ast::{Block, FnDecl, NodeId};
use syntax::codemap::Span;
use syntax::visit::FnKind;
use rustc::lint::{Context, LintArray, LintPass};
const MAX_ARGS_DEFAULT: usize = 6;
const MAX_ARGS_FOR_CLOSURE: usize = 4;
declare_lint!(FN_ARG_LI... | Use if-let as we only have a binary match | Use if-let as we only have a binary match
| Rust | mit | SeanHeelan/pedantrs |
ee6a8832cc9e606105e9b591cb4d2b57b65a4f01 | src/multirust-cli/setup_mode.rs | src/multirust-cli/setup_mode.rs | use std::env;
use self_update;
use multirust::Result;
use clap::{App, Arg};
pub fn main() -> Result<()> {
let args: Vec<_> = env::args().collect();
let arg1 = args.get(1).map(|a| &**a);
// Secret command used during self-update. Not for users.
if arg1 == Some("--self-replace") {
return self_up... | use std::env;
use self_update;
use multirust::Result;
use clap::{App, Arg};
pub fn main() -> Result<()> {
let args: Vec<_> = env::args().collect();
let arg1 = args.get(1).map(|a| &**a);
// Secret command used during self-update. Not for users.
if arg1 == Some("--self-replace") {
return self_up... | Remove author name from rustup-setup UI | Remove author name from rustup-setup UI
| Rust | apache-2.0 | Boddlnagg/rustup.rs,nodakai/rustup.rs,rust-lang/rustup,nodakai/rustup.rs,polonez/rustup.rs,inejge/rustup.rs,nodakai/rustup.rs,rust-lang/rustup,nodakai/rustup.rs,theindigamer/rustup.rs,polonez/rustup.rs,rust-lang/rustup,Boddlnagg/rustup.rs,inejge/rustup.rs,Boddlnagg/rustup.rs,theindigamer/rustup.rs,rust-lang/rustup,noda... |
13d1d26453f1f89d9d1cb8a82cc016bc0b71213d | src/utils/lang.rs | src/utils/lang.rs | use core::fmt;
use ::xen::sched::crash;
#[cfg(not(test))]
#[lang = "stack_exhausted"]
pub fn stack_exhausted() -> ! {
unimplemented!()
}
#[cfg(not(test))]
#[lang = "eh_personality"]
pub fn eh_personality() -> ! {
unimplemented!()
}
#[cfg(not(test))]
#[lang = "panic_fmt"]
pub extern fn panic_impl(msg: fmt::A... | use core::fmt;
use ::xen::sched::crash;
#[cfg(not(test))]
#[lang = "stack_exhausted"]
pub fn stack_exhausted() -> ! {
unimplemented!()
}
#[cfg(not(test))]
#[lang = "eh_personality"]
pub fn eh_personality() -> ! {
unimplemented!()
}
#[cfg(not(test))]
#[lang = "panic_fmt"]
pub extern fn panic_impl(msg: fmt::A... | Add dummy implementation of _Unwind_Resume | utils: Add dummy implementation of _Unwind_Resume
| Rust | mit | uni-rs/uni.rs |
43e9444e4eed1b8dc6502c290a20bff26a3e87b8 | kernel/src/lang.rs | kernel/src/lang.rs | use core::prelude::*;
use core::fmt;
#[lang="eh_personality"]
pub fn eh_personality() { }
#[lang="panic_fmt"]
extern fn panic_fmt(fmt: fmt::Arguments, file: &'static str, line: usize) -> ! {
println!("panic: {}", fmt);
loop {
unsafe {
asm!("hlt");
}
}
}
#[lang="stack_exhausted... | use core::prelude::*;
use core::fmt;
#[lang="eh_personality"]
pub fn eh_personality() { }
#[lang="panic_fmt"]
extern fn panic_fmt(fmt: fmt::Arguments, file: &'static str, line: usize) -> ! {
println!("panic: {} ({}:{})", fmt, file, line);
loop {
unsafe {
asm!("hlt");
}
}
}
#[l... | Use file and line number in panic. | Use file and line number in panic.
| Rust | mit | anchovieshat/cathode-old,anchovieshat/cathode-old,anchovieshat/cathode-old |
8036529980702e6e9c033188c090d6e9d62c00e2 | rust/secret-santa.rs | rust/secret-santa.rs | use std::rand;
use std::rand::Rng;
fn main() {
println("Secret Santa");
let names = ~["Angus", "Greg", "Lewis", "Mike", "Isabel", "Rob", "Shannon", "Allan"];
let pairings = secret_santa(&names);
print_pairings(&pairings);
}
fn secret_santa<'r>(names: &~[&'r str]) -> ~[(&'r str,&'r str)] {
let mut rng = rand:... | use std::rand;
use std::rand::Rng;
fn main() {
println("Secret Santa");
let names = ~["Angus", "Greg", "Lewis", "Mike", "Isabel", "Rob", "Shannon", "Allan"];
let pairings = secret_santa(&names);
print_pairings(&pairings);
}
fn secret_santa<'r>(names: &~[&'r str]) -> ~[(&'r str,&'r str)] {
let mut rng = rand:... | Revert "Changed implementation to be based on shuffled list" | Revert "Changed implementation to be based on shuffled list"
This reverts commit 6b5eb69b569316a79f1674d76b4dfe5d189c1e32.
| Rust | unlicense | AetherWorks/SecretSanta,AetherWorks/SecretSanta,AetherWorks/SecretSanta,AetherWorks/SecretSanta,AetherWorks/SecretSanta |
8d25d6b2c9bb04c9f0d222ed6b900f696c0e7ebe | tests/test_backtrace.rs | tests/test_backtrace.rs | #[rustversion::not(nightly)]
#[ignore]
#[test]
fn test_backtrace() {}
#[rustversion::nightly]
#[test]
fn test_backtrace() {
use anyhow::anyhow;
let error = anyhow!("oh no!");
let _ = error.backtrace();
}
| #![cfg(not(miri))]
#[rustversion::not(nightly)]
#[ignore]
#[test]
fn test_backtrace() {}
#[rustversion::nightly]
#[test]
fn test_backtrace() {
use anyhow::anyhow;
let error = anyhow!("oh no!");
let _ = error.backtrace();
}
| Disable backtrace test on miri | Disable backtrace test on miri
Starting in the most recent release of miri, the build.rs probe fails to
build even on nightly toolchain with one of the following errors:
error: miri can only run programs that have a main function
error: the current sysroot was built without `-Zalways-encode-mir`,
or libc... | Rust | apache-2.0 | dtolnay/anyhow |
7815b1d7629fcfc9530d15ba14731bb41f32ba00 | tests/integration/consumer_producer/mod.rs | tests/integration/consumer_producer/mod.rs | pub use super::*;
use kafka::producer::{Producer, RequiredAcks};
use kafka;
use kafka::consumer::Consumer;
use std::time::Duration;
pub fn test_producer() -> Producer {
Producer::from_hosts(vec![LOCAL_KAFKA_BOOTSTRAP_HOST.to_owned()])
.with_ack_timeout(Duration::from_secs(1))
.with_required_acks(Re... | pub use super::*;
use kafka::producer::{Producer, RequiredAcks};
use kafka;
use kafka::client::FetchOffset;
use kafka::consumer::Consumer;
use std::time::Duration;
pub fn test_producer() -> Producer {
Producer::from_hosts(vec![LOCAL_KAFKA_BOOTSTRAP_HOST.to_owned()])
.with_ack_timeout(Duration::from_secs(1)... | Make sure consumer is always at the latest offset | Make sure consumer is always at the latest offset
| Rust | mit | spicavigo/kafka-rust,spicavigo/kafka-rust |
8240ed26a97a6d1642546e56144870305ff4676c | tests/run-pass/concurrency/tls_lib_drop.rs | tests/run-pass/concurrency/tls_lib_drop.rs | // ignore-windows: Concurrency on Windows is not supported yet.
//! Check that destructors of the library thread locals are executed immediately
//! after a thread terminates.
//!
//! FIXME: We should have a similar test for thread-local statics (statics
//! annotated with `#[thread_local]`) once they support destruct... | // ignore-windows: Concurrency on Windows is not supported yet.
//! Check that destructors of the library thread locals are executed immediately
//! after a thread terminates.
use std::cell::RefCell;
use std::thread;
struct TestCell {
value: RefCell<u8>,
}
impl Drop for TestCell {
fn drop(&mut self) {
... | Change the test not to rely on internals. | Change the test not to rely on internals.
| Rust | apache-2.0 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri |
7da06be87ae4f61a1622bbc4711c28f655fa7b34 | src/effects/sum.rs | src/effects/sum.rs | use super::effect::{Effect, EffectRenderState};
use partial::Partial;
/// The output for a Sum effect is the sum of all partials sent to any of its
/// slots.
pub struct Sum;
pub struct SumProcessIter {
partial : Option<Partial>,
}
impl Iterator for SumProcessIter {
type Item=Partial;
fn next(&mut self)... | use std::iter;
use super::effect::{Effect, EffectRenderState};
use partial::Partial;
/// The output for a Sum effect is the sum of all partials sent to any of its
/// slots.
pub struct Sum;
impl Effect for Sum {
fn new() -> Sum {
Sum
}
fn process(&self, state : &mut EffectRenderState, partial : &... | Simplify implementation of Sum effect | Simplify implementation of Sum effect
| Rust | mit | Wallacoloo/libfriendship |
37089307c9e41233372b0c47b6175b2935c93019 | src/jira_client.rs | src/jira_client.rs | extern crate serde;
extern crate serde_json;
use hyper::Client;
use hyper::client::{Response};
use hyper::header::Headers;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;
pub fn send<R: JIRARequest, T: serde::de::Deserialize... | extern crate serde;
extern crate serde_json;
use hyper::Client;
use hyper::client::{Response};
use hyper::header::Headers;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;
use hyper::status::StatusCode;
use jira_request::*;
use std::io::Read;
pub fn send<R: JIRARequest, T: serde::de::Deserialize... | Fix the type of body to Vec | :hammer: Fix the type of body to Vec
| Rust | mit | dorayakikun/alfred_jira_workflow |
8ca9d0ada45932e5e958b95cb8d2a7d1e9c2f103 | src/relay/utils.rs | src/relay/utils.rs | use std::{
future::Future,
io::{self, Error},
time::Duration,
};
use tokio::time;
pub async fn try_timeout<T, E, F>(fut: F, timeout: Option<Duration>) -> io::Result<T>
where
F: Future<Output = Result<T, E>>,
Error: From<E>,
{
match timeout {
Some(t) => time::timeout(t, fut).await?,
... | use std::{
future::Future,
io::{self, Error},
time::Duration,
};
use tokio::time;
pub async fn try_timeout<T, E, F>(fut: F, timeout: Option<Duration>) -> io::Result<T>
where
F: Future<Output = Result<T, E>>,
Error: From<E>,
{
match timeout {
Some(t) => time::timeout(t, fut).await?,
... | Disable set_nofile in Android build | Disable set_nofile in Android build
RLIMT_NOFILE is private in Android system.
| Rust | mit | zonyitoo/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust,shadowsocks/shadowsocks-rust |
0e5a2a44fc9ca89680d1b70e45b74ae1721aa003 | src/main.rs | src/main.rs | use std::process::Command;
use std::process::exit;
use std::os::unix::process::CommandExt;
fn main() {
let err = Command::new("java")
.arg("-Xms512m")
.arg("-Xmx1536m")
.arg("-Xss2m")
.args(&["-jar", "/Users/dnw/.sbt/launchers/0.13.13/sbt-launch.jar"])
.arg("shell")
... | use std::process::Command;
use std::process::exit;
use std::os::unix::process::CommandExt;
fn main() {
let home = std::env::var("HOME").unwrap();
let err = Command::new("java")
.arg("-Xms512m")
.arg("-Xmx1536m")
.arg("-Xss2m")
.args(&["-jar", &format!("{}/.sbt/launchers/0.13.13/... | Make launcher path dependent on HOME | Make launcher path dependent on HOME
| Rust | apache-2.0 | dwijnand/sbtl,dwijnand/sbtl |
8b71c865b2d66c581476e4e7b4870840ba691aa2 | tests/compile-fail/rc_return.rs | tests/compile-fail/rc_return.rs | extern crate rayon;
use std::rc::Rc;
fn main() {
rayon::join(|| Rc::new(22), || Rc::new(23));
//~^ ERROR E0277
//~| ERROR E0277
}
| extern crate rayon;
use std::rc::Rc;
fn main() {
rayon::join(|| Rc::new(22), || ()); //~ ERROR E0277
rayon::join(|| (), || Rc::new(23)); //~ ERROR E0277
}
| Split up the test of join returning Rc | Split up the test of join returning Rc
It seems that current rustc is now only reporting one error for `Rc`
returned in both `join` arguments. We can split our test into two lines
to explicitly check the failure in each argument position.
| Rust | apache-2.0 | cuviper/rayon,cuviper/rayon |
4966c2f514577c2c5f6f5ee4640d2926652a74e5 | src/lib.rs | src/lib.rs | #![no_std]
mod entities;
pub use entities::ENTITIES;
#[cfg(test)]
mod tests {
extern crate std;
use self::std::collections::HashMap;
use super::ENTITIES;
#[test]
fn sanity() {
let found = ENTITIES.iter().find(|e| e.entity == ">");
assert!(found.is_some());
assert_eq... | #![no_std]
mod entities;
pub use entities::ENTITIES;
pub use entities::Codepoints;
pub use entities::Entity;
#[cfg(test)]
mod tests {
extern crate std;
use self::std::collections::HashMap;
use super::ENTITIES;
#[test]
fn sanity() {
let found = ENTITIES.iter().find(|e| e.entity == ">... | Make Codepoints and Entity types public | Make Codepoints and Entity types public
| Rust | mit | p-jackson/entities |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.