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
names.rs
//! This example of boxcars extracts all the player names found in the "PlayerStats" property of the //! header. This property may be absent in some replays or lack players that drop or join mid-game. //! A more foolproof approach is to scour the network data for a specific property: //! "Engine.PlayerReplicationInfo:P...
fn main() -> Result<(), Box<dyn error::Error>> { let mut data = Vec::new(); io::stdin().read_to_end(&mut data)?; let replay = ParserBuilder::new(&data[..]) .on_error_check_crc() .ignore_network_data_on_error() .parse()?; let stats_prop = replay .properties .iter() ...
{ let id = replay .objects .iter() .position(|val| val == "Engine.PlayerReplicationInfo:PlayerName") .map(|index| boxcars::ObjectId(index as i32)) .ok_or("Expected Engine.PlayerReplicationInfo:PlayerName to be present in replay")?; Ok(id) }
identifier_body
names.rs
//! This example of boxcars extracts all the player names found in the "PlayerStats" property of the //! header. This property may be absent in some replays or lack players that drop or join mid-game. //! A more foolproof approach is to scour the network data for a specific property: //! "Engine.PlayerReplicationInfo:P...
( replay: &boxcars::Replay, ) -> Result<boxcars::ObjectId, Box<dyn error::Error>> { let id = replay .objects .iter() .position(|val| val == "Engine.PlayerReplicationInfo:PlayerName") .map(|index| boxcars::ObjectId(index as i32)) .ok_or("Expected Engine.PlayerReplicationInfo:Pl...
player_name_object_id
identifier_name
integration_test.rs
// Synapse password reset // Copyright (C) 2016 Euan Kemp // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. ...
(c: &hyper::Client, uname: String, password: String) { let encoded: String = form_urlencoded::Serializer::new(String::new()) .append_pair("Username", uname.as_ref()) .append_pair("Password", password.as_ref()) .finish(); let mut res = c.post("http://localhost:8082") ...
register_user
identifier_name
integration_test.rs
// Synapse password reset // Copyright (C) 2016 Euan Kemp // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. ...
#[test] fn it_works() { let c = Client::new(); let mut rng = OsRng::new().unwrap(); let orig_pass = format!("password{}", rng.next_u64()); let username1 = format!("user{}", rng.next_u64()); register_user(&c, username1.clone(), orig_pass.clone()); let result = lo...
_ => Err(resp.status), } }
random_line_split
integration_test.rs
// Synapse password reset // Copyright (C) 2016 Euan Kemp // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. ...
fn reset_password(c: &hyper::Client, uname: String, token: String, password: String) -> (hyper::status::StatusCode, String) { let encoded = form_urlencoded::Serializer::new(String::new()) .append_pair("usern...
{ let encoded: String = form_urlencoded::Serializer::new(String::new()) .append_pair("Username", uname.as_ref()) .append_pair("Password", password.as_ref()) .finish(); let mut res = c.post("http://localhost:8082") .header(hyper::header::ContentType::form_u...
identifier_body
issue-61963.rs
// aux-build:issue-61963.rs // aux-build:issue-61963-1.rs #![deny(bare_trait_objects)] #[macro_use] extern crate issue_61963; #[macro_use] extern crate issue_61963_1; // This test checks that the bare trait object lint does not trigger on macro attributes that // generate code which would trigger the lint. pub struc...
#[dom_struct] pub struct Foo { //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] //~| WARN this is accepted in the current edition qux: Qux<Qux<Baz>>, bar: Box<Bar>, //~^ ERROR trait objects without an explicit `dyn` are deprecated [bare_trait_objects] //~| ...
pub trait Bar {} pub struct Qux<T>(T);
random_line_split
issue-61963.rs
// aux-build:issue-61963.rs // aux-build:issue-61963-1.rs #![deny(bare_trait_objects)] #[macro_use] extern crate issue_61963; #[macro_use] extern crate issue_61963_1; // This test checks that the bare trait object lint does not trigger on macro attributes that // generate code which would trigger the lint. pub struc...
() {}
main
identifier_name
errors.rs
//! Error handling for git-global. use std::error::Error; use std::fmt; use std::io; use std::result; /// An error. #[derive(Debug)] pub enum GitGlobalError {
} /// Our `Result` alias with `GitGlobalError` as the error type. pub type Result<T> = result::Result<T, GitGlobalError>; impl fmt::Display for GitGlobalError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use GitGlobalError::*; match *self { BadSubcommand(ref cmd) => { ...
BadSubcommand(String), Generic,
random_line_split
errors.rs
//! Error handling for git-global. use std::error::Error; use std::fmt; use std::io; use std::result; /// An error. #[derive(Debug)] pub enum GitGlobalError { BadSubcommand(String), Generic, } /// Our `Result` alias with `GitGlobalError` as the error type. pub type Result<T> = result::Result<T, GitGlobalErro...
(err: io::Error) -> GitGlobalError { GitGlobalError::Generic } }
from
identifier_name
webglobject.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/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use dom::bindings::codegen::Bindings::WebGLOb...
(global: GlobalRef) -> Root<WebGLObject> { reflect_dom_object(box WebGLObject::new_inherited(), global, WebGLObjectBinding::Wrap) } }
new
identifier_name
webglobject.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/. */ // https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use dom::bindings::codegen::Bindings::WebGLOb...
}
{ reflect_dom_object(box WebGLObject::new_inherited(), global, WebGLObjectBinding::Wrap) }
identifier_body
webglobject.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/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl use dom::bindings::codegen::Bindings::WebGLObjectBinding; use dom::bindings::global::GlobalRef; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::bindings::js::Root; #[dom_struct] pub struct WebGLObject { reflector_: Reflector, ...
random_line_split
main.rs
use std::io; use std::iter; mod zipper; fn get_numbers_divisible_by(divisor: uint, max: uint) -> Vec<uint> { iter::count(1u, 1). filter(|&n| n % divisor == 0). take_while(|&n| n < max). collect() } fn get_factors(number: uint) -> Vec<uint> { iter::range(1u, number + 1). filter(|&n| number % n...
() { let numbers = super::get_numbers_divisible_by(2, 100); for n in numbers.into_iter() { let half_n: f32 = n as f32 / 2.0; assert!(half_n == half_n.ceil()); } } #[test] fn get_numbers_divisible_by_3 () { let numbers = super::get_numbers_divisible_b...
get_numbers_divisible_by_2
identifier_name
main.rs
use std::io; use std::iter; mod zipper; fn get_numbers_divisible_by(divisor: uint, max: uint) -> Vec<uint>
fn get_factors(number: uint) -> Vec<uint> { iter::range(1u, number + 1). filter(|&n| number % n == 0). collect() } #[cfg(test)] mod test { use std::num::Float; use std::slice::PartialEqSliceExt; #[test] fn get_numbers_divisible_by_2 () { let numbers = super::get_numbers_divisible...
{ iter::count(1u, 1). filter(|&n| n % divisor == 0). take_while(|&n| n < max). collect() }
identifier_body
main.rs
use std::io; use std::iter; mod zipper; fn get_numbers_divisible_by(divisor: uint, max: uint) -> Vec<uint> {
fn get_factors(number: uint) -> Vec<uint> { iter::range(1u, number + 1). filter(|&n| number % n == 0). collect() } #[cfg(test)] mod test { use std::num::Float; use std::slice::PartialEqSliceExt; #[test] fn get_numbers_divisible_by_2 () { let numbers = super::get_numbers_divisible_...
iter::count(1u, 1). filter(|&n| n % divisor == 0). take_while(|&n| n < max). collect() }
random_line_split
harfbuzz.rs
_t, } pub struct ShapedGlyphEntry { cluster: uint, codepoint: GlyphIndex, advance: Au, offset: Option<Point2D<Au>>, } impl ShapedGlyphData { pub fn new(buffer: *hb_buffer_t) -> ShapedGlyphData { unsafe { let glyph_count = 0; let glyph_infos = hb_buffer_get_glyph_inf...
} if max_glyph_idx > glyph_span.end() { glyph_span.extend_to(max_glyph_idx); debug!("Extended glyph span (off={:u}, len={:u}) to cover char byte span's max \ glyph index", glyph_span.begin(),...
{ max_glyph_idx = num::max(byteToGlyph[i] as uint + 1, max_glyph_idx); }
conditional_block
harfbuzz.rs
_destroy(self.hb_funcs); } } } impl Shaper { pub fn new(font: &mut Font) -> Shaper { unsafe { // Indirection for Rust Issue #6248, dynamic freeze scope artifically extended let font_ptr = font as *mut Font; let hb_face: *hb_face_t = hb_face_create_for_tables(...
destroy_blob_func
identifier_name
harfbuzz.rs
position_t, } pub struct ShapedGlyphEntry { cluster: uint, codepoint: GlyphIndex, advance: Au, offset: Option<Point2D<Au>>, } impl ShapedGlyphData { pub fn new(buffer: *hb_buffer_t) -> ShapedGlyphData { unsafe { let glyph_count = 0; let glyph_infos = hb_buffer_get_g...
glyph", char_byte_span.end()); let range = text.char_range_at(char_byte_span.end()); drop(range.ch); char_byte_span.extend_to(range.next); } // extend glyph range to max glyph index covered by char_s...
random_line_split
harfbuzz.rs
the y-position of the pen. pub fn get_entry_for_glyph(&self, i: uint, y_pos: &mut Au) -> ShapedGlyphEntry { assert!(i < self.count); unsafe { let glyph_info_i = ptr::offset(self.glyph_infos, i as int); let pos_info_i = ptr::offset(self.pos_infos, i as int); let ...
{ let font: *Font = font_data as *Font; assert!(font.is_not_null()); unsafe { match (*font).glyph_index(char::from_u32(unicode).unwrap()) { Some(g) => { *glyph = g as hb_codepoint_t; true as hb_bool_t } None => false as hb_bool_t ...
identifier_body
dir_ind.rs
use std::io::{self, Read, Write}; use std::fmt; use instruction::parameter::{Direct, Indirect}; use instruction::parameter::{ParamType, ParamTypeOf}; use instruction::parameter::InvalidParamType; use instruction::mem_size::MemSize; use instruction::write_to::WriteTo; use instruction::get_value::GetValue; use machine::M...
} impl WriteTo for DirInd { fn write_to<W: Write>(&self, writer: &mut W) -> io::Result<()> { match *self { DirInd::Direct(direct) => direct.write_to(writer), DirInd::Indirect(indirect) => indirect.write_to(writer), } } } impl ParamTypeOf for DirInd { fn param_type(...
{ match *self { DirInd::Direct(direct) => direct.mem_size(), DirInd::Indirect(indirect) => indirect.mem_size(), } }
identifier_body
dir_ind.rs
use std::io::{self, Read, Write}; use std::fmt; use instruction::parameter::{Direct, Indirect}; use instruction::parameter::{ParamType, ParamTypeOf}; use instruction::parameter::InvalidParamType; use instruction::mem_size::MemSize; use instruction::write_to::WriteTo; use instruction::get_value::GetValue; use machine::M...
<R: Read>(param_type: ParamType, reader: &mut R) -> Result<Self, Error> { match param_type { ParamType::Direct => Ok(DirInd::Direct(Direct::read_from(reader)?)), ParamType::Indirect => Ok(DirInd::Indirect(Indirect::read_from(reader)?)), _ => Err(Error::InvalidParamType(Invali...
read_from
identifier_name
dir_ind.rs
use std::io::{self, Read, Write}; use std::fmt; use instruction::parameter::{Direct, Indirect}; use instruction::parameter::{ParamType, ParamTypeOf}; use instruction::parameter::InvalidParamType; use instruction::mem_size::MemSize; use instruction::write_to::WriteTo; use instruction::get_value::GetValue; use machine::M...
fn mem_size(&self) -> usize { match *self { DirInd::Direct(direct) => direct.mem_size(), DirInd::Indirect(indirect) => indirect.mem_size(), } } } impl WriteTo for DirInd { fn write_to<W: Write>(&self, writer: &mut W) -> io::Result<()> { match *self { ...
} impl MemSize for DirInd {
random_line_split
build.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 ...
} } fn commit_hash() -> Option<String> { Command::new("git") .args(&["rev-parse", "--short", "HEAD"]) .output() .ok() .and_then(|r| String::from_utf8(r.stdout).ok()) } fn commit_date() -> Option<String> { Command::new("git") .args(&["log", "-1", "--date=short", "--pretty...
match (commit_hash(), commit_date()) { (Some(hash), Some(date)) => format!(" ({} {})", hash.trim_right(), date), _ => String::new(),
random_line_split
build.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 ...
() -> String { match (commit_hash(), commit_date()) { (Some(hash), Some(date)) => format!(" ({} {})", hash.trim_right(), date), _ => String::new(), } } fn commit_hash() -> Option<String> { Command::new("git") .args(&["rev-parse", "--short", "HEAD"]) .output() .ok() ...
commit_info
identifier_name
build.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 ...
fn commit_date() -> Option<String> { Command::new("git") .args(&["log", "-1", "--date=short", "--pretty=format:%cd"]) .output() .ok() .and_then(|r| String::from_utf8(r.stdout).ok()) }
{ Command::new("git") .args(&["rev-parse", "--short", "HEAD"]) .output() .ok() .and_then(|r| String::from_utf8(r.stdout).ok()) }
identifier_body
sshengine.rs
use std::net::TcpStream; use std::path::Path; use std::path::PathBuf; use ssh2::Session; use std::io; use std::io::Write; use std::io::Read; use std::fs::File; use std::io::BufReader; use std::io::BufWriter; pub fn
(adress: &str, user: &str, password: &str, remote_root_path: &Path, files_path: &Vec<PathBuf>) { let tcp = TcpStream::connect(adress).unwrap(); let mut sess = Session::new().unwrap(); sess.handshake(&tcp).unwrap(); sess.userauth_password(user, password).unwrap(); for file_path in files_path { let filename = fil...
upload_to_remote
identifier_name
sshengine.rs
use std::net::TcpStream; use std::path::Path; use std::path::PathBuf; use ssh2::Session; use std::io; use std::io::Write; use std::io::Read; use std::fs::File; use std::io::BufReader; use std::io::BufWriter; pub fn upload_to_remote(adress: &str, user: &str, password: &str, remote_root_path: &Path, files_path: &Vec<Pa...
let file_size = file.metadata().unwrap().len(); let mut file_reader = BufReader::new(file); let mut remote_path = remote_root_path.join(filename); println!("Remote path {:?}", remote_path); let mut remote_channel = sess.scp_send(&remote_path, 0o644, file_size, None).unwrap(); let mut remote_file_writer =...
for file_path in files_path { let filename = file_path.file_name().unwrap(); let mut file = File::open(&file_path).unwrap();
random_line_split
sshengine.rs
use std::net::TcpStream; use std::path::Path; use std::path::PathBuf; use ssh2::Session; use std::io; use std::io::Write; use std::io::Read; use std::fs::File; use std::io::BufReader; use std::io::BufWriter; pub fn upload_to_remote(adress: &str, user: &str, password: &str, remote_root_path: &Path, files_path: &Vec<P...
io::copy(&mut file_reader, &mut remote_file_writer); } } pub fn download_file_from_remote(adress: &str, user: &str, password: &str, remote_path: &Path, local_path: &Path) { //remote duplicate code let tcp = TcpStream::connect(adress).unwrap(); let mut sess = Session::new().unwrap(); sess.handshake(&tcp).unwrap...
{ let tcp = TcpStream::connect(adress).unwrap(); let mut sess = Session::new().unwrap(); sess.handshake(&tcp).unwrap(); sess.userauth_password(user, password).unwrap(); for file_path in files_path { let filename = file_path.file_name().unwrap(); let mut file = File::open(&file_path).unwrap(); let file_size...
identifier_body
eq_op_macros.rs
#![warn(clippy::eq_op)] // lint also in macro definition macro_rules! assert_in_macro_def { () => { let a = 42; assert_eq!(a, a); assert_ne!(a, a); debug_assert_eq!(a, a); debug_assert_ne!(a, a); }; } // lint identical args in assert-like macro invocations (see #3574) f...
// ok debug_assert_ne!(a, b); debug_assert_ne!(a, a + 1); debug_assert_ne!(a + 1, b + 1); let my_vec = vec![1; 5]; let mut my_iter = my_vec.iter(); assert_ne!(my_iter.next(), my_iter.next()); }
random_line_split
eq_op_macros.rs
#![warn(clippy::eq_op)] // lint also in macro definition macro_rules! assert_in_macro_def { () => { let a = 42; assert_eq!(a, a); assert_ne!(a, a); debug_assert_eq!(a, a); debug_assert_ne!(a, a); }; } // lint identical args in assert-like macro invocations (see #3574) f...
() { assert_in_macro_def!(); let a = 1; let b = 2; // lint identical args in `assert_eq!` assert_eq!(a, a); assert_eq!(a + 1, a + 1); // ok assert_eq!(a, b); assert_eq!(a, a + 1); assert_eq!(a + 1, b + 1); // lint identical args in `assert_ne!` assert_ne!(a, a); as...
main
identifier_name
eq_op_macros.rs
#![warn(clippy::eq_op)] // lint also in macro definition macro_rules! assert_in_macro_def { () => { let a = 42; assert_eq!(a, a); assert_ne!(a, a); debug_assert_eq!(a, a); debug_assert_ne!(a, a); }; } // lint identical args in assert-like macro invocations (see #3574) f...
assert_ne!(a + 1, b + 1); // lint identical args in `debug_assert_eq!` debug_assert_eq!(a, a); debug_assert_eq!(a + 1, a + 1); // ok debug_assert_eq!(a, b); debug_assert_eq!(a, a + 1); debug_assert_eq!(a + 1, b + 1); // lint identical args in `debug_assert_ne!` debug_assert_ne!...
{ assert_in_macro_def!(); let a = 1; let b = 2; // lint identical args in `assert_eq!` assert_eq!(a, a); assert_eq!(a + 1, a + 1); // ok assert_eq!(a, b); assert_eq!(a, a + 1); assert_eq!(a + 1, b + 1); // lint identical args in `assert_ne!` assert_ne!(a, a); asser...
identifier_body
arm_unknown_linux_gnueabihf.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 base = super::linux_base::opts(); Target { llvm_target: "arm-unknown-linux-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: "gnueabihf".t...
identifier_body
arm_unknown_linux_gnueabihf.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 ...
() -> Target { let base = super::linux_base::opts(); Target { llvm_target: "arm-unknown-linux-gnueabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), arch: "arm".to_string(), target_os: "linux".to_string(), target_env: ...
target
identifier_name
arm_unknown_linux_gnueabihf.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 ...
options: TargetOptions { features: "+v6,+vfp2".to_string(), .. base } } }
random_line_split
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bi...
fn bind_to_tree(&self, tree_in_doc: bool) { if let Some(ref s) = self.super_type() { s.bind_to_tree(tree_in_doc); } let node = NodeCast::from_ref(self); node.check_parent_disabled_state_for_option(); } fn unbind_from_tree(&self, tree_in_doc: bool) { if...
{ if let Some(ref s) = self.super_type() { s.before_remove_attr(attr); } match attr.local_name() { &atom!("disabled") => { let node = NodeCast::from_ref(self); node.set_disabled_state(false); node.set_enabled_state(true); ...
identifier_body
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bi...
(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> Root<HTMLOptionElement> { let element = HTMLOptionElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap) } } fn collect_tex...
new
identifier_name
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bi...
} } } impl HTMLOptionElementMethods for HTMLOptionElement { // https://www.whatwg.org/html/#dom-option-disabled make_bool_getter!(Disabled); // https://www.whatwg.org/html/#dom-option-disabled fn SetDisabled(&self, disabled: bool) { let elem = ElementCast::from_ref(self); ...
{ collect_text(&child.r(), value); }
conditional_block
htmloptionelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods; use dom::bi...
let node = NodeCast::from_ref(self); node.check_parent_disabled_state_for_option(); } fn unbind_from_tree(&self, tree_in_doc: bool) { if let Some(ref s) = self.super_type() { s.unbind_from_tree(tree_in_doc); } let node = NodeCast::from_ref(self); if ...
random_line_split
iso_8859_7.rs
// AUTOGENERATED FROM index-iso-8859-7.txt, ORIGINAL COMMENT FOLLOWS: // // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/ // // For details on index-iso-8859-7.txt see the Encoding Standard // http://encoding.spec.whatwg.org/ static FORWARD_TABLE: &'static [u16] ...
(code: u32) -> u8 { let offset = (code >> 5) as uint; let offset = if offset < 262 {BACKWARD_TABLE_UPPER[offset] as uint} else {0}; BACKWARD_TABLE_LOWER[offset + ((code & 31) as uint)] } #[cfg(test)] single_byte_tests!()
backward
identifier_name
iso_8859_7.rs
// AUTOGENERATED FROM index-iso-8859-7.txt, ORIGINAL COMMENT FOLLOWS: // // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/ // // For details on index-iso-8859-7.txt see the Encoding Standard // http://encoding.spec.whatwg.org/ static FORWARD_TABLE: &'static [u16] ...
else {0}; BACKWARD_TABLE_LOWER[offset + ((code & 31) as uint)] } #[cfg(test)] single_byte_tests!()
{BACKWARD_TABLE_UPPER[offset] as uint}
conditional_block
iso_8859_7.rs
// AUTOGENERATED FROM index-iso-8859-7.txt, ORIGINAL COMMENT FOLLOWS: // // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/ // // For details on index-iso-8859-7.txt see the Encoding Standard // http://encoding.spec.whatwg.org/ static FORWARD_TABLE: &'static [u16] ...
static BACKWARD_TABLE_LOWER: &'static [u8] = &[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159...
{ FORWARD_TABLE[(code - 0x80) as uint] }
identifier_body
iso_8859_7.rs
// AUTOGENERATED FROM index-iso-8859-7.txt, ORIGINAL COMMENT FOLLOWS:
// // For details on index-iso-8859-7.txt see the Encoding Standard // http://encoding.spec.whatwg.org/ static FORWARD_TABLE: &'static [u16] = &[ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 1...
// // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/
random_line_split
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
}) } /// Given a settings page and a name, returns the row that has that name. pub fn get_row_by_name(page: &'static SettingsPage, name: &str) -> &'static SettingRow { for row in page.iter() { if row.name == name { return row } } panic!("No setting row with that name in...
{ directory_exit(s, settings__.clone()); }
conditional_block
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
.parse() .expect("Unable to parse last-page value into usize!"); let last_page = PAGE_LIST[last_page_ix]; let changed = check_changes(s, last_page, settings_.clone()); if changed { let ix = get_page_index(new_page.name) ...
.on_submit(move |s, new_page| { let new_page: &&'static SettingsPage = new_page; let last_page_ix: usize = settings_.get(String::from("last-page")) .expect("`last-page` wasn't in settings.")
random_line_split
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
/// Commits all changes for a page to the internal Settings object and then writes them to all files. fn save_changes(s: &mut Cursive, page: &SettingsPage, settings: Settings) { for row in page.iter() { let cur_val = get_by_id(row.id, s).expect(&format!("Couldn't get value by id for: {}", row.id)); ...
{ for row in page.iter() { let cur_val = get_by_id(row.id, s) .expect(&format!("Unable to get {} by id!", row.id)); let last_val_opt = settings.get(String::from(row.id)); let last_val = if last_val_opt.is_none() { String::from(row.default.expect(&format!("No past val ...
identifier_body
directory.rs
//! The directory displays all the available settings and lets users change them //! from within the configurator. use cursive::Cursive; use cursive::views::{Dialog, TextView, EditView, ListView, BoxView, LinearLayout, SelectView}; use super::*; /// Draws the global configuration directory which contains all possibl...
(s: &mut Cursive, page: &SettingsPage, settings: Settings) -> bool { for row in page.iter() { let cur_val = get_by_id(row.id, s) .expect(&format!("Unable to get {} by id!", row.id)); let last_val_opt = settings.get(String::from(row.id)); let last_val = if last_val_opt.is_none() { ...
check_changes
identifier_name
regions-addr-of-self.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn dog() -> dog { dog { cats_chased: 0u } } fn main() { let mut d = dog(); d.chase_cat(); info!("cats_chased: {}", d.cats_chased); }
{ let p: &mut uint = &mut self.cats_chased; *p += 1u; }
identifier_body
regions-addr-of-self.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 ...
*p += 1u; } pub fn chase_cat_2(&mut self) { let p: &mut uint = &mut self.cats_chased; *p += 1u; } } fn dog() -> dog { dog { cats_chased: 0u } } fn main() { let mut d = dog(); d.chase_cat(); info!("cats_chased: {}", d.cats_chased); }
pub fn chase_cat(&mut self) { let p: &'static mut uint = &mut self.cats_chased; //~ ERROR cannot infer an appropriate lifetime
random_line_split
regions-addr-of-self.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 mut d = dog(); d.chase_cat(); info!("cats_chased: {}", d.cats_chased); }
main
identifier_name
csv_sql.rs
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
() -> Result<()> { // create local execution context let mut ctx = ExecutionContext::new(); // define schema for data source (csv file) let schema = Arc::new(Schema::new(vec![ Field::new("c1", DataType::Utf8, false), Field::new("c2", DataType::UInt32, false), Field::new("c3", Da...
main
identifier_name
csv_sql.rs
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use datafusion::error::Result; use datafusion::execution::context::ExecutionContext; /// This example demonstrates executing a simple query against an Arrow data source (CSV) and /// fetching results fn main() -> Result<()> { // create local execution context let mut ctx = ExecutionContext::new(); // def...
use arrow::array::{BinaryArray, Float64Array}; use arrow::datatypes::{DataType, Field, Schema};
random_line_split
csv_sql.rs
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
let testdata = ::std::env::var("ARROW_TEST_DATA").expect("ARROW_TEST_DATA not defined"); // register csv file with the execution context ctx.register_csv( "aggregate_test_100", &format!("{}/csv/aggregate_test_100.csv", testdata), &schema, true, ); let sql =...
{ // create local execution context let mut ctx = ExecutionContext::new(); // define schema for data source (csv file) let schema = Arc::new(Schema::new(vec![ Field::new("c1", DataType::Utf8, false), Field::new("c2", DataType::UInt32, false), Field::new("c3", DataType::Int8, fal...
identifier_body
route.rs
use router::criterion::*; use hyper::method::{Method as hyperMethod}; use hyper::server::{Request, Response}; pub type BoxedHandler = Box<for <'a> Fn(Request, Response) + Send + Sync>; pub struct Route { criteria: Vec<Criterion>, handler: BoxedHandler } impl Route { pub fn new(handler: BoxedHandler) -> Self { r...
self.criteria.push(criterion); } pub fn execute(&self, req: Request, res: Response) { (self.handler)(req, res); } pub fn resolve(&self, request: &Request) -> bool { let mut bool = true; for criterion in self.criteria.iter() { if!check(criterion, request) { bool = false; } } retur...
pub fn add_criterion(&mut self, criterion: Criterion) {
random_line_split
route.rs
use router::criterion::*; use hyper::method::{Method as hyperMethod}; use hyper::server::{Request, Response}; pub type BoxedHandler = Box<for <'a> Fn(Request, Response) + Send + Sync>; pub struct Route { criteria: Vec<Criterion>, handler: BoxedHandler } impl Route { pub fn new(handler: BoxedHandler) -> Self { r...
} return bool; } }
{ bool = false; }
conditional_block
route.rs
use router::criterion::*; use hyper::method::{Method as hyperMethod}; use hyper::server::{Request, Response}; pub type BoxedHandler = Box<for <'a> Fn(Request, Response) + Send + Sync>; pub struct
{ criteria: Vec<Criterion>, handler: BoxedHandler } impl Route { pub fn new(handler: BoxedHandler) -> Self { return Route{criteria: Vec::new(), handler: handler}; } pub fn new_with_method_path(handler: BoxedHandler, method: hyperMethod, path: String) -> Self { let mut route = Route::new(handler); ...
Route
identifier_name
backend_plugin.rs
use std::os::raw::{c_void}; use std::rc::Rc; use plugin::Plugin; use plugins::PluginHandler; use prodbg_api::backend::CBackendCallbacks; use menus; use services; use Lib; use minifb::Menu; use std::mem::transmute; use std::ptr; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct BackendHandle(pub usize); pub stru...
None } pub fn get_menu(&mut self, handle: BackendHandle, menu_id_offset: u32) -> Option<Box<Menu>> { if let Some(backend) = self.get_backend(Some(handle)) { unsafe { let plugin_funcs = backend.plugin_type.plugin_funcs as *mut CBackendCallbacks; if ...
{ for i in 0..self.instances.len() { if self.instances[i].handle == handle { return Some(&mut self.instances[i]); } } }
conditional_block
backend_plugin.rs
use std::os::raw::{c_void}; use std::rc::Rc; use plugin::Plugin; use plugins::PluginHandler; use prodbg_api::backend::CBackendCallbacks; use menus; use services; use Lib; use minifb::Menu; use std::mem::transmute; use std::ptr; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct BackendHandle(pub usize); pub stru...
(&mut self) { let t = self.reload_state.clone(); for reload_plugin in &t { Self::create_instance(self, &reload_plugin.name); } } fn reload_failed(&mut self) {} } impl BackendPlugins { pub fn new() -> BackendPlugins { BackendPlugins { instances: Vec::...
reload_plugin
identifier_name
backend_plugin.rs
use std::os::raw::{c_void}; use std::rc::Rc; use plugin::Plugin; use plugins::PluginHandler; use prodbg_api::backend::CBackendCallbacks; use menus; use services; use Lib; use minifb::Menu; use std::mem::transmute; use std::ptr; #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct BackendHandle(pub usize); pub stru...
menu_id_offset: 0, }; self.handle_counter.0 += 1; self.instances.push(instance); Some(handle) } pub fn create_instance_from_index(mut self, index: usize) -> Option<BackendHandle> { Self::create_instance_from_type(&mut self, index) } pub fn create_...
let instance = BackendInstance { plugin_data: user_data, handle: handle, plugin_type: self.plugin_types[index].clone(),
random_line_split
managed-pointer-within-unique.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...
let managed_within_unique = box ContainsManaged { x: -3, y: box(GC) -4i }; zzz(); // #break } fn zzz() {()}
} fn main() { let ordinary_unique = box() (-1i, -2i);
random_line_split
managed-pointer-within-unique.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...
() { let ordinary_unique = box() (-1i, -2i); let managed_within_unique = box ContainsManaged { x: -3, y: box(GC) -4i }; zzz(); // #break } fn zzz() {()}
main
identifier_name
message_dialog.rs
// Copyright 2013-2015, The Rust-GNOME Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use ffi; use FFIWidget; use cast::{GTK_MESSAGE_DIALOG, GTK_WINDOW}; use glib::translate::...
impl ::DialogTrait for MessageDialog {}
impl ::BinTrait for MessageDialog {} impl ::WindowTrait for MessageDialog {}
random_line_split
message_dialog.rs
// Copyright 2013-2015, The Rust-GNOME Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use ffi; use FFIWidget; use cast::{GTK_MESSAGE_DIALOG, GTK_WINDOW}; use glib::translate::...
<T: ::WidgetTrait>(&self) -> Option<T> { let tmp_pointer = unsafe { ffi::gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(self.unwrap_widget())) }; if tmp_pointer.is_null() { None } else { Some(::FFIWidget::wrap_widget(tmp_pointer)) } } } impl_drop!(Me...
get_message_area
identifier_name
message_dialog.rs
// Copyright 2013-2015, The Rust-GNOME Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> use ffi; use FFIWidget; use cast::{GTK_MESSAGE_DIALOG, GTK_WINDOW}; use glib::translate::...
pub fn get_message_area<T: ::WidgetTrait>(&self) -> Option<T> { let tmp_pointer = unsafe { ffi::gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(self.unwrap_widget())) }; if tmp_pointer.is_null() { None } else { Some(::FFIWidget::wrap_widget(tmp_pointer)) ...
{ unsafe { ffi::gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(self.unwrap_widget()), markup.to_glib_none().0) } }
identifier_body
capture_block.rs
use std::io::Write; use liquid_core::error::ResultLiquidExt; use liquid_core::model::Value; use liquid_core::Language; use liquid_core::Renderable; use liquid_core::Result; use liquid_core::Runtime; use liquid_core::Template; use liquid_core::{BlockReflection, ParseBlock, TagBlock, TagTokenIter}; #[derive(Copy, Clone...
(&self, _writer: &mut dyn Write, runtime: &dyn Runtime) -> Result<()> { let mut captured = Vec::new(); self.template .render_to(&mut captured, runtime) .trace_with(|| self.trace().into())?; let output = String::from_utf8(captured).expect("render only writes UTF-8"); ...
render_to
identifier_name
capture_block.rs
use std::io::Write; use liquid_core::error::ResultLiquidExt; use liquid_core::model::Value; use liquid_core::Language; use liquid_core::Renderable; use liquid_core::Result; use liquid_core::Runtime; use liquid_core::Template; use liquid_core::{BlockReflection, ParseBlock, TagBlock, TagTokenIter}; #[derive(Copy, Clone...
use liquid_core::model::Scalar; use liquid_core::parser; use liquid_core::runtime; use liquid_core::runtime::RuntimeBuilder; fn options() -> Language { let mut options = Language::default(); options .blocks .register("capture".to_string(), CaptureBlock.into())...
mod test { use super::*;
random_line_split
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
Action::Skip => (), Action::Abort => { return; } }; } ssa.clear_mark(node); } // Remove empty blocks and redirect control flows. let blocks = ssa.blocks(); for bl...
{ ssa.remove_value(*node); }
conditional_block
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
<T: FnMut(Box<dyn Change>) -> Action>(&self, ssa: &mut SSAStorage, mut policy: T) { for node in &ssa.values() { if!ssa.is_marked(node) { match policy(Box::new(RemoveValue(*node))) { Action::Apply => { ssa.remove_value(*node); ...
sweep
identifier_name
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
// Remove empty blocks and redirect control flows. let blocks = ssa.blocks(); for block in &blocks { // Do not touch start or exit nodes if *block == entry_node_err!(ssa) || *block == exit_node_err!(ssa) { continue; } let remove_bl...
random_line_split
dce.rs
// Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may not be copied, modified, or distributed // except according to those term...
} impl FuncAnalyzer for DCE { fn analyze<T: FnMut(Box<dyn Change>) -> Action>( &mut self, rfn: &mut RadecoFunction, policy: Option<T>, ) -> Option<Box<dyn AnalyzerResult>> { self.mark(rfn.ssa_mut()); self.sweep( rfn.ssa_mut(), policy.expect("A po...
{ self }
identifier_body
regions-fn-subtyping.rs
// run-pass #![allow(dead_code)] #![allow(unused_assignments)] // Issue #2263. // pretty-expanded FIXME #23616 #![allow(unused_variables)] // Should pass region checking. fn
(f: Box<dyn FnMut(&usize)>) { // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be // used in any...
ok
identifier_name
regions-fn-subtyping.rs
// run-pass #![allow(dead_code)] #![allow(unused_assignments)] // Issue #2263.
// pretty-expanded FIXME #23616 #![allow(unused_variables)] // Should pass region checking. fn ok(f: Box<dyn FnMut(&usize)>) { // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should...
random_line_split
regions-fn-subtyping.rs
// run-pass #![allow(dead_code)] #![allow(unused_assignments)] // Issue #2263. // pretty-expanded FIXME #23616 #![allow(unused_variables)] // Should pass region checking. fn ok(f: Box<dyn FnMut(&usize)>)
// This version is the same as above, except that here, g's type is // inferred. fn ok_inferred(f: Box<dyn FnMut(&usize)>) { let mut g: Box<dyn for<'r> FnMut(&'r usize)> = Box::new(|_| {}); g = f; } pub fn main() { }
{ // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be // used in any context that expects g's ty...
identifier_body
main.rs
#![feature(stmt_expr_attributes)] extern crate winerunner; use winerunner::core::Core; use winerunner::cmd::ListVersionsCommand; use winerunner::cmd::WinebootCommand; use winerunner::cmd::WinecfgCommand; use winerunner::cmd::WineserverCommand; use winerunner::cmd::WineconsoleCommand; use winerunner::cmd::InstallComma...
{ let mut app = Core::new(); app.add_command(ListVersionsCommand::new()); app.add_command(InstallCommand::new()); app.add_command(WinecfgCommand::new()); app.add_command(WineconsoleCommand::new()); app.add_command(WineserverCommand::new()); app.add_command(WinebootCommand::new()); #[cf...
identifier_body
main.rs
#![feature(stmt_expr_attributes)] extern crate winerunner; use winerunner::core::Core; use winerunner::cmd::ListVersionsCommand; use winerunner::cmd::WinebootCommand; use winerunner::cmd::WinecfgCommand; use winerunner::cmd::WineserverCommand; use winerunner::cmd::WineconsoleCommand; use winerunner::cmd::InstallComma...
app.add_command(ListVersionsCommand::new()); app.add_command(InstallCommand::new()); app.add_command(WinecfgCommand::new()); app.add_command(WineconsoleCommand::new()); app.add_command(WineserverCommand::new()); app.add_command(WinebootCommand::new()); #[cfg(feature = "devel")] app.add_...
fn main() { let mut app = Core::new();
random_line_split
main.rs
#![feature(stmt_expr_attributes)] extern crate winerunner; use winerunner::core::Core; use winerunner::cmd::ListVersionsCommand; use winerunner::cmd::WinebootCommand; use winerunner::cmd::WinecfgCommand; use winerunner::cmd::WineserverCommand; use winerunner::cmd::WineconsoleCommand; use winerunner::cmd::InstallComma...
() { let mut app = Core::new(); app.add_command(ListVersionsCommand::new()); app.add_command(InstallCommand::new()); app.add_command(WinecfgCommand::new()); app.add_command(WineconsoleCommand::new()); app.add_command(WineserverCommand::new()); app.add_command(WinebootCommand::new()); #...
main
identifier_name
builtin-superkinds-capabilities-transitive.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 ...
trait Foo : Bar { } impl <T: Send> Foo for T { } impl <T: Send> Bar for T { } fn foo<T: Foo>(val: T, chan: comm::Chan<T>) { chan.send(val); } fn main() { let (p,c) = comm::stream(); foo(31337, c); assert!(p.recv() == 31337); }
trait Bar : Send { }
random_line_split
builtin-superkinds-capabilities-transitive.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 (p,c) = comm::stream(); foo(31337, c); assert!(p.recv() == 31337); }
main
identifier_name
builtin-superkinds-capabilities-transitive.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 ...
fn main() { let (p,c) = comm::stream(); foo(31337, c); assert!(p.recv() == 31337); }
{ chan.send(val); }
identifier_body
lib.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 ...
() ->! { // FIXME(#14674): This really needs to do something other than just abort // here, but any printing done must be *guaranteed* to not // allocate. unsafe { core::intrinsics::abort() } }
oom
identifier_name
lib.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 ...
// duplicating the lang-items when building in test cfg; but also need // to allow code to have `use boxed::HEAP;` // and `use boxed::Box;` declarations. #[cfg(not(test))] pub mod boxed; #[cfg(test)] mod boxed { pub use std::boxed::{Box, HEAP}; } #[cfg(test)] mod boxed_test; pub mod arc; pub mod rc; pub mod raw_vec; /...
pub mod heap; // Primitive types using the heaps above // Need to conditionally define the mod from `boxed.rs` to avoid
random_line_split
lib.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 ...
{ // FIXME(#14674): This really needs to do something other than just abort // here, but any printing done must be *guaranteed* to not // allocate. unsafe { core::intrinsics::abort() } }
identifier_body
where-clauses.rs
// run-pass trait Equal { fn equal(&self, other: &Self) -> bool; fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool where T: Eq, U: Eq; } impl<T> Equal for T where T: Eq { fn equal(&self, other: &T) -> bool { self == other } fn equals<U,X>(&self, this: &U, other: &U...
fn equal<T>(x: &T, y: &T) -> bool where T: Eq { x == y } fn main() { println!("{}", equal(&1, &2)); println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar")); }
this == other && x == y } }
random_line_split
where-clauses.rs
// run-pass trait Equal { fn equal(&self, other: &Self) -> bool; fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool where T: Eq, U: Eq; } impl<T> Equal for T where T: Eq { fn equal(&self, other: &T) -> bool { self == other } fn equals<U,X>(&self, this: &U, other: &U...
() { println!("{}", equal(&1, &2)); println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar")); }
main
identifier_name
where-clauses.rs
// run-pass trait Equal { fn equal(&self, other: &Self) -> bool; fn equals<T,U>(&self, this: &T, that: &T, x: &U, y: &U) -> bool where T: Eq, U: Eq; } impl<T> Equal for T where T: Eq { fn equal(&self, other: &T) -> bool { self == other } fn equals<U,X>(&self, this: &U, other: &U...
{ println!("{}", equal(&1, &2)); println!("{}", equal(&1, &1)); println!("{}", "hello".equal(&"hello")); println!("{}", "hello".equals::<isize,&str>(&1, &1, &"foo", &"bar")); }
identifier_body
datacenterinfo.rs
use serde::ser::{Serialize, Serializer, SerializeStruct}; use serde::de::{Deserialize, Deserializer, Visitor, Error as DeError, MapAccess}; use std::fmt; use super::DcName; use super::AmazonMetaData; // Field name constants const NAME: &'static str = "name"; const METADATA: &'static str = "metadata"; // The eureka API...
maybe_name = Some(map.next_value()?); }, Field::Metadata => { if maybe_metadata.is_some() { return Err(DeError::duplicate_field(METADATA)); } ...
{ return Err(DeError::duplicate_field(NAME)); }
conditional_block
datacenterinfo.rs
use serde::ser::{Serialize, Serializer, SerializeStruct}; use serde::de::{Deserialize, Deserializer, Visitor, Error as DeError, MapAccess}; use std::fmt; use super::DcName; use super::AmazonMetaData; // Field name constants const NAME: &'static str = "name"; const METADATA: &'static str = "metadata"; // The eureka API...
(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("Expecting `name` or `metadata` ") } fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: DeError, { match v { ...
expecting
identifier_name
datacenterinfo.rs
use serde::ser::{Serialize, Serializer, SerializeStruct}; use serde::de::{Deserialize, Deserializer, Visitor, Error as DeError, MapAccess}; use std::fmt; use super::DcName; use super::AmazonMetaData; // Field name constants const NAME: &'static str = "name"; const METADATA: &'static str = "metadata"; // The eureka API...
CLASS => Ok(Field::Class), _ => Err(DeError::unknown_field(v, FIELDS)) } } } deserializer.deserialize_identifier(FieldVisitor) } } struct DataCenterInfoVisitor...
match v { NAME => Ok(Field::Name), METADATA => Ok(Field::Metadata),
random_line_split
terms.rs
//! A module that describes a logical term in a formula //! //! A term consists of a series of symbol values that can have //! new values pushed into it. Insertions will make sure that the //! term is symbol is unique in a term /// A logical symbol in a term #[derive(Copy, Clone, Debug, Hash, Eq)] pub struct Symbol {...
pub fn merge(&mut self, other: Term) { let ovec: Vec<Symbol> = other.symbols; for sym in ovec.iter() { self.insert(sym.clone()); } } } /// A helper macro that creates terms with a variable amount of symbols /// based on the more user friendly syntax /// /// term!["A", "!B...
/// Merge two terms together in a very naive way. This function will only check /// for same duplicates (to avoid { A, A, B } situations). This will however allow /// { A, ¬A } scenarios. Those need to be removed manually
random_line_split
terms.rs
//! A module that describes a logical term in a formula //! //! A term consists of a series of symbol values that can have //! new values pushed into it. Insertions will make sure that the //! term is symbol is unique in a term /// A logical symbol in a term #[derive(Copy, Clone, Debug, Hash, Eq)] pub struct Symbol {...
&self, other: &Term) -> bool { for s in &self.symbols { if!other.contains(s) { return false; } } for s in &other.symbols { if!self.contains(s) { return false; } } // return self.symbols == other.sym...
q(
identifier_name
terms.rs
//! A module that describes a logical term in a formula //! //! A term consists of a series of symbol values that can have //! new values pushed into it. Insertions will make sure that the //! term is symbol is unique in a term /// A logical symbol in a term #[derive(Copy, Clone, Debug, Hash, Eq)] pub struct Symbol {...
} for s in &other.symbols { if!self.contains(s) { return false; } } // return self.symbols == other.symbols; return true; } } impl Term { /// Simple linear `contains` function for a Term. Avoid using this /// as it can le...
return false; }
conditional_block
hrtb-debruijn-in-receiver.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 ...
() -> Foo<'a> { panic!() } fn insert(&'a mut self) { } } fn main() { let mut foo = Foo::new(); foo.insert(); foo.insert(); //~ ERROR cannot borrow }
new
identifier_name
hrtb-debruijn-in-receiver.rs
// Copyright 2014 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. // Test the case...
// http://rust-lang.org/COPYRIGHT.
random_line_split
hrtb-debruijn-in-receiver.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} fn main() { let mut foo = Foo::new(); foo.insert(); foo.insert(); //~ ERROR cannot borrow }
{ }
identifier_body
dom_html_base_font_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; use glib::GString; use glib::object::IsA; use glib::translate::*; use libc; use std::fmt; use webk...
fn set_face(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_face(self.as_ref().to_glib_none().0, value.to_glib_none().0); } } fn set_size(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_do...
random_line_split
dom_html_base_font_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; use glib::GString; use glib::object::IsA; use glib::translate::*; use libc; use std::fmt; use webk...
(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_size(self.as_ref().to_glib_none().0, value); } } } impl fmt::Display for DOMHTMLBaseFontElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMHTML...
set_size
identifier_name
dom_html_base_font_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; use glib::GString; use glib::object::IsA; use glib::translate::*; use libc; use std::fmt; use webk...
fn set_size(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_size(self.as_ref().to_glib_none().0, value); } } } impl fmt::Display for DOMHTMLBaseFontElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { w...
{ unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_face(self.as_ref().to_glib_none().0, value.to_glib_none().0); } }
identifier_body
mod.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/. */ //! The implementation of the DOM. //! //! The DOM is comprised of interfaces (defined by specifications using //!...
pub mod htmltablecolelement; pub mod htmltabledatacellelement; pub mod htmltableelement; pub mod htmltableheadercellelement; pub mod htmltablerowelement; pub mod htmltablesectionelement; pub mod htmltemplateelement; pub mod htmltextareaelement; pub mod htmltimeelement; pub mod htmltitleelement; pub mod htmltrackelement...
pub mod htmlstyleelement; pub mod htmltablecaptionelement; pub mod htmltablecellelement;
random_line_split
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn new() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } ...
od tests { use super::*; use crate::common::tree_node; #[test] fn test_find_mode() { let root = tree_node(TreeNode { val: 1, left: None, right: tree_node(TreeNode { val: 2, left: tree_node(TreeNode::new(2)), rig...
ome(r) = root { Self::mid_order(&r.borrow().left, ans); ans.update(r.borrow().val); Self::mid_order(&r.borrow().right, ans); } } } #[cfg(test)] m
identifier_body
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn new() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } ...
ns = Answer::new(); Self::mid_order(&root, &mut ans); ans.v } fn mid_order(root: &Option<Rc<RefCell<TreeNode>>>, ans: &mut Answer) { if let Some(r) = root { Self::mid_order(&r.borrow().left, ans); ans.update(r.borrow().val); Self::mid_order(&r.borrow(...
rn vec![]; } let mut a
conditional_block
no_0501_find_mode_in_binary_search_tree.rs
use crate::common::TreeNode; use std::cell::RefCell; use std::rc::Rc; struct Answer { base: i32, count: u32, max_count: u32, v: Vec<i32>, } impl Answer { fn new() -> Self { Answer { base: 0, count: 0, max_count: 0, v: Vec::new(), } ...
Self::mid_order(&r.borrow().right, ans); } } } #[cfg(test)] mod tests { use super::*; use crate::common::tree_node; #[test] fn test_find_mode() { let root = tree_node(TreeNode { val: 1, left: None, right: tree_node(TreeNode { ...
Self::mid_order(&r.borrow().left, ans); ans.update(r.borrow().val);
random_line_split