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 |
|---|---|---|---|---|
day_3.rs | pub use tdd_kata::map_kata::day_3::HashMap;
#[test]
fn it_should_create_a_new_empty_map() {
let map = HashMap::new(10);
assert!(map.is_empty());
assert_eq!(map.size(), 0);
}
#[test]
fn it_should_increase_map_size_when_put() {
let mut map = HashMap::new(10);
let old_size = map.size();
map.put... | {
let mut map = HashMap::new(10);
map.put(1,1);
let old_size = map.size();
map.put(1,2);
assert_eq!(map.size(), old_size);
} | identifier_body | |
day_3.rs | pub use tdd_kata::map_kata::day_3::HashMap;
#[test]
fn it_should_create_a_new_empty_map() {
let map = HashMap::new(10);
assert!(map.is_empty());
assert_eq!(map.size(), 0); |
#[test]
fn it_should_increase_map_size_when_put() {
let mut map = HashMap::new(10);
let old_size = map.size();
map.put(1,1);
assert_eq!(map.size(), old_size+1);
}
#[test]
#[ignore]
fn it_should_contain_put_value() {
let mut map = HashMap::new(10);
map.put(1,1);
assert!(map.contains(1));... | } | random_line_split |
android_bitmap.rs | use core::prelude::*;
use core::raw;
use core::{ptr, mem};
use core::borrow::IntoCow;
use libc::c_void;
use jni::{jobject, jclass, jmethodID, JNIEnv};
use jni_constants::{JNI_TRUE, JNI_FALSE};
use android::bitmap::{AndroidBitmap_getInfo, AndroidBitmap_lockPixels, AndroidBitmap_unlockPixels, AndroidBitmapInfo};
use andr... | (&self) -> GLResult<&[u8]> {
match self.as_slice_unsafe() {
Ok(ok) => Ok(&*ok),
Err(err) => Err(err),
}
}
pub unsafe fn set_premultiplied(&mut self, premultiplied: bool) -> bool {
if let Some(set_premultiplied) = SET_PREMULTIPLIED {
let pm = if premul... | as_slice | identifier_name |
android_bitmap.rs | use core::prelude::*;
use core::raw;
use core::{ptr, mem};
use core::borrow::IntoCow;
use libc::c_void;
use jni::{jobject, jclass, jmethodID, JNIEnv};
use jni_constants::{JNI_TRUE, JNI_FALSE};
use android::bitmap::{AndroidBitmap_getInfo, AndroidBitmap_lockPixels, AndroidBitmap_unlockPixels, AndroidBitmapInfo};
use andr... | }
}
pub unsafe fn set_premultiplied(&mut self, premultiplied: bool) -> bool {
if let Some(set_premultiplied) = SET_PREMULTIPLIED {
let pm = if premultiplied { JNI_TRUE } else { JNI_FALSE };
((**self.env).CallVoidMethod)(self.env, self.obj, set_premultiplied, pm);
... | match self.as_slice_unsafe() {
Ok(ok) => Ok(&*ok),
Err(err) => Err(err), | random_line_split |
android_bitmap.rs | use core::prelude::*;
use core::raw;
use core::{ptr, mem};
use core::borrow::IntoCow;
use libc::c_void;
use jni::{jobject, jclass, jmethodID, JNIEnv};
use jni_constants::{JNI_TRUE, JNI_FALSE};
use android::bitmap::{AndroidBitmap_getInfo, AndroidBitmap_lockPixels, AndroidBitmap_unlockPixels, AndroidBitmapInfo};
use andr... |
pub unsafe fn set_premultiplied(&mut self, premultiplied: bool) -> bool {
if let Some(set_premultiplied) = SET_PREMULTIPLIED {
let pm = if premultiplied { JNI_TRUE } else { JNI_FALSE };
((**self.env).CallVoidMethod)(self.env, self.obj, set_premultiplied, pm);
true
... | {
match self.as_slice_unsafe() {
Ok(ok) => Ok(&*ok),
Err(err) => Err(err),
}
} | identifier_body |
htmlbodyelement.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::bindings::codegen::HTMLBodyElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBodyElementDeriv... | pub fn VLink(&self) -> DOMString {
~""
}
pub fn SetVLink(&self, _v_link: DOMString) -> ErrorResult {
Ok(())
}
pub fn ALink(&self) -> DOMString {
~""
}
pub fn SetALink(&self, _a_link: DOMString) -> ErrorResult {
Ok(())
}
pub fn BgColor(&self) -> DOM... | Ok(())
}
| random_line_split |
htmlbodyelement.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::bindings::codegen::HTMLBodyElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLBodyElementDeriv... | (&self) -> DOMString {
~""
}
pub fn SetALink(&self, _a_link: DOMString) -> ErrorResult {
Ok(())
}
pub fn BgColor(&self) -> DOMString {
~""
}
pub fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult {
Ok(())
}
pub fn Background(&self) -> DOMString ... | ALink | identifier_name |
base.rs | use std::borrow::Borrow;
use std::collections::HashSet;
use std::cmp::{max, min};
use structs::Point;
/// Trait wrapping base range implementation
pub trait Base: Borrow<Point> {
/// Find the points at the same height within the provided manhattan distance
fn base_range(&self, range: i32) -> HashSet<Point>;
}
im... | (&self, range: i32) -> HashSet<Point> {
let mut set: HashSet<Point> = HashSet::new();
for dq in -range..range + 1 {
let lower: i32 = max(-range, -dq - range);
let upper: i32 = min(range, -dq + range);
for ds in lower..upper + 1 {
let dr: i32 = -dq - ds;
let found = self.borro... | base_range | identifier_name |
base.rs | use std::borrow::Borrow;
use std::collections::HashSet;
use std::cmp::{max, min};
use structs::Point;
/// Trait wrapping base range implementation
pub trait Base: Borrow<Point> {
/// Find the points at the same height within the provided manhattan distance
fn base_range(&self, range: i32) -> HashSet<Point>;
}
im... |
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn base_range() {
let point: Point = Point(1, 2, 5);
let set: HashSet<Point> = point.base_range(&point, 1);
assert!(set.contains(&Point(1, 2, 5)));
assert!(set.contains(&Point(2, 2, 5)));
assert!(set.contains(&Point(1, 3, 5)));
assert!(s... | {
let mut set: HashSet<Point> = HashSet::new();
for dq in -range..range + 1 {
let lower: i32 = max(-range, -dq - range);
let upper: i32 = min(range, -dq + range);
for ds in lower..upper + 1 {
let dr: i32 = -dq - ds;
let found = self.borrow() + &Point(dq, dr, 0);
set.... | identifier_body |
base.rs | use std::borrow::Borrow;
use std::collections::HashSet;
use std::cmp::{max, min};
use structs::Point;
/// Trait wrapping base range implementation
pub trait Base: Borrow<Point> {
/// Find the points at the same height within the provided manhattan distance
fn base_range(&self, range: i32) -> HashSet<Point>;
}
im... | let found = self.borrow() + &Point(dq, dr, 0);
set.insert(found);
}
}
set
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn base_range() {
let point: Point = Point(1, 2, 5);
let set: HashSet<Point> = point.base_range(&point, 1);
assert!(set.contains(&Point(1, 2... | let lower: i32 = max(-range, -dq - range);
let upper: i32 = min(range, -dq + range);
for ds in lower..upper + 1 {
let dr: i32 = -dq - ds; | random_line_split |
mocks.rs | use crate::{
cart::Cart,
rom::{CHR_BANK_SIZE, PRG_BANK_SIZE},
};
pub struct CartMock {
pub prg: [u8; PRG_BANK_SIZE],
pub chr: [u8; CHR_BANK_SIZE],
}
impl Default for CartMock {
fn default() -> Self {
CartMock {
prg: [0; PRG_BANK_SIZE],
chr: [0; CHR_BANK_SIZE],
... | (&mut self, addr: u16, value: u8) {
self.prg[addr as usize] = value
}
fn read_chr(&self, addr: u16) -> u8 {
self.chr[addr as usize]
}
fn write_chr(&mut self, addr: u16, value: u8) {
self.chr[addr as usize] = value
}
}
| write_prg | identifier_name |
mocks.rs | use crate::{
cart::Cart,
rom::{CHR_BANK_SIZE, PRG_BANK_SIZE},
};
pub struct CartMock {
pub prg: [u8; PRG_BANK_SIZE],
pub chr: [u8; CHR_BANK_SIZE],
}
impl Default for CartMock {
fn default() -> Self {
CartMock {
prg: [0; PRG_BANK_SIZE],
chr: [0; CHR_BANK_SIZE],
... | fn read_prg(&self, addr: u16) -> u8 {
self.prg[addr as usize]
}
fn write_prg(&mut self, addr: u16, value: u8) {
self.prg[addr as usize] = value
}
fn read_chr(&self, addr: u16) -> u8 {
self.chr[addr as usize]
}
fn write_chr(&mut self, addr: u16, value: u8) {
... | }
}
impl Cart for CartMock { | random_line_split |
build.rs | use std::env;
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use time::{strftime, now};
use std::process::Command;
fn main() {
let version = env::var("CARGO_PKG_VERSION").unwrap();
let timestamp = strftime("%F %H:%M:%S %z", &now()).unwrap();
let commit = get_head_comm... | (contents: &str, filename: &str) {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let file = out_dir.join(filename);
let debug_path = file.to_str().unwrap().to_string();
File::create(file)
.expect(&format!("Unable to create file {:?}", debug_path))
.write_all(contents.as_byt... | write | identifier_name |
build.rs | use std::env;
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use time::{strftime, now};
use std::process::Command;
fn main() {
let version = env::var("CARGO_PKG_VERSION").unwrap();
let timestamp = strftime("%F %H:%M:%S %z", &now()).unwrap();
let commit = get_head_comm... | } | File::create(file)
.expect(&format!("Unable to create file {:?}", debug_path))
.write_all(contents.as_bytes())
.expect(&format!("Unable to write string '{}' to file {:?}", contents, debug_path)); | random_line_split |
build.rs | use std::env;
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use time::{strftime, now};
use std::process::Command;
fn main() {
let version = env::var("CARGO_PKG_VERSION").unwrap();
let timestamp = strftime("%F %H:%M:%S %z", &now()).unwrap();
let commit = get_head_comm... | {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let file = out_dir.join(filename);
let debug_path = file.to_str().unwrap().to_string();
File::create(file)
.expect(&format!("Unable to create file {:?}", debug_path))
.write_all(contents.as_bytes())
.expect(&format!(... | identifier_body | |
lib.rs | #![crate_name = "mockstream"]
#![crate_type = "lib"]
//! A reader/writer streams to mock real streams in tests.
use std::cell::RefCell;
use std::io::{Cursor, Error, ErrorKind, Read, Result, Write};
use std::mem::swap;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std:... |
}
}
impl Read for FailingMockStream {
fn read(&mut self, _: &mut [u8]) -> Result<usize> {
self.error()
}
}
impl Write for FailingMockStream {
fn write(&mut self, _: &[u8]) -> Result<usize> {
self.error()
}
fn flush(&mut self) -> Result<()> {
Ok(())
}
}
| {
if self.repeat_count > 0 {
self.repeat_count -= 1;
}
Err(Error::new(self.kind, self.message))
} | conditional_block |
lib.rs | #![crate_name = "mockstream"]
#![crate_type = "lib"]
//! A reader/writer streams to mock real streams in tests.
use std::cell::RefCell;
use std::io::{Cursor, Error, ErrorKind, Read, Result, Write};
use std::mem::swap;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std:... | (&mut self, _: &[u8]) -> Result<usize> {
self.error()
}
fn flush(&mut self) -> Result<()> {
Ok(())
}
}
| write | identifier_name |
lib.rs | #![crate_name = "mockstream"]
#![crate_type = "lib"]
//! A reader/writer streams to mock real streams in tests.
use std::cell::RefCell;
use std::io::{Cursor, Error, ErrorKind, Read, Result, Write};
use std::mem::swap;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std:... | fn write(&mut self, buf: &[u8]) -> Result<usize> {
self.pimpl.borrow_mut().write(buf)
}
fn flush(&mut self) -> Result<()> {
self.pimpl.borrow_mut().flush()
}
}
/// Thread-safe stream.
#[derive(Clone, Default)]
pub struct SyncMockStream {
pimpl: Arc<Mutex<MockStream>>,
pub waiti... | impl Write for SharedMockStream { | random_line_split |
lib.rs | #![crate_name = "mockstream"]
#![crate_type = "lib"]
//! A reader/writer streams to mock real streams in tests.
use std::cell::RefCell;
use std::io::{Cursor, Error, ErrorKind, Read, Result, Write};
use std::mem::swap;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std:... |
}
impl Read for SharedMockStream {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
self.pimpl.borrow_mut().read(buf)
}
}
impl Write for SharedMockStream {
fn write(&mut self, buf: &[u8]) -> Result<usize> {
self.pimpl.borrow_mut().write(buf)
}
fn flush(&mut self) -> Result<(... | {
self.pimpl.borrow_mut().pop_bytes_written()
} | identifier_body |
WindowClass.rs | /**
Window Class Structures (Windows) / WNDCLASS structure (Windows)
**/
extern crate std;
use super::super::prelude::{
UINT, WNDPROC, CCINT, HINSTANCE, HICON, HCURSOR,
HBRUSH, LPCTSTR, wapi, ToWindowTextConvertion,
Application, Cursor, Icon, Text, WindowProcedure,
Atom, Brush, WindowService, Wi... | }
}
pub fn unregister(&self, app : Option<Application>) -> bool {
WindowService::UnregisterClass(self.lpszClassName, app)
}
} |
pub fn RegisterClass(&self) -> Atom {
unsafe {
wapi::WindowClass::RegisterClassW(self as *const WNDCLASS) | random_line_split |
WindowClass.rs | /**
Window Class Structures (Windows) / WNDCLASS structure (Windows)
**/
extern crate std;
use super::super::prelude::{
UINT, WNDPROC, CCINT, HINSTANCE, HICON, HCURSOR,
HBRUSH, LPCTSTR, wapi, ToWindowTextConvertion,
Application, Cursor, Icon, Text, WindowProcedure,
Atom, Brush, WindowService, Wi... | {
style : UINT , /* WindowClassStyle */
lpfnWndProc : WNDPROC , /* WindowProcedure */
cbClsExtra : CCINT , /* CCINT */
cbWndExtra : CCINT , /* CCINT */
hInstance : HINSTANCE , /* Application */
hIcon : HICON , /* Icon */
hCursor : H... | WindowClass | identifier_name |
chain_params.rs | use super::{UInt256,ConsensusParams};
pub enum Chain {
MAIN,
TESTNET,
REGTEST, | }
pub struct ChainParams {
pub id : Chain,
pub message_start : [u8;4],
pub consensus: ConsensusParams,
}
lazy_static! {
#[allow(dead_code)]
static ref CHAIN_MAIN:ChainParams = ChainParams{
id : Chain::MAIN,
message_start : [ 0xf9, 0xbe, 0xb4, 0xd9 ],
consensus: ConsensusParams {
... | random_line_split | |
chain_params.rs | use super::{UInt256,ConsensusParams};
pub enum Chain {
MAIN,
TESTNET,
REGTEST,
}
pub struct | {
pub id : Chain,
pub message_start : [u8;4],
pub consensus: ConsensusParams,
}
lazy_static! {
#[allow(dead_code)]
static ref CHAIN_MAIN:ChainParams = ChainParams{
id : Chain::MAIN,
message_start : [ 0xf9, 0xbe, 0xb4, 0xd9 ],
consensus: ConsensusParams {
hash_genesis_block: U... | ChainParams | identifier_name |
show.rs | use rustc_serialize::json;
| use types::{Config, Playlist, Runnable};
use utils;
pub struct Show {
playlist: Vec<Box<Runnable>>,
dmx: DmxOutput
}
impl Show {
/// Creates a new show starting at playlist item at index offset, 0-indexed
pub fn new(cfg: &Config, proj_name: &str, dmx_port: &str, offset: u32) -> Result<Show, Error> {
... | use DmxOutput;
use error::Error; | random_line_split |
show.rs | use rustc_serialize::json;
use DmxOutput;
use error::Error;
use types::{Config, Playlist, Runnable};
use utils;
pub struct Show {
playlist: Vec<Box<Runnable>>,
dmx: DmxOutput
}
impl Show {
/// Creates a new show starting at playlist item at index offset, 0-indexed
pub fn new(cfg: &Config, proj_name:... |
}
| {
// Run show
for show_item in self.playlist.into_iter() {
let _ = try!(show_item.run(&mut self.dmx));
}
Ok(())
} | identifier_body |
show.rs | use rustc_serialize::json;
use DmxOutput;
use error::Error;
use types::{Config, Playlist, Runnable};
use utils;
pub struct Show {
playlist: Vec<Box<Runnable>>,
dmx: DmxOutput
}
impl Show {
/// Creates a new show starting at playlist item at index offset, 0-indexed
pub fn | (cfg: &Config, proj_name: &str, dmx_port: &str, offset: u32) -> Result<Show, Error> {
println!("Creating DMX outputter");
let dmx = try!(DmxOutput::new(dmx_port));
println!("Reading playlist");
let plist_path = Playlist::get_path(cfg, proj_name);
let plist_json = try!(u... | new | identifier_name |
permutationtable.rs | use math::{Point2, Point3, Point4};
use rand::{Rand, Rng, SeedableRng, XorShiftRng};
use std::fmt;
const TABLE_SIZE: usize = 256;
/// A seed table, required by all noise functions.
///
/// Table creation is expensive, so in most circumstances you'll only want to
/// create one of these per generator.
#[derive(Copy, C... | (&self, pos: Point4<isize>) -> usize {
let w = (pos[3] & 0xff) as usize;
self.values[self.get3([pos[0], pos[1], pos[2]]) ^ w] as usize
}
}
impl fmt::Debug for PermutationTable {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "PermutationTable {{.. }}")
}
}
#[cfg(t... | get4 | identifier_name |
permutationtable.rs | use math::{Point2, Point3, Point4};
use rand::{Rand, Rng, SeedableRng, XorShiftRng};
use std::fmt;
const TABLE_SIZE: usize = 256;
/// A seed table, required by all noise functions.
///
/// Table creation is expensive, so in most circumstances you'll only want to
/// create one of these per generator.
#[derive(Copy, C... |
}
impl PermutationTable {
/// Deterministically generates a new permutation table based on a `u32` seed value.
///
/// Internally this uses a `XorShiftRng`, but we don't really need to worry
/// about cryptographic security when working with procedural noise.
pub fn new(seed: u32) -> PermutationTa... | {
let mut seq: Vec<u8> = (0..TABLE_SIZE).map(|x| x as u8).collect();
rng.shuffle(&mut *seq);
// It's unfortunate that this double-initializes the array, but Rust
// doesn't currently provide a clean way to do this in one pass. Hopefully
// it won't matter, as Seed creation will ... | identifier_body |
permutationtable.rs | use math::{Point2, Point3, Point4};
use rand::{Rand, Rng, SeedableRng, XorShiftRng};
use std::fmt;
const TABLE_SIZE: usize = 256;
/// A seed table, required by all noise functions.
///
/// Table creation is expensive, so in most circumstances you'll only want to
/// create one of these per generator.
#[derive(Copy, C... | }
} | let _ = perlin.get([-1.0, 2.0, 3.0]); | random_line_split |
compression.rs | //! A middleware for compressing all transmitted data.
use crate::{wire, Error};
use flate2;
use std::io::prelude::*;
use std::io::Cursor;
/// Defines a compression algorithm.
#[derive(Copy, Clone, Debug)]
pub enum Algorithm
{
/// The zlib compression algorithm.
///
/// https://en.wikipedia.org/wiki/Zlib... |
impl wire::Middleware for Compression
{
fn encode_data(&mut self, data: Vec<u8>) -> Result<Vec<u8>, Error> {
match *self {
Compression::Enabled(algorithm) => match algorithm {
Algorithm::Zlib => {
let e = flate2::write::ZlibEncoder::new(data, flate2::Compress... | random_line_split | |
compression.rs | //! A middleware for compressing all transmitted data.
use crate::{wire, Error};
use flate2;
use std::io::prelude::*;
use std::io::Cursor;
/// Defines a compression algorithm.
#[derive(Copy, Clone, Debug)]
pub enum Algorithm
{
/// The zlib compression algorithm.
///
/// https://en.wikipedia.org/wiki/Zlib... |
{
/// No compression or decompression should be applied to the data.
Disabled,
/// Compression and decompression should be applied to the data.
Enabled(Algorithm),
}
impl wire::Middleware for Compression
{
fn encode_data(&mut self, data: Vec<u8>) -> Result<Vec<u8>, Error> {
match *self {
... | Compression | identifier_name |
day22.rs | use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::HashSet;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use itertools::Itertools;
use regex::Regex;
use common::Solution;
type Coordinate = (usize, usize);
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, De... |
let mut new_state = State {
grid: state.grid.clone(),
empty_pos: switch,
pos: if switch == state.pos { state.empty_pos } else { state.pos },
};
if!visited.contains(&(new_state.pos, new_state.empty_pos)) {
... | {
// Not enough capacity
continue;
} | conditional_block |
day22.rs | use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::HashSet;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use itertools::Itertools;
use regex::Regex;
use common::Solution;
type Coordinate = (usize, usize);
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, De... | self.read_input(input);
let fitting = iproduct!(&self.nodes, &self.nodes)
.filter(|&(_, b)| b.used > 0)
.filter(|&(a, b)| a!= b)
.filter(|&(a, b)| a.fits(*b))
.count();
fitting.to_string()
}
fn part2(&mut self, input: &mut Read) -> String {... |
impl Solution for Day22 {
fn part1(&mut self, input: &mut Read) -> String { | random_line_split |
day22.rs | use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::HashSet;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use itertools::Itertools;
use regex::Regex;
use common::Solution;
type Coordinate = (usize, usize);
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, De... | {
pos: Coordinate,
empty_pos: Coordinate,
grid: Vec<usize>,
}
impl State {
fn estimate(&self) -> usize {
self.pos.0 + self.pos.1
+ self.pos.0.max(self.empty_pos.0) + self.pos.1.max(self.empty_pos.1)
- self.pos.0.min(self.empty_pos.0) - self.pos.1.min(self.empty_pos.1)
... | State | identifier_name |
day22.rs | use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::collections::HashSet;
use std::io::BufRead;
use std::io::BufReader;
use std::io::Read;
use itertools::Itertools;
use regex::Regex;
use common::Solution;
type Coordinate = (usize, usize);
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, De... |
fn part2(&mut self, input: &mut Read) -> String {
self.read_input(input);
let (size, used, capacity) = self.build_grid();
let (empty_pos, _) = used.iter()
.find_position(|&&used| used == 0)
.unwrap();
let height = used.len() / size;
let state = Sta... | {
self.read_input(input);
let fitting = iproduct!(&self.nodes, &self.nodes)
.filter(|&(_, b)| b.used > 0)
.filter(|&(a, b)| a != b)
.filter(|&(a, b)| a.fits(*b))
.count();
fitting.to_string()
} | identifier_body |
privacy4.rs | // 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 ... | () {}
}
}
pub fn foo() {}
fn test2() {
use bar::glob::gpriv; //~ ERROR: function `gpriv` is private
gpriv();
}
#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }
| gpriv | identifier_name |
privacy4.rs | // 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 ... | // Test to make sure that private items imported through globs remain private
// when they're used.
mod bar {
pub use self::glob::*;
mod glob {
fn gpriv() {}
}
}
pub fn foo() {}
fn test2() {
use bar::glob::gpriv; //~ ERROR: function `gpriv` is private
gpriv();
}
#[start] fn main(_: isi... | random_line_split | |
privacy4.rs | // 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 ... |
#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 }
| {
use bar::glob::gpriv; //~ ERROR: function `gpriv` is private
gpriv();
} | identifier_body |
angle.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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{Parse, ParserContext};
use std::f32::consts::P... |
}
impl Angle {
/// Creates an angle with the given value in degrees.
#[inline]
pub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self {
Angle {
value: AngleDimension::Deg(value),
was_calc,
}
}
/// Returns the value of the angle in degrees, mostly for ... | {
Angle {
value: AngleDimension::Deg(computed.degrees()),
was_calc: false,
}
} | identifier_body |
angle.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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{Parse, ParserContext};
use std::f32::consts::P... | if self.was_calc {
dest.write_str("calc(")?;
}
self.value.to_css(dest)?;
if self.was_calc {
dest.write_str(")")?;
}
Ok(())
}
}
impl ToComputedValue for Angle {
type ComputedValue = ComputedAngle;
#[inline]
fn to_computed_value(&se... | impl ToCss for Angle {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{ | random_line_split |
angle.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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{Parse, ParserContext};
use std::f32::consts::P... | (degrees: CSSFloat) -> Self {
Angle {
value: AngleDimension::Deg(degrees),
was_calc: true,
}
}
}
/// Whether to allow parsing an unitless zero as a valid angle.
///
/// This should always be `No`, except for exceptions like:
///
/// https://github.com/w3c/fxtf-drafts/issue... | from_calc | identifier_name |
lualib.rs | pub mod raw {
use libc::c_int;
use raw::lua_State;
pub static LUA_COLIBNAME: &'static str = "coroutine";
pub static LUA_TABLIBNAME: &'static str = "table";
pub static LUA_IOLIBNAME: &'static str = "io";
pub static LUA_OSLIBNAME: &'static str = "os";
pub static LUA_STRLIBNAME: &'static str =... | }
} | random_line_split | |
currency.rs | use params::to_snakecase;
/// Currency is the list of supported currencies.
///
/// For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash)]
pub enum Currency {
#[serde(rename = "aed")]
AED, // Uni... | "thb" => Ok(Currency::THB),
"tjs" => Ok(Currency::TJS),
"top" => Ok(Currency::TOP),
"try" => Ok(Currency::TRY),
"ttd" => Ok(Currency::TTD),
"twd" => Ok(Currency::TWD),
"tzs" => Ok(Currency::TZS),
"uah" => Ok(Currency::UAH),
... | "szl" => Ok(Currency::SZL), | random_line_split |
currency.rs | use params::to_snakecase;
/// Currency is the list of supported currencies.
///
/// For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash)]
pub enum Currency {
#[serde(rename = "aed")]
AED, // Uni... | ));
impl ::std::fmt::Display for ParseCurrencyError {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
fmt.write_str(::std::error::Error::description(self))
}
}
impl ::std::error::Error for ParseCurrencyError {
fn description(&self) -> &str {
"unknown currency code"
... | or(/* private */ ( | identifier_name |
currency.rs | use params::to_snakecase;
/// Currency is the list of supported currencies.
///
/// For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash)]
pub enum Currency {
#[serde(rename = "aed")]
AED, // Uni... | str::FromStr for Currency {
type Err = ParseCurrencyError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"aed" => Ok(Currency::AED),
"afn" => Ok(Currency::AFN),
"all" => Ok(Currency::ALL),
"amd" => Ok(Currency::AMD),
"ang" => Ok(C... | (f, "{}", to_snakecase(&format!("{:?}", self)))
}
}
impl ::std:: | identifier_body |
communication.rs | use futures_util::{SinkExt, StreamExt};
use log::*;
use tokio::{
io::{AsyncRead, AsyncWrite},
net::{TcpListener, TcpStream},
};
use tokio_tungstenite::{accept_async, client_async, WebSocketStream};
use tungstenite::Message;
async fn run_connection<S>(
connection: WebSocketStream<S>,
msg_tx: futures_cha... |
con_rx.await.expect("Server not ready");
let tcp = TcpStream::connect("127.0.0.1:12346").await.expect("Failed to connect");
let url = url::Url::parse("ws://localhost:12345/").unwrap();
let (stream, _) = client_async(url, tcp).await.expect("Client failed to connect");
let (mut tx, _rx) = stream.spli... | {
let _ = env_logger::try_init();
let (con_tx, con_rx) = futures_channel::oneshot::channel();
let (msg_tx, msg_rx) = futures_channel::oneshot::channel();
let f = async move {
let listener = TcpListener::bind("127.0.0.1:12346").await.unwrap();
info!("Server ready");
con_tx.send(... | identifier_body |
communication.rs | use futures_util::{SinkExt, StreamExt};
use log::*;
use tokio::{
io::{AsyncRead, AsyncWrite},
net::{TcpListener, TcpStream},
};
use tokio_tungstenite::{accept_async, client_async, WebSocketStream};
use tungstenite::Message;
async fn run_connection<S>(
connection: WebSocketStream<S>,
msg_tx: futures_cha... | let (mut stream, _) = client_async(url, tcp).await.expect("Client failed to connect");
for i in 1..10 {
info!("Sending message");
stream.send(Message::Text(format!("{}", i))).await.expect("Failed to send message");
}
stream.close(None).await.expect("Failed to close");
info!("Waiti... | info!("Waiting for server to be ready");
con_rx.await.expect("Server not ready");
let tcp = TcpStream::connect("127.0.0.1:12345").await.expect("Failed to connect");
let url = "ws://localhost:12345/"; | random_line_split |
communication.rs | use futures_util::{SinkExt, StreamExt};
use log::*;
use tokio::{
io::{AsyncRead, AsyncWrite},
net::{TcpListener, TcpStream},
};
use tokio_tungstenite::{accept_async, client_async, WebSocketStream};
use tungstenite::Message;
async fn | <S>(
connection: WebSocketStream<S>,
msg_tx: futures_channel::oneshot::Sender<Vec<Message>>,
) where
S: AsyncRead + AsyncWrite + Unpin,
{
info!("Running connection");
let mut connection = connection;
let mut messages = vec![];
while let Some(message) = connection.next().await {
info!... | run_connection | identifier_name |
atomic_max_acq.rs | #![feature(core, core_intrinsics)]
extern crate core;
#[cfg(test)]
mod tests {
use core::intrinsics::atomic_max_acq;
use core::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
// pub fn atomic_max_acq<T>(dst: *mut T, src: T) -> T;
struct A<T> {
v: UnsafeCell<T>
}
unsafe imp... | () {
atomic_max_acq_test!(!0, 0, 0 );
}
}
| atomic_max_acq_test1 | identifier_name |
atomic_max_acq.rs | #![feature(core, core_intrinsics)]
extern crate core;
#[cfg(test)]
mod tests {
use core::intrinsics::atomic_max_acq;
use core::cell::UnsafeCell;
use std::sync::Arc;
use std::thread;
// pub fn atomic_max_acq<T>(dst: *mut T, src: T) -> T;
struct A<T> {
v: UnsafeCell<T>
}
unsafe imp... |
assert_eq!(old, $init);
});
thread::sleep_ms(10);
let ptr: *mut T = data.v.get();
assert_eq!(unsafe { *ptr }, $result);
})
}
#[test]
fn atomic_max_acq_test1() {
atomic_max_acq_test!(!0, 0, 0 );
}
} |
thread::spawn(move || {
let dst: *mut T = clone.v.get();
let src: T = $value;
let old: T = unsafe { atomic_max_acq::<T>(dst, src) }; | random_line_split |
istr.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 test_append() {
let mut s = ~"";
s += ~"a";
assert!((s == ~"a"));
let mut s = ~"a";
s += ~"b";
debug!(s.clone());
assert!((s == ~"ab"));
let mut s = ~"c";
s += ~"offee";
assert!((s == ~"coffee"));
s += ~"&tea";
assert!((s == ~"coffee&tea"));
}
pub fn main() {
t... | }
| random_line_split |
istr.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 test_stack_add() {
assert!((~"a" + ~"b" == ~"ab"));
let s: ~str = ~"a";
assert!((s + s == ~"aa"));
assert!((~"" + ~"" == ~""));
}
fn test_stack_heap_add() { assert!((~"a" + ~"bracadabra" == ~"abracadabra")); }
fn test_heap_add() {
assert!((~"this should" + ~" totally work" == ~"this should to... | { let s = ~"a big ol' string"; debug!(s); } | identifier_body |
istr.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 ... | () {
assert!((~"this should" + ~" totally work" == ~"this should totally work"));
}
fn test_append() {
let mut s = ~"";
s += ~"a";
assert!((s == ~"a"));
let mut s = ~"a";
s += ~"b";
debug!(s.clone());
assert!((s == ~"ab"));
let mut s = ~"c";
s += ~"offee";
assert!((s == ~"... | test_heap_add | identifier_name |
symbolic_color.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use StyleProperties;
use ffi;
use gdk;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::fmt;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialEq... | unsafe {
from_glib_full(ffi::gtk_symbolic_color_new_alpha(color.to_glib_none().0, factor))
}
}
#[cfg_attr(feature = "v3_8", deprecated)]
pub fn new_literal(color: &gdk::RGBA) -> SymbolicColor {
assert_initialized_main_thread!();
unsafe {
from_glib_ful... | assert_initialized_main_thread!(); | random_line_split |
symbolic_color.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use StyleProperties;
use ffi;
use gdk;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::fmt;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialEq... | <'a, P: Into<Option<&'a StyleProperties>>>(&self, props: P) -> Option<gdk::RGBA> {
let props = props.into();
let props = props.to_glib_none();
unsafe {
let mut resolved_color = gdk::RGBA::uninitialized();
let ret = from_glib(ffi::gtk_symbolic_color_resolve(self.to_glib_no... | resolve | identifier_name |
symbolic_color.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use StyleProperties;
use ffi;
use gdk;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::fmt;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialEq... |
#[cfg_attr(feature = "v3_8", deprecated)]
pub fn new_name(name: &str) -> SymbolicColor {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gtk_symbolic_color_new_name(name.to_glib_none().0))
}
}
#[cfg_attr(feature = "v3_8", deprecated)]
pub fn new... | {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gtk_symbolic_color_new_mix(color1.to_glib_none().0, color2.to_glib_none().0, factor))
}
} | identifier_body |
symbolic_color.rs | // This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use StyleProperties;
use ffi;
use gdk;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::fmt;
use std::mem;
use std::ptr;
glib_wrapper! {
#[derive(Debug, PartialEq... |
}
}
#[cfg_attr(feature = "v3_8", deprecated)]
fn to_string(&self) -> String {
unsafe {
from_glib_full(ffi::gtk_symbolic_color_to_string(self.to_glib_none().0))
}
}
}
impl fmt::Display for SymbolicColor {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fm... | { None } | conditional_block |
lib.rs |
pub trait TakeWhileWithFailureIterator: Iterator {
fn take_while_with_failure<P>(self, predicate: P) -> TakeWhileWithFailure<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized {
TakeWhileWithFailure{iter: self, flag: false, predicate: predicate}
}
}
/// An iterator that accepts ... |
#[test]
fn it_works_on_empty_vecs() {
let empty_vec: Vec<i64> = Vec::new();
assert_eq!(empty_vec.iter().take_while_with_failure(|_| true).collect::<Vec<&i64>>().len(), 0);
}
| {
assert_eq!(vec![2,4,5,6].iter().take_while_with_failure(|_| true).collect::<Vec<&i64>>(), vec![&2,&4,&5,&6]);
} | identifier_body |
lib.rs | pub trait TakeWhileWithFailureIterator: Iterator {
fn take_while_with_failure<P>(self, predicate: P) -> TakeWhileWithFailure<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized {
TakeWhileWithFailure{iter: self, flag: false, predicate: predicate}
}
}
/// An iterator that accepts e... | (0, upper) // can't know a lower bound, due to the predicate
}
}
impl<'a, I: Iterator +?Sized> TakeWhileWithFailureIterator for I {
/// Creates an iterator that yields elements as long as the predicate returns true.
/// Additionally, it includes the first element that returns false, after which n... | #[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let (_, upper) = self.iter.size_hint(); | random_line_split |
lib.rs |
pub trait TakeWhileWithFailureIterator: Iterator {
fn take_while_with_failure<P>(self, predicate: P) -> TakeWhileWithFailure<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized {
TakeWhileWithFailure{iter: self, flag: false, predicate: predicate}
}
}
/// An iterator that accepts ... | (&self) -> (usize, Option<usize>) {
let (_, upper) = self.iter.size_hint();
(0, upper) // can't know a lower bound, due to the predicate
}
}
impl<'a, I: Iterator +?Sized> TakeWhileWithFailureIterator for I {
/// Creates an iterator that yields elements as long as the predicate returns true.
... | size_hint | identifier_name |
lib.rs |
pub trait TakeWhileWithFailureIterator: Iterator {
fn take_while_with_failure<P>(self, predicate: P) -> TakeWhileWithFailure<Self, P> where
P: FnMut(&Self::Item) -> bool, Self: Sized {
TakeWhileWithFailure{iter: self, flag: false, predicate: predicate}
}
}
/// An iterator that accepts ... |
Some(x)
})
}
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
let (_, upper) = self.iter.size_hint();
(0, upper) // can't know a lower bound, due to the predicate
}
}
impl<'a, I: Iterator +?Sized> TakeWhileWithFailureIterator for I {
... | {
self.flag = true;
} | conditional_block |
unrooted_must_root.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 rustc::hir;
use rustc::hir::intravisit as visit;
use rustc::hir::map as ast_map;
use rustc::lint::{LateContext... | () -> UnrootedPass {
UnrootedPass
}
}
/// Checks if a type is unrooted or contains any owned unrooted types
fn is_unrooted_ty(cx: &LateContext, ty: &ty::TyS, in_new_function: bool) -> bool {
let mut ret = false;
ty.maybe_walk(|t| {
match t.sty {
ty::TyAdt(did, _) => {
... | new | identifier_name |
unrooted_must_root.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 rustc::hir;
use rustc::hir::intravisit as visit;
use rustc::hir::map as ast_map;
use rustc::lint::{LateContext... | ty::TyRef(..) => false, // don't recurse down &ptrs
ty::TyRawPtr(..) => false, // don't recurse down *ptrs
ty::TyFnDef(..) | ty::TyFnPtr(_) => false,
_ => true
}
});
ret
}
impl LintPass for UnrootedPass {
fn get_lints(&self) -> LintArray {
lin... | true
}
},
ty::TyBox(..) if in_new_function => false, // box in new() is okay | random_line_split |
unrooted_must_root.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 rustc::hir;
use rustc::hir::intravisit as visit;
use rustc::hir::map as ast_map;
use rustc::lint::{LateContext... | else if match_def_path(cx, did.did, &["core", "cell", "Ref"])
|| match_def_path(cx, did.did, &["core", "cell", "RefMut"])
|| match_def_path(cx, did.did, &["core", "slice", "Iter"])
|| match_def_path(cx, did.did, &["std", "collections", "hash", "ma... | {
false
} | conditional_block |
task.rs | // Copyright 2012-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-MI... |
#[test]
fn test_try_future() {
let result = TaskBuilder::new().try_future(proc() {});
assert!(result.unwrap().is_ok());
let result = TaskBuilder::new().try_future(proc() -> () {
panic!();
});
assert!(result.unwrap().is_err());
}
#[test]
fn test... | {
let (tx, rx) = channel();
TaskBuilder::new().spawn(proc() {
tx.send(());
});
rx.recv();
} | identifier_body |
task.rs | // Copyright 2012-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-MI... | (mut self, stderr: Box<Writer + Send>) -> TaskBuilder {
self.stderr = Some(stderr);
self
}
// Where spawning actually happens (whether yielding a future or not)
fn spawn_internal(self, f: proc():Send,
on_exit: Option<proc(Result<(), Box<Any + Send>>):Send>) {
l... | stderr | identifier_name |
task.rs | // Copyright 2012-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-MI... |
#[test]
fn test_run_basic() {
let (tx, rx) = channel();
TaskBuilder::new().spawn(proc() {
tx.send(());
});
rx.recv();
}
#[test]
fn test_try_future() {
let result = TaskBuilder::new().try_future(proc() {});
assert!(result.unwrap().is_ok())... | fn test_send_named_task() {
TaskBuilder::new().named("ada lovelace".into_cow()).try(proc() {
assert!(name().unwrap() == "ada lovelace");
}).map_err(|_| ()).unwrap();
} | random_line_split |
urlhint.rs | // Copyright 2015-2017 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 lat... | () -> Self {
FakeRegistrar {
calls: Arc::new(Mutex::new(Vec::new())),
responses: Mutex::new(
vec![
Ok(format!("000000000000000000000000{}", URLHINT).from_hex().unwrap()),
Ok(Vec::new())
]
),
}
}
}
impl ContractClient for FakeRegistrar {
fn registrar(&self) -> Result<Addres... | new | identifier_name |
urlhint.rs | // Copyright 2015-2017 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 lat... |
impl URLHint for URLHintContract {
fn resolve(&self, id: Bytes) -> BoxFuture<Option<URLHintResult>, String> {
use futures::future::Either;
let do_call = |_, data| {
let addr = match self.client.registrar() {
Ok(addr) => addr,
Err(e) => return Box::new(future::err(e))
as BoxFuture<Vec<u8>, _>,
... | repo: repo,
commit: commit,
owner: owner,
}))
} | random_line_split |
urlhint.rs | // Copyright 2015-2017 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 lat... |
}
/// Hash-Addressed Content
#[derive(Debug, PartialEq)]
pub struct Content {
/// URL of the content
pub url: String,
/// MIME type of the content
pub mime: Mime,
/// Content owner address
pub owner: Address,
}
/// Result of resolving id to URL
#[derive(Debug, PartialEq)]
pub enum URLHintResult {
/// Dapp
Da... | {
if bytes.len() < COMMIT_LEN {
return None;
}
let mut commit = [0; COMMIT_LEN];
for i in 0..COMMIT_LEN {
commit[i] = bytes[i];
}
Some(commit)
} | identifier_body |
generic-extern-mangle.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 ... | () {
assert_eq!(99u8, foo(255u8, 100u8));
assert_eq!(99u16, foo(65535u16, 100u16));
}
| main | identifier_name |
generic-extern-mangle.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 ... | fn main() {
assert_eq!(99u8, foo(255u8, 100u8));
assert_eq!(99u16, foo(65535u16, 100u16));
} | random_line_split | |
generic-extern-mangle.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 ... |
fn main() {
assert_eq!(99u8, foo(255u8, 100u8));
assert_eq!(99u16, foo(65535u16, 100u16));
}
| { a.wrapping_add(b) } | identifier_body |
pointing.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/. */
//! Specified values for Pointing properties.
//!
//! https://drafts.csswg.org/css-ui/#pointing-keyboard
use styl... | /// https://drafts.csswg.org/css-ui/#cursor
#[cfg(feature = "servo")]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub struct Cursor(pub CursorKind);
/// The specified value for the `cursor` property.
///
/// https://drafts.csswg.org/css-ui/#cursor
#[cfg(feature = "gecko")]
#[derive(C... | /// | random_line_split |
pointing.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/. */
//! Specified values for Pointing properties.
//!
//! https://drafts.csswg.org/css-ui/#pointing-keyboard
use styl... | (pub CursorKind);
/// The specified value for the `cursor` property.
///
/// https://drafts.csswg.org/css-ui/#cursor
#[cfg(feature = "gecko")]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Cursor {
/// The parsed images for the cursor.
pub images: Box<[CursorImage]>,
/// The ... | Cursor | identifier_name |
stock_maximize.rs | use std::io;
use std::io::BufRead;
fn stock_maximize(stock_values: &Vec<i64>) -> i64 {
let mut money = 0i64;
let mut current_max = *stock_values.last().unwrap();
for stock_values in stock_values.iter().rev() {
if *stock_values <= current_max {
money += current_max - stock_values;
... |
#[test]
fn sample2() {
assert_eq!(197, super::stock_maximize(&vec![1, 2, 100]));
}
#[test]
fn sample3() {
assert_eq!(3, super::stock_maximize(&vec![1, 3, 1, 2]));
}
//&(1..250).collect()
#[test]
fn big() {
super::stock_maximize(&(1..40000).collect());
... | {
assert_eq!(0, super::stock_maximize(&vec![5, 3, 2]));
} | identifier_body |
stock_maximize.rs | use std::io;
use std::io::BufRead;
fn stock_maximize(stock_values: &Vec<i64>) -> i64 {
let mut money = 0i64;
let mut current_max = *stock_values.last().unwrap();
for stock_values in stock_values.iter().rev() {
if *stock_values <= current_max {
money += current_max - stock_values;
... | () {
super::stock_maximize(&(1..40000).collect());
}
} | big | identifier_name |
stock_maximize.rs | use std::io;
use std::io::BufRead;
fn stock_maximize(stock_values: &Vec<i64>) -> i64 {
let mut money = 0i64;
let mut current_max = *stock_values.last().unwrap();
for stock_values in stock_values.iter().rev() {
if *stock_values <= current_max {
money += current_max - stock_values;
... | .map(|value| value.parse::<i64>().unwrap())
.take(count)
.collect();
results.push(stock_maximize(&values));
}
for result in results.iter() {
println!("{}", result);
}
}
#[cfg(test)]
mod tests {
#[test]
fn sample1() {
assert_eq!(0, super::sto... | while let Some(line_count) = lines_enum.next() {
let count = line_count.unwrap().trim().parse::<usize>().unwrap();
let line_values = lines_enum.next().unwrap().unwrap();
let values: Vec<i64> = line_values.trim().split(' ') | random_line_split |
stock_maximize.rs | use std::io;
use std::io::BufRead;
fn stock_maximize(stock_values: &Vec<i64>) -> i64 {
let mut money = 0i64;
let mut current_max = *stock_values.last().unwrap();
for stock_values in stock_values.iter().rev() {
if *stock_values <= current_max | else {
current_max = *stock_values;
}
}
money
}
#[allow(dead_code)]
fn main() {
let stdin = io::stdin();
let mut lines = stdin.lock().lines();
let first_line = lines.next().unwrap().unwrap();
let t = first_line.trim().parse::<usize>().unwrap();
let mut lines_enum = line... | {
money += current_max - stock_values;
} | conditional_block |
htmldlistelement.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::bindings::codegen::Bindings::HTMLDListElementBinding;
use dom::bindings::js::Root;
use dom::bindings::str... | HTMLDListElement {
htmlelement:
HTMLElement::new_inherited(localName, prefix, document)
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDListElement> {
... | htmlelement: HTMLElement
}
impl HTMLDListElement {
fn new_inherited(localName: Atom, prefix: Option<DOMString>, document: &Document) -> HTMLDListElement { | random_line_split |
htmldlistelement.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::bindings::codegen::Bindings::HTMLDListElementBinding;
use dom::bindings::js::Root;
use dom::bindings::str... |
#[allow(unrooted_must_root)]
pub fn new(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> Root<HTMLDListElement> {
let element = HTMLDListElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDListElem... | {
HTMLDListElement {
htmlelement:
HTMLElement::new_inherited(localName, prefix, document)
}
} | identifier_body |
htmldlistelement.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::bindings::codegen::Bindings::HTMLDListElementBinding;
use dom::bindings::js::Root;
use dom::bindings::str... | (localName: Atom, prefix: Option<DOMString>, document: &Document) -> HTMLDListElement {
HTMLDListElement {
htmlelement:
HTMLElement::new_inherited(localName, prefix, document)
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: Atom,
prefix: Opt... | new_inherited | identifier_name |
mod.rs | //! Collision detection algorithms and structure for the Narrow Phase.
#[doc(inline)]
pub use self::collision_detector::{CollisionDetector, CollisionDispatcher, CollisionAlgorithm};
pub use self::ball_ball::BallBall;
pub use self::plane_support_map::{PlaneSupportMap, SupportMapPlane};
pub use self::support_map_support_... | mod plane_support_map;
mod support_map_support_map;
mod incremental_contact_manifold_generator;
mod one_shot_contact_manifold_generator;
mod composite_shape_repr;
mod basic_collision_dispatcher; | pub mod collision_detector;
#[doc(hidden)]
pub mod contact_signal;
mod ball_ball; | random_line_split |
unexpand.rs | #![crate_name = "unexpand"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Virgile Andreani <virgile.andreani@anbuco.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#![feature(macro_rules)]
extern crate geto... | (s: String) -> Vec<uint> {
let words = s.as_slice().split(',').collect::<Vec<&str>>();
let nums = words.into_iter()
.map(|sn| from_str::<uint>(sn)
.unwrap_or_else(
|| crash!(1, "{}\n", "tab size contains invalid character(s)"))
)
.collect::<Vec<uint>>();
... | tabstops_parse | identifier_name |
unexpand.rs | #![crate_name = "unexpand"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Virgile Andreani <virgile.andreani@anbuco.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#![feature(macro_rules)]
extern crate geto... | file_buf = match io::File::open(&Path::new(path.as_slice())) {
Ok(a) => a,
_ => crash!(1, "{}: {}\n", path, "No such file or directory")
};
io::BufferedReader::new(box file_buf as Box<Reader>)
}
}
fn is_tabstop(tabstops: &[uint], col: uint) -> bool {
match tabsto... | random_line_split | |
unexpand.rs | #![crate_name = "unexpand"]
/*
* This file is part of the uutils coreutils package.
*
* (c) Virgile Andreani <virgile.andreani@anbuco.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#![feature(macro_rules)]
extern crate geto... | if is_tabstop(ts, col) {
nspaces = 0;
col += 1;
safe_write!(&mut output, "{}", '\t');
}
match to_next_stop(ts, col) {
Some(to_next) => {
... | {
let mut output = io::stdout();
let ts = options.tabstops.as_slice();
for file in options.files.into_iter() {
let mut col = 0;
let mut nspaces = 0;
let mut init = true;
for c in open(file).chars() {
match c {
Ok(' ') => {
if i... | identifier_body |
frame_allocator.rs | use super::frame::{Frame, FrameAllocator};
use super::PAGE_SIZE;
use ::kern::console as con;
use con::LogLevel::*;
use collections::Vec;
const UNIT: usize = PAGE_SIZE;
#[derive(Debug)]
pub struct BuddyAllocator {
pub start: usize,
pub size: usize,
tree: Vec<usize>
}
impl BuddyAllocator {
pub fn new(... | (&self, n: usize) -> Option<usize> {
if n >= self.tree.len() {
None
} else {
let o = (n+1).next_power_of_two() / 2;
let chunk = self.size / o;
let offset = chunk * (n - o);
return Some(self.start + offset * UNIT);
}
}
fn mark_u... | address_of | identifier_name |
frame_allocator.rs | use super::frame::{Frame, FrameAllocator};
use super::PAGE_SIZE;
use ::kern::console as con;
use con::LogLevel::*;
use collections::Vec;
const UNIT: usize = PAGE_SIZE;
#[derive(Debug)]
pub struct BuddyAllocator {
pub start: usize,
pub size: usize,
tree: Vec<usize>
}
impl BuddyAllocator {
pub fn new(... | } | random_line_split | |
frame_allocator.rs | use super::frame::{Frame, FrameAllocator};
use super::PAGE_SIZE;
use ::kern::console as con;
use con::LogLevel::*;
use collections::Vec;
const UNIT: usize = PAGE_SIZE;
#[derive(Debug)]
pub struct BuddyAllocator {
pub start: usize,
pub size: usize,
tree: Vec<usize>
}
impl BuddyAllocator {
pub fn new(... |
let mut offset = (addr - self.start) / UNIT;
if offset >= self.size { return; }
let mut size = 1;
let mut n = offset + self.size;
while self.tree[n]!= 0 {
n = n / 2;
size *= 2;
}
self.tree[n] = size;
while n > 1 {
n... | { return; } | conditional_block |
frame_allocator.rs | use super::frame::{Frame, FrameAllocator};
use super::PAGE_SIZE;
use ::kern::console as con;
use con::LogLevel::*;
use collections::Vec;
const UNIT: usize = PAGE_SIZE;
#[derive(Debug)]
pub struct BuddyAllocator {
pub start: usize,
pub size: usize,
tree: Vec<usize>
}
impl BuddyAllocator {
pub fn new(... |
pub fn dump(&self) {
for i in 1..self.tree.len() {
if i.is_power_of_two() {
printk!(Debug, "\n");
}
printk!(Debug, "{} ", self.tree[i]);
}
printk!(Debug, "\n");
}
fn address_of(&self, n: usize) -> Option<usize> {
if n >= ... | {
let size = size / UNIT;
let size = if size.is_power_of_two() { size } else { size.next_power_of_two() / 2 };
let mut tree = vec![0; size*2];
for i in 1..tree.len() {
tree[i] = size * 2 / (i+1).next_power_of_two();
}
printk!(Info, "BuddyAllocator {:x}\n", tr... | identifier_body |
associated-types-eq-3.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 ... |
pub fn baz(x: &Foo<A=Bar>) {
let _: Bar = x.boo();
}
pub fn main() {
let a = 42i;
foo1(a); //~ERROR expected usize, found struct Bar
baz(&a); //~ERROR expected usize, found struct Bar
}
| {
let _: Bar = x.boo(); //~ERROR mismatched types
} | identifier_body |
associated-types-eq-3.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 ... | fn boo(&self) -> <Self as Foo>::A;
}
struct Bar;
impl Foo for int {
type A = uint;
fn boo(&self) -> uint {
42
}
}
fn foo1<I: Foo<A=Bar>>(x: I) {
let _: Bar = x.boo();
}
fn foo2<I: Foo>(x: I) {
let _: Bar = x.boo(); //~ERROR mismatched types
}
pub fn baz(x: &Foo<A=Bar>) {
let _:... | // Test equality constraints on associated types. Check we get type errors
// where we should.
pub trait Foo {
type A; | random_line_split |
associated-types-eq-3.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 ... | <I: Foo>(x: I) {
let _: Bar = x.boo(); //~ERROR mismatched types
}
pub fn baz(x: &Foo<A=Bar>) {
let _: Bar = x.boo();
}
pub fn main() {
let a = 42i;
foo1(a); //~ERROR expected usize, found struct Bar
baz(&a); //~ERROR expected usize, found struct Bar
}
| foo2 | identifier_name |
snake.rs | use std::collections::VecDeque;
const SNAKE_LENGTH: i32 = 5;
const ROWS: u8 = 30;
const COLS: u8 = 30;
pub enum Direction {
Up,
Down,
Left,
Right,
None,
}
pub struct Snake {
pub p: VecDeque<(i32, i32)>,
pub d: Direction,
}
pub struct Food {
pub p: (i32, i32),
pub f: FoodType,
}
... | (&mut self, d: Direction) {
match (&self.d, &d) {
(&Direction::Up, &Direction::Down) |
(&Direction::Down, &Direction::Up) |
(&Direction::Left, &Direction::Right) |
(&Direction::Right, &Direction::Left) => {}
_ => self.d = d,
}
}
pub fn... | set_direction | identifier_name |
snake.rs | use std::collections::VecDeque;
const SNAKE_LENGTH: i32 = 5;
const ROWS: u8 = 30;
const COLS: u8 = 30;
pub enum Direction {
Up,
Down,
Left,
Right,
None,
}
pub struct Snake {
pub p: VecDeque<(i32, i32)>,
pub d: Direction,
}
pub struct Food {
pub p: (i32, i32),
pub f: FoodType,
}
... | impl Snake {
pub fn new() -> Self {
Snake {
p: VecDeque::new(),
d: Direction::None,
}
}
pub fn collide_with_tail(&self) -> bool {
let h = self.p.front().unwrap();
self.p.iter().skip(1).any(|&p| p == *h)
}
pub fn collide_with_food(&self, food: ... | f: FoodType::Apple,
}
}
}
| random_line_split |
snake.rs | use std::collections::VecDeque;
const SNAKE_LENGTH: i32 = 5;
const ROWS: u8 = 30;
const COLS: u8 = 30;
pub enum Direction {
Up,
Down,
Left,
Right,
None,
}
pub struct Snake {
pub p: VecDeque<(i32, i32)>,
pub d: Direction,
}
pub struct Food {
pub p: (i32, i32),
pub f: FoodType,
}
... |
pub fn collide_with_edge(&self) -> bool {
(self.p[0].0 < 0) | (self.p[0].1 < 0) | (self.p[0].1 < 0) | (self.p[0].1 >= COLS as i32) | (self.p[0].0 >= ROWS as i32)
}
}
| {
match (&self.d, &d) {
(&Direction::Up, &Direction::Down) |
(&Direction::Down, &Direction::Up) |
(&Direction::Left, &Direction::Right) |
(&Direction::Right, &Direction::Left) => {}
_ => self.d = d,
}
} | identifier_body |
unboxed-closures-infer-recursive-fn.rs | // run-pass
#![feature(fn_traits, unboxed_closures)]
use std::marker::PhantomData;
// Test that we are able to infer a suitable kind for a "recursive"
// closure. As far as I can tell, coding up a recursive closure
// requires the good ol' [Y Combinator].
//
// [Y Combinator]: https://en.wikipedia.org/wiki/Fixed-poi... |
};
let factorial: YCombinator<_,u32,u32> = YCombinator::new(factorial);
let r = factorial(10);
assert_eq!(3628800, r);
}
| {arg * recur(arg-1)} | conditional_block |
unboxed-closures-infer-recursive-fn.rs | // run-pass
#![feature(fn_traits, unboxed_closures)]
use std::marker::PhantomData;
// Test that we are able to infer a suitable kind for a "recursive"
// closure. As far as I can tell, coding up a recursive closure
// requires the good ol' [Y Combinator].
//
// [Y Combinator]: https://en.wikipedia.org/wiki/Fixed-poi... | (f: F) -> YCombinator<F,A,R> {
YCombinator { func: f, marker: PhantomData }
}
}
impl<A,R,F : Fn(&dyn Fn(A) -> R, A) -> R> Fn<(A,)> for YCombinator<F,A,R> {
extern "rust-call" fn call(&self, (arg,): (A,)) -> R {
(self.func)(self, arg)
}
}
impl<A,R,F : Fn(&dyn Fn(A) -> R, A) -> R> FnMut<(A,)... | new | identifier_name |
unboxed-closures-infer-recursive-fn.rs | // run-pass
#![feature(fn_traits, unboxed_closures)]
use std::marker::PhantomData;
// Test that we are able to infer a suitable kind for a "recursive"
// closure. As far as I can tell, coding up a recursive closure
// requires the good ol' [Y Combinator].
//
// [Y Combinator]: https://en.wikipedia.org/wiki/Fixed-poi... |
impl<A,R,F : Fn(&dyn Fn(A) -> R, A) -> R> Fn<(A,)> for YCombinator<F,A,R> {
extern "rust-call" fn call(&self, (arg,): (A,)) -> R {
(self.func)(self, arg)
}
}
impl<A,R,F : Fn(&dyn Fn(A) -> R, A) -> R> FnMut<(A,)> for YCombinator<F,A,R> {
extern "rust-call" fn call_mut(&mut self, args: (A,)) -> R { ... | YCombinator { func: f, marker: PhantomData }
}
} | random_line_split |
unboxed-closures-infer-recursive-fn.rs | // run-pass
#![feature(fn_traits, unboxed_closures)]
use std::marker::PhantomData;
// Test that we are able to infer a suitable kind for a "recursive"
// closure. As far as I can tell, coding up a recursive closure
// requires the good ol' [Y Combinator].
//
// [Y Combinator]: https://en.wikipedia.org/wiki/Fixed-poi... |
}
impl<A,R,F : Fn(&dyn Fn(A) -> R, A) -> R> Fn<(A,)> for YCombinator<F,A,R> {
extern "rust-call" fn call(&self, (arg,): (A,)) -> R {
(self.func)(self, arg)
}
}
impl<A,R,F : Fn(&dyn Fn(A) -> R, A) -> R> FnMut<(A,)> for YCombinator<F,A,R> {
extern "rust-call" fn call_mut(&mut self, args: (A,)) -> R... | {
YCombinator { func: f, marker: PhantomData }
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.