file_name large_stringlengths 4 69 | prefix large_stringlengths 0 26.7k | suffix large_stringlengths 0 24.8k | middle large_stringlengths 0 2.12k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
p074.rs | //! [Problem 74](https://projecteuler.net/problem=74) solver.
#![warn(
bad_style,
unused,
unused_extern_crates,
unused_import_braces,
unused_qualifications,
unused_results
)]
use std::collections::HashMap;
#[derive(Clone)]
enum Length {
Loop(usize),
Chain(usize),
Unknown,
}
fn fa... |
}
chain_len + loop_len
}
fn solve() -> String {
let limit = 1000000;
let factorial = {
let mut val = [1; 10];
for i in 1..10 {
val[i] = val[i - 1] * (i as u32);
}
val
};
let mut map = vec![Length::Unknown; (factorial[9] * 6 + 1) as usize];
let ... | {
map[key as usize] = Length::Chain(loop_len + chain_len - idx);
} | conditional_block |
lib.rs | // Copyright (C) 2015, Alberto Corona <alberto@0x1a.us>
// All rights reserved. This file is part of core-utils, distributed under the
// GPL v3 license. For full terms please see the LICENSE file.
#![crate_type = "lib"]
#![feature(path_relative_from,exit_status)]
extern crate term;
use std::io::prelude::Write;
use ... |
pub fn err(prog: &str, status: Status, mesg: String) {
match term::stdout() {
Some(mut term) => {
term.fg(term::color::RED).unwrap();
(write!(term, "{}: {}\n", prog, mesg)).unwrap();
term.reset().unwrap();
exit(status);
}
None => {},
};
}... | {
match term::stdout() {
Some(mut term) => {
term.fg(term::color::RED).unwrap();
(write!(term, "{}: {}\n",item.display(), mesg)).unwrap();
term.reset().unwrap();
exit(status);
}
None => {},
};
} | identifier_body |
lib.rs | // Copyright (C) 2015, Alberto Corona <alberto@0x1a.us>
// All rights reserved. This file is part of core-utils, distributed under the
// GPL v3 license. For full terms please see the LICENSE file.
#![crate_type = "lib"]
#![feature(path_relative_from,exit_status)]
extern crate term;
use std::io::prelude::Write;
use ... | ,
};
}
pub fn err(prog: &str, status: Status, mesg: String) {
match term::stdout() {
Some(mut term) => {
term.fg(term::color::RED).unwrap();
(write!(term, "{}: {}\n", prog, mesg)).unwrap();
term.reset().unwrap();
exit(status);
}
None => {}... | {} | conditional_block |
lib.rs | // Copyright (C) 2015, Alberto Corona <alberto@0x1a.us>
// All rights reserved. This file is part of core-utils, distributed under the
// GPL v3 license. For full terms please see the LICENSE file.
#![crate_type = "lib"]
#![feature(path_relative_from,exit_status)]
extern crate term;
use std::io::prelude::Write;
use ... | use std::env;
use std::path::{PathBuf,Path};
pub enum Status {
Ok,
Error,
OptError,
ArgError,
}
pub fn exit(status: Status) {
process::exit(status as i32);
}
pub fn set_exit_status(status: Status) {
env::set_exit_status(status as i32);
}
pub fn path_err(status: Status, mesg: String, item: P... | random_line_split | |
lib.rs | // Copyright (C) 2015, Alberto Corona <alberto@0x1a.us>
// All rights reserved. This file is part of core-utils, distributed under the
// GPL v3 license. For full terms please see the LICENSE file.
#![crate_type = "lib"]
#![feature(path_relative_from,exit_status)]
extern crate term;
use std::io::prelude::Write;
use ... | (&self, rel_from: &PathBuf) -> PathBuf {
self.relative_from(&rel_from).unwrap_or(&PathBuf::new()).to_path_buf()
}
}
| rel_to | identifier_name |
configurable_validator_signer.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{Error, PersistentSafetyStorage};
use diem_crypto::{
ed25519::{Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature},
hash::CryptoHash,
};
use diem_global_constants::CONSENSUS_KEY;
use diem_types::{account_address::A... | <T: Serialize + CryptoHash>(
&self,
message: &T,
storage: &PersistentSafetyStorage,
) -> Result<Ed25519Signature, Error> {
match self {
ConfigurableValidatorSigner::Signer(signer) => Ok(signer.sign(message)),
ConfigurableValidatorSigner::Handle(handle) => hand... | sign | identifier_name |
configurable_validator_signer.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{Error, PersistentSafetyStorage};
use diem_crypto::{
ed25519::{Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature},
hash::CryptoHash,
};
use diem_global_constants::CONSENSUS_KEY;
use diem_types::{account_address::A... |
/// Returns the author associated with this handle.
pub fn author(&self) -> AccountAddress {
self.author
}
/// Returns the public key version associated with this handle.
pub fn key_version(&self) -> Ed25519PublicKey {
self.key_version.clone()
}
/// Signs a given message ... | {
ValidatorHandle {
author,
key_version,
}
} | identifier_body |
configurable_validator_signer.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{Error, PersistentSafetyStorage};
use diem_crypto::{
ed25519::{Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature},
hash::CryptoHash,
};
use diem_global_constants::CONSENSUS_KEY;
use diem_types::{account_address::A... | }
/// Returns the public key version associated with this handle.
pub fn key_version(&self) -> Ed25519PublicKey {
self.key_version.clone()
}
/// Signs a given message using this handle and a given secure storage backend.
pub fn sign<T: Serialize + CryptoHash>(
&self,
me... | }
/// Returns the author associated with this handle.
pub fn author(&self) -> AccountAddress {
self.author | random_line_split |
bfi.rs | use crate::core::bits::Bits;
use crate::core::instruction::{BfiParams, Instruction};
use crate::core::register::Reg;
#[allow(non_snake_case)]
pub fn decode_BFI_t1(opcode: u32) -> Instruction {
let rn: u8 = opcode.get_bits(16..20) as u8;
let rd: u8 = opcode.get_bits(8..12) as u8;
let imm3: u8 = opcode.get_... |
// msbit = lsbit + width -1 <=>
// width = msbit - lsbit + 1
let width = msbit - lsbit + 1;
Instruction::BFI {
params: BfiParams {
rd: Reg::from(rd),
rn: Reg::from(rn),
lsbit: lsbit as usize,
width: width as usize,
},
}
} | let imm2: u8 = opcode.get_bits(6..8) as u8;
let lsbit = u32::from((imm3 << 2) + imm2);
let msbit = opcode.get_bits(0..5); | random_line_split |
bfi.rs | use crate::core::bits::Bits;
use crate::core::instruction::{BfiParams, Instruction};
use crate::core::register::Reg;
#[allow(non_snake_case)]
pub fn decode_BFI_t1(opcode: u32) -> Instruction | },
}
}
| {
let rn: u8 = opcode.get_bits(16..20) as u8;
let rd: u8 = opcode.get_bits(8..12) as u8;
let imm3: u8 = opcode.get_bits(12..15) as u8;
let imm2: u8 = opcode.get_bits(6..8) as u8;
let lsbit = u32::from((imm3 << 2) + imm2);
let msbit = opcode.get_bits(0..5);
// msbit = lsbit + width -1 <=... | identifier_body |
bfi.rs | use crate::core::bits::Bits;
use crate::core::instruction::{BfiParams, Instruction};
use crate::core::register::Reg;
#[allow(non_snake_case)]
pub fn | (opcode: u32) -> Instruction {
let rn: u8 = opcode.get_bits(16..20) as u8;
let rd: u8 = opcode.get_bits(8..12) as u8;
let imm3: u8 = opcode.get_bits(12..15) as u8;
let imm2: u8 = opcode.get_bits(6..8) as u8;
let lsbit = u32::from((imm3 << 2) + imm2);
let msbit = opcode.get_bits(0..5);
// ... | decode_BFI_t1 | identifier_name |
helpers.rs |
use errors::*;
use crypto::digest::Digest;
use crypto::blake2b::Blake2b;
/// Helper to calculate a discovery key from a public key. 'key' should be 32 bytes; the returned
/// array will also be 32 bytes long.
///
/// dat discovery keys are calculated as a BLAKE2b "keyed hash" (using the passed key) of the string
/// ... | (key: &[u8]) -> Vec<u8> {
let mut discovery_key = [0; 32];
let mut hash = Blake2b::new_keyed(32, key);
hash.input(&"hypercore".as_bytes());
hash.result(&mut discovery_key);
discovery_key.to_vec()
}
/// Helper to parse a dat address (aka, public key) in string format.
///
/// Address can start with ... | make_discovery_key | identifier_name |
helpers.rs | use errors::*;
use crypto::digest::Digest;
use crypto::blake2b::Blake2b;
/// Helper to calculate a discovery key from a public key. 'key' should be 32 bytes; the returned
/// array will also be 32 bytes long.
///
/// dat discovery keys are calculated as a BLAKE2b "keyed hash" (using the passed key) of the string
/// "... | Ok(key_bytes)
}
#[test]
fn test_parse_dat_address() {
assert!(parse_dat_address(
"c7638882870abd4044d6467b0738f15e3a36f57c3a7f7f3417fd7e4e0841d597").is_ok());
assert!(parse_dat_address(
"C7638882870ABD4044D6467B0738F15E3A36F57C3A7F7F3417FD7E4E0841D597").is_ok());
assert!(parse_dat_addr... | random_line_split | |
helpers.rs |
use errors::*;
use crypto::digest::Digest;
use crypto::blake2b::Blake2b;
/// Helper to calculate a discovery key from a public key. 'key' should be 32 bytes; the returned
/// array will also be 32 bytes long.
///
/// dat discovery keys are calculated as a BLAKE2b "keyed hash" (using the passed key) of the string
/// ... |
#[test]
fn test_parse_dat_address() {
assert!(parse_dat_address(
"c7638882870abd4044d6467b0738f15e3a36f57c3a7f7f3417fd7e4e0841d597").is_ok());
assert!(parse_dat_address(
"C7638882870ABD4044D6467B0738F15E3A36F57C3A7F7F3417FD7E4E0841D597").is_ok());
assert!(parse_dat_address(
"dat:/... | {
let raw_key = if input.starts_with("dat://") {
&input[6..]
} else {
input
};
if raw_key.len() != 32 * 2 {
bail!("dat key not correct length");
}
let mut key_bytes = vec![];
for i in 0..32 {
let r = u8::from_str_radix(&raw_key[2 * i..2 * i + 2], 16);
... | identifier_body |
img.rs | use std::iter::Iterator;
use std::path;
use image;
use image::{DynamicImage, GenericImageView};
pub struct Image {
pub width: u32,
pub height: u32,
img_buf: DynamicImage,
}
impl Image {
pub fn new<P: AsRef<path::Path> + ToString>(path: P) -> Image {
let img_buf = image::open(&path).unwrap();
... | (img_buf: DynamicImage) -> Image {
let (width, height) = img_buf.dimensions();
Image {
width,
height,
img_buf,
}
}
#[cfg(feature = "qrcode_builder")]
pub fn from_qr(code: &str, width: u32) -> Image {
use image::ImageBuffer;
use qrc... | from | identifier_name |
img.rs | use std::iter::Iterator;
use std::path;
use image;
use image::{DynamicImage, GenericImageView};
pub struct Image {
pub width: u32,
pub height: u32,
img_buf: DynamicImage,
}
impl Image {
pub fn new<P: AsRef<path::Path> + ToString>(path: P) -> Image {
let img_buf = image::open(&path).unwrap();
... | else {
image::Rgb([0, 0, 0])
}
});
Image {
width,
height: width,
img_buf: DynamicImage::ImageRgb8(img_buf),
}
}
pub fn is_blank_pixel(&self, x: u32, y: u32) -> bool {
let pixel = self.img_buf.get_pixel(x, y);
... | {
image::Rgb([0xFF, 0xFF, 0xFF])
} | conditional_block |
img.rs | use std::iter::Iterator;
use std::path;
use image;
use image::{DynamicImage, GenericImageView};
pub struct Image {
pub width: u32,
pub height: u32,
img_buf: DynamicImage,
}
impl Image {
pub fn new<P: AsRef<path::Path> + ToString>(path: P) -> Image {
let img_buf = image::open(&path).unwrap();
... | } | random_line_split | |
chrome_loader.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 net::chrome_loader::resolve_chrome_url;
use url::Url;
#[test]
fn test_relative() {
let url = Url::parse("... | fn test_absolute_2() {
let url = Url::parse("chrome://C:\\Windows").unwrap();
assert!(resolve_chrome_url(&url).is_err());
}
#[test]
#[cfg(target_os = "windows")]
fn test_absolute_3() {
let url = Url::parse("chrome://\\\\server/C$").unwrap();
assert!(resolve_chrome_url(&url).is_err());
}
#[test]
fn tes... | #[test]
#[cfg(target_os = "windows")] | random_line_split |
chrome_loader.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 net::chrome_loader::resolve_chrome_url;
use url::Url;
#[test]
fn test_relative() {
let url = Url::parse("... |
#[test]
#[cfg(target_os = "windows")]
fn test_absolute_3() {
let url = Url::parse("chrome://\\\\server/C$").unwrap();
assert!(resolve_chrome_url(&url).is_err());
}
#[test]
fn test_valid() {
let url = Url::parse("chrome://badcert.jpg").unwrap();
let resolved = resolve_chrome_url(&url).unwrap();
as... | {
let url = Url::parse("chrome://C:\\Windows").unwrap();
assert!(resolve_chrome_url(&url).is_err());
} | identifier_body |
chrome_loader.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 net::chrome_loader::resolve_chrome_url;
use url::Url;
#[test]
fn test_relative() {
let url = Url::parse("... | () {
let url = Url::parse("chrome:///etc/passwd").unwrap();
assert!(resolve_chrome_url(&url).is_err());
}
#[test]
#[cfg(target_os = "windows")]
fn test_absolute_2() {
let url = Url::parse("chrome://C:\\Windows").unwrap();
assert!(resolve_chrome_url(&url).is_err());
}
#[test]
#[cfg(target_os = "windows... | test_absolute | identifier_name |
main.rs | #![feature(slice_position_elem, iter_arith)]
#[macro_use] extern crate libeuler;
/// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
///
/// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
fn main() {
solut... | else {
factor += 1;
}
}
retval
}
fn prime_factors_less_than(max: &i64) -> Vec<Vec<i64>> {
let mut retval = Vec::new();
for i in 1..*max {
retval.push(factors(&i));
}
retval
}
| {
retval.push(factor);
v /= factor;
} | conditional_block |
main.rs | #![feature(slice_position_elem, iter_arith)]
#[macro_use] extern crate libeuler;
/// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
///
/// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
fn main() |
for v in still_needed {
needed_factors.push(v.clone());
}
}
needed_factors.iter().map(|&i| i).product::<i64>()
}
};
}
fn factors(value: &i64) -> Vec<i64> {
let mut factor = 2;
let mut v = value.clone();
let mut retva... | {
solutions!{
inputs: (max_factor: i64 = 20)
sol naive {
let primes = prime_factors_less_than(&max_factor);
let mut needed_factors = Vec::new();
for factors in primes.iter() {
let mut f = needed_factors.clone();
let still_needed: ... | identifier_body |
main.rs | #![feature(slice_position_elem, iter_arith)]
#[macro_use] extern crate libeuler;
/// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
///
/// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
fn main() {
solut... | (value: &i64) -> Vec<i64> {
let mut factor = 2;
let mut v = value.clone();
let mut retval = Vec::new();
while v > 1 {
if v % factor == 0 {
retval.push(factor);
v /= factor;
} else {
factor += 1;
}
}
retval
}
fn prime_factors_less_tha... | factors | identifier_name |
main.rs | #![feature(slice_position_elem, iter_arith)]
#[macro_use] extern crate libeuler;
/// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
///
/// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
fn main() {
solut... |
needed_factors.iter().map(|&i| i).product::<i64>()
}
};
}
fn factors(value: &i64) -> Vec<i64> {
let mut factor = 2;
let mut v = value.clone();
let mut retval = Vec::new();
while v > 1 {
if v % factor == 0 {
retval.push(factor);
v /= factor;
... | needed_factors.push(v.clone());
}
} | random_line_split |
lib.rs | #[macro_use]
extern crate bitflags;
extern crate nix;
extern crate libc;
mod itimer_spec;
mod sys;
use std::mem;
use std::ptr;
use std::os::unix::io::{RawFd, AsRawFd};
use nix::{Errno, Error};
use nix::unistd;
use libc::{c_int, clockid_t};
pub use self::itimer_spec::*;
#[doc(hidden)]
const TIMERFD_DATA_SIZE: usize ... | (&mut self) {
let _ = unistd::close(self.0);
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::{time, thread};
use nix::sys::time::{TimeSpec, TimeValLike};
#[test]
fn test_read_timerfd() {
let mut timer =
TimerFd::with_flags(ClockId::Monotonic, TFD_NONBLOCK).expec... | drop | identifier_name |
lib.rs | #[macro_use]
extern crate bitflags;
extern crate nix;
extern crate libc;
mod itimer_spec;
mod sys;
use std::mem;
use std::ptr;
use std::os::unix::io::{RawFd, AsRawFd};
use nix::{Errno, Error};
use nix::unistd;
use libc::{c_int, clockid_t};
pub use self::itimer_spec::*;
#[doc(hidden)]
const TIMERFD_DATA_SIZE: usize ... |
#[inline]
pub fn timerfd_settime(
fd: RawFd,
flags: TFDTimerFlags,
utmr: &ITimerSpec,
otmr: Option<&mut ITimerSpec>,
) -> nix::Result<()> {
let res = unsafe {
sys::timerfd_settime(
fd,
flags.bits(),
utmr as *const ITimerSpec,
otmr.map(|x| x a... | {
unsafe { Errno::result(sys::timerfd_create(clock_id, flags.bits())) }
} | identifier_body |
lib.rs | #[macro_use]
extern crate bitflags;
extern crate nix;
extern crate libc;
mod itimer_spec;
mod sys;
use std::mem;
use std::ptr;
use std::os::unix::io::{RawFd, AsRawFd};
use nix::{Errno, Error};
use nix::unistd;
use libc::{c_int, clockid_t};
pub use self::itimer_spec::*;
#[doc(hidden)]
const TIMERFD_DATA_SIZE: usize ... | assert!(timer.read_time().unwrap().is_some());
}
} | random_line_split | |
opening.rs | use std::io::prelude::*;
use std::path::Path;
use std::fs::File;
use std::io::Result;
use bitboard::Board;
use bitboard::Move;
use bitboard::Turn;
///
///Opening book file format:
///(16 bytes: hash table array size (n))
///n * (20 bytes: (1 byte used)(16 bytes: board position, normalized)(1 byte: white best move)(... | {
file : File,
}
impl Opening {
pub fn new(filename : String) -> Result<Opening> {
let open_file = File::open(&filename)?;
Ok(Opening {
file : open_file,
})
}
pub fn get_move(&mut self, bb : Board, t : Turn) -> Result<Move> {
Ok(Move::null())
... | Opening | identifier_name |
opening.rs | use std::io::prelude::*;
use std::path::Path;
use std::fs::File;
use std::io::Result;
use bitboard::Board;
use bitboard::Move;
use bitboard::Turn;
/// | ///
struct OpeningNode {
hash_val_1 : u32,
hash_val_2 : u32,
black_minimax : i16,
white_minimax : i16,
best_alt_move : u16,
alt_score : i16,
flags : u16,
}
pub struct Opening {
file : File,
}
impl Opening {
pub fn new(filename : String) -> Resul... | ///Opening book file format:
///(16 bytes: hash table array size (n))
///n * (20 bytes: (1 byte used)(16 bytes: board position, normalized)(1 byte: white best move)(1 byte: black best move)) | random_line_split |
regions-free-region-ordering-callee.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn ordering4<'a, 'b>(a: &'a uint, b: &'b uint, x: |&'a &'b uint|) {
// Do not infer ordering from closure argument types.
let z: Option<&'a &'b uint> = None;
//~^ ERROR reference has a longer lifetime than the data it references
}
fn ordering5<'a, 'b>(a: &'a uint, b: &'b uint, x: Option<&'a &'b uint>) {
... | random_line_split | |
regions-free-region-ordering-callee.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <'a, 'b>(x: &'a &'b uint) -> &'a uint {
// It is safe to assume that 'a <= 'b due to the type of x
let y: &'b uint = &**x;
return y;
}
fn ordering2<'a, 'b>(x: &'a &'b uint, y: &'a uint) -> &'b uint {
// However, it is not safe to assume that 'b <= 'a
&*y //~ ERROR cannot infer
}
fn ordering3<'a, '... | ordering1 | identifier_name |
regions-free-region-ordering-callee.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn ordering5<'a, 'b>(a: &'a uint, b: &'b uint, x: Option<&'a &'b uint>) {
let z: Option<&'a &'b uint> = None;
}
fn main() {}
| {
// Do not infer ordering from closure argument types.
let z: Option<&'a &'b uint> = None;
//~^ ERROR reference has a longer lifetime than the data it references
} | identifier_body |
error.rs | use crate::asm::Token;
use std::fmt;
#[derive(Debug, Clone)]
pub enum Error {
ParseError { error: String },
NoSectionDecl,
MissingSection,
StringConstantWithoutLabel { instr: String },
SymbolAlreadyDeclared { name: String },
InvalidDirectiveName { instr: String },
UnknownDirective { name: S... | f.write_str(&format!("Invalid directive name: {}", instr))
}
Error::UnknownDirective { ref name } => {
f.write_str(&format!("Unknown directive: {}", name))
}
Error::UnknownSection { ref name } => {
f.write_str(&format!("Unkn... | )),
Error::SymbolAlreadyDeclared { ref name } => {
f.write_str(&format!("Symbol {:?} declared multiple times", name))
}
Error::InvalidDirectiveName { ref instr } => { | random_line_split |
error.rs | use crate::asm::Token;
use std::fmt;
#[derive(Debug, Clone)]
pub enum Error {
ParseError { error: String },
NoSectionDecl,
MissingSection,
StringConstantWithoutLabel { instr: String },
SymbolAlreadyDeclared { name: String },
InvalidDirectiveName { instr: String },
UnknownDirective { name: S... |
Error::InvalidDirectiveName { ref instr } => {
f.write_str(&format!("Invalid directive name: {}", instr))
}
Error::UnknownDirective { ref name } => {
f.write_str(&format!("Unknown directive: {}", name))
}
Error::UnknownSection ... | {
f.write_str(&format!("Symbol {:?} declared multiple times", name))
} | conditional_block |
error.rs | use crate::asm::Token;
use std::fmt;
#[derive(Debug, Clone)]
pub enum | {
ParseError { error: String },
NoSectionDecl,
MissingSection,
StringConstantWithoutLabel { instr: String },
SymbolAlreadyDeclared { name: String },
InvalidDirectiveName { instr: String },
UnknownDirective { name: String },
UnknownSection { name: String },
UnknownLabel { name: Strin... | Error | identifier_name |
dis.rs | mode(zydis::DecoderMode::MINIMAL, false)?;
decoder.enable_mode(zydis::DecoderMode::KNC, false)?;
decoder.enable_mode(zydis::DecoderMode::MPX, false)?;
decoder.enable_mode(zydis::DecoderMode::CET, false)?;
decoder.enable_mode(zydis::DecoderMode::LZCNT, false)?;
decoder.enable_mode(zydis::DecoderMode... |
#[test]
fn test_format_insn() {
use crate::analysis::dis::zydis;
let buf = get_buf(Rsrc::K32);
let pe = crate::loader::pe::PE::from_bytes(&buf).unwrap();
let mut formatter = zydis::Formatter::new(zydis::FormatterStyle::INTEL).unwrap();
struct UserData {
n... | {
// this is a jump from addr 0x0 to itmodule:
// JMP $+0;
let module = load_shellcode32(b"\xEB\xFE");
let insn = read_insn(&module, 0x0);
let op = get_first_operand(&insn).unwrap();
let xref = get_immediate_operand_xref(&module, 0x0, &insn, &op).unwrap();
assert... | identifier_body |
dis.rs | _mode(zydis::DecoderMode::MINIMAL, false)?;
decoder.enable_mode(zydis::DecoderMode::KNC, false)?;
decoder.enable_mode(zydis::DecoderMode::MPX, false)?;
decoder.enable_mode(zydis::DecoderMode::CET, false)?;
decoder.enable_mode(zydis::DecoderMode::LZCNT, false)?;
decoder.enable_mode(zydis::DecoderMod... | let op: &zydis::DecodedOperand = &*ctx.operand;
insn.calc_absolute_address(ctx.runtime_address, op)
.expect("failed to calculate absolute address")
};
if let Some(name) = userdata.names.get(&absolute_addr... |
let absolute_address = unsafe {
// safety: the insn and operands come from zydis, so we assume they contain
// valid data.
let insn: &zydis::DecodedInstruction = &*ctx.instruction; | random_line_split |
dis.rs | mode(zydis::DecoderMode::MINIMAL, false)?;
decoder.enable_mode(zydis::DecoderMode::KNC, false)?;
decoder.enable_mode(zydis::DecoderMode::MPX, false)?;
decoder.enable_mode(zydis::DecoderMode::CET, false)?;
decoder.enable_mode(zydis::DecoderMode::LZCNT, false)?;
decoder.enable_mode(zydis::DecoderMode... | () {
// 0: ff 25 06 00 00 00 +-> jmp DWORD PTR ds:0x6
// 6: 00 00 00 00 +-- dw 0x0
let module = load_shellcode32(b"\xFF\x25\x06\x00\x00\x00\x00\x00\x00\x00");
let insn = read_insn(&module, 0x0);
let op = get_first_operand(&insn).unwrap();
let xref = g... | test_get_memory_operand_xref_simple | identifier_name |
context.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/. */
//! Data needed by the layout thread.
use fnv::FnvHasher;
use gfx::display_list::{WebRenderImageInfo, OpaqueNode}... | (&self) -> &SharedStyleContext {
&self.style_context
}
pub fn get_or_request_image_or_meta(&self,
node: OpaqueNode,
url: ServoUrl,
use_placeholder: UsePlaceholder)
... | shared_context | identifier_name |
context.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/. */
//! Data needed by the layout thread.
use fnv::FnvHasher;
use gfx::display_list::{WebRenderImageInfo, OpaqueNode}... | pub registered_painters: &'a RegisteredPainters,
/// A list of in-progress image loads to be shared with the script thread.
/// A None value means that this layout was not initiated by the script thread.
pub pending_images: Option<Mutex<Vec<PendingImage>>>,
/// A list of nodes that have just initi... | pub webrender_image_cache: Arc<RwLock<HashMap<(ServoUrl, UsePlaceholder),
WebRenderImageInfo,
BuildHasherDefault<FnvHasher>>>>,
/// Paint worklets | random_line_split |
context.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/. */
//! Data needed by the layout thread.
use fnv::FnvHasher;
use gfx::display_list::{WebRenderImageInfo, OpaqueNode}... |
/// Layout information shared among all workers. This must be thread-safe.
pub struct LayoutContext<'a> {
/// The pipeline id of this LayoutContext.
pub id: PipelineId,
/// Bits shared by the layout and style system.
pub style_context: SharedStyleContext<'a>,
/// Reference to the script thread i... | {
FONT_CONTEXT_KEY.with(|r| {
if let Some(ref context) = *r.borrow() {
context.size_of(ops)
} else {
0
}
})
} | identifier_body |
context.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/. */
//! Data needed by the layout thread.
use fnv::FnvHasher;
use gfx::display_list::{WebRenderImageInfo, OpaqueNode}... | else {
0
}
})
}
/// Layout information shared among all workers. This must be thread-safe.
pub struct LayoutContext<'a> {
/// The pipeline id of this LayoutContext.
pub id: PipelineId,
/// Bits shared by the layout and style system.
pub style_context: SharedStyleContext<'a>,
... | {
context.size_of(ops)
} | conditional_block |
pretty.rs | use chrono::*;
pub use super::split;
pub fn pretty_short(dur: Duration) -> String {
let components = split::split_duration(dur).as_vec();
let mut components_iter = components.iter().skip_while(|a| a.val() == 0);
let first_component = components_iter.next();
let second_component = components_iter.next(... | (val: &split::TimePeriod) -> Option<&split::TimePeriod> {
if val.val() == 0 {return None};
return Some(val);
}
return final_str;
}
pub fn pretty_full(dur: Duration) -> String {
let components = split::split_duration(dur);
let mut final_str = String::new();
for (i, component) in co... | has_second | identifier_name |
pretty.rs | use chrono::*;
pub use super::split;
pub fn pretty_short(dur: Duration) -> String {
let components = split::split_duration(dur).as_vec();
let mut components_iter = components.iter().skip_while(|a| a.val() == 0);
let first_component = components_iter.next();
let second_component = components_iter.next(... | ,
// The duration is 0
None => {split::TimePeriod::Millisecond(0).to_string()},
};
fn has_second(val: &split::TimePeriod) -> Option<&split::TimePeriod> {
if val.val() == 0 {return None};
return Some(val);
}
return final_str;
}
pub fn pretty_full(dur: Duration) -> Strin... | {
match second_component.and_then(has_second) {
Some(y) => {format!("{} and {}", x.to_string(), y.to_string())},
None => {x.to_string()}
}
} | conditional_block |
pretty.rs | use chrono::*;
pub use super::split;
pub fn pretty_short(dur: Duration) -> String {
let components = split::split_duration(dur).as_vec();
let mut components_iter = components.iter().skip_while(|a| a.val() == 0);
let first_component = components_iter.next();
let second_component = components_iter.next(... | assert_eq!(pretty_short(dur), final_str);
}
} | random_line_split | |
pretty.rs | use chrono::*;
pub use super::split;
pub fn pretty_short(dur: Duration) -> String {
let components = split::split_duration(dur).as_vec();
let mut components_iter = components.iter().skip_while(|a| a.val() == 0);
let first_component = components_iter.next();
let second_component = components_iter.next(... | {
let test_data = vec![
(Duration::milliseconds(0), "0 milliseconds"),
(Duration::milliseconds(1), "1 millisecond"),
(-Duration::milliseconds(1), "1 millisecond"),
(Duration::milliseconds(200), "200 milliseconds"),
(Duration::seconds(1) + Duration::milliseconds(200), "1 secon... | identifier_body | |
build.rs | // Copyright (C) 2016 ParadoxSpiral
//
// This file is part of mpv-rs.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any... | let source = env::var("MPV_SOURCE").expect("env var `MPV_SOURCE` not set");
if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
println!("cargo:rustc-link-search={}/64/", source);
} else {
println!("cargo:rustc-link-search={}/32/", source);
}
}
#[cfg(all(feature = "build_l... | random_line_split | |
build.rs | // Copyright (C) 2016 ParadoxSpiral
//
// This file is part of mpv-rs.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any... | () {
let source = env::var("MPV_SOURCE").expect("env var `MPV_SOURCE` not set");
if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
println!("cargo:rustc-link-search={}/64/", source);
} else {
println!("cargo:rustc-link-search={}/32/", source);
}
}
#[cfg(all(feature = "bu... | main | identifier_name |
build.rs | // Copyright (C) 2016 ParadoxSpiral
//
// This file is part of mpv-rs.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any... | // x86_64-unknown-linux-gnu, thus the script can't find the compiler.
// TODO: When Cross-compiling to different archs is implemented, this has to be handled.
env::remove_var("TARGET");
let cmd = format!(
"cd {} && echo \"--enable-libmpv-shared\" > {0}/mpv_options \
&& {0}/build -j{}",... | {
let source = env::var("MPV_SOURCE").expect("env var `MPV_SOURCE` not set");
let num_threads = env::var("NUM_JOBS").unwrap();
// `target` (in cfg) doesn't really mean target. It means target(host) of build script,
// which is a bit confusing because it means the actual `--target` everywhere else.
... | identifier_body |
build.rs | // Copyright (C) 2016 ParadoxSpiral
//
// This file is part of mpv-rs.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any... |
}
#[cfg(target_pointer_width = "32")]
{
if env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "64" {
panic!("Cross-compiling to different arch not yet supported");
}
}
// The mpv build script interprets the TARGET env var, which is set by cargo to e.g.
// x86_64... | {
panic!("Cross-compiling to different arch not yet supported");
} | conditional_block |
expr-block-generic-box2.rs | // Copyright 2012-2014 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-MI... |
pub fn main() { test_vec(); }
| {
fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; }
test_generic::<@int>(@1, compare_vec);
} | identifier_body |
expr-block-generic-box2.rs | // Copyright 2012-2014 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-MI... | <T:Clone>(expected: T, eq: compare<T>) {
let actual: T = { expected.clone() };
assert!((eq(expected, actual)));
}
fn test_vec() {
fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; }
test_generic::<@int>(@1, compare_vec);
}
pub fn main() { test_vec(); }
| test_generic | identifier_name |
expr-block-generic-box2.rs | // Copyright 2012-2014 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-MI... |
pub fn main() { test_vec(); } | fn test_vec() {
fn compare_vec(v1: @int, v2: @int) -> bool { return v1 == v2; }
test_generic::<@int>(@1, compare_vec);
} | random_line_split |
htmlbaseelement.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 dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
use dom::bindings::inheritance:... |
}
impl VirtualMethods for HTMLBaseElement {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation);
... | {
if !tree_in_doc {
return;
}
if self.upcast::<Element>().has_attribute(&atom!("href")) {
let document = document_from_node(self);
document.refresh_base_element();
}
} | identifier_body |
htmlbaseelement.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 dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
use dom::bindings::inheritance:... | (localName: DOMString,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLBaseElement> {
let element = HTMLBaseElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)
}
/// https://html.s... | new | identifier_name |
htmlbaseelement.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 dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
use dom::bindings::inheritance:... | fn unbind_from_tree(&self, tree_in_doc: bool) {
self.super_type().unwrap().unbind_from_tree(tree_in_doc);
self.bind_unbind(tree_in_doc);
}
} | }
| random_line_split |
htmlbaseelement.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 dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLBaseElementBinding;
use dom::bindings::inheritance:... |
if self.upcast::<Element>().has_attribute(&atom!("href")) {
let document = document_from_node(self);
document.refresh_base_element();
}
}
}
impl VirtualMethods for HTMLBaseElement {
fn super_type(&self) -> Option<&VirtualMethods> {
Some(self.upcast::<HTMLElemen... | {
return;
} | conditional_block |
rot.rs | pub struct Rot {
pub s: f32,
pub c: f32
}
impl Rot {
pub fn new() -> Rot {
Rot {
s: 0.0,
c: 1.0
}
}
/// Initialize from an angle in radians
pub fn new_angle(angle: f32) -> Rot {
Rot {
s: angle.sin(),
c: angle.cos()
... | use super::Vec2;
/// Rotation
#[derive(Copy, Clone)] | random_line_split | |
rot.rs | use super::Vec2;
/// Rotation
#[derive(Copy, Clone)]
pub struct | {
pub s: f32,
pub c: f32
}
impl Rot {
pub fn new() -> Rot {
Rot {
s: 0.0,
c: 1.0
}
}
/// Initialize from an angle in radians
pub fn new_angle(angle: f32) -> Rot {
Rot {
s: angle.sin(),
c: angle.cos()
}
}
... | Rot | identifier_name |
personal.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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 Software Foundation, either version 3 of the License, or
// (at your option) any la... | let response = r#"{"jsonrpc":"2.0","result":true,"id":1}"#;
assert_eq!(tester.io.handle_request_sync(&request), Some(response.into()));
assert!(tester.accounts.sign(address, None, Default::default()).is_ok(), "Should unlock account.");
} | }"#; | random_line_split |
personal.rs | // Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity 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 Software Foundation, either version 3 of the License, or
// (at your option) any la... | () {
let tester = setup();
let address = tester.accounts.new_account("password123").unwrap();
let request = r#"{
"jsonrpc": "2.0",
"method": "personal_unlockAccount",
"params": [
""#.to_owned() + &format!("0x{:?}", address) + r#"",
"password123",
"0x100"
],
"id": 1
}"#;
let response = r#"{"json... | should_unlock_account_temporarily | identifier_name |
thread_share.rs | //thread_share.rs
//Copyright 2015 David Huddle
use std::thread;
use std::sync::{Arc,mpsc};
extern crate time;
/// takes a vector and modifies in on a different thread
pub fn do_amazing_things(data:Vec<i32>)->Vec<i32> |
/// Takes a vec and breaks it up to do calculations
pub fn do_calc(data: Vec<i32>)->Vec<i32>{
let mut package = vec![data];
let start = time::precise_time_ns();
for _ in 0..2 {
package = break_vec(package);
}
let stop = time::precise_time_ns();
println!("split time: {}", stop - start)... | {
let (tx, rx) = mpsc::channel();
let tx = tx.clone();
thread::spawn(move || {
let mut ret = Vec::new();
for x in data {
ret.push(x * 7);
}
tx.send(ret);
});
rx.recv().ok().expect("Could not receive answer")
} | identifier_body |
thread_share.rs | //thread_share.rs
//Copyright 2015 David Huddle
use std::thread;
use std::sync::{Arc,mpsc};
extern crate time;
/// takes a vector and modifies in on a different thread
pub fn do_amazing_things(data:Vec<i32>)->Vec<i32>{
let (tx, rx) = mpsc::channel();
let tx = tx.clone();
thread::spawn(move || {
l... | for _ in 0..10 {
let tx = tx.clone();
thread::spawn(move || {
let answer = 42;
tx.send(answer);
});
}
let mut ret:Vec<i32> = Vec::new();
for _ in 0..10 {
ret.push(rx.recv().ok().expect("Could not receive answer"));
}
ret
}
/// Simple examp... | }
/// Simple example of multi provider single consumer
pub fn simple_mpsc()->Vec<i32>{
let (tx, rx) = mpsc::channel(); | random_line_split |
thread_share.rs | //thread_share.rs
//Copyright 2015 David Huddle
use std::thread;
use std::sync::{Arc,mpsc};
extern crate time;
/// takes a vector and modifies in on a different thread
pub fn do_amazing_things(data:Vec<i32>)->Vec<i32>{
let (tx, rx) = mpsc::channel();
let tx = tx.clone();
thread::spawn(move || {
l... | (){
use std::thread;
let handle = thread::spawn(move || {
panic!("oops!");
});
let result = handle.join();
assert!(result.is_err());
}
| thread_handle | identifier_name |
mem_replace.rs | // run-rustfix
#![allow(unused_imports)]
#![warn(
clippy::all,
clippy::style,
clippy::mem_replace_option_with_none,
clippy::mem_replace_with_default
)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use std::mem;
fn replace_option_with_none() {
let ... | () {
let mut s = String::from("foo");
let _ = std::mem::replace(&mut s, String::default());
let s = &mut String::from("foo");
let _ = std::mem::replace(s, String::default());
let _ = std::mem::replace(s, Default::default());
let mut v = vec![123];
let _ = std::mem::replace(&mut v, Vec::def... | replace_with_default | identifier_name |
mem_replace.rs | // run-rustfix
#![allow(unused_imports)]
#![warn(
clippy::all,
clippy::style,
clippy::mem_replace_option_with_none,
clippy::mem_replace_with_default
)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use std::mem;
fn replace_option_with_none() |
fn replace_with_default() {
let mut s = String::from("foo");
let _ = std::mem::replace(&mut s, String::default());
let s = &mut String::from("foo");
let _ = std::mem::replace(s, String::default());
let _ = std::mem::replace(s, Default::default());
let mut v = vec![123];
let _ = std::mem:... | {
let mut an_option = Some(1);
let _ = mem::replace(&mut an_option, None);
let an_option = &mut Some(1);
let _ = mem::replace(an_option, None);
} | identifier_body |
mem_replace.rs | // run-rustfix
#![allow(unused_imports)]
#![warn(
clippy::all,
clippy::style,
clippy::mem_replace_option_with_none,
clippy::mem_replace_with_default
)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use std::mem;
fn replace_option_with_none() { |
fn replace_with_default() {
let mut s = String::from("foo");
let _ = std::mem::replace(&mut s, String::default());
let s = &mut String::from("foo");
let _ = std::mem::replace(s, String::default());
let _ = std::mem::replace(s, Default::default());
let mut v = vec![123];
let _ = std::mem::... | let mut an_option = Some(1);
let _ = mem::replace(&mut an_option, None);
let an_option = &mut Some(1);
let _ = mem::replace(an_option, None);
} | random_line_split |
lib.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/. */
//! This module contains shared types and messages for use by devtools/script.
//! The traits are here instead of ... | extern crate cssparser;
extern crate euclid;
extern crate rustc_serialize;
extern crate serde;
extern crate util;
#[macro_use]
pub mod values;
pub mod viewport;
use cssparser::{Parser, SourcePosition};
pub trait ParseErrorReporter {
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &st... | random_line_split | |
graph.rs |
use std::f32;
use std::u16;
use std::fmt;
use std::cmp::Ordering;
use crate::utils::vec_filter;
//TODO: rename to Links and GraphState to Graph
pub type ID = u32;
#[derive(Clone, PartialEq)]
pub struct Link
{
pub from: ID,
pub to: ID,
pub quality: u16,
//bandwidth: u16,
//channel: u8
cost: u16,
}
impl Lin... |
}
true
}
pub fn remove_unconnected_nodes(&mut self) {
let mut remove = Vec::new();
for id in 0..self.node_count as ID {
if self.get_node_degree(id) == 0 {
remove.push(id);
}
}
self.remove_nodes(&remove);
}
pub fn node_count(&self) -> usize {
self.node_count
}
pub fn link_count(&self) -... | {
return false;
} | conditional_block |
graph.rs |
use std::f32;
use std::u16;
use std::fmt;
use std::cmp::Ordering;
use crate::utils::vec_filter;
//TODO: rename to Links and GraphState to Graph
pub type ID = u32;
#[derive(Clone, PartialEq)]
pub struct Link
{
pub from: ID,
pub to: ID,
pub quality: u16,
//bandwidth: u16,
//channel: u8
cost: u16,
}
impl Lin... | (links: &[Link], node_count: usize) -> Graph {
let mut roots = Vec::with_capacity(node_count);
let mut mst = Vec::new();
// initial root of every node is itself
for i in 0..node_count {
roots.push(i as ID);
}
// find root of node
fn root(roots: &mut [ID], i: ID) -> usize {
let mut i = i as usize;
... | minimum_spanning_tree_impl | identifier_name |
graph.rs | use std::f32;
use std::u16;
use std::fmt;
use std::cmp::Ordering;
use crate::utils::vec_filter;
//TODO: rename to Links and GraphState to Graph
pub type ID = u32;
#[derive(Clone, PartialEq)]
pub struct Link
{
pub from: ID,
pub to: ID,
pub quality: u16,
//bandwidth: u16,
//channel: u8
cost: u16,
}
impl Link... | while roots[i]!= i as ID {
// Path halving optimization
let tmp = roots[roots[i] as usize];
roots[i] = tmp;
i = tmp as usize;
}
i
}
for link in links {
let x = root(&mut roots, link.from);
let y = root(&mut roots, link.to);
if x!= y {
mst.push(link.clone());
roots[x] = roo... |
// find root of node
fn root(roots: &mut [ID], i: ID) -> usize {
let mut i = i as usize; | random_line_split |
graph.rs |
use std::f32;
use std::u16;
use std::fmt;
use std::cmp::Ordering;
use crate::utils::vec_filter;
//TODO: rename to Links and GraphState to Graph
pub type ID = u32;
#[derive(Clone, PartialEq)]
pub struct Link
{
pub from: ID,
pub to: ID,
pub quality: u16,
//bandwidth: u16,
//channel: u8
cost: u16,
}
impl Lin... | }
}
pub fn clear_links(&mut self) {
self.links.clear();
}
pub fn is_directed(&self) -> bool {
for link in &self.links {
if self.link_idx(link.to, link.from).is_none() {
return false;
}
}
true
}
pub fn remove_unconnected_nodes(&mut self) {
let mut remove = Vec::new();
for id in 0..self.... | {
match self.links.binary_search_by(|link| link.from.cmp(&id)) {
Ok(idx) => {
let mut start = idx;
let mut end = idx;
for i in (0..idx).rev() {
if self.links[i].from == id {
start = i;
}
}
for i in idx..self.links.len() {
if self.links[i].from == id {
end = i;
}
... | identifier_body |
reftest.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 ... |
let parts: ~[&str] = line.split(' ').filter(|p|!p.is_empty()).collect();
if parts.len()!= 3 {
fail!("reftest line: '{:s}' doesn't match 'KIND LEFT RIGHT'", line);
}
let kind = match parts[0] {
"==" => Same,
"!=" => Differ... | if line.starts_with("#") {
continue;
} | random_line_split |
reftest.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 ... |
fn capture(reftest: &Reftest, side: uint) -> png::Image {
let filename = format!("/tmp/servo-reftest-{:06u}-{:u}.png", reftest.id, side);
let mut args = reftest.servo_args.clone();
args.push_all_move(~[~"-f", ~"-o", filename.clone(), reftest.files[side].clone()]);
let retval = match Process::status("... | {
let name = reftest.name.clone();
TestDescAndFn {
desc: TestDesc {
name: DynTestName(name),
ignore: false,
should_fail: false,
},
testfn: DynTestFn(proc() {
check_reftest(reftest);
}),
}
} | identifier_body |
reftest.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 ... | (reftest: &Reftest, side: uint) -> png::Image {
let filename = format!("/tmp/servo-reftest-{:06u}-{:u}.png", reftest.id, side);
let mut args = reftest.servo_args.clone();
args.push_all_move(~[~"-f", ~"-o", filename.clone(), reftest.files[side].clone()]);
let retval = match Process::status("./servo", ar... | capture | identifier_name |
unsized3.rs | // Copyright 2014 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 ... | <T> {
f: [T],
}
struct Bar {
f1: usize,
f2: [usize],
}
struct Baz {
f1: usize,
f2: str,
}
trait Tr {
fn foo(&self) -> usize;
}
struct St {
f: usize
}
impl Tr for St {
fn foo(&self) -> usize {
self.f
}
}
struct Qux<'a> {
f: Tr+'a
}
pub fn main() {
let _: &Foo<f6... | Foo | identifier_name |
unsized3.rs | // Copyright 2014 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 ... | let x: &Baz = mem::transmute(slice::from_raw_parts(&*data, 5));
assert!(x.f1 == 42);
let chs: Vec<char> = x.f2.chars().collect();
assert!(chs.len() == 5);
assert!(chs[0] == 'a');
assert!(chs[1] == 'b');
assert!(chs[2] == 'c');
assert!(chs[3] == 'd');
... | let data: Box<_> = box Baz_ {
f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] }; | random_line_split |
rpc.rs | extern crate crypto;
use bytes::BytesMut;
use crypto::digest::Digest;
use encoding::{all::ISO_8859_1, DecoderTrap, EncoderTrap, Encoding};
use futures::SinkExt;
use tokio::{
io::{AsyncRead, AsyncWrite},
net::TcpStream,
stream::StreamExt,
};
use tokio_util::codec::{Decoder, Encoder, Framed};
use tracing::*;... | <Io> {
conn: Framed<Io, BoincCodec>,
}
impl DaemonStream<TcpStream> {
pub async fn connect(host: String, password: Option<String>) -> Result<Self, Error> {
Self::authenticate(TcpStream::connect(host).await?, password).await
}
}
impl<Io: AsyncRead + AsyncWrite + Unpin> DaemonStream<Io> {
async ... | DaemonStream | identifier_name |
rpc.rs | extern crate crypto;
use bytes::BytesMut;
use crypto::digest::Digest;
use encoding::{all::ISO_8859_1, DecoderTrap, EncoderTrap, Encoding};
use futures::SinkExt;
use tokio::{
io::{AsyncRead, AsyncWrite},
net::TcpStream,
stream::StreamExt,
};
use tokio_util::codec::{Decoder, Encoder, Framed};
use tracing::*;... |
pub(crate) async fn query(
&mut self,
request_data: Vec<treexml::Element>,
) -> Result<Vec<treexml::Element>, Error> {
self.conn.send(request_data).await?;
let data = self
.conn
.try_next()
.await?
.ok_or_else(|| Error::DaemonError("EO... | random_line_split | |
placement-in-syntax.rs | // 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 ... | //
// Compare with new-box-syntax.rs
use std::boxed::{Box, HEAP};
struct Structure {
x: isize,
y: isize,
}
pub fn main() {
let x: Box<isize> = in HEAP { 2 };
let b: Box<isize> = in HEAP { 1 + 2 };
let c = in HEAP { 3 + 4 };
let s: Box<Structure> = in HEAP {
Structure {
x:... |
// Tests that the new `in` syntax works with unique pointers. | random_line_split |
placement-in-syntax.rs | // 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 ... | () {
let x: Box<isize> = in HEAP { 2 };
let b: Box<isize> = in HEAP { 1 + 2 };
let c = in HEAP { 3 + 4 };
let s: Box<Structure> = in HEAP {
Structure {
x: 3,
y: 4,
}
};
}
| main | identifier_name |
placement-in-syntax.rs | // 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 ... | {
let x: Box<isize> = in HEAP { 2 };
let b: Box<isize> = in HEAP { 1 + 2 };
let c = in HEAP { 3 + 4 };
let s: Box<Structure> = in HEAP {
Structure {
x: 3,
y: 4,
}
};
} | identifier_body | |
lib.rs | /*!
# Kiss3d
Keep It Simple, Stupid 3d graphics engine.
This library is born from the frustration in front of the fact that today’s 3D
graphics library are:
* either too low level: you have to write your own shaders and opening a
window steals you 8 hours, 300 lines of code and 10L of coffee.
* or high level but t... | ```text
[dependencies.kiss3d]
git = "https://github.com/sebcrozet/kiss3d"
```
## Contributions
I’d love to see people improving this library for their own needs. However, keep in mind that
**Kiss3d** is KISS. One-liner features (from the user point of view) are preferred.
*/
#![deny(non_camel_case_types)]
#![deny(unu... | random_line_split | |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | (&self, msg: Message) -> Result<(), SendError<Message>> {
Ok(try!(self.tx.send(msg)))
}
}
impl<Message: Send +'static> Debug for ActorCell<Message> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
write!(f, "ActorCell")
}
}
impl<Message: Send +'static> Clone for ActorCell<Message> {
fn clone(&se... | send | identifier_name |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | }
});
ActorRef(
ActorRefEnum::DedicatedThread(
ActorCell {
tx: tx,
actor: actor
}
)
)
}
}
impl<Message: Send +'static> ActorRefImpl<Message> for ActorCell<Message> {
fn send(&self, msg: Message) -> Result<(), SendError<Message>> {
Ok(try!(self.tx.send(msg)))
}
}
impl<Message: S... | {
let (tx, rx) = channel();
let actor_box: Box<Actor<Message>> = Box::new(actor);
let actor = Arc::new(Mutex::new(actor_box));
let actor_for_thread = actor.clone();
thread::spawn( move|| {
let mut actor = actor_for_thread.lock().unwrap();
loop {
match rx.recv() {
Ok(msg) => {
debug!("Pr... | identifier_body |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | ,
Err(error) => {
debug!("Quitting: {:?}", error);
break;
},
}
}
});
ActorRef(
ActorRefEnum::DedicatedThread(
ActorCell {
tx: tx,
actor: actor
}
)
)
}
}
impl<Message: Send +'static> ActorRefImpl<Message> for ActorCell<Message> {
fn send(&self, msg: Message)... | {
debug!("Processing");
actor.process(msg);
} | conditional_block |
mod.rs | //! Dedicated single thread actor-ref implementations
use std::thread;
use std::sync::mpsc::{channel, Sender};
use std::sync::{Arc, Mutex};
use std::fmt::{self, Debug, Formatter};
use {Actor, ActorSpawner};
use {ActorRef, ActorRefImpl, ActorRefEnum};
use {SendError};
#[cfg(test)]
mod tests;
/// A simplistic enviro... | }
impl<Message: Send +'static> Debug for ActorCell<Message> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
write!(f, "ActorCell")
}
}
impl<Message: Send +'static> Clone for ActorCell<Message> {
fn clone(&self) -> ActorCell<Message> {
ActorCell {
tx: self.tx.clone(),
actor: self.actor.clon... | } | random_line_split |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... | (&self) -> &Model { self.model }
}
| deref | identifier_name |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... | Where::Simplex {
itrcnt: try!(callback.get_double(SIMPLEX, SPX_ITRCNT)),
objval: try!(callback.get_double(SIMPLEX, SPX_OBJVAL)),
priminf: try!(callback.get_double(SIMPLEX, SPX_PRIMINF)),
dualinf: try!(callback.get_double(SIMPLEX, SPX_DUALINF)),
ispert: try!(call... | {
let mut callback = Callback {
cbdata: cbdata,
where_: Where::Polling,
model: model
};
let where_ = match where_ {
POLLING => Where::Polling,
PRESOLVE => {
Where::PreSolve {
coldel: try!(callback.get_int(PRESOLVE, PRE_COLDEL)),
rowdel: try!(callbac... | identifier_body |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... |
MIP => {
Where::MIP {
objbst: try!(callback.get_double(MIP, MIP_OBJBST)),
objbnd: try!(callback.get_double(MIP, MIP_OBJBND)),
nodcnt: try!(callback.get_double(MIP, MIP_NODCNT)),
solcnt: try!(callback.get_double(MIP, MIP_SOLCNT)),
cutcnt: try!(callback.get... | {
Where::Simplex {
itrcnt: try!(callback.get_double(SIMPLEX, SPX_ITRCNT)),
objval: try!(callback.get_double(SIMPLEX, SPX_OBJVAL)),
priminf: try!(callback.get_double(SIMPLEX, SPX_PRIMINF)),
dualinf: try!(callback.get_double(SIMPLEX, SPX_DUALINF)),
ispert: try!(ca... | conditional_block |
callback.rs | // Copyright (c) 2016 Yusuke Sasaki
//
// This software is released under the MIT License.
// See http://opensource.org/licenses/mit-license.php or <LICENSE>.
use ffi;
use itertools::{Itertools, Zip};
use std::mem::transmute;
use std::ops::Deref;
use std::ptr::null;
use std::os::raw;
use error::{Error, Result};
use... | /// Current count of feasible solutions found.
solcnt: i32
},
/// Printing a log message
Message(String),
/// Currently in barrier.
Barrier {
/// Current barrier iteration count.
itrcnt: i32,
/// Primal objective value for current barrier iterate.
primobj: f64,
/// Dual objective... | /// Current best objective bound.
objbnd: f64,
/// Current explored node count.
nodcnt: f64, | random_line_split |
function.rs | use object::values::Value;
use object::string::InString;
use vm::opcode::Instruction;
#[derive(PartialEq,Eq,Hash,Debug,Clone)]
pub struct LocVar {
varname: InString,
startpc: u32, // first point where variable is active
endpc: u32 // first point where variable is dead
}
/... | code: Vec::new(),
p: Vec::new(),
lineinfo: Vec::new(),
locvars: Vec::new(),
upvalues: Vec::new(),
source: source,
linedefined: linedefined,
lastlinedefined: lastlinedefined,
nups: nups,
numparams: numparams,
is_vararg: is_vararg,
maxstac... | k: Vec::new(),
| random_line_split |
function.rs | use object::values::Value;
use object::string::InString;
use vm::opcode::Instruction;
#[derive(PartialEq,Eq,Hash,Debug,Clone)]
pub struct LocVar {
varname: InString,
startpc: u32, // first point where variable is active
endpc: u32 // first point where variable is dead
}
/... |
}
impl Proto {
pub fn new(source: InString,
linedefined: u32,
lastlinedefined: u32,
nups: u8,
numparams: u8,
is_vararg: u8,
maxstacksize: u8)
-> Proto {
Proto {
k: Vec::new(),
code: Vec::new(),
p: ... | {
LocVar {
varname: varname,
startpc: startpc,
endpc: endpc
}
} | identifier_body |
function.rs | use object::values::Value;
use object::string::InString;
use vm::opcode::Instruction;
#[derive(PartialEq,Eq,Hash,Debug,Clone)]
pub struct LocVar {
varname: InString,
startpc: u32, // first point where variable is active
endpc: u32 // first point where variable is dead
}
/... | (source: InString,
linedefined: u32,
lastlinedefined: u32,
nups: u8,
numparams: u8,
is_vararg: u8,
maxstacksize: u8)
-> Proto {
Proto {
k: Vec::new(),
code: Vec::new(),
p: Vec::new(),
lineinfo: Vec::n... | new | identifier_name |
lib.rs | #![cfg_attr(feature = "nightly-testing", plugin(clippy))]
#![cfg_attr(feature = "nightly-testing", feature(plugin))]
#![cfg_attr(feature = "nightly-testing", allow(used_underscore_binding))]
#![cfg_attr(not(feature = "with-syntex"), feature(rustc_private, plugin))]
#![cfg_attr(not(feature = "with-syntex"), plugin(quasi... | reg.add_attr("feature(custom_attribute)");
reg.add_decorator("derive_Serialize", ser::expand_derive_serialize);
reg.add_decorator("derive_Deserialize", de::expand_derive_deserialize);
reg.add_post_expansion_pass(strip_attributes);
}
#[cfg(not(feature = "with-syntex"))]
pub fn register(reg: &mut rustc... |
fold::Folder::fold_crate(&mut StripAttributeFolder, krate)
}
reg.add_attr("feature(custom_derive)"); | random_line_split |
lib.rs | #![cfg_attr(feature = "nightly-testing", plugin(clippy))]
#![cfg_attr(feature = "nightly-testing", feature(plugin))]
#![cfg_attr(feature = "nightly-testing", allow(used_underscore_binding))]
#![cfg_attr(not(feature = "with-syntex"), feature(rustc_private, plugin))]
#![cfg_attr(not(feature = "with-syntex"), plugin(quasi... | fold::noop_fold_mac(mac, self)
}
}
fold::Folder::fold_crate(&mut StripAttributeFolder, krate)
}
reg.add_attr("feature(custom_derive)");
reg.add_attr("feature(custom_attribute)");
reg.add_decorator("derive_Serialize", ser::expand_derive_serialize);
reg.a... | {
use syntax::{ast, fold};
/// Strip the serde attributes from the crate.
#[cfg(feature = "with-syntex")]
fn strip_attributes(krate: ast::Crate) -> ast::Crate {
/// Helper folder that strips the serde attributes after the extensions have been expanded.
struct StripAttributeFolder;
... | identifier_body |
lib.rs | #![cfg_attr(feature = "nightly-testing", plugin(clippy))]
#![cfg_attr(feature = "nightly-testing", feature(plugin))]
#![cfg_attr(feature = "nightly-testing", allow(used_underscore_binding))]
#![cfg_attr(not(feature = "with-syntex"), feature(rustc_private, plugin))]
#![cfg_attr(not(feature = "with-syntex"), plugin(quasi... |
_ => {}
}
Some(attr)
}
fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac {
fold::noop_fold_mac(mac, self)
}
}
fold::Folder::fold_crate(&mut StripAttributeFolder, krate)
}
reg.add_attr("fe... | { return None; } | conditional_block |
lib.rs | #![cfg_attr(feature = "nightly-testing", plugin(clippy))]
#![cfg_attr(feature = "nightly-testing", feature(plugin))]
#![cfg_attr(feature = "nightly-testing", allow(used_underscore_binding))]
#![cfg_attr(not(feature = "with-syntex"), feature(rustc_private, plugin))]
#![cfg_attr(not(feature = "with-syntex"), plugin(quasi... | ;
impl fold::Folder for StripAttributeFolder {
fn fold_attribute(&mut self, attr: ast::Attribute) -> Option<ast::Attribute> {
match attr.node.value.node {
ast::MetaItemKind::List(ref n, _) if n == &"serde" => { return None; }
_ => {}
... | StripAttributeFolder | identifier_name |
clients.rs | // Learn stuff about our users.
+ my name is *
- <set name=<formal>>Nice to meet you, <get name>.
- <set name=<formal>><get name>, nice to meet you.
+ my name is <bot master>
- <set name=<bot master>>That's my master's name too.
+ my name is <bot name>
- <set name=<bot name>>What a coincidence! That's my name too!
-... |
+ i have a girlfriend
- <set status=girlfriend>What's her name?
+ i have a boyfriend
- <set status=boyfriend>What's his name?
+ *
% whats her name
- <set spouse=<formal>>That's a pretty name.
+ *
% whats his name
- <set spouse=<formal>>That's a cool name.
+ my (girlfriend|boyfriend)* name is *
- <set spouse=<forma... | + my favorite * is *
- <set fav<star1>=<star2>>Why is it your favorite?
+ i am single
- <set status=single><set spouse=nobody>I am too. | random_line_split |
mod_dir_path.rs | // Copyright 2012-2014 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-MI... | {
assert_eq!(mod_dir_simple::syrup::foo(), 10);
#[path = "auxiliary"]
mod foo {
mod two_macros_2;
}
#[path = "auxiliary"]
mod bar {
macro_rules! m { () => { mod two_macros_2; } }
m!();
}
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.