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
instr_aam.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 aam_1() { run_test(&Instruction { mnemonic: Mnemonic::AAM, operand1: Some(Literal8(116)),...
() { run_test(&Instruction { mnemonic: Mnemonic::AAM, operand1: Some(Literal8(85)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[212, 85], OperandSize::Dword) }
aam_2
identifier_name
instr_aam.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 aam_1() { run_test(&Instruction { mnemonic: Mnemonic::AAM, operand1: Some(Literal8(116)),...
{ run_test(&Instruction { mnemonic: Mnemonic::AAM, operand1: Some(Literal8(85)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[212, 85], OperandSize::Dword) }
identifier_body
instr_aam.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 aam_2() { run_test(&Instruction { mnemonic: Mnemonic::AAM, operand1: Some(Literal8(85)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[212, 85], OperandSize::Dword) }
#[test] fn aam_1() { run_test(&Instruction { mnemonic: Mnemonic::AAM, operand1: Some(Literal8(116)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[212, 116], OperandSize::Word) }
random_line_split
day_1.rs
pub use tdd_kata::graph_search_kata::day_1::{UnidirectedGraph, DepthFirstSearch}; pub use expectest::prelude::{be_equal_to, be_true, be_false}; describe! dfs { describe! graph { before_each { let mut graph = UnidirectedGraph::default(); graph.add_edge(1, 2); } i...
let adj_to_two = graph.adjacent_to(2); expect!(adj_to_two).to(be_equal_to(&vec![1])); } } describe! search { it "should create depth first search" { let graph = UnidirectedGraph::default(); DepthFirstSearch::new(&graph, 1); } it...
it "should be adjacent to each other" { let adj_to_one = graph.adjacent_to(1); expect!(adj_to_one).to(be_equal_to(&vec![2]));
random_line_split
log.rs
use crate::core::counter::Counter; use crate::iterators::{HistogramIterator, PickMetadata, PickyIterator}; use crate::Histogram; /// An iterator that will yield at log-size steps through the histogram's value range. pub struct Iter<'a, T: 'a + Counter> { hist: &'a Histogram<T>, // > 1.0 next_value_reporti...
}
{ // If the next iterate will not move to the next sub bucket index (which is empty if if we // reached this point), then we are not yet done iterating (we want to iterate until we are // no longer on a value that has a count, rather than util we first reach the last value // that has a ...
identifier_body
log.rs
use crate::core::counter::Counter; use crate::iterators::{HistogramIterator, PickMetadata, PickyIterator}; use crate::Histogram; /// An iterator that will yield at log-size steps through the histogram's value range. pub struct Iter<'a, T: 'a + Counter> { hist: &'a Histogram<T>, // > 1.0 next_value_reporti...
(&mut self, index: usize, _: u64, _: T) -> Option<PickMetadata> { let val = self.hist.value_for(index); if val >= self.current_step_lowest_value_reporting_level || index == self.hist.last_index() { let metadata = PickMetadata::new(None, Some(self.current_step_highest_...
pick
identifier_name
log.rs
use crate::core::counter::Counter; use crate::iterators::{HistogramIterator, PickMetadata, PickyIterator}; use crate::Histogram; /// An iterator that will yield at log-size steps through the histogram's value range. pub struct Iter<'a, T: 'a + Counter> { hist: &'a Histogram<T>, // > 1.0 next_value_reporti...
"value_units_per_bucket must be > 0" ); assert!(log_base > 1.0, "log_base must be > 1.0"); let new_lowest = hist.lowest_equivalent(value_units_in_first_bucket - 1); HistogramIterator::new( hist, Iter { hist, log_base, ...
value_units_in_first_bucket: u64, log_base: f64, ) -> HistogramIterator<'a, T, Iter<'a, T>> { assert!( value_units_in_first_bucket > 0,
random_line_split
log.rs
use crate::core::counter::Counter; use crate::iterators::{HistogramIterator, PickMetadata, PickyIterator}; use crate::Histogram; /// An iterator that will yield at log-size steps through the histogram's value range. pub struct Iter<'a, T: 'a + Counter> { hist: &'a Histogram<T>, // > 1.0 next_value_reporti...
} fn more(&mut self, index_to_pick: usize) -> bool { // If the next iterate will not move to the next sub bucket index (which is empty if if we // reached this point), then we are not yet done iterating (we want to iterate until we are // no longer on a value that has a count, rather t...
{ None }
conditional_block
handlers.rs
// Handle incoming requests. extern crate iron; extern crate redis; extern crate rustc_serialize; extern crate hyper; extern crate url; extern crate router; use std::vec::Vec; use rustc_serialize::json::Json; use iron::modifiers::Redirect; use iron::headers::{CacheControl, CacheDirective}; use iron::prelude::*; use ...
(req: &mut Request) -> IronResult<Response> { // Learn the parameters given to the request let router = req.extensions.get::<Router>().unwrap(); let redis: redis::Connection = setup_redis(); let hyper_client: Client = Client::new(); let user = router.find("user").unwrap(); let repo = router.fi...
github_finder
identifier_name
handlers.rs
// Handle incoming requests. extern crate iron; extern crate redis; extern crate rustc_serialize; extern crate hyper; extern crate url; extern crate router; use std::vec::Vec; use rustc_serialize::json::Json; use iron::modifiers::Redirect; use iron::headers::{CacheControl, CacheDirective}; use iron::prelude::*; use ...
branch); // Fetch the content API request for the Github URL, // Parse its JSON and try to find the `SHA`-key. if let Some(body) = fetch(&hyper_client, &github_url) { if let Ok(json) = Json::from_str(&body) { if...
_ => { let github_url = format!("https://api.github.com/repos/{0}/{1}/git/refs/heads/{2}", user, repo,
random_line_split
handlers.rs
// Handle incoming requests. extern crate iron; extern crate redis; extern crate rustc_serialize; extern crate hyper; extern crate url; extern crate router; use std::vec::Vec; use rustc_serialize::json::Json; use iron::modifiers::Redirect; use iron::headers::{CacheControl, CacheDirective}; use iron::prelude::*; use ...
redis.get(result_key.to_owned()), || schedule_github_update(&user, &repo, &sha)); // Then render the response let mut response = match method { // If this is a simple request for status, just return the result "status" => Response::with((status::Ok, text.to_owned())), //...
// First extract all the request information let router = req.extensions.get::<Router>().unwrap(); let redis: redis::Connection = setup_redis(); let user = router.find("user").unwrap(); let repo = router.find("repo").unwrap(); let sha = router.find("sha").unwrap(); let filename: Vec<&str> = ro...
identifier_body
local.rs
//! The thread-local state. use std::{mem, thread}; use std::cell::RefCell; use {global, hazard, guard, debug, settings}; use garbage::Garbage; thread_local! { /// The state of this thread. static STATE: RefCell<State> = RefCell::new(State::default()); } /// Add new garbage to be deleted. /// /// This garbag...
{ /// The cached garbage waiting to be exported to the global state. garbage: Vec<Garbage>, /// The cache of currently available hazards. /// /// We maintain this cache to avoid the performance hit of creating new hazards. /// /// The hazards in this vector are not necessarily in state "fre...
State
identifier_name
local.rs
//! The thread-local state. use std::{mem, thread}; use std::cell::RefCell; use {global, hazard, guard, debug, settings}; use garbage::Garbage; thread_local! { /// The state of this thread. static STATE: RefCell<State> = RefCell::new(State::default()); } /// Add new garbage to be deleted. /// /// This garbag...
} /// See `export_garbage()` for more information. fn export_garbage(&mut self) { // Print message in debug mode. debug::exec(|| println!("Exporting garbage.")); // Clear the vector and export the garbage. global::export_garbage(mem::replace(&mut self.garbage, Vec::new()))...
{ false }
conditional_block
local.rs
//! The thread-local state. use std::{mem, thread}; use std::cell::RefCell; use {global, hazard, guard, debug, settings}; use garbage::Garbage; thread_local! { /// The state of this thread. static STATE: RefCell<State> = RefCell::new(State::default()); } /// Add new garbage to be deleted. /// /// This garbag...
fn debug_free_blocked() { use std::mem; let (writer, reader) = hazard::create(); mem::forget(reader); free_hazard(writer); } }
#[cfg(debug_assertions)] #[test] #[should_panic]
random_line_split
no_0094_binary_tree_inorder_traversal.rs
// Definition for a binary tree node. #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn new(val: i32) -> Self { TreeNode { val, lef...
stack.push(root.unwrap()); while let Some(node) = stack.pop() { let left_node = node.borrow_mut().left.take(); if let Some(left) = left_node { // 有左子树,把 node 和左子树都放进去 stack.push(node); stack.push(left); continue; ...
let mut ans = Vec::new(); let mut stack = Vec::new();
random_line_split
no_0094_binary_tree_inorder_traversal.rs
// Definition for a binary tree node. #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn new(val: i32) -> Self { TreeNode { val, lef...
Some(Rc::new(RefCell::new(n))) } }
left: None, right: node(TreeNode { val: 2, left: node(TreeNode::new(3)), right: None, }), }); assert_eq!(Solution::inorder_traversal(root), vec![1, 3, 2]); } fn node(n: TreeNode) -> Option<Rc<RefCell<TreeNode>>> {
identifier_body
no_0094_binary_tree_inorder_traversal.rs
// Definition for a binary tree node. #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn new(val: i32) -> Self { TreeNode { val, lef...
let mut ans = Vec::new(); let mut stack = Vec::new(); stack.push(root.unwrap()); while let Some(node) = stack.pop() { let left_node = node.borrow_mut().left.take(); if let Some(left) = left_node { // 有左子树,把 node 和左子树都放进去 stack.pu...
{ return Vec::new(); }
conditional_block
no_0094_binary_tree_inorder_traversal.rs
// Definition for a binary tree node. #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } impl TreeNode { #[inline] pub fn new(val: i32) -> Self { TreeNode { val, lef...
(root: Option<Rc<RefCell<TreeNode>>>) -> Vec<i32> { if root.is_none() { return Vec::new(); } let mut ans = Vec::new(); let mut stack = Vec::new(); stack.push(root.unwrap()); while let Some(node) = stack.pop() { let left_node = node.borrow_mut().l...
inorder_traversal
identifier_name
class-typarams.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn meow_count(&mut self) -> uint { self.meows } } fn cat<U>(in_x : uint, in_y : int) -> cat<U> { cat { meows: in_x, how_hungry: in_y, m: PhantomData } } pub fn main() { let _nyan : cat<int> = cat::<int>(52, 99); // let mut kitty = cat(1000, 2); }
{ self.meows += 1; }
identifier_body
class-typarams.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn meow_count(&mut self) -> uint { self.meows } } fn cat<U>(in_x : uint, in_y : int) -> cat<U> { cat { meows: in_x, how_hungry: in_y, m: PhantomData } } pub fn main() { let _nyan : cat<int> = cat::<int>(52, 99); // let mut kitty = cat(1000, 2); }
impl<U> cat<U> { pub fn speak(&mut self) { self.meows += 1; }
random_line_split
class-typarams.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 ...
<U>(in_x : uint, in_y : int) -> cat<U> { cat { meows: in_x, how_hungry: in_y, m: PhantomData } } pub fn main() { let _nyan : cat<int> = cat::<int>(52, 99); // let mut kitty = cat(1000, 2); }
cat
identifier_name
main.rs
/*! This crate implements a simple arithmetic calculator, using the [`rust-scan`](https://github.com/DanielKeep/rust-scan.git) package to do the parsing. */ #![feature(phase)] #[phase(plugin)] extern crate scan; extern crate scan_util; use std::borrow::ToOwned; use std::collections::HashMap; use std::num::Float; use ...
(Expr); scanner! { AddExpr, // We *could* boil this down to a single arm, but it wouldn't be as neat. lhs:MulExpr "+" rhs:AddExpr => { // Again, we only need MulExpr and AddExpr in order to trigger the correct scanning rules. What we actually *care* about are the Exprs inside. let (MulExpr(lhs), AddExpr(rhs)) =...
AddExpr
identifier_name
main.rs
/*! This crate implements a simple arithmetic calculator, using the [`rust-scan`](https://github.com/DanielKeep/rust-scan.git) package to do the parsing. */ #![feature(phase)] #[phase(plugin)] extern crate scan; extern crate scan_util; use std::borrow::ToOwned; use std::collections::HashMap; use std::num::Float; use ...
continue; }, // Exit. ".q" | ".quit" => { println!("Bye!"); return; }, // Fallback for unknown commands. "." cmd:&str,.._ => { println!("error: unknown command `{}`", cmd); println!("Try `.help`."); continue; }, // Ignore empty li...
{ let mut vars = HashMap::new(); vars.insert("NaN".to_owned(), Float::nan()); vars.insert("inf".to_owned(), Float::infinity()); vars.insert("pi".to_owned(), ::std::f64::consts::PI); vars.insert("e".to_owned(), ::std::f64::consts::E); println!("Type `.help` or `.h` for brief instructions."); println!("Type `.qu...
identifier_body
main.rs
/*! This crate implements a simple arithmetic calculator, using the [`rust-scan`](https://github.com/DanielKeep/rust-scan.git) package to do the parsing. */ #![feature(phase)] #[phase(plugin)] extern crate scan; extern crate scan_util; use std::borrow::ToOwned; use std::collections::HashMap; use std::num::Float; use ...
}; match stmt { LetStmt(name, expr) => { let vars = &mut vars; eval(expr, vars).map(|v| vars.insert(name.clone(), v)); }, ExprStmt(expr) => { eval(expr, &vars).map(|v| println!("= {}", v)); }, } } } /** Evaluates an expression, returning `Some(f64)` if t...
Ok(stmt) => stmt,
random_line_split
namespace.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 gecko_bindings::structs::nsIAtom; use selectors::bloom::BloomHash; use std::borrow::Borrow; use std::ops::Dere...
(WeakAtom); impl Deref for Namespace { type Target = WeakNamespace; #[inline] fn deref(&self) -> &WeakNamespace { let weak: *const WeakAtom = &*self.0; unsafe { &*(weak as *const WeakNamespace) } } } impl Borrow<WeakNamespace> for Namespace { #[inline] fn b...
WeakNamespace
identifier_name
namespace.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 gecko_bindings::structs::nsIAtom; use selectors::bloom::BloomHash; use std::borrow::Borrow; use std::ops::Dere...
}
{ self.0.get_hash() }
identifier_body
namespace.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 gecko_bindings::structs::nsIAtom; use selectors::bloom::BloomHash; use std::borrow::Borrow; use std::ops::Dere...
#[inline] fn eq(&self, other: &Self) -> bool { let weak: *const WeakNamespace = self; let other: *const WeakNamespace = other; weak == other } } impl BloomHash for Namespace { #[inline] fn bloom_hash(&self) -> u32 { self.0.get_hash() } } impl BloomHash for WeakN...
impl Eq for WeakNamespace {} impl PartialEq for WeakNamespace {
random_line_split
fsu-moves-and-copies.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...
pub fn main() { test0(); test1(); test2(); }
assert_eq!(c.nocopy.v, 22); }
random_line_split
fsu-moves-and-copies.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...
} impl Drop for DropNoFoo { fn drop(&mut self) { } } struct DropMoveFoo { inner: MoveFoo } impl DropMoveFoo { fn new(x:int,y:int) -> DropMoveFoo { DropMoveFoo { inner: MoveFoo::new(x,y) } } } impl Drop for DropMoveFoo { fn drop(&mut self) { } } fn test0() { // just copy implicitly copyable fields from `f`, ...
{ DropNoFoo { inner: NoFoo::new(x,y) } }
identifier_body
fsu-moves-and-copies.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...
(x:int,y:int) -> DropNoFoo { DropNoFoo { inner: NoFoo::new(x,y) } } } impl Drop for DropNoFoo { fn drop(&mut self) { } } struct DropMoveFoo { inner: MoveFoo } impl DropMoveFoo { fn new(x:int,y:int) -> DropMoveFoo { DropMoveFoo { inner: MoveFoo::new(x,y) } } } impl Drop for DropMoveFoo { fn drop(&mut self) { } } ...
new
identifier_name
slnfile.rs
use std::path::Path; use std::fs::File;
use visualstudio::{ProjDesc, escape}; pub struct SlnFile { projects: Vec<ProjDesc>, } impl SlnFile { pub fn new() -> SlnFile { SlnFile { projects: Vec::new() } } pub fn add_project(&mut self, proj: ProjDesc) { self.projects.push(proj); } pub fn write_to<P:...
use std::io::Write;
random_line_split
slnfile.rs
use std::path::Path; use std::fs::File; use std::io::Write; use visualstudio::{ProjDesc, escape}; pub struct SlnFile { projects: Vec<ProjDesc>, } impl SlnFile { pub fn new() -> SlnFile
pub fn add_project(&mut self, proj: ProjDesc) { self.projects.push(proj); } pub fn write_to<P: AsRef<Path>>(&self, path: P) { let mut file = File::create(path).unwrap(); // Generic version metadata writeln!(file, "Microsoft Visual Studio Solution File, Format Version 12.0...
{ SlnFile { projects: Vec::new() } }
identifier_body
slnfile.rs
use std::path::Path; use std::fs::File; use std::io::Write; use visualstudio::{ProjDesc, escape}; pub struct SlnFile { projects: Vec<ProjDesc>, } impl SlnFile { pub fn new() -> SlnFile { SlnFile { projects: Vec::new() } } pub fn
(&mut self, proj: ProjDesc) { self.projects.push(proj); } pub fn write_to<P: AsRef<Path>>(&self, path: P) { let mut file = File::create(path).unwrap(); // Generic version metadata writeln!(file, "Microsoft Visual Studio Solution File, Format Version 12.00").unwrap(); wr...
add_project
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 app_units::Au; use euclid::size::Size2D; use font_metrics::FontMetricsProvider; use medi...
/// A trait to represent the conversion between computed and specified values. pub trait ToComputedValue { /// The computed value type we're going to be converted to. type ComputedValue; /// Convert a specified value to a computed value, using itself and the data /// inside the `Context`. #[inline...
pub fn mutate_style(&mut self) -> &mut ComputedValues { &mut self.style } }
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 app_units::Au; use euclid::size::Size2D; use font_metrics::FontMetricsProvider; use medi...
fn from_computed_value(computed: &RGBA) -> Self { specified::Color::RGBA(*computed) } } impl ToComputedValue for specified::CSSColor { type ComputedValue = CSSColor; #[cfg(not(feature = "gecko"))] #[inline] fn to_computed_value(&self, _context: &Context) -> CSSColor { self.pa...
{ use gecko::values::convert_nscolor_to_rgba as to_rgba; // It's safe to access the nsPresContext immutably during style computation. let pres_context = unsafe { &*context.device.pres_context }; match *self { specified::Color::RGBA(rgba) => rgba, specified::Color:...
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 app_units::Au; use euclid::size::Size2D; use font_metrics::FontMetricsProvider; use medi...
(computed: &CSSColor) -> Self { specified::CSSColor { parsed: match *computed { CSSColor::RGBA(rgba) => specified::Color::RGBA(rgba), CSSColor::CurrentColor => specified::Color::CurrentColor, }, authored: None, } } } #[cfg(feature ...
from_computed_value
identifier_name
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html mod card; mod config; mod deck; mod deckconf; mod graves; mod note; mod notetype; mod revlog; mod sqlite; mod sync; mod sync_check; mod tag; mod upgrades; pub(crate) use sqlite::SqliteStora...
#[cfg(test)] mod test { use super::ids_to_string; #[test] fn ids_string() { let mut s = String::new(); ids_to_string::<u8>(&mut s, &[]); assert_eq!(s, "()"); s.clear(); ids_to_string(&mut s, &[7]); assert_eq!(s, "(7)"); s.clear(); ids_to_str...
{ buf.push('('); if !ids.is_empty() { for id in ids.iter().skip(1) { write!(buf, "{},", id).unwrap(); } write!(buf, "{}", ids[0]).unwrap(); } buf.push(')'); }
identifier_body
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html mod card; mod config; mod deck; mod deckconf; mod graves; mod note; mod notetype; mod revlog; mod sqlite; mod sync; mod sync_check; mod tag; mod upgrades; pub(crate) use sqlite::SqliteStora...
<T>(buf: &mut String, ids: &[T]) where T: std::fmt::Display, { buf.push('('); if!ids.is_empty() { for id in ids.iter().skip(1) { write!(buf, "{},", id).unwrap(); } write!(buf, "{}", ids[0]).unwrap(); } buf.push(')'); } #[cfg(test)] mod test { use super::ids_t...
ids_to_string
identifier_name
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html mod card; mod config; mod deck; mod deckconf; mod graves; mod note; mod notetype; mod revlog; mod sqlite; mod sync; mod sync_check; mod tag; mod upgrades; pub(crate) use sqlite::SqliteStora...
buf.push(')'); } #[cfg(test)] mod test { use super::ids_to_string; #[test] fn ids_string() { let mut s = String::new(); ids_to_string::<u8>(&mut s, &[]); assert_eq!(s, "()"); s.clear(); ids_to_string(&mut s, &[7]); assert_eq!(s, "(7)"); s.clear(...
{ for id in ids.iter().skip(1) { write!(buf, "{},", id).unwrap(); } write!(buf, "{}", ids[0]).unwrap(); }
conditional_block
mod.rs
// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
mod card; mod config; mod deck; mod deckconf; mod graves; mod note; mod notetype; mod revlog; mod sqlite; mod sync; mod sync_check; mod tag; mod upgrades; pub(crate) use sqlite::SqliteStorage; pub(crate) use sync::open_and_check_sqlite_file; use std::fmt::Write; // Write a list of IDs as '(x,y,...)' into the provide...
random_line_split
generator.rs
// Copyright 2015, 2016 Ethcore (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 later version....
() { let bloom = H2048([0x1; 256]); let mut gen = ChainGenerator::default(); let mut finalizer = BlockFinalizer::default(); let block0_rlp = gen.with_bloom(bloom).generate(&mut finalizer).unwrap(); let block1_rlp = gen.generate(&mut finalizer).unwrap(); let block0 = BlockView::new(&block0_rlp); let block...
with_bloom_generator
identifier_name
generator.rs
// Copyright 2015, 2016 Ethcore (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 later version....
bloom: bloom } } fn with_transaction(&mut self, transaction: SignedTransaction) -> Transaction<Self> { Transaction { iter: self, transaction: transaction, } } fn complete<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Complete<'a, Self> { Complete { iter: self, finalizer: finalizer...
fn with_bloom(&mut self, bloom: H2048) -> Bloom<Self> { Bloom { iter: self,
random_line_split
generator.rs
// Copyright 2015, 2016 Ethcore (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 later version....
fn complete<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Complete<'a, Self> { Complete { iter: self, finalizer: finalizer } } fn generate<'a>(&'a mut self, finalizer: &'a mut BlockFinalizer) -> Option<Bytes> where <I as Iterator>::Item: CompleteBlock { self.complete(finalizer).next() } } ...
{ Transaction { iter: self, transaction: transaction, } }
identifier_body
overlay.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use Bin; use Container; use Widget; use ffi; use glib::Value; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct Overlay(Object<ffi::GtkOverlay>): Bin, Container, Widget; mat...
<T: IsA<Widget>>(&self, item: &T, index: i32) { unsafe { ffi::gtk_container_child_set_property(self.to_glib_none().0, item.to_glib_none().0, "index".to_glib_none().0, Value::from(&index).to_glib_none().0); } } //fn connect_get_child_position<Unsupported or ignored types>(&self, f: F...
set_child_index
identifier_name
overlay.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use Bin; use Container; use Widget; use ffi; use glib::Value; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct Overlay(Object<ffi::GtkOverlay>): Bin, Container, Widget; mat...
ffi::gtk_overlay_add_overlay(self.to_glib_none().0, widget.to_glib_none().0); } } #[cfg(feature = "v3_18")] fn get_overlay_pass_through<P: IsA<Widget>>(&self, widget: &P) -> bool { unsafe { from_glib(ffi::gtk_overlay_get_overlay_pass_through(self.to_glib_none().0, wi...
impl<O: IsA<Overlay> + IsA<Container>> OverlayExt for O { fn add_overlay<P: IsA<Widget>>(&self, widget: &P) { unsafe {
random_line_split
overlay.rs
// This file was generated by gir (5c017c9) from gir-files (71d73f0) // DO NOT EDIT use Bin; use Container; use Widget; use ffi; use glib::Value; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct Overlay(Object<ffi::GtkOverlay>): Bin, Container, Widget; mat...
fn set_child_index<T: IsA<Widget>>(&self, item: &T, index: i32) { unsafe { ffi::gtk_container_child_set_property(self.to_glib_none().0, item.to_glib_none().0, "index".to_glib_none().0, Value::from(&index).to_glib_none().0); } } //fn connect_get_child_position<Unsupported or ig...
{ let mut value = Value::from(&0); unsafe { ffi::gtk_container_child_get_property(self.to_glib_none().0, item.to_glib_none().0, "index".to_glib_none().0, value.to_glib_none_mut().0); } value.get().unwrap() }
identifier_body
kill.rs
#![crate_name = "kill"] #![feature(collections, core, old_io, rustc_private, unicode)] /* * This file is part of the uutils coreutils package. * * (c) Maciej Dziardziel <fiedzia@gmail.com> * * For the full copyright and license information, please view the LICENSE file * that was distributed with this source cod...
(signal_name_or_value: &str) { for signal in ALL_SIGNALS.iter() { if signal.name == signal_name_or_value || (format!("SIG{}", signal.name).as_slice()) == signal_name_or_value { println!("{}", signal.value); exit!(EXIT_OK as i32) } else if signal_name_or_value == signal.value...
print_signal
identifier_name
kill.rs
#![crate_name = "kill"] #![feature(collections, core, old_io, rustc_private, unicode)] /* * This file is part of the uutils coreutils package. * * (c) Maciej Dziardziel <fiedzia@gmail.com> * * For the full copyright and license information, please view the LICENSE file * that was distributed with this source cod...
static EXIT_OK: i32 = 0; static EXIT_ERR: i32 = 1; #[derive(Clone)] pub enum Mode { Kill, Table, List, Help, Version, } impl Copy for Mode {} pub fn main(args: Vec<String>) -> i32 { let opts = [ optflag("h", "help", "display this help and exit"), optflag("V", "version", "out...
#[path = "signals.rs"] mod signals; static NAME: &'static str = "kill"; static VERSION: &'static str = "0.0.1";
random_line_split
shootout-k-nucleotide.rs
// xfail-test extern mod extra; use std::cast::transmute; use std::i32::range; use std::libc::{STDIN_FILENO, c_int, fdopen, fgets, fileno, fopen, fstat}; use std::libc::{stat, strlen}; use std::ptr::null; use std::unstable::intrinsics::init; use std::vec::{reverse}; use extra::sort::quick_sort3; static LINE_LEN: uin...
(string: &str) -> Code { let mut code = Code(0u64); for uint::range(0, string.len()) |i| { code = code.push_char(string[i]); } code } // XXX: Inefficient. fn unpack(&self, frame: i32) -> ~str { let mut key = **self; let mut result = ~[]; f...
pack
identifier_name
shootout-k-nucleotide.rs
// xfail-test extern mod extra; use std::cast::transmute; use std::i32::range; use std::libc::{STDIN_FILENO, c_int, fdopen, fgets, fileno, fopen, fstat}; use std::libc::{stat, strlen}; use std::ptr::null; use std::unstable::intrinsics::init; use std::vec::{reverse}; use extra::sort::quick_sort3; static LINE_LEN: uin...
} { let mut entry = &mut *self.items[index].get_mut_ref(); if entry.code == key { c.f(*entry); return; } Table::search_remainder(*entry, key, c) } } fn each(&self, f: &fn(entry: &Entry) -> bool) { ...
{ let mut entry = ~Entry { code: key, count: 0, next: None, }; c.f(entry); self.items[index] = Some(entry); return; }
conditional_block
shootout-k-nucleotide.rs
// xfail-test extern mod extra; use std::cast::transmute; use std::i32::range; use std::libc::{STDIN_FILENO, c_int, fdopen, fgets, fileno, fopen, fstat}; use std::libc::{stat, strlen}; use std::ptr::null; use std::unstable::intrinsics::init; use std::vec::{reverse}; use extra::sort::quick_sort3; static LINE_LEN: uin...
buf = buf.slice(1, buf.len()); if buf.len() == 0 { break; } if buf[0]!= (''as u8) && buf[0]!= ('\t' as u8) && buf[0]!= ('\n' as u8) && buf[0]!= 0 { break; } } buf } #[inline(never)] fn read_stdin() -> ~[u8] { unsafe { l...
TABLE[c] } fn next_char<'a>(mut buf: &'a [u8]) -> &'a [u8] { loop {
random_line_split
shootout-k-nucleotide.rs
// xfail-test extern mod extra; use std::cast::transmute; use std::i32::range; use std::libc::{STDIN_FILENO, c_int, fdopen, fgets, fileno, fopen, fstat}; use std::libc::{stat, strlen}; use std::ptr::null; use std::unstable::intrinsics::init; use std::vec::{reverse}; use extra::sort::quick_sort3; static LINE_LEN: uin...
reverse(result); str::from_bytes(result) } } // Hash table implementation trait TableCallback { fn f(&self, entry: &mut Entry); } struct BumpCallback; impl TableCallback for BumpCallback { fn f(&self, entry: &mut Entry) { entry.count += 1; } } struct PrintCallback(&'static...
{ let mut key = **self; let mut result = ~[]; for (frame as uint).times { result.push(unpack_symbol((key as u8) & 3)); key >>= 2; }
identifier_body
lib.rs
// DO NOT EDIT! // This file was generated automatically from'src/mako/api/lib.rs.mako' // DO NOT EDIT! //! This documentation was generated from *Shopping Content* crate version *0.1.8+20150528*, where *20150528* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code ...
//! let r = hub.accounts().get(...).doit() //! let r = hub.accounts().update(...).doit() //! let r = hub.accounts().list(...).doit() //! let r = hub.accounts().authinfo(...).doit() //! let r = hub.accounts().delete(...).doit() //! let r = hub.accounts().insert(...).doit() //! ``` //! //! The `resource()` and `activity...
//! ```ignore //! let r = hub.accounts().custombatch(...).doit() //! let r = hub.accounts().patch(...).doit()
random_line_split
many_single_char_names.rs
#![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)] #![warn(clippy::many_single_char_names)] fn bla() { let a: i32; let (b, c, d): (i32, i64, i16); { { let cdefg: i32; let blar: i32; } { let e: i32; } { ...
(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {} fn bindings2() { let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!(); } fn shadowing() { let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; ...
bindings
identifier_name
many_single_char_names.rs
#![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)] #![warn(clippy::many_single_char_names)] fn bla() { let a: i32; let (b, c, d): (i32, i64, i16); { { let cdefg: i32; let blar: i32; } { let e: i32; } { ...
} } } fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {} fn bindings2() { let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!(); } fn shadowing() { let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; let a...
random_line_split
many_single_char_names.rs
#![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)] #![warn(clippy::many_single_char_names)] fn bla() { let a: i32; let (b, c, d): (i32, i64, i16); { { let cdefg: i32; let blar: i32; } { let e: i32; } { ...
fn shadowing() { let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; let a = 0i32; { let a = 0i32; } } fn patterns() { enum Z { A(i32), B(i32), C(i32), D(i32), E(i32), F(i32), } // These should not ...
{ let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!(); }
identifier_body
plugin.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 ...
<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box<MacResult+'cx> { let name = match token_tree { [ast::TtToken(_, token::Ident(ref name, _))] => name, ...
expand_build_diagnostic_array
identifier_name
plugin.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 ...
"used diagnostic code {} not registered", &token::get_ident(code) )); } }); MacEager::expr(quote_expr!(ecx, ())) } pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_t...
{ let code = match token_tree { [ast::TtToken(_, token::Ident(code, _))] => code, _ => unreachable!() }; with_used_diagnostics(|diagnostics| { match diagnostics.insert(code.name, span) { Some(previous_span) => { ecx.span_warn(span, &format!( ...
identifier_body
plugin.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_tree: &[TokenTree]) -> Box<MacResult+'cx> { let name = match token_tree { [ast::TtToken(_, token::...
MacEager::items(SmallVector::many(vec![quote_item!(ecx, mod $sym {}).unwrap()])) }
random_line_split
multi.rs
//! # Multiple agent types //! Simple example of multiple types of agents. //! You can use an enum, where each variant is a different type of agent. //! Here we're just using fields on enum variants for state, but you could also define separate //! state structs that you wrap enum variants around. extern crate djinn; ...
} } updated } } fn main() { let sim = MultiSim {}; let world = World {}; // Setup the manager let addr = "redis://127.0.0.1/"; let pop_client = Client::open(addr).unwrap(); let mut manager = Manager::new(addr, pop_client, sim.clone()); // Spawn the populat...
{ let updated = updates.len() > 0; for update in updates { match *state { State::Cat(ref mut cat) => { match update { Update::Purr => { cat.purrs += 1; } _ ...
identifier_body
multi.rs
//! # Multiple agent types //! Simple example of multiple types of agents. //! You can use an enum, where each variant is a different type of agent. //! Here we're just using fields on enum variants for state, but you could also define separate //! state structs that you wrap enum variants around. extern crate djinn; ...
(&self, mut state: &mut Self::State, updates: Vec<Self::Update>) -> bool { let updated = updates.len() > 0; for update in updates { match *state { State::Cat(ref mut cat) => { match update { Update::Purr => { ...
update
identifier_name
multi.rs
//! # Multiple agent types //! Simple example of multiple types of agents. //! You can use an enum, where each variant is a different type of agent. //! Here we're just using fields on enum variants for state, but you could also define separate //! state structs that you wrap enum variants around. extern crate djinn; ...
fn decide<R: Redis>(&self, agent: &Agent<Self::State>, world: &Self::World, population: &Population<Self, R>, updates: &mut Updates<Self>) -> () { match agent.state { State::P...
impl Simulation for MultiSim { type State = State; type Update = Update; type World = World;
random_line_split
strategies.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 futures::{future, Future, Sink, Stream}; use futures::future::Loop; use libc; use std::error; use std::fmt::{self...
} impl error::Error for AuthError { fn description(&self) -> &str { match *self { AuthError::Io(ref err) => err.description(), AuthError::Rejected {.. } => "D-Bus authentication rejected", } } fn cause(&self) -> Option<&error::Error> { match *self { ...
{ match *self { AuthError::Io(ref err) => err.fmt(f), AuthError::Rejected { .. } => { write!(f, "Authentication attempt was rejected by the D-Bus server.") } } }
identifier_body
strategies.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 futures::{future, Future, Sink, Stream}; use futures::future::Loop; use libc; use std::error; use std::fmt::{self...
(err: AuthError) -> Self { match err { AuthError::Io(e) => e, AuthError::Rejected {.. } => { Error::new(ErrorKind::PermissionDenied, "D-Bus authentication rejected") } } } } impl From<Error> for AuthError { fn from(err: Error) -> Self { ...
from
identifier_name
strategies.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 futures::{future, Future, Sink, Stream}; use futures::future::Loop; use libc; use std::error; use std::fmt::{self...
Some(ServerCommand::Error) => Ok(Loop::Continue((auth, ClientCommand::Cancel))), Some(_) => Ok(Loop::Continue((auth, ClientCommand::Error(None)))), None => { Err((Error::new(ErrorKind::UnexpectedEof, ...
{ Err((AuthError::Rejected { supported_mechanisms: supported_mechanisms }, Some(auth))) }
conditional_block
strategies.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 futures::{future, Future, Sink, Stream}; use futures::future::Loop; use libc; use std::error; use std::fmt::{self...
fn cause(&self) -> Option<&error::Error> { match *self { AuthError::Io(ref err) => Some(err), AuthError::Rejected {.. } => None, } } } impl From<AuthError> for Error { fn from(err: AuthError) -> Self { match err { AuthError::Io(e) => e, ...
} }
random_line_split
extern-with-type-bounds.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 ...
{}
identifier_body
extern-with-type-bounds.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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(intrinsi...
//
random_line_split
extern-with-type-bounds.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 ...
() {}
main
identifier_name
main.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/. */ #![deny(unused_imports)] #![deny(unused_variables)] #![feature(box_syntax)] #![feature(convert)] // For FFI #![al...
}
random_line_split
main.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/. */ #![deny(unused_imports)] #![deny(unused_variables)] #![feature(box_syntax)] #![feature(convert)] // For FFI #![al...
() { env_logger::init().unwrap(); // Parse the command line options and store them globally if opts::from_cmdline_args(env::args().collect::<Vec<_>>().as_slice()) { resource_task::global_init(); let window = if opts::get().headless { None } else { Some(windo...
main
identifier_name
project.rs
// Examples to illustrate project loading extern crate r2api; extern crate r2pipe; extern crate radeco_lib; use r2api::api_trait::R2Api; use r2pipe::R2; use radeco_lib::frontend::radeco_containers::{FunctionLoader, ModuleLoader, ProjectLoader}; use radeco_lib::frontend::radeco_source::Source; use std::cell::RefCell;...
} } }
random_line_split
project.rs
// Examples to illustrate project loading extern crate r2api; extern crate r2pipe; extern crate radeco_lib; use r2api::api_trait::R2Api; use r2pipe::R2; use radeco_lib::frontend::radeco_containers::{FunctionLoader, ModuleLoader, ProjectLoader}; use radeco_lib::frontend::radeco_source::Source; use std::cell::RefCell;...
() { { let mut r2 = R2::new(Some("/bin/ls")).expect("Failed to load r2"); r2.analyze(); let src: Rc<Source> = Rc::new(Rc::new(RefCell::new(r2))); let p = ProjectLoader::default() .path("/bin/ls") .source(Rc::clone(&src)) .module_loader( ...
main
identifier_name
project.rs
// Examples to illustrate project loading extern crate r2api; extern crate r2pipe; extern crate radeco_lib; use r2api::api_trait::R2Api; use r2pipe::R2; use radeco_lib::frontend::radeco_containers::{FunctionLoader, ModuleLoader, ProjectLoader}; use radeco_lib::frontend::radeco_source::Source; use std::cell::RefCell;...
println!("{:#X}", rfn.function.0); } } } }
{ { let mut r2 = R2::new(Some("/bin/ls")).expect("Failed to load r2"); r2.analyze(); let src: Rc<Source> = Rc::new(Rc::new(RefCell::new(r2))); let p = ProjectLoader::default() .path("/bin/ls") .source(Rc::clone(&src)) .module_loader( ...
identifier_body
macro_example.rs
#[macro_use] extern crate nickel; extern crate regex; extern crate rustc_serialize; extern crate hyper; use std::io::Write; use nickel::status::StatusCode::{self, NotFound}; use nickel::{ Nickel, NickelError, Continue, Halt, Request, Response, MediaType, QueryString, JsonBody, StaticFilesHandler, MiddlewareRes...
server.handle_error(custom_handler); println!("Running server!"); server.listen("127.0.0.1:6767"); }
// issue #20178 let custom_handler: fn(&mut NickelError, &mut Request) -> Action = custom_404;
random_line_split
macro_example.rs
#[macro_use] extern crate nickel; extern crate regex; extern crate rustc_serialize; extern crate hyper; use std::io::Write; use nickel::status::StatusCode::{self, NotFound}; use nickel::{ Nickel, NickelError, Continue, Halt, Request, Response, MediaType, QueryString, JsonBody, StaticFilesHandler, MiddlewareRes...
} Continue(()) } fn main() { let mut server = Nickel::new(); // middleware is optional and can be registered with `utilize` server.utilize(logger); // go to http://localhost:6767/thoughtram_logo_brain.png to see static file serving in action server.utilize(StaticFilesHandler::new("examp...
{ let _ = res.write_all(b"<h1>Call the police!</h1>"); return Halt(()) }
conditional_block
macro_example.rs
#[macro_use] extern crate nickel; extern crate regex; extern crate rustc_serialize; extern crate hyper; use std::io::Write; use nickel::status::StatusCode::{self, NotFound}; use nickel::{ Nickel, NickelError, Continue, Halt, Request, Response, MediaType, QueryString, JsonBody, StaticFilesHandler, MiddlewareRes...
//this is how to overwrite the default error handler to handle 404 cases with a custom view fn custom_404<'a>(err: &mut NickelError, _req: &mut Request) -> Action { if let Some(ref mut res) = err.stream { if res.status() == NotFound { let _ = res.write_all(b"<h1>Call the police!</h1>"); ...
{ println!("logging request: {:?}", request.origin.uri); Ok(Continue(response)) }
identifier_body
macro_example.rs
#[macro_use] extern crate nickel; extern crate regex; extern crate rustc_serialize; extern crate hyper; use std::io::Write; use nickel::status::StatusCode::{self, NotFound}; use nickel::{ Nickel, NickelError, Continue, Halt, Request, Response, MediaType, QueryString, JsonBody, StaticFilesHandler, MiddlewareRes...
<'a>(err: &mut NickelError, _req: &mut Request) -> Action { if let Some(ref mut res) = err.stream { if res.status() == NotFound { let _ = res.write_all(b"<h1>Call the police!</h1>"); return Halt(()) } } Continue(()) } fn main() { let mut server = Nickel::new(); ...
custom_404
identifier_name
compound.rs
//! //! Shape composed from the union of primitives. //! use crate::bounding_volume::{BoundingVolume, AABB}; use crate::math::Isometry; use crate::partitioning::{BVHImpl, BVT}; use crate::query::{Contact, ContactKinematic, ContactPrediction, ContactPreprocessor}; use crate::shape::{CompositeShape, FeatureId, Shape, Sh...
fn map_part_and_preprocessor_at( &self, i: usize, m: &Isometry<N>, _prediction: &ContactPrediction<N>, f: &mut dyn FnMut(&Isometry<N>, &dyn Shape<N>, &dyn ContactPreprocessor<N>), ) { let elt = &self.shapes()[i]; let pos = m * elt.0; let proc = C...
{ let elt = &self.shapes()[i]; let pos = m * elt.0; f(&pos, elt.1.as_ref()) }
identifier_body
compound.rs
//! //! Shape composed from the union of primitives. //! use crate::bounding_volume::{BoundingVolume, AABB}; use crate::math::Isometry; use crate::partitioning::{BVHImpl, BVT}; use crate::query::{Contact, ContactKinematic, ContactPrediction, ContactPreprocessor}; use crate::shape::{CompositeShape, FeatureId, Shape, Sh...
/// The shapes bounding volumes. #[inline] pub fn bounding_volumes(&self) -> &[AABB<N>] { &self.bvs[..] } /// The AABB of the i-th shape compositing this compound. #[inline] pub fn aabb_at(&self, i: usize) -> &AABB<N> { &self.bvs[i] } /// Transforms a FeatureId of t...
}
random_line_split
compound.rs
//! //! Shape composed from the union of primitives. //! use crate::bounding_volume::{BoundingVolume, AABB}; use crate::math::Isometry; use crate::partitioning::{BVHImpl, BVT}; use crate::query::{Contact, ContactKinematic, ContactPrediction, ContactPreprocessor}; use crate::shape::{CompositeShape, FeatureId, Shape, Sh...
(&self, i: usize) -> AABB<N> { self.bounding_volumes()[i].clone() } #[inline] fn bvh(&self) -> BVHImpl<N, usize, AABB<N>> { BVHImpl::BVT(&self.bvt) } } struct CompoundContactProcessor<'a, N: RealField> { part_pos: &'a Isometry<N>, part_id: usize, nbits: usize, } impl<'a, N...
aabb_at
identifier_name
compound.rs
//! //! Shape composed from the union of primitives. //! use crate::bounding_volume::{BoundingVolume, AABB}; use crate::math::Isometry; use crate::partitioning::{BVHImpl, BVT}; use crate::query::{Contact, ContactKinematic, ContactPrediction, ContactPreprocessor}; use crate::shape::{CompositeShape, FeatureId, Shape, Sh...
else { kinematic.feature2() }; let actual_feature = match feature { FeatureId::Vertex(i) => FeatureId::Vertex((i << self.nbits) | self.part_id), #[cfg(feature = "dim3")] FeatureId::Edge(i) => FeatureId::Edge((i << self.nbits) | self.part_id), ...
{ kinematic.feature1() }
conditional_block
windowing.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/. */ //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. use embedder_t...
ToggleWebRenderDebug(WebRenderDebugOption), /// Capture current WebRender CaptureWebRender, } impl Debug for WindowEvent { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { match *self { WindowEvent::Idle => write!(f, "Idle"), WindowEvent::Refresh => write!(f, "Ref...
/// visible one. SelectBrowser(TopLevelBrowsingContextId), /// Toggles a debug flag in WebRender
random_line_split
windowing.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/. */ //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. use embedder_t...
WindowEvent::SelectBrowser(..) => write!(f, "SelectBrowser"), WindowEvent::ToggleWebRenderDebug(..) => write!(f, "ToggleWebRenderDebug"), WindowEvent::CaptureWebRender => write!(f, "CaptureWebRender"), } } } #[derive(Clone, Copy, Debug, PartialEq)] pub enum AnimationSta...
{ match *self { WindowEvent::Idle => write!(f, "Idle"), WindowEvent::Refresh => write!(f, "Refresh"), WindowEvent::Resize => write!(f, "Resize"), WindowEvent::Keyboard(..) => write!(f, "Keyboard"), WindowEvent::LoadUrl(..) => write!(f, "LoadUrl"), ...
identifier_body
windowing.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/. */ //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. use embedder_t...
{ Click(MouseButton, DevicePoint), MouseDown(MouseButton, DevicePoint), MouseUp(MouseButton, DevicePoint), } /// Various debug and profiling flags that WebRender supports. #[derive(Clone)] pub enum WebRenderDebugOption { Profiler, TextureCacheDebug, RenderTargetDebug, } /// Events that the wi...
MouseWindowEvent
identifier_name
sendable.rs
// Copyright 2015 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 ...
fn refresh(&self)->bool; // is this an account transfer type fn merge(&self, responses: Vec<Box<Sendable>>) -> Option<Box<Sendable>>; }
{ Option::None }
identifier_body
sendable.rs
// Copyright 2015 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 ...
(&self)->Option<name_type::NameType> { Option::None } fn refresh(&self)->bool; // is this an account transfer type fn merge(&self, responses: Vec<Box<Sendable>>) -> Option<Box<Sendable>>; }
owner
identifier_name
sendable.rs
// Copyright 2015 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 ...
/// passed to routing, refresh / account transfer is optional /// The name will let routing know its a NaeManager and the owner will allow routing to hash /// the requesters ID with this name (by hashing the requesters ID) for put and post messages pub trait Sendable { fn name(&self)->name_type::NameType; fn ty...
use name_type; /// This trait is required for any type of message to be
random_line_split
missing-allocator.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
// option. This file may not be copied, modified, or distributed // except according to those terms. // compile-flags: -C panic=abort // no-prefer-dynamic #![no_std] #![crate_type = "staticlib"] #![feature(panic_handler, alloc_error_handler, alloc)] #[panic_handler] fn panic(_: &core::panic::PanicInfo) ->! { loo...
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
random_line_split
missing-allocator.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 ...
(_: &core::panic::PanicInfo) ->! { loop {} } #[alloc_error_handler] fn oom(_: core::alloc::Layout) ->! { loop {} } extern crate alloc;
panic
identifier_name
missing-allocator.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 ...
extern crate alloc;
{ loop {} }
identifier_body
lib.rs
extern crate racer_interner; #[macro_use] extern crate serde; extern crate serde_json; pub mod mapping; pub mod metadata; use crate::metadata::Metadata; use std::env; use std::error::Error; use std::fmt; use std::io; use std::path::{Path, PathBuf}; use std::process::Command; use std::str::Utf8Error; #[derive(Debug)]...
(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { ErrorKind::Encode(e) => fmt::Display::fmt(e, f), ErrorKind::Json(e) => fmt::Display::fmt(e, f), ErrorKind::Io(e) => fmt::Display::fmt(e, f), ErrorKind::Subprocess(s) => write!(f, "stderr: {}", s), ...
fmt
identifier_name
lib.rs
extern crate racer_interner; #[macro_use] extern crate serde; extern crate serde_json; pub mod mapping; pub mod metadata; use crate::metadata::Metadata; use std::env; use std::error::Error; use std::fmt; use std::io; use std::path::{Path, PathBuf}; use std::process::Command; use std::str::Utf8Error; #[derive(Debug)]...
} impl From<serde_json::Error> for ErrorKind { fn from(e: serde_json::Error) -> ErrorKind { ErrorKind::Json(e) } } impl From<io::Error> for ErrorKind { fn from(e: io::Error) -> ErrorKind { ErrorKind::Io(e) } } pub fn find_manifest(mut current: &Path) -> Option<PathBuf> { let file...
{ ErrorKind::Encode(e) }
identifier_body
lib.rs
extern crate racer_interner; #[macro_use] extern crate serde; extern crate serde_json; pub mod mapping; pub mod metadata; use crate::metadata::Metadata; use std::env; use std::error::Error; use std::fmt; use std::io; use std::path::{Path, PathBuf};
use std::str::Utf8Error; #[derive(Debug)] pub enum ErrorKind { Encode(Utf8Error), Json(serde_json::Error), Io(io::Error), Subprocess(String), } impl fmt::Display for ErrorKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { ErrorKind::Encode(e) => fmt::Dis...
use std::process::Command;
random_line_split
transaction_info_test.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::*; use crate::DiemDB; use diem_temppath::TempPath; use proptest::{collection::vec, prelude::*}; fn verify( store: &LedgerStore, txn_infos: &[TransactionInfo], first_version: Version, ledger_version: Version, ...
#[test] fn test_transaction_info_put_get_verify( batch1 in vec(any::<TransactionInfo>(), 1..100), batch2 in vec(any::<TransactionInfo>(), 1..100), ) { let tmp_dir = TempPath::new(); let db = DiemDB::new_for_test(&tmp_dir); let store = &db.ledger_store; // in...
#![proptest_config(ProptestConfig::with_cases(10))]
random_line_split
transaction_info_test.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::*; use crate::DiemDB; use diem_temppath::TempPath; use proptest::{collection::vec, prelude::*}; fn verify( store: &LedgerStore, txn_infos: &[TransactionInfo], first_version: Version, ledger_version: Version, ...
}) } fn save(store: &LedgerStore, first_version: Version, txn_infos: &[TransactionInfo]) -> HashValue { let mut cs = ChangeSet::new(); let root_hash = store .put_transaction_infos(first_version, &txn_infos, &mut cs) .unwrap(); store.db.write_schemas(cs.batch).unwrap(); root_hash ...
{ txn_infos .iter() .enumerate() .for_each(|(idx, expected_txn_info)| { let version = first_version + idx as u64; let txn_info_with_proof = store .get_transaction_info_with_proof(version, ledger_version) .unwrap(); assert_...
identifier_body
transaction_info_test.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::*; use crate::DiemDB; use diem_temppath::TempPath; use proptest::{collection::vec, prelude::*}; fn
( store: &LedgerStore, txn_infos: &[TransactionInfo], first_version: Version, ledger_version: Version, root_hash: HashValue, ) { txn_infos .iter() .enumerate() .for_each(|(idx, expected_txn_info)| { let version = first_version + idx as u64; let txn_i...
verify
identifier_name
server.rs
// TODO: Implement a reader and writer from the client / server relationship. // Then try and get clients to talk to everyone -> specific clients. // Once that's done, move on to formatting messages via tokio::Encode / Decode. // Example TCP #[allow(unused_imports)] use std::net::SocketAddr; use std::collections::{Has...
{ clients: Rc<RefCell<HashMap<UserID, mpsc::UnboundedSender<Stanza>>>>, #[allow(dead_code)] groups: Rc<RefCell<HashMap<UserID, mpsc::UnboundedSender<Stanza>>>>, channel: (mpsc::UnboundedSender<Stanza>, mpsc::UnboundedReceiver<Stanza>), core: Core, addr: SocketAddr, } // Ixnay on the private cl...
TctServer
identifier_name
server.rs
// TODO: Implement a reader and writer from the client / server relationship. // Then try and get clients to talk to everyone -> specific clients. // Once that's done, move on to formatting messages via tokio::Encode / Decode. // Example TCP #[allow(unused_imports)] use std::net::SocketAddr; use std::collections::{Has...
/// Execute the server, runs in foreground for any application... /// This is a temporary design to get something off the ground. pub fn run(&mut self) { let socket = TcpListener::bind(&self.addr, &self.core.handle().clone()).unwrap(); let handle = self.core.handle(); l...
{ let core = Core::new().unwrap(); TctServer { // Odd way of doing this but yeah, core needs to be defined after // channel. channel: mpsc::unbounded(), core: core, addr: addr, groups: Rc::new(RefCell::new(HashMap::new())), ...
identifier_body
server.rs
// TODO: Implement a reader and writer from the client / server relationship. // Then try and get clients to talk to everyone -> specific clients. // Once that's done, move on to formatting messages via tokio::Encode / Decode. // Example TCP #[allow(unused_imports)] use std::net::SocketAddr; use std::collections::{Has...
} }
self.core.run(server).unwrap();
random_line_split