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
visitor.rs
// Copyright 2016 Google Inc. All rights reserved. // // 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-2.0 // // Unless required by applicable l...
// node or span for the item name if let Ok(bind_vname) = self.anchor_from_sub_span(item.span, &def_name) { self.writer.edge(&bind_vname, EdgeKind::DefinesBinding, &def_vname) } } _ => (), } self.parent_vname = ...
{ let old_parent = self.parent_vname.clone(); let def_id = self.tcx.map.local_def_id(item.id); let def_name = item.name.to_string(); let def_vname = self.vname_from_defid(def_id); use rustc::hir::Item_::*; match item.node { ItemStatic(..) | ItemConst(..) => ...
identifier_body
closure.rs
use arena::TypedArena; use back::link::{self, mangle_internal_name_by_path_and_seq}; use llvm::{ValueRef, get_params}; use middle::mem_categorization::Typer; use trans::adt; use trans::attributes; use trans::base::*; use trans::build::*; use trans::callee::{self, ArgVals, Callee, TraitItem, MethodData}; use trans::clea...
<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, arg_scope_id: ScopeId, freevars: &[ty::Freevar]) -> Block<'blk, 'tcx> { let _icx = push_ctxt("closure::load_closure_environment"); // Special case for sma...
load_closure_environment
identifier_name
closure.rs
use arena::TypedArena; use back::link::{self, mangle_internal_name_by_path_and_seq}; use llvm::{ValueRef, get_params}; use middle::mem_categorization::Typer; use trans::adt; use trans::attributes; use trans::base::*; use trans::build::*; use trans::callee::{self, ArgVals, Callee, TraitItem, MethodData}; use trans::cle...
// region since it doesn't really matter. let substs = tcx.mk_substs(substs); let closure_ty = tcx.mk_closure(closure_def_id, substs); let ref_closure_ty = tcx.mk_imm_ref(tcx.mk_region(ty::ReStatic), closure_ty); // Make a version with the type of by-ref closure. let ty::ClosureTy { unsafety, a...
let tcx = ccx.tcx(); let typer = NormalizingClosureTyper::new(tcx); // Find a version of the closure type. Substitute static for the
random_line_split
closure.rs
use arena::TypedArena; use back::link::{self, mangle_internal_name_by_path_and_seq}; use llvm::{ValueRef, get_params}; use middle::mem_categorization::Typer; use trans::adt; use trans::attributes; use trans::base::*; use trans::build::*; use trans::callee::{self, ArgVals, Callee, TraitItem, MethodData}; use trans::clea...
fn trans_closure_adapter_shim<'a, 'tcx>( ccx: &'a CrateContext<'a, 'tcx>, closure_def_id: ast::DefId, substs: Substs<'tcx>, llfn_closure_kind: ty::ClosureKind, trait_closure_kind: ty::ClosureKind, llfn: ValueRef) -> ValueRef { let _icx = push_ctxt("trans_closure_adapter_shim"); let t...
// The substitutions should have no type parameters remaining // after passing through fulfill_obligation let llfn = callee::trans_fn_ref_with_substs(ccx, closure_def_id, node, ...
identifier_body
aarch64.rs
//! Aarch64 run-time features. /// Checks if `aarch64` feature is enabled. #[macro_export] #[unstable(feature = "stdsimd", issue = "27731")] #[allow_internal_unstable(stdsimd_internal, stdsimd)] macro_rules! is_aarch64_feature_detected { ("neon") => { // FIXME: this should be removed once we rename Aarch64...
{ /// ARM Advanced SIMD (ASIMD) asimd, /// Polynomial Multiply pmull, /// Floating point support fp, /// Half-float support. fp16, /// Scalable Vector Extension (SVE) sve, /// CRC32 (Cyclic Redundancy Check) crc, /// Crypto: AES + PMULL + SHA1 + SHA2 crypto, ...
Feature
identifier_name
aarch64.rs
//! Aarch64 run-time features. /// Checks if `aarch64` feature is enabled. #[macro_export] #[unstable(feature = "stdsimd", issue = "27731")] #[allow_internal_unstable(stdsimd_internal, stdsimd)] macro_rules! is_aarch64_feature_detected { ("neon") => { // FIXME: this should be removed once we rename Aarch64...
}; } /// ARM Aarch64 CPU Feature enum. Each variant denotes a position in a bitset /// for a particular feature. /// /// PLEASE: do not use this, it is an implementation detail subject to change. #[doc(hidden)] #[allow(non_camel_case_types)] #[repr(u8)] #[unstable(feature = "stdsimd_internal", issue = "0")] pub en...
is_aarch64_feature_detected!($t); }; ($t:tt) => { compile_error!(concat!("unknown aarch64 target feature: ", $t))
random_line_split
reject-specialized-drops-8142.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[unsafe_destructor] impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT //~^ERROR Implementations of Drop cannot be specialized #[unsafe_destructor] impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT //~^ERROR Implementations of Drop cannot be specialized pub f...
#[unsafe_destructor] impl<'t,Bt:'t> Drop for T<'t,Bt> { fn drop(&mut self) { } } // ACCEPT impl Drop for U { fn drop(&mut self) { } } // ACCEPT
random_line_split
reject-specialized-drops-8142.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&mut self) { } } // REJECT //~^ ERROR Implementations of Drop cannot be specialized #[unsafe_destructor] impl<Adds_bnd:Bound> Drop for Q<Adds_bnd> { fn drop(&mut self) { } } // REJECT //~^ ERROR The requirement `Adds_bnd : Bound` is added only by the Drop impl. #[unsafe_destructor] impl<'rbnd,Adds_rbnd:'rbnd> Drop f...
drop
identifier_name
cell.rs
// Copyright 2012-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...
<'a>(&'a self) -> &'a T { self._value } } /// Copies a `Ref`. /// /// The `RefCell` is already immutably borrowed, so this cannot fail. /// /// A `Clone` implementation would interfere with the widespread /// use of `r.borrow().clone()` to clone the contents of a `RefCell`. #[unstable(feature = "core", ...
deref
identifier_name
cell.rs
// Copyright 2012-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...
Some(b) => RefMut { _value: unsafe { &mut *self.value.get() }, _borrow: b, }, None => panic!("RefCell<T> already borrowed"), } } /// Gets a reference to the underlying `UnsafeCell`. /// /// This can be used to circumvent `RefCe...
match BorrowRefMut::new(&self.borrow) {
random_line_split
num.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 ...
; // No more digits left to accumulate. } } else { // Do the same as above, but accounting for two's complement. for byte in buf.iter_mut().rev() { let n = zero - (x % base); // Get the current place value. x = ...
{ break }
conditional_block
num.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 ...
/// A binary (base 2) radix #[derive(Clone, PartialEq)] struct Binary; /// An octal (base 8) radix #[derive(Clone, PartialEq)] struct Octal; /// A decimal (base 10) radix #[derive(Clone, PartialEq)] struct Decimal; /// A hexadecimal (base 16) radix, formatted with lower-case characters #[derive(Clone, PartialEq)] st...
random_line_split
num.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 ...
; /// A hexadecimal (base 16) radix, formatted with upper-case characters #[derive(Clone, PartialEq)] pub struct UpperHex; macro_rules! radix { ($T:ident, $base:expr, $prefix:expr, $($x:pat => $conv:expr),+) => { impl GenericRadix for $T { fn base(&self) -> u8 { $base } fn prefix(&...
LowerHex
identifier_name
my_task.rs
use std::collections::VecDeque; use std::{thread, time}; use tokio::prelude::*; const SLEEP_MILLIS: u64 = 100; fn poll_number() -> Async<u32> { Async::Ready(233) } pub struct MyTask; impl Future for MyTask { type Item = (); type Error = (); fn poll(&mut self) -> Result<Async<()>, ()> { match p...
pub fn run(&mut self) { loop { while let Some(mut task) = self.ready_tasks.pop_front() { match task.poll().unwrap() { Async::Ready(_) => {} Async::NotReady => { self.not_ready_tasks.push_back(task); ...
{ self.not_ready_tasks.push_back(Box::new(task)); }
identifier_body
my_task.rs
use std::collections::VecDeque; use std::{thread, time}; use tokio::prelude::*; const SLEEP_MILLIS: u64 = 100; fn poll_number() -> Async<u32> { Async::Ready(233) } pub struct MyTask; impl Future for MyTask { type Item = (); type Error = (); fn poll(&mut self) -> Result<Async<()>, ()> { match p...
self.sleep_until_tasks_are_ready(); } } fn sleep_until_tasks_are_ready(&mut self) { loop { if self.not_ready_tasks.is_empty() { thread::sleep(time::Duration::from_millis(SLEEP_MILLIS)); } else { while let Some(mut task) = self....
{ return; }
conditional_block
my_task.rs
use std::collections::VecDeque; use std::{thread, time}; use tokio::prelude::*; const SLEEP_MILLIS: u64 = 100; fn poll_number() -> Async<u32> { Async::Ready(233) } pub struct MyTask; impl Future for MyTask { type Item = (); type Error = (); fn poll(&mut self) -> Result<Async<()>, ()> { match p...
Async::NotReady => { self.not_ready_tasks.push_back(task); } } } if self.not_ready_tasks.is_empty() { return; } self.sleep_until_tasks_are_ready(); } } fn sleep_until_tasks_are_ready(&mut ...
loop { while let Some(mut task) = self.ready_tasks.pop_front() { match task.poll().unwrap() { Async::Ready(_) => {}
random_line_split
my_task.rs
use std::collections::VecDeque; use std::{thread, time}; use tokio::prelude::*; const SLEEP_MILLIS: u64 = 100; fn poll_number() -> Async<u32> { Async::Ready(233) } pub struct MyTask; impl Future for MyTask { type Item = (); type Error = (); fn poll(&mut self) -> Result<Async<()>, ()> { match p...
(&mut self) { loop { if self.not_ready_tasks.is_empty() { thread::sleep(time::Duration::from_millis(SLEEP_MILLIS)); } else { while let Some(mut task) = self.not_ready_tasks.pop_front() { self.ready_tasks.push_back(task); ...
sleep_until_tasks_are_ready
identifier_name
mod.rs
//! Bounding volumes. #[doc(inline)] pub use bounding_volume::bounding_volume::{HasBoundingVolume, BoundingVolume}; #[doc(inline)] pub use bounding_volume::aabb::{AABB, aabb}; #[doc(inline)] pub use bounding_volume::bounding_sphere::{BoundingSphere, bounding_sphere}; pub use bounding_volume::aabb_utils::{implicit_sha...
pub type BoundingSphere3<N> = BoundingSphere<Pnt3<N>>; /// A 3D AABB. pub type AABB3<N> = AABB<Pnt3<N>>;
/// A 3D bounding sphere:
random_line_split
mir_raw_fat_ptr.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn simple_eq<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> bool { let result = a == b; result } fn assert_inorder<T: Copy>(a: &[T], compare: fn(T, T) -> ComparisonResults) { for i in 0..a.len() { for j in 0..a.len() { let cres = compare(a[i], a[j]); ...
{ ComparisonResults { lt: a < b, le: a <= b, gt: a > b, ge: a >= b, eq: a == b, ne: a != b } }
identifier_body
mir_raw_fat_ptr.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
assert!(!simple_eq(&0u8 as *const _, &1u8 as *const _)); }
random_line_split
mir_raw_fat_ptr.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T: Copy>(a: &[T], compare: fn(T, T) -> ComparisonResults) { for i in 0..a.len() { for j in 0..a.len() { let cres = compare(a[i], a[j]); if i < j { assert_eq!(cres, LT); } else if i == j { assert_eq!(cres, EQ); ...
assert_inorder
identifier_name
main.rs
#![feature(proc_macro_hygiene, decl_macro)] extern crate rand; #[macro_use] extern crate rocket; extern crate rocket_contrib; #[macro_use] extern crate diesel; #[macro_use] extern crate serde_derive; use diesel::prelude::*; use diesel::result::Error; use rand::Rng; use rocket_contrib::json::Json; use rocket_contrib::...
#[get("/updates?<q>")] fn updates(conn: db::DbConn, q: u16) -> Json<Vec<models::World>> { use schema::world::dsl::*; let q = if q == 0 { 1 } else if q > 500 { 500 } else { q }; let mut results = Vec::with_capacity(q as usize); for _ in 0..q { let mut resu...
{ updates(conn, 1) }
identifier_body
main.rs
#![feature(proc_macro_hygiene, decl_macro)] extern crate rand; #[macro_use] extern crate rocket; extern crate rocket_contrib; #[macro_use] extern crate diesel; #[macro_use] extern crate serde_derive; use diesel::prelude::*; use diesel::result::Error; use rand::Rng; use rocket_contrib::json::Json; use rocket_contrib::...
(conn: db::DbConn) -> Template { use schema::fortune::dsl::*; let mut context = fortune .load::<models::Fortune>(&*conn) .expect("error loading fortunes"); context.push(models::Fortune { id: 0, message: "Additional fortune added at request time.".to_string(), }); con...
fortunes
identifier_name
main.rs
#![feature(proc_macro_hygiene, decl_macro)] extern crate rand; #[macro_use] extern crate rocket; extern crate rocket_contrib; #[macro_use] extern crate diesel; #[macro_use] extern crate serde_derive; use diesel::prelude::*; use diesel::result::Error; use rand::Rng; use rocket_contrib::json::Json; use rocket_contrib::...
let mut result = world .filter(id.eq(random_number())) .first::<models::World>(&*conn) .expect("error loading world"); result.randomNumber = random_number(); results.push(result); } let _ = conn.transaction::<(), Error, _>(|| { for w in &results ...
let mut results = Vec::with_capacity(q as usize); for _ in 0..q {
random_line_split
main.rs
#![feature(proc_macro_hygiene, decl_macro)] extern crate rand; #[macro_use] extern crate rocket; extern crate rocket_contrib; #[macro_use] extern crate diesel; #[macro_use] extern crate serde_derive; use diesel::prelude::*; use diesel::result::Error; use rand::Rng; use rocket_contrib::json::Json; use rocket_contrib::...
; let mut results = Vec::with_capacity(q as usize); for _ in 0..q { let result = world .filter(id.eq(random_number())) .first::<models::World>(&*conn) .expect("error loading world"); results.push(result); } Json(results) } #[get("/fortunes")] fn fortu...
{ q }
conditional_block
domtokenlist.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, AttrHelpers}; use dom::bindings::codegen::Bindings::DOMTokenListBinding; use dom::bindings::...
} } } }
{ let element = self.element.root(); let mut atoms = element.r().get_tokenlist_attribute(&self.local_name); let token = try!(self.check_token_exceptions(token.as_slice())); match atoms.iter().position(|atom| *atom == token) { Some(index) => match force { Some(...
identifier_body
domtokenlist.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, AttrHelpers}; use dom::bindings::codegen::Bindings::DOMTokenListBinding; use dom::bindings::...
(element: JSRef<Element>, local_name: Atom) -> DOMTokenList { DOMTokenList { reflector_: Reflector::new(), element: JS::from_rooted(element), local_name: local_name, } } pub fn new(element: JSRef<Element>, local_name: &Atom) -> Temporary<DOMTokenList> { ...
new_inherited
identifier_name
domtokenlist.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, AttrHelpers}; use dom::bindings::codegen::Bindings::DOMTokenListBinding; use dom::bindings::...
slice => Ok(Atom::from_slice(slice)) } } } // http://dom.spec.whatwg.org/#domtokenlist impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> { // http://dom.spec.whatwg.org/#dom-domtokenlist-length fn Length(self) -> u32 { self.attribute().root().map(|attr| { attr...
"" => Err(Syntax), slice if slice.find(HTML_SPACE_CHARACTERS).is_some() => Err(InvalidCharacter),
random_line_split
x86_64.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 ...
}, target_triple: match target_os { session::os_macos => ~"x86_64-apple-darwin", session::os_win32 => ~"x86_64-pc-mingw32", session::os_linux => ~"x86_64-unknown-linux-gnu", session::os_android => ~"x86_64-unknown-android-gnu", session::os_freebsd => ~...
{ ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ ~"s0:64:64-f80:128:128-n8:16:32:64-S128" }
conditional_block
x86_64.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 ...
session::os_linux => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ ~"s0:64:64-f80:128:128-n8:16:32:64-S128" } session::os_android => { ~"e-p:64:64:64-i1:8:8-i8:...
{ return target_strs::t { module_asm: ~"", meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), data_layout: match target_os { session::os_macos => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ~"f32:32:32-f64:64:64-v64:6...
identifier_body
x86_64.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 ...
session::os_win32 => { // FIXME: Test this. Copied from linux (#2398) ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ ~"s0:64:64-f80:128:128-n8:16:32:64-S128" } s...
session::os_macos => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ ~"s0:64:64-f80:128:128-n8:16:32:64" }
random_line_split
x86_64.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 ...
(target_os: session::os) -> target_strs::t { return target_strs::t { module_asm: ~"", meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), data_layout: match target_os { session::os_macos => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ ...
get_target_strs
identifier_name
filter_collector_wrapper.rs
// # Custom collector example // // This example shows how you can implement your own // collector. As an example, we will compute a collector // that computes the standard deviation of a given fast field. // // Of course, you can have a look at the tantivy's built-in collectors // such as the `CountCollector` for more...
} pub struct FilterSegmentCollector<TSegmentCollector, TPredicate, TPredicateValue> where TPredicate:'static, TPredicateValue: FastValue, { fast_field_reader: DynamicFastFieldReader<TPredicateValue>, segment_collector: TSegmentCollector, predicate: TPredicate, t_predicate_value: PhantomData<TP...
{ self.collector.merge_fruits(segment_fruits) }
identifier_body
filter_collector_wrapper.rs
// # Custom collector example // // This example shows how you can implement your own // collector. As an example, we will compute a collector // that computes the standard deviation of a given fast field. // // Of course, you can have a look at the tantivy's built-in collectors // such as the `CountCollector` for more...
(self) -> <TSegmentCollector as SegmentCollector>::Fruit { self.segment_collector.harvest() } }
harvest
identifier_name
filter_collector_wrapper.rs
// # Custom collector example // // This example shows how you can implement your own // collector. As an example, we will compute a collector // that computes the standard deviation of a given fast field. // // Of course, you can have a look at the tantivy's built-in collectors // such as the `CountCollector` for more...
} fn harvest(self) -> <TSegmentCollector as SegmentCollector>::Fruit { self.segment_collector.harvest() } }
{ self.segment_collector.collect(doc, score) }
conditional_block
filter_collector_wrapper.rs
// # Custom collector example // // This example shows how you can implement your own // collector. As an example, we will compute a collector // that computes the standard deviation of a given fast field. // // Of course, you can have a look at the tantivy's built-in collectors // such as the `CountCollector` for more...
TPredicateValue: FastValue, { // That's the type of our result. // Our standard deviation will be a float. type Fruit = TCollector::Fruit; type Child = FilterSegmentCollector<TCollector::Child, TPredicate, TPredicateValue>; fn for_segment( &self, segment_local_id: u32, ...
where TCollector: Collector + Send + Sync, TPredicate: 'static + Fn(TPredicateValue) -> bool + Send + Sync + Clone,
random_line_split
lint-unused-extern-crate.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let x: collecs::vec::Vec<uint> = Vec::new(); let y = now(); }
main
identifier_name
lint-unused-extern-crate.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 ...
#[allow(unused_imports)] use rand::isaac::IsaacRng; use time::*; fn main() { let x: collecs::vec::Vec<uint> = Vec::new(); let y = now(); }
extern crate time; // no error, the use * marks it as used
random_line_split
lint-unused-extern-crate.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let x: collecs::vec::Vec<uint> = Vec::new(); let y = now(); }
identifier_body
lib.rs
//! This is a library for controlling colours and formatting, such as //! red bold text or blue underlined text, on ANSI terminals. //! //! //! ## Basic usage //! //! There are two main data structures in this crate that you need to be //! concerned with: `ANSIString` and `Style`. A `Style` holds stylistic //! informat...
//! the same type. The `Style` struct also has a `Default` implementation if you //! want to have a style with *nothing* set. //! //! use ansi_term::Style; //! use ansi_term::Colour::Red; //! Red.normal().paint("yet another red string"); //! Style::default().paint("a completely regular string"); //! //!...
//! for example, you may have a method that returns `Styles`, and need to //! represent both the “red bold” and “red, but not bold” styles with values of
random_line_split
marker.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#[unstable(feature = "core", reason = "requires RFC and more experience")] #[allow(deprecated)] #[rustc_on_unimplemented = "`{Self}` does not implement `Any`; \ ensure all type parameters are bounded by `Any`"] pub trait Reflect {} impl Reflect for.. { }
random_line_split
marker.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
; macro_rules! impls{ ($t: ident) => ( impl<T:?Sized> Hash for $t<T> { #[inline] fn hash<H: Hasher>(&self, _: &mut H) { } } impl<T:?Sized> cmp::PartialEq for $t<T> { fn eq(&self, _other: &$t<T>) -> bool { true } ...
NoCopy
identifier_name
lib.rs
// too darn annoying to try and make them do so. #![cfg_attr(test, allow(dead_code))] extern crate ascii_canvas; extern crate atty; extern crate bit_set; extern crate diff; extern crate ena; extern crate itertools; extern crate lalrpop_util; extern crate petgraph; extern crate regex; extern crate regex_syntax; extern ...
// Need this for rusty_peg #![recursion_limit = "256"] // I hate this lint. #![allow(unused_parens)] // The builtin tests don't cover the CLI and so forth, and it's just
random_line_split
mod.rs
use chrono::{offset::Utc, DateTime}; use diesel::{self, pg::PgConnection}; use serde_json::Value; use sql_types::{FollowPolicy, Url}; pub mod follow_request; pub mod follower; pub mod group; pub mod persona; use self::follower::Follower; use schema::base_actors; use user::UserLike; #[derive(Debug, AsChangeset)] #[t...
} pub fn save_changes(self, conn: &PgConnection) -> Result<BaseActor, diesel::result::Error> { use diesel::prelude::*; diesel::update(base_actors::table) .set(&self) .get_result(conn) } } #[derive(Debug, Queryable, QueryableByName)] #[table_name = "base_actors"] pub ...
pub fn set_follow_policy(&mut self, follow_policy: FollowPolicy) { self.follow_policy = follow_policy;
random_line_split
mod.rs
use chrono::{offset::Utc, DateTime}; use diesel::{self, pg::PgConnection}; use serde_json::Value; use sql_types::{FollowPolicy, Url}; pub mod follow_request; pub mod follower; pub mod group; pub mod persona; use self::follower::Follower; use schema::base_actors; use user::UserLike; #[derive(Debug, AsChangeset)] #[t...
( &self, follows: &BaseActor, conn: &PgConnection, ) -> Result<bool, diesel::result::Error> { self.is_following_id(follows.id, conn) } pub fn is_following_id( &self, follows: i32, conn: &PgConnection, ) -> Result<bool, diesel::result::Error> { ...
is_following
identifier_name
mod.rs
use chrono::{offset::Utc, DateTime}; use diesel::{self, pg::PgConnection}; use serde_json::Value; use sql_types::{FollowPolicy, Url}; pub mod follow_request; pub mod follower; pub mod group; pub mod persona; use self::follower::Follower; use schema::base_actors; use user::UserLike; #[derive(Debug, AsChangeset)] #[t...
pub fn is_following( &self, follows: &BaseActor, conn: &PgConnection, ) -> Result<bool, diesel::result::Error> { self.is_following_id(follows.id, conn) } pub fn is_following_id( &self, follows: i32, conn: &PgConnection, ) -> Result<bool, die...
{ ModifiedBaseActor { id: self.id, display_name: self.display_name, profile_url: self.profile_url, inbox_url: self.inbox_url, outbox_url: self.outbox_url, follow_policy: self.follow_policy, original_json: self.original_json, ...
identifier_body
fix-shoff.rs
; radare script to fix elf.shoff ; author: pancake -- nopcode.org @ 2009 ; ; Usage example: ; cp /usr/bin/gedit gedit ; # TRASH ELF SHT PTR ; echo wx 99 @ 0x21 | radare -nw gedit ; # OBJDUMP/GDB/LTRACE/... CANNOT DO ANYTHING ; objdump -d gedit # objdump: gedit: File format not recognized ; # FIX ELF SHT PTR ; e...
? [1:$$+1] ?!.loop: s +4-$$%4 f nsht wv nsht @ 0x20 )
random_line_split
workspace.rs
use crate::config::{CrateDependency, CrateDependencyKind, CrateDependencySource}; use crate::database::{DatabaseCache, DatabaseClient, CRATE_DB_FILE_NAME}; use crate::download_db::download_db; use log::info; use ritual_common::errors::{bail, Result}; use ritual_common::file_utils::{ create_dir_all, load_json, os_st...
(&self, crate_name: &str) -> PathBuf { self.path.join("out").join(crate_name) } pub fn delete_database_if_exists(&mut self, crate_name: &str) -> Result<()> { let path = database_path(&self.path, crate_name); let mut cache = DatabaseCache::global().lock().unwrap(); cache.remove_i...
crate_path
identifier_name
workspace.rs
use crate::config::{CrateDependency, CrateDependencyKind, CrateDependencySource}; use crate::database::{DatabaseCache, DatabaseClient, CRATE_DB_FILE_NAME}; use crate::download_db::download_db; use log::info; use ritual_common::errors::{bail, Result}; use ritual_common::file_utils::{ create_dir_all, load_json, os_st...
.join("db") .join(format!("{}.json", crate_name)) } impl Workspace { pub fn new(path: PathBuf) -> Result<Self> { if!path.is_dir() { bail!("No such directory: {}", path.display()); } let config_path = config_path(&path); for &dir in &["tmp", "out", "log", "b...
fn database_path(workspace_path: &Path, crate_name: &str) -> PathBuf { workspace_path
random_line_split
workspace.rs
use crate::config::{CrateDependency, CrateDependencyKind, CrateDependencySource}; use crate::database::{DatabaseCache, DatabaseClient, CRATE_DB_FILE_NAME}; use crate::download_db::download_db; use log::info; use ritual_common::errors::{bail, Result}; use ritual_common::file_utils::{ create_dir_all, load_json, os_st...
let config_path = config_path(&path); for &dir in &["tmp", "out", "log", "backup", "db", "external_db"] { create_dir_all(path.join(dir))?; } let w = Workspace { path, config: if config_path.exists() { load_json(config_path)? ...
{ bail!("No such directory: {}", path.display()); }
conditional_block
trait-bounds-on-structs-and-enums.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() {}
blah
identifier_name
trait-bounds-on-structs-and-enums.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 ...
f: Box<T<X>+'static>, } impl<X: U> St<X> { fn blah() {} } fn main() {}
} struct St<X: U> {
random_line_split
main.rs
// normalize-stderr-32bit: "`&str` \(64 bits\)" -> "`&str` ($$STR bits)" // normalize-stderr-64bit: "`&str` \(128 bits\)" -> "`&str` ($$STR bits)" use std::mem::transmute; pub trait TypeConstructor<'a> { type T; } unsafe fn transmute_lifetime<'a, 'b, C>(x: <C as TypeConstructor<'a>>::T) ...
let x: Foo = transmute(10); //~ ERROR cannot transmute between types of different sizes } fn main() {}
union Foo { x: () } unsafe fn vary() {
random_line_split
main.rs
// normalize-stderr-32bit: "`&str` \(64 bits\)" -> "`&str` ($$STR bits)" // normalize-stderr-64bit: "`&str` \(128 bits\)" -> "`&str` ($$STR bits)" use std::mem::transmute; pub trait TypeConstructor<'a> { type T; } unsafe fn transmute_lifetime<'a, 'b, C>(x: <C as TypeConstructor<'a>>::T) ...
unsafe fn sizes() { let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types of different sizes } unsafe fn ptrs() { let x: u8 = transmute("test"); //~ ERROR cannot transmute between types of different sizes } union Foo { x: () } unsafe fn vary() { let x: Foo = transmute(10); //~ ERROR can...
{ transmute(x) //~ ERROR cannot transmute between types of different sizes }
identifier_body
main.rs
// normalize-stderr-32bit: "`&str` \(64 bits\)" -> "`&str` ($$STR bits)" // normalize-stderr-64bit: "`&str` \(128 bits\)" -> "`&str` ($$STR bits)" use std::mem::transmute; pub trait TypeConstructor<'a> { type T; } unsafe fn transmute_lifetime<'a, 'b, C>(x: <C as TypeConstructor<'a>>::T) ...
() {}
main
identifier_name
issue-83538-tainted-cache-after-cycle.rs
// Regression test for issue #83538. The problem here is that we have // two cycles: // // * `Ty` embeds `Box<Ty>` indirectly, which depends on `Global:'static`, which is OkModuloRegions. // * But `Ty` also references `First`, which has a cycle on itself. That should just be `Ok`. // // But our caching mechanism was bl...
} fn main() { // Key is that Vec<First> is "ok" and Third<'_, Ty> is "ok modulo regions": forward(); //~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>), [])) = Ok(EvaluatedToOk) //~| ERROR evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>), [])) ...
where Third<'a, Ty>: Unpin, Vec<First>: Unpin, {
random_line_split
issue-83538-tainted-cache-after-cycle.rs
// Regression test for issue #83538. The problem here is that we have // two cycles: // // * `Ty` embeds `Box<Ty>` indirectly, which depends on `Global:'static`, which is OkModuloRegions. // * But `Ty` also references `First`, which has a cycle on itself. That should just be `Ok`. // // But our caching mechanism was bl...
<'a, f> { g: Vec<(f, &'a f)>, } enum Ty { j(Fourth, Fifth, Sixth), } struct Fourth { o: Vec<Ty>, } struct Fifth { bounds: First, } struct Sixth { p: Box<Ty>, } #[rustc_evaluate_where_clauses] fn forward<'a>() where Vec<First>: Unpin, Third<'a, Ty>: Unpin, { } #[rustc_evaluate_where_cla...
Third
identifier_name
list.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("List", inherited=True) %> ${help...
{ CounterStyle(CounterStyleOrNone), String(String), } } impl ComputedValueAsSpecified for SpecifiedValue {} no_viewport_percentage!(SpecifiedValue); #[cfg(feature = "gecko")] impl SpecifiedValue { /// Convert from gecko k...
T
identifier_name
list.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" />
// TODO(pcwalton): Implement the full set of counter styles per CSS-COUNTER-STYLES [1] 6.1: // // decimal-leading-zero, armenian, upper-armenian, lower-armenian, georgian, lower-roman, // upper-roman // // TODO(bholley): Missing quite a few gecko properties here as well. // // In gecko, {upper,lower}-{roman,al...
<% data.new_style_struct("List", inherited=True) %> ${helpers.single_keyword("list-style-position", "outside inside", animation_value_type="discrete", spec="https://drafts.csswg.org/css-lists/#propdef-list-style-position")}
random_line_split
list.mako.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/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("List", inherited=True) %> ${help...
Ok(SpecifiedValue(quotes)) } else { Err(StyleParseError::UnspecifiedError.into()) } } </%helpers:longhand> ${helpers.predefined_type("-moz-image-region", "ClipRectOrAuto", "computed::ClipRectOrAuto::auto()", ...
{ if input.try(|input| input.expect_ident_matching("none")).is_ok() { return Ok(SpecifiedValue(Vec::new())) } let mut quotes = Vec::new(); loop { let first = match input.next() { Ok(&Token::QuotedString(ref value)) => value.as_ref().to_owned(), ...
identifier_body
mod.rs
// Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Parity is distributed in the hope that it will be useful, // but WITHO...
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity.
random_line_split
fn-trait-formatting.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 ...
needs_fn(1); //~^ ERROR `core::ops::Fn<(isize,)>` //~| ERROR `core::ops::Fn<(isize,)>` }
{ let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>; //~^ ERROR object-safe //~| ERROR mismatched types //~| expected `()` //~| found `Box<core::ops::FnOnce(isize)>` //~| expected () //~| found box let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>; //~^ ERROR mismat...
identifier_body
fn-trait-formatting.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 ...
//~| ERROR mismatched types //~| expected `()` //~| found `Box<core::ops::FnOnce(isize)>` //~| expected () //~| found box let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>; //~^ ERROR mismatched types //~| expected `()` //~| found `Box<core::ops::Fn(isize, isize)>` ...
random_line_split
fn-trait-formatting.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 _: () = (box |_: isize| {}) as Box<FnOnce(isize)>; //~^ ERROR object-safe //~| ERROR mismatched types //~| expected `()` //~| found `Box<core::ops::FnOnce(isize)>` //~| expected () //~| found box let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>; //~^ ERROR mis...
main
identifier_name
int_test.rs
// int_test.rs // // Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough // Copyright (C) 2016 G.vd.Schoot // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either versi...
gsl::test_rel(mean, expected, rel, "mean(fractional)"); } { let mean = mean(slice_a); let variance = variance_with_fixed_mean(slice_a, mean); let expected = 13.7; gsl::test_rel(variance, expected, rel, "variance_with_fixed_mean"); } { let mean = mean(sli...
{ // sample sets of integers let slice_1 = &[1, 2, 3, 4, 5, 6]; let slice_a = &[17, 18, 16, 18, 12, 20, 18, 20, 20, 22, 20, 10, 8, 12, 16, 16, 18, 20, 18, 21]; let slice_b = &[19, 20, 22, 24, 10, 25, 20, 22, 21, 23, 20, 10, 12, 14, 12, 20, 22, 24, 23, 17]; let rel = 1.0e-10; { let m...
identifier_body
int_test.rs
// int_test.rs // // Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough // Copyright (C) 2016 G.vd.Schoot // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either versi...
() { // sample sets of integers let slice_1 = &[1, 2, 3, 4, 5, 6]; let slice_a = &[17, 18, 16, 18, 12, 20, 18, 20, 20, 22, 20, 10, 8, 12, 16, 16, 18, 20, 18, 21]; let slice_b = &[19, 20, 22, 24, 10, 25, 20, 22, 21, 23, 20, 10, 12, 14, 12, 20, 22, 24, 23, 17]; let rel = 1.0e-10; { le...
test_i32_slice
identifier_name
int_test.rs
// int_test.rs // // Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Jim Davies, Brian Gough // Copyright (C) 2016 G.vd.Schoot // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either versi...
#[test] fn test_i32_slice() { // sample sets of integers let slice_1 = &[1, 2, 3, 4, 5, 6]; let slice_a = &[17, 18, 16, 18, 12, 20, 18, 20, 20, 22, 20, 10, 8, 12, 16, 16, 18, 20, 18, 21]; let slice_b = &[19, 20, 22, 24, 10, 25, 20, 22, 21, 23, 20, 10, 12, 14, 12, 20, 22, 24, 23, 17]; let rel = 1...
extern crate stat; use stat::*;
random_line_split
auth.rs
// Copyright 2017 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License, // version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which // licence you accepted on initial access to the Software (the "Licences"). // // By ...
} impl ReprC for AuthReq { type C = *const ffi::AuthReq; type Error = IpcError; /// Constructs the object from the FFI counterpart. /// /// After calling this function, the subobjects memory is owned by the /// resulting object. unsafe fn clone_from_repr_c(repr_c: *const ffi::AuthReq) -> ...
{ let AuthReq { app, app_container, containers, } = self; let containers = containers_into_vec(containers).map_err(StringError::from)?; let (containers_ptr, containers_len, containers_cap) = vec_into_raw_parts(containers); Ok(ffi::AuthReq { ...
identifier_body
auth.rs
// Copyright 2017 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License, // version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which // licence you accepted on initial access to the Software (the "Licences"). // // By ...
/// Represents an authorization request #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct AuthReq { /// The application identifier for this request pub app: AppExchangeInfo, /// `true` if the app wants dedicated container for itself. `false` /// otherwise. pub app_container:...
use ffi::ipc::req as ffi; use ffi_utils::{ReprC, StringError, vec_into_raw_parts}; use ipc::errors::IpcError; use std::collections::HashMap;
random_line_split
auth.rs
// Copyright 2017 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License, // version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which // licence you accepted on initial access to the Software (the "Licences"). // // By ...
{ /// The application identifier for this request pub app: AppExchangeInfo, /// `true` if the app wants dedicated container for itself. `false` /// otherwise. pub app_container: bool, /// The list of containers it wishes to access (and desired permissions). pub containers: HashMap<String, C...
AuthReq
identifier_name
mod.rs
pub mod pic; pub mod pit; pub mod port_io; use driver::vga; use core::fmt::Write; use driver::vga::Writer; pub fn pic_init() { unsafe { //start the initialisation of the PICs port_io::outb(pic::PIC_MASTER_COMMAND, pic::ICW1_INIT | pic::ICW1_ICW4); port_io::wait(); port_io::outb(pic...
port_io::wait(); //provide additional environment information port_io::outb(pic::PIC_MASTER_DATA, pic::ICW4_8086); //operate in 8086 mode port_io::wait(); port_io::outb(pic::PIC_SLAVE_DATA, pic::ICW4_8086); //operate in 8086 mode port_io::wait(); //mask all inte...
//provide slave/master relationship information port_io::outb(pic::PIC_MASTER_DATA, 4); //inform MASTER there is a SLAVE at IRQ2 port_io::wait(); port_io::outb(pic::PIC_SLAVE_DATA, 2); //inform SLAVE it is a cascade identity
random_line_split
mod.rs
pub mod pic; pub mod pit; pub mod port_io; use driver::vga; use core::fmt::Write; use driver::vga::Writer; pub fn
() { unsafe { //start the initialisation of the PICs port_io::outb(pic::PIC_MASTER_COMMAND, pic::ICW1_INIT | pic::ICW1_ICW4); port_io::wait(); port_io::outb(pic::PIC_SLAVE_COMMAND, pic::ICW1_INIT | pic::ICW1_ICW4); port_io::wait(); //provide the PIC vector offsets ...
pic_init
identifier_name
mod.rs
pub mod pic; pub mod pit; pub mod port_io; use driver::vga; use core::fmt::Write; use driver::vga::Writer; pub fn pic_init() { unsafe { //start the initialisation of the PICs port_io::outb(pic::PIC_MASTER_COMMAND, pic::ICW1_INIT | pic::ICW1_ICW4); port_io::wait(); port_io::outb(pic...
{ pit::set_phase(hz); vga::okay(); write!(Writer::new(), "Initialised the PIT, at a phase of {:#} Hz\n", hz) .expect("Unexpected failure in write!()"); }
identifier_body
server.rs
#![feature(core)] #![feature(path_ext)] extern crate eve; extern crate getopts; extern crate url; extern crate core; use std::thread; use std::env; use std::fs::PathExt; use getopts::Options; use std::net::SocketAddr; use core::str::FromStr; use eve::server; use eve::static_server; #[allow(dead_code)] fn main()
return; } // parse static file server address let default_addr = SocketAddr::from_str("0.0.0.0:8080").unwrap(); let addr = match matches.opt_str("f") { Some(ip) => { match SocketAddr::from_str(&*ip) { Ok(addr) => addr, Err(_) => { println!("WARNING: Could not parse static file...
{ // handle command line arguments let args: Vec<String> = env::args().collect(); // define the command line arguments let mut opts = Options::new(); opts.optopt("f", "file-server-address", "specify a socket address for the static file server. Defaults to 0.0.0.0:8080","SOCKET ADDRESS"); opts.optopt("s", ...
identifier_body
server.rs
#![feature(core)] #![feature(path_ext)] extern crate eve; extern crate getopts; extern crate url; extern crate core; use std::thread; use std::env; use std::fs::PathExt; use getopts::Options; use std::net::SocketAddr; use core::str::FromStr; use eve::server; use eve::static_server; #[allow(dead_code)] fn
() { // handle command line arguments let args: Vec<String> = env::args().collect(); // define the command line arguments let mut opts = Options::new(); opts.optopt("f", "file-server-address", "specify a socket address for the static file server. Defaults to 0.0.0.0:8080","SOCKET ADDRESS"); opts.optopt("s...
main
identifier_name
server.rs
#![feature(core)] #![feature(path_ext)] extern crate eve; extern crate getopts; extern crate url; extern crate core; use std::thread; use std::env; use std::fs::PathExt; use getopts::Options; use std::net::SocketAddr; use core::str::FromStr; use eve::server; use eve::static_server; #[allow(dead_code)] fn main() { ...
// parse static file server address let default_addr = SocketAddr::from_str("0.0.0.0:8080").unwrap(); let addr = match matches.opt_str("f") { Some(ip) => { match SocketAddr::from_str(&*ip) { Ok(addr) => addr, Err(_) => { println!("WARNING: Could not parse static file server address.\nDefau...
print!("{}", opts.usage("")); return; }
random_line_split
server.rs
#![feature(core)] #![feature(path_ext)] extern crate eve; extern crate getopts; extern crate url; extern crate core; use std::thread; use std::env; use std::fs::PathExt; use getopts::Options; use std::net::SocketAddr; use core::str::FromStr; use eve::server; use eve::static_server; #[allow(dead_code)] fn main() { ...
// parse static file server address let default_addr = SocketAddr::from_str("0.0.0.0:8080").unwrap(); let addr = match matches.opt_str("f") { Some(ip) => { match SocketAddr::from_str(&*ip) { Ok(addr) => addr, Err(_) => { println!("WARNING: Could not parse static file server address.\nDef...
{ print!("{}", opts.usage("")); return; }
conditional_block
lib.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. #[allow(unused_extern_crates)] extern crate tikv_alloc; mod client; mod feature_gate; pub mod metrics; mod util; mod config; pub mod errors; pub use self::client::{DummyPdClient, RpcClient}; pub use self::config::Config; pub use self::errors::{Error, ...
/// Gets Region by Region id. fn get_region_by_id(&self, _region_id: u64) -> PdFuture<Option<metapb::Region>> { unimplemented!(); } /// Gets Region and its leader by Region id. fn get_region_leader_by_id( &self, _region_id: u64, ) -> PdFuture<Option<(metapb::Region, me...
{ unimplemented!(); }
identifier_body
lib.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. #[allow(unused_extern_crates)] extern crate tikv_alloc; mod client; mod feature_gate; pub mod metrics; mod util; mod config; pub mod errors; pub use self::client::{DummyPdClient, RpcClient}; pub use self::config::Config; pub use self::errors::{Error, ...
else { store.take_address() } }
{ store.take_peer_address() }
conditional_block
lib.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. #[allow(unused_extern_crates)] extern crate tikv_alloc; mod client; mod feature_gate; pub mod metrics; mod util; mod config; pub mod errors; pub use self::client::{DummyPdClient, RpcClient}; pub use self::config::Config; pub use self::errors::{Error, ...
/// Registers a handler to the client, which will be invoked after reconnecting to PD. /// /// Please note that this method should only be called once. fn handle_reconnect<F: Fn() + Sync + Send +'static>(&self, _: F) where Self: Sized, { } fn get_gc_safe_point(&self) -> PdFutur...
random_line_split
lib.rs
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0. #[allow(unused_extern_crates)] extern crate tikv_alloc; mod client; mod feature_gate; pub mod metrics; mod util; mod config; pub mod errors; pub use self::client::{DummyPdClient, RpcClient}; pub use self::config::Config; pub use self::errors::{Error, ...
(&self) -> Result<u64> { unimplemented!(); } /// Creates the cluster with cluster ID, node, stores and first Region. /// If the cluster is already bootstrapped, return ClusterBootstrapped error. /// When a node starts, if it finds nothing in the node and /// cluster is not bootstrapped, it ...
get_cluster_id
identifier_name
distinct_on.rs
use crate::expression::SelectableExpression; use crate::pg::Pg; use crate::query_builder::order_clause::{NoOrderClause, OrderClause}; use crate::query_builder::{AstPass, QueryFragment, QueryId, SelectQuery, SelectStatement}; use crate::query_dsl::methods::DistinctOnDsl; use crate::query_dsl::order_dsl::ValidOrderingFor...
} } impl<ST, F, S, D, W, O, LOf, G, Selection> DistinctOnDsl<Selection> for SelectStatement<F, S, D, W, O, LOf, G> where Selection: SelectableExpression<F>, Selection::SqlType: SingleValue, Self: SelectQuery<SqlType = ST>, O: ValidOrderingForDistinct<DistinctOnClause<Selection>>, SelectStat...
self.0.walk_ast(out.reborrow())?; out.push_sql(")"); Ok(())
random_line_split
distinct_on.rs
use crate::expression::SelectableExpression; use crate::pg::Pg; use crate::query_builder::order_clause::{NoOrderClause, OrderClause}; use crate::query_builder::{AstPass, QueryFragment, QueryId, SelectQuery, SelectStatement}; use crate::query_dsl::methods::DistinctOnDsl; use crate::query_dsl::order_dsl::ValidOrderingFor...
(self, selection: Selection) -> Self::Output { SelectStatement::new( self.select, self.from, DistinctOnClause(selection), self.where_clause, self.order, self.limit_offset, self.group_by, self.locking, ) }...
distinct_on
identifier_name
lib.rs
extern crate regex; extern crate fall_tree; extern crate fall_parse; mod fall; mod ast_ext; pub use self::fall::language as lang_fall; pub use self::fall::{ ERROR, WHITESPACE, EOL_COMMENT, NODE, CLASS, TOKENIZER, RULE, VERBATIM, AST, PUB, TEST, EQ, PIPE, STAR, ...
TRAIT, AST_TRAIT_DEF, }; pub use self::fall::{ FallFile, TokenizerDef, LexRule, SynRule, Parameters, Parameter, Attributes, Attribute, AttributeValue, VerbatimDef, AstDef, AstNodeDef, AstClassDef, AstTraitDef, MethodDef, AstSelector, TestDef, ...
AST_NODE_DEF, AST_CLASS_DEF, METHOD_DEF, AST_SELECTOR,
random_line_split
toolbox.rs
// +--------------------------------------------------------------------------+ // | Copyright 2016 Matthew D. Steele <mdsteele@alum.mit.edu> | // | | // | This file is part of Tuna. | ...
&Event::KeyDown(key, kmod) => { if key == self.key && kmod == NONE { *tool = self.tool; return Action::redraw().and_stop(); } } _ => {} } Action::ignore() } } //=============================...
{ *tool = self.tool; return Action::redraw().and_stop(); }
conditional_block
toolbox.rs
// +--------------------------------------------------------------------------+ // | Copyright 2016 Matthew D. Steele <mdsteele@alum.mit.edu> | // | | // | This file is part of Tuna. | ...
{ tool: Tool, key: Keycode, icon: ToolIcon, } impl ToolPicker { fn new(tool: Tool, key: Keycode) -> ToolPicker { let icon = match tool { Tool::Checkerboard => ToolIcon::Checkerboard, Tool::Eyedropper => ToolIcon::Eyedropper, Tool::Lasso => ToolIcon::Lasso, ...
ToolPicker
identifier_name
toolbox.rs
// +--------------------------------------------------------------------------+ // | Copyright 2016 Matthew D. Steele <mdsteele@alum.mit.edu> | // | | // | This file is part of Tuna. | ...
} } fn picker( x: i32, y: i32, tool: Tool, key: Keycode, ) -> Box<dyn GuiElement<Tool, ()>> { Box::new(SubrectElement::new( ToolPicker::new(tool, key), Rect::new(x, y, 20, 20), )) } } impl GuiElement<EditorState, ()> for ...
{ let elements: Vec<Box<dyn GuiElement<Tool, ()>>> = vec![ Toolbox::picker(2, 2, Tool::Pencil, Keycode::P), Toolbox::picker(26, 2, Tool::PaintBucket, Keycode::K), Toolbox::picker(50, 2, Tool::PaletteReplace, Keycode::V), Toolbox::picker(2, 26, Tool::Watercolor, Ke...
identifier_body
toolbox.rs
// +--------------------------------------------------------------------------+ // | Copyright 2016 Matthew D. Steele <mdsteele@alum.mit.edu> | // | | // | This file is part of Tuna. | ...
return Action::redraw().and_stop(); } } _ => {} } Action::ignore() } } //===========================================================================//
return Action::redraw().and_stop(); } &Event::KeyDown(key, kmod) => { if key == self.key && kmod == NONE { *tool = self.tool;
random_line_split
lib.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/. */ #![feature(alloc)] #![feature(box_syntax)] #![feature(core_intrinsics)] #![feature(custom_derive)] #![feature(fnbo...
// Workaround for lack of `ptr_eq` on Arcs... #[inline] pub fn arc_ptr_eq<T:'static + Send + Sync>(a: &Arc<T>, b: &Arc<T>) -> bool { let a: &T = &**a; let b: &T = &**b; (a as *const T) == (b as *const T) }
pub fn breakpoint() { unsafe { ::std::intrinsics::breakpoint() }; }
random_line_split
lib.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/. */ #![feature(alloc)] #![feature(box_syntax)] #![feature(core_intrinsics)] #![feature(custom_derive)] #![feature(fnbo...
() { unsafe { ::std::intrinsics::breakpoint() }; } // Workaround for lack of `ptr_eq` on Arcs... #[inline] pub fn arc_ptr_eq<T:'static + Send + Sync>(a: &Arc<T>, b: &Arc<T>) -> bool { let a: &T = &**a; let b: &T = &**b; (a as *const T) == (b as *const T) }
breakpoint
identifier_name
lib.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/. */ #![feature(alloc)] #![feature(box_syntax)] #![feature(core_intrinsics)] #![feature(custom_derive)] #![feature(fnbo...
// Workaround for lack of `ptr_eq` on Arcs... #[inline] pub fn arc_ptr_eq<T:'static + Send + Sync>(a: &Arc<T>, b: &Arc<T>) -> bool { let a: &T = &**a; let b: &T = &**b; (a as *const T) == (b as *const T) }
{ unsafe { ::std::intrinsics::breakpoint() }; }
identifier_body
rustkernel.rs
/* * Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 is free software: you can redistribute it and/or modify * it under the terms of the GNU Genera...
mod syscalls; mod tests; mod workloop;
mod cap; mod com; mod mem; mod pes; mod platform;
random_line_split
grids.rs
/* Copyright 2017-2019 the Conwayste Developers. * * This file is part of libconway. * * libconway is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your op...
} let run_last_col = col + rle_len - 1; if let Some(_last_col) = last_col { if _last_col < run_last_col { last_col = Some(run_last_col); } } else { ...
{ let (width, height) = (self.width(), self.height()); let mut first_row = None; let mut last_row = None; let mut first_col = None; let mut last_col = None; for row in 0..height { let mut col = 0; while col < width { let (rle_len, c...
identifier_body
grids.rs
/* Copyright 2017-2019 the Conwayste Developers. * * This file is part of libconway. * * libconway is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your op...
else { 0 } } #[inline] pub fn modify_bits_in_word(&mut self, row: usize, word_col: usize, mask: u64, op: BitOperation) { match op { BitOperation::Set => self[row][word_col] |= mask, BitOperation::Clear => self[row][word_col] &=!mask, Bit...
{ self.0[0].len() }
conditional_block
grids.rs
/* Copyright 2017-2019 the Conwayste Developers. * * This file is part of libconway. * * libconway is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your op...
(result: &mut String, output_col: &mut usize, rle_len: usize, ch: char) { let what_to_add = if rle_len == 1 { let mut s = String::with_capacity(1); s.push(ch); s } else { format!("{}{}", rle_len, ch) }; if *output_col + what_to_add.len(...
push
identifier_name
grids.rs
/* Copyright 2017-2019 the Conwayste Developers. * * This file is part of libconway. * * libconway is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your op...
} push(&mut result, &mut output_col, 1, '!'); Pattern(result) } /// Given a starting cell at `(col, row)`, get the character at that cell, and the number of /// contiguous identical cells considering only this cell and the cells to the right of it. /// This is intended for expor...
} row += 1; col = 0; line_ends_buffered += 1;
random_line_split
int.rs
use arch::int; pub fn mask_interrupt(i: u32, mask: bool) { int::mask_interrupt(i, mask); } pub fn set_int(i: u32, idt_idx: u32) { int::set_int(i, idt_idx); } pub fn fire_timer() { int::fire_timer(); } pub fn enable_interrupts() { int::enable_interrupts(); } pub fn disable_interrupts() { int::di...
loop{}; }, _ => { //println!("OTHER INTERRUPT {}", ctx.int_id); //loop{}; } } }
disable_interrupts(); loop{} } 14 => { println!("PAGE FAULT 0x{:x}, addr: 0x{:x}", error_code, retaddr);
random_line_split
int.rs
use arch::int; pub fn mask_interrupt(i: u32, mask: bool) { int::mask_interrupt(i, mask); } pub fn set_int(i: u32, idt_idx: u32) { int::set_int(i, idt_idx); } pub fn fire_timer()
pub fn enable_interrupts() { int::enable_interrupts(); } pub fn disable_interrupts() { int::disable_interrupts(); } pub fn interrupt_handler(int_id: u32, error_code: u32, retaddr: usize) { match int_id { 80 => { println!("[ TASK ] System call from user space"); } 81 ...
{ int::fire_timer(); }
identifier_body
int.rs
use arch::int; pub fn mask_interrupt(i: u32, mask: bool) { int::mask_interrupt(i, mask); } pub fn set_int(i: u32, idt_idx: u32) { int::set_int(i, idt_idx); } pub fn fire_timer() { int::fire_timer(); } pub fn enable_interrupts() { int::enable_interrupts(); } pub fn disable_interrupts() { int::di...
} }
{ //println!("OTHER INTERRUPT {}", ctx.int_id); //loop{}; }
conditional_block
int.rs
use arch::int; pub fn mask_interrupt(i: u32, mask: bool) { int::mask_interrupt(i, mask); } pub fn set_int(i: u32, idt_idx: u32) { int::set_int(i, idt_idx); } pub fn fire_timer() { int::fire_timer(); } pub fn enable_interrupts() { int::enable_interrupts(); } pub fn
() { int::disable_interrupts(); } pub fn interrupt_handler(int_id: u32, error_code: u32, retaddr: usize) { match int_id { 80 => { println!("[ TASK ] System call from user space"); } 81 => { println!("[ OK ] Interrupt test passes"); }, 33 => prin...
disable_interrupts
identifier_name