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
implicit_infer.rs
use rustc_data_structures::fx::FxHashMap; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_middle::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_span::Span; use super::explicit::ExplicitPredicatesMap; use ...
// `with_self_ty`, since there is no concrete type // `Self` for a `dyn Trait` at this // stage. Therefore when checking explicit // predicates in `check_explicit_predicates` we // need to ignore checking the explicit_ma...
debug!("ty in field = {}", &ty); if let Some(ex_trait_ref) = obj.principal() { // Here, we are passing the type `usize` as a // placeholder value with the function
random_line_split
stylepropertymapreadonly.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; use dom::b...
.collect(); // https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-getproperties // requires this sort order result.sort_by(|key1, key2| { if let Ok(key1) = custom_properties::parse_name(key1) { if let Ok(key2) = custom_properties::parse_nam...
random_line_split
stylepropertymapreadonly.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; use dom::b...
{ reflector: Reflector, entries: HashMap<Atom, Dom<CSSStyleValue>>, } impl StylePropertyMapReadOnly { fn new_inherited<Entries>(entries: Entries) -> StylePropertyMapReadOnly where Entries: IntoIterator<Item=(Atom, Dom<CSSStyleValue>)> { StylePropertyMapReadOnly { reflector:...
StylePropertyMapReadOnly
identifier_name
stylepropertymapreadonly.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; use dom::b...
else { key1.cmp(key2) } } }); result } }
{ Ordering::Less }
conditional_block
stylepropertymapreadonly.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::StylePropertyMapReadOnlyBinding::StylePropertyMapReadOnlyMethods; use dom::b...
pub fn from_iter<Entries>(global: &GlobalScope, entries: Entries) -> DomRoot<StylePropertyMapReadOnly> where Entries: IntoIterator<Item=(Atom, String)>, { let mut keys = Vec::new(); rooted_vec!(let mut values); let iter = entries.into_iter(); let (lo, _) = iter.size_hin...
{ StylePropertyMapReadOnly { reflector: Reflector::new(), entries: entries.into_iter().collect(), } }
identifier_body
liststore.rs
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk is distributed in the hop...
pub fn set_column_types(&self, column_types: &[GType]) { unsafe { ffi::gtk_list_store_set_column_types(self.pointer, column_types.len().to_i32().unwrap(), column_types) } } pub fn set_string(&self, iter: &TreeIter, column: i32, text: &str) { let text_c = text.to_c_str(); unsafe { f...
pub fn new(column_types: &[GType]) -> Option<ListStore> { let tmp_pointer = unsafe { ffi::gtk_list_store_newv(column_types.len().to_i32().unwrap(), column_types) }; check_pointer!(tmp_pointer, ListStore, G_OBJECT_FROM_LIST_STORE) }
random_line_split
liststore.rs
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk is distributed in the hop...
) } } pub fn get_model(&self) -> Option<gtk::TreeModel> { if self.pointer.is_null() { None } else { Some(gtk::TreeModel::wrap_pointer(gtk::cast::GTK_TREE_MODEL_FROM_LIST_STORE(self.pointer))) } } pub fn set_value(&self, iter: &TreeIter, column: i32, valu...
{ position.unwrap().get_pointer() }
conditional_block
liststore.rs
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk is distributed in the hop...
{ pointer: *mut ffi::C_GtkListStore } impl ListStore { pub fn new(column_types: &[GType]) -> Option<ListStore> { let tmp_pointer = unsafe { ffi::gtk_list_store_newv(column_types.len().to_i32().unwrap(), column_types) }; check_pointer!(tmp_pointer, ListStore, G_OBJECT_FROM_LIST_STORE) } ...
ListStore
identifier_name
liststore.rs
// This file is part of rgtk. // // rgtk is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // rgtk is distributed in the hop...
pub fn append(&self, iter: &TreeIter) { unsafe { ffi::gtk_list_store_append(self.pointer, iter.get_pointer()) } } pub fn clear(&self) { unsafe { ffi::gtk_list_store_clear(self.pointer) } } pub fn iter_is_valid(&self, iter: &TreeIter) -> bool { unsafe { ffi::to_bool(ffi::g...
{ unsafe { ffi::gtk_list_store_prepend(self.pointer, iter.get_pointer()) } }
identifier_body
encodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
~[cx.expr_str(span, name), cx.expr_uint(span, i), lambda]); stmts.push(cx.stmt_expr(call)); } let blk = cx.lambda_stmts_1(span, stmts,...
{ let encoder = substr.nonself_args[0]; // throw an underscore in front to suppress unused variable warnings let blkarg = cx.ident_of("_e"); let blkencoder = cx.expr_ident(span, blkarg); let encode = cx.ident_of("encode"); return match *substr.fields { Struct(ref fields) => { ...
identifier_body
encodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
let name = cx.expr_str(span, cx.str_of(variant.node.name)); let call = cx.expr_method_call(span, blkencoder, cx.ident_of("emit_enum_variant"), ~[name, cx.expr_uint(s...
{ // We're not generating an AST that the borrow checker is expecting, // so we need to generate a unique local variable to take the // mutable loan out on, otherwise we get conflicts which don't // actually exist. let me = cx.stmt_let(span, false, blkarg, enc...
conditional_block
encodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
d.read_rec(|| { { node: d.read_field(~"node", 0, || decode(d)), span: d.read_field(~"span", 1, || decode(d)), } }) } } */ use ast::{MetaItem, Item, Expr, MutImmutable, MutMutable}; use codemap::Span; use ext::ba...
T: Decodable<D> > spanned<T>: Decodable<D> { fn decode(d: &D) -> spanned<T> {
random_line_split
encodable.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(cx: &ExtCtxt, span: Span, substr: &Substructure) -> @Expr { let encoder = substr.nonself_args[0]; // throw an underscore in front to suppress unused variable warnings let blkarg = cx.ident_of("_e"); let blkencoder = cx.expr_ident(span, blkarg); let encode = cx.ident_of("en...
encodable_substructure
identifier_name
table_colgroup.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! CSS table formatting contexts. #![deny(unsafe_code)] use app_units::Au; use context::LayoutContext; use eucl...
fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {} // Table columns are invisible. fn build_display_list(&mut self, _: &LayoutContext) {} fn repair_style(&mut self, _: &Arc<ComputedValues>) {} fn compute_overflow(&self) -> Rect<Au> { Rect::zero() } fn gene...
{}
identifier_body
table_colgroup.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! CSS table formatting contexts. #![deny(unsafe_code)] use app_units::Au; use context::LayoutContext; use eucl...
/// Table columns do not have block-size. fn assign_block_size(&mut self, _: &LayoutContext) { } fn update_late_computed_inline_position_if_necessary(&mut self, _: Au) {} fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {} // Table columns are invisible. fn build_disp...
}
random_line_split
table_colgroup.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! CSS table formatting contexts. #![deny(unsafe_code)] use app_units::Au; use context::LayoutContext; use eucl...
(&mut self, _: &mut FnMut(&mut Fragment)) {} } impl fmt::Debug for TableColGroupFlow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.fragment { Some(ref rb) => write!(f, "TableColGroupFlow: {:?}", rb), None => write!(f, "TableColGroupFlow"), } } }
mutate_fragments
identifier_name
borrowck-assign-to-andmut-in-aliasable-loc.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 main() {}
fn c(s: & &mut S) { *s.pointer += 1; //~ ERROR cannot assign
random_line_split
borrowck-assign-to-andmut-in-aliasable-loc.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 ...
<'self> { pointer: &'self mut int } fn a(s: &S) { *s.pointer += 1; //~ ERROR cannot assign } fn b(s: &mut S) { *s.pointer += 1; } fn c(s: & &mut S) { *s.pointer += 1; //~ ERROR cannot assign } fn main() {}
S
identifier_name
borrowck-assign-to-andmut-in-aliasable-loc.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 c(s: & &mut S) { *s.pointer += 1; //~ ERROR cannot assign } fn main() {}
{ *s.pointer += 1; }
identifier_body
ptr.rs
not take ownership of the original allocation //! and requires no resource management later, //! but you must not use the pointer after its lifetime. //! //! ## 2. Transmute an owned box (`Box<T>`). //! //! The `transmute` function takes, by value, whatever it's given //! and returns it as whatever type is requested, ...
<T>(buf: **T) -> uint { position(buf, |i| *i == null()) } impl<T> Clone for *T { #[inline] fn clone(&self) -> *T { *self } } impl<T> Clone for *mut T { #[inline] fn clone(&self) -> *mut T { *self } } /// Return the first offset `i` such that `f(buf[i]) == true`. #[inline] ...
buf_len
identifier_name
ptr.rs
: *mut int = cast::transmute(my_speed); //! //! // By taking ownership of the original `Box<T>` though //! // we are obligated to transmute it back later to be destroyed. //! drop(cast::transmute::<_, Box<int>>(my_speed)); //! drop(cast::transmute::<_, Box<int>>(my_num)); //! } //! ``` //! //! Note that...
let arr = box [ one.with_ref(|buf| buf), two.with_ref(|buf| buf), three.with_ref(|buf| buf), // fake a null terminator
random_line_split
ptr.rs
not take ownership of the original allocation //! and requires no resource management later, //! but you must not use the pointer after its lifetime. //! //! ## 2. Transmute an owned box (`Box<T>`). //! //! The `transmute` function takes, by value, whatever it's given //! and returns it as whatever type is requested, ...
} } // Equality for pointers #[cfg(not(test))] impl<T> Eq for *T { #[inline] fn eq(&self, other: &*T) -> bool { *self == *other } #[inline] fn ne(&self, other: &*T) -> bool {!self.eq(other) } } #[cfg(not(test))] impl<T> TotalEq for *T {} #[cfg(not(test))] impl<T> Eq for *mut T { ...
{ Some(cast::transmute(*self)) }
conditional_block
breakctr2.rs
use std::env; use std::slice; use std::io::prelude::*; use common::{err, challenge}; use common::cipher::one_byte_xor as obx; use set3::breakctr; pub static info: challenge::Info = challenge::Info { no: 20, title: "Break fixed-nonce CTR statistically", help: "param1: path to file conta...
(ciphers: &Vec<Vec<u8>>) -> Result<Vec<u8>, err::Error> { let mut cipher_its: Vec<slice::Iter<u8>> = Vec::new(); let mut keystream = Vec::<u8>::new(); for c in ciphers { cipher_its.push(c.iter()); } let mut all_ciphers_done = false; let mut col_no = 0; while! all_ciphers_done { ...
break_ctr
identifier_name
breakctr2.rs
use std::env; use std::slice; use std::io::prelude::*; use common::{err, challenge}; use common::cipher::one_byte_xor as obx; use set3::breakctr; pub static info: challenge::Info = challenge::Info { no: 20, title: "Break fixed-nonce CTR statistically", help: "param1: path to file conta...
if col.len() > 0 { keystream.push(try!(obx::guess_key(&col, Some(&options))).key); } else { all_ciphers_done = true; } col_no += 1; } Ok(keystream) } pub fn break_ctr_with_manual_guess_for_last_chars(ciphers: &Vec<Vec<u8>>, guesses: &Vec<(usize...
{ // the input is too short, so, we take a shot // assuming all are valid // word characters fn last_chars_distance_fn(input: &str) -> Result<f32, err::Error...
conditional_block
breakctr2.rs
use std::env; use std::slice; use std::io::prelude::*; use common::{err, challenge}; use common::cipher::one_byte_xor as obx;
pub static info: challenge::Info = challenge::Info { no: 20, title: "Break fixed-nonce CTR statistically", help: "param1: path to file containing base64 encoded plain strings", execute_fn: interactive }; pub const min_chars_for_charfreq: usize = 10; // minimum number of chara...
use set3::breakctr;
random_line_split
breakctr2.rs
use std::env; use std::slice; use std::io::prelude::*; use common::{err, challenge}; use common::cipher::one_byte_xor as obx; use set3::breakctr; pub static info: challenge::Info = challenge::Info { no: 20, title: "Break fixed-nonce CTR statistically", help: "param1: path to file conta...
} let mut options = obx::GuessOptions::new(); if col_no == 0 { // first column has a lot of upper case letters, hence, does not break correctly // with standard character frequencies fn upper_letters_distance_fn(input: &str) -> Result<f32, err...
{ let mut cipher_its: Vec<slice::Iter<u8>> = Vec::new(); let mut keystream = Vec::<u8>::new(); for c in ciphers { cipher_its.push(c.iter()); } let mut all_ciphers_done = false; let mut col_no = 0; while ! all_ciphers_done { //println!("col no: {}", col_no); let mu...
identifier_body
lib.rs
extern crate libc; use libc::{c_char, c_int, c_void, free, malloc, size_t}; use std::ffi; use std::mem; use std::ptr; use std::str; mod c { use libc::{c_char, c_int}; #[repr(C)] pub enum Status { Done = 0, EOF, Move, Dispatch, Stay, Signal } type ...
(c_word: *const c_char, c_possib_ptr: *mut*mut*mut c_char) -> c_int { use std::slice; let word = match cstr_to_str(c_word) { Some(word) => word, None => return 0 as c_int }; let possib_fn = unsafe { list_possib_fn.unwrap() }; let possib = possib_fn(word); let c_possib_sz = (me...
list_possib_bridge
identifier_name
lib.rs
extern crate libc; use libc::{c_char, c_int, c_void, free, malloc, size_t}; use std::ffi; use std::mem; use std::ptr; use std::str; mod c { use libc::{c_char, c_int};
#[repr(C)] pub enum Status { Done = 0, EOF, Move, Dispatch, Stay, Signal } type CompleteFn = extern fn(*const c_char, *mut c_int) -> *mut c_char; type ListPossibFn = extern fn(*const c_char, *mut*mut*mut c_char) -> c_int; #[link(name = "editline...
random_line_split
lib.rs
extern crate libc; use libc::{c_char, c_int, c_void, free, malloc, size_t}; use std::ffi; use std::mem; use std::ptr; use std::str; mod c { use libc::{c_char, c_int}; #[repr(C)] pub enum Status { Done = 0, EOF, Move, Dispatch, Stay, Signal } type ...
pub fn line_buffer<'a>() -> Option<&'a str> { cstr_to_str(c::rl_line_buffer) } pub fn readline(prompt: &str) -> Option<&str> { let c_prompt = match ffi::CString::new(prompt) { Ok(c_prompt) => c_prompt, Err(..) => return None }; let c_line = unsafe { c::readline(c_prompt.as_ptr()) };...
{ let c_s = match ffi::CString::new(s) { Ok(c_s) => c_s, Err(..) => return None }; let dup = unsafe { malloc((s.len() + 1) as size_t) as *mut c_char }; if dup.is_null() { return None; } Some(unsafe { libc::strcpy(dup, c_s.as_ptr()) }) }
identifier_body
border_unit.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. #![cfg_attr(feature = "cargo-clippy", allow(clippy::collapsible_if))] pub struct Config { pub border_color: u8, pub cs...
{ pub config: Config, main_flop: bool, vertical_flop: bool, } impl BorderUnit { pub fn new() -> Self { BorderUnit { config: Config::new(), main_flop: false, vertical_flop: false, } } pub fn is_enabled(&self) -> bool { self.main_flop ...
BorderUnit
identifier_name
border_unit.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. #![cfg_attr(feature = "cargo-clippy", allow(clippy::collapsible_if))] pub struct Config { pub border_color: u8, pub cs...
self.main_flop = false; } } else if x == 0x1bc { self.main_flop = true; } } else { if x == 0x83 { self.update_vertical_flop(y, den); if!self.vertical_flop { self.main_flop ...
*/ if self.config.csel { if x == 0x7c { self.update_vertical_flop(y, den); if !self.vertical_flop {
random_line_split
border_unit.rs
// This file is part of zinc64. // Copyright (c) 2016-2019 Sebastian Jastrzebski. All rights reserved. // Licensed under the GPLv3. See LICENSE file in the project root for full license text. #![cfg_attr(feature = "cargo-clippy", allow(clippy::collapsible_if))] pub struct Config { pub border_color: u8, pub cs...
pub fn output(&self) -> u8 { self.config.border_color } pub fn reset(&mut self) { self.config.reset(); self.main_flop = false; self.vertical_flop = false; } /* | CSEL=0 | CSEL=1 ------+------------+----------- Left | 31 ($1f) | 24 ($...
{ self.main_flop || self.vertical_flop }
identifier_body
expr-match.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 ...
// Tests for using match as an expression fn test_basic() { let mut rs: bool = match true { true => { true } false => { false } }; assert!((rs)); rs = match false { true => { false } false => { true } }; assert!((rs)); } fn test_inferrence() { let rs = match true { true => { true } false => { fal...
random_line_split
expr-match.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 rs = match true { true => { true } false => { false } }; assert!((rs)); } fn test_alt_as_alt_head() { // Yeah, this is kind of confusing... let rs = match match false { true => { true } false => { false } } { true => { false } false => { true } }; asser...
test_inferrence
identifier_name
expr-match.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 ...
} { true => { false } false => { true } }; assert!((rs)); } fn test_alt_as_block_result() { let rs = match false { true => { false } false => { match true { true => { true } false => { false } } } }; assert!((rs)); } pub fn main() { test...
{ false }
conditional_block
expr-match.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn test_alt_as_alt_head() { // Yeah, this is kind of confusing... let rs = match match false { true => { true } false => { false } } { true => { false } false => { true } }; assert!((rs)); } fn test_alt_as_block_result() { let rs = match false { ...
{ let rs = match true { true => { true } false => { false } }; assert!((rs)); }
identifier_body
ospeedr.rs
// peripheral/gpio/ospeedr.rs // AltOSRust // // Created by Daniel Seitz on 11/30/16 use super::super::{Register, Field}; #[derive(Copy, Clone)] pub enum Speed { Low, Medium, High, } impl Field for Speed { fn mask(&self) -> u32 { match *self { Speed::Low => 0b00, Speed::Medium => 0b01, ...
(&self) -> u32 { 0x08 } } impl OSPEEDR { pub fn set_speed(&self, speed: Speed, port: u8) { if port > 15 { panic!("OSPEEDR::set_speed - specified port must be between [0..15]!"); } let mask = speed.mask(); unsafe { let mut reg = self.addr(); *reg &=!(0b11 << (port * 2)); ...
mem_offset
identifier_name
ospeedr.rs
// peripheral/gpio/ospeedr.rs // AltOSRust // // Created by Daniel Seitz on 11/30/16 use super::super::{Register, Field}; #[derive(Copy, Clone)] pub enum Speed { Low, Medium, High, } impl Field for Speed { fn mask(&self) -> u32
} impl Speed { fn from_mask(mask: u32) -> Self { match mask { 0b00 | 0b10 => Speed::Low, 0b01 => Speed::Medium, 0b11 => Speed::High, _ => panic!("Speed::from_mask - mask was not a valid value!"), } } } #[derive(Copy, Clone)] pub struct OSPEEDR { base_addr: u32, } impl Register ...
{ match *self { Speed::Low => 0b00, Speed::Medium => 0b01, Speed::High => 0b11, } }
identifier_body
ospeedr.rs
// peripheral/gpio/ospeedr.rs // AltOSRust // // Created by Daniel Seitz on 11/30/16 use super::super::{Register, Field}; #[derive(Copy, Clone)] pub enum Speed { Low, Medium, High, } impl Field for Speed { fn mask(&self) -> u32 { match *self { Speed::Low => 0b00, Speed::Medium => 0b01, ...
#[derive(Copy, Clone)] pub struct OSPEEDR { base_addr: u32, } impl Register for OSPEEDR { fn new(base_addr: u32) -> Self { OSPEEDR { base_addr: base_addr } } fn base_addr(&self) -> u32 { self.base_addr } fn mem_offset(&self) -> u32 { 0x08 } } impl OSPEEDR { pub fn set_speed(&self, speed...
}
random_line_split
totalord.rs
// Copyright 2013 The Rust Project Developers. See the 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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use ast::{meta_item...
// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. //
random_line_split
mul.rs
#![feature(core, core_simd)] extern crate core; #[cfg(test)] mod tests { use core::simd::f32x4; // #[simd] // #[derive(Copy, Clone, Debug)] // #[repr(C)] // pub struct f32x4(pub f32, pub f32, pub f32, pub f32); #[test] fn mul_test1()
}
{ let x: f32x4 = f32x4( 1.23, 4.56, 7.89, 0.12 ); let y: f32x4 = f32x4( 2.0, 2.0, 2.0, 2.0 ); let z: f32x4 = x * y; let result: String = format!("{:?}", z); assert_eq!(result, "f32x4(\ 2.46, 9.12, 15.78, 0.24\ )".to_string()); }
identifier_body
mul.rs
#![feature(core, core_simd)] extern crate core; #[cfg(test)] mod tests { use core::simd::f32x4; // #[simd] // #[derive(Copy, Clone, Debug)] // #[repr(C)] // pub struct f32x4(pub f32, pub f32, pub f32, pub f32); #[test]
let x: f32x4 = f32x4( 1.23, 4.56, 7.89, 0.12 ); let y: f32x4 = f32x4( 2.0, 2.0, 2.0, 2.0 ); let z: f32x4 = x * y; let result: String = format!("{:?}", z); assert_eq!(result, "f32x4(\ 2.46, 9.12, 15.78, 0.24\ )".to_string()); } }
fn mul_test1() {
random_line_split
mul.rs
#![feature(core, core_simd)] extern crate core; #[cfg(test)] mod tests { use core::simd::f32x4; // #[simd] // #[derive(Copy, Clone, Debug)] // #[repr(C)] // pub struct f32x4(pub f32, pub f32, pub f32, pub f32); #[test] fn
() { let x: f32x4 = f32x4( 1.23, 4.56, 7.89, 0.12 ); let y: f32x4 = f32x4( 2.0, 2.0, 2.0, 2.0 ); let z: f32x4 = x * y; let result: String = format!("{:?}", z); assert_eq!(result, "f32x4(\ 2.46, 9.12, 15.78, 0.24\ )".to_string()); } }
mul_test1
identifier_name
boolobject.rs
use super::PyObject; use crate::conversion::ToPyObject; use crate::err::PyResult; use crate::ffi; use crate::python::Python; /// Represents a Python `bool`. pub struct PyBool(PyObject); pyobject_newtype!(PyBool, PyBool_Check, PyBool_Type); impl PyBool { /// Depending on `val`, returns `py.True()` or `py.False()`...
fn test_true() { let gil = Python::acquire_gil(); let py = gil.python(); assert!(py.True().is_true()); assert_eq!(true, py.True().as_object().extract(py).unwrap()); assert!(true.to_py_object(py).as_object() == py.True().as_object()); } #[test] fn test_false() { ...
#[test]
random_line_split
boolobject.rs
use super::PyObject; use crate::conversion::ToPyObject; use crate::err::PyResult; use crate::ffi; use crate::python::Python; /// Represents a Python `bool`. pub struct PyBool(PyObject); pyobject_newtype!(PyBool, PyBool_Check, PyBool_Type); impl PyBool { /// Depending on `val`, returns `py.True()` or `py.False()`...
} /// Gets whether this boolean is `true`. #[inline] pub fn is_true(&self) -> bool { self.0.as_ptr() == unsafe { crate::ffi::Py_True() } } } /// Converts a rust `bool` to a Python `bool`. impl ToPyObject for bool { type ObjectType = PyBool; #[inline] fn to_py_object(&self, py...
{ py.False() }
conditional_block
boolobject.rs
use super::PyObject; use crate::conversion::ToPyObject; use crate::err::PyResult; use crate::ffi; use crate::python::Python; /// Represents a Python `bool`. pub struct PyBool(PyObject); pyobject_newtype!(PyBool, PyBool_Check, PyBool_Type); impl PyBool { /// Depending on `val`, returns `py.True()` or `py.False()`...
#[test] fn test_false() { let gil = Python::acquire_gil(); let py = gil.python(); assert!(!py.False().is_true()); assert_eq!(false, py.False().as_object().extract(py).unwrap()); assert!(false.to_py_object(py).as_object() == py.False().as_object()); } }
{ let gil = Python::acquire_gil(); let py = gil.python(); assert!(py.True().is_true()); assert_eq!(true, py.True().as_object().extract(py).unwrap()); assert!(true.to_py_object(py).as_object() == py.True().as_object()); }
identifier_body
boolobject.rs
use super::PyObject; use crate::conversion::ToPyObject; use crate::err::PyResult; use crate::ffi; use crate::python::Python; /// Represents a Python `bool`. pub struct PyBool(PyObject); pyobject_newtype!(PyBool, PyBool_Check, PyBool_Type); impl PyBool { /// Depending on `val`, returns `py.True()` or `py.False()`...
(&self, py: Python) -> PyBool { PyBool::get(py, *self) } #[inline] fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where F: FnOnce(*mut ffi::PyObject) -> R, { // Avoid unnecessary Py_INCREF/Py_DECREF pair f(unsafe { if *self { ff...
to_py_object
identifier_name
xmlname.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/. */ //! Functions for validating and extracting qualified XML names. use dom::bindings::error::{Error, ErrorResult, F...
} }
random_line_split
xmlname.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/. */ //! Functions for validating and extracting qualified XML names. use dom::bindings::error::{Error, ErrorResult, F...
} /// Convert a possibly-null URL to a namespace. /// /// If the URL is None, returns the empty namespace. pub fn namespace_from_domstring(url: Option<DOMString>) -> Namespace { match url { None => ns!(), Some(s) => Namespace(Atom::from(&*s)), } }
{ XMLName::QName }
conditional_block
xmlname.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/. */ //! Functions for validating and extracting qualified XML names. use dom::bindings::error::{Error, ErrorResult, F...
} fn is_valid_continuation(c: char) -> bool { is_valid_start(c) || match c { '-' | '.' | '0'...'9' | '\u{B7}' | '\u{300}'...'\u{36F}' | '\u{203F}'...'\u{2040}' => true, _ => false, } } let mut ...
{ match c { ':' | 'A'...'Z' | '_' | 'a'...'z' | '\u{C0}'...'\u{D6}' | '\u{D8}'...'\u{F6}' | '\u{F8}'...'\u{2FF}' | '\u{370}'...'\u{37D}' | '\u{37F}'...'\u{1FFF}' | '\u{200C}'...'\u{200D}' | ...
identifier_body
xmlname.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/. */ //! Functions for validating and extracting qualified XML names. use dom::bindings::error::{Error, ErrorResult, F...
(url: Option<DOMString>) -> Namespace { match url { None => ns!(), Some(s) => Namespace(Atom::from(&*s)), } }
namespace_from_domstring
identifier_name
mod_is_reduced.rs
use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base_test_util::generators::unsigned_pair_gen_var_12; use std::panic::catch_unwind; fn mod_is_reduced_helper<T: PrimitiveUnsigned>() { let test = |n: T, m, out| { assert_eq!(n.mod_is_reduced(&m), out);
test(T::MAX - T::ONE, T::MAX, true); test(T::MAX, T::MAX, false); } #[test] fn test_mod_is_reduced() { apply_fn_to_unsigneds!(mod_is_reduced_helper); } fn mod_is_reduced_fail_helper<T: PrimitiveUnsigned>() { assert_panic!(T::ZERO.mod_is_reduced(&T::ZERO)); } #[test] fn mod_is_reduced_fail() { app...
}; test(T::ZERO, T::exact_from(5), true); test(T::exact_from(100), T::exact_from(100), false); test(T::exact_from(100), T::exact_from(101), true); test(T::MAX - T::ONE, T::MAX - T::ONE, false);
random_line_split
mod_is_reduced.rs
use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base_test_util::generators::unsigned_pair_gen_var_12; use std::panic::catch_unwind; fn mod_is_reduced_helper<T: PrimitiveUnsigned>() { let test = |n: T, m, out| { assert_eq!(n.mod_is_reduced(&m), out); }; test(T::ZERO, T::e...
<T: PrimitiveUnsigned>() { assert_panic!(T::ZERO.mod_is_reduced(&T::ZERO)); } #[test] fn mod_is_reduced_fail() { apply_fn_to_unsigneds!(mod_is_reduced_fail_helper); } fn mod_is_reduced_properties_helper<T: PrimitiveUnsigned>() { unsigned_pair_gen_var_12::<T, T>().test_properties(|(n, m)| { assert_...
mod_is_reduced_fail_helper
identifier_name
mod_is_reduced.rs
use malachite_base::num::basic::unsigneds::PrimitiveUnsigned; use malachite_base_test_util::generators::unsigned_pair_gen_var_12; use std::panic::catch_unwind; fn mod_is_reduced_helper<T: PrimitiveUnsigned>()
#[test] fn test_mod_is_reduced() { apply_fn_to_unsigneds!(mod_is_reduced_helper); } fn mod_is_reduced_fail_helper<T: PrimitiveUnsigned>() { assert_panic!(T::ZERO.mod_is_reduced(&T::ZERO)); } #[test] fn mod_is_reduced_fail() { apply_fn_to_unsigneds!(mod_is_reduced_fail_helper); } fn mod_is_reduced_prope...
{ let test = |n: T, m, out| { assert_eq!(n.mod_is_reduced(&m), out); }; test(T::ZERO, T::exact_from(5), true); test(T::exact_from(100), T::exact_from(100), false); test(T::exact_from(100), T::exact_from(101), true); test(T::MAX - T::ONE, T::MAX - T::ONE, false); test(T::MAX - T::ONE,...
identifier_body
main.rs
// http://rosettacode.org/wiki/Taxicab_numbers use std::cmp::Ordering; use std::collections::BinaryHeap; /// A type to represent a pair-sum of cubes. /// value = a^3 + b^3 #[derive(Copy, Clone, PartialEq, Eq)] struct SumCubes { a: u64, b: u64, value: u64, } impl SumCubes { fn new(a: u64, b: u64) -> S...
} } /// An iterator through all Taxicab numbers struct TaxicabNumbers { /// Use a BinaryHeap as a priority queue to iterate through sums of /// cubes efficiently in increasing order pq: BinaryHeap<SumCubes>, } impl TaxicabNumbers { fn new() -> TaxicabNumbers { let mut res = TaxicabNumbers ...
} impl Ord for SumCubes { fn cmp(&self, other: &SumCubes) -> Ordering { self.partial_cmp(other).unwrap()
random_line_split
main.rs
// http://rosettacode.org/wiki/Taxicab_numbers use std::cmp::Ordering; use std::collections::BinaryHeap; /// A type to represent a pair-sum of cubes. /// value = a^3 + b^3 #[derive(Copy, Clone, PartialEq, Eq)] struct SumCubes { a: u64, b: u64, value: u64, } impl SumCubes { fn new(a: u64, b: u64) -> S...
{ // A001235 on OEIS let seq = [ 1729u64, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597, 439101, 443889, 513000, 513856, 515375, 525824, 558441, 593047, ...
identifier_body
main.rs
// http://rosettacode.org/wiki/Taxicab_numbers use std::cmp::Ordering; use std::collections::BinaryHeap; /// A type to represent a pair-sum of cubes. /// value = a^3 + b^3 #[derive(Copy, Clone, PartialEq, Eq)] struct SumCubes { a: u64, b: u64, value: u64, } impl SumCubes { fn new(a: u64, b: u64) -> S...
{ /// Use a BinaryHeap as a priority queue to iterate through sums of /// cubes efficiently in increasing order pq: BinaryHeap<SumCubes>, } impl TaxicabNumbers { fn new() -> TaxicabNumbers { let mut res = TaxicabNumbers { pq: BinaryHeap::new(), }; res.pq.push(SumCub...
TaxicabNumbers
identifier_name
main.rs
// http://rosettacode.org/wiki/Taxicab_numbers use std::cmp::Ordering; use std::collections::BinaryHeap; /// A type to represent a pair-sum of cubes. /// value = a^3 + b^3 #[derive(Copy, Clone, PartialEq, Eq)] struct SumCubes { a: u64, b: u64, value: u64, } impl SumCubes { fn new(a: u64, b: u64) -> S...
// Populate the priority queue with more sums self.pq.push(SumCubes::new(nxt.a + 1, nxt.b)); if nxt.a == nxt.b { self.pq.push(SumCubes::new(nxt.a + 1, nxt.b + 1)); } } } } fn main() { let numbers = TaxicabNumbers::new(); for (at, way...
{ ways.clear(); ways.push(nxt); }
conditional_block
mod.rs
//! Merchant Fulfillment - Version 2015-06-01 //! //! [Documentation](http://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_Overview.html) pub use self::types::*; use client::{Client, Method}; use result::MwsResult; mod types; static PATH: &'static str = "/MerchantFulfillment/2015-06-01"; static ...
ShipDate: None, ShippingServiceOptions: ShippingServiceOptions { DeliveryExperience: DeliveryExperience::DeliveryConfirmationWithSignature, DeclaredValue: None, CarrierWillPickUp: false, LabelFormat: None, }, LabelCustomization: Default::default(), } } #[...
random_line_split
mod.rs
//! Merchant Fulfillment - Version 2015-06-01 //! //! [Documentation](http://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_Overview.html) pub use self::types::*; use client::{Client, Method}; use result::MwsResult; mod types; static PATH: &'static str = "/MerchantFulfillment/2015-06-01"; static ...
( client: &Client, params: GetEligibleShippingServicesParameters, ) -> MwsResult<GetEligibleShippingServicesResponse> { client .request_xml( Method::POST, PATH, VERSION, "GetEligibleShippingServices", params, ) .map(|e: GetEligibleShippingServicesEnvelope| e.into_inner()) ...
GetEligibleShippingServices
identifier_name
layout.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/. */ #![crate_id = "github.com/mozilla/servo#layout:0.1"] #![crate_type = "lib"] #![crate_type = "dylib"] #![crate_type...
pub mod block; pub mod construct; pub mod context; pub mod floats; pub mod flow; pub mod flow_list; pub mod flow_ref; pub mod fragment; pub mod layout_task; pub mod inline; pub mod model; pub mod parallel; pub mod table_wrapper; pub mod table; pub mod table_caption; pub mod table_colgroup; pub mod table_rowgroup; pub ...
extern crate collections; extern crate green; extern crate libc; extern crate sync; extern crate url;
random_line_split
engine.rs
// The MIT License (MIT) // // Copyright (c) 2014 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitati...
pub fn generate(&mut self, output: &mut Writer) -> IoResult<()> { // println!("html: "); match output.write_str(format!("{}", self.dom_tree)) { Ok(_) => Ok(()), Err(e) => Err(e) } } }
{ unimplemented!() }
identifier_body
engine.rs
// The MIT License (MIT) // // Copyright (c) 2014 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitati...
<T: fmt::Show>(&mut self, val: T) -> bool { unimplemented!() } pub fn set_vec_val<T: fmt::Show>(&mut self, vec_val: Vec<T>) -> bool { unimplemented!() } pub fn generate(&mut self, output: &mut Writer) -> IoResult<()> { // println!("html: "); match output.write_str(forma...
set_val
identifier_name
engine.rs
// The MIT License (MIT) // // Copyright (c) 2014 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitati...
use parser::Parser; use dom_tree::DomTree; use input_reader::InputReader; pub struct Engine { lexer: Lexer, parser: Parser, dom_tree: DomTree } impl Engine { pub fn new(input: ~Reader, html_fmt: HtmlFormat) -> Engine { Engine { lexer: Lexer::new(InputReader::new(input)), ...
use std::io::IoResult; use format::{HtmlFormat, Xhtml, Html5, Html4}; use token::*; use lexer::Lexer;
random_line_split
atomic_refcell.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 style::atomic_refcell::{AtomicRef, AtomicRefCell}; struct Foo { u: u32, } struct Bar { f: Foo, }
assert_eq!(b.f.u, 42); let c = AtomicRef::map(b, |x| &x.f); assert_eq!(c.u, 42); let d = AtomicRef::map(c, |x| &x.u); assert_eq!(*d, 42); } /* FIXME(bholley): Enable once we have AtomicRefMut::map(), which is blocked on * https://github.com/Kimundi/owning-ref-rs/pull/16 #[test] fn map_mut() { ...
#[test] fn map() { let a = AtomicRefCell::new(Bar { f: Foo { u: 42 } }); let b = a.borrow();
random_line_split
atomic_refcell.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 style::atomic_refcell::{AtomicRef, AtomicRefCell}; struct
{ u: u32, } struct Bar { f: Foo, } #[test] fn map() { let a = AtomicRefCell::new(Bar { f: Foo { u: 42 } }); let b = a.borrow(); assert_eq!(b.f.u, 42); let c = AtomicRef::map(b, |x| &x.f); assert_eq!(c.u, 42); let d = AtomicRef::map(c, |x| &x.u); assert_eq!(*d, 42); } /* FIXME(bho...
Foo
identifier_name
shadow.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 ...
(c: Vec<isize> ) { let a: isize = 5; let mut b: Vec<isize> = Vec::new(); match t::none::<isize> { t::some::<isize>(_) => { for _i in &c { println!("{}", a); let a = 17; b.push(a); } } _ => { } } } enum t<T...
foo
identifier_name
shadow.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 ...
enum t<T> { none, some(T), } pub fn main() { let x = 10; let x = x + 20; assert_eq!(x, 30); foo(Vec::new()); }
{ let a: isize = 5; let mut b: Vec<isize> = Vec::new(); match t::none::<isize> { t::some::<isize>(_) => { for _i in &c { println!("{}", a); let a = 17; b.push(a); } } _ => { } } }
identifier_body
shadow.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 ...
_ => { } } } enum t<T> { none, some(T), } pub fn main() { let x = 10; let x = x + 20; assert_eq!(x, 30); foo(Vec::new()); }
{ for _i in &c { println!("{}", a); let a = 17; b.push(a); } }
conditional_block
shadow.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 ...
} } enum t<T> { none, some(T), } pub fn main() { let x = 10; let x = x + 20; assert_eq!(x, 30); foo(Vec::new()); }
let a = 17; b.push(a); } } _ => { }
random_line_split
main_loop.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 MainContext; use ffi; use ffi as glib_ffi; use gobject_ffi; use std::mem; use std::ptr; use translate::*; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Has...
(&self) { unsafe { ffi::g_main_loop_quit(self.to_glib_none().0); } } pub fn run(&self) { unsafe { ffi::g_main_loop_run(self.to_glib_none().0); } } } unsafe impl Send for MainLoop {} unsafe impl Sync for MainLoop {}
quit
identifier_name
main_loop.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 MainContext; use ffi; use ffi as glib_ffi; use gobject_ffi; use std::mem; use std::ptr; use translate::*; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Has...
from_glib_full(ffi::g_main_loop_new(context.0, is_running.to_glib())) } } pub fn get_context(&self) -> MainContext { unsafe { from_glib_none(ffi::g_main_loop_get_context(self.to_glib_none().0)) } } pub fn is_running(&self) -> bool { unsafe { ...
let context = context.into(); let context = context.to_glib_none(); unsafe {
random_line_split
main_loop.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 MainContext; use ffi; use ffi as glib_ffi; use gobject_ffi; use std::mem; use std::ptr; use translate::*; glib_wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Has...
} unsafe impl Send for MainLoop {} unsafe impl Sync for MainLoop {}
{ unsafe { ffi::g_main_loop_run(self.to_glib_none().0); } }
identifier_body
main.rs
.1, map, cache), Ops::Or => self.input(&self.items.0, map, cache) | self.input(&self.items.1, map, cache), Ops::Rsh => self.input(&self.items.0, map, cache) >> self.input(&self.items.1, map, cache), Ops::Lsh => self.input(&self.items.0, map, cache) << self.input(&self.items.1, map, c...
{ let swap = vec[0]; vec[0] = vec[n-1]; vec[n-1] = swap; }
conditional_block
main.rs
* lwh[2], lwh[1] * lwh[2]); paper += 2 * (a + b + c) + least(a, b, c); let (p1, p2, p3) = (2 * (lwh[0] + lwh[1]), 2 * (lwh[0] + lwh[2]), 2 * (lwh[1] + lwh[2])); ribbon += least(p1, p2, p3) + lwh[0] * lwh[1] * lwh[2]; } (paper, ribbon) } fn d3(&self) -> (us...
{ let args: Vec<_> = env::args().collect(); if args.len() > 1 { match &*args[1] { "d1" => { let (x, y) = Advent.d1(); println!("floor: {}\nbasement: {}", x, y); }, "d2" => { let (x, y) = Advent.d2(); pri...
identifier_body
main.rs
items.1, map, cache), Ops::Rsh => self.input(&self.items.0, map, cache) >> self.input(&self.items.1, map, cache), Ops::Lsh => self.input(&self.items.0, map, cache) << self.input(&self.items.1, map, cache) } } } struct Advent; impl Advent { fn d1(&self) -> (i32, usize) { ...
look_n_say
identifier_name
main.rs
val }, Err(_) => { let val = map.get(item).unwrap().output(map, cache); cache.insert(item.to_string(), val); val } } } fn output(&self, map: &HashMap<String, Wire>, cache: &mut HashMap<String, u16>) -> u...
//I'm angry that this works because it shouldn't //the dataset doesn't have an item to break it if dubs_count > 1 { got_dubs = true; } } if i < line_b.len()-2 && line_b[i] == line_b[i...
if !got_dubs { let dubs = Regex::new(&format!("{}{}", line_b[i] as char, line_b[i+1] as char)).unwrap(); let dubs_count = dubs.find_iter(&line).count();
random_line_split
generic-associated-types-where.rs
#![feature(generic_associated_types)] // Checking the interaction with this other feature #![feature(associated_type_defaults)] use std::fmt::{Display, Debug}; trait Foo { type Assoc where Self: Sized; type Assoc2<T> where T: Display; type Assoc3<T>; type WithDefault<'a, T: Debug + 'a>:?Sized = dyn I...
impl Foo for Bar { type Assoc = usize; type Assoc2<T> = Vec<T>; //~^ ERROR `T` doesn't implement `std::fmt::Display` type Assoc3<T> where T: Iterator = Vec<T>; //~^ ERROR impl has stricter requirements than trait type WithDefault<'a, T: Debug + 'a> = &'a dyn Iterator<Item=T>; type NoGenerics...
struct Bar;
random_line_split
generic-associated-types-where.rs
#![feature(generic_associated_types)] // Checking the interaction with this other feature #![feature(associated_type_defaults)] use std::fmt::{Display, Debug}; trait Foo { type Assoc where Self: Sized; type Assoc2<T> where T: Display; type Assoc3<T>; type WithDefault<'a, T: Debug + 'a>:?Sized = dyn I...
() {}
main
identifier_name
generic-associated-types-where.rs
#![feature(generic_associated_types)] // Checking the interaction with this other feature #![feature(associated_type_defaults)] use std::fmt::{Display, Debug}; trait Foo { type Assoc where Self: Sized; type Assoc2<T> where T: Display; type Assoc3<T>; type WithDefault<'a, T: Debug + 'a>:?Sized = dyn I...
{}
identifier_body
issue-7575.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 ...
} impl ManyImplTrait for uint {} impl ManyImplTrait for int {} impl ManyImplTrait for char {} impl ManyImplTrait for MyInt {} fn no_param_bound(u: uint, m: MyInt) -> uint { u.f8(42) + u.f9(342) + m.fff(42) //~^ ERROR type `uint` does not implement any method in scope named `f9` //~^^ NOTE...
{ true }
identifier_body
issue-7575.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 ...
() -> bool { true } } impl ManyImplTrait for uint {} impl ManyImplTrait for int {} impl ManyImplTrait for char {} impl ManyImplTrait for MyInt {} fn no_param_bound(u: uint, m: MyInt) -> uint { u.f8(42) + u.f9(342) + m.fff(42) //~^ ERROR type `uint` does not implement any method in scope na...
is_str
identifier_name
issue-7575.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 ...
impl ManyImplTrait for StrBuf { fn is_str() -> bool { true } } impl ManyImplTrait for uint {} impl ManyImplTrait for int {} impl ManyImplTrait for char {} impl ManyImplTrait for MyInt {} fn no_param_bound(u: uint, m: MyInt) -> uint { u.f8(42) + u.f9(342) + m.fff(42) //~^ ERROR type `u...
}
random_line_split
svh-a-change-type-static.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} pub fn an_unused_name() -> int { 4 }
pub fn foo<T:U>(_: int) -> int { 3
random_line_split
svh-a-change-type-static.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 ...
{ 4 }
identifier_body
svh-a-change-type-static.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 ...
() -> int { 4 }
an_unused_name
identifier_name
audiodestinationnode.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::audionode::{AudioNode, MAX_CHANNEL_COUNT}; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings...
} impl AudioDestinationNode { fn new_inherited( context: &BaseAudioContext, options: &AudioNodeOptions, ) -> AudioDestinationNode { AudioDestinationNode { node: AudioNode::new_inherited( AudioNodeInit::DestinationNode, Some(context.destination...
#[dom_struct] pub struct AudioDestinationNode { node: AudioNode,
random_line_split
audiodestinationnode.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::audionode::{AudioNode, MAX_CHANNEL_COUNT}; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings...
}
{ MAX_CHANNEL_COUNT }
identifier_body
audiodestinationnode.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::audionode::{AudioNode, MAX_CHANNEL_COUNT}; use dom::baseaudiocontext::BaseAudioContext; use dom::bindings...
( global: &GlobalScope, context: &BaseAudioContext, options: &AudioNodeOptions, ) -> DomRoot<AudioDestinationNode> { let node = AudioDestinationNode::new_inherited(context, options); reflect_dom_object(Box::new(node), global, AudioDestinationNodeBinding::Wrap) } } impl A...
new
identifier_name
test-lists.rs
#![crate_name = "foo"] // @has foo/fn.f.html // @has - //ol/li "list" // @has - //ol/li/ol/li "fooooo" // @has - //ol/li/ol/li "x" // @has - //ol/li "foo" /// 1. list /// 1. fooooo /// 2. x /// 2. foo pub fn f() {} // @has foo/fn.foo2.html // @has - //ul/li "normal list" // @has - //ul/li/ul/li "sub list" // ...
() {}
foo2
identifier_name
test-lists.rs
#![crate_name = "foo"] // @has foo/fn.f.html // @has - //ol/li "list" // @has - //ol/li/ol/li "fooooo" // @has - //ol/li/ol/li "x"
/// 2. x /// 2. foo pub fn f() {} // @has foo/fn.foo2.html // @has - //ul/li "normal list" // @has - //ul/li/ul/li "sub list" // @has - //ul/li/ul/li "new elem still same elem and again same elem!" // @has - //ul/li "new big elem" /// * normal list /// * sub list /// * new elem /// still same elem //...
// @has - //ol/li "foo" /// 1. list /// 1. fooooo
random_line_split
test-lists.rs
#![crate_name = "foo"] // @has foo/fn.f.html // @has - //ol/li "list" // @has - //ol/li/ol/li "fooooo" // @has - //ol/li/ol/li "x" // @has - //ol/li "foo" /// 1. list /// 1. fooooo /// 2. x /// 2. foo pub fn f()
// @has foo/fn.foo2.html // @has - //ul/li "normal list" // @has - //ul/li/ul/li "sub list" // @has - //ul/li/ul/li "new elem still same elem and again same elem!" // @has - //ul/li "new big elem" /// * normal list /// * sub list /// * new elem /// still same elem /// /// and again same elem! /// ...
{}
identifier_body
htmlmapelement.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::Bindings::HTMLMapElementBinding; use crate::dom::bindings::inheritance::Castab...
( local_name: LocalName, prefix: Option<Prefix>, document: &Document, ) -> HTMLMapElement { HTMLMapElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), } } #[allow(unrooted_must_root)] pub fn new( local_name: LocalN...
new_inherited
identifier_name
htmlmapelement.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::Bindings::HTMLMapElementBinding; use crate::dom::bindings::inheritance::Castab...
prefix: Option<Prefix>, document: &Document, ) -> HTMLMapElement { HTMLMapElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), } } #[allow(unrooted_must_root)] pub fn new( local_name: LocalName, prefix: Option<Prefi...
random_line_split
htmlmapelement.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::Bindings::HTMLMapElementBinding; use crate::dom::bindings::inheritance::Castab...
}
{ self.upcast::<Node>() .traverse_preorder() .filter_map(DomRoot::downcast::<HTMLAreaElement>) .collect() }
identifier_body
about_loader.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use file_loader; use mime_classifier::MIMEClassifier; use net_traits::ProgressMsg::Done; use net_traits::{LoadData...
(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEClassifier>) { match load_data.url.non_relative_scheme_data().unwrap() { "blank" => { let chan = start_sending(start_chan, Metadata { final_url: load_data.url, content_type: Some(ContentType(M...
factory
identifier_name
about_loader.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use file_loader; use mime_classifier::MIMEClassifier; use net_traits::ProgressMsg::Done; use net_traits::{LoadData...
pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Arc<MIMEClassifier>) { match load_data.url.non_relative_scheme_data().unwrap() { "blank" => { let chan = start_sending(start_chan, Metadata { final_url: load_data.url, content_type: Some...
use util::resource_files::resources_dir_path; use std::fs::PathExt; use std::sync::Arc;
random_line_split
about_loader.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use file_loader; use mime_classifier::MIMEClassifier; use net_traits::ProgressMsg::Done; use net_traits::{LoadData...
_ => { start_sending(start_chan, Metadata::default(load_data.url)) .send(Done(Err("Unknown about: URL.".to_string()))) .unwrap(); return } }; file_loader::factory(load_data, start_chan, classifier) }
{ match load_data.url.non_relative_scheme_data().unwrap() { "blank" => { let chan = start_sending(start_chan, Metadata { final_url: load_data.url, content_type: Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, vec![]))), charset: Some("utf-8"....
identifier_body
about_loader.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use file_loader; use mime_classifier::MIMEClassifier; use net_traits::ProgressMsg::Done; use net_traits::{LoadData...
_ => { start_sending(start_chan, Metadata::default(load_data.url)) .send(Done(Err("Unknown about: URL.".to_string()))) .unwrap(); return } }; file_loader::factory(load_data, start_chan, classifier) }
{ let mut path = resources_dir_path(); path.push("failure.html"); assert!(path.exists()); load_data.url = Url::from_file_path(&*path).unwrap(); }
conditional_block
statistic.rs
// Copyright 2015 The Delix Project Authors. See the AUTHORS file at the top level directory. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-...
() -> Self { Statistic { query: RwLock::new(None), entries: RwLock::new(HashMap::new()), } } pub fn assign_query(&self, query: Arc<store::Query>) { *self.query.write().unwrap() = Some(query); } pub fn push(&self, subject: Subject, duration: Duration) { ...
new
identifier_name