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
dom_html_html_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::DOMElement; use crate::DOMEventTarget; use crate::DOMHTMLElement; use crate::DOMNode; use crate::DOMObject; use glib::object::Cast; use glib::object::IsA; use glib::si...
f.write_str("DOMHTMLHtmlElement") } }
random_line_split
dom_html_html_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::DOMElement; use crate::DOMEventTarget; use crate::DOMHTMLElement; use crate::DOMNode; use crate::DOMObject; use glib::object::Cast; use glib::object::IsA; use glib::si...
<P, F: Fn(&P) +'static>( this: *mut ffi::WebKitDOMHTMLHtmlElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<DOMHTMLHtmlElement>, { let f: &F = &*(f as *const F); f(&DOMHTMLHtmlElement::from_glib_borro...
notify_version_trampoline
identifier_name
dom_html_html_element.rs
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::DOMElement; use crate::DOMEventTarget; use crate::DOMHTMLElement; use crate::DOMNode; use crate::DOMObject; use glib::object::Cast; use glib::object::IsA; use glib::si...
) } } } impl fmt::Display for DOMHTMLHtmlElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("DOMHTMLHtmlElement") } }
{ unsafe extern "C" fn notify_version_trampoline<P, F: Fn(&P) + 'static>( this: *mut ffi::WebKitDOMHTMLHtmlElement, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<DOMHTMLHtmlElement>, { let f: &F = &*(f as *con...
identifier_body
armv7s_apple_ios.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 ...
() -> Target { Target { llvm_target: "armv7s-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), arch: "arm".to_string(), target_os: "ios".to_string(), target_env: "".to_string(), options: TargetOptions { ...
target
identifier_name
armv7s_apple_ios.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 ...
{ Target { llvm_target: "armv7s-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), arch: "arm".to_string(), target_os: "ios".to_string(), target_env: "".to_string(), options: TargetOptions { feature...
identifier_body
armv7s_apple_ios.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 ...
Target { llvm_target: "armv7s-apple-ios".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), arch: "arm".to_string(), target_os: "ios".to_string(), target_env: "".to_string(), options: TargetOptions { features:...
use super::apple_ios_base::{opts, Arch}; pub fn target() -> Target {
random_line_split
mod.rs
use crate::c_str; use crate::graphic::{GlBuffer, GlProgram, GlProgramBuilder, GlUniform, GlVertexArray}; use crate::opengl; use nalgebra::{Isometry3, Matrix4, Point3}; use opengl::types::{GLsizeiptr, GLuint}; use std::ffi::c_void; use std::mem; use std::rc::Rc; mod layer; mod read_write; pub use layer::TerrainLayer...
.geometry_shader(TERRAIN_GEOMETRY_SHADER) .fragment_shader(TERRAIN_FRAGMENT_SHADER) .build(); // TODO(nnmm): If our initial position as returned by local_from_global is very different // from (0, 0, 0), the first call to camera_changed() will be very resourc...
I::Item: AsRef<std::path::Path>, { let program = GlProgramBuilder::new_with_vertex_shader(Rc::clone(&gl), TERRAIN_VERTEX_SHADER)
random_line_split
mod.rs
use crate::c_str; use crate::graphic::{GlBuffer, GlProgram, GlProgramBuilder, GlUniform, GlVertexArray}; use crate::opengl; use nalgebra::{Isometry3, Matrix4, Point3}; use opengl::types::{GLsizeiptr, GLuint}; use std::ffi::c_void; use std::mem; use std::rc::Rc; mod layer; mod read_write; pub use layer::TerrainLayer...
( program: &GlProgram, vertex_array: &GlVertexArray, gl: Rc<opengl::Gl>, ) -> (GlBuffer, GlBuffer, usize) { let num_vertices = (GRID_SIZE + 1) * (GRID_SIZE + 1) * 3; let mut vertices: Vec<i32> = Vec::with_capacity(num_vertices as usize); for iy in 0..=GRID_SIZE as i32...
create_mesh
identifier_name
mod.rs
use crate::c_str; use crate::graphic::{GlBuffer, GlProgram, GlProgramBuilder, GlUniform, GlVertexArray}; use crate::opengl; use nalgebra::{Isometry3, Matrix4, Point3}; use opengl::types::{GLsizeiptr, GLuint}; use std::ffi::c_void; use std::mem; use std::rc::Rc; mod layer; mod read_write; pub use layer::TerrainLayer...
indices.push(flat_ix(ix + 1, iy)); indices.push(flat_ix(ix, iy + 1)); indices.push(flat_ix(ix + 1, iy + 1)); } } // See https://learnopengl.com/Getting-started/Hello-Triangle, section // "Vertex Array Object" for background on buffers...
{ let num_vertices = (GRID_SIZE + 1) * (GRID_SIZE + 1) * 3; let mut vertices: Vec<i32> = Vec::with_capacity(num_vertices as usize); for iy in 0..=GRID_SIZE as i32 { for ix in 0..=GRID_SIZE as i32 { vertices.push(ix); vertices.push(iy); ...
identifier_body
mod.rs
use crate::c_str; use crate::graphic::{GlBuffer, GlProgram, GlProgramBuilder, GlUniform, GlVertexArray}; use crate::opengl; use nalgebra::{Isometry3, Matrix4, Point3}; use opengl::types::{GLsizeiptr, GLuint}; use std::ffi::c_void; use std::mem; use std::rc::Rc; mod layer; mod read_write; pub use layer::TerrainLayer...
unsafe { self.vertex_array.bind(); // Switch from the point cloud rendering shader to terrain shader self.program.gl.UseProgram(self.program.id); // Activate wireframe mode self.program .gl .PolygonMode(opengl::FRONT_AND_...
{ return; }
conditional_block
stop.rs
use async_trait::async_trait; use cucumber::given; use mimir::adapters::secondary::elasticsearch::remote::connection_test_pool; use mimir::domain::ports::secondary::remote::Remote; use snafu::ResultExt; use crate::error::{self, Error}; use crate::state::{GlobalState, State, Step, StepStatus}; use crate::steps::admin::...
{ pub region: String, pub dataset: String, } #[async_trait(?Send)] impl Step for IndexNTFS { async fn execute(&mut self, state: &State) -> Result<StepStatus, Error> { let Self { region, dataset } = self; let client = connection_test_pool() .conn(ElasticsearchStorageConfig::defa...
IndexNTFS
identifier_name
stop.rs
use async_trait::async_trait; use cucumber::given; use mimir::adapters::secondary::elasticsearch::remote::connection_test_pool; use mimir::domain::ports::secondary::remote::Remote; use snafu::ResultExt; use crate::error::{self, Error}; use crate::state::{GlobalState, State, Step, StepStatus}; use crate::steps::admin::...
#[async_trait(?Send)] impl Step for IndexNTFS { async fn execute(&mut self, state: &State) -> Result<StepStatus, Error> { let Self { region, dataset } = self; let client = connection_test_pool() .conn(ElasticsearchStorageConfig::default_testing()) .await .expect("C...
pub struct IndexNTFS { pub region: String, pub dataset: String, }
random_line_split
core.rs
/* Copyright (C) 2017 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
{} /// Extern functions operating on Flow. extern { pub fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64); } /// Rust implementation of Flow. impl Flow { /// Return the time of the last flow update as a `Duration` /// since the epoch. pub fn get_last_time(&mut self) -> std::tim...
Flow
identifier_name
core.rs
/* Copyright (C) 2017 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
} } /// AppLayerDecoderEventsSetEventRaw wrapper. pub fn sc_app_layer_decoder_events_set_event_raw( events: *mut *mut AppLayerDecoderEvents, event: u8) { unsafe { if let Some(c) = SC { (c.AppLayerDecoderEventsSetEventRaw)(events, event); } } } /// AppLayerDecoderEventsFree...
{ (c.DetectEngineStateFree)(state); }
conditional_block
core.rs
/* Copyright (C) 2017 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
/// Opaque flow type (defined in C) pub enum Flow {} /// Extern functions operating on Flow. extern { pub fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64); } /// Rust implementation of Flow. impl Flow { /// Return the time of the last flow update as a `Duration` /// since the epo...
{ unsafe { if let Some(c) = SC { (c.AppLayerDecoderEventsFreeEvents)(events); } } }
identifier_body
core.rs
/* Copyright (C) 2017 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
// // Function types for calls into C. // #[allow(non_snake_case)] pub type SCLogMessageFunc = extern "C" fn(level: std::os::raw::c_int, filename: *const std::os::raw::c_char, line: std::os::raw::c_uint, function: *const std::os::raw::c_char, ...
}
random_line_split
cargo_doc.rs
use std::collections::HashSet; use std::fs; use std::path::Path; use std::process::Command; use core::PackageIdSpec; use core::source::Source; use ops; use sources::PathSource; use util::{CargoResult, human}; pub struct DocOptions<'a, 'b: 'a> { pub open_result: bool, pub compile_opts: ops::CompileOptions<'a, ...
let package = try!(source.root_package()); let mut lib_names = HashSet::new(); let mut bin_names = HashSet::new(); if options.compile_opts.spec.is_none() { for target in package.targets().iter().filter(|t| t.documented()) { if target.is_lib() { assert!(lib_names.inse...
try!(source.update());
random_line_split
cargo_doc.rs
use std::collections::HashSet; use std::fs; use std::path::Path; use std::process::Command; use core::PackageIdSpec; use core::source::Source; use ops; use sources::PathSource; use util::{CargoResult, human}; pub struct DocOptions<'a, 'b: 'a> { pub open_result: bool, pub compile_opts: ops::CompileOptions<'a, ...
#[cfg(target_os = "macos")] fn open_docs(path: &Path) { match Command::new("open").arg(path).status() { Ok(_) => return, Err(_) => () }; }
{ match Command::new("start").arg(path).status() { Ok(_) => return, Err(_) => () }; }
identifier_body
cargo_doc.rs
use std::collections::HashSet; use std::fs; use std::path::Path; use std::process::Command; use core::PackageIdSpec; use core::source::Source; use ops; use sources::PathSource; use util::{CargoResult, human}; pub struct DocOptions<'a, 'b: 'a> { pub open_result: bool, pub compile_opts: ops::CompileOptions<'a, ...
(path: &Path) { match Command::new("start").arg(path).status() { Ok(_) => return, Err(_) => () }; } #[cfg(target_os = "macos")] fn open_docs(path: &Path) { match Command::new("open").arg(path).status() { Ok(_) => return, Err(_) => () }; }
open_docs
identifier_name
cargo_doc.rs
use std::collections::HashSet; use std::fs; use std::path::Path; use std::process::Command; use core::PackageIdSpec; use core::source::Source; use ops; use sources::PathSource; use util::{CargoResult, human}; pub struct DocOptions<'a, 'b: 'a> { pub open_result: bool, pub compile_opts: ops::CompileOptions<'a, ...
} Ok(()) } #[cfg(not(any(target_os = "windows", target_os = "macos")))] fn open_docs(path: &Path) { // trying xdg-open match Command::new("xdg-open").arg(path).status() { Ok(_) => return, Err(_) => () }; // trying gnome-open match Command::new("gnome-open").arg(path).stat...
{ open_docs(&path); }
conditional_block
q_lambda.rs
use crate::{ domains::Transition, fa::ScaledGradientUpdate, utils::argmax_first, traces, Differentiable, Enumerable, Function, Handler, Parameterised, }; use std::ops::Index; #[derive(Clone, Debug)] #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), serde(cra...
{ td_error: f64, } /// Watkins' Q-learning with eligibility traces. /// /// # References /// - Watkins, C. J. C. H. (1989). Learning from Delayed Rewards. Ph.D. thesis, /// Cambridge University. /// - Watkins, C. J. C. H., Dayan, P. (1992). Q-learning. Machine Learning, /// 8:279–292. #[derive(Clone, Debug, Param...
Response
identifier_name
q_lambda.rs
use crate::{ domains::Transition, fa::ScaledGradientUpdate, utils::argmax_first, traces, Differentiable, Enumerable, Function, Handler, Parameterised, }; use std::ops::Index; #[derive(Clone, Debug)] #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), serde(cra...
residual } else { let ns = t.to.state(); let (_, nqs_max) = self.fa_theta.find_max((ns,)); let residual = t.reward + self.gamma * nqs_max - qsa; self.fa_theta.handle(ScaledGradientUpdate { alpha: self.alpha * residual, ...
let s = t.from.state(); let qs = self.fa_theta.evaluate((s,)); let qsa = qs[t.action]; let grad_s = self.fa_theta.grad((s, t.action)); // Update trace: if t.action != argmax_first(qs).0 { self.trace.reset(); } self.trace.update(&grad_s); let td_error =...
identifier_body
q_lambda.rs
use crate::{ domains::Transition, fa::ScaledGradientUpdate, utils::argmax_first, traces, Differentiable, Enumerable, Function, Handler, Parameterised, }; use std::ops::Index; #[derive(Clone, Debug)] #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), serde(cra...
Ok(Response { td_error, }) } }
let ns = t.to.state(); let (_, nqs_max) = self.fa_theta.find_max((ns,)); let residual = t.reward + self.gamma * nqs_max - qsa; self.fa_theta.handle(ScaledGradientUpdate { alpha: self.alpha * residual, jacobian: &self.trace, })...
conditional_block
q_lambda.rs
use crate::{ domains::Transition, fa::ScaledGradientUpdate, utils::argmax_first, traces, Differentiable, Enumerable, Function, Handler, Parameterised, }; use std::ops::Index; #[derive(Clone, Debug)] #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), serde(cra...
self.trace.reset(); residual } else { let ns = t.to.state(); let (_, nqs_max) = self.fa_theta.find_max((ns,)); let residual = t.reward + self.gamma * nqs_max - qsa; self.fa_theta.handle(ScaledGradientUpdate { alpha: self....
jacobian: &self.trace, }).map_err(|_| ())?;
random_line_split
markdown.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 ...
(_ob: *buf, text: *buf, lang: *buf, opaque: *libc::c_void) { unsafe { if text.is_null() || lang.is_null() { return } let (test, shouldfail, ignore) = vec::raw::buf_as_slice((*lang).data, (*lang).size as uint, |lang| { ...
block
identifier_name
markdown.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 ...
let (test, shouldfail, ignore) = vec::raw::buf_as_slice((*lang).data, (*lang).size as uint, |lang| { let s = str::from_utf8(lang); (s.contains("rust"), s.contains("should_fail"), s.contains("...
{ return }
conditional_block
markdown.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 ...
static MKDEXT_AUTOLINK: libc::c_uint = 1 << 3; static MKDEXT_STRIKETHROUGH: libc::c_uint = 1 << 4; type sd_markdown = libc::c_void; // this is opaque to us struct sd_callbacks { blockcode: extern "C" fn(*buf, *buf, *buf, *libc::c_void), other: [libc::size_t,..25], } struct html_toc_data { header_count: ...
static MKDEXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 0; static MKDEXT_TABLES: libc::c_uint = 1 << 1; static MKDEXT_FENCED_CODE: libc::c_uint = 1 << 2;
random_line_split
foreign2.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 ...
{ }
identifier_body
foreign2.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 ...
() { }
main
identifier_name
foreign2.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 main() { }
}
random_line_split
erlang_rust_port.rs
// see erlang_rust_port.erl extern crate erl_ext; extern crate getopts; use getopts::Options; use erl_ext::{Decoder,Encoder,Error}; use std::io; use std::env; fn main() { let args: Vec<String> = env::args().collect(); let mut opts = Options::new(); opts.optflag("u", "utf8-atoms", "Use utf-8 atoms featu...
{ loop { assert!(true == try!(decoder.read_prelude())); let term = try!(decoder.decode_term()); try!(encoder.write_prelude()); try!(encoder.encode_term(term)); try!(encoder.flush()); } }
identifier_body
erlang_rust_port.rs
// see erlang_rust_port.erl
extern crate erl_ext; extern crate getopts; use getopts::Options; use erl_ext::{Decoder,Encoder,Error}; use std::io; use std::env; fn main() { let args: Vec<String> = env::args().collect(); let mut opts = Options::new(); opts.optflag("u", "utf8-atoms", "Use utf-8 atoms feature"); opts.optflag("s", "...
random_line_split
erlang_rust_port.rs
// see erlang_rust_port.erl extern crate erl_ext; extern crate getopts; use getopts::Options; use erl_ext::{Decoder,Encoder,Error}; use std::io; use std::env; fn main() { let args: Vec<String> = env::args().collect(); let mut opts = Options::new(); opts.optflag("u", "utf8-atoms", "Use utf-8 atoms featu...
<R: io::Read>(mut decoder: Decoder<R>, mut encoder: Encoder) -> Result<(), Error> { loop { assert!(true == try!(decoder.read_prelude())); let term = try!(decoder.decode_term()); try!(encoder.write_prelude()); try!(encoder.encode_term(term)); try!(encoder.flush()); } }
read_write_loop
identifier_name
dom_manipulation.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::event::{EventBubbles, E...
{ let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task( ScriptThreadEventCategory::ScriptEvent, Box::new(canceller.wrap_task(task)), )); self.0.send(msg).map_err(|_| ()) } } impl DOMManipulationTaskSource { pub fn queue_event(&self, ...
) -> Result<(), ()> where T: TaskOnce + 'static,
random_line_split
dom_manipulation.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::event::{EventBubbles, E...
(pub Sender<MainThreadScriptMsg>); impl fmt::Debug for DOMManipulationTaskSource { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMManipulationTaskSource(...)") } } impl TaskSource for DOMManipulationTaskSource { fn queue_with_canceller<T>( &self, task: T, ...
DOMManipulationTaskSource
identifier_name
dom_manipulation.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::event::{EventBubbles, E...
}
{ let target = Trusted::new(target); let _ = self.queue(SimpleEventTask { target, name }, window.upcast()); }
identifier_body
htmltablerowelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::utils::{DOMString, ErrorResult}; use dom::htmlelement::HTMLElement; pub struct HTMLTableRowEle...
pub fn DeleteCell(&mut self, _index: i32) -> ErrorResult { Ok(()) } pub fn Align(&self) -> DOMString { None } pub fn SetAlign(&self, _align: &DOMString) -> ErrorResult { Ok(()) } pub fn Ch(&self) -> DOMString { None } pub fn SetCh(&self, _ch: &DOM...
random_line_split
htmltablerowelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::utils::{DOMString, ErrorResult}; use dom::htmlelement::HTMLElement; pub struct HTMLTableRowEle...
(&self) -> DOMString { None } pub fn SetCh(&self, _ch: &DOMString) -> ErrorResult { Ok(()) } pub fn ChOff(&self) -> DOMString { None } pub fn SetChOff(&self, _ch_off: &DOMString) -> ErrorResult { Ok(()) } pub fn VAlign(&self) -> DOMString { Non...
Ch
identifier_name
htmltablerowelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::utils::{DOMString, ErrorResult}; use dom::htmlelement::HTMLElement; pub struct HTMLTableRowEle...
pub fn Align(&self) -> DOMString { None } pub fn SetAlign(&self, _align: &DOMString) -> ErrorResult { Ok(()) } pub fn Ch(&self) -> DOMString { None } pub fn SetCh(&self, _ch: &DOMString) -> ErrorResult { Ok(()) } pub fn ChOff(&self) -> DOMString ...
{ Ok(()) }
identifier_body
main.rs
/* cmongo2sql Utility to convert a MongoDB JSON dump to a SQL dump. Copyright 2016 Sam Saint-Pettersen. Licensed under the MIT/X11 License. Rust port of original Python tool (1.0.5). */ extern crate clioptions; extern crate regex; extern crate rustc_serialize; extern crate chrono; use clioptions::CliOptions; use reg...
(signature: &str, input: &str, output: &str, db: &str, comments: bool, verbose: bool) { let mut records = Vec::new(); let f = File::open(input).unwrap(); let file = BufReader::new(&f); for line in file.lines() { records.push(Json::from_str(&line.unwrap()).unwrap()); } let mut table = St...
convert_json_to_sql
identifier_name
main.rs
/* cmongo2sql Utility to convert a MongoDB JSON dump to a SQL dump. Copyright 2016 Sam Saint-Pettersen. Licensed under the MIT/X11 License. Rust port of original Python tool (1.0.5). */ extern crate clioptions; extern crate regex; extern crate rustc_serialize; extern crate chrono; use clioptions::CliOptions; use reg...
} if extensions { check_extensions(&program, &input, &output); } convert_json_to_sql(&signature, &input, &output, &db, comments, verbose); } else { display_error(&program, "No options specified"); } }
{ for (i, a) in cli.get_args().iter().enumerate() { match a.trim() { "-h" | "--help" => display_usage(&program, 0), "-v" | "--version" => display_version(&signature), "-f" | "--file" => input = cli.next_argument(i), "-o" | "--out" => ou...
conditional_block
main.rs
/* cmongo2sql Utility to convert a MongoDB JSON dump to a SQL dump. Copyright 2016 Sam Saint-Pettersen. Licensed under the MIT/X11 License. Rust port of original Python tool (1.0.5). */ extern crate clioptions; extern crate regex; extern crate rustc_serialize; extern crate chrono; use clioptions::CliOptions; use reg...
fn display_version(signature: &str) { println!("{}", signature); exit(0); } fn display_usage(program: &str, code: i32) { println!("\ncmongo2sql"); println!("Utility to convert a MongoDB JSON dump to a SQL dump."); println!("\nCopyright 2016 Sam Saint-Pettersen."); println!("Licensed under the...
{ println!("Error: {}.", err); display_usage(&program, -1); }
identifier_body
main.rs
/* cmongo2sql Utility to convert a MongoDB JSON dump to a SQL dump. Copyright 2016 Sam Saint-Pettersen. Licensed under the MIT/X11 License. Rust port of original Python tool (1.0.5). */ extern crate clioptions; extern crate regex; extern crate rustc_serialize; extern crate chrono; use clioptions::CliOptions; use reg...
display_error(&program, "No input file specified"); } else if output.is_empty() { display_error(&program, "No output file specified"); } if extensions { check_extensions(&program, &input, &output); } convert_json_to_sql(&signature, &i...
if input.is_empty() {
random_line_split
incremental.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 flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
special_damage.insert(kid.compute_layout_damage()); } self_base.restyle_damage .insert(flow::base(kid).restyle_damage.damage_for_parent( child_is_absolutely_positioned)); has_counter_affecting_c...
{ let mut special_damage = SpecialRestyleDamage::empty(); let is_absolutely_positioned = flow::base(self).flags.contains(FlowFlags::IS_ABSOLUTELY_POSITIONED); // In addition to damage, we use this phase to compute whether nodes affect CSS counters. let mut has_counter_affecting_children...
identifier_body
incremental.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 flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
}
self_base.restyle_damage.remove(ServoRestyleDamage::RECONSTRUCT_FLOW); for kid in self_base.children.iter_mut() { kid.reflow_entire_document(); } }
random_line_split
incremental.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 flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
{ Incremental, Force } bitflags! { pub struct SpecialRestyleDamage: u8 { #[doc = "If this flag is set, we need to reflow the entire document. This is more or less a \ temporary hack to deal with cases that we don't handle incrementally yet."] const REFLOW_ENTIRE_DOCUMENT =...
RelayoutMode
identifier_name
incremental.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 flow::{self, FlowFlags, Flow}; use style::computed_values::float; use style::selector_parser::RestyleDamage; u...
else { self_base.flags.remove(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN) } special_damage } fn reflow_entire_document(self) { let self_base = flow::mut_base(self); self_base.restyle_damage.insert(RestyleDamage::rebuild_and_reflow()); self_base.restyle_damag...
{ self_base.flags.insert(FlowFlags::HAS_COUNTER_AFFECTING_CHILDREN) }
conditional_block
sendfn-spawn-with-fn-arg.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 ...
(f: ~fn(int)) { f(22); } fn test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { error!(*three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); task::spawn(|| { test05_start(fn_to_send.take()); }); }
test05_start
identifier_name
sendfn-spawn-with-fn-arg.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 test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { error!(*three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); task::spawn(|| { test05_start(fn_to_send.take()); }); }
{ f(22); }
identifier_body
sendfn-spawn-with-fn-arg.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 test05_start(f: ~fn(int)) { f(22); } fn test05() { let three = ~3; let fn_to_send: ~fn(int) = |n| { error!(*three + n); // will copy x into the closure assert_eq!(*three, 3); }; let fn_to_send = Cell::new(fn_to_send); task::spawn(|| { test05_start(fn_to_send.take()); ...
random_line_split
serviceworkerglobalscope.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 devtools; use devtools_traits::DevtoolScriptControlMsg; use dom::abstractworker::WorkerScriptMsg; use dom::bin...
CommonWorker(WorkerScriptMsg::DOMMessage(data)) => { let scope = self.upcast::<WorkerGlobalScope>(); let target = self.upcast(); let _ac = JSAutoCompartment::new(scope.get_cx(), scope.reflector().get_jsobject()....
match msg {
random_line_split
serviceworkerglobalscope.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 devtools; use devtools_traits::DevtoolScriptControlMsg; use dom::abstractworker::WorkerScriptMsg; use dom::bin...
let reports = get_reports(cx, path_seg); reports_chan.send(reports); }, Response(mediator) => { // TODO XXXcreativcoder This will eventually use a FetchEvent interface to fire event // when we have the Request and Response dom api's...
{ use self::ServiceWorkerScriptMsg::*; match msg { CommonWorker(WorkerScriptMsg::DOMMessage(data)) => { let scope = self.upcast::<WorkerGlobalScope>(); let target = self.upcast(); let _ac = JSAutoCompartment::new(scope.get_cx(), ...
identifier_body
serviceworkerglobalscope.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 devtools; use devtools_traits::DevtoolScriptControlMsg; use dom::abstractworker::WorkerScriptMsg; use dom::bin...
(init: WorkerGlobalScopeInit, worker_url: Url, id: PipelineId, from_devtools_receiver: Receiver<DevtoolScriptControlMsg>, runtime: Runtime, own_sender: Sender<ServiceWorkerScriptMsg>, receiver: Receiver<ServiceWorkerScriptMsg>, ...
new
identifier_name
serviceworkerglobalscope.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 devtools; use devtools_traits::DevtoolScriptControlMsg; use dom::abstractworker::WorkerScriptMsg; use dom::bin...
else if ret == devtools_handle.id() { Ok(MixedMessage::FromDevtools(try!(devtools_port.recv()))) } else if ret == timer_port_handle.id() { Ok(MixedMessage::FromTimeoutThread(try!(timer_event_port.recv()))) } else { panic!("unexpected select result!") } } ...
{ Ok(MixedMessage::FromServiceWorker(try!(worker_port.recv()))) }
conditional_block
main.rs
// Recap: The Rules of References // 1. At any time, you can have *either* but not both of: // a. One mutable reference // b. Any number of immutable references // 2. References must always be valid. fn main() { references(); mutable_references(); mutable_reference_scope_invalid(); mutable_refere...
fn dangling_references() { // let reference = dangle(); // // fn dangle() -> &String { // let s = String::from("Hello"); // &s // s is deallocated while the reference is returned // } } fn calculate_length(s: &String) -> usize { s.len() } // The follo...
{ // It's okay to have multiple immutable references in the same scope let s = String::from("Hello"); let r = &s; // OK! let r2 = &s; // OK! }
identifier_body
main.rs
// Recap: The Rules of References // 1. At any time, you can have *either* but not both of: // a. One mutable reference // b. Any number of immutable references // 2. References must always be valid. fn main() { references(); mutable_references(); mutable_reference_scope_invalid(); mutable_refere...
() { // let reference = dangle(); // // fn dangle() -> &String { // let s = String::from("Hello"); // &s // s is deallocated while the reference is returned // } } fn calculate_length(s: &String) -> usize { s.len() } // The following function will cause...
dangling_references
identifier_name
main.rs
// Recap: The Rules of References // 1. At any time, you can have *either* but not both of: // a. One mutable reference // b. Any number of immutable references // 2. References must always be valid. fn main() { references(); mutable_references(); mutable_reference_scope_invalid(); mutable_refere...
} fn mutable_reference_scope_valid() { let mut s = String::from("Hello"); { let r = &mut s; r.push_str("GG"); } // r goes out of scope let r2 = &mut s; // And now it's okay to create a new mutable reference } fn immutable_references() { // It's okay to have multiple immutable ref...
{ // let r2 = &mut s; // Same as above }
random_line_split
i16.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 ...
if y { None } else { Some(x) } } } }
#[inline] fn checked_mul(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v);
random_line_split
i16.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 ...
else { Some(x) } } } } impl CheckedMul for i16 { #[inline] fn checked_mul(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = intrinsics::i16_mul_with_overflow(*self, *v); if y { None } else { Some(x) } } } }
{ None }
conditional_block
i16.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 ...
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic. #[inline] fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self) } } /// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic. #[inline] fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::ctt...
{ unsafe { intrinsics::ctpop16(*self) } }
identifier_body
i16.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = intrinsics::i16_sub_with_overflow(*self, *v); if y { None } else { Some(x) } } } } impl CheckedMul for i16 { #[inline] fn checked_mul(&self, v: &i16) -> Option<i16> { unsafe { let (x, y) = in...
checked_sub
identifier_name
extern-stress.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 ...
() { for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
main
identifier_name
extern-stress.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 ...
else { task::yield(); count(data - 1u) + count(data - 1u) } } fn count(n: uint) -> uint { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
{ data }
conditional_block
extern-stress.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 ...
for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
pub fn main() {
random_line_split
extern-stress.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 count(n: uint) -> uint { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { for 100u.times { do task::spawn { assert_eq!(count(5u), 16u); }; } }
{ if data == 1u { data } else { task::yield(); count(data - 1u) + count(data - 1u) } }
identifier_body
build.rs
extern crate capnpc; extern crate cc; extern crate cmake; fn main() { // Compile RPC schema file into rust code capnpc::CompilerCommand::new() .src_prefix("schema") .file("schema/pung.capnp") .run().expect("schema compiler command"); // Compile and link pung C++ PIR shim cc::Bui...
.define("PERF_TIMERS", "OFF") .build(); println!("cargo:rustc-link-search=native={}/build/pir", dst.display()); println!("cargo:rustc-link-lib=static=pir_static"); // Dynamic libraries needed by XPIR println!("cargo:rustc-link-lib=gomp"); pri...
// Compile and link XPIR c++ shim let dst = cmake::Config::new("deps/xpir") .define("CMAKE_BUILD_TYPE", "Release") .define("MULTI_THREAD", "OFF")
random_line_split
build.rs
extern crate capnpc; extern crate cc; extern crate cmake; fn main()
// Compile and link XPIR c++ shim let dst = cmake::Config::new("deps/xpir") .define("CMAKE_BUILD_TYPE", "Release") .define("MULTI_THREAD", "OFF") .define("PERF_TIMERS", "OFF") .build(); println!(...
{ // Compile RPC schema file into rust code capnpc::CompilerCommand::new() .src_prefix("schema") .file("schema/pung.capnp") .run().expect("schema compiler command"); // Compile and link pung C++ PIR shim cc::Build::new() .file("src/pir/cpp/pungPIR.cpp") ...
identifier_body
build.rs
extern crate capnpc; extern crate cc; extern crate cmake; fn
() { // Compile RPC schema file into rust code capnpc::CompilerCommand::new() .src_prefix("schema") .file("schema/pung.capnp") .run().expect("schema compiler command"); // Compile and link pung C++ PIR shim cc::Build::new() .file("src/pir/cpp/pungPIR.cpp") ...
main
identifier_name
trait-bounds-basic.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 ...
(_x: Box<Foo+Send>) { } fn c(x: Box<Foo+Sync+Send>) { e(x); } fn d(x: Box<Foo+Send>) { e(x); } fn e(x: Box<Foo>) { e(x); } pub fn main() { }
b
identifier_name
trait-bounds-basic.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 ...
fn d(x: Box<Foo+Send>) { e(x); } fn e(x: Box<Foo>) { e(x); } pub fn main() { }
}
random_line_split
trait-bounds-basic.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 ...
fn e(x: Box<Foo>) { e(x); } pub fn main() { }
{ e(x); }
identifier_body
lib.rs
#![crate_name = "xpath"] #![feature(macro_rules)] extern crate document; use std::collections::HashMap; use document::{Any,ToAny}; use document::{Nodeset}; use tokenizer::{XPathTokenizer,XPathTokenDeabbreviator,XPathTokenDisambiguator}; use parser::XPathParser; pub mod axis; pub mod expression; pub mod function; p...
} fn position(&self) -> uint { self.position } fn function_for_name(&self, name: &str) -> Option<& 'a BoxFunc> { self.functions.find(&name.to_string()) } fn value_of(&self, name: &str) -> Option<&XPathValue> { self.variables.find(&name.to_string()) } } pub struct ...
pub fn next<A: ToAny>(& mut self, node: A) { self.node = node.to_any(); self.position += 1;
random_line_split
lib.rs
#![crate_name = "xpath"] #![feature(macro_rules)] extern crate document; use std::collections::HashMap; use document::{Any,ToAny}; use document::{Nodeset}; use tokenizer::{XPathTokenizer,XPathTokenDeabbreviator,XPathTokenDisambiguator}; use parser::XPathParser; pub mod axis; pub mod expression; pub mod function; p...
<A: ToAny>(node: A, functions: &'a Functions, variables: &'a Variables) -> XPathEvaluationContext<'a> { XPathEvaluationContext { node: node.to_any(), functions: functions, variables: variables, position: 0, ...
new
identifier_name
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
self.visible_rect.intersects(&stacking_context.clip_rect) { result_list.push_back((*stacking_context).clone()) } } } }
where I: Iterator<&'a Arc<StackingContext>> { for stacking_context in stacking_contexts { if self.visible_rect.intersects(&stacking_context.bounds) &&
random_line_split
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
/// Adds display items that intersect the visible rect to `result_list`. fn add_in_bounds_display_items<'a,I>(&self, result_list: &mut DList<DisplayItem>, mut display_items: I) where I: I...
{ let mut result = DisplayList::new(); self.add_in_bounds_display_items(&mut result.background_and_borders, display_list.background_and_borders.iter()); self.add_in_bounds_display_items(&mut result.block_backgrounds_and_borders, ...
identifier_body
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
<'a,I>(&self, result_list: &mut DList<Arc<StackingContext>>, mut stacking_contexts: I) where I: Iterator<&'a Arc<StackingContext>> { for stacking_context in stacking_contexts { ...
add_in_bounds_stacking_contexts
identifier_name
optimizer.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/. */ //! Transforms a display list to produce a visually-equivalent, but cheaper-to-render, one. use display_list::{Di...
} } /// Adds child stacking contexts whose boundaries intersect the visible rect to `result_list`. fn add_in_bounds_stacking_contexts<'a,I>(&self, result_list: &mut DList<Arc<StackingContext>>, mut stacking_c...
{ result_list.push_back((*display_item).clone()) }
conditional_block
main_context.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT> use glib_sys::{self, gboolean, gpointer}; use source::Priority; use std::mem; use translate:...
() { let a = MainContext::new(); let b = MainContext::new(); assert!(!is_same_context(&a, &b)); a.with_thread_default(|| { let t = MainContext::get_thread_default().unwrap(); assert!(is_same_context(&a, &t)); b.with_thread_default(|| { ...
test_with_thread_default
identifier_name
main_context.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT> use glib_sys::{self, gboolean, gpointer}; use source::Priority; use std::mem; use translate:...
fn test_invoke() { let c = MainContext::new(); let l = ::MainLoop::new(Some(&c), false); let l_clone = l.clone(); thread::spawn(move || { c.invoke(move || l_clone.quit()); }); l.run(); } fn is_same_context(a: &MainContext, b: &MainContext) -> bo...
use std::ptr; use std::thread; #[test]
random_line_split
main_context.rs
// Copyright 2015-2016, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT> use glib_sys::{self, gboolean, gpointer}; use source::Priority; use std::mem; use translate:...
unsafe extern "C" fn destroy_closure<F: FnOnce() +'static>(ptr: gpointer) { Box::<Option<F>>::from_raw(ptr as *mut _); } let func = Box::into_raw(Box::new(Some(func))); glib_sys::g_main_context_invoke_full( self.to_glib_none().0, priority.to_glib(), ...
{ let func: &mut Option<F> = &mut *(func as *mut Option<F>); let func = func .take() .expect("MainContext::invoke() closure called multiple times"); func(); glib_sys::G_SOURCE_REMOVE }
identifier_body
ir.rs
//! Enumerations and structs to represent instructions. //! Shared by the SSA representation and the intermediate representation of the ESIL parser. use std::default::Default; pub type Address = u64; pub type WidthSpec = u16; #[derive(Debug, Clone, Default)] pub struct MAddr { // maybe store section id and offset i...
(&self, dst: MVal, op1: MVal, op2: MVal, addr: Option<MAddr>) -> MInst { MInst::new(*self, dst, op1, op2, addr) } pub fn is_binary(&self) -> bool { self.arity() == MArity::Binary } pub fn is_unary(&self) -> bool { self.arity() == MArity::Unary } pub fn arity(&self) -> MArity { self.info().1 } pub fn...
to_inst
identifier_name
ir.rs
//! Enumerations and structs to represent instructions. //! Shared by the SSA representation and the intermediate representation of the ESIL parser. use std::default::Default; pub type Address = u64; pub type WidthSpec = u16; #[derive(Debug, Clone, Default)] pub struct MAddr { // maybe store section id and offset i...
pub fn esilold() -> MVal { MVal::new("".to_string(), 64, MValType::EsilOld, 0, None) } pub fn esillastsz() -> MVal { MVal::new("".to_string(), 64, MValType::Lastsz, 0, None) } } impl MInst { pub fn new(opcode: MOpcode, dst: MVal, op1: MVal, op2: MVal, _addr: Option<MAddr>) -> MInst { let addr = _addr.unw...
{ MVal::new("".to_string(), 64, MValType::EsilCur, 0, None) }
identifier_body
ir.rs
//! Enumerations and structs to represent instructions. //! Shared by the SSA representation and the intermediate representation of the ESIL parser. use std::default::Default; pub type Address = u64; pub type WidthSpec = u16; #[derive(Debug, Clone, Default)] pub struct MAddr { // maybe store section id and offset i...
pub enum MValType { Register, Temporary, Internal, EsilCur, EsilOld, Lastsz, Unknown, Null, } #[derive(Debug, Copy, Clone, PartialEq)] pub enum MOpcode { OpAdd, OpSub, OpMul, OpDiv, OpMod, OpAnd, OpOr, OpXor, OpNot, OpEq, OpCmp, OpGt, OpLt, OpLteq, OpGteq, OpLsl, OpLsr, OpIf, OpJmp, OpCJmp,...
Binary, Ternary, // Unused for now. Maybe remove later? } #[derive(Debug, Copy, Clone, PartialEq)]
random_line_split
regions-close-object-into-object-5.rs
#![allow(warnings)] trait A<T> { fn get(&self) -> T { panic!() } } struct B<'a, T: 'a>(&'a (A<T> + 'a)); trait X { fn foo(&self) {} } impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box<A<T> +'static>) -> Box<X +'static> { // oh dear!
Box::new(B(&*v)) as Box<dyn X> //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type...
random_line_split
regions-close-object-into-object-5.rs
#![allow(warnings)] trait A<T> { fn get(&self) -> T { panic!() } } struct B<'a, T: 'a>(&'a (A<T> + 'a)); trait X { fn foo(&self)
} impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box<A<T> +'static>) -> Box<X +'static> { // oh dear! Box::new(B(&*v)) as Box<dyn X> //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not liv...
{}
identifier_body
regions-close-object-into-object-5.rs
#![allow(warnings)] trait A<T> { fn get(&self) -> T { panic!() } } struct
<'a, T: 'a>(&'a (A<T> + 'a)); trait X { fn foo(&self) {} } impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box<A<T> +'static>) -> Box<X +'static> { // oh dear! Box::new(B(&*v)) as Box<dyn X> //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long...
B
identifier_name
send_str_hashmap.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 ...
() { let mut map: HashMap<SendStr, usize> = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); ...
main
identifier_name
send_str_hashmap.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { let mut map: HashMap<SendStr, usize> = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); assert!(map.insert("foo".to_string().into_cow(), 42).is_s...
random_line_split
send_str_hashmap.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 ...
assert!(map.insert("bcd".to_string().into_cow(), b).is_none()); assert!(map.insert("cde".into_cow(), c).is_none()); assert!(map.insert("def".to_string().into_cow(), d).is_none()); assert!(map.insert("abc".into_cow(), a).is_some()); assert!(map.insert("bcd".to_string().into_cow(), b).is_some()); ...
{ let mut map: HashMap<SendStr, usize> = HashMap::new(); assert!(map.insert("foo".into_cow(), 42).is_none()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); assert!(map.insert("foo".into_cow(), 42).is_some()); assert!(map.insert("foo".to_string().into_cow(), 42).is_some()); as...
identifier_body
inner-static.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at
// // 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. // aux-build:inn...
// http://rust-lang.org/COPYRIGHT.
random_line_split
inner-static.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { let a = inner_static::A::<()> { v: () }; let b = inner_static::B::<()> { v: () }; let c = inner_static::test::A::<()> { v: () }; assert_eq!(a.bar(), 2); assert_eq!(b.bar(), 4); assert_eq!(c.bar(), 6); }
main
identifier_name
inner-static.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ let a = inner_static::A::<()> { v: () }; let b = inner_static::B::<()> { v: () }; let c = inner_static::test::A::<()> { v: () }; assert_eq!(a.bar(), 2); assert_eq!(b.bar(), 4); assert_eq!(c.bar(), 6); }
identifier_body
lib.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...
nbits: usize } impl Index<usize> for BitVec { type Output = bool; #[inline] fn index(&self, i: usize) -> &bool { if self.get(i).expect("index out of bounds") { &TRUE } else { &FALSE } } } impl BitVec { /// An operation might screw up the unused ...
storage: Vec<u64>, /// The number of valid bits in the internal representation
random_line_split
lib.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...
(&self) -> bool { self.len() == 0 } /// Clears all bits in this vector. #[inline] pub fn clear(&mut self) { for w in &mut self.storage { *w = 0; } } } impl Default for BitVec { #[inline] fn default() -> BitVec { BitVec::new() } } impl Clone for BitVec { #[inline] fn clone(&self...
is_empty
identifier_name
lib.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...
; *ptr = val; } /// Sets all bits to 1. /// /// # Examples /// /// ```ignore /// use std::collections::BitVec; /// /// let before = 0b01100000; /// let after = 0b11111111; /// /// let mut bv = BitVec::from_bytes(&[before]); /// bv.set_all(); /// assert_e...
{ *ptr & !flag }
conditional_block
lib.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...
#[inline] pub fn as_bytes_mut(&mut self) -> &mut [u8] { unsafe { std::slice::from_raw_parts_mut(self.storage.as_mut_ptr() as *mut _, (self.nbits + 7) / 8) } } #[inline] pub fn as_bytes(&self) -> &[u8] { unsafe { ...
{ assert!(bits <= data.len() * 64); let mut ret = BitVec { storage: data, nbits: bits }; ret.fix_last_block(); ret }
identifier_body
inherited_table.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("InheritedTable", inherited=True, ...
${helpers.single_keyword("empty-cells", "show hide", gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS", animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells")} ${helpers.single_keyword("caption-side", "top...
gecko_constant_prefix="NS_STYLE_BORDER", animation_value_type="none", spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse")}
random_line_split
inherited_table.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("InheritedTable", inherited=True, ...
{ pub horizontal: Au, pub vertical: Au, } /// https://drafts.csswg.org/css-transitions/#animtype-simple-list impl Animatable for T { #[inline] fn interpolate(&self, other: &Self, time: f64) -> Result<Self, ()> { Ok(T { ...
T
identifier_name
inherited_table.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("InheritedTable", inherited=True, ...
impl ToCss for SpecifiedValue { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write, { try!(self.horizontal.to_css(dest)); if let Some(vertical) = self.vertical.as_ref() { try!(dest.write_str(" ")); vertical.to_cs...
{ computed_value::T { horizontal: Au(0), vertical: Au(0), } }
identifier_body
main.rs
// Works under Rust 1.14.0 :) extern crate rand; use std::io::prelude::*; use std::io; use rand::{thread_rng, Rng}; const MAX_ATTEMPTS:i16 = 5; fn play(guess:u8, target:u8, remaining_guesses:i16) -> bool
fn main() { println!(" Yo! Welcome to Guess the Number with Rust! Rust will, like, pick a number between 1 and 100 and, like, you've gotta guess it or whatever. Oh. And you only get 5 guesses. Bonne chance! "); let mut rng = thread_rng(); let _number = rng.gen_range::<u8>(1, 100); let mut _attempt = 1; // O...
{ if guess == target { // We won! println!("Noice! You gone done did good, kid."); return true; } else { if guess < target { // Go lower println!("Hmm too low, bro."); } else if guess > target { // Go higher println!("Yo too high, guy."); } println!("You have {0} guesses left. ", remaining_g...
identifier_body