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
qualifier.rs
use regex::Regex; lazy_static! { pub static ref REGEX: Regex = Regex::new("^[a-z0-9]+:([a-z0-9]+):(.*)$").unwrap(); } pub fn qualify(entity: &str, prefix: &str, method: &str) -> String { format!("{}:{}:{}", prefix, method, entity) } pub fn to_unqualified(entity: &str) -> String { match REGEX.captures(ent...
} } pub fn is_fully_qualified(entity: &str) -> bool { REGEX.is_match(&entity) } macro_rules! qualifiable_type (($newtype:ident) => ( #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] pub struct $newtype(pub String); impl $newtype { #[allow(dead_code)] pub fn ...
{ caps.get(1).map(|m| m.as_str().to_string()) }
conditional_block
qualifier.rs
use regex::Regex; lazy_static! { pub static ref REGEX: Regex = Regex::new("^[a-z0-9]+:([a-z0-9]+):(.*)$").unwrap(); } pub fn qualify(entity: &str, prefix: &str, method: &str) -> String { format!("{}:{}:{}", prefix, method, entity) } pub fn to_unqualified(entity: &str) -> String { match REGEX.captures(ent...
} pub fn is_fully_qualified(entity: &str) -> bool { REGEX.is_match(&entity) } macro_rules! qualifiable_type (($newtype:ident) => ( #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] pub struct $newtype(pub String); impl $newtype { #[allow(dead_code)] pub fn get_met...
}
random_line_split
qualifier.rs
use regex::Regex; lazy_static! { pub static ref REGEX: Regex = Regex::new("^[a-z0-9]+:([a-z0-9]+):(.*)$").unwrap(); } pub fn qualify(entity: &str, prefix: &str, method: &str) -> String { format!("{}:{}:{}", prefix, method, entity) } pub fn to_unqualified(entity: &str) -> String { match REGEX.captures(ent...
macro_rules! qualifiable_type (($newtype:ident) => ( #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] pub struct $newtype(pub String); impl $newtype { #[allow(dead_code)] pub fn get_method(&self) -> Option<String> { qualifier::method(&self.0) } ...
{ REGEX.is_match(&entity) }
identifier_body
qualifier.rs
use regex::Regex; lazy_static! { pub static ref REGEX: Regex = Regex::new("^[a-z0-9]+:([a-z0-9]+):(.*)$").unwrap(); } pub fn qualify(entity: &str, prefix: &str, method: &str) -> String { format!("{}:{}:{}", prefix, method, entity) } pub fn to_unqualified(entity: &str) -> String { match REGEX.captures(ent...
(entity: &str) -> bool { REGEX.is_match(&entity) } macro_rules! qualifiable_type (($newtype:ident) => ( #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] pub struct $newtype(pub String); impl $newtype { #[allow(dead_code)] pub fn get_method(&self) -> Option<String>...
is_fully_qualified
identifier_name
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
<V: LevelVisitor>(&self, visitor: &mut V) { LevelWalker::new( &self.level, &self.analysis, &self.textures, self.archive.metadata(), visitor, ) .walk(); } } #[derive(DependenciesFrom)] pub struct Dependencies<'context> { config: ...
walk
identifier_name
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
} #[derive(DependenciesFrom)] pub struct Dependencies<'context> { config: &'context Config, } impl<'context> System<'context> for WadSystem { type Dependencies = Dependencies<'context>; type Error = Error; fn debug_name() -> &'static str { "wad" } fn create(deps: Dependencies) -> Re...
{ LevelWalker::new( &self.level, &self.analysis, &self.textures, self.archive.metadata(), visitor, ) .walk(); }
identifier_body
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
"Loading new level {:?} ({})...", self.level_name, self.next_level_index ); self.level = WadLevel::from_archive(&self.archive, self.current_level_index) .chain_err(|| { ErrorKind(format!( ...
{ if self.next_level_index >= self.archive.num_levels() { info!( "New level index {} is out of bounds, keeping current.", self.next_level_index ); self.next_level_index = self.current_level_index; } else { ...
conditional_block
wad_system.rs
use super::errors::{Error, ErrorKind, Result}; use engine::{DependenciesFrom, System}; use failchain::{bail, ResultExt}; use log::info; use std::path::PathBuf; use wad::{ Archive, Level as WadLevel, LevelAnalysis, LevelVisitor, LevelWalker, Result as WadResult, TextureDirectory, WadName, }; #[derive(Debug)] pu...
.name(); info!( "Loading new level {:?} ({})...", self.level_name, self.next_level_index ); self.level = WadLevel::from_archive(&self.archive, self.current_level_index) .chain_err(|| { ...
"while accessing level name for next level request {}", self.next_level_index )) })?
random_line_split
pci.rs
/* SPDX-License-Identifier: GPL-2.0-only */ use std::collections::HashMap; pub struct ConfigAddr(pub u32); impl ConfigAddr { pub fn enabled(&self) -> bool { (self.0 & (1 << 31))!= 0 } pub fn offset(&self) -> u8 { (self.0 & 0xff) as u8 } pub fn bdf(&self) -> u16 { ((self....
} pub fn write(&mut self, value: u32) { let bdf = self.config_addr.bdf(); if let Some(device) = self.devices.get_mut(&bdf) { device.write(self.config_addr.offset(), value); } } }
{ u32::MAX }
conditional_block
pci.rs
/* SPDX-License-Identifier: GPL-2.0-only */ use std::collections::HashMap; pub struct ConfigAddr(pub u32); impl ConfigAddr { pub fn enabled(&self) -> bool { (self.0 & (1 << 31))!= 0 } pub fn offset(&self) -> u8 { (self.0 & 0xff) as u8 } pub fn bdf(&self) -> u16 { ((self....
{ pub config_addr: ConfigAddr, pub devices: HashMap<u16, Box<dyn PciDevice + Send>>, } impl PciBus { pub fn new() -> Self { let host_bridge = HostBridge::new(); let mut pci_bus = PciBus { config_addr: ConfigAddr(0), devices: HashMap::new(), }; pci_bu...
PciBus
identifier_name
pci.rs
/* SPDX-License-Identifier: GPL-2.0-only */ use std::collections::HashMap; pub struct ConfigAddr(pub u32); impl ConfigAddr { pub fn enabled(&self) -> bool { (self.0 & (1 << 31))!= 0 } pub fn offset(&self) -> u8 { (self.0 & 0xff) as u8 } pub fn bdf(&self) -> u16 { ((self....
pub trait PciDevice { fn read(&self, offset: u8) -> u32; fn write(&mut self, offset: u8, value: u32); } pub struct HostBridge { pub data: [u32; 16], } impl HostBridge { pub fn new() -> Self { //0:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01) let ...
} }
random_line_split
web3.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...
//! Web3 rpc implementation. use hash::keccak; use jsonrpc_core::Result; use util::version; use v1::traits::Web3; use v1::types::{H256, Bytes}; /// Web3 rpc implementation. pub struct Web3Client; impl Web3Client { /// Creates new Web3Client. pub fn new() -> Self { Web3Client } } impl Web3 for Web3Client { fn clie...
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
random_line_split
web3.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 Web3 for Web3Client { fn client_version(&self) -> Result<String> { Ok(version().to_owned().replace("Parity/", "Parity//")) } fn sha3(&self, data: Bytes) -> Result<H256> { Ok(keccak(&data.0).into()) } }
{ Web3Client }
identifier_body
web3.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) -> Result<String> { Ok(version().to_owned().replace("Parity/", "Parity//")) } fn sha3(&self, data: Bytes) -> Result<H256> { Ok(keccak(&data.0).into()) } }
client_version
identifier_name
security_level.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
{ /// All blocks from genesis to chain head are known to have valid state transitions and PoW. FullState, /// All blocks from genesis to chain head are known to have a valid PoW. FullProofOfWork, /// Some recent headers (the argument) are known to have a valid PoW. PartialProofOfWork(BlockNumber), } impl Securi...
SecurityLevel
identifier_name
security_level.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
}
_ => false, } }
random_line_split
security_level.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
}
{ match *self { SecurityLevel::FullState | SecurityLevel::FullProofOfWork => true, _ => false, } }
identifier_body
closure-bounds-squiggle-closure-as-copyable-typaram.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: ~fn:Copy()) -> (~fn:(), ~fn:()) { bar(x) } fn main() { let v = ~[~[1,2,3],~[4,5,6]]; // shouldn't get double-freed let (f1,f2) = do foo { assert!(v.len() == 2); }; f1(); f2(); }
foo
identifier_name
closure-bounds-squiggle-closure-as-copyable-typaram.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 ...
; f1(); f2(); }
{ let v = ~[~[1,2,3],~[4,5,6]]; // shouldn't get double-freed let (f1,f2) = do foo { assert!(v.len() == 2); }
identifier_body
closure-bounds-squiggle-closure-as-copyable-typaram.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 ...
bar(x) } fn main() { let v = ~[~[1,2,3],~[4,5,6]]; // shouldn't get double-freed let (f1,f2) = do foo { assert!(v.len() == 2); }; f1(); f2(); }
random_line_split
main.rs
// y // 2 _|_|_ // 1 _|_|_ // 0 | | // 0 1 2 x use std::collections::LinkedList; use std::io::stdin; struct Step { loc: Loc, who: i8 } struct Loc { x: i8, y: i8, } struct EachRecord { win: Vec<Loc>, draw: Vec<Loc>, lose: Vec<Loc> } fn main() { let mut table : LinkedList<Step>...
// xxx * 3 x x // x * 3 x * 3 // x x let t1 = test1(&table); let t2 = test2(&table); let t3 = test3(&table); return 0; } fn test1(table: &[[i8; 3]; 3]) -> i8 { for i in 0.. 3 { if table[i][0]!= 0 && table[i][0] == table[i][1] && ...
// ret // 0 = unfinished // 1 = win 0 // 2 = win 1 // 3 = draw
random_line_split
main.rs
// y // 2 _|_|_ // 1 _|_|_ // 0 | | // 0 1 2 x use std::collections::LinkedList; use std::io::stdin; struct
{ loc: Loc, who: i8 } struct Loc { x: i8, y: i8, } struct EachRecord { win: Vec<Loc>, draw: Vec<Loc>, lose: Vec<Loc> } fn main() { let mut table : LinkedList<Step> = LinkedList::new(); let mut record : [EachRecord; 19683]; loop { if end_check(&table) { tab...
Step
identifier_name
main.rs
// y // 2 _|_|_ // 1 _|_|_ // 0 | | // 0 1 2 x use std::collections::LinkedList; use std::io::stdin; struct Step { loc: Loc, who: i8 } struct Loc { x: i8, y: i8, } struct EachRecord { win: Vec<Loc>, draw: Vec<Loc>, lose: Vec<Loc> } fn main() { let mut table : LinkedList<Step>...
fn add2record(table: &[[i8; 3]; 3], record: &mut [EachRecord; 19683]) { // Step(x, y, who) -> EachRecord[table]: // win: Vec<Loc NextStep>, draw: Vec<Loc>, lose: Vec<Loc> let t = table_status(table); } fn table_status(table: &[[i8; 3]; 3]) -> i8 { // ret // 0 = unfinished ...
{ return table.len() > 8; }
identifier_body
world.rs
use std::boxed::Box; use std::collections::HashMap; use glutin; use game::ContentId; use game::entity::{Entity, UID, EEntityType, EntityController}; use std::sync::mpsc::{Receiver, Sender, SyncSender}; use content::load_content::{EContentRequestType, EContentRequestResult}; use graphics::renderer::RenderFrame; use gam...
World { entity_uids: 1 as u64, //uids start at 1, because we can use 0 as a flag value, a NULL valye controller_uid: 1 as u64, to_content_server: to_content_server, from_cotent_server: from_cotent_server, to_render_thread: to_render_thread, ...
random_line_split
world.rs
use std::boxed::Box; use std::collections::HashMap; use glutin; use game::ContentId; use game::entity::{Entity, UID, EEntityType, EntityController}; use std::sync::mpsc::{Receiver, Sender, SyncSender}; use content::load_content::{EContentRequestType, EContentRequestResult}; use graphics::renderer::RenderFrame; use gam...
pub fn inner_update(mut self) { let mut frame_timer = FrameTimer::new(); let mut frame_count = 0 as u64; let controller_uid = self.get_uid_for_controller().clone(); let ui_uid = self.get_uid_for_controller().clone(); let mut entity_controllers: HashMap<EEntityType, &mut E...
{ let entity_type = entity.get_entity_type(); if !self.type_to_uid_list.contains_key(&entity_type) { self.type_to_uid_list.insert(entity_type, Vec::new()); } self.type_to_uid_list.get_mut(&entity_type).unwrap().push( entity.get_uid(), ); let entity...
identifier_body
world.rs
use std::boxed::Box; use std::collections::HashMap; use glutin; use game::ContentId; use game::entity::{Entity, UID, EEntityType, EntityController}; use std::sync::mpsc::{Receiver, Sender, SyncSender}; use content::load_content::{EContentRequestType, EContentRequestResult}; use graphics::renderer::RenderFrame; use gam...
(&mut self) -> UID { self.controller_uid += 1; return self.controller_uid; } pub fn load_content(&self, content: EContentRequestType) -> Result<ContentId, ELoadContentError> { let _ = self.to_content_server.send(content); let result = self.from_cotent_server.recv(); matc...
get_uid_for_controller
identifier_name
world.rs
use std::boxed::Box; use std::collections::HashMap; use glutin; use game::ContentId; use game::entity::{Entity, UID, EEntityType, EntityController}; use std::sync::mpsc::{Receiver, Sender, SyncSender}; use content::load_content::{EContentRequestType, EContentRequestResult}; use graphics::renderer::RenderFrame; use gam...
, } }, Err(_) => { return Err(ELoadContentError::LoadThreadNoResponce); }, } } }
{ return Ok(id); }
conditional_block
complex.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] fn test_to_str() { fn test(c : Complex64, s: String) { assert_eq!(c.to_str().to_string(), s); } test(_0_0i, "0+0i".to_string()); test(_1_0i, "1+0i".to_string()); test(_0_1i, "0+1i".to_string()); test(_1_1i, "1+1i".to_string()); ...
{ assert_eq!(-_1_0i + _0_1i, _neg1_1i); assert_eq!((-_0_1i) * _0_1i, _1_0i); for &c in all_consts.iter() { assert_eq!(-(-c), c); } }
identifier_body
complex.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 ...
let (r, theta) = c.to_polar(); assert!((c - Complex::from_polar(&r, &theta)).norm() < 1e-6); } for &c in all_consts.iter() { test(c); } } mod arith { use super::{_0_0i, _1_0i, _1_1i, _0_1i, _neg1_1i, _05_05i, all_consts}; use std::num::Zero; #[te...
random_line_split
complex.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 ...
} } #[cfg(test)] mod test { #![allow(non_uppercase_statics)] use super::{Complex64, Complex}; use std::num::{Zero,One,Float}; pub static _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 }; pub static _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 }; pub static _1_1i : Complex64 = Complex {...
{ format!("{}+{}i", self.re.to_str_radix(radix), self.im.to_str_radix(radix)) }
conditional_block
complex.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 ...
(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.im < Zero::zero() { write!(f, "{}-{}i", self.re, -self.im) } else { write!(f, "{}+{}i", self.re, self.im) } } } impl<T: ToStrRadix + Num + PartialOrd> ToStrRadix for Complex<T> { fn to_str_radix(&self, radi...
fmt
identifier_name
uninit-consts-allow-partially-uninit.rs
// compile-flags: -C no-prepopulate-passes -Z partially_uninit_const_threshold=1024 // Like uninit-consts.rs, but tests that we correctly generate partially-uninit consts // when the (disabled by default) partially_uninit_const_threshold flag is used. #![crate_type = "lib"] use std::mem::MaybeUninit; pub struct Par...
pub const fn partially_uninit() -> PartiallyUninit { const X: PartiallyUninit = PartiallyUninit { x: 0xdeadbeef, y: MaybeUninit::uninit() }; // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{(32|64)}}(i8* align 4 %1, i8* align 4 getelementptr inbounds (<{ [4 x i8], [12 x i8] }>, <{ [4 x i8], [12 x i8] }>* [[PARTIAL...
// This shouldn't contain undef, since it's larger than the 1024 byte limit. // CHECK: [[UNINIT_PADDING_HUGE:@[0-9]+]] = private unnamed_addr constant <{ [32768 x i8] }> <{ [32768 x i8] c"{{.+}}" }>, align 4 // CHECK-LABEL: @partially_uninit #[no_mangle]
random_line_split
uninit-consts-allow-partially-uninit.rs
// compile-flags: -C no-prepopulate-passes -Z partially_uninit_const_threshold=1024 // Like uninit-consts.rs, but tests that we correctly generate partially-uninit consts // when the (disabled by default) partially_uninit_const_threshold flag is used. #![crate_type = "lib"] use std::mem::MaybeUninit; pub struct Par...
() -> [(u32, u8); 4096] { const X: [(u32, u8); 4096] = [(123, 45); 4096]; // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{(32|64)}}(i8* align 4 %1, i8* align 4 getelementptr inbounds (<{ [32768 x i8] }>, <{ [32768 x i8] }>* [[UNINIT_PADDING_HUGE]], i32 0, i32 0, i32 0), i{{(32|64)}} 32768, i1 false) X }
uninit_padding_huge
identifier_name
lib.rs
#![doc(html_root_url = "https://dtolnay.github.io/syn")] #![cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))] extern crate proc_macro; extern crate proc_macro2; extern crate unicode_xid; #[cfg(any(feature = "printing", feature = "parsing"))] extern crate quote; #[cfg_attr(feature = "parsing", macro_use...
/// Parse a string of Rust code into the chosen syn data type. /// /// # Examples /// /// ```rust /// extern crate syn; /// # /// # #[macro_use] /// # extern crate error_chain; /// /// use syn::Expr; /// # /// # error_chain! { /// # foreign_links { /// # Syn(syn::ParseError); /// # } /// # } /// /// f...
{ _parse(tokens.into()) }
identifier_body
lib.rs
#![doc(html_root_url = "https://dtolnay.github.io/syn")] #![cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))] extern crate proc_macro; extern crate proc_macro2; extern crate unicode_xid; #[cfg(any(feature = "printing", feature = "parsing"))] extern crate quote; #[cfg_attr(feature = "parsing", macro_use...
<T>(tokens: proc_macro2::TokenStream) -> Result<T, ParseError> where T: Synom, { let buf = SynomBuffer::new(tokens); let result = T::parse(buf.begin()); let err = match result { Ok((rest, t)) => { if rest.eof() { return Ok(t); } else if rest == buf.begin()...
_parse
identifier_name
lib.rs
#![doc(html_root_url = "https://dtolnay.github.io/syn")] #![cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))] extern crate proc_macro; extern crate proc_macro2; extern crate unicode_xid; #[cfg(any(feature = "printing", feature = "parsing"))] extern crate quote; #[cfg_attr(feature = "parsing", macro_use...
pub use file::File; mod lifetime; pub use lifetime::Lifetime; mod lit; pub use lit::{Lit, LitKind}; mod mac; pub use mac::{Mac, TokenTree}; mod derive; pub use derive::{Body, DeriveInput, BodyEnum, BodyStruct}; mod op; pub use op::{BinOp, UnOp}; mod ty; pub use ty::{Abi, AbiKind, AngleBracketedParameterData, Bare...
ArgSelf, ArgCaptured}; #[cfg(feature = "full")] mod file; #[cfg(feature = "full")]
random_line_split
user.rs
// // FSUIPC library // Copyright (c) 2015 Alvaro Polo // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. use std::ffi::CString; use std::io; use std::os::raw::c_voi...
} pub struct UserSession<'a> { handle: &'a mut UserHandle, buffer: MutRawBytes, } impl<'a> Session for UserSession<'a> { fn read_bytes(&mut self, offset: u16, dest: *mut u8, len: usize) -> io::Result<usize> { self.buffer.write_rsd(offset, dest, len) } fn write_bytes(&mut self, offset: u1...
{ unsafe { GlobalDeleteAtom(self.file_mapping_atom); UnmapViewOfFile(self.data as *const c_void); CloseHandle(self.file_mapping); } }
identifier_body
user.rs
// // FSUIPC library // Copyright (c) 2015 Alvaro Polo // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. use std::ffi::CString; use std::io; use std::os::raw::c_voi...
{ handle: HWND, file_mapping_atom: ATOM, file_mapping: HANDLE, msg_id: u32, data: *mut u8, } impl UserHandle { pub fn new() -> io::Result<Self> { unsafe { let win_name = CString::new("UIPCMAIN").unwrap(); let handle = FindWindowExA( ptr::null_mut...
UserHandle
identifier_name
user.rs
// // FSUIPC library // Copyright (c) 2015 Alvaro Polo // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. use std::ffi::CString; use std::io; use std::os::raw::c_voi...
impl<'a> Session for UserSession<'a> { fn read_bytes(&mut self, offset: u16, dest: *mut u8, len: usize) -> io::Result<usize> { self.buffer.write_rsd(offset, dest, len) } fn write_bytes(&mut self, offset: u16, src: *const u8, len: usize) -> io::Result<usize> { self.buffer.write_wsd(offset, s...
buffer: MutRawBytes, }
random_line_split
user.rs
// // FSUIPC library // Copyright (c) 2015 Alvaro Polo // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. use std::ffi::CString; use std::io; use std::os::raw::c_voi...
let file_mapping_name = CString::new( format!("FsasmLib:IPC:{:x}:{:x}", GetCurrentProcessId(), next_file_mapping_index())).unwrap(); let file_mapping_atom = GlobalAddAtomA(file_mapping_name.as_ptr()); if file_mapping_atom == ...
{ return Err(io::Error::new( io::ErrorKind::ConnectionRefused, "cannot connect to user FSUIPC: cannot register window message")); }
conditional_block
wrapper.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes //! escape, a...
(&self) -> bool { match *self { TextContent::Text(_) => false, TextContent::GeneratedContent(ref content) => content.is_empty(), } } }
is_empty
identifier_name
wrapper.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes //! escape, a...
pub enum TextContent { Text(Box<str>), GeneratedContent(Vec<ContentItem>), } impl TextContent { pub fn is_empty(&self) -> bool { match *self { TextContent::Text(_) => false, TextContent::GeneratedContent(ref content) => content.is_empty(), } } }
damage } }
random_line_split
wrapper.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! A safe wrapper for DOM nodes that prevents layout from mutating the DOM, from letting DOM nodes //! escape, a...
fn flow_debug_id(self) -> usize { self.borrow_layout_data() .map_or(0, |d| d.flow_construction_result.debug_id()) } } pub trait GetStyleAndLayoutData<'dom> { fn get_style_and_layout_data(self) -> Option<StyleAndLayoutData<'dom>>; } impl<'dom, T> GetStyleAndLayoutData<'dom> for T where...
{ self.get_style_and_layout_data() .map(|d| d.layout_data.borrow_mut()) }
identifier_body
lattice.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 ...
try!(sub.tys(a, v)); try!(sub.tys(b, v)); Ok(()) } } impl<'a, 'tcx> LatticeDir<'tcx> for Glb<'a, 'tcx> { fn relate_bound(&self, v: Ty<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>) -> cres<'tcx, ()> { let sub = self.sub(); try!(sub.tys(v, a)); try!(sub.tys(v, b)); Ok((...
let sub = self.sub();
random_line_split
lattice.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 ...
} pub fn super_lattice_tys<'tcx, L:LatticeDir<'tcx>+Combine<'tcx>>(this: &L, a: Ty<'tcx>, b: Ty<'tcx>) -> cres<'tcx, Ty<'tc...
{ let sub = self.sub(); try!(sub.tys(v, a)); try!(sub.tys(v, b)); Ok(()) }
identifier_body
lattice.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 ...
<'tcx, L:LatticeDir<'tcx>+Combine<'tcx>>(this: &L, a: Ty<'tcx>, b: Ty<'tcx>) -> cres<'tcx, Ty<'tcx>> { debug!("{}.lattice...
super_lattice_tys
identifier_name
kmerge_impl.rs
use crate::size_hint; use crate::Itertools; use alloc::vec::Vec; use std::iter::FusedIterator; use std::mem::replace; use std::fmt; /// Head element and Tail iterator pair /// /// `PartialEq`, `Eq`, `PartialOrd` and `Ord` are implemented by comparing sequences based on /// first items (which are guaranteed to exist)....
impl<I, F> Clone for KMergeBy<I, F> where I: Iterator + Clone, I::Item: Clone, F: Clone, { clone_fields!(heap, less_than); } impl<I, F> Iterator for KMergeBy<I, F> where I: Iterator, F: KMergePredicate<I::Item> { type Item = I::Item; fn next(&mut self) -> Option<Sel...
{ let iter = iterable.into_iter(); let (lower, _) = iter.size_hint(); let mut heap: Vec<_> = Vec::with_capacity(lower); heap.extend(iter.filter_map(|it| HeadTail::new(it.into_iter()))); heapify(&mut heap, |a, b| less_than.kmerge_pred(&a.head, &b.head)); KMergeBy { heap, less_than } }
identifier_body
kmerge_impl.rs
use crate::size_hint; use crate::Itertools; use alloc::vec::Vec; use std::iter::FusedIterator; use std::mem::replace; use std::fmt; /// Head element and Tail iterator pair /// /// `PartialEq`, `Eq`, `PartialOrd` and `Ord` are implemented by comparing sequences based on /// first items (which are guaranteed to exist)....
#[derive(Clone, Debug)] pub struct KMergeByLt; impl<T: PartialOrd> KMergePredicate<T> for KMergeByLt { fn kmerge_pred(&mut self, a: &T, b: &T) -> bool { a < b } } impl<T, F: FnMut(&T, &T)->bool> KMergePredicate<T> for F { fn kmerge_pred(&mut self, a: &T, b: &T) -> bool { self(a, b) } }...
fn kmerge_pred(&mut self, a: &T, b: &T) -> bool; }
random_line_split
kmerge_impl.rs
use crate::size_hint; use crate::Itertools; use alloc::vec::Vec; use std::iter::FusedIterator; use std::mem::replace; use std::fmt; /// Head element and Tail iterator pair /// /// `PartialEq`, `Eq`, `PartialOrd` and `Ord` are implemented by comparing sequences based on /// first items (which are guaranteed to exist)....
} /// Hints at the size of the sequence, same as the `Iterator` method. fn size_hint(&self) -> (usize, Option<usize>) { size_hint::add_scalar(self.tail.size_hint(), 1) } } impl<I> Clone for HeadTail<I> where I: Iterator + Clone, I::Item: Clone { clone_fields!(head, tail); } ...
{ None }
conditional_block
kmerge_impl.rs
use crate::size_hint; use crate::Itertools; use alloc::vec::Vec; use std::iter::FusedIterator; use std::mem::replace; use std::fmt; /// Head element and Tail iterator pair /// /// `PartialEq`, `Eq`, `PartialOrd` and `Ord` are implemented by comparing sequences based on /// first items (which are guaranteed to exist)....
<I, F> where I: Iterator, { heap: Vec<HeadTail<I>>, less_than: F, } impl<I, F> fmt::Debug for KMergeBy<I, F> where I: Iterator + fmt::Debug, I::Item: fmt::Debug, { debug_fmt_fields!(KMergeBy, heap); } /// Create an iterator that merges elements of the contained iterators. /// /// Equival...
KMergeBy
identifier_name
by-value-self-argument-in-trait-impl.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(self) -> int { zzz(); self } } struct Struct { x: uint, y: uint, } impl Trait for Struct { fn method(self) -> Struct { zzz(); self } } impl Trait for (f64, int, int, f64) { fn method(self) -> (f64, int, int, f64) { zzz(); self } } impl Tra...
method
identifier_name
by-value-self-argument-in-trait-impl.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
fn zzz() {()}
{ let _ = (1111 as int).method(); let _ = Struct { x: 2222, y: 3333 }.method(); let _ = (4444.5, 5555, 6666, 7777.5).method(); let _ = (@8888).method(); }
identifier_body
by-value-self-argument-in-trait-impl.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// debugger:finish // debugger:print self->val // check:$4 = 8888 // debugger:continue trait Trait { fn method(self) -> Self; } impl Trait for int { fn method(self) -> int { zzz(); self } } struct Struct { x: uint, y: uint, } impl Trait for Struct { fn method(self) -> Struct...
random_line_split
net.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 ...
/// Returns the last error from the Windows socket interface. fn last_error() -> io::Error { io::Error::from_os_error(unsafe { c::WSAGetLastError() }) } /// Checks if the signed integer is the Windows constant `SOCKET_ERROR` (-1) /// and if so, returns the last error from the Windows socket interface.. This /// ...
{ static START: Once = ONCE_INIT; START.call_once(|| unsafe { let mut data: c::WSADATA = mem::zeroed(); let ret = c::WSAStartup(0x202, // version 2.2 &mut data); assert_eq!(ret, 0); rt::at_exit(|| { c::WSACleanup(); }) }); }
identifier_body
net.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 ...
pub type wrlen_t = i32; pub struct Socket(libc::SOCKET); /// Checks whether the Windows socket interface has been started already, and /// if not, starts it. pub fn init() { static START: Once = ONCE_INIT; START.call_once(|| unsafe { let mut data: c::WSADATA = mem::zeroed(); let ret = c::WSAS...
use sys_common::AsInner;
random_line_split
net.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 ...
() { static START: Once = ONCE_INIT; START.call_once(|| unsafe { let mut data: c::WSADATA = mem::zeroed(); let ret = c::WSAStartup(0x202, // version 2.2 &mut data); assert_eq!(ret, 0); rt::at_exit(|| { c::WSACleanup(); }) }); } /// Returns t...
init
identifier_name
fat.rs
//! A Mach-o fat binary is a multi-architecture binary container use core::fmt; if_std! { use std::fs::File; use std::io::{self, Read}; } use crate::error; use crate::mach::constants::cputype::{CpuSubType, CpuType, CPU_ARCH_ABI64, CPU_SUBTYPE_MASK}; use scroll::{Pread, Pwrite, SizeWith}; pub const FAT_MAGIC...
(&self) -> CpuSubType { self.cpusubtype &!CPU_SUBTYPE_MASK } /// Returns the capabilities of the CPU pub fn cpu_caps(&self) -> u32 { (self.cpusubtype & CPU_SUBTYPE_MASK) >> 24 } /// Whether this fat architecture header describes a 64-bit binary pub fn is_64(&self) -> bool { ...
cpusubtype
identifier_name
fat.rs
//! A Mach-o fat binary is a multi-architecture binary container use core::fmt; if_std! { use std::fs::File; use std::io::{self, Read}; } use crate::error; use crate::mach::constants::cputype::{CpuSubType, CpuType, CPU_ARCH_ABI64, CPU_SUBTYPE_MASK}; use scroll::{Pread, Pwrite, SizeWith}; pub const FAT_MAGIC...
} } /// Returns the cpu type pub fn cputype(&self) -> CpuType { self.cputype } /// Returns the cpu subtype with the capabilities removed pub fn cpusubtype(&self) -> CpuSubType { self.cpusubtype &!CPU_SUBTYPE_MASK } /// Returns the capabilities of the CPU p...
{ log::warn!("invalid `FatArch` offset"); &[] }
conditional_block
fat.rs
//! A Mach-o fat binary is a multi-architecture binary container use core::fmt; if_std! { use std::fs::File; use std::io::{self, Read}; } use crate::error; use crate::mach::constants::cputype::{CpuSubType, CpuType, CPU_ARCH_ABI64, CPU_SUBTYPE_MASK}; use scroll::{Pread, Pwrite, SizeWith}; pub const FAT_MAGIC...
}
{ let arch = bytes.pread_with::<FatArch>(offset, scroll::BE)?; Ok(arch) }
identifier_body
fat.rs
//! A Mach-o fat binary is a multi-architecture binary container use core::fmt; if_std! { use std::fs::File; use std::io::{self, Read}; } use crate::error; use crate::mach::constants::cputype::{CpuSubType, CpuType, CPU_ARCH_ABI64, CPU_SUBTYPE_MASK}; use scroll::{Pread, Pwrite, SizeWith}; pub const FAT_MAGIC...
/// Parse a mach-o fat header from the `bytes` pub fn parse(bytes: &[u8]) -> error::Result<FatHeader> { Ok(bytes.pread_with::<FatHeader>(0, scroll::BE)?) } } #[repr(C)] #[derive(Clone, Copy, Default, Pread, Pwrite, SizeWith)] /// The Mach-o `FatArch` always has its data bigendian pub struct FatArch...
random_line_split
kindck-inherited-copy-bound.rs
// Test that Copy bounds inherited by trait are checked. // // revisions: curr object_safe_for_dispatch #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))] #![feature(box_syntax)] use std::any::Any; trait Foo : Copy { fn foo(&self)
} impl<T:Copy> Foo for T { } fn take_param<T:Foo>(foo: &T) { } fn a() { let x: Box<_> = box 3; take_param(&x); //[curr]~ ERROR E0277 //[object_safe_for_dispatch]~^ ERROR E0277 } fn b() { let x: Box<_> = box 3; let y = &x; let z = &x as &dyn Foo; //[curr]~^ ERROR E0038 //[curr]~| ERR...
{}
identifier_body
kindck-inherited-copy-bound.rs
// Test that Copy bounds inherited by trait are checked. // // revisions: curr object_safe_for_dispatch #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))] #![feature(box_syntax)] use std::any::Any; trait Foo : Copy { fn foo(&self) {} } impl<T:Copy> Foo for T { } fn take_param<T:Foo>(foo:...
() { let x: Box<_> = box 3; let y = &x; let z = &x as &dyn Foo; //[curr]~^ ERROR E0038 //[curr]~| ERROR E0038 //[object_safe_for_dispatch]~^^^ ERROR E0038 } fn main() { }
b
identifier_name
kindck-inherited-copy-bound.rs
// Test that Copy bounds inherited by trait are checked. // // revisions: curr object_safe_for_dispatch #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))] #![feature(box_syntax)] use std::any::Any; trait Foo : Copy { fn foo(&self) {} } impl<T:Copy> Foo for T { } fn take_param<T:Foo>(foo:...
//[object_safe_for_dispatch]~^^^ ERROR E0038 } fn main() { }
let z = &x as &dyn Foo; //[curr]~^ ERROR E0038 //[curr]~| ERROR E0038
random_line_split
from_string.rs
use malachite_base::num::conversion::string::from_string::digit_from_display_byte; use malachite_base_test_util::generators::common::{GenConfig, GenMode}; use malachite_base_test_util::generators::{unsigned_gen, unsigned_gen_var_10}; use malachite_base_test_util::runner::Runner; pub(crate) fn register(runner: &mut Run...
fn demo_digit_from_display_byte(gm: GenMode, config: GenConfig, limit: usize) { for b in unsigned_gen().get(gm, &config).take(limit) { println!( "digit_from_display_byte({}) = {:?}", b, digit_from_display_byte(b) ); } } fn demo_digit_from_display_byte_targe...
{ register_demo!(runner, demo_digit_from_display_byte); register_demo!(runner, demo_digit_from_display_byte_targeted); }
identifier_body
from_string.rs
use malachite_base::num::conversion::string::from_string::digit_from_display_byte;
use malachite_base_test_util::generators::common::{GenConfig, GenMode}; use malachite_base_test_util::generators::{unsigned_gen, unsigned_gen_var_10}; use malachite_base_test_util::runner::Runner; pub(crate) fn register(runner: &mut Runner) { register_demo!(runner, demo_digit_from_display_byte); register_demo!...
random_line_split
from_string.rs
use malachite_base::num::conversion::string::from_string::digit_from_display_byte; use malachite_base_test_util::generators::common::{GenConfig, GenMode}; use malachite_base_test_util::generators::{unsigned_gen, unsigned_gen_var_10}; use malachite_base_test_util::runner::Runner; pub(crate) fn
(runner: &mut Runner) { register_demo!(runner, demo_digit_from_display_byte); register_demo!(runner, demo_digit_from_display_byte_targeted); } fn demo_digit_from_display_byte(gm: GenMode, config: GenConfig, limit: usize) { for b in unsigned_gen().get(gm, &config).take(limit) { println!( ...
register
identifier_name
x86_64-linux-macos.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/. */ #[allow(unused_mut)] #[inline(always)] pub unsafe fn request( default: usize, request: usize, ...
arg4: usize, arg5: usize) -> usize { let args: [usize; 6] = [request, arg1, arg2, arg3, arg4, arg5]; let mut result: usize; // Valgrind notices this magic instruction sequence and interprets // it as a kind of hypercall. When not running under Valgrind, // the instructions do noth...
arg2: usize, arg3: usize,
random_line_split
x86_64-linux-macos.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/. */ #[allow(unused_mut)] #[inline(always)] pub unsafe fn
( default: usize, request: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) -> usize { let args: [usize; 6] = [request, arg1, arg2, arg3, arg4, arg5]; let mut result: usize; // Valgrind notices this magic instruction sequence a...
request
identifier_name
x86_64-linux-macos.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/. */ #[allow(unused_mut)] #[inline(always)] pub unsafe fn request( default: usize, request: usize, ...
result }
{ let args: [usize; 6] = [request, arg1, arg2, arg3, arg4, arg5]; let mut result: usize; // Valgrind notices this magic instruction sequence and interprets // it as a kind of hypercall. When not running under Valgrind, // the instructions do nothing and `default` is returned. asm!(" r...
identifier_body
issue-5554.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 ...
() { constants!(); }
main
identifier_name
issue-5554.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(macro_ru...
// http://rust-lang.org/COPYRIGHT. //
random_line_split
api.rs
//! //! Public API for bitcrust-db //! //! //! //! use config; use store; use store::Store; use block_add; // Creates a store; mock interface pub fn init() -> Store { let config = test_cfg!(); let store = Store::new(&config); info!(store.logger, "Store intitalized"; "dir" => config.root.to_str().unwr...
(_: [u8; 32]) { } #[cfg(test)] mod tests { use util::*; use super::*; #[test] pub fn test_add_block() { let hex = "0100000000000000000000000000000000000000000000000000000000000000\ 000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa\ 4b1e5e4a29ab5f49ffff0...
get_block
identifier_name
api.rs
//! //! Public API for bitcrust-db //! //! //! //! use config; use store; use store::Store; use block_add; // Creates a store; mock interface pub fn init() -> Store { let config = test_cfg!(); let store = Store::new(&config); info!(store.logger, "Store intitalized"; "dir" => config.root.to_str().unwr...
pub fn get_block(_: [u8; 32]) { } #[cfg(test)] mod tests { use util::*; use super::*; #[test] pub fn test_add_block() { let hex = "0100000000000000000000000000000000000000000000000000000000000000\ 000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa\ 4b1...
random_line_split
api.rs
//! //! Public API for bitcrust-db //! //! //! //! use config; use store; use store::Store; use block_add; // Creates a store; mock interface pub fn init() -> Store { let config = test_cfg!(); let store = Store::new(&config); info!(store.logger, "Store intitalized"; "dir" => config.root.to_str().unwr...
pub fn get_block(_: [u8; 32]) { } #[cfg(test)] mod tests { use util::*; use super::*; #[test] pub fn test_add_block() { let hex = "0100000000000000000000000000000000000000000000000000000000000000\ 000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa\ 4...
{ }
identifier_body
generic-exterior-box.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} fn reclift<T:'static>(t: T) -> Recbox<T> { return Recbox {x: @t}; } pub fn main() { let foo: int = 17; let rbfoo: Recbox<int> = reclift::<int>(foo); assert_eq!(*rbfoo.x, foo); }
Recbox
identifier_name
generic-exterior-box.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 ...
#![feature(managed_boxes)] struct Recbox<T> {x: @T} fn reclift<T:'static>(t: T) -> Recbox<T> { return Recbox {x: @t}; } pub fn main() { let foo: int = 17; let rbfoo: Recbox<int> = reclift::<int>(foo); assert_eq!(*rbfoo.x, foo); }
// option. This file may not be copied, modified, or distributed // except according to those terms.
random_line_split
traversal.rs
processing after the last descendant // has been processed. break; } node = parent.as_node(); } } else { // Otherwise record the number of children to process when the time // comes. node.as...
child_cascade_requirement, is_initial_style, note_child, ); } // FIXME(bholley): Make these assertions pass for servo. if cfg!(feature = "gecko") && cfg!(debug_assertions) && data.styles.is_display_none() { debug_assert!(!element.has_dirty_descendants());...
data, propagated_hint,
random_line_split
traversal.rs
/// A DOM Traversal trait, that is used to generically implement styling for /// Gecko and Servo. pub trait DomTraversal<E: TElement>: Sync { /// Process `node` on the way down, before its children have been processed. /// /// The callback is invoked for each child node that should be processed by ///...
{ false }
identifier_body
traversal.rs
after the last descendant // has been processed. break; } node = parent.as_node(); } } else { // Otherwise record the number of children to process when the time // comes. node.as_element() ...
(node: E::ConcreteNode, _parent_data: &ElementData) -> bool { debug_assert!(node.is_text_node()); false } /// Returns true if traversal is needed for the given element and subtree. fn element_needs_traversal( el: E, traversal_flags: TraversalFlags, data: Option<&Elem...
text_node_needs_traversal
identifier_name
traversal.rs
after the last descendant // has been processed. break; } node = parent.as_node(); } } else { // Otherwise record the number of children to process when the time // comes. node.as_element() ...
; // Before examining each child individually, try to prove that our children // don't need style processing. They need processing if any of the following // conditions hold: // // * We have the dirty descendants bit. // * We're propagating a restyle hint. // * We can't skip the cascade....
{ element.has_dirty_descendants() }
conditional_block
lib.rs
#![feature(slice_patterns)] #![feature(advanced_slice_patterns)] use std::fs::File; use std::path::Path; use std::io::prelude::*; use std::str::Chars; use std::collections::VecDeque; use std::error::Error; mod defs; mod parser; mod repl; #[macro_use] pub use defs::*; use parser::*; use repl::eval; // outputs csv fil...
(&self, tag: &Tag) -> String { format!("NAVY,{},{},{},{},{},{},{},{},{},{},{}", parser::to_string(tag), self.cli, self.fri, self.man, self.com, self.tra, self.mon, self.iro, ...
to_csv_string
identifier_name
lib.rs
#![feature(slice_patterns)] #![feature(advanced_slice_patterns)] use std::fs::File; use std::path::Path; use std::io::prelude::*; use std::str::Chars; use std::collections::VecDeque; use std::error::Error; mod defs; mod parser; mod repl; #[macro_use] pub use defs::*; use parser::*; use repl::eval; // outputs csv fil...
} impl Army { fn new() -> Army { Army { irr: 0, cav: 0, inf: 0, hus: 0, cui: 0, dra: 0, art: 0, eng: 0, gua: 0, arm: 0, pla: 0, } } fn to_csv_string(&self, ta...
{ String::new() }
identifier_body
lib.rs
#![feature(slice_patterns)] #![feature(advanced_slice_patterns)] use std::fs::File; use std::path::Path; use std::io::prelude::*; use std::str::Chars; use std::collections::VecDeque; use std::error::Error; mod defs; mod parser; mod repl; #[macro_use] pub use defs::*; use parser::*; use repl::eval; // outputs csv fil...
} fn to_csv_string(&self, tag: &Tag) -> String { format!("ARMY,{},{},{},{},{},{},{},{},{},{},{},{}", parser::to_string(tag), self.irr, self.cav, self.inf, self.hus, self.cui, self.dra, ...
pla: 0, }
random_line_split
init.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::RegisterBindings; use crate::dom::bindings::conversions::is_dom_proxy; use cra...
}; }, _ => warn!("Failed to get file count limit"), }; } } #[cfg(not(target_os = "linux"))] fn perform_platform_specific_initialization() {} #[allow(unsafe_code)] unsafe extern "C" fn is_dom_object(obj: *mut JSObject) -> bool { !obj.is_null() && (is_platform_obje...
match libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) { 0 => (), _ => warn!("Failed to set file count limit"),
random_line_split
init.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::RegisterBindings; use crate::dom::bindings::conversions::is_dom_proxy; use cra...
() { // 4096 is default max on many linux systems const MAX_FILE_LIMIT: libc::rlim_t = 4096; // Bump up our number of file descriptors to save us from impending doom caused by an onslaught // of iframes. unsafe { let mut rlim = libc::rlimit { rlim_cur: 0, rlim_max: 0...
perform_platform_specific_initialization
identifier_name
init.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::RegisterBindings; use crate::dom::bindings::conversions::is_dom_proxy; use cra...
#[allow(unsafe_code)] pub fn init() -> JSEngineSetup { unsafe { proxyhandler::init(); // Create the global vtables used by the (generated) DOM // bindings to implement JS proxies. RegisterBindings::RegisterProxyHandlers(); js::glue::InitializeMemoryReporter(Some(is_dom_ob...
{ !obj.is_null() && (is_platform_object_static(obj) || is_dom_proxy(obj)) }
identifier_body
init.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::codegen::RegisterBindings; use crate::dom::bindings::conversions::is_dom_proxy; use cra...
else { MAX_FILE_LIMIT } }, }; match libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) { 0 => (), _ => warn!("Failed to set file count limit"), }; }, ...
{ rlim.rlim_max }
conditional_block
index.rs
use Context; use ffi; use std::ffi::CString; pub trait LuaIndex { fn get(&self, cxt: &Context, idx: i32); fn set(&self, cxt: &Context, idx: i32); } macro_rules! integer_index { ($ty:ident) => ( impl LuaIndex for $ty { fn get(&self, cxt: &Context, idx: i32) { unsafe { f...
(&self, cxt: &Context, idx: i32) { unsafe { ffi::lua_getfield(cxt.handle, idx, unsafe { CString::new(*self).unwrap().as_ptr() as _ }) } } fn set(&self, cxt: &Context, idx: i32) { unsafe { ffi::lua_setfield(cxt.handle, idx, unsafe { CString::new(*self).unwrap().as...
get
identifier_name
index.rs
use Context; use ffi; use std::ffi::CString; pub trait LuaIndex { fn get(&self, cxt: &Context, idx: i32); fn set(&self, cxt: &Context, idx: i32); } macro_rules! integer_index { ($ty:ident) => ( impl LuaIndex for $ty { fn get(&self, cxt: &Context, idx: i32) { unsafe { f...
}
{ unsafe { ffi::lua_setfield(cxt.handle, idx, unsafe { CString::new(*self).unwrap().as_ptr() as _ }) } }
identifier_body
index.rs
use Context;
use std::ffi::CString; pub trait LuaIndex { fn get(&self, cxt: &Context, idx: i32); fn set(&self, cxt: &Context, idx: i32); } macro_rules! integer_index { ($ty:ident) => ( impl LuaIndex for $ty { fn get(&self, cxt: &Context, idx: i32) { unsafe { ffi::lua_rawgeti(cxt.han...
use ffi;
random_line_split
reserved.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/. */ /// Taken from `https://en.cppreference.com/w/cpp/keyword` /// Some experimental keywords were filtered out and th...
(rust_identifier: &mut String) { if RESERVED_KEYWORDS .binary_search(&rust_identifier.as_ref()) .is_ok() { rust_identifier.push('_'); } }
escape
identifier_name
reserved.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/. */ /// Taken from `https://en.cppreference.com/w/cpp/keyword` /// Some experimental keywords were filtered out and th...
{ if RESERVED_KEYWORDS .binary_search(&rust_identifier.as_ref()) .is_ok() { rust_identifier.push('_'); } }
identifier_body
reserved.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/. */ /// Taken from `https://en.cppreference.com/w/cpp/keyword` /// Some experimental keywords were filtered out and th...
}
{ rust_identifier.push('_'); }
conditional_block
reserved.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/. */ /// Taken from `https://en.cppreference.com/w/cpp/keyword` /// Some experimental keywords were filtered out and th...
"try", "typedef", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", ]; pub fn escape(rust_identifier: &mut String) { if RESERVED_KEYWORDS .binary_search(&rust_identifier.as_ref()) .is_ok() { rust_identi...
"template", "this", "thread_local", "throw", "true",
random_line_split
clap-test.rs
#[allow(unused_imports, dead_code)] mod test { use std::str; use std::io::{Cursor, Write}; use regex::Regex; use clap::{App, Arg, SubCommand, ArgGroup}; fn compare<S, S2>(l: S, r: S2) -> bool where S: AsRef<str>, S2: AsRef<str> { let re = Regex::new("\x1b[^m]*m")...
.arg(Arg::from_usage("-f --flag... 'tests flags'") .global(true)) .args(&[ Arg::from_usage("[flag2] -F 'tests flags with exclusions'").conflicts_with("flag").requires("long-option-2"), Arg::from_usage("--long-option-2 [option2] 'tests long options wit...
.args_from_usage(args)
random_line_split
clap-test.rs
#[allow(unused_imports, dead_code)] mod test { use std::str; use std::io::{Cursor, Write}; use regex::Regex; use clap::{App, Arg, SubCommand, ArgGroup}; fn compare<S, S2>(l: S, r: S2) -> bool where S: AsRef<str>, S2: AsRef<str> { let re = Regex::new("\x1b[^m]*m")...
b } pub fn compare_output(l: App, args: &str, right: &str, stderr: bool) -> bool { let mut buf = Cursor::new(Vec::with_capacity(50)); let res = l.get_matches_from_safe(args.split(' ').collect::<Vec<_>>()); let err = res.unwrap_err(); err.write_to(&mut buf).unwrap(); ...
{ println!(""); println!("--> left"); println!("{}", left); println!("--> right"); println!("{}", right); println!("--") }
conditional_block
clap-test.rs
#[allow(unused_imports, dead_code)] mod test { use std::str; use std::io::{Cursor, Write}; use regex::Regex; use clap::{App, Arg, SubCommand, ArgGroup}; fn
<S, S2>(l: S, r: S2) -> bool where S: AsRef<str>, S2: AsRef<str> { let re = Regex::new("\x1b[^m]*m").unwrap(); // Strip out any mismatching \r character on windows that might sneak in on either side let ls = l.as_ref().trim().replace("\r", ""); let rs = r.as_ref...
compare
identifier_name
clap-test.rs
#[allow(unused_imports, dead_code)] mod test { use std::str; use std::io::{Cursor, Write}; use regex::Regex; use clap::{App, Arg, SubCommand, ArgGroup}; fn compare<S, S2>(l: S, r: S2) -> bool where S: AsRef<str>, S2: AsRef<str> { let re = Regex::new("\x1b[^m]*m")...
Arg::from_usage("--minvals2 [minvals]... 'Tests 2 min vals'").min_values(2), Arg::from_usage("--maxvals3 [maxvals]... 'Tests 3 max vals'").max_values(3) ]) .subcommand(SubCommand::with_name("subcmd") .about("tests subcommands") ...
{ let args = "-o --option=[opt]... 'tests options' [positional] 'tests positionals'"; let opt3_vals = ["fast", "slow"]; let pos3_vals = ["vi", "emacs"]; App::new("clap-test") .version("v1.4.8") .about("tests clap library") .author("...
identifier_body
template.rs
use Renderable; use context::Context; use filters::{size, upcase, minus, plus, replace, times, divided_by, ceil, floor, round}; use error::Result; pub struct Template { pub elements: Vec<Box<Renderable>>, } impl Renderable for Template { fn render(&self, context: &mut Context) -> Result<Option<String>> { ...
} Ok(Some(buf)) } } impl Template { pub fn new(elements: Vec<Box<Renderable>>) -> Template { Template { elements: elements } } }
{ break; }
conditional_block
template.rs
use Renderable; use context::Context; use filters::{size, upcase, minus, plus, replace, times, divided_by, ceil, floor, round}; use error::Result; pub struct Template { pub elements: Vec<Box<Renderable>>, } impl Renderable for Template { fn render(&self, context: &mut Context) -> Result<Option<String>> { ...
// Did the last element we processed set an interrupt? If so, we // need to abandon the rest of our child elements and just // return what we've got. This is usually in response to a // `break` or `continue` tag being rendered. if context.interrupted() { ...
random_line_split