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
tray.rs
//! This modules only contains a function to create a tray icon. extern crate systray; extern crate tempfile; use std::sync::{Arc, Mutex}; use library::Queue; use command::Command; /// Creates a tray icon with some buttons to send commands to the server. pub fn
(queue: &Arc<Mutex<Queue>>) { if let Ok(mut tray) = systray::Application::new() { // This is stupid, but I have no other way to do this // Read the icon file at compilation into an array... const BYTES: &[u8] = include_bytes!("../assets/icons/icon.ico"); //... then write this icon f...
start_tray
identifier_name
debug.rs
/*! */ use backend::Facade; use context::Context; use ContextExt; use version::Api; use version::Version; use gl; use std::rc::Rc; pub use context::DebugCallbackBehavior; /// Represents a callback that can be used for the debug output feature of OpenGL. /// /// The first three parameters are self-explanatory. The ...
} /// Source of a debug message. #[derive(Clone, Copy, Debug)] #[repr(u32)] pub enum Source { /// Calls to the OpenGL API. Api = gl::DEBUG_SOURCE_API, /// Calls to a window-system API. WindowSystem = gl::DEBUG_SOURCE_WINDOW_SYSTEM, /// A compiler for a shading language. ShaderCompiler = gl::D...
/// or highly-dangerous undefined behavior. High = gl::DEBUG_SEVERITY_HIGH,
random_line_split
debug.rs
/*! */ use backend::Facade; use context::Context; use ContextExt; use version::Api; use version::Version; use gl; use std::rc::Rc; pub use context::DebugCallbackBehavior; /// Represents a callback that can be used for the debug output feature of OpenGL. /// /// The first three parameters are self-explanatory. The ...
{ /// Calls to the OpenGL API. Api = gl::DEBUG_SOURCE_API, /// Calls to a window-system API. WindowSystem = gl::DEBUG_SOURCE_WINDOW_SYSTEM, /// A compiler for a shading language. ShaderCompiler = gl::DEBUG_SOURCE_SHADER_COMPILER, /// An application associated with Openctxt.gl. ThirdP...
Source
identifier_name
debug.rs
/*! */ use backend::Facade; use context::Context; use ContextExt; use version::Api; use version::Version; use gl; use std::rc::Rc; pub use context::DebugCallbackBehavior; /// Represents a callback that can be used for the debug output feature of OpenGL. /// /// The first three parameters are self-explanatory. The ...
else if ctxt.extensions.gl_ext_disjoint_timer_query { unsafe { let mut value = 0; ctxt.gl.GetQueryObjectui64vEXT(self.id, gl::QUERY_RESULT_EXT, &mut value); ctxt.gl.DeleteQueriesEXT(1, [self.id].as_ptr()); value } } else {...
{ // TODO: extension unsafe { let mut value = 0; ctxt.gl.GetQueryObjectui64v(self.id, gl::QUERY_RESULT, &mut value); ctxt.gl.DeleteQueries(1, [self.id].as_ptr()); value } }
conditional_block
mod.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 unimpl() -> IoError { IoError { kind: old_io::IoUnavailable, desc: "operations not yet supported", detail: None, } } // unix has nonzero values as errors pub fn mkerr_libc<T: Int>(ret: T) -> IoResult<()> { if ret!= Int::zero() { Err(last_error()) } else { ...
{ IoError { kind: if n == 0 { old_io::TimedOut } else { old_io::ShortWrite(n) }, desc: desc, detail: None, } }
identifier_body
mod.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 ...
, desc: desc, detail: None, } } pub fn unimpl() -> IoError { IoError { kind: old_io::IoUnavailable, desc: "operations not yet supported", detail: None, } } // unix has nonzero values as errors pub fn mkerr_libc<T: Int>(ret: T) -> IoResult<()> { if ret!= Int::zer...
{ old_io::ShortWrite(n) }
conditional_block
mod.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 ...
(_: uint, _: uint) { } pub unsafe fn record_rust_managed_stack_bounds(_: uint, _: uint) { } pub unsafe fn record_sp_limit(limit: uint) { } pub unsafe fn get_sp_limit() -> uint { 1024 } } // common error constructors pub fn eof() -> IoError { IoError { kind: old_io::EndO...
record_os_managed_stack_bounds
identifier_name
mod.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 timeout(desc: &'static str) -> IoError { IoError { kind: old_io::TimedOut, desc: desc, detail: None, } } pub fn short_write(n: uint, desc: &'static str) -> IoError { IoError { kind: if n == 0 { old_io::TimedOut } else { old_io::ShortWrite(n) }, desc: desc, ...
desc: "end of file", detail: None, }
random_line_split
lib.rs
#![warn(missing_docs)] //! Actor-like concurrency for rust. #[macro_use] extern crate log; #[cfg(feature = "channel")] pub mod channel; #[cfg(feature = "thread")] pub mod thread; #[cfg(feature = "jobsteal")] extern crate jobsteal; #[cfg(feature = "jobsteal")] pub mod js_pool; #[cfg(test)] pub mod tests; use std...
}; ActorRef(variant) } } /// Reason for failed send. #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum SendErrorReason { /// Message cannot be sent because the message /// buffer is full. Full, /// Message cannot be sent because the recipient /// is not reachable anymore. Unreachable, /// Unknown Erro...
&ActorRefEnum::DedicatedThread(ref cell) => ActorRefEnum::DedicatedThread(cell.clone()), #[cfg(feature = "jobsteal")] &ActorRefEnum::InJobStealPool(ref cell) => ActorRefEnum::InJobStealPool(cell.clone()),
random_line_split
lib.rs
#![warn(missing_docs)] //! Actor-like concurrency for rust. #[macro_use] extern crate log; #[cfg(feature = "channel")] pub mod channel; #[cfg(feature = "thread")] pub mod thread; #[cfg(feature = "jobsteal")] extern crate jobsteal; #[cfg(feature = "jobsteal")] pub mod js_pool; #[cfg(test)] pub mod tests; use std...
{ /// Message cannot be sent because the message /// buffer is full. Full, /// Message cannot be sent because the recipient /// is not reachable anymore. Unreachable, /// Unknown Error Unknown, } #[derive(PartialEq, Eq, Clone, Copy)] /// Error for attempted send. pub struct SendError<Message>(SendErrorReason,...
SendErrorReason
identifier_name
regions-early-bound-used-in-type-param.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 http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Tests that yo...
random_line_split
regions-early-bound-used-in-type-param.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let b1 = Box { t: &3 }; assert_eq!(add(b1, b1), 6); }
main
identifier_name
regions-early-bound-used-in-type-param.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ let b1 = Box { t: &3 }; assert_eq!(add(b1, b1), 6); }
identifier_body
instr_pmovzxwq.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 pmovzxwq_1() {
#[test] fn pmovzxwq_2() { run_test(&Instruction { mnemonic: Mnemonic::PMOVZXWQ, operand1: Some(Direct(XMM1)), operand2: Some(IndirectScaledDisplaced(ESI, Eight, 68842024, Some(OperandSize::Dword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, bro...
run_test(&Instruction { mnemonic: Mnemonic::PMOVZXWQ, operand1: Some(Direct(XMM4)), operand2: Some(Direct(XMM7)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 56, 52, 231], OperandSize::Dword) }
random_line_split
instr_pmovzxwq.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
() { run_test(&Instruction { mnemonic: Mnemonic::PMOVZXWQ, operand1: Some(Direct(XMM4)), operand2: Some(Direct(XMM7)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 56, 52, 231], OperandSize::Dword) } #[test] fn pmovzxwq_2(...
pmovzxwq_1
identifier_name
instr_pmovzxwq.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 pmovzxwq_1()
#[test] fn pmovzxwq_2() { run_test(&Instruction { mnemonic: Mnemonic::PMOVZXWQ, operand1: Some(Direct(XMM1)), operand2: Some(IndirectScaledDisplaced(ESI, Eight, 68842024, Some(OperandSize::Dword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, b...
{ run_test(&Instruction { mnemonic: Mnemonic::PMOVZXWQ, operand1: Some(Direct(XMM4)), operand2: Some(Direct(XMM7)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 56, 52, 231], OperandSize::Dword) }
identifier_body
media_queries.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/. */ //! Servo's media-query device and expression representation. use app_units::Au; use context::QuirksMode; use css...
(&self, device: &Device, quirks_mode: QuirksMode) -> bool { let viewport_size = device.au_viewport_size(); let value = viewport_size.width; match self.0 { ExpressionKind::Width(ref range) => { match range.to_computed_range(device, quirks_mode) { Ra...
matches
identifier_name
media_queries.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/. */ //! Servo's media-query device and expression representation. use app_units::Au; use context::QuirksMode; use css...
, Range::Eq(ref width) => { value == *width }, } } } } } impl ToCss for Expression { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write, { write!(dest, "(")?; let (mm, l) = match self.0 { Expressio...
{ value <= *width }
conditional_block
media_queries.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/. */ //! Servo's media-query device and expression representation. use app_units::Au; use context::QuirksMode; use css...
Size2D::new(Au::from_f32_px(self.viewport_size.width), Au::from_f32_px(self.viewport_size.height)) } /// Returns the viewport size in pixels. #[inline] pub fn px_viewport_size(&self) -> TypedSize2D<f32, CSSPixel> { self.viewport_size } /// Returns the device...
/// Returns the viewport size of the current device in app units, needed, /// among other things, to resolve viewport units. #[inline] pub fn au_viewport_size(&self) -> Size2D<Au> {
random_line_split
media_queries.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/. */ //! Servo's media-query device and expression representation. use app_units::Au; use context::QuirksMode; use css...
/// Return the media type of the current device. pub fn media_type(&self) -> MediaType { self.media_type.clone() } /// Returns whether document colors are enabled. pub fn use_document_colors(&self) -> bool { true } /// Returns the default background color. pub fn defa...
{ self.viewport_size = constraints.size; }
identifier_body
weird-exprs.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 funny() { fn f(_x: ()) { } f(return); } fn what() { fn the(x: @mut bool) { return while!*x { *x = true; }; } let i = @mut false; let dont = {||the(i)}; dont(); assert!((*i)); } fn zombiejesus() { loop { while (return) { if (return) { match (retu...
{ let _x: bool = return true; }
identifier_body
weird-exprs.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 f(_x: ()) { } f(return); } fn what() { fn the(x: @mut bool) { return while!*x { *x = true; }; } let i = @mut false; let dont = {||the(i)}; dont(); assert!((*i)); } fn zombiejesus() { loop { while (return) { if (return) { match (return) { ...
funny
identifier_name
weird-exprs.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
let mut _y = (_x = 0) == (_x = 0); let mut _z = (_x = 0) < (_x = 0); let _a = (_x += 0) == (_x = 0); let _b = util::swap(&mut _y, &mut _z) == util::swap(&mut _y, &mut _z); } fn canttouchthis() -> uint { fn p() -> bool { true } let _a = (assert!((true)) == (assert!(p()))); let _c = (assert!(...
fn notsure() { let mut _x;
random_line_split
main.rs
// Pitot - a customizable aviation information receiver // Copyright (C) 2017-2018 Datong Sun (dndx@idndx.com) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the Lice...
}); p.link_processor(processor::ownship::Ownship::new()); p.link_processor(Box::new(processor::clock::Clock::new()) as Box<Processor>); p.link_processor(Box::new(processor::traffic::Traffic::new()) as Box<Processor>); p.link_processor(Box::new(processor::fisb::FISB::new()) as Box<Processor>); p...
{ env_logger::init().unwrap(); let mut p = Pitot::new(10); // 10 Hz sensor::gnss::ublox::UbloxGNSSProvider::new().and_then(&mut |g| { p.link_sensor(g); Some(()) }); sensor::barometer::bmp280::BMP280BaroProvider::new().and_then(&mut |b| { p.link_sensor(b); Some(()) ...
identifier_body
main.rs
// Pitot - a customizable aviation information receiver // Copyright (C) 2017-2018 Datong Sun (dndx@idndx.com) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the Lice...
// along with this program. If not, see <http://www.gnu.org/licenses/>. #[macro_use] extern crate log; extern crate chrono; extern crate env_logger; extern crate serial; #[macro_use] extern crate nom; extern crate serde_json; extern crate time; #[macro_use] extern crate serde_derive; extern crate i2cdev_bmp280; exter...
// // You should have received a copy of the GNU General Public License
random_line_split
main.rs
// Pitot - a customizable aviation information receiver // Copyright (C) 2017-2018 Datong Sun (dndx@idndx.com) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the Lice...
() { env_logger::init().unwrap(); let mut p = Pitot::new(10); // 10 Hz sensor::gnss::ublox::UbloxGNSSProvider::new().and_then(&mut |g| { p.link_sensor(g); Some(()) }); sensor::barometer::bmp280::BMP280BaroProvider::new().and_then(&mut |b| { p.link_sensor(b); Some(()...
main
identifier_name
mod.rs
// libovgu-canteen - A canteen parser module for ovgu. // // Copyright (C) 2017 // Fin Christensen <christensen.fin@gmail.com> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either ve...
pub mod price; pub mod symbol;
//! This module holds unit tests for `libovgu-canteen`. pub mod additive; pub mod allergenic;
random_line_split
vi_insert.rs
//! Vi insert mode specific key bindings use super::assert_cursor; use crate::config::EditMode; use crate::keys::KeyEvent as E; #[test] fn insert_mode_by_default() { assert_cursor(EditMode::Vi, ("", ""), &[E::from('a'), E::ENTER], ("a", "")); } #[test]
("H", ""), ); } #[test] fn backspace() { assert_cursor(EditMode::Vi, ("", ""), &[E::BACKSPACE, E::ENTER], ("", "")); assert_cursor( EditMode::Vi, ("Hi", ""), &[E::BACKSPACE, E::ENTER], ("H", ""), ); assert_cursor( EditMode::Vi, ("", "Hi"), ...
fn ctrl_h() { assert_cursor( EditMode::Vi, ("Hi", ""), &[E::ctrl('H'), E::ENTER],
random_line_split
vi_insert.rs
//! Vi insert mode specific key bindings use super::assert_cursor; use crate::config::EditMode; use crate::keys::KeyEvent as E; #[test] fn insert_mode_by_default()
#[test] fn ctrl_h() { assert_cursor( EditMode::Vi, ("Hi", ""), &[E::ctrl('H'), E::ENTER], ("H", ""), ); } #[test] fn backspace() { assert_cursor(EditMode::Vi, ("", ""), &[E::BACKSPACE, E::ENTER], ("", "")); assert_cursor( EditMode::Vi, ("Hi", ""), ...
{ assert_cursor(EditMode::Vi, ("", ""), &[E::from('a'), E::ENTER], ("a", "")); }
identifier_body
vi_insert.rs
//! Vi insert mode specific key bindings use super::assert_cursor; use crate::config::EditMode; use crate::keys::KeyEvent as E; #[test] fn insert_mode_by_default() { assert_cursor(EditMode::Vi, ("", ""), &[E::from('a'), E::ENTER], ("a", "")); } #[test] fn
() { assert_cursor( EditMode::Vi, ("Hi", ""), &[E::ctrl('H'), E::ENTER], ("H", ""), ); } #[test] fn backspace() { assert_cursor(EditMode::Vi, ("", ""), &[E::BACKSPACE, E::ENTER], ("", "")); assert_cursor( EditMode::Vi, ("Hi", ""), &[E::BACKSPACE, ...
ctrl_h
identifier_name
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::...
}; elem.set_attribute_from_parser(name, DOMString::from(String::from(attr.value)), None); } JS::from_ref(elem.upcast()) } fn create_comment(&mut self, text: StrTendril) -> JS<Node> { let comment = Comment::new(DOMString::from(String::from(text)), &*self.document...
for attr in attrs { let name = QualName { ns: Namespace(attr.name.namespace_url), local: attr.name.local,
random_line_split
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::...
(&mut self) -> JS<Node> { JS::from_ref(self.document.upcast()) } fn elem_name(&self, target: &JS<Node>) -> QName { let elem = target.downcast::<Element>() .expect("tried to get name of non-Element in XML parsing"); QName { prefix: elem.prefix().as_ref().map_or(ato...
get_document
identifier_name
xml.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/. */ #![allow(unrooted_must_root)] use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::...
fn create_element(&mut self, name: QName, attrs: Vec<Attribute>) -> JS<Node> { let prefix = if name.prefix == atom!("") { None } else { Some(name.prefix) }; let name = QualName { ns: Namespace(name.namespace_url), local: name.local, }; let elem =...
{ let elem = target.downcast::<Element>() .expect("tried to get name of non-Element in XML parsing"); QName { prefix: elem.prefix().as_ref().map_or(atom!(""), |p| Atom::from(&**p)), namespace_url: elem.namespace().0.clone(), local: elem.local_name().clone(...
identifier_body
store.rs
use std::ascii::AsciiExt; use std::collections::HashSet; use folder::Folder; use message::Flag; use message::parse_flag; use self::StoreName::{Add, Replace, Sub}; use super::sequence_set; /// Representation of a STORE operation pub enum StoreName { Replace, // replace current flags with new flags Add, // add...
// Set the silent flag if it is present. If there is something else // instead of the word "silent", a BAD response should be sent to the // client. let silent = match silent_part { None => false, Some(part) => { if part == "silent" { true } else ...
{ if store_args.len() < 3 { return None; } // Parse the sequence set argument let sequence_set_opt = sequence_set::parse(store_args[0].trim_matches('"')); // Grab how to handle the flags. It should be case insensitive. let data_name = store_args[1].trim_matches('"').to_ascii_lowercase(); // Sp...
identifier_body
store.rs
use std::ascii::AsciiExt; use std::collections::HashSet; use folder::Folder; use message::Flag; use message::parse_flag; use self::StoreName::{Add, Replace, Sub}; use super::sequence_set; /// Representation of a STORE operation pub enum StoreName { Replace, // replace current flags with new flags Add, // add...
(folder: &mut Folder, store_args: &[&str], seq_uid: bool, tag: &str) -> Option<String> { if store_args.len() < 3 { return None; } // Parse the sequence set argument let sequence_set_opt = sequence_set::parse(store_args[0].trim_matches('"')); // Grab how to handle the flags. It should b...
store
identifier_name
store.rs
use std::ascii::AsciiExt; use std::collections::HashSet; use folder::Folder; use message::Flag; use message::parse_flag; use self::StoreName::{Add, Replace, Sub}; use super::sequence_set; /// Representation of a STORE operation pub enum StoreName { Replace, // replace current flags with new flags Add, // add...
let data_name = store_args[1].trim_matches('"').to_ascii_lowercase(); // Split into "flag" part and "silent" part. let mut data_name_parts = (&data_name[..]).split('.'); let flag_part = data_name_parts.next(); let silent_part = data_name_parts.next(); // There shouldn't be any more parts to th...
// Parse the sequence set argument let sequence_set_opt = sequence_set::parse(store_args[0].trim_matches('"')); // Grab how to handle the flags. It should be case insensitive.
random_line_split
lib.rs
// #![allow(dead_code)] extern crate timely; extern crate time; extern crate mmap; use std::rc::Rc; use timely::dataflow::*; use timely::dataflow::operators::*; use timely::dataflow::channels::pact::Exchange; use timely::ExchangeData as Data; pub mod graph; mod typedrw; pub use typedrw::TypedMemoryMap; // Algorit...
type Prefix; type Extension; // these are the parts required for the join algorithm fn count(&self, &Self::Prefix) -> u64; fn propose(&self, &Self::Prefix, &mut Vec<Self::Extension>); fn intersect(&self, &Self::Prefix, &mut Vec<Self::Extension>); // these are needed to tell timely dataflow...
random_line_split
lib.rs
// #![allow(dead_code)] extern crate timely; extern crate time; extern crate mmap; use std::rc::Rc; use timely::dataflow::*; use timely::dataflow::operators::*; use timely::dataflow::channels::pact::Exchange; use timely::ExchangeData as Data; pub mod graph; mod typedrw; pub use typedrw::TypedMemoryMap; // Algorit...
<E: Data>(self, extenders: Vec<&StreamPrefixExtender<G, Prefix=P, Extension=E>>) -> Stream<G, (P, Vec<E>)> { let mut counts = self.map(|p| (p, 1 << 31, 0)); for (index,extender) in extenders.iter().enumerate() { counts = extender.count(counts, index as u64); } let p...
extend
identifier_name
lib.rs
// #![allow(dead_code)] extern crate timely; extern crate time; extern crate mmap; use std::rc::Rc; use timely::dataflow::*; use timely::dataflow::operators::*; use timely::dataflow::channels::pact::Exchange; use timely::ExchangeData as Data; pub mod graph; mod typedrw; pub use typedrw::TypedMemoryMap; // Algorit...
} }) } fn intersect(&self, stream: Stream<G, (Self::Prefix, Vec<Self::Extension>)>) -> Stream<G, (Self::Prefix, Vec<Self::Extension>)> { let logic = self.logic(); let clone = self.clone(); let exch = Exchange::new(move |&(ref x,_)| (*logic)(x)); let mut vecto...
{ break; }
conditional_block
lib.rs
// #![allow(dead_code)] extern crate timely; extern crate time; extern crate mmap; use std::rc::Rc; use timely::dataflow::*; use timely::dataflow::operators::*; use timely::dataflow::channels::pact::Exchange; use timely::ExchangeData as Data; pub mod graph; mod typedrw; pub use typedrw::TypedMemoryMap; // Algorit...
} }
{ let mut counts = self.map(|p| (p, 1 << 31, 0)); for (index,extender) in extenders.iter().enumerate() { counts = extender.count(counts, index as u64); } let parts = counts.partition(extenders.len() as u64, |(p, _, i)| (i, p)); let mut results = Vec::new(); ...
identifier_body
asm-out-assign-imm.rs
// Copyright 2012-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 // <LICEN...
{}
identifier_body
asm-out-assign-imm.rs
// Copyright 2012-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 // <LICEN...
(x: int) { println!("{}", x); } #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")] #[cfg(target_arch = "arm")] pub fn main() { let x: int; x = 1; //~ NOTE prior assignment occurs here foo(x); unsafe { asm!("mov $1, $0" : "=r"(x) : "r"(5u)); //~ ERROR re-assignment of immutable variable ...
foo
identifier_name
asm-out-assign-imm.rs
// Copyright 2012-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 // <LICEN...
foo(x); } #[cfg(not(target_arch = "x86"), not(target_arch = "x86_64"), not(target_arch = "arm"))] pub fn main() {}
x = 1; //~ NOTE prior assignment occurs here foo(x); unsafe { asm!("mov $1, $0" : "=r"(x) : "r"(5u)); //~ ERROR re-assignment of immutable variable `x` }
random_line_split
local.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 ...
#[inline] unsafe fn unsafe_borrow() -> *mut Task { local_ptr::unsafe_borrow() } #[inline] unsafe fn try_unsafe_borrow() -> Option<*mut Task> { local_ptr::try_unsafe_borrow() } } #[cfg(test)] mod test { use std::prelude::*; use std::rt::thread::Thread; use super::*; use task:...
local_ptr::borrow::<Task>() } } #[inline] unsafe fn unsafe_take() -> Box<Task> { local_ptr::unsafe_take() }
random_line_split
local.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] fn borrow_with_return() { Thread::start(proc() { let task = box Task::new(); Local::put(task); { let _ = Local::borrow(None::<Task>); } let task: Box<Task> = Local::take(); cleanup_task(task); })....
{ Thread::start(proc() { let task = box Task::new(); Local::put(task); unsafe { let _task: *mut Task = Local::unsafe_borrow(); } let task: Box<Task> = Local::take(); cleanup_task(task); }).join(); }
identifier_body
local.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 ...
() -> Option<*mut Task> { local_ptr::try_unsafe_borrow() } } #[cfg(test)] mod test { use std::prelude::*; use std::rt::thread::Thread; use super::*; use task::Task; #[test] fn thread_local_task_smoke_test() { Thread::start(proc() { let task = box Task::new(); ...
try_unsafe_borrow
identifier_name
p69.rs
#[deriving(Clone)] #[deriving(Eq)] enum BinaryTree<T> { Node(T, ~BinaryTree<T>, ~BinaryTree<T>), Empty } impl std::fmt::Show for BinaryTree<char> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn aux(tree: BinaryTree<char>) -> ~str { match tree { Empt...
(dotstring: ~str) -> BinaryTree<char> { fn aux(dotstring: &mut std::str::Chars) -> BinaryTree<char> { match dotstring.next() { Some('.') => Empty, Some( c ) => Node(c, ~aux(dotstring), ~aux(dotstring)), None => fail!("invalid argument for dotstring_to_tree") ...
dotstring_to_tree
identifier_name
p69.rs
#[deriving(Clone)] #[deriving(Eq)] enum BinaryTree<T> { Node(T, ~BinaryTree<T>, ~BinaryTree<T>), Empty } impl std::fmt::Show for BinaryTree<char> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn aux(tree: BinaryTree<char>) -> ~str { match tree { Empt...
Empty => ~"." } } fn dotstring_to_tree(dotstring: ~str) -> BinaryTree<char> { fn aux(dotstring: &mut std::str::Chars) -> BinaryTree<char> { match dotstring.next() { Some('.') => Empty, Some( c ) => Node(c, ~aux(dotstring), ~aux(dotstring)), None => fail!...
// node ::= <label> <node> <node> | '.' fn tree_to_dotstring(tree: BinaryTree<char>) -> ~str { match tree { Node(c, ~left, ~right) => std::str::from_char(c) + tree_to_dotstring(left) + tree_to_dotstring(right),
random_line_split
p69.rs
#[deriving(Clone)] #[deriving(Eq)] enum BinaryTree<T> { Node(T, ~BinaryTree<T>, ~BinaryTree<T>), Empty } impl std::fmt::Show for BinaryTree<char> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { fn aux(tree: BinaryTree<char>) -> ~str { match tree { Empt...
fn dotstring_to_tree(dotstring: ~str) -> BinaryTree<char> { fn aux(dotstring: &mut std::str::Chars) -> BinaryTree<char> { match dotstring.next() { Some('.') => Empty, Some( c ) => Node(c, ~aux(dotstring), ~aux(dotstring)), None => fail!("invalid argument for dotstr...
{ match tree { Node(c, ~left, ~right) => std::str::from_char(c) + tree_to_dotstring(left) + tree_to_dotstring(right), Empty => ~"." } }
identifier_body
trait-to-str.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...
} pub fn main() { assert_eq!(1.to_string_(), "1".to_string()); assert_eq!((vec!(2, 3, 4)).to_string_(), "[2, 3, 4]".to_string()); fn indirect<T:to_str>(x: T) -> String { format!("{}!", x.to_string_()) } assert_eq!(indirect(vec!(10, 20)), "[10, 20]!".to_string()); fn indirect2<T:to_st...
{ format!("[{}]", self.iter() .map(|e| e.to_string_()) .collect::<Vec<String>>() .connect(", ")) }
identifier_body
trait-to-str.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!(indirect(vec!(10, 20)), "[10, 20]!".to_string()); fn indirect2<T:to_str>(x: T) -> String { indirect(x) } assert_eq!(indirect2(vec!(1)), "[1]!".to_string()); }
random_line_split
trait-to-str.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!(1.to_string_(), "1".to_string()); assert_eq!((vec!(2, 3, 4)).to_string_(), "[2, 3, 4]".to_string()); fn indirect<T:to_str>(x: T) -> String { format!("{}!", x.to_string_()) } assert_eq!(indirect(vec!(10, 20)), "[10, 20]!".to_string()); fn indirect2<T:to_str>(x: T) -> Str...
main
identifier_name
decompositions.rs
use traits::operations::{Transpose, ApproxEq}; use traits::structure::{ColSlice, Eye, Indexable, Diag, SquareMat, BaseFloat}; use traits::geometry::Norm; use std::cmp::min; use std::ops::{Mul, Add, Sub}; /// Get the householder matrix corresponding to a reflexion to the hyperplane /// defined by `vec`. It can be a ref...
, V, VS, M>(m: &M) -> Result<M, &'static str> where N: BaseFloat, VS: Indexable<usize, N> + Norm<N>, M: Indexable<(usize, usize), N> + SquareMat<N, V> + Add<M, Output = M> + Sub<M, Output = M> + ColSlice<VS> + ApproxEq<N> + Copy { let mut out = m.clone().transp...
olesky<N
identifier_name
decompositions.rs
use traits::operations::{Transpose, ApproxEq}; use traits::structure::{ColSlice, Eye, Indexable, Diag, SquareMat, BaseFloat}; use traits::geometry::Norm; use std::cmp::min; use std::ops::{Mul, Add, Sub}; /// Get the householder matrix corresponding to a reflexion to the hyperplane /// defined by `vec`. It can be a ref...
} } for i in 0.. out.nrows() { for j in i + 1.. out.ncols() { out[(i, j)] = N::zero(); } } return Ok(out); }
return Err("Cholesky: Input matrix is not positive definite to machine precision"); }
conditional_block
decompositions.rs
use traits::operations::{Transpose, ApproxEq}; use traits::structure::{ColSlice, Eye, Indexable, Diag, SquareMat, BaseFloat}; use traits::geometry::Norm; use std::cmp::min; use std::ops::{Mul, Add, Sub}; /// Get the householder matrix corresponding to a reflexion to the hyperplane /// defined by `vec`. It can be a ref...
/// QR decomposition using Householder reflections. /// /// # Arguments /// * `m` - matrix to decompose pub fn qr<N, V, M>(m: &M) -> (M, M) where N: BaseFloat, V: Indexable<usize, N> + Norm<N>, M: Copy + Eye + ColSlice<V> + Transpose + Indexable<(usize, usize), N> + Mul<M, Output =...
let mut qk : M = Eye::new_identity(dim); let subdim = vec.shape(); let stop = subdim + start; assert!(dim >= stop); for j in (start .. stop) { for i in (start .. stop) { unsafe { let vv = vec.unsafe_at(i - start) * vec.unsafe_at(j - start); let...
identifier_body
decompositions.rs
use traits::operations::{Transpose, ApproxEq}; use traits::structure::{ColSlice, Eye, Indexable, Diag, SquareMat, BaseFloat}; use traits::geometry::Norm; use std::cmp::min; use std::ops::{Mul, Add, Sub}; /// Get the householder matrix corresponding to a reflexion to the hyperplane /// defined by `vec`. It can be a ref...
} } for i in 0.. out.nrows() { for j in i + 1.. out.ncols() { out[(i, j)] = N::zero(); } } return Ok(out); }
random_line_split
fp12.rs
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
(&self, other: &FP12) -> bool { return (self.a == other.a) && (self.b == other.b) && (self.c == other.c); } } impl fmt::Display for FP12 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "FP12: [ {}, {}, {} ]", self.a, self.b, self.c) } } impl fmt::Debug for FP12 { fn fmt(&self, f: &mut...
eq
identifier_name
fp12.rs
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
mt.add(&t[i]); mt.norm(); } c.conj(); let nb=1+mt.nbits(); /* convert exponent to signed 1-bit window */ for j in 0..nb { for i in 0..4 { a[i]=(t[i].lastbits(2)-2) as i8; t[i].dec(a[i] as isize); t[i].norm(); t[i].fshr(1); } w[j]=8*a[0]+4*a[1]+2*a[2]+a[3]; } w[nb]=(8*t[0].lastbits(...
{ t[i].inc(1); t[i].norm(); c.mul(&mut q[i]); }
conditional_block
fp12.rs
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
} p.mul(&mut c); /* apply correction */ p.reduce(); return p; } } /* fn main() { let mut w=FP12::new(); } */
p.mul(&mut s[(m&1) as usize]);
random_line_split
fp12.rs
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
} impl fmt::Debug for FP12 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "FP12: [ {}, {}, {} ]", self.a, self.b, self.c) } } impl FP12 { pub fn new() -> FP12 { FP12 { a: FP4::new(), b: FP4::new(), c: FP4::new() } } pub fn new_int(a: isize) -> FP12 { let mut f=FP12::new...
{ write!(f, "FP12: [ {}, {}, {} ]", self.a, self.b, self.c) }
identifier_body
mod.rs
//! Implementations of `Trace` and associated traits. //! //! The `Trace` trait provides access to an ordered collection of `(key, val, time, diff)` tuples, but //! there is substantial flexibility in implementations of this trait. Depending on characteristics of //! the data, we may wish to represent the data in dif...
// pub mod rhh; // pub mod rhh_k;
pub use self::batcher::RadixBatcher as Batcher; pub mod ord; pub mod hash;
random_line_split
lang-item-public.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 ...
{ loop {} }
identifier_body
lang-item-public.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 ...
extern crate core; extern crate libc; #[lang = "stack_exhausted"] extern fn stack_exhausted() {} #[lang = "eh_personality"] extern fn eh_personality() {} #[lang = "panic_fmt"] extern fn rust_begin_unwind(msg: core::fmt::Arguments, file: &'static str, line: u32) ->! { loop {} }
// except according to those terms. #![feature(no_std, core, libc)] #![no_std] #![feature(lang_items)]
random_line_split
lang-item-public.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 ...
() {} #[lang = "panic_fmt"] extern fn rust_begin_unwind(msg: core::fmt::Arguments, file: &'static str, line: u32) ->! { loop {} }
eh_personality
identifier_name
record.rs
use super::{function, general, trait_impls}; use crate::{ analysis::{self, record_type::RecordType, special_functions::Type}, env::Env, library, traits::MaybeRef, }; use std::io::{Result, Write}; pub fn generate(w: &mut dyn Write, env: &Env, analysis: &analysis::record::Info) -> Result<()> { let ty...
else { panic!( "Record {} has record_boxed=true but don't have glib:get_type function", analysis.name ); } } else if let (Some(ref_fn), Some(unref_fn)) = ( analysis.specials.traits().get(&Type::Ref), analysis.specials.traits().get(&Typ...
{ general::define_auto_boxed_type( w, env, &analysis.name, &type_.c_type, analysis.boxed_inline, &analysis.init_function_expression, &analysis.copy_into_function_expression, &analy...
conditional_block
record.rs
use super::{function, general, trait_impls}; use crate::{ analysis::{self, record_type::RecordType, special_functions::Type}, env::Env, library, traits::MaybeRef, }; use std::io::{Result, Write}; pub fn generate(w: &mut dyn Write, env: &Env, analysis: &analysis::record::Info) -> Result<()> { let ty...
general::define_shared_type( w, env, &analysis.name, &type_.c_type, &ref_fn.glib_name, &unref_fn.glib_name, analysis.glib_get_type.as_ref().map(|(f, v)| { if v > &analysis.version { (f.clone()...
random_line_split
record.rs
use super::{function, general, trait_impls}; use crate::{ analysis::{self, record_type::RecordType, special_functions::Type}, env::Env, library, traits::MaybeRef, }; use std::io::{Result, Write}; pub fn
(w: &mut dyn Write, env: &Env, analysis: &analysis::record::Info) -> Result<()> { let type_ = analysis.type_(&env.library); general::start_comments(w, &env.config)?; general::uses(w, env, &analysis.imports, type_.version)?; if RecordType::of(env.type_(analysis.type_id).maybe_ref().unwrap()) == RecordT...
generate
identifier_name
record.rs
use super::{function, general, trait_impls}; use crate::{ analysis::{self, record_type::RecordType, special_functions::Type}, env::Env, library, traits::MaybeRef, }; use std::io::{Result, Write}; pub fn generate(w: &mut dyn Write, env: &Env, analysis: &analysis::record::Info) -> Result<()> { let ty...
contents.push(format!( "{}{} use self::{}::{};", cfg, analysis.visibility.export_visibility(), module_name, analysis.name )); }
{ let cfg_condition = general::cfg_condition_string(analysis.cfg_condition.as_ref(), false, 0); let version_cfg = general::version_condition_string( env, Some(analysis.type_id.ns_id), analysis.version, false, 0, ); let mut cfg = String::new(); if let Some(s) =...
identifier_body
identifiers.rs
pub enum ChannelID { PrivateReserved, Classic, Connectionless, AMPManagerProtocol, AttributeProtocol, Signaling, SMP, PublicReserved(u16), AMPTest, ConnectionOriented(u16), OutOfRangeIDError(u16) } impl ChannelID { pub fn from_u16(id: u16) -> ChannelID { match id...
ChannelID::PrivateReserved => 0x00, ChannelID::Classic => 0x01, ChannelID::Connectionless => 0x02, ChannelID::AMPManagerProtocol => 0x03, ChannelID::AttributeProtocol => 0x04, ChannelID::Signaling => 0x05, ChannelID::SMP => 0x06, ...
} } pub fn to_u16(&self) -> u16 { match *self {
random_line_split
identifiers.rs
pub enum ChannelID { PrivateReserved, Classic, Connectionless, AMPManagerProtocol, AttributeProtocol, Signaling, SMP, PublicReserved(u16), AMPTest, ConnectionOriented(u16), OutOfRangeIDError(u16) } impl ChannelID { pub fn from_u16(id: u16) -> ChannelID { match id...
}
{ match *self { ChannelID::PrivateReserved => 0x00, ChannelID::Classic => 0x01, ChannelID::Connectionless => 0x02, ChannelID::AMPManagerProtocol => 0x03, ChannelID::AttributeProtocol => 0x04, ChannelID::Signaling => 0x05, Channe...
identifier_body
identifiers.rs
pub enum
{ PrivateReserved, Classic, Connectionless, AMPManagerProtocol, AttributeProtocol, Signaling, SMP, PublicReserved(u16), AMPTest, ConnectionOriented(u16), OutOfRangeIDError(u16) } impl ChannelID { pub fn from_u16(id: u16) -> ChannelID { match id { 0x0...
ChannelID
identifier_name
lib.rs
//! This crate allows connecting to a 3DS that's running NTR CFW with the debugger enabled, and //! then reading and writing to the 3DS's RAM. #![warn(missing_copy_implementations, missing_debug_implementations, missing_docs, unused_extern_crates, unused_import_braces, unused_qualifications)] extern crate byteord...
} }); } Ok(Connection { ntr_sender: ntr_sender, mem_read_rx: mem_read_rx, get_pid_rx: get_pid_rx, }) } /// Returns the process identifier for the currently running title id `tid`. /// /// You can find ...
{ let mut data_buf = vec![0u8; data_len].into_boxed_slice(); tcp_stream.read_exact(&mut data_buf).unwrap(); if cmd == 0 { let msg = String::from_utf8_lossy(&data_buf); if let Some(_) = msg.fi...
conditional_block
lib.rs
//! This crate allows connecting to a 3DS that's running NTR CFW with the debugger enabled, and //! then reading and writing to the 3DS's RAM. #![warn(missing_copy_implementations, missing_debug_implementations, missing_docs, unused_extern_crates, unused_import_braces, unused_qualifications)] extern crate byteord...
(&mut self, addr: u32, pid: u32) -> io::Result<i8> { Ok(self.mem_read(addr, 1, pid)?[0] as i8) } /// Writes a `u32` to 3DS memory. pub fn write_u32(&mut self, addr: u32, data: u32, pid: u32) -> io::Result<()> { let buf = &mut vec![0u8; 4]; LittleEndian::write_u32(buf, data); ...
read_i8
identifier_name
lib.rs
//! This crate allows connecting to a 3DS that's running NTR CFW with the debugger enabled, and //! then reading and writing to the 3DS's RAM. #![warn(missing_copy_implementations, missing_debug_implementations, missing_docs, unused_extern_crates, unused_import_braces, unused_qualifications)] extern crate byteord...
/// Reads a `u16` from 3DS memory. pub fn read_u16(&mut self, addr: u32, pid: u32) -> io::Result<u16> { Ok(LittleEndian::read_u16(&self.mem_read(addr, 2, pid)?)) } /// Reads a `u8` from 3DS memory. pub fn read_u8(&mut self, addr: u32, pid: u32) -> io::Result<u8> { Ok(self.mem_read...
{ Ok(LittleEndian::read_u32(&self.mem_read(addr, 4, pid)?)) }
identifier_body
lib.rs
//! This crate allows connecting to a 3DS that's running NTR CFW with the debugger enabled, and //! then reading and writing to the 3DS's RAM. #![warn(missing_copy_implementations, missing_debug_implementations, missing_docs, unused_extern_crates, unused_import_braces, unused_qualifications)] extern crate byteord...
if let Some(_) = msg.find("end of process list.") { get_pid_tx.send(msg.into_owned()).unwrap(); } } else if cmd == 9 { mem_read_tx.send(data_buf).unwrap(); ...
let msg = String::from_utf8_lossy(&data_buf);
random_line_split
periodic.rs
use std::time::{Duration, Instant}; use std::thread; use std::sync::{Arc, Mutex, Condvar}; use poller::Poller; pub struct AsyncPeriodicRunner { terminate: Arc<(Mutex<bool>, Condvar)>, thread: Option<thread::JoinHandle<()>> } impl AsyncPeriodicRunner { pub fn new<P: Poller +'static>(poller: P, poll_period:...
}; return result; } } impl Drop for AsyncPeriodicRunner { fn drop(&mut self) { let &(ref l, ref cvar) = &*self.terminate; { let mut terminate = l.lock().unwrap(); *terminate = true; cvar.notify_one(); } println!("Waiting fo...
random_line_split
periodic.rs
use std::time::{Duration, Instant}; use std::thread; use std::sync::{Arc, Mutex, Condvar}; use poller::Poller; pub struct AsyncPeriodicRunner { terminate: Arc<(Mutex<bool>, Condvar)>, thread: Option<thread::JoinHandle<()>> } impl AsyncPeriodicRunner { pub fn new<P: Poller +'static>(poller: P, poll_period...
}
{ let &(ref l, ref cvar) = &*self.terminate; { let mut terminate = l.lock().unwrap(); *terminate = true; cvar.notify_one(); } println!("Waiting for poller thread to exit..."); if let Some(h) = self.thread.take() { h.join().unwrap();...
identifier_body
periodic.rs
use std::time::{Duration, Instant}; use std::thread; use std::sync::{Arc, Mutex, Condvar}; use poller::Poller; pub struct AsyncPeriodicRunner { terminate: Arc<(Mutex<bool>, Condvar)>, thread: Option<thread::JoinHandle<()>> } impl AsyncPeriodicRunner { pub fn
<P: Poller +'static>(poller: P, poll_period: Duration) -> AsyncPeriodicRunner { let terminate_arc = Arc::new((Mutex::new(false), Condvar::new())); let result = AsyncPeriodicRunner{ terminate: terminate_arc.clone(), thread: Some(thread::spawn(move || -> () { le...
new
identifier_name
periodic.rs
use std::time::{Duration, Instant}; use std::thread; use std::sync::{Arc, Mutex, Condvar}; use poller::Poller; pub struct AsyncPeriodicRunner { terminate: Arc<(Mutex<bool>, Condvar)>, thread: Option<thread::JoinHandle<()>> } impl AsyncPeriodicRunner { pub fn new<P: Poller +'static>(poller: P, poll_period...
; } }
{ h.join().unwrap(); }
conditional_block
main.rs
use amethyst::{ core::transform::TransformBundle, input::{InputBundle, StringBindings}, prelude::*, renderer::{ plugins::{RenderFlat2D, RenderToWindow}, types::DefaultBackend, RenderingBundle, }, utils::application_root_dir, }; mod pong; mod systems; use crate::pong::Pon...
.with_bundle(TransformBundle::new())? .with_bundle(input_bundle)? .with(systems::PaddleSystem, "paddle_system", &["input_system"]); let assets_dir = app_root.join("assets"); let mut game = Application::new(assets_dir, Pong, game_data)?; game.run(); Ok(()) } /* struct MyState; i...
{ amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; let display_config_path = app_root.join("config").join("display.ron"); let binding_path = app_root.join("config").join("bindings.ron"); let input_bundle = InputBundle::<StringBindings>::new() .with_b...
identifier_body
main.rs
use amethyst::{ core::transform::TransformBundle, input::{InputBundle, StringBindings}, prelude::*, renderer::{ plugins::{RenderFlat2D, RenderToWindow}, types::DefaultBackend, RenderingBundle, }, utils::application_root_dir, }; mod pong; mod systems; use crate::pong::Pon...
) .with_plugin(RenderFlat2D::default()), )? .with_bundle(TransformBundle::new())?; let mut game = Application::new(assets_dir, MyState, game_data)?; game.run(); Ok(()) } */
RenderToWindow::from_config_path(display_config_path)? .with_clear([0.34, 0.36, 0.52, 1.0]),
random_line_split
main.rs
use amethyst::{ core::transform::TransformBundle, input::{InputBundle, StringBindings}, prelude::*, renderer::{ plugins::{RenderFlat2D, RenderToWindow}, types::DefaultBackend, RenderingBundle, }, utils::application_root_dir, }; mod pong; mod systems; use crate::pong::Pon...
() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; let display_config_path = app_root.join("config").join("display.ron"); let binding_path = app_root.join("config").join("bindings.ron"); let input_bundle = InputBundle::<StringBindi...
main
identifier_name
roll.rs
// rouler - A container-based system for generating die rolls // Copyright (C) 2016 by John Berry // // 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 std::cmp::Or...
}
{ write!(f, "[{}: {}]", self.roll, self.total) }
identifier_body
roll.rs
// rouler - A container-based system for generating die rolls // Copyright (C) 2016 by John Berry // // 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 std::cmp::Or...
(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "[{}: {}]", self.roll, self.total) } }
fmt
identifier_name
roll.rs
// rouler - A container-based system for generating die rolls // Copyright (C) 2016 by John Berry // // 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 std::cmp::Or...
/// assert!(roll_dice_or_fail("food4").is_err()) /// ``` pub fn roll_dice_or_fail(r: &str) -> Result<i64, Error<impl RuleType>> { let parser = RollParser::parse(Rule::calc, r); parser.map(compute) } /// A function for safely creating a new `Roller` without panicking. /// /// Takes a `&str` input and if the syn...
/// ``` /// use rouler::roll_dice_or_fail; /// /// assert!(roll_dice_or_fail("6d6").is_ok());
random_line_split
shootout-mandelbrot.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // Copyright (c) 2012-2014 The Rust Project Developers // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted...
<W: Write>(w: usize, mut out: W) -> io::Result<()> { assert!(WORKERS % 2 == 0); // Ensure w and h are multiples of 8. let w = (w + 7) / 8 * 8; let h = w; let chunk_size = h / WORKERS; // Account for remainders in workload division, e.g. 1000 / 16 = 62.5 let last_chunk_size = if h % WORKER...
mandelbrot
identifier_name
shootout-mandelbrot.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // Copyright (c) 2012-2014 The Rust Project Developers // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted...
let v_consts = f64x2(1.5, 1.0); // A lot of this code assumes this (so do other lang benchmarks) assert!(w == h); let mut precalc_r = Vec::with_capacity(w); let mut precalc_i = Vec::with_capacity(h); let precalc_futures = (0..WORKERS).map(|i| { thread::spawn(move|| { let mu...
{ assert!(WORKERS % 2 == 0); // Ensure w and h are multiples of 8. let w = (w + 7) / 8 * 8; let h = w; let chunk_size = h / WORKERS; // Account for remainders in workload division, e.g. 1000 / 16 = 62.5 let last_chunk_size = if h % WORKERS != 0 { chunk_size + h % WORKERS } els...
identifier_body
shootout-mandelbrot.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // Copyright (c) 2012-2014 The Rust Project Developers // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted...
; res.unwrap(); }
{ mandelbrot(args.nth(1).unwrap().parse().unwrap(), io::stdout()) }
conditional_block
shootout-mandelbrot.rs
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // Copyright (c) 2012-2014 The Rust Project Developers // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted...
}).collect::<Vec<_>>(); for res in precalc_futures { let (rs, is) = res.join().unwrap(); precalc_r.extend(rs); precalc_i.extend(is); } assert_eq!(precalc_r.len(), w); assert_eq!(precalc_i.len(), h); let arc_init_r = Arc::new(precalc_r); let arc_init_i = Arc::new(pr...
(rs, is) })
random_line_split
stability.rs
; /// A stability index, giving the stability level for items and methods. pub struct Index { // Indicates whether this crate has #![feature(staged_api)] staged_api: bool, // stability for crate-local items; unmarked stability == no entry local: NodeMap<Stability>, // cache for extern-crate items; ...
fn is_staged_api(tcx: &ty::ctxt, id: DefId) -> bool { match ty::trait_item_of_item(tcx, id) { Some(ty::MethodTraitItemId(trait_method_id)) if trait_method_id!= id => { is_staged_api(tcx, trait_method_id) } _ if is_local(id) => { tcx.stability.bor...
{ tcx.sess.codemap().span_is_internal(span) }
identifier_body
stability.rs
replace; /// A stability index, giving the stability level for items and methods. pub struct Index { // Indicates whether this crate has #![feature(staged_api)] staged_api: bool, // stability for crate-local items; unmarked stability == no entry local: NodeMap<Stability>, // cache for extern-crate ...
} None => { // This is an 'unmarked' API, which should not exist // in the standard library. if self.tcx.sess.features.borrow().unmarked_api { self.tcx.sess.span_warn(span, "use of unmarked library feature"); ...
// handled by a lint.
random_line_split
stability.rs
; /// A stability index, giving the stability level for items and methods. pub struct Index { // Indicates whether this crate has #![feature(staged_api)] staged_api: bool, // stability for crate-local items; unmarked stability == no entry local: NodeMap<Stability>, // cache for extern-crate items; ...
(&mut self, item: &ast::Item) { // When compiling with --test we don't enforce stability on the // compiler-generated test module, demarcated with `DUMMY_SP` plus the // name `__test` if item.span == DUMMY_SP && item.ident.as_str() == "__test" { return } check_item(self.tcx, ite...
visit_item
identifier_name
margin.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% from data import ALL_SIDES, maybe_moz_logical_alias %> <...
logical_group="scroll-margin", spec="https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-margin-%s" % side[0], animation_value_type="ComputedValue", )} % endfor
"Length", "computed::Length::zero()", engines="gecko", logical=side[1],
random_line_split
amd64.rs
// Copyright 2015 Ted Mielczarek. See the COPYRIGHT // file at the top-level directory of this distribution. // Note since x86 and Amd64 have basically the same ABI, this implementation // is written to largely erase the details of the two wherever possible, // so that it can be copied between the two with minimal cha...
(ptr: Pointer) -> bool { // x64 has the notion of a "canonical address", as a result of only 48 bits // of a pointer actually being used, because this is all that a 4-level page // table can support. A canonical address copies bit 47 to all the otherwise // unused high bits. This creates two ranges wher...
is_non_canonical
identifier_name
amd64.rs
// Copyright 2015 Ted Mielczarek. See the COPYRIGHT // file at the top-level directory of this distribution. // Note since x86 and Amd64 have basically the same ABI, this implementation // is written to largely erase the details of the two wherever possible, // so that it can be copied between the two with minimal cha...
}; use std::collections::HashSet; type Pointer = u64; const POINTER_WIDTH: Pointer = 8; const INSTRUCTION_REGISTER: &str = "rip"; const STACK_POINTER_REGISTER: &str = "rsp"; const FRAME_POINTER_REGISTER: &str = "rbp"; // FIXME: rdi and rsi are also preserved on windows (but not in sysv) -- we should handle that? const...
use minidump::{ MinidumpContext, MinidumpContextValidity, MinidumpMemory, MinidumpModuleList, MinidumpRawContext,
random_line_split
amd64.rs
// Copyright 2015 Ted Mielczarek. See the COPYRIGHT // file at the top-level directory of this distribution. // Note since x86 and Amd64 have basically the same ABI, this implementation // is written to largely erase the details of the two wherever possible, // so that it can be copied between the two with minimal cha...
else { default_scan_range }; for i in 0..scan_range { let address_of_ip = last_sp + i * POINTER_WIDTH; let caller_ip = stack_memory.get_memory_at_address(address_of_ip as u64)?; if instruction_seems_valid(caller_ip, modules, symbol_provider) { // ip is pushed by CAL...
{ extended_scan_range }
conditional_block
amd64.rs
// Copyright 2015 Ted Mielczarek. See the COPYRIGHT // file at the top-level directory of this distribution. // Note since x86 and Amd64 have basically the same ABI, this implementation // is written to largely erase the details of the two wherever possible, // so that it can be copied between the two with minimal cha...
fn get_caller_by_scan<P>( ctx: &CONTEXT_AMD64, valid: &MinidumpContextValidity, trust: FrameTrust, stack_memory: &MinidumpMemory, modules: &MinidumpModuleList, symbol_provider: &P, ) -> Option<StackFrame> where P: SymbolProvider, { // Stack scanning is just walking from the end of the ...
{ match valid { MinidumpContextValidity::All => CALLEE_SAVED_REGS.iter().copied().collect(), MinidumpContextValidity::Some(ref which) => CALLEE_SAVED_REGS .iter() .filter(|&reg| which.contains(reg)) .copied() .collect(), } }
identifier_body
cabi_x86_64.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...
_ => panic!("ty_align: unhandled type") } } fn ty_size(ty: Type) -> uint { match ty.kind() { Integer => (ty.int_width() as uint + 7) / 8, Pointer => 8, Float => 4, Double => 8, Struct => { let str_tys = ty.f...
let len = ty.vector_length(); let elt = ty.element_type(); ty_align(elt) * len }
random_line_split
cabi_x86_64.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...
(ty: Type) -> uint { match ty.kind() { Integer => ((ty.int_width() as uint) + 7) / 8, Pointer => 8, Float => 4, Double => 8, Struct => { if ty.is_packed() { 1 } else { let str_tys = ty.field_t...
ty_align
identifier_name
cabi_x86_64.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...
Array => { let elt = ty.element_type(); ty_align(elt) } Vector => { let len = ty.vector_length(); let elt = ty.element_type(); ty_align(elt) * len } _ => panic!("ty_align: unhandle...
{ fn align(off: uint, ty: Type) -> uint { let a = ty_align(ty); return (off + a - 1u) / a * a; } fn ty_align(ty: Type) -> uint { match ty.kind() { Integer => ((ty.int_width() as uint) + 7) / 8, Pointer => 8, Float => 4, Double => 8, ...
identifier_body