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
type_of.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...
Type::vec(cx, &Type::i8(cx)).ptr_to() } ty::ty_enum(did, ref substs) => { // Only create the named struct, but don't fill it in. We // fill it in *after* placing it into the type cache. This // avoids creating more than one copy of the enum when one // of the enum's v...
ty::ty_float(t) => Type::float_from_ty(cx, t), ty::ty_str(ty::VstoreUniq) => {
random_line_split
monad.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 ...
assert!((~[~"hi"]) .bind(|x| ~[x.clone(), *x + ~"!"] ) .bind(|x| ~[x.clone(), *x + ~"?"] ) == ~[~"hi", ~"hi?", ~"hi!", ~"hi!?"]); }
} pub fn main() { assert_eq!(transform(Some(10)), Some(~"11")); assert_eq!(transform(None), None);
random_line_split
monad.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 ...
<B>(&self, f: &fn(&A) -> Option<B>) -> Option<B> { match *self { Some(ref a) => { f(a) } None => { None } } } } fn transform(x: Option<int>) -> Option<~str> { x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::to_str(*n)) ) } pub fn main() { assert_eq!(transform(Some(10))...
bind
identifier_name
monad.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 transform(x: Option<int>) -> Option<~str> { x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::to_str(*n)) ) } pub fn main() { assert_eq!(transform(Some(10)), Some(~"11")); assert_eq!(transform(None), None); assert!((~[~"hi"]) .bind(|x| ~[x.clone(), *x + ~"!"] ) .bind(|x| ~[x.clone(), *x...
{ match *self { Some(ref a) => { f(a) } None => { None } } }
identifier_body
test.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
} pub struct Collector { priv tests: ~[test::TestDescAndFn], priv names: ~[~str], priv libs: @RefCell<HashSet<Path>>, priv cnt: uint, priv cratename: ~str, } impl Collector { pub fn add_test(&mut self, test: &str, ignore: bool, should_fail: bool) { let test = test.to_owned(); ...
{ let mut prog = ~r" #[deny(warnings)]; #[allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)]; "; if s.contains("extra") { prog.push_str("extern mod extra;\n"); } if s.contains(cratename) { prog.push_str(format!("extern mod {};\n", cratename)); } if s...
identifier_body
test.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
}
return ret; }
random_line_split
test.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(test: &str, cratename: &str, libs: HashSet<Path>) { let test = maketest(test, cratename); let parsesess = parse::new_parse_sess(None); let input = driver::str_input(test); let sessopts = @session::options { binary: ~"rustdoctest", maybe_sysroot: Some(@os::self_exe_path().unwrap().dir_p...
runtest
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(box_syntax)] #![feature(fnbox)] #![feature(mpsc_select)] #![feature(plugin)] #![feature(plugin)] #![plu...
#[macro_use] extern crate mime; extern crate mime_guess; extern crate msg; extern crate net_traits; extern crate openssl; extern crate rustc_serialize; extern crate threadpool; extern crate time; #[cfg(any(target_os = "macos", target_os = "linux"))] extern crate tinyfiledialogs; extern crate unicase; extern crate url; ...
extern crate ipc_channel; #[macro_use] extern crate log;
random_line_split
reaction.rs
use chrono::{offset::Utc, DateTime}; use diesel::{self, pg::PgConnection}; use super::Comment; use schema::reactions; use sql_types::ReactionType; #[derive(Debug, Identifiable, Queryable, QueryableByName)] #[table_name = "reactions"] pub struct Reaction { id: i32, reaction_type: ReactionType, comment_id: ...
pub fn reaction_type(&self) -> ReactionType { self.reaction_type } pub fn comment_id(&self) -> i32 { self.comment_id } } #[derive(Insertable)] #[table_name = "reactions"] pub struct NewReaction { reaction_type: ReactionType, comment_id: i32, } impl NewReaction { pub fn i...
{ self.id }
identifier_body
reaction.rs
use chrono::{offset::Utc, DateTime}; use diesel::{self, pg::PgConnection}; use super::Comment; use schema::reactions; use sql_types::ReactionType; #[derive(Debug, Identifiable, Queryable, QueryableByName)] #[table_name = "reactions"] pub struct Reaction { id: i32, reaction_type: ReactionType, comment_id: ...
{ reaction_type: ReactionType, comment_id: i32, } impl NewReaction { pub fn insert(self, conn: &PgConnection) -> Result<Reaction, diesel::result::Error> { use diesel::prelude::*; diesel::insert_into(reactions::table) .values(&self) .get_result(conn) } pub fn...
NewReaction
identifier_name
reaction.rs
use chrono::{offset::Utc, DateTime}; use diesel::{self, pg::PgConnection}; use super::Comment; use schema::reactions; use sql_types::ReactionType; #[derive(Debug, Identifiable, Queryable, QueryableByName)] #[table_name = "reactions"] pub struct Reaction { id: i32, reaction_type: ReactionType, comment_id: ...
use test_helper::*; #[test] fn create_reaction() { with_connection(|conn| { make_post(conn, |conversation_post| { make_post(conn, |comment_post| { with_comment( conn, &conversation_post, ...
#[cfg(test)] mod tests {
random_line_split
effects.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/. */ //! Generic types for CSS values related to effects. #[cfg(feature = "gecko")] use values::specified::url::Specif...
/// `grayscale(<factor>)` #[css(function)] Grayscale(Factor), /// `hue-rotate(<angle>)` #[css(function)] HueRotate(Angle), /// `invert(<factor>)` #[css(function)] Invert(Factor), /// `opacity(<factor>)` #[css(function)] Opacity(Factor), /// `saturate(<factor>)` #[...
#[css(function)] Brightness(Factor), /// `contrast(<factor>)` #[css(function)] Contrast(Factor),
random_line_split
effects.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/. */ //! Generic types for CSS values related to effects. #[cfg(feature = "gecko")] use values::specified::url::Specif...
<Color, SizeLength, ShapeLength> { /// Color. pub color: Color, /// Horizontal radius. pub horizontal: SizeLength, /// Vertical radius. pub vertical: SizeLength, /// Blur radius. pub blur: ShapeLength, }
SimpleShadow
identifier_name
dependency.rs
use semver::VersionReq; use core::{SourceId, Summary, PackageId}; use util::CargoResult; /// Informations about a dependency requested by a Cargo manifest. #[derive(PartialEq,Clone,Debug)] pub struct Dependency { name: String, source_id: SourceId, req: VersionReq, specified_req: Option<String>, ki...
(mut self, kind: Kind) -> Dependency { self.kind = kind; self } /// Sets the list of features requested for the package. pub fn set_features(mut self, features: Vec<String>) -> Dependency { self.features = features; self } /// Sets whether the dependency requests de...
set_kind
identifier_name
dependency.rs
use semver::VersionReq; use core::{SourceId, Summary, PackageId}; use util::CargoResult; /// Informations about a dependency requested by a Cargo manifest. #[derive(PartialEq,Clone,Debug)] pub struct Dependency { name: String, source_id: SourceId, req: VersionReq, specified_req: Option<String>, ki...
pub fn kind(&self) -> Kind { self.kind } pub fn specified_req(&self) -> Option<&str> { self.specified_req.as_ref().map(|s| s.as_slice()) } /// If none, this dependencies must be built for all platforms. /// If some, it must only be built for the specified platform. pub fn only_for_plat...
{ &self.source_id }
identifier_body
dependency.rs
use semver::VersionReq; use core::{SourceId, Summary, PackageId}; use util::CargoResult; /// Informations about a dependency requested by a Cargo manifest. #[derive(PartialEq,Clone,Debug)] pub struct Dependency { name: String, source_id: SourceId, req: VersionReq, specified_req: Option<String>, ki...
} impl SerializedDependency { pub fn from_dependency(dep: &Dependency) -> SerializedDependency { SerializedDependency { name: dep.name().to_string(), req: dep.version_req().to_string() } } }
req: String
random_line_split
lib.rs
//! A sample implementation of `multiprocessing.pool.ThreadPool` from Python in //! Rust. //! //! Only a single method is implemented (`imap()`). The implementation of other //! methods is straightforward and is left to the reader. extern crate num_cpus; extern crate threadpool; use std::collections::BTreeMap; use st...
#[test] fn with_workers_creates_pool_with_given_number_of_workers() { let pool = ThreadPool::with_workers(4); assert_eq!(pool.worker_count(), 4); } #[test] fn imap_returns_results_in_correct_order() { let pool = ThreadPool::new(); let mut results = Vec::new(); ...
{ let pool = ThreadPool::new(); assert_eq!(pool.worker_count(), num_cpus::get()); }
identifier_body
lib.rs
//! A sample implementation of `multiprocessing.pool.ThreadPool` from Python in //! Rust. //! //! Only a single method is implemented (`imap()`). The implementation of other //! methods is straightforward and is left to the reader. extern crate num_cpus; extern crate threadpool; use std::collections::BTreeMap; use st...
/// Internal representation of the thread pool. pool: threadpool::ThreadPool, } impl ThreadPool { /// Creates a new thread pool, where the number of worker threads is /// detected automatically based on the number of available CPUs in the /// system. pub fn new() -> Self { let worker_co...
use std::sync::mpsc; /// A thread pool with an interface similar to that of /// `multiprocessing.pool.ThreadPool` from Python. pub struct ThreadPool {
random_line_split
lib.rs
//! A sample implementation of `multiprocessing.pool.ThreadPool` from Python in //! Rust. //! //! Only a single method is implemented (`imap()`). The implementation of other //! methods is straightforward and is left to the reader. extern crate num_cpus; extern crate threadpool; use std::collections::BTreeMap; use st...
() { let pool = ThreadPool::new(); let results = pool.imap(|n| n * 2, vec![1_000; 0]); ::std::mem::drop(pool); // There is no assertion. We just want to check that we do not panic // when the pool is destroyed before we consume the result from imap(). results.collect::<...
does_not_panic_when_pool_is_destroyed_before_imap_is_consumed
identifier_name
composite_shape_repr.rs
use na; use na::Translate; use math::{Scalar, Point, Vect, Isometry}; use utils::data::hash_map::HashMap; use utils::data::hash::UintTWHash; use entities::bounding_volume::{self, BoundingVolume}; use entities::partitioning::BoundingVolumeInterferencesCollector; use entities::shape::CompositeShape; use entities::inspect...
<P: Point, M> { sub_detector: CompositeShapeRepr<P, M> } impl<P: Point, M> ReprCompositeShape<P, M> { /// Creates a new collision detector between a shape and a concave shape. pub fn new(prediction: <P::Vect as Vect>::Scalar) -> ReprCompositeShape<P, M> { ReprCompositeShape { sub_detect...
ReprCompositeShape
identifier_name
composite_shape_repr.rs
use na; use na::Translate; use math::{Scalar, Point, Vect, Isometry}; use utils::data::hash_map::HashMap; use utils::data::hash::UintTWHash; use entities::bounding_volume::{self, BoundingVolume}; use entities::partitioning::BoundingVolumeInterferencesCollector; use entities::shape::CompositeShape; use entities::inspect...
d: &CollisionDispatcher<P, M>, ma: &M, a: &Repr<P, M>, mb: &M, b: &Repr<P, M>) -> bool { if let Some(cs) = inspection::maybe_as_composite_shape(b) { self.sub_detector.do_update(d, mb, cs, ma, a, true); ...
random_line_split
composite_shape_repr.rs
use na; use na::Translate; use math::{Scalar, Point, Vect, Isometry}; use utils::data::hash_map::HashMap; use utils::data::hash::UintTWHash; use entities::bounding_volume::{self, BoundingVolume}; use entities::partitioning::BoundingVolumeInterferencesCollector; use entities::shape::CompositeShape; use entities::inspect...
}
{ self.sub_detector.colls(out) }
identifier_body
composite_shape_repr.rs
use na; use na::Translate; use math::{Scalar, Point, Vect, Isometry}; use utils::data::hash_map::HashMap; use utils::data::hash::UintTWHash; use entities::bounding_volume::{self, BoundingVolume}; use entities::partitioning::BoundingVolumeInterferencesCollector; use entities::shape::CompositeShape; use entities::inspect...
} // Remove outdated sub detectors for i in self.to_delete.iter() { self.sub_detectors.remove(i); } self.to_delete.clear(); } } /// Collision detector between a shape and a concave shape. pub struct ReprCompositeShape<P: Point, M> { sub_detector: Composite...
{ // FIXME: ask the detector if it wants to be removed or not self.to_delete.push(key); }
conditional_block
bytes.rs
use std::net::Ipv4Addr; use byteorder::{ByteOrder, NativeEndian, NetworkEndian}; pub trait BytesAble { fn as_bytes(&self) -> Vec<u8>; #[inline] fn write_bytes(&self, dst: &mut [u8]) { dst.copy_from_slice(&self.as_bytes()); } } pub trait BytesAbleNum { fn as_bytes_be(&self) -> Vec<u8>; ...
} impl BytesAble for Ipv4Addr { #[inline] fn as_bytes(&self) -> Vec<u8> { self.octets().to_vec() } } impl BytesAble for String { #[inline] fn as_bytes(&self) -> Vec<u8> { self.as_bytes().to_vec() } } macro_rules! impl_bytes_able_for_num_type { ($ty:ty, $size:expr) => { ...
{ dst.copy_from_slice(&self.as_bytes_le()); }
identifier_body
bytes.rs
use std::net::Ipv4Addr; use byteorder::{ByteOrder, NativeEndian, NetworkEndian}; pub trait BytesAble { fn as_bytes(&self) -> Vec<u8>; #[inline] fn write_bytes(&self, dst: &mut [u8]) { dst.copy_from_slice(&self.as_bytes()); } } pub trait BytesAbleNum { fn as_bytes_be(&self) -> Vec<u8>; ...
impl_bytes_able_for_num_type!(u64, 8); impl_bytes_able_for_num_type!(u32, 4); impl_bytes_able_for_num_type!(u16, 2);
}
random_line_split
bytes.rs
use std::net::Ipv4Addr; use byteorder::{ByteOrder, NativeEndian, NetworkEndian}; pub trait BytesAble { fn as_bytes(&self) -> Vec<u8>; #[inline] fn
(&self, dst: &mut [u8]) { dst.copy_from_slice(&self.as_bytes()); } } pub trait BytesAbleNum { fn as_bytes_be(&self) -> Vec<u8>; fn as_bytes_le(&self) -> Vec<u8>; #[inline] fn write_bytes_be(&self, dst: &mut [u8]) { dst.copy_from_slice(&self.as_bytes_be()); } #[inline] ...
write_bytes
identifier_name
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
<T:'static>(self) -> Option<&'a mut T> { self.downcast_mut::<T>() } } #[stable] impl<'a> AnyMutRefExt<'a> for &'a mut Any+'a { #[inline] #[unstable = "naming conventions around acquiring references may change"] fn downcast_mut<T:'static>(self) -> Option<&'a mut T> { if self.is::<T>() { ...
as_mut
identifier_name
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
}
{ if self.is::<T>() { unsafe { // Get the raw representation of the trait object let to: TraitObject = transmute_copy(&self); // Extract the data pointer Some(transmute(to.data)) } } else { None ...
identifier_body
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} } /// Extension methods for a mutable referenced `Any` trait object #[unstable = "this trait will not be necessary once DST lands, it will be a \ part of `impl Any`"] pub trait AnyMutRefExt<'a> { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if i...
{ None }
conditional_block
any.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#[unstable = "naming conventions around acquiring references may change"] fn downcast_mut<T:'static>(self) -> Option<&'a mut T>; /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't. #[deprecated = "this function has been renamed to `downcast_mut`"] ...
part of `impl Any`"] pub trait AnyMutRefExt<'a> { /// Returns some mutable reference to the boxed value if it is of type `T`, or /// `None` if it isn't.
random_line_split
unop-move-semantics.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 use_imm<T>(_: &T) { }
{ }
identifier_body
unop-move-semantics.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 ...
!*m; //~ ERROR: cannot move out of borrowed content !*n; //~ ERROR: cannot move out of borrowed content use_imm(n); use_mut(m); } fn main() {} fn use_mut<T>(_: &mut T) { } fn use_imm<T>(_: &T) { }
random_line_split
unop-move-semantics.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T>(_: &T) { }
use_imm
identifier_name
signal-exit-status.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 ...
match status { ExitSignal(_) if cfg!(unix) => {}, ExitStatus(0xC0000028) if cfg!(windows) => {}, _ => fail!("invalid termination (was not signalled): {:?}", status) } } }
random_line_split
signal-exit-status.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 args = os::args(); let args = args.as_slice(); if args.len() >= 2 && args[1].as_slice() == "signal" { // Raise a segfault. unsafe { *(0 as *mut int) = 0; } } else { let status = Command::new(args[0].as_slice()).arg("signal").status().unwrap(); // Windows does not ha...
identifier_body
signal-exit-status.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 ...
else { let status = Command::new(args[0].as_slice()).arg("signal").status().unwrap(); // Windows does not have signal, so we get exit status 0xC0000028 (STATUS_BAD_STACK). match status { ExitSignal(_) if cfg!(unix) => {}, ExitStatus(0xC0000028) if cfg!(windows) => {}, ...
{ // Raise a segfault. unsafe { *(0 as *mut int) = 0; } }
conditional_block
signal-exit-status.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 args = os::args(); let args = args.as_slice(); if args.len() >= 2 && args[1].as_slice() == "signal" { // Raise a segfault. unsafe { *(0 as *mut int) = 0; } } else { let status = Command::new(args[0].as_slice()).arg("signal").status().unwrap(); // Windows does not...
main
identifier_name
point_bvt.rs
use na::Identity; use entities::partitioning::BVTVisitor; use point::PointQuery; use math::Point; // FIXME: add a point cost fn. /// Bounding Volume Tree visitor collecting nodes that may contain a given point. pub struct PointInterferencesCollector<'a, P: 'a, B: 'a> { point: &'a P, collector: &'a mut Vec...
#[inline] fn visit_leaf(&mut self, b: &B, bv: &BV) { if bv.contains_point(&Identity::new(), self.point) { self.collector.push(b.clone()) } } }
random_line_split
point_bvt.rs
use na::Identity; use entities::partitioning::BVTVisitor; use point::PointQuery; use math::Point; // FIXME: add a point cost fn. /// Bounding Volume Tree visitor collecting nodes that may contain a given point. pub struct PointInterferencesCollector<'a, P: 'a, B: 'a> { point: &'a P, collector: &'a mut Vec...
} }
{ self.collector.push(b.clone()) }
conditional_block
point_bvt.rs
use na::Identity; use entities::partitioning::BVTVisitor; use point::PointQuery; use math::Point; // FIXME: add a point cost fn. /// Bounding Volume Tree visitor collecting nodes that may contain a given point. pub struct PointInterferencesCollector<'a, P: 'a, B: 'a> { point: &'a P, collector: &'a mut Vec...
#[inline] fn visit_leaf(&mut self, b: &B, bv: &BV) { if bv.contains_point(&Identity::new(), self.point) { self.collector.push(b.clone()) } } }
{ bv.contains_point(&Identity::new(), self.point) }
identifier_body
point_bvt.rs
use na::Identity; use entities::partitioning::BVTVisitor; use point::PointQuery; use math::Point; // FIXME: add a point cost fn. /// Bounding Volume Tree visitor collecting nodes that may contain a given point. pub struct PointInterferencesCollector<'a, P: 'a, B: 'a> { point: &'a P, collector: &'a mut Vec...
(&mut self, b: &B, bv: &BV) { if bv.contains_point(&Identity::new(), self.point) { self.collector.push(b.clone()) } } }
visit_leaf
identifier_name
graph.rs
use std::vec::Vec; use gnuplot::*; /// Draws a graph with x-axis indicating the iteration number and /// y-axis showing the cost at that iteration. pub fn draw_cost_graph(fg : &mut Figure, cost_history : &Vec<f64>) { let mut x = Vec::with_capacity(cost_history.len()); for i in 0..cost_history.len() { x.push(i...
fg.axes3d() .surface(z_array.iter(), grid_size, grid_size, Some((x_start, y_start, x_end, y_end)), &[]) .show_contours_custom(true, true, Linear, Fix("Decision Boundary"), [0.0f64].iter()); }
{ assert!(limits.0 < limits.2); assert!(limits.1 < limits.3); assert!(grid_size >= 1); let mut z_array : Vec<f64> = vec![]; let x_start = limits.0; let y_start = limits.1; let x_end = limits.2; let y_end = limits.3; let x_step = (x_end - x_start) / grid_size as f64; let y_step = (y_end - y_start) /...
identifier_body
graph.rs
use std::vec::Vec; use gnuplot::*; /// Draws a graph with x-axis indicating the iteration number and /// y-axis showing the cost at that iteration. pub fn
(fg : &mut Figure, cost_history : &Vec<f64>) { let mut x = Vec::with_capacity(cost_history.len()); for i in 0..cost_history.len() { x.push(i) } fg.axes2d() .set_aspect_ratio(Fix(1.0)) .set_x_label("Iteration", &[Rotate(0.0)]) .set_y_label("Cost", &[Rotate(90.0)]) .lines(x.iter(), cost_history.i...
draw_cost_graph
identifier_name
graph.rs
use std::vec::Vec; use gnuplot::*; /// Draws a graph with x-axis indicating the iteration number and /// y-axis showing the cost at that iteration. pub fn draw_cost_graph(fg : &mut Figure, cost_history : &Vec<f64>) { let mut x = Vec::with_capacity(cost_history.len());
.set_aspect_ratio(Fix(1.0)) .set_x_label("Iteration", &[Rotate(0.0)]) .set_y_label("Cost", &[Rotate(90.0)]) .lines(x.iter(), cost_history.iter(), &[Color("#006633")]) .set_title("Cost Graph", &[]); } /// Draws a decision boundary at p_f(x, y) = 0 by evaluating the function /// within the supplied limits...
for i in 0..cost_history.len() { x.push(i) } fg.axes2d()
random_line_split
cell_renderer_text.rs
// This file was generated by gir (17af302) from gir-files (11e0e6d) // DO NOT EDIT use CellRenderer; use ffi; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct CellRendererText(Object<ffi::GtkCellRendererText>): CellRenderer; match fn { get_type =>...
}
{ unsafe { ffi::gtk_cell_renderer_text_set_fixed_height_from_font(self.to_glib_none().0, number_of_rows); } }
identifier_body
cell_renderer_text.rs
// This file was generated by gir (17af302) from gir-files (11e0e6d) // DO NOT EDIT
use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct CellRendererText(Object<ffi::GtkCellRendererText>): CellRenderer; match fn { get_type => || ffi::gtk_cell_renderer_text_get_type(), } } impl CellRendererText { pub fn new() -> CellRendererText { assert_initializ...
use CellRenderer; use ffi; use glib::object::Downcast;
random_line_split
cell_renderer_text.rs
// This file was generated by gir (17af302) from gir-files (11e0e6d) // DO NOT EDIT use CellRenderer; use ffi; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct CellRendererText(Object<ffi::GtkCellRendererText>): CellRenderer; match fn { get_type =>...
(&self, number_of_rows: i32) { unsafe { ffi::gtk_cell_renderer_text_set_fixed_height_from_font(self.to_glib_none().0, number_of_rows); } } }
set_fixed_height_from_font
identifier_name
numeric-method-autoexport.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...
() { // ints // num assert_eq!(15_isize.add(6_isize), 21_isize); assert_eq!(15_i8.add(6i8), 21_i8); assert_eq!(15_i16.add(6i16), 21_i16); assert_eq!(15_i32.add(6i32), 21_i32); assert_eq!(15_i64.add(6i64), 21_i64); // uints // num assert_eq!(15_usize.add(6_usize), 21_usize); assert_e...
main
identifier_name
numeric-method-autoexport.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...
// floats // num assert_eq!(10_f32.to_i32().unwrap(), 10); assert_eq!(10_f64.to_i32().unwrap(), 10); }
random_line_split
numeric-method-autoexport.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...
assert_eq!(10_f64.to_i32().unwrap(), 10); }
{ // ints // num assert_eq!(15_isize.add(6_isize), 21_isize); assert_eq!(15_i8.add(6i8), 21_i8); assert_eq!(15_i16.add(6i16), 21_i16); assert_eq!(15_i32.add(6i32), 21_i32); assert_eq!(15_i64.add(6i64), 21_i64); // uints // num assert_eq!(15_usize.add(6_usize), 21_usize); assert_eq!(...
identifier_body
driver.rs
use libc::c_int; use std::ffi::CString; use std::ptr::null_mut; use std::sync::{Once, ONCE_INIT}; use utils::{_string, _last_null_pointer_err}; use raster::Dataset; use raster::types::GdalType; use gdal_major_object::MajorObject; use metadata::Metadata; use gdal_sys::{self, GDALDriverH, GDALMajorObjectH}; use errors::...
size_y as c_int, bands as c_int, T::gdal_type(), null_mut() ) }; if c_dataset.is_null() { Err(_last_null_pointer_err("GDALCreate"))?; }; Ok(unsafe { Dataset::_with_c_ptr(c_dataset) }) } } impl MajorObjec...
size_x as c_int,
random_line_split
driver.rs
use libc::c_int; use std::ffi::CString; use std::ptr::null_mut; use std::sync::{Once, ONCE_INIT}; use utils::{_string, _last_null_pointer_err}; use raster::Dataset; use raster::types::GdalType; use gdal_major_object::MajorObject; use metadata::Metadata; use gdal_sys::{self, GDALDriverH, GDALMajorObjectH}; use errors::...
{ c_driver: GDALDriverH, } impl Driver { pub fn get(name: &str) -> Result<Driver> { _register_drivers(); let c_name = CString::new(name)?; let c_driver = unsafe { gdal_sys::GDALGetDriverByName(c_name.as_ptr()) }; if c_driver.is_null() { Err(_last_null_pointer_err("...
Driver
identifier_name
driver.rs
use libc::c_int; use std::ffi::CString; use std::ptr::null_mut; use std::sync::{Once, ONCE_INIT}; use utils::{_string, _last_null_pointer_err}; use raster::Dataset; use raster::types::GdalType; use gdal_major_object::MajorObject; use metadata::Metadata; use gdal_sys::{self, GDALDriverH, GDALMajorObjectH}; use errors::...
pub fn short_name(&self) -> String { let rv = unsafe { gdal_sys::GDALGetDriverShortName(self.c_driver) }; _string(rv) } pub fn long_name(&self) -> String { let rv = unsafe { gdal_sys::GDALGetDriverLongName(self.c_driver) }; _string(rv) } pub fn create( &se...
{ self.c_driver }
identifier_body
driver.rs
use libc::c_int; use std::ffi::CString; use std::ptr::null_mut; use std::sync::{Once, ONCE_INIT}; use utils::{_string, _last_null_pointer_err}; use raster::Dataset; use raster::types::GdalType; use gdal_major_object::MajorObject; use metadata::Metadata; use gdal_sys::{self, GDALDriverH, GDALMajorObjectH}; use errors::...
; Ok(unsafe { Dataset::_with_c_ptr(c_dataset) }) } } impl MajorObject for Driver { unsafe fn gdal_object_ptr(&self) -> GDALMajorObjectH { self.c_driver } } impl Metadata for Driver {}
{ Err(_last_null_pointer_err("GDALCreate"))?; }
conditional_block
mod.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Computed values. use {Atom, Namespace}; use context::QuirksMode; use euclid::Size2D; use font_metrics::FontMe...
pub quirks_mode: QuirksMode, /// Whether this computation is being done for a SMIL animation. /// /// This is used to allow certain properties to generate out-of-range /// values, which SMIL allows. pub for_smil_animation: bool, /// The property we are computing a value for, if it is a non...
pub in_media_query: bool, /// The quirks mode of this context.
random_line_split
mod.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Computed values. use {Atom, Namespace}; use context::QuirksMode; use euclid::Size2D; use font_metrics::FontMe...
/// The default computed style we're getting our reset style from. pub fn default_style(&self) -> &ComputedValues { self.builder.default_style() } /// The current style. pub fn style(&self) -> &StyleBuilder { &self.builder } /// Apply text-zoom if enabled. #[cfg(featu...
{ self.builder.device.au_viewport_size_for_viewport_unit_resolution() }
identifier_body
mod.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Computed values. use {Atom, Namespace}; use context::QuirksMode; use euclid::Size2D; use font_metrics::FontMe...
<'a> { /// Whether the current element is the root element. pub is_root_element: bool, /// Values accessed through this need to be in the properties "computed /// early": color, text-decoration, font-size, display, position, float, /// border-*-style, outline-style, font-family, writing-mode... ...
Context
identifier_name
mod.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Computed values. use {Atom, Namespace}; use context::QuirksMode; use euclid::Size2D; use font_metrics::FontMe...
if let Some(right) = self.right { right.to_css(dest)?; dest.write_str(", ")?; } else { dest.write_str("auto, ")?; } if let Some(bottom) = self.bottom { bottom.to_css(dest)?; dest.write_str(", ")?; } else { ...
{ dest.write_str("auto, ")?; }
conditional_block
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/. #![crate_name = "lrs_user_group"] #![crate_type = "lib"] #![feature(plugin, no_std, negate_unsigned, custom_derive)] ...
Err(e) => { if let Some(err) = error { *err = Err(e); } LineReader { start: 0, end: 0, file: File::invalid(), err: None, } }, Ok(f) => LineReader { ...
fn new(file: &str, error: Option<&'a mut Result>) -> LineReader<'a> { match File::open_read(file) {
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/. #![crate_name = "lrs_user_group"] #![crate_type = "lib"] #![feature(plugin, no_std, negate_unsigned, custom_derive)] ...
fn set_err(&mut self, e: error::Errno) { if let Some(ref mut err) = self.err { **err = Err(e); } } fn fill<'b>(&mut self, buf: &'b mut [u8]) -> &'b [u8] { loop { { // Borrow checked doesn't understand that return ends the loop. ...
{ match File::open_read(file) { Err(e) => { if let Some(err) = error { *err = Err(e); } LineReader { start: 0, end: 0, file: File::invalid(), err: None, } }, ...
identifier_body
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/. #![crate_name = "lrs_user_group"] #![crate_type = "lib"] #![feature(plugin, no_std, negate_unsigned, custom_derive)] ...
<'b>(&mut self, buf: &'b mut [u8]) -> &'b [u8] { loop { { // Borrow checked doesn't understand that return ends the loop. let cur: &'static [u8] = unsafe { mem::cast(&buf[self.start..self.end]) }; if let Some(pos) = memchr(cur, b'\n') { ...
fill
identifier_name
instr_vrcp28ss.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn vrcp28ss_1() { run_test(&Instruction { mnemonic: Mnemonic::VRCP28SS, operand1: Some(Direc...
fn vrcp28ss_2() { run_test(&Instruction { mnemonic: Mnemonic::VRCP28SS, operand1: Some(Direct(XMM6)), operand2: Some(Direct(XMM3)), operand3: Some(IndirectScaledDisplaced(ESI, Eight, 1780382507, Some(OperandSize::Dword), None)), operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode::Zero), sa...
} #[test]
random_line_split
instr_vrcp28ss.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn vrcp28ss_1() { run_test(&Instruction { mnemonic: Mnemonic::VRCP28SS, operand1: Some(Direc...
() { run_test(&Instruction { mnemonic: Mnemonic::VRCP28SS, operand1: Some(Direct(XMM16)), operand2: Some(Direct(XMM0)), operand3: Some(Direct(XMM31)), operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode::Zero), sae: true, mask: Some(MaskReg::K4), broadcast: None }, &[98, 130, 125, 156, 203,...
vrcp28ss_3
identifier_name
instr_vrcp28ss.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn vrcp28ss_1()
#[test] fn vrcp28ss_2() { run_test(&Instruction { mnemonic: Mnemonic::VRCP28SS, operand1: Some(Direct(XMM6)), operand2: Some(Direct(XMM3)), operand3: Some(IndirectScaledDisplaced(ESI, Eight, 1780382507, Some(OperandSize::Dword), None)), operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode:...
{ run_test(&Instruction { mnemonic: Mnemonic::VRCP28SS, operand1: Some(Direct(XMM7)), operand2: Some(Direct(XMM0)), operand3: Some(Direct(XMM1)), operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode::Zero), sae: true, mask: Some(MaskReg::K7), broadcast: None }, &[98, 242, 125, 159, 203, 249]...
identifier_body
22.rs
/* Problem 22: Names scores * * Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it * into alphabetical order. Then working out the alphabetical value for each name, multiply this * value by its alphabetical position in the list to obtain a name score. * * For example, ...
fn alphabetical_value<S: Borrow<str>>(name: S) -> u32 { name.borrow() .chars() .map(|chr| (chr as u8) - ('A' as u8) + 1) .fold(0, |sum, char_value| sum + char_value as u32) } fn get_name_list() -> Vec<String> { data_reader::for_path("./data/22-names.txt").collect() }
{ let mut names: Vec<String> = get_name_list(); names.sort(); let values = names.into_iter().map(alphabetical_value); let result = values.enumerate().fold(0, |sum, (index, score)| { let index = index as u32; sum + ((index + 1) * score) }); println!("{}", result); }
identifier_body
22.rs
/* Problem 22: Names scores * * Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it * into alphabetical order. Then working out the alphabetical value for each name, multiply this * value by its alphabetical position in the list to obtain a name score. * * For example, ...
println!("{}", result); } fn alphabetical_value<S: Borrow<str>>(name: S) -> u32 { name.borrow() .chars() .map(|chr| (chr as u8) - ('A' as u8) + 1) .fold(0, |sum, char_value| sum + char_value as u32) } fn get_name_list() -> Vec<String> { data_reader::for_path("./data/22-names.txt").col...
random_line_split
22.rs
/* Problem 22: Names scores * * Using names.txt, a 46K text file containing over five-thousand first names, begin by sorting it * into alphabetical order. Then working out the alphabetical value for each name, multiply this * value by its alphabetical position in the list to obtain a name score. * * For example, ...
() -> Vec<String> { data_reader::for_path("./data/22-names.txt").collect() }
get_name_list
identifier_name
nested.rs
// Copyright 2013 The rust-for-real developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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 c...
fn try_task() { // This task fails but won't make the caller // task fail, instead, it'll return an error result. let failure: Result<(), ()> = do task::try { fail!("BAAAAAAD"); }; assert!(failure.is_err()); // This task won't fail and will return a ~str let success: Result<~str, (...
fail!() } } }
random_line_split
nested.rs
// Copyright 2013 The rust-for-real developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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 c...
; assert!(failure.is_err()); // This task won't fail and will return a ~str let success: Result<~str, ()> = do task::try { ~"Yo, you know how to do things" }; assert!(success.is_ok()); println(success.unwrap()); } fn main() { simple_nesting(); supervised_task(); try_task(...
{ // This task fails but won't make the caller // task fail, instead, it'll return an error result. let failure: Result<(), ()> = do task::try { fail!("BAAAAAAD"); }
identifier_body
nested.rs
// Copyright 2013 The rust-for-real developers. For a full listing of the authors, // refer to the AUTHORS file at the top-level directory of this distribution. // // 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 c...
() { do task::spawn { let (parent, child) = DuplexStream::<int, int>(); child.send(0); // Using a supervised task to avoid // propagating linked failures to the // parent task in case it ends before // the child does. do task::spawn_supervised { ...
simple_nesting
identifier_name
data_dao_testing.rs
extern crate proton_cli; use proton_cli::dao::DataDao; use proton_cli::error::Error; /// Implementation of DataDao for testing purposes. Uses given functions to return values. /// Functions are boxed so their sizes are known (pointers). /// The general naming convention used is trait_function_name_fn, for all trait ...
fn new_data<'a>( &'a self, seqid: u32, chanid: u32, new_data: &'a Vec<u16> ) -> Result<(), Error> { (self.new_data_fn)(seqid, chanid, new_data.to_owned()) } fn get_data(&self, seqid: u32, chanid: u32) -> Result<Vec<u16>, Error> { (self.get_data_fn)(seqid,...
{ (self.new_data_default_fn)(seqid, chan_ids, default_data) }
identifier_body
data_dao_testing.rs
extern crate proton_cli; use proton_cli::dao::DataDao; use proton_cli::error::Error; /// Implementation of DataDao for testing purposes. Uses given functions to return values. /// Functions are boxed so their sizes are known (pointers). /// The general naming convention used is trait_function_name_fn, for all trait ...
{ pub new_data_default_fn: Box<Fn(u32, Vec<u32>, Vec<u16>) -> Result<(), Error>>, pub new_data_fn: Box<Fn(u32, u32, Vec<u16>) -> Result<(), Error>>, pub get_data_fn: Box<Fn(u32, u32) -> Result<Vec<u16>, Error>>, pub update_data_fn: Box<Fn(u32, u32, Vec<u16>) -> Result<(), Error>> } impl DataDaoTesting { /// Cr...
DataDaoTesting
identifier_name
data_dao_testing.rs
extern crate proton_cli; use proton_cli::dao::DataDao; use proton_cli::error::Error; /// Implementation of DataDao for testing purposes. Uses given functions to return values. /// Functions are boxed so their sizes are known (pointers). /// The general naming convention used is trait_function_name_fn, for all trait ...
) -> Result<(), Error> { (self.new_data_fn)(seqid, chanid, new_data.to_owned()) } fn get_data(&self, seqid: u32, chanid: u32) -> Result<Vec<u16>, Error> { (self.get_data_fn)(seqid, chanid) } fn update_data<'a>(&'a self, seqid: u32, chanid: u32, new_data: &'a Vec<u16>) -> Result<(...
new_data: &'a Vec<u16>
random_line_split
wrapper.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::reflector::DomObject; use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::tr...
unsafe { NonNull::new_unchecked(extension.reflector().get_jsobject().get()) } } fn spec(&self) -> WebGLExtensionSpec { T::spec() } fn is_supported(&self, ext: &WebGLExtensions) -> bool { self.is_enabled() || T::is_supported(ext) } fn is_enabled(&s...
{ self.enable(ext); }
conditional_block
wrapper.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::reflector::DomObject; use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::tr...
(&self) -> Option<DomRoot<T::Extension>> { self.extension.get() } }
dom_object
identifier_name
wrapper.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::reflector::DomObject; use dom::bindings::root::{DomRoot, MutNullableDom}; use dom::bindings::tr...
self.extension.get().is_some() } fn enable(&self, ext: &WebGLExtensions) { T::enable(ext); } fn name(&self) -> &'static str { T::name() } fn as_any<'a>(&'a self) -> &'a Any { self } } impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTr...
} fn is_enabled(&self) -> bool {
random_line_split
hybrid_expect.rs
endogenous Y, ZI, ZPAI, ZY, I, PAI, R exogenous EI "monetary policy shock",EPAI "Cost push shock",EY "IS shock" parameters beta_lag "$\beta_{lag}$", beta_lead "$\beta_{lead}$", beta_r "$\beta_{r}$", gam_lag "$\gamma_{lag}$", gam_y "$\gamma_{y}$", lamb_lag "$\lambda_{lag}$", lamb_lead "$\lambda_{lead}$", lamb_y "$\lam...
rhoi ,0.0000; rhopai ,0.0000; rhoy ,0.0000; siggdp ,0.5000; sigi ,0.5000; sigpai ,0.5000; sigy ,0.5000; hbe_lambda ,0.3000; % weight on current relative to past in backward-looking expectations hbe_w ,0.3000; % weight on backward-looking expectations in "total" expectations
gam_y ,0.5000; lamb_lag ,0.0000; lamb_lead ,0.9900; lamb_y ,0.0500;
random_line_split
slice.rs
//! Slices //! //! See `Slice`-structure documentation for more information on this module. use hal::{handle, buffer}; use hal::{Primitive, Backend, VertexCount}; use hal::command::InstanceParams; use hal::device::Device; use hal::memory::Bind; use format::Format; use pso; /// A `Slice` dictates in which and in what ...
} /// A helper trait to create `IndexBuffers` from different kinds of data. pub trait IntoIndexBuffer<B: Backend> { /// Turns self into an `IndexBuffer`. fn into_index_buffer<F: Device<B> +?Sized>(self, device: &mut F) -> IndexBuffer<B>; } impl<B: Backend> IntoIndexBuffer<B> for IndexBuffer<B> { fn into_i...
{ IndexBuffer::Auto }
identifier_body
slice.rs
//! Slices //! //! See `Slice`-structure documentation for more information on this module. use hal::{handle, buffer}; use hal::{Primitive, Backend, VertexCount}; use hal::command::InstanceParams; use hal::device::Device; use hal::memory::Bind; use format::Format; use pso;
/// # Overview /// A `Slice` in gfx has a different meaning from the term slice as employed more broadly in rust (`&[T]`). /// /// A `Slice` object in essence dictates in what order the vertices in a `VertexBuffer` get /// processed. To do this, it contains an internal index-buffer. This `Buffer` is a list of /// indic...
/// A `Slice` dictates in which and in what order vertices get processed. It is required for /// processing a PSO. ///
random_line_split
slice.rs
//! Slices //! //! See `Slice`-structure documentation for more information on this module. use hal::{handle, buffer}; use hal::{Primitive, Backend, VertexCount}; use hal::command::InstanceParams; use hal::device::Device; use hal::memory::Bind; use format::Format; use pso; /// A `Slice` dictates in which and in what ...
<F: Device<B> +?Sized>(self, _: &mut F) -> IndexBuffer<B> { self } } impl<B: Backend> IntoIndexBuffer<B> for () { fn into_index_buffer<F: Device<B> +?Sized>(self, _: &mut F) -> IndexBuffer<B> { IndexBuffer::Auto } } macro_rules! impl_index_buffer { ($prim_ty:ty, $buf_ty:ident) => ( ...
into_index_buffer
identifier_name
test_socket.rs
use nix::sys::socket::{InetAddr, UnixAddr, getsockname}; use std::mem; use std::net::{self, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::path::Path; use std::str::FromStr; use std::os::unix::io::RawFd; use libc::c_char; #[test] pub fn test_inetv4_addr_to_sock_addr() { let actual: net::SocketAddr = FromStr::from_s...
{ use nix::{Errno, Error}; use nix::sys::socket::{AddressFamily, SockType, SockFlag}; use nix::sys::socket::{socket, SockAddr}; use nix::sys::socket::SYSPROTO_CONTROL; let fd = socket(AddressFamily::System, SockType::Datagram, SockFlag::empty(), SYSPROTO_CONTROL).expect("socket failed"); let _s...
identifier_body
test_socket.rs
use nix::sys::socket::{InetAddr, UnixAddr, getsockname}; use std::mem; use std::net::{self, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::path::Path; use std::str::FromStr; use std::os::unix::io::RawFd; use libc::c_char; #[test] pub fn test_inetv4_addr_to_sock_addr() { let actual: net::SocketAddr = FromStr::from_s...
() { use nix::sys::socket::{AddressFamily, SockType, SockFlag}; use nix::sys::socket::{bind, socket, connect, listen, accept, SockAddr}; use nix::unistd::{read, write, close}; use std::thread; use tempdir::TempDir; let tempdir = TempDir::new("test_unixdomain").unwrap(); let sockname = tempd...
test_unixdomain
identifier_name
test_socket.rs
use nix::sys::socket::{InetAddr, UnixAddr, getsockname}; use std::mem; use std::net::{self, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::path::Path; use std::str::FromStr; use std::os::unix::io::RawFd; use libc::c_char; #[test] pub fn test_inetv4_addr_to_sock_addr() { let actual: net::SocketAddr = FromStr::from_s...
} assert_eq!(msg.flags & (MSG_TRUNC | MSG_CTRUNC), MsgFlags::empty()); close(fd2).unwrap(); } let received_r = received_r.expect("Did not receive passed fd"); // Ensure that the received file descriptor works write(w, b"world").unwrap(); let mut buf = [0u8; 5]; read(rec...
{ panic!("unexpected cmsg"); }
conditional_block
test_socket.rs
use nix::sys::socket::{InetAddr, UnixAddr, getsockname}; use std::mem; use std::net::{self, Ipv6Addr, SocketAddr, SocketAddrV6}; use std::path::Path; use std::str::FromStr; use std::os::unix::io::RawFd; use libc::c_char; #[test] pub fn test_inetv4_addr_to_sock_addr() { let actual: net::SocketAddr = FromStr::from_s...
let flowinfo: u32 = 1; let scope_id: u32 = 2; let ip: Ipv6Addr = "fe80::1".parse().unwrap(); let actual = SocketAddr::V6(SocketAddrV6::new(ip, port, flowinfo, scope_id)); let addr = InetAddr::from_std(&actual); match addr { InetAddr::V6(addr) => { assert_eq!(addr.sin6_port,...
let port: u16 = 3000;
random_line_split
htmltabledatacellelement.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::HTMLTableDataCellElementBinding; use dom::bindings::codegen::InheritTypes::H...
<'a>(&'a self) -> &'a Reflector { self.htmltablecellelement.reflector() } }
reflector
identifier_name
htmltabledatacellelement.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::HTMLTableDataCellElementBinding; use dom::bindings::codegen::InheritTypes::H...
self.type_id == NodeTargetTypeId(ElementNodeTypeId(HTMLTableDataCellElementTypeId)) } } impl HTMLTableDataCellElement { pub fn new_inherited(localName: DOMString, document: &JSRef<Document>) -> HTMLTableDataCellElement { HTMLTableDataCellElement { htmltablecellelement: HTMLTableCell...
fn is_htmltabledatacellelement(&self) -> bool {
random_line_split
main.rs
extern crate scoped_pool; #[macro_use] extern crate log; extern crate ansi_term; extern crate env_logger; extern crate pbr; extern crate serde_derive; extern crate term_painter; #[macro_use] extern crate clap; extern crate anyhow; extern crate glob; extern crate num_cpus; extern crate regex; extern crate toml; extern c...
if findings.had_too_long_lines > 0 { println!(" [with TOO LONG LINES:{}]", findings.had_too_long_lines) } if findings.had_win_line_endings > 0 { println!( " [with WINDOWS LINE ENDINGS:{}]", findings.had_win_line_endings ) ...
{ println!(" [with TRAILING SPACES:{}]", findings.had_trailing_ws) }
conditional_block
main.rs
extern crate scoped_pool; #[macro_use] extern crate log; extern crate ansi_term; extern crate env_logger; extern crate pbr;
extern crate anyhow; extern crate glob; extern crate num_cpus; extern crate regex; extern crate toml; extern crate unic_char_range; extern crate walkdir; use args::Args; mod app; mod args; mod check; mod clean; mod config; mod search; use pbr::ProgressBar; use std::{ fs::File, io::prelude::*, num, proces...
extern crate serde_derive; extern crate term_painter; #[macro_use] extern crate clap;
random_line_split
main.rs
extern crate scoped_pool; #[macro_use] extern crate log; extern crate ansi_term; extern crate env_logger; extern crate pbr; extern crate serde_derive; extern crate term_painter; #[macro_use] extern crate clap; extern crate anyhow; extern crate glob; extern crate num_cpus; extern crate regex; extern crate toml; extern c...
let clean_f = args.clean(); let tabs_f = args.tabs(); let use_crlf = args.use_crlf(); let thread_count = args.threads(); let color_f = args.color(); let max_line_length = args.line_length(); let start_dir = args.path(); debug!("args:{:?}", args); if args.quiet() { println!("q...
{ let enforcer_cfg = config::get_cfg(args.config_file()); if args.status() { println!(" using this config: {:?}", enforcer_cfg); std::process::exit(0); } let cfg_ignores: &Vec<String> = &enforcer_cfg.ignore; let cfg_endings = enforcer_cfg.endings; let file_endings = if !args.end...
identifier_body
main.rs
extern crate scoped_pool; #[macro_use] extern crate log; extern crate ansi_term; extern crate env_logger; extern crate pbr; extern crate serde_derive; extern crate term_painter; #[macro_use] extern crate clap; extern crate anyhow; extern crate glob; extern crate num_cpus; extern crate regex; extern crate toml; extern c...
( quiet: bool, findings: Findings, colored: bool, ) -> Result<u64, num::ParseIntError> { let total_errors = findings.had_tabs + findings.had_illegals + findings.had_trailing_ws + findings.had_too_long_lines + findings.had_win_line_endings; if quiet { if colore...
report_findings
identifier_name
board.rs
extern crate image; use std::fs::File; use std::path::Path; pub struct Board { pub width: usize, pub height: usize, pub data: Vec<String> } impl Board { pub fn new(x: usize, y: usize) -> Board
pub fn colour(&self, x: usize, y: usize) -> (u8,u8,u8) { let s = self.get(x, y); match s.as_ref() { "" => { (255,255,255) } "Y" => { (0,0,255) } "N" => { (255,0,0) } "?" => { (255,255,0) } "t" => { (0,0,0) } _ => { panic!("Unknown sigil: {}", s) } ...
{ Board { width: x, height: y, data: vec!["".to_string(); x*y] } }
identifier_body
board.rs
extern crate image; use std::fs::File; use std::path::Path; pub struct Board { pub width: usize, pub height: usize, pub data: Vec<String> } impl Board { pub fn new(x: usize, y: usize) -> Board { Board {
} pub fn colour(&self, x: usize, y: usize) -> (u8,u8,u8) { let s = self.get(x, y); match s.as_ref() { "" => { (255,255,255) } "Y" => { (0,0,255) } "N" => { (255,0,0) } "?" => { (255,255,0) } "t" => { (0,0,0) } _ => { panic!("Unknown sigil: {}", s) ...
width: x, height: y, data: vec!["".to_string(); x*y] }
random_line_split
board.rs
extern crate image; use std::fs::File; use std::path::Path; pub struct Board { pub width: usize, pub height: usize, pub data: Vec<String> } impl Board { pub fn
(x: usize, y: usize) -> Board { Board { width: x, height: y, data: vec!["".to_string(); x*y] } } pub fn colour(&self, x: usize, y: usize) -> (u8,u8,u8) { let s = self.get(x, y); match s.as_ref() { "" => { (255,255,255) } "Y" => { (0,0,255) } ...
new
identifier_name
controller.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/. extern crate rand; use foxbox_core::config_store::ConfigService; use foxbox_core::profile_service::{ProfilePath, Pro...
fn adapter_notification(&self, _: serde_json::value::Value) {} fn http_as_addrs(&self) -> Result<IntoIter<SocketAddr>, io::Error> { ("localhost", 3000).to_socket_addrs() } fn ws_as_addrs(&self) -> Result<IntoIter<SocketAddr>, io::Error> { ("localhost", 4000).to_socket_addrs() } ...
{}
identifier_body
controller.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/. extern crate rand; use foxbox_core::config_store::ConfigService; use foxbox_core::profile_service::{ProfilePath, Pro...
} fn get_upnp_manager(&self) -> Arc<UpnpManager> { Arc::new(UpnpManager::new()) } fn get_users_manager(&self) -> Arc<UsersManager> { Arc::new(UsersManager::new(&self.profile_service.path_for("unused"))) } fn get_profile(&self) -> &ProfileService { &self.profile_service ...
fn get_config(&self) -> Arc<ConfigService> { self.config.clone()
random_line_split
controller.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/. extern crate rand; use foxbox_core::config_store::ConfigService; use foxbox_core::profile_service::{ProfilePath, Pro...
(&self) -> String { String::from("localhost") } fn get_domain(&self) -> String { String::from("knilox.org") } fn get_box_certificate(&self) -> io::Result<CertificateRecord> { CertificateRecord::new_from_components("foxbox.local".to_owned(), ...
get_hostname
identifier_name
snapshot_manifest.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
}
{ let decoder = UntrustedRlp::new(raw); let state_hashes: Vec<H256> = decoder.val_at(0)?; let block_hashes: Vec<H256> = decoder.val_at(1)?; let state_root: H256 = decoder.val_at(2)?; let block_number: u64 = decoder.val_at(3)?; let block_hash: H256 = decoder.val_at(4)?; Ok(ManifestData { state_hashes:...
identifier_body
snapshot_manifest.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
pub struct ManifestData { /// List of state chunk hashes. pub state_hashes: Vec<H256>, /// List of block chunk hashes. pub block_hashes: Vec<H256>, /// The final, expected state root. pub state_root: H256, /// Block number this snapshot was taken at. pub block_number: u64, /// Block hash this snapshot was take...
use util::Bytes; /// Manifest data. #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "ipc", binary)]
random_line_split
snapshot_manifest.rs
// Copyright 2015-2017 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
{ /// List of state chunk hashes. pub state_hashes: Vec<H256>, /// List of block chunk hashes. pub block_hashes: Vec<H256>, /// The final, expected state root. pub state_root: H256, /// Block number this snapshot was taken at. pub block_number: u64, /// Block hash this snapshot was taken at. pub block_hash: ...
ManifestData
identifier_name
p_2_3_1_01.rs
// P_2_3_1_01 // // Generative Gestaltung – Creative Coding im Web // ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018 // Benedikt Groß, Hartmut Bohnacker, Julia Laub, Claudius Lazzeroni // with contributions by Joey Lee and Niels Poldervaart // Copyright 2018 // // http://www.generative-gestaltung....
c: Rgba, line_length: f32, angle: f32, angle_speed: f32, } fn model(app: &App) -> Model { app.new_window() .size(1280, 720) .view(view) .mouse_pressed(mouse_pressed) .key_pressed(key_pressed) .key_released(key_released) .build() .unwrap(); Model...
el {
identifier_name