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
drop-trait-enum.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!(receiver.recv().unwrap(), Message::DestructorRan); assert_eq!(receiver.recv().unwrap(), Message::Dropped); assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); assert_eq!(receiver.recv().unwrap(), Message::Dropped); assert_eq!(receiver.recv().unwrap(), Message::DestructorR...
SendOnDrop { sender: sender.clone() }, sender.clone()); v = Foo::SimpleVariant(sender.clone()); v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; })
random_line_split
drop-trait-enum.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 main() { let (sender, receiver) = channel(); { let v = Foo::SimpleVariant(sender); } assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); assert_eq!(receiver.recv().ok(), None); let (sender, receiver) = channel(); { let v = Foo::NestedVariant(box 42, Send...
{ match self { &mut Foo::SimpleVariant(ref mut sender) => { sender.send(Message::DestructorRan).unwrap(); } &mut Foo::NestedVariant(_, _, ref mut sender) => { sender.send(Message::DestructorRan).unwrap(); } &mut Foo::Fai...
identifier_body
drop-trait-enum.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 ...
{ sender: Sender<Message> } impl Drop for SendOnDrop { fn drop(&mut self) { self.sender.send(Message::Dropped).unwrap(); } } enum Foo { SimpleVariant(Sender<Message>), NestedVariant(Box<usize>, SendOnDrop, Sender<Message>), FailingVariant { on_drop: SendOnDrop } } impl Drop for Foo {...
SendOnDrop
identifier_name
assert-eq-macro-success.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 ...
{ x : int } pub fn main() { assert_eq!(14,14); assert_eq!("abc".to_string(),"abc".to_string()); assert_eq!(box Point{x:34},box Point{x:34}); assert_eq!(&Point{x:34},&Point{x:34}); assert_eq!(@Point{x:34},@Point{x:34}); }
Point
identifier_name
assert-eq-macro-success.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 main() { assert_eq!(14,14); assert_eq!("abc".to_string(),"abc".to_string()); assert_eq!(box Point{x:34},box Point{x:34}); assert_eq!(&Point{x:34},&Point{x:34}); assert_eq!(@Point{x:34},@Point{x:34}); }
#[deriving(PartialEq, Show)] struct Point { x : int }
random_line_split
common.rs
build::Br(*bcx, out.llbb); reachable = true; } } if!reachable { build::Unreachable(out); } return out; } } // Heap selectors. Indicate which heap something should go on. #[deriving(Eq)] pub enum heap { heap_managed, heap_exchange, ...
random_line_split
common.rs
llvm::LLVMDisposeBuilder(self.b); } } } pub fn BuilderRef_res(b: BuilderRef) -> BuilderRef_res { BuilderRef_res { b: b } } pub type ExternMap = HashMap<~str, ValueRef>; // Here `self_ty` is the real type of the self parameter to this method. It // will only be set in the case of...
{ node_id_type(bcx, ex.id) }
identifier_body
common.rs
dependency; this causes the rust driver * to locate an extern crate, scan its compilation metadata, and emit extern * declarations for any symbols used by the declaring crate. * * A "foreign" is an extern that references C (or other non-rust ABI) code. * There is no metadata to scan for extern references so in th...
(&self, e: &ast::Expr) -> bool { ty::expr_is_lval(self.tcx(), self.ccx().maps.method_map, e) } pub fn expr_kind(&self, e: &ast::Expr) -> ty::ExprKind { ty::expr_kind(self.tcx(), self.ccx().maps.method_map, e) } pub fn def(&self, nid: ast::NodeId) -> ast::Def { match self.tcx()....
expr_is_lval
identifier_name
remutex.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 ...
self) -> TryLockResult<ReentrantMutexGuard<T>> { if unsafe { self.inner.try_lock() } { Ok(try!(ReentrantMutexGuard::new(&self))) } else { Err(TryLockError::WouldBlock) } } } impl<T> Drop for ReentrantMutex<T> { fn drop(&mut self) { // This is actually saf...
y_lock(&
identifier_name
remutex.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 ...
lse { Err(TryLockError::WouldBlock) } } } impl<T> Drop for ReentrantMutex<T> { fn drop(&mut self) { // This is actually safe b/c we know that there is no further usage of // this mutex (it's up to the user to arrange for a mutex to get // dropped, that's not our job)...
Ok(try!(ReentrantMutexGuard::new(&self))) } e
conditional_block
remutex.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 c = m.lock().unwrap(); assert_eq!(*c, ()); } assert_eq!(*b, ()); } assert_eq!(*a, ()); } } #[test] fn is_mutex() { let m = Arc::new(ReentrantMutex::new(RefCell::new(0))); ...
{ let b = m.lock().unwrap();
random_line_split
remutex.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 ...
impl<'mutex, T> ReentrantMutexGuard<'mutex, T> { fn new(lock: &'mutex ReentrantMutex<T>) -> LockResult<ReentrantMutexGuard<'mutex, T>> { poison::map_result(lock.poison.borrow(), |guard| { ReentrantMutexGuard { __lock: lock, __poison: guard, ...
match self.try_lock() { Ok(guard) => write!(f, "ReentrantMutex {{ data: {:?} }}", &*guard), Err(TryLockError::Poisoned(err)) => { write!(f, "ReentrantMutex {{ data: Poisoned({:?}) }}", &**err.get_ref()) }, Err(TryLockError::WouldBlock) => write!(f,...
identifier_body
buffer.rs
use std::ffi::c_void; use std::cell::Cell; use std::fmt; use std::ops::Deref; pub unsafe trait BufferType: ::lv2::core::PortType { type BufferImpl: PortBuffer +'static; } pub unsafe trait PortBuffer { fn get_ptr(&self) -> *mut c_void; fn get_size(&self) -> usize; } #[derive(Clone, Default)] pub struct Ce...
dst.set(src) } } } unsafe impl<T: Copy> PortBuffer for VecBuffer<T> { #[inline] fn get_ptr(&self) -> *mut c_void { self.inner.as_ptr() as _ } #[inline] fn get_size(&self) -> usize { self.inner.len() } // type BufferType = SampleDependentBufferType<T...
pub fn set_all<I: IntoIterator<Item=T>>(&self, iter: I) { for (src, dst) in iter.into_iter().zip(&self.inner) {
random_line_split
buffer.rs
use std::ffi::c_void; use std::cell::Cell; use std::fmt; use std::ops::Deref; pub unsafe trait BufferType: ::lv2::core::PortType { type BufferImpl: PortBuffer +'static; } pub unsafe trait PortBuffer { fn get_ptr(&self) -> *mut c_void; fn get_size(&self) -> usize; } #[derive(Clone, Default)] pub struct Ce...
// type BufferType = SampleDependentBufferType<T>; } impl<T: Copy + fmt::Debug> fmt::Debug for VecBuffer<T> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fmt::Debug::fmt(&self.get(), f) } } unsafe impl BufferType for ::lv2::core::ports::Audio { type BufferImpl = VecBuff...
{ self.inner.len() }
identifier_body
buffer.rs
use std::ffi::c_void; use std::cell::Cell; use std::fmt; use std::ops::Deref; pub unsafe trait BufferType: ::lv2::core::PortType { type BufferImpl: PortBuffer +'static; } pub unsafe trait PortBuffer { fn get_ptr(&self) -> *mut c_void; fn get_size(&self) -> usize; } #[derive(Clone, Default)] pub struct Ce...
(&self, value: T) { self.inner.replace(value); } } unsafe impl<T: Copy> PortBuffer for CellBuffer<T> { #[inline] fn get_ptr(&self) -> *mut c_void { self.inner.as_ptr() as _ } #[inline] fn get_size(&self) -> usize { 1 } } unsafe impl BufferType for ::lv2::core::port...
set
identifier_name
part1.rs
// adventofcode - day 9 // part 1 use std::io::prelude::*; use std::fs::File; use std::collections::HashSet; struct Graph { nodes: Option<Vec<String>>, matrix: Option<Vec<Vec<i32>>>, } impl Graph { fn new(names: HashSet<&str>) -> Graph { let mut graph = Graph{nodes: None, matrix: None}; ...
{ let mut file = match File::open("../../inputs/09.txt") { Ok(f) => f, Err(e) => panic!("file error: {}", e), }; let mut data = String::new(); match file.read_to_string(&mut data){ Ok(_) => {}, Err(e) => panic!("file error: {}", e), }; // remove trailing \n ...
identifier_body
part1.rs
// adventofcode - day 9 // part 1 use std::io::prelude::*; use std::fs::File; use std::collections::HashSet; struct Graph { nodes: Option<Vec<String>>, matrix: Option<Vec<Vec<i32>>>, } impl Graph { fn new(names: HashSet<&str>) -> Graph { let mut graph = Graph{nodes: None, matrix: None}; ...
.collect::<Vec<String>>(); let length = info[2].parse::<i32>().unwrap(); graph.insert_edge(&info[0], &info[1], length); } Some(graph) } // This function simply imports the data set from a file called input.txt fn import_data() -> String { let mut file = ...
for line in data.lines(){ let info = line.split(" to ") .flat_map(|s| s.split(" = ")) .map(|s| s.parse::<String>().unwrap())
random_line_split
part1.rs
// adventofcode - day 9 // part 1 use std::io::prelude::*; use std::fs::File; use std::collections::HashSet; struct Graph { nodes: Option<Vec<String>>, matrix: Option<Vec<Vec<i32>>>, } impl Graph { fn new(names: HashSet<&str>) -> Graph { let mut graph = Graph{nodes: None, matrix: None}; ...
() -> String { let mut file = match File::open("../../inputs/09.txt") { Ok(f) => f, Err(e) => panic!("file error: {}", e), }; let mut data = String::new(); match file.read_to_string(&mut data){ Ok(_) => {}, Err(e) => panic!("file error: {}", e), }; // remove tra...
import_data
identifier_name
step7_quote.rs
#![feature(exit_status)] extern crate mal; use std::collections::HashMap; use std::env as stdenv; use mal::types::{MalVal, MalRet, MalError, err_str}; use mal::types::{symbol, _nil, string, list, vector, hash_map, malfunc}; use mal::types::MalError::{ErrString, ErrMalVal}; use mal::types::MalType::{Nil, False, Sym, ...
return Ok(tmp.clone()); } let ref a0 = *args[0]; match *a0 { Sym(ref a0sym) => (args, &a0sym[..]), _ => (args, "__<fn*>__"), } }, _ => return err_str("Expected list"), }; match a0sym { "def!"...
{ 'tco: loop { //println!("eval: {}, {}", ast, env.borrow()); //println!("eval: {}", ast); match *ast { List(_,_) => (), // continue _ => return eval_ast(ast, env), } // apply list match *ast { List(_,_) => (), // continue _ => return Ok(ast), } l...
identifier_body
step7_quote.rs
#![feature(exit_status)] extern crate mal; use std::collections::HashMap; use std::env as stdenv; use mal::types::{MalVal, MalRet, MalError, err_str}; use mal::types::{symbol, _nil, string, list, vector, hash_map, malfunc}; use mal::types::MalError::{ErrString, ErrMalVal}; use mal::types::MalType::{Nil, False, Sym, ...
(x: MalVal) -> bool { match *x { List(ref lst,_) | Vector(ref lst,_) => lst.len() > 0, _ => false, } } fn quasiquote(ast: MalVal) -> MalVal { if!is_pair(ast.clone()) { return list(vec![symbol("quote"), ast]) } match *ast.clone() { List(ref args,_) | Vector(ref args,...
is_pair
identifier_name
step7_quote.rs
#![feature(exit_status)] extern crate mal; use std::collections::HashMap; use std::env as stdenv; use mal::types::{MalVal, MalRet, MalError, err_str}; use mal::types::{symbol, _nil, string, list, vector, hash_map, malfunc}; use mal::types::MalError::{ErrString, ErrMalVal}; use mal::types::MalType::{Nil, False, Sym, ...
return list(vec![symbol("quote"), ast]) } match *ast.clone() { List(ref args,_) | Vector(ref args,_) => { let ref a0 = args[0]; match **a0 { Sym(ref s) if *s == "unquote" => return args[1].clone(), _ => (), } if is_...
fn quasiquote(ast: MalVal) -> MalVal { if !is_pair(ast.clone()) {
random_line_split
main.rs
extern crate graphics; extern crate freetype as ft; extern crate opengl_graphics; extern crate piston; extern crate find_folder; #[cfg(feature = "include_sdl2")] extern crate sdl2_window; #[cfg(feature = "include_glfw")] extern crate glfw_window; #[cfg(feature = "include_glutin")] extern crate glutin_window; #[cfg(fe...
).unwrap(); res.push((texture, [(x + g.bitmap_left()) as f64, (y - g.bitmap_top()) as f64])); x += (g.advance().x >> 6) as i32; y += (g.advance().y >> 6) as i32; } res } fn render_text<G, T>(glyphs: &[(T, [f64; 2])], c: &Context, gl: &mut G) where G: Graphics<Texture = T>, ...
let texture = Texture::from_memory_alpha( bitmap.buffer(), bitmap.width() as u32, bitmap.rows() as u32, &TextureSettings::new()
random_line_split
main.rs
extern crate graphics; extern crate freetype as ft; extern crate opengl_graphics; extern crate piston; extern crate find_folder; #[cfg(feature = "include_sdl2")] extern crate sdl2_window; #[cfg(feature = "include_glfw")] extern crate glfw_window; #[cfg(feature = "include_glutin")] extern crate glutin_window; #[cfg(fe...
res } fn render_text<G, T>(glyphs: &[(T, [f64; 2])], c: &Context, gl: &mut G) where G: Graphics<Texture = T>, T: ImageSize { for &(ref texture, [x, y]) in glyphs { use graphics::*; Image::new_color(color::BLACK).draw( texture, &c.draw_state, c.transform...
{ let mut x = 10; let mut y = 0; let mut res = vec![]; for ch in text.chars() { face.load_char(ch as usize, ft::face::LoadFlag::RENDER).unwrap(); let g = face.glyph(); let bitmap = g.bitmap(); let texture = Texture::from_memory_alpha( bitmap.buffer(), ...
identifier_body
main.rs
extern crate graphics; extern crate freetype as ft; extern crate opengl_graphics; extern crate piston; extern crate find_folder; #[cfg(feature = "include_sdl2")] extern crate sdl2_window; #[cfg(feature = "include_glfw")] extern crate glfw_window; #[cfg(feature = "include_glutin")] extern crate glutin_window; #[cfg(fe...
} }
{ use graphics::*; gl.draw(args.viewport(), |c, gl| { clear(color::WHITE, gl); render_text(&glyphs, &c.trans(0.0, 100.0), gl); }); }
conditional_block
main.rs
extern crate graphics; extern crate freetype as ft; extern crate opengl_graphics; extern crate piston; extern crate find_folder; #[cfg(feature = "include_sdl2")] extern crate sdl2_window; #[cfg(feature = "include_glfw")] extern crate glfw_window; #[cfg(feature = "include_glutin")] extern crate glutin_window; #[cfg(fe...
(face: &mut ft::Face, text: &str) -> Vec<(Texture, [f64; 2])> { let mut x = 10; let mut y = 0; let mut res = vec![]; for ch in text.chars() { face.load_char(ch as usize, ft::face::LoadFlag::RENDER).unwrap(); let g = face.glyph(); let bitmap = g.bitmap(); let texture = Te...
glyphs
identifier_name
navigator.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::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::Na...
(&self) -> DOMString { navigatorinfo::Language() } // https://html.spec.whatwg.org/multipage/#dom-navigator-plugins fn Plugins(&self) -> Root<PluginArray> { self.plugins.or_init(|| PluginArray::new(self.global().r())) } // https://html.spec.whatwg.org/multipage/#dom-navigator-mimet...
Language
identifier_name
navigator.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::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::Na...
// https://html.spec.whatwg.org/multipage/#dom-navigator-platform fn Platform(&self) -> DOMString { navigatorinfo::Platform() } // https://html.spec.whatwg.org/multipage/#dom-navigator-useragent fn UserAgent(&self) -> DOMString { navigatorinfo::UserAgent() } // https://ht...
{ navigatorinfo::AppCodeName() }
identifier_body
navigator.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::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::reflector::{Refle...
random_line_split
build.rs
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use std::process::Command; // this build script is called on en every `devtool build`, // embedding the FIRECRACKER_VERSION directly in the resulting binary fn
() { let firecracker_version = Command::new("git") .args(&["describe", "--dirty"]) .output() .ok() .and_then(|output| { if output.status.success() { return Some(output.stdout); } None }) .and_then(|version_bytes| String::...
main
identifier_name
build.rs
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0
// this build script is called on en every `devtool build`, // embedding the FIRECRACKER_VERSION directly in the resulting binary fn main() { let firecracker_version = Command::new("git") .args(&["describe", "--dirty"]) .output() .ok() .and_then(|output| { if output.status.s...
use std::process::Command;
random_line_split
build.rs
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use std::process::Command; // this build script is called on en every `devtool build`, // embedding the FIRECRACKER_VERSION directly in the resulting binary fn main()
{ let firecracker_version = Command::new("git") .args(&["describe", "--dirty"]) .output() .ok() .and_then(|output| { if output.status.success() { return Some(output.stdout); } None }) .and_then(|version_bytes| String...
identifier_body
build.rs
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use std::process::Command; // this build script is called on en every `devtool build`, // embedding the FIRECRACKER_VERSION directly in the resulting binary fn main() { let firecracker_version = Comma...
None }) .and_then(|version_bytes| String::from_utf8(version_bytes).ok()) .map(|version_string| version_string.trim_start_matches('v').to_string()) .unwrap_or_else(|| env!("CARGO_PKG_VERSION").to_string()); println!( "cargo:rustc-env=FIRECRACKER_VERSION={}", ...
{ return Some(output.stdout); }
conditional_block
dom.rs
Some(n) => { // Filter out nodes that layout should ignore. if n.is_text_node() || n.is_element() { return Some(n) } } None => return None, } } } } /// An iterator over th...
( &self, _id: &Atom, ) -> Result<&[<Self::ConcreteNode as TNode>::ConcreteElement], ()> { Err(()) } } /// The `TNode` trait. This is the main generic trait over which the style /// system can be implemented. pub trait TNode : Sized + Copy + Clone + Debug + NodeInfo + PartialEq { ///...
elements_with_id
identifier_name
dom.rs
None => return None, Some(n) => n, }; self.previous = prev.next_in_preorder(Some(self.scope)); self.previous } } /// The `TDocument` trait, to represent a document node. pub trait TDocument : Sized + Copy + Clone { /// The concrete `TNode` type. type Concret...
{ *self }
conditional_block
dom.rs
Some(n) => { // Filter out nodes that layout should ignore. if n.is_text_node() || n.is_element() { return Some(n) } } None => return None, } } } } /// An iterator over t...
impl<N> Iterator for DomDescendants<N> where N: TNode { type Item = N; #[inline] fn next(&mut self) -> Option<N> { let prev = match self.previous.take() { None => return None, Some(n) => n, }; self.previous = prev.next_in_preorder(Some(self.scope)); ...
}
random_line_split
dom.rs
Some(n) => { // Filter out nodes that layout should ignore. if n.is_text_node() || n.is_element() { return Some(n) } } None => return None, } } } } /// An iterator over th...
/// Get this element's style attribute. fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>; /// Unset the style attribute's dirty bit. /// Servo doesn't need to manage ditry bit for style attribute. fn unset_dirty_style_attribute(&self) { } /// Get this elem...
{ unreachable!("Servo doesn't know about NAC"); }
identifier_body
codemap.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 ...
<T>(lo: BytePos, hi: BytePos, t: T) -> Spanned<T> { respan(mk_sp(lo, hi), t) } pub fn respan<T>(sp: Span, t: T) -> Spanned<T> { Spanned {node: t, span: sp} } pub fn dummy_spanned<T>(t: T) -> Spanned<T> { respan(dummy_sp(), t) } /* assuming that we're not in macro expansion */ pub fn mk_sp(lo: BytePos, hi...
spanned
identifier_name
codemap.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 ...
let linebpos = f.lines[a]; let linechpos = self.bytepos_to_local_charpos(linebpos); debug!("codemap: byte pos {:?} is on the line at byte pos {:?}", pos, linebpos); debug!("codemap: char pos {:?} is on the line at char pos {:?}", chpos, linechpos); d...
let chpos = self.bytepos_to_local_charpos(pos);
random_line_split
ipv4.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 base::prelude::*; use core::{mem}; use base::{error}; use cty::{ AF_INET, sa_family_t, c_int, sockaddr_in, in...
(&self) -> &SockAddr { unsafe { mem::cast(self) } } } impl_try_as_ref!(SockAddr, Ipv4SockAddr); impl AsMut<SockAddr> for Ipv4SockAddr { fn as_mut(&mut self) -> &mut SockAddr { unsafe { mem::cast(self) } } } impl_try_as_mut!(SockAddr, Ipv4SockAddr); impl Debug for Ipv4Addr { fn fmt<W: W...
as_ref
identifier_name
ipv4.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 base::prelude::*; use core::{mem}; use base::{error}; use cty::{ AF_INET, sa_family_t, c_int, sockaddr_in, in...
const PORT_OFF: usize = 2; const ADDR_OFF: usize = 4; pub fn validate(bytes: &[u8]) -> Result<usize> { if bytes.len() < IPV4_SOCK_ADDR_SIZE { return Err(error::InvalidArgument); } let mut family: sa_family_t = 0; mem::copy(family.as_mut(), bytes); match family as c_int { AF_INET => ...
// should have a static assert that this size // is actually correct. // Offsets of the port and address. Same XXX applies.
random_line_split
ipv4.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 base::prelude::*; use core::{mem}; use base::{error}; use cty::{ AF_INET, sa_family_t, c_int, sockaddr_in, in...
/// Turns the address into a 32 bit integer in network byte order. pub fn to_be(self) -> u32 { unsafe { mem::cast(self.to_bytes()) } } /// Compares the address to the current prefix `0.0.0.0/8`. pub fn is_current(self) -> bool { self.0 == 0 } /// Compares the address to t...
{ [self.0, self.1, self.2, self.3] }
identifier_body
ipv4.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 base::prelude::*; use core::{mem}; use base::{error}; use cty::{ AF_INET, sa_family_t, c_int, sockaddr_in, in...
let mut family: sa_family_t = 0; mem::copy(family.as_mut(), bytes); match family as c_int { AF_INET => Ok(IPV4_SOCK_ADDR_SIZE), _ => Err(error::InvalidArgument), } } /// An Ipv4 address. #[derive(Pod, Eq)] pub struct Ipv4Addr(pub u8, pub u8, pub u8, pub u8); impl Ipv4Addr { /// Cr...
{ return Err(error::InvalidArgument); }
conditional_block
data.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/. */ //! Per-node data used in style calculation. use context::{SharedStyleContext, StackLimitChecker}; use dom::TElem...
} } /// A lazily-allocated list of styles for eagerly-cascaded pseudo-elements. /// /// We use an Arc so that sharing these styles via the style sharing cache does /// not require duplicate allocations. We leverage the copy-on-write semantics of /// Arc::make_mut(), which is free (i.e. does not require atomic RMU ...
/// structs via rule node identity. The former gives us stronger transitive /// guarantees that allows us to apply the style sharing cache to cousins. const PRIMARY_STYLE_REUSED_VIA_RULE_NODE = 1 << 3;
random_line_split
data.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/. */ //! Per-node data used in style calculation. use context::{SharedStyleContext, StackLimitChecker}; use dom::TElem...
} /// Mark this element as restyled, which is useful to know whether we need /// to do a post-traversal. pub fn set_restyled(&mut self) { self.flags.insert(ElementDataFlags::WAS_RESTYLED); self.flags.remove(ElementDataFlags::TRAVERSED_WITHOUT_STYLING); } /// Returns true if th...
{ self.flags.remove(ElementDataFlags::ANCESTOR_WAS_RECONSTRUCTED); }
conditional_block
data.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/. */ //! Per-node data used in style calculation. use context::{SharedStyleContext, StackLimitChecker}; use dom::TElem...
/// If an ancestor is already getting reconstructed by Gecko's top-down /// frame constructor, no need to apply damage. Similarly if we already /// have an explicitly stored ReconstructFrame hint. /// /// See https://bugzilla.mozilla.org/show_bug.cgi?id=1301258#c12 /// for followup work to ma...
{ self.is_restyle() || !self.hint.is_empty() || !self.damage.is_empty() }
identifier_body
data.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/. */ //! Per-node data used in style calculation. use context::{SharedStyleContext, StackLimitChecker}; use dom::TElem...
(&self) -> bool { self.reconstructed_self_or_ancestor() } /// N/A in Servo. #[cfg(feature = "servo")] pub fn skip_applying_damage(&self) -> bool { false } /// Returns whether it is safe to perform cousin sharing based on the ComputedValues /// identity of the primary style in this ElementData. The...
skip_applying_damage
identifier_name
lib.rs
//! kaiseki -- literate programming preprocessing #[macro_use] extern crate error_chain; extern crate regex; pub mod input; pub mod list; mod parsing; pub mod processing_errors { error_chain! { errors { NotUTF8(file: String, lineno: usize) { description("line is not valid UTF-8") display...
&None => None } } fn collect_anchor_lines(tangled: Tangled, anchors: &mut BTreeMap<String, Anchor>, lines: &mut Vec<String>, indentation: usize, options: &OutputOptions) { use std::iter; let indent_prefix = iter...
{ let header = format!( "{} '{}', line {}", comment_prefix, &block.file, block.lineno ); Some(header) }
conditional_block
lib.rs
//! kaiseki -- literate programming preprocessing #[macro_use] extern crate error_chain; extern crate regex; pub mod input; pub mod list; mod parsing; pub mod processing_errors { error_chain! { errors { NotUTF8(file: String, lineno: usize) { description("line is not valid UTF-8") display...
loop { let next_anchor = process_block_lines(&mut lines, &mut block, &mut errors); if!block.lines.is_empty() { tangled_section.push_back(Either::Left(block)); } match next_anchor { Some((lineno, indentation, anchor)) => { macro_rules! has_anchor { ($an...
random_line_split
lib.rs
//! kaiseki -- literate programming preprocessing #[macro_use] extern crate error_chain; extern crate regex; pub mod input; pub mod list; mod parsing; pub mod processing_errors { error_chain! { errors { NotUTF8(file: String, lineno: usize) { description("line is not valid UTF-8") display...
{ indentation: usize, // The *absolute* level of indentation. tangled: Tangled } impl Anchor { fn new(indentation: usize) -> Self { Anchor { indentation: indentation, tangled: List::new() } } } /// An `Either` represents the situation when *either* arm is a valid /// value, as opposed to...
Anchor
identifier_name
lib.rs
//! kaiseki -- literate programming preprocessing #[macro_use] extern crate error_chain; extern crate regex; pub mod input; pub mod list; mod parsing; pub mod processing_errors { error_chain! { errors { NotUTF8(file: String, lineno: usize) { description("line is not valid UTF-8") display...
fn collect_anchor_lines(tangled: Tangled, anchors: &mut BTreeMap<String, Anchor>, lines: &mut Vec<String>, indentation: usize, options: &OutputOptions) { use std::iter; let indent_prefix = iter::repeat(' ').take(inden...
{ match &options.comment { &Some(ref comment_prefix) => { let header = format!( "{} '{}', line {}", comment_prefix, &block.file, block.lineno ); Some(header) } &None => None } }
identifier_body
cargo_test.rs
use std::ffi::{OsString, OsStr}; use ops::{self, Compilation}; use util::{self, CargoTestError, Test, ProcessError}; use util::errors::{CargoResult, CargoErrorKind, CargoError}; use core::Workspace; pub struct TestOptions<'a> { pub compile_opts: ops::CompileOptions<'a>, pub no_run: bool, pub no_fail_fast:...
else { Ok(Some(CargoTestError::new(test, errors))) } } pub fn run_benches(ws: &Workspace, options: &TestOptions, args: &[String]) -> CargoResult<Option<CargoTestError>> { let mut args = args.to_vec(); args.push("--bench".to_string()); let compilation = com...
{ Ok(None) }
conditional_block
cargo_test.rs
use std::ffi::{OsString, OsStr}; use ops::{self, Compilation}; use util::{self, CargoTestError, Test, ProcessError}; use util::errors::{CargoResult, CargoErrorKind, CargoError}; use core::Workspace; pub struct TestOptions<'a> { pub compile_opts: ops::CompileOptions<'a>, pub no_run: bool, pub no_fail_fast:...
<'a>(ws: &Workspace<'a>, options: &TestOptions<'a>) -> CargoResult<Compilation<'a>> { let mut compilation = ops::compile(ws, &options.compile_opts)?; compilation.tests.sort_by(|a, b| { (a.0.package_id(), &a.1, &a.2).cmp(&(b.0.package_id(), &b.1, &b.2)) }); ...
compile_tests
identifier_name
cargo_test.rs
use std::ffi::{OsString, OsStr}; use ops::{self, Compilation}; use util::{self, CargoTestError, Test, ProcessError}; use util::errors::{CargoResult, CargoErrorKind, CargoError}; use core::Workspace; pub struct TestOptions<'a> { pub compile_opts: ops::CompileOptions<'a>, pub no_run: bool, pub no_fail_fast:...
}); Ok(compilation) } /// Run the unit and integration tests of a project. fn run_unit_tests(options: &TestOptions, test_args: &[String], compilation: &Compilation) -> CargoResult<(Test, Vec<ProcessError>)> { let config = options.compile_opts.config; ...
compilation.tests.sort_by(|a, b| { (a.0.package_id(), &a.1, &a.2).cmp(&(b.0.package_id(), &b.1, &b.2))
random_line_split
cargo_test.rs
use std::ffi::{OsString, OsStr}; use ops::{self, Compilation}; use util::{self, CargoTestError, Test, ProcessError}; use util::errors::{CargoResult, CargoErrorKind, CargoError}; use core::Workspace; pub struct TestOptions<'a> { pub compile_opts: ops::CompileOptions<'a>, pub no_run: bool, pub no_fail_fast:...
fn compile_tests<'a>(ws: &Workspace<'a>, options: &TestOptions<'a>) -> CargoResult<Compilation<'a>> { let mut compilation = ops::compile(ws, &options.compile_opts)?; compilation.tests.sort_by(|a, b| { (a.0.package_id(), &a.1, &a.2).cmp(&(b.0.package_id(), &b.1...
{ let mut args = args.to_vec(); args.push("--bench".to_string()); let compilation = compile_tests(ws, options)?; if options.no_run { return Ok(None) } let (test, errors) = run_unit_tests(options, &args, &compilation)?; match errors.len() { 0 => Ok(None), _ => Ok(Some...
identifier_body
tests.rs
pub use datatypes::{GridSettings, Region, ResizeRule, SplitKind, SaveGrid}; pub use datatypes::ResizeRule::*; pub use datatypes::SplitKind::*; pub use terminal::interfaces::{Resizeable, ConstructGrid}; pub use super::panel::Panel; pub use super::panel::Panel::*; pub use super::ring::Ring; pub use super::section::Screen...
(self.0, self.1) } fn resize_width(&mut self, width: u32) { self.0 = width; } fn resize_height(&mut self, height: u32) { self.1 = height; } } impl ConstructGrid for MockFill { fn new(settings: GridSettings) -> MockFill { MockFill(settings.width, settings.height...
#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct MockFill(pub u32, pub u32); impl Resizeable for MockFill { fn dims(&self) -> (u32, u32) {
random_line_split
tests.rs
pub use datatypes::{GridSettings, Region, ResizeRule, SplitKind, SaveGrid}; pub use datatypes::ResizeRule::*; pub use datatypes::SplitKind::*; pub use terminal::interfaces::{Resizeable, ConstructGrid}; pub use super::panel::Panel; pub use super::panel::Panel::*; pub use super::ring::Ring; pub use super::section::Screen...
} impl ConstructGrid for MockFill { fn new(settings: GridSettings) -> MockFill { MockFill(settings.width, settings.height) } } pub const GRID: MockFill = MockFill(8, 8); pub const OLD_AREA: Region = Region { left: 0, top: 2, right: 8, bottom: 10 }; pub const NEW_AREA: Region = Region { left: 1, top: ...
{ self.1 = height; }
identifier_body
tests.rs
pub use datatypes::{GridSettings, Region, ResizeRule, SplitKind, SaveGrid}; pub use datatypes::ResizeRule::*; pub use datatypes::SplitKind::*; pub use terminal::interfaces::{Resizeable, ConstructGrid}; pub use super::panel::Panel; pub use super::panel::Panel::*; pub use super::ring::Ring; pub use super::section::Screen...
(&self) -> (u32, u32) { (self.0, self.1) } fn resize_width(&mut self, width: u32) { self.0 = width; } fn resize_height(&mut self, height: u32) { self.1 = height; } } impl ConstructGrid for MockFill { fn new(settings: GridSettings) -> MockFill { MockFill(setting...
dims
identifier_name
msgsend-pipes.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 ...
{ let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { vec!("".to_string(), "1000000".to_string(), "8".to_string()) } else if args.len() <= 1u { vec!("".to_string(), "10000".to_string(), "4".to_string()) } else { args.clone().into_iter().map(|x| x.to_string()...
identifier_body
msgsend-pipes.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 ...
Ok(request::bytes(b)) => { //println!("server: received {} bytes", b); count += b; } Err(..) => { done = true; } _ => { } } } responses.send(count); //println!("server exiting"); } fn run(args: &[String]) { let (to_parent, from_ch...
{ responses.send(count.clone()); }
conditional_block
msgsend-pipes.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 ...
<T>(_x: T) {} enum request { get_count, bytes(uint), stop } fn server(requests: &Receiver<request>, responses: &Sender<uint>) { let mut count: uint = 0; let mut done = false; while!done { match requests.recv_opt() { Ok(request::get_count) => { responses.send(count.clone()); }...
move_out
identifier_name
msgsend-pipes.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 ...
_ => { } } } responses.send(count); //println!("server exiting"); } fn run(args: &[String]) { let (to_parent, from_child) = channel(); let size = from_str::<uint>(args[1].as_slice()).unwrap(); let workers = from_str::<uint>(args[2].as_slice()).unwrap(); let num_bytes = 10...
count += b; } Err(..) => { done = true; }
random_line_split
union-borrow-move-parent-sibling.rs
// Copyright 2017 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 ...
unsafe fn parent_sibling_borrow() { let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; let a = &mut u.x.0; let b = &u.y; //~ ERROR cannot borrow `u.y` use_borrow(a); } unsafe fn parent_sibling_move() { let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; let a = u.x.0; let b =...
fn use_borrow<T>(_: &T) {}
random_line_split
union-borrow-move-parent-sibling.rs
// Copyright 2017 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 ...
unsafe fn grandparent_sibling_borrow() { let mut u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; let a = &mut (u.x.0).0; let b = &u.y; //~ ERROR cannot borrow `u.y` use_borrow(a); } unsafe fn grandparent_sibling_move() { let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; let a = (u...
{ let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; let a = u.x.0; let b = u.y; //~ ERROR use of moved value: `u.y` }
identifier_body
union-borrow-move-parent-sibling.rs
// Copyright 2017 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 mut u = U { y: Box::default() }; let a = &mut *u.y; let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) use_borrow(a); } unsafe fn deref_sibling_move() { let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; let a = *u.y; let b = u.x; //~ ERROR use of moved value: `u.x` } fn...
deref_sibling_borrow
identifier_name
send_receive.rs
#![deny(warnings)] extern crate mpi; use mpi::traits::*; use mpi::point_to_point as p2p; use mpi::topology::Rank; fn
() { let universe = mpi::initialize().unwrap(); let world = universe.world(); let size = world.size(); let rank = world.rank(); let next_rank = if rank + 1 < size { rank + 1 } else { 0 }; let next_process = world.process_at_rank(next_rank); let previous_rank = if rank - 1 >= 0 { rank - 1 } ...
main
identifier_name
send_receive.rs
#![deny(warnings)] extern crate mpi; use mpi::traits::*; use mpi::point_to_point as p2p; use mpi::topology::Rank; fn main() { let universe = mpi::initialize().unwrap(); let world = universe.world(); let size = world.size(); let rank = world.rank(); let next_rank = if rank + 1 < size { rank + 1 } ...
; let next_process = world.process_at_rank(next_rank); let previous_rank = if rank - 1 >= 0 { rank - 1 } else { size - 1 }; let previous_process = world.process_at_rank(previous_rank); let (msg, status): (Rank, _) = p2p::send_receive(&rank, &previous_process, &next_process); println!("Process {} go...
{ 0 }
conditional_block
send_receive.rs
#![deny(warnings)] extern crate mpi; use mpi::traits::*; use mpi::point_to_point as p2p; use mpi::topology::Rank; fn main() { let universe = mpi::initialize().unwrap(); let world = universe.world(); let size = world.size(); let rank = world.rank(); let next_rank = if rank + 1 < size { rank + 1 } ...
let x = status.source_rank(); let v = vec![x, x + 1, x - 1]; assert_eq!(v, msg); } } world.barrier(); let mut x = rank; p2p::send_receive_replace_into(&mut x, &next_process, &previous_process); assert_eq!(x, previous_rank); }
let (msg, status) = world.any_process().receive_vec::<Rank>(); println!("Process {} got long message {:?}.\nStatus is: {:?}", rank, msg, status);
random_line_split
send_receive.rs
#![deny(warnings)] extern crate mpi; use mpi::traits::*; use mpi::point_to_point as p2p; use mpi::topology::Rank; fn main()
for _ in 1..size { let (msg, status) = world.any_process().receive_vec::<Rank>(); println!("Process {} got long message {:?}.\nStatus is: {:?}", rank, msg, status); let x = status.source_rank(); let v = vec![x, x + 1, x - 1]; assert_eq!(v, msg); ...
{ let universe = mpi::initialize().unwrap(); let world = universe.world(); let size = world.size(); let rank = world.rank(); let next_rank = if rank + 1 < size { rank + 1 } else { 0 }; let next_process = world.process_at_rank(next_rank); let previous_rank = if rank - 1 >= 0 { rank - 1 } els...
identifier_body
table_caption.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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::BlockFlow; use construct::FlowConstructor; ...
(&mut self, block_position: Au) { self.block_flow.update_late_computed_block_position_if_necessary(block_position) } fn build_display_list(&mut self, layout_context: &LayoutContext) { debug!("build_display_list_table_caption: same process as block flow"); self.block_flow.build_display_l...
update_late_computed_block_position_if_necessary
identifier_name
table_caption.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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::BlockFlow; use construct::FlowConstructor; ...
fn bubble_inline_sizes(&mut self) { self.block_flow.bubble_inline_sizes(); } fn assign_inline_sizes(&mut self, ctx: &LayoutContext) { debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_caption"); self.block_flow.assign_inline_sizes(ctx); } fn assign_...
{ &mut self.block_flow }
identifier_body
table_caption.rs
* 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/. */ //! CSS table formatting contexts. #![deny(unsafe_block)] use block::BlockFlow; use construct::FlowConstructor; use context::LayoutContext; use flow::{TableCaptionFlowClass, FlowClass...
/* This Source Code Form is subject to the terms of the Mozilla Public
random_line_split
malformed-param-list.rs
#![feature(plugin)] #![plugin(rocket_codegen)] #[get("/><")] //~ ERROR malformed fn get() -> &'static str { "hi" } #[get("/<name><")] //~ ERROR malformed fn get1(name: &str) -> &'static str { "hi" } #[get("/<<<<name><")] //~ ERROR malformed fn get2(name: &str) -> &'static str { "hi" } #[get("/<!>")] //~ ERROR ident...
#[get("/<>")] //~ ERROR empty fn get8() -> &'static str { "hi" } fn main() { }
{ "hi" }
identifier_body
malformed-param-list.rs
#![feature(plugin)] #![plugin(rocket_codegen)] #[get("/><")] //~ ERROR malformed fn get() -> &'static str { "hi" } #[get("/<name><")] //~ ERROR malformed fn get1(name: &str) -> &'static str { "hi" } #[get("/<<<<name><")] //~ ERROR malformed fn get2(name: &str) -> &'static str { "hi" } #[get("/<!>")] //~ ERROR ident...
#[get("/<>")] //~ ERROR empty fn get8() -> &'static str { "hi" } fn main() { }
#[get("/<>name><")] //~ ERROR malformed fn get6() -> &'static str { "hi" } #[get("/<name>:<id>")] //~ ERROR identifiers fn get7() -> &'static str { "hi" }
random_line_split
malformed-param-list.rs
#![feature(plugin)] #![plugin(rocket_codegen)] #[get("/><")] //~ ERROR malformed fn
() -> &'static str { "hi" } #[get("/<name><")] //~ ERROR malformed fn get1(name: &str) -> &'static str { "hi" } #[get("/<<<<name><")] //~ ERROR malformed fn get2(name: &str) -> &'static str { "hi" } #[get("/<!>")] //~ ERROR identifiers fn get3() -> &'static str { "hi" } #[get("/<_>")] //~ ERROR ignored fn get4() ->...
get
identifier_name
wasm32_experimental_emscripten.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 ...
target_c_int_width: "32".to_string(), target_os: "emscripten".to_string(), target_env: String::new(), target_vendor: "unknown".to_string(), data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128".to_string(), arch: "wasm32".to_string(), linker_flavor: LinkerFlavor::Em, ...
target_endian: "little".to_string(), target_pointer_width: "32".to_string(),
random_line_split
wasm32_experimental_emscripten.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 ...
obj_is_bitcode: true, is_like_emscripten: true, max_atomic_width: Some(32), post_link_args, target_family: Some("unix".to_string()), .. Default::default() }; Ok(Target { llvm_target: "wasm32-unknown-unknown".to_string(), target_endian: "little".to_s...
{ let mut post_link_args = LinkArgs::new(); post_link_args.insert(LinkerFlavor::Em, vec!["-s".to_string(), "WASM=1".to_string(), "-s".to_string(), "ASSERTIONS=1".to_string(), ...
identifier_body
wasm32_experimental_emscripten.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 ...
() -> Result<Target, String> { let mut post_link_args = LinkArgs::new(); post_link_args.insert(LinkerFlavor::Em, vec!["-s".to_string(), "WASM=1".to_string(), "-s".to_string(), "ASSERTIONS=1".to...
target
identifier_name
lib.rs
#[derive(serde::Deserialize, Debug)] struct HasuraError { error: HasuraInfo, } #[derive(serde::Deserialize, Debug)] struct HasuraInfo { description: Option<String>, exec_status: String, hint: Option<String>, message: String, status_code: String, } #[cfg(test)] mod tests { #[test] fn it...
) -> Result<D, Vec<String>> { let data = req.send().await.map_err(|e| vec![format!("{:?}", e)])?; let decode: reqwest::Result<graphql_client::Response<D>> = data.json().await; let body = decode.map_err(|e| vec![format!("{:?}", e)])?; match body.data { Some(d) => Ok(d), None => Err(mat...
/// [GraphQL Spec](http://spec.graphql.org/draft/#sec-Errors) pub async fn graphql_request<D: serde::de::DeserializeOwned>( req: reqwest::RequestBuilder,
random_line_split
lib.rs
#[derive(serde::Deserialize, Debug)] struct HasuraError { error: HasuraInfo, } #[derive(serde::Deserialize, Debug)] struct HasuraInfo { description: Option<String>, exec_status: String, hint: Option<String>, message: String, status_code: String, } #[cfg(test)] mod tests { #[test] fn it...
None => e.message, } }) .collect() }
{ format!("{}\n{:?}", e.message, h_err) }
conditional_block
lib.rs
#[derive(serde::Deserialize, Debug)] struct HasuraError { error: HasuraInfo, } #[derive(serde::Deserialize, Debug)] struct HasuraInfo { description: Option<String>, exec_status: String, hint: Option<String>, message: String, status_code: String, } #[cfg(test)] mod tests { #[test] fn it...
(errors: Vec<graphql_client::Error>) -> Vec<String> { errors .into_iter() .map(|e| { let internal = e .extensions .as_ref() .and_then(|ext| ext.get("internal")) .and_then(|v| serde_json::from_value::<HasuraError>(v.clone()).ok()) ...
parse_errors
identifier_name
lib.rs
#[derive(serde::Deserialize, Debug)] struct HasuraError { error: HasuraInfo, } #[derive(serde::Deserialize, Debug)] struct HasuraInfo { description: Option<String>, exec_status: String, hint: Option<String>, message: String, status_code: String, } #[cfg(test)] mod tests { #[test] fn it...
fn parse_errors(errors: Vec<graphql_client::Error>) -> Vec<String> { errors .into_iter() .map(|e| { let internal = e .extensions .as_ref() .and_then(|ext| ext.get("internal")) .and_then(|v| serde_json::from_value::<HasuraError>(...
{ let req = client .post(graphql_endpoint.as_str()) .header("x-hasura-admin-secret", hasura_admin_secret.as_bytes()) .json(&body); graphql_request(req).await }
identifier_body
object-one-type-two-traits.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 ...
self as Box<Any+'static> } } fn is<T:Any>(x: &Any) -> bool { x.is::<T>() } fn main() { let x = box 22isize as Box<Wrap>; println!("x={}", x.get()); let y = x.wrap(); }
impl Wrap for isize { fn get(&self) -> isize { *self } fn wrap(self: Box<isize>) -> Box<Any+'static> {
random_line_split
object-one-type-two-traits.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 = box 22isize as Box<Wrap>; println!("x={}", x.get()); let y = x.wrap(); }
identifier_body
object-one-type-two-traits.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:Any>(x: &Any) -> bool { x.is::<T>() } fn main() { let x = box 22isize as Box<Wrap>; println!("x={}", x.get()); let y = x.wrap(); }
is
identifier_name
enum_and_vtable_mangling.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] pub const match_: _bindgen_ty_1 = _bindgen_ty_1::match_; pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else; #[repr(u32)] #[derive(Debug, Copy, Clone, P...
); assert_eq!( unsafe { &(*(::std::ptr::null::<C>())).i as *const _ as usize }, 8usize, concat!("Offset of field: ", stringify!(C), "::", stringify!(i)) ); } impl Default for C { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { #[link_name =...
8usize, concat!("Alignment of ", stringify!(C))
random_line_split
enum_and_vtable_mangling.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] pub const match_: _bindgen_ty_1 = _bindgen_ty_1::match_; pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else; #[repr(u32)] #[derive(Debug, Copy, Clone, P...
() { assert_eq!( ::std::mem::size_of::<C>(), 16usize, concat!("Size of: ", stringify!(C)) ); assert_eq!( ::std::mem::align_of::<C>(), 8usize, concat!("Alignment of ", stringify!(C)) ); assert_eq!( unsafe { &(*(::std::ptr::null::<C>())).i as *co...
bindgen_test_layout_C
identifier_name
mod.rs
/************************************************************************ * * * Copyright 2015 Urban Hafner, Thomas Poinsot, Igor Polyakov * * * * This file is part of ...
-> i64 { self.byo_time_left } pub fn main_time_left(&self) -> i64 { self.main_time_left } fn set_main_time(&mut self, time: i64) { self.main_time_left = time; } fn set_byo_time(&mut self, time: i64) { self.byo_time = time; self.byo_time_left = time; ...
_left(&self)
identifier_name
mod.rs
/************************************************************************ * * * Copyright 2015 Urban Hafner, Thomas Poinsot, Igor Polyakov * * * * This file is part of ...
b fn reset(&mut self) { // Do nothing } pub fn byo_stones_left(&self) -> i32 { self.byo_stones_left } pub fn byo_time_left(&self) -> i64 { self.byo_time_left } pub fn main_time_left(&self) -> i64 { self.main_time_left } fn set_main_time(&mut self, time...
self.adjust_time(); } pu
identifier_body
mod.rs
/************************************************************************ * * * Copyright 2015 Urban Hafner, Thomas Poinsot, Igor Polyakov * * * * This file is part of ...
byo_stones_left: 0, byo_time: 0, byo_time_left: 0, config: config, current_budget: Duration::milliseconds(0), main_time_left: 0, time_stamp: PreciseTime::now(), } } pub fn setup(&mut self, main_in_s: i64, byo_in_s: i64...
byo_stones: 0,
random_line_split
mod.rs
/************************************************************************ * * * Copyright 2015 Urban Hafner, Thomas Poinsot, Igor Polyakov * * * * This file is part of ...
elapsed > self.current_budget } } pub fn stop(&mut self) { self.adjust_time(); } pub fn reset(&mut self) { // Do nothing } pub fn byo_stones_left(&self) -> i32 { self.byo_stones_left } pub fn byo_time_left(&self) -> i64 { self.byo_t...
self.config.log(format!("Search stopped early. Fastplay rule triggered.")); true } else {
conditional_block
dependency.rs
use std::fmt; use std::rc::Rc; use std::str::FromStr; use semver::VersionReq; use semver::ReqParseError; use serde::ser; use core::{SourceId, Summary, PackageId}; use util::{Cfg, CfgExpr, Config}; use util::errors::{CargoResult, CargoResultExt, CargoError}; /// Information about a dependency requested by a Cargo man...
(&mut self, id: SourceId) -> &mut Dependency { Rc::make_mut(&mut self.inner).source_id = id; self } /// Set the version requirement for this dependency pub fn set_version_req(&mut self, req: VersionReq) -> &mut Dependency { Rc::make_mut(&mut self.inner).req = req; self }...
set_source_id
identifier_name
dependency.rs
use std::fmt; use std::rc::Rc; use std::str::FromStr; use semver::VersionReq; use semver::ReqParseError; use serde::ser; use core::{SourceId, Summary, PackageId}; use util::{Cfg, CfgExpr, Config}; use util::errors::{CargoResult, CargoResultExt, CargoError}; /// Information about a dependency requested by a Cargo man...
} }, Ok(v) => Ok(v), } } impl ser::Serialize for Kind { fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error> where S: ser::Serializer, { match *self { Kind::Normal => None, Kind::Development => Some("dev"), Kind::Build => So...
} e => Err(e.into()),
random_line_split
shared_memory.rs
//! TODO docs use std::ffi::CString; use std::slice; use types; pub struct Handle { shm_fd: ::detail::FileHandle, name: String, access_mode: types::AccessMode, } impl Handle { pub fn new(name: &str, create_mode: types::CreateMode, access_mode: types::AccessMode, ...
match Handle::remove(name) { Ok(_) => {}, Err(err) => assert!(false, "Can't remove file: {}", err), } } }
assert_eq!(data, &buffer[..data.len()]); }
random_line_split
shared_memory.rs
//! TODO docs use std::ffi::CString; use std::slice; use types; pub struct Handle { shm_fd: ::detail::FileHandle, name: String, access_mode: types::AccessMode, } impl Handle { pub fn new(name: &str, create_mode: types::CreateMode, access_mode: types::AccessMode, ...
(&self) -> &String { &self.name } pub fn access_mode(&self) -> types::AccessMode { self.access_mode.clone() } } impl Drop for Handle { fn drop(&mut self) { ::detail::close_handle(self.shm_fd) } } pub struct MappedRegion { _handle: Handle, ptr: *mut u8, size: u...
name
identifier_name
paths.rs
// Copyright 2017 Thorben Kroeger. // Dual-licensed MIT and Apache 2.0 (see LICENSE files for details). use std::path::{Path, PathBuf}; pub struct CommonPrefix { pub prefix: PathBuf, pub suffix1: PathBuf, pub suffix2: PathBuf } pub fn common_prefix(path1: &Path, path2: &Path) -> CommonPrefix { let mu...
_ => { break; } } } let common_prefix = common_prefix.iter().map(|s| s.as_os_str()).collect::<PathBuf>(); let r1 = a.map(|s| s.as_os_str()).collect::<PathBuf>(); let r2 = b.map(|s| s.as_os_str()).collect::<PathBuf>(); CommonPrefix { prefix: common_prefix, suffix...
{ if e1 != e2 { break; } common_prefix.push(e1); a.next(); b.next(); continue; }
conditional_block
paths.rs
// Copyright 2017 Thorben Kroeger. // Dual-licensed MIT and Apache 2.0 (see LICENSE files for details). use std::path::{Path, PathBuf}; pub struct CommonPrefix { pub prefix: PathBuf, pub suffix1: PathBuf, pub suffix2: PathBuf } pub fn
(path1: &Path, path2: &Path) -> CommonPrefix { let mut a = path1.components().peekable(); let mut b = path2.components().peekable(); let mut common_prefix = vec![]; loop { match (a.peek(), b.peek()) { (Some(&e1), Some(&e2)) => { if e1!= e2 { b...
common_prefix
identifier_name
paths.rs
// Copyright 2017 Thorben Kroeger. // Dual-licensed MIT and Apache 2.0 (see LICENSE files for details). use std::path::{Path, PathBuf}; pub struct CommonPrefix { pub prefix: PathBuf, pub suffix1: PathBuf, pub suffix2: PathBuf } pub fn common_prefix(path1: &Path, path2: &Path) -> CommonPrefix { let mu...
if e1!= e2 { break; } common_prefix.push(e1); a.next(); b.next(); continue; } _ => { break; } } } let common_prefix = common_prefix.iter().map(|s| s.as_os_str()).col...
match (a.peek(), b.peek()) { (Some(&e1), Some(&e2)) => {
random_line_split
paths.rs
// Copyright 2017 Thorben Kroeger. // Dual-licensed MIT and Apache 2.0 (see LICENSE files for details). use std::path::{Path, PathBuf}; pub struct CommonPrefix { pub prefix: PathBuf, pub suffix1: PathBuf, pub suffix2: PathBuf } pub fn common_prefix(path1: &Path, path2: &Path) -> CommonPrefix
let r1 = a.map(|s| s.as_os_str()).collect::<PathBuf>(); let r2 = b.map(|s| s.as_os_str()).collect::<PathBuf>(); CommonPrefix { prefix: common_prefix, suffix1: r1, suffix2: r2 } }
{ let mut a = path1.components().peekable(); let mut b = path2.components().peekable(); let mut common_prefix = vec![]; loop { match (a.peek(), b.peek()) { (Some(&e1), Some(&e2)) => { if e1 != e2 { break; } comm...
identifier_body
trait-inheritance-num.rs
// xfail-fast // 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 // <...
<T:NumExt>(n: &T) -> bool { *n > NumCast::from(1).unwrap() } fn greater_than_one_float<T:FloatExt>(n: &T) -> bool { *n > NumCast::from(1).unwrap() } pub fn main() {}
greater_than_one
identifier_name
trait-inheritance-num.rs
// xfail-fast // 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 // <...
pub fn main() {}
{ *n > NumCast::from(1).unwrap() }
identifier_body