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
asm.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
.map(|s| format!("~{{{}}}", s.get())) .collect::<Vec<String>>() .connect(","); let more_clobbers = get_clobbers(); if!more_clobbers.is_empty() { if!clobbers.is_empty() { clobbers.push(','); ...
let mut clobbers = ia.clobbers.iter()
random_line_split
asm.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm) -> Block<'blk, 'tcx> { let fcx = bcx.fcx; let mut bcx = bcx; let mut constraints = Vec::new(); let mut output_types = Vec::new(); let temp_scope = fcx.push_custom_cleanup_scope(); let mut ext_inputs =...
trans_inline_asm
identifier_name
asm.rs
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn get_clobbers() -> String { "~{dirflag},~{fpsr},~{flags}".to_string() }
{ "".to_string() }
identifier_body
communicate.rs
//! Defines the messages passed between client and server. use cgmath::{Aabb3, Vector2, Vector3, Point3}; use std::default::Default; use std::ops::Add; use block_position::BlockPosition; use entity::EntityId; use lod::LODIndex; use serialize::{Copyable, Flatten, MemStream, EOF}; use terrain_block::TerrainBlock; #[de...
(self, rhs: u32) -> ClientId { let ClientId(i) = self; ClientId(i + rhs) } } #[derive(Debug, Clone)] /// TerrainBlock plus identifying info, e.g. for transmission between server and client. pub struct TerrainBlockSend { #[allow(missing_docs)] pub position: Copyable<BlockPosition>, #[allow(missing_docs)...
add
identifier_name
communicate.rs
//! Defines the messages passed between client and server. use cgmath::{Aabb3, Vector2, Vector3, Point3}; use std::default::Default; use std::ops::Add; use block_position::BlockPosition; use entity::EntityId; use lod::LODIndex; use serialize::{Copyable, Flatten, MemStream, EOF}; use terrain_block::TerrainBlock; #[de...
UpdatePlayer(Copyable<EntityId>, Copyable<Aabb3<f32>>), /// Update the client's view of a mob with a given mesh. UpdateMob(Copyable<EntityId>, Copyable<Aabb3<f32>>), /// The sun as a [0, 1) portion of its cycle. UpdateSun(Copyable<f32>), /// Provide a block of terrain to a client. UpdateBlock(TerrainBl...
random_line_split
ccuclkcr.rs
#[doc = "Register `CCUCLKCR` reader"] pub struct R(crate::R<CCUCLKCR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<CCUCLKCR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<CCUCLKCR_SPEC>> for R { #[inline(always)] fn from(reader: ...
} } impl R { #[doc = "Bit 0 - CCU Clock Divider Enable"] #[inline(always)] pub fn ccudiv(&self) -> CCUDIV_R { CCUDIV_R::new((self.bits & 0x01)!= 0) } } impl W { #[doc = "Bit 0 - CCU Clock Divider Enable"] #[inline(always)] pub fn ccudiv(&mut self) -> CCUDIV_W { CCUDIV_W {...
#[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01); self.w
random_line_split
ccuclkcr.rs
#[doc = "Register `CCUCLKCR` reader"] pub struct R(crate::R<CCUCLKCR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<CCUCLKCR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<CCUCLKCR_SPEC>> for R { #[inline(always)] fn from(reader: ...
(crate::W<CCUCLKCR_SPEC>); impl core::ops::Deref for W { type Target = crate::W<CCUCLKCR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::ops::DerefMut for W { #[inline(always)] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } i...
W
identifier_name
ccuclkcr.rs
#[doc = "Register `CCUCLKCR` reader"] pub struct R(crate::R<CCUCLKCR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<CCUCLKCR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<CCUCLKCR_SPEC>> for R { #[inline(always)] fn from(reader: ...
} impl R { #[doc = "Bit 0 - CCU Clock Divider Enable"] #[inline(always)] pub fn ccudiv(&self) -> CCUDIV_R { CCUDIV_R::new((self.bits & 0x01)!= 0) } } impl W { #[doc = "Bit 0 - CCU Clock Divider Enable"] #[inline(always)] pub fn ccudiv(&mut self) -> CCUDIV_W { CCUDIV_W { w: s...
{ self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01); self.w }
identifier_body
strutil.rs
// miscelaneous string utilities // returns the string slice following the target, if any pub fn after<'a>(s: &'a str, target: &str) -> Option<&'a str> { if let Some(idx) = s.find(target) { Some(&s[(idx+target.len())..]) } else { None } }
// like after, but subsequently finds a word following... pub fn word_after(txt: &str, target: &str) -> Option<String> { if let Some(txt) = after(txt,target) { // maybe skip some space, and end with whitespace or semicolon let start = txt.find(|c:char| c.is_alphanumeric()).unwrap(); let end ...
random_line_split
strutil.rs
// miscelaneous string utilities // returns the string slice following the target, if any pub fn after<'a>(s: &'a str, target: &str) -> Option<&'a str> { if let Some(idx) = s.find(target) { Some(&s[(idx+target.len())..]) } else { None } } // like after, but subsequently finds a word fo...
// split into two at a delimiter pub fn split(txt: &str, delim: char) -> (&str,&str) { if let Some(idx) = txt.find(delim) { (&txt[0..idx], &txt[idx+1..]) } else { (txt,"") } }
{ (iter.next().unwrap(), iter.next().unwrap()) }
identifier_body
strutil.rs
// miscelaneous string utilities // returns the string slice following the target, if any pub fn after<'a>(s: &'a str, target: &str) -> Option<&'a str> { if let Some(idx) = s.find(target) { Some(&s[(idx+target.len())..]) } else { None } } // like after, but subsequently finds a word fo...
(txt: &str, delim: char) -> (&str,&str) { if let Some(idx) = txt.find(delim) { (&txt[0..idx], &txt[idx+1..]) } else { (txt,"") } }
split
identifier_name
strutil.rs
// miscelaneous string utilities // returns the string slice following the target, if any pub fn after<'a>(s: &'a str, target: &str) -> Option<&'a str> { if let Some(idx) = s.find(target)
else { None } } // like after, but subsequently finds a word following... pub fn word_after(txt: &str, target: &str) -> Option<String> { if let Some(txt) = after(txt,target) { // maybe skip some space, and end with whitespace or semicolon let start = txt.find(|c:char| c.is_alphanumeric...
{ Some(&s[(idx+target.len())..]) }
conditional_block
searcher.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 i == "" { dirs_to_search.push(Path::new("/usr/share/terminfo")); } else { dirs_to_search.push(Path::new(i)); } }, // Found nothing in TERMINFO_DIRS, use the default paths: ...
{ if term.len() == 0 { return None; } let homedir = os::homedir(); let mut dirs_to_search = Vec::new(); let first_char = term.char_at(0); // Find search directory match getenv("TERMINFO") { Some(dir) => dirs_to_search.push(Path::new(dir)), None => { if ...
identifier_body
searcher.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 ...
(term: &str) -> Result<File, String> { match get_dbpath_for_term(term) { Some(x) => { match File::open(&*x) { Ok(file) => Ok(file), Err(e) => Err(format!("error opening file: {:?}", e)), } } None => { Err(format!("could not ...
open
identifier_name
searcher.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 ...
#[test] #[ignore(reason = "see test_get_dbpath_for_term")] fn test_open() { open("screen").unwrap(); let t = open("nonexistent terminal that hopefully does not exist"); assert!(t.is_err()); }
}
random_line_split
deriving-meta.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...
}
a == a; // check for PartialEq impl w/o testing its correctness a.clone(); // check for Clone impl w/o testing its correctness hash(&a); // check for Hash impl w/o testing its correctness
random_line_split
deriving-meta.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...
pub fn main() { let a = Foo {bar: 4, baz: -3}; a == a; // check for PartialEq impl w/o testing its correctness a.clone(); // check for Clone impl w/o testing its correctness hash(&a); // check for Hash impl w/o testing its correctness }
{}
identifier_body
deriving-meta.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
<T: Hash>(_t: &T) {} pub fn main() { let a = Foo {bar: 4, baz: -3}; a == a; // check for PartialEq impl w/o testing its correctness a.clone(); // check for Clone impl w/o testing its correctness hash(&a); // check for Hash impl w/o testing its correctness }
hash
identifier_name
constantsourcenode.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/. */ use crate::dom::audioparam::AudioParam; use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; use c...
#[allow(unrooted_must_root)] pub fn new( window: &Window, context: &BaseAudioContext, options: &ConstantSourceOptions, ) -> Fallible<DomRoot<ConstantSourceNode>> { let node = ConstantSourceNode::new_inherited(window, context, options)?; Ok(reflect_dom_object( ...
}
random_line_split
constantsourcenode.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/. */ use crate::dom::audioparam::AudioParam; use crate::dom::audioscheduledsourcenode::AudioScheduledSourceNode; use c...
(&self) -> DomRoot<AudioParam> { DomRoot::from_ref(&self.offset) } } impl<'a> From<&'a ConstantSourceOptions> for ServoMediaConstantSourceOptions { fn from(options: &'a ConstantSourceOptions) -> Self { Self { offset: *options.offset, } } }
Offset
identifier_name
try_init.rs
use { serde_json, string }; use dispatch::{ add_node, connect_nodes, get }; use error::*; use action::{ AddNode, ConnectNodes }; use libflo_action_std::{ ACTION_MAPPER, BasicAction, dispatch_fn, DispatchMap, DISPATCH_MAP, parse_fn, ParseMap, PARSE_MAP }; use libflo_std::LIBFLO; pub unsafe fn
() -> Result<()> { if ACTION_MAPPER.is_set()? && LIBFLO.is_set()? { let action_mapper = ACTION_MAPPER.read()?; let libflo = LIBFLO.read()?; let module_mapper = libflo.get_module_mapper(); // Set up parser let add_node_parser = parse_fn(|arg| serde_json::from_str::<AddNode>(a...
try_init
identifier_name
try_init.rs
use { serde_json, string }; use dispatch::{ add_node, connect_nodes, get }; use error::*; use action::{ AddNode, ConnectNodes }; use libflo_action_std::{ ACTION_MAPPER, BasicAction, dispatch_fn, DispatchMap, DISPATCH_MAP, parse_fn, ParseMap, PARSE_MAP }; use libflo_std::LIBFLO;
// Set up parser let add_node_parser = parse_fn(|arg| serde_json::from_str::<AddNode>(arg)); let connect_nodes_parser = parse_fn(|arg| serde_json::from_str::<ConnectNodes>(arg)); let get_parser = parse_fn(|arg| serde_json::from_str::<BasicAction>(arg)); let parser = ParseMap::n...
pub unsafe fn try_init() -> Result<()> { if ACTION_MAPPER.is_set()? && LIBFLO.is_set()? { let action_mapper = ACTION_MAPPER.read()?; let libflo = LIBFLO.read()?; let module_mapper = libflo.get_module_mapper();
random_line_split
try_init.rs
use { serde_json, string }; use dispatch::{ add_node, connect_nodes, get }; use error::*; use action::{ AddNode, ConnectNodes }; use libflo_action_std::{ ACTION_MAPPER, BasicAction, dispatch_fn, DispatchMap, DISPATCH_MAP, parse_fn, ParseMap, PARSE_MAP }; use libflo_std::LIBFLO; pub unsafe fn try_init() -> Result<()> {...
PARSE_MAP.set(parser)?; // Set up dispatch map let add_node_dispatch = dispatch_fn(|arg| add_node(arg)); let connect_nodes_dispatch = dispatch_fn(|arg| connect_nodes(arg)); let get_dispatch = dispatch_fn(|_: &BasicAction| get()); let dispatch_map = DispatchMap::new( ...
{ let action_mapper = ACTION_MAPPER.read()?; let libflo = LIBFLO.read()?; let module_mapper = libflo.get_module_mapper(); // Set up parser let add_node_parser = parse_fn(|arg| serde_json::from_str::<AddNode>(arg)); let connect_nodes_parser = parse_fn(|arg| serde_json::fr...
conditional_block
try_init.rs
use { serde_json, string }; use dispatch::{ add_node, connect_nodes, get }; use error::*; use action::{ AddNode, ConnectNodes }; use libflo_action_std::{ ACTION_MAPPER, BasicAction, dispatch_fn, DispatchMap, DISPATCH_MAP, parse_fn, ParseMap, PARSE_MAP }; use libflo_std::LIBFLO; pub unsafe fn try_init() -> Result<()>
PARSE_MAP.set(parser)?; // Set up dispatch map let add_node_dispatch = dispatch_fn(|arg| add_node(arg)); let connect_nodes_dispatch = dispatch_fn(|arg| connect_nodes(arg)); let get_dispatch = dispatch_fn(|_: &BasicAction| get()); let dispatch_map = DispatchMap::new( ...
{ if ACTION_MAPPER.is_set()? && LIBFLO.is_set()? { let action_mapper = ACTION_MAPPER.read()?; let libflo = LIBFLO.read()?; let module_mapper = libflo.get_module_mapper(); // Set up parser let add_node_parser = parse_fn(|arg| serde_json::from_str::<AddNode>(arg)); let...
identifier_body
plain.rs
use text::style::{Style, StyleCommand, Color, PaletteColor}; use std::fmt::{self, Display}; use std::str::FromStr; use serde::de::{Deserializer, Deserialize, Error, Visitor}; use serde::{Serializer, Serialize}; use std::iter::Peekable; use std::slice; // [PlainBuf] Overhead: 48 bytes for collections, 4 bytes per descr...
} let (part, rest) = self.head.split_at(len); self.head = rest; Some((part, style)) } else { None } } } pub struct FormatReader { target: PlainBuf, marker: char, expect_code: bool, style: Style, current_len: usize } impl FormatReader { pub fn new() -> Self { Self::with_marker('§') ...
len += next_len as usize; self.descriptors.next();
random_line_split
plain.rs
use text::style::{Style, StyleCommand, Color, PaletteColor}; use std::fmt::{self, Display}; use std::str::FromStr; use serde::de::{Deserializer, Deserialize, Error, Visitor}; use serde::{Serializer, Serialize}; use std::iter::Peekable; use std::slice; // [PlainBuf] Overhead: 48 bytes for collections, 4 bytes per descr...
pub fn with_marker(marker: char) -> Self { FormatReader { target: PlainBuf::new(), marker: marker, expect_code: false, style: Style::new(), current_len: 0 } } pub fn extend(target: PlainBuf, marker: char) -> Self { FormatReader { target: target, marker: marker, expect_code: false, ...
{ Self::with_marker('§') }
identifier_body
plain.rs
use text::style::{Style, StyleCommand, Color, PaletteColor}; use std::fmt::{self, Display}; use std::str::FromStr; use serde::de::{Deserializer, Deserialize, Error, Visitor}; use serde::{Serializer, Serialize}; use std::iter::Peekable; use std::slice; // [PlainBuf] Overhead: 48 bytes for collections, 4 bytes per descr...
&mut self, string: &str) { let mut start = 0; for (index, char) in string.char_indices() { if self.expect_code { self.target.string.push_str(&string[start..start+self.current_len]); self.flush(); self.style.process(&StyleCommand::from_code(char).unwrap_or(StyleCommand::Color(PaletteColor::Whi...
ppend(
identifier_name
match-on-borrowed.rs
// Test that a (partially) mutably borrowed place can be matched on, so long as // we don't have to read any values that are mutably borrowed to determine // which arm to take. // // Test that we don't allow mutating the value being matched on in a way that // changes which patterns it matches, until we have chosen an ...
() {}
main
identifier_name
match-on-borrowed.rs
// Test that a (partially) mutably borrowed place can be matched on, so long as // we don't have to read any values that are mutably borrowed to determine // which arm to take. // // Test that we don't allow mutating the value being matched on in a way that // changes which patterns it matches, until we have chosen an ...
let x = &mut b.0; match *b { // OK, no access of borrowed data _ if false => (), A(_, r) => (), } x; } fn underscore_example(mut c: i32) { let r = &mut c; match c { // OK, no access of borrowed data (or any data at all) _ if false => (), _ => (), } r; } ...
fn indirect_struct_example(mut b: &mut A) {
random_line_split
match-on-borrowed.rs
// Test that a (partially) mutably borrowed place can be matched on, so long as // we don't have to read any values that are mutably borrowed to determine // which arm to take. // // Test that we don't allow mutating the value being matched on in a way that // changes which patterns it matches, until we have chosen an ...
enum Never {} fn never_init() { let n: Never; match n {} //~ ERROR } fn main() {}
{ let x = &mut t; match t { true => (), //~ ERROR false => (), } x; }
identifier_body
namespaces.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 cssparser::ast::*; use std::collections::hashmap::HashMap; use servo_util::namespace::Namespace; use errors::l...
} } pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) { let location = rule.location; macro_rules! syntax_error( () => {{ log_css_error(location, "Invalid @namespace rule"); return }}; ); if rule.block.is_some() { syntax_error!() } ...
impl NamespaceMap { pub fn new() -> NamespaceMap { NamespaceMap { default: None, prefix_map: HashMap::new() }
random_line_split
namespaces.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 cssparser::ast::*; use std::collections::hashmap::HashMap; use servo_util::namespace::Namespace; use errors::l...
} pub fn parse_namespace_rule(rule: AtRule, namespaces: &mut NamespaceMap) { let location = rule.location; macro_rules! syntax_error( () => {{ log_css_error(location, "Invalid @namespace rule"); return }}; ); if rule.block.is_some() { syntax_error!() } let ...
{ NamespaceMap { default: None, prefix_map: HashMap::new() } }
identifier_body
namespaces.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 cssparser::ast::*; use std::collections::hashmap::HashMap; use servo_util::namespace::Namespace; use errors::l...
}, (None, Some(ns)) => { if namespaces.default.is_some() { log_css_error(location, "Duplicate @namespace rule"); } namespaces.default = Some(ns); }, _ => syntax_error!() } }
{ log_css_error(location, "Duplicate @namespace rule"); }
conditional_block
namespaces.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 cssparser::ast::*; use std::collections::hashmap::HashMap; use servo_util::namespace::Namespace; use errors::l...
(rule: AtRule, namespaces: &mut NamespaceMap) { let location = rule.location; macro_rules! syntax_error( () => {{ log_css_error(location, "Invalid @namespace rule"); return }}; ); if rule.block.is_some() { syntax_error!() } let mut prefix: Option<String> = Non...
parse_namespace_rule
identifier_name
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
(&self) -> Option<Root<HTMLFormElement>> { self.form_owner() } } impl Validatable for HTMLObjectElement {} impl VirtualMethods for HTMLObjectElement { fn super_type(&self) -> Option<&VirtualMethods> { Some(self.upcast::<HTMLElement>() as &VirtualMethods) } fn attribute_mutated(&self, ...
GetForm
identifier_name
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
} impl Validatable for HTMLObjectElement {} impl VirtualMethods for HTMLObjectElement { fn super_type(&self) -> Option<&VirtualMethods> { Some(self.upcast::<HTMLElement>() as &VirtualMethods) } fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { self.super_type().unwr...
{ self.form_owner() }
identifier_body
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
} } } impl HTMLObjectElementMethods for HTMLObjectElement { // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(&self) -> Root<ValidityState> { let window = window_from_node(self); ValidityState::new(window.r(), self.upcast()) } // https://html.spec.wha...
{ }
conditional_block
htmlobjectelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::Attr; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::HTMLObjectElementB...
use dom::element::{AttributeMutation, Element}; use dom::htmlelement::HTMLElement; use dom::htmlformelement::{FormControl, HTMLFormElement}; use dom::node::{Node, window_from_node}; use dom::validation::Validatable; use dom::validitystate::ValidityState; use dom::virtualmethods::VirtualMethods; use net_traits::image::b...
use dom::bindings::str::DOMString; use dom::document::Document;
random_line_split
image.rs
// // // use geom::{Rect,Px}; use surface::Colour; pub enum Align { Left, Center, Right, } //enum Tile { // None, // Stretch, // Repeat, //} /// Static image wrapper pub struct Image<T: Buffer> { has_changed: ::std::cell::Cell<bool>, align_v: Align, align_h: Align, data: T, } impl Align { fn get_ofs(&self, ...
; //kernel_log!("c = {:x}, alpha = {}", c.as_argb32(), a); *d = Colour::blend_alpha( Colour::from_argb32(*d), c, 255 - a ).as_argb32(); } }); } }
{ self.bg }
conditional_block
image.rs
// // // use geom::{Rect,Px}; use surface::Colour; pub enum Align { Left, Center, Right, } //enum Tile { // None, // Stretch, // Repeat, //} /// Static image wrapper pub struct Image<T: Buffer> { has_changed: ::std::cell::Cell<bool>, align_v: Align, align_h: Align, data: T, } impl Align { fn get_ofs(&self, ...
fn render(&self, surface: ::surface::SurfaceView, force: bool) { if force || self.has_changed.get() { let (i_w, i_h) = self.dims_px(); let x = self.align_h.get_ofs(i_w, surface.width()); let y = self.align_h.get_ofs(i_h, surface.height()); let subsurf = surface.slice( Rect::new(Px(x), Px(y), Px(!0), Px...
{ // Don't care false }
identifier_body
image.rs
// // // use geom::{Rect,Px}; use surface::Colour; pub enum Align { Left, Center, Right, } //enum Tile { // None, // Stretch, // Repeat, //} /// Static image wrapper pub struct Image<T: Buffer> { has_changed: ::std::cell::Cell<bool>, align_v: Align, align_h: Align, data: T, } impl Align { fn get_ofs(&self, ...
pub struct RasterBiA { bg: ::surface::Colour, fg: ::surface::Colour, width: usize, data: Vec<bool>, // TODO: Use BitVec or similar alpha: Vec<u8>, } impl RasterBiA { pub fn new_img<P: AsRef<::std::fs::Path>>(path: P, fg: ::surface::Colour, bg: ::surface::Colour) -> Result<Image<Self>,LoadError> { Self::new(path...
} } /// Raster two-colour image with alpha
random_line_split
image.rs
// // // use geom::{Rect,Px}; use surface::Colour; pub enum Align { Left, Center, Right, } //enum Tile { // None, // Stretch, // Repeat, //} /// Static image wrapper pub struct
<T: Buffer> { has_changed: ::std::cell::Cell<bool>, align_v: Align, align_h: Align, data: T, } impl Align { fn get_ofs(&self, item: u32, avail: u32) -> u32 { if item >= avail { return 0; } match self { &Align::Left => 0, &Align::Center => avail / 2 - item / 2, &Align::Right => avail - item, } ...
Image
identifier_name
lib.rs
extern crate gitignore; extern crate libc; use std::ffi::CStr; use std::ffi::CString; use std::mem; use std::path::{Path, PathBuf}; use std::string::FromUtf8Error; #[repr(C)] pub struct RubyArray { len: libc::size_t, data: *const libc::c_void, } impl RubyArray { fn from_vec<T>(vec: Vec<T>) -> RubyArr...
(path_ptr: *const libc::c_char) -> RubyArray { let path_string = ptr_to_string(path_ptr).unwrap(); let path = Path::new(&*path_string).to_path_buf(); let gitignore_path = path.join(".gitignore"); let file = gitignore::File::new(&gitignore_path).unwrap(); let files = file.included_files().unwrap();...
included_files
identifier_name
lib.rs
extern crate gitignore; extern crate libc; use std::ffi::CStr; use std::ffi::CString; use std::mem; use std::path::{Path, PathBuf}; use std::string::FromUtf8Error; #[repr(C)] pub struct RubyArray { len: libc::size_t, data: *const libc::c_void, } impl RubyArray { fn from_vec<T>(vec: Vec<T>) -> RubyArr...
let path_string = ptr_to_string(path_ptr).unwrap(); let path = Path::new(&*path_string).to_path_buf(); let gitignore_path = path.join(".gitignore"); let file = gitignore::File::new(&gitignore_path).unwrap(); let files = file.included_files().unwrap(); RubyArray::from_vec(paths_to_ptrs(files)) ...
pub extern "C" fn included_files(path_ptr: *const libc::c_char) -> RubyArray {
random_line_split
test_pd_client.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use grpcio::EnvBuilder; use kvproto::metapb::*; use pd_client::{PdClient, RegionInfo, RegionStat, RpcClient}; use security::{SecurityConfig, SecurityManager}; use test_pd::{mocker::*, util::*, Server as MockServer}; use tikv_util::config::ReadableDurat...
// Clean up the fail point. fail::remove(pd_client_reconnect_fp); handle.join().unwrap(); } // Reconnection will be speed limited. #[test] fn test_reconnect_limit() { let pd_client_reconnect_fp = "pd_client_reconnect"; let (_server, client) = new_test_server_and_client(ReadableDuration::secs(100)...
{ panic!("pd client2 is blocked"); }
conditional_block
test_pd_client.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use grpcio::EnvBuilder; use kvproto::metapb::*; use pd_client::{PdClient, RegionInfo, RegionStat, RpcClient}; use security::{SecurityConfig, SecurityManager}; use test_pd::{mocker::*, util::*, Server as MockServer}; use tikv_util::config::ReadableDurat...
request!(client => block_on(get_region_by_id(0))), request!(client => block_on(region_heartbeat(0, Region::default(), Peer::default(), RegionStat::default(), None))), request!(client => block_on(ask_split(Region::default()))), request!(client => block_on(ask_batch_split(Region::default()...
{ let (_server, client) = new_test_server_and_client(ReadableDuration::millis(100)); let client = Arc::new(client); let pd_client_reconnect_fp = "pd_client_reconnect"; // It contains all interfaces of PdClient. let test_funcs: Vec<(_, Box<dyn FnOnce() + Send>)> = vec![ request!(client => re...
identifier_body
test_pd_client.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use grpcio::EnvBuilder; use kvproto::metapb::*; use pd_client::{PdClient, RegionInfo, RegionStat, RpcClient}; use security::{SecurityConfig, SecurityManager}; use test_pd::{mocker::*, util::*, Server as MockServer}; use tikv_util::config::ReadableDurat...
() { let pd_client_reconnect_fp = "pd_client_reconnect"; let (_server, client) = new_test_server_and_client(ReadableDuration::secs(100)); // The GLOBAL_RECONNECT_INTERVAL is 0.1s so sleeps 0.2s here. thread::sleep(Duration::from_millis(200)); // The first reconnection will succeed, and the last_up...
test_reconnect_limit
identifier_name
test_pd_client.rs
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use grpcio::EnvBuilder; use kvproto::metapb::*;
use test_pd::{mocker::*, util::*, Server as MockServer}; use tikv_util::config::ReadableDuration; use std::sync::{mpsc, Arc}; use std::thread; use std::time::Duration; fn new_test_server_and_client( update_interval: ReadableDuration, ) -> (MockServer<Service>, RpcClient) { let server = MockServer::new(1); ...
use pd_client::{PdClient, RegionInfo, RegionStat, RpcClient}; use security::{SecurityConfig, SecurityManager};
random_line_split
depart.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless r...
use hcore::crypto::SymKey; use error::{Error, Result}; pub fn run( ui: &mut UI, member_id: &str, peers: Vec<String>, ring_key: Option<SymKey>, ) -> Result<()> { ui.begin( format!("Permanently marking {} as departed", member_id), )?; ui.status( Status::Creating, form...
use common::ui::{Status, UI};
random_line_split
depart.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless r...
( ui: &mut UI, member_id: &str, peers: Vec<String>, ring_key: Option<SymKey>, ) -> Result<()> { ui.begin( format!("Permanently marking {} as departed", member_id), )?; ui.status( Status::Creating, format!("service configuration"), )?; for peer in peers.into_it...
run
identifier_name
depart.rs
// Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless r...
thread::sleep(time::Duration::from_millis(100)); } ui.end("Departure recorded.")?; Ok(()) }
{ ui.begin( format!("Permanently marking {} as departed", member_id), )?; ui.status( Status::Creating, format!("service configuration"), )?; for peer in peers.into_iter() { ui.status(Status::Applying, format!("to peer {}", peer))?; let mut client = Client::new...
identifier_body
sequence.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/. */ //! Utilities for paquet sequencing use std::cmp::*; use std::iter::Step; use std::num::{Zero, One}; #[derive...
Some(val) => self.0 = val, None => self.0 = I::zero() }; self.0.clone() } pub fn stepu(&mut self) { let _ = self.step(); } } #[test] fn test_step_incr() { let mut seq = Sequence::new(0 as u8); assert_eq!(0, seq.0); seq.step(); assert_eq!(1, seq.0); s...
match self.0.step(&I::one()) {
random_line_split
sequence.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/. */ //! Utilities for paquet sequencing use std::cmp::*; use std::iter::Step; use std::num::{Zero, One}; #[derive...
(&mut self) -> I { match self.0.step(&I::one()) { Some(val) => self.0 = val, None => self.0 = I::zero() }; self.0.clone() } pub fn stepu(&mut self) { let _ = self.step(); } } #[test] fn test_step_incr() { let mut seq = Sequence::new(0 as u8); assert_eq!(...
step
identifier_name
sequence.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/. */ //! Utilities for paquet sequencing use std::cmp::*; use std::iter::Step; use std::num::{Zero, One}; #[derive...
} #[test] fn test_step_incr() { let mut seq = Sequence::new(0 as u8); assert_eq!(0, seq.0); seq.step(); assert_eq!(1, seq.0); seq.step(); assert_eq!(2, seq.0); seq.step(); assert_eq!(3, seq.0); seq.step(); assert_eq!(4, seq.0) } #[test] fn test_step_cycle() { use std::u8; ...
{ let _ = self.step(); }
identifier_body
problem-005.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // 2520 is the smallest number that can be divided by each of the numbers // from 1 to 10 without any remainder. // // What is the smallest positive number that is evenly divisible by all of // the numbers from 1...
} #[cfg(test)] mod tests { use super::*; use test::Bencher; #[test] fn correct() { assert_eq!(232792560, solution()); } #[bench] fn bench(b: &mut Bencher) { b.iter(|| solution()); } }
} fn main() { println!("The smallest positive integer divisible by all of [1,20] is {}", solution());
random_line_split
problem-005.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // 2520 is the smallest number that can be divided by each of the numbers // from 1 to 10 without any remainder. // // What is the smallest positive number that is evenly divisible by all of // the numbers from 1...
() { assert_eq!(232792560, solution()); } #[bench] fn bench(b: &mut Bencher) { b.iter(|| solution()); } }
correct
identifier_name
problem-005.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // 2520 is the smallest number that can be divided by each of the numbers // from 1 to 10 without any remainder. // // What is the smallest positive number that is evenly divisible by all of // the numbers from 1...
} } return n; } fn main() { println!("The smallest positive integer divisible by all of [1,20] is {}", solution()); } #[cfg(test)] mod tests { use super::*; use test::Bencher; #[test] fn correct() { assert_eq!(232792560, solution()); } #[bench] fn bench(b: &m...
{ all_divisible = false; break; }
conditional_block
problem-005.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // 2520 is the smallest number that can be divided by each of the numbers // from 1 to 10 without any remainder. // // What is the smallest positive number that is evenly divisible by all of // the numbers from 1...
#[bench] fn bench(b: &mut Bencher) { b.iter(|| solution()); } }
{ assert_eq!(232792560, solution()); }
identifier_body
list.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("List", inherited=True) %> ${help...
gujarati gurmukhi kannada khmer lao malayalam mongolian myanmar oriya persian telugu thai tibetan cjk-earthly-branch cjk-heavenly-stem lower-greek hiragana hiragana-iroha katakana katakana-iroha""", gecko_con...
// [1]: http://dev.w3.org/csswg/css-counter-styles/ ${helpers.single_keyword("list-style-type", """ disc none circle square decimal lower-alpha upper-alpha disclosure-open disclosure-closed """, extra_servo_values="""arabic-indic bengali cambodian cjk-decimal devanagari
random_line_split
list.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("List", inherited=True) %> ${help...
{ None, Url(Url), } impl ToCss for SpecifiedValue { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { match *self { SpecifiedValue::None => dest.write_str("none"), SpecifiedValue::Url(ref url) => url.to_css(dest), ...
SpecifiedValue
identifier_name
list.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <% data.new_style_struct("List", inherited=True) %> ${help...
} #[inline] pub fn get_initial_value() -> computed_value::T { computed_value::T(vec![ ("\u{201c}".to_owned(), "\u{201d}".to_owned()), ("\u{2018}".to_owned(), "\u{2019}".to_owned()), ]) } pub fn parse(_: &ParserContext, input: &mut Parser) -> Result<Specifie...
{ let mut first = true; for pair in &self.0 { if !first { try!(dest.write_str(" ")); } first = false; try!(Token::QuotedString(Cow::from(&*pair.0)).to_css(dest)); try!(dest.write_str(" ")); ...
identifier_body
row_polymorphism.rs
use gluon::{
}; use crate::support::make_vm; #[macro_use] mod support; test_expr! { polymorphic_field_access, r#" let f record = record.x f { y = 1, x = 123 } "#, 123 } test_expr! { polymorphic_record_unpack, r#" let f record = let { x, y } = record x #Int- y f { y = 1, z = 0, x = 123 } "#, 122 } #[test] fn polymorphic...
vm::api::{FunctionRef, Hole, OpaqueValue}, Thread, ThreadExt,
random_line_split
row_polymorphism.rs
use gluon::{ vm::api::{FunctionRef, Hole, OpaqueValue}, Thread, ThreadExt, }; use crate::support::make_vm; #[macro_use] mod support; test_expr! { polymorphic_field_access, r#" let f record = record.x f { y = 1, x = 123 } "#, 123 } test_expr! { polymorphic_record_unpack, r#" let f record = let { x, y } =...
// FIXME Add this test back when order no longer matters for fields // test_expr! { prelude different_order_on_fields, // r#" // let x = // if False then // { x = 1, y = "a" } // else // { y = "b", x = 2 } // x.y // "#, // String::from("a") // } //
{ let _ = ::env_logger::try_init(); let vm = make_vm(); let child = vm.new_thread().unwrap(); vm.run_expr::<OpaqueValue<&Thread, Hole>>("", "import! std.function") .unwrap(); let result = child.run_expr::<FunctionRef<fn(i32) -> i32>>( "test", r#" let function = impo...
identifier_body
row_polymorphism.rs
use gluon::{ vm::api::{FunctionRef, Hole, OpaqueValue}, Thread, ThreadExt, }; use crate::support::make_vm; #[macro_use] mod support; test_expr! { polymorphic_field_access, r#" let f record = record.x f { y = 1, x = 123 } "#, 123 } test_expr! { polymorphic_record_unpack, r#" let f record = let { x, y } =...
() { let _ = ::env_logger::try_init(); let vm = make_vm(); let child = vm.new_thread().unwrap(); vm.run_expr::<OpaqueValue<&Thread, Hole>>("", "import! std.function") .unwrap(); let result = child.run_expr::<FunctionRef<fn(i32) -> i32>>( "test", r#" let function = im...
polymorphic_record_access_from_child_thread
identifier_name
stylesheet_set.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/. */ //! A centralized set of stylesheets for a document. use dom::TElement; use invalidation::stylesheets::Stylesheet...
/// Returns whether the given set has changed from the last flush. pub fn has_changed(&self) -> bool { self.dirty } /// Flush the current set, unmarking it as dirty, and returns an iterator /// over the new stylesheet list. pub fn flush<E>( &mut self, document_element:...
{ debug!("StylesheetSet::set_author_style_disabled"); if self.author_style_disabled == disabled { return; } self.author_style_disabled = disabled; self.dirty = true; self.invalidations.invalidate_fully(); }
identifier_body
stylesheet_set.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/. */ //! A centralized set of stylesheets for a document. use dom::TElement; use invalidation::stylesheets::Stylesheet...
&sheet, guard ); self.entries.insert(0, StylesheetSetEntry { sheet }); self.dirty = true; } /// Insert a given stylesheet before another stylesheet in the document. pub fn insert_stylesheet_before( &mut self, stylist: &Stylist, sheet: ...
self.invalidations.collect_invalidations_for( stylist,
random_line_split
stylesheet_set.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/. */ //! A centralized set of stylesheets for a document. use dom::TElement; use invalidation::stylesheets::Stylesheet...
self.author_style_disabled = disabled; self.dirty = true; self.invalidations.invalidate_fully(); } /// Returns whether the given set has changed from the last flush. pub fn has_changed(&self) -> bool { self.dirty } /// Flush the current set, unmarking it as dirty, ...
{ return; }
conditional_block
stylesheet_set.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/. */ //! A centralized set of stylesheets for a document. use dom::TElement; use invalidation::stylesheets::Stylesheet...
( &mut self, stylist: &Stylist, sheet: S, guard: &SharedRwLockReadGuard, ) { debug!("StylesheetSet::remove_stylesheet"); self.remove_stylesheet_if_present(&sheet); self.dirty = true; self.invalidations.collect_invalidations_for( stylist, ...
remove_stylesheet
identifier_name
cli.rs
//! Provides the CLI option parser //! //! Used to parse the argv/config file into a struct that //! the server can consume and use as configuration data. use docopt::Docopt; static USAGE: &'static str = " Usage: statsd [options] statsd --help Options: -h, --help Print help information. -p, --p...
{ pub flag_port: u16, pub flag_admin_port: u16, pub flag_admin_host: String, pub flag_flush_interval: u64, pub flag_console: bool, pub flag_graphite: bool, pub flag_graphite_port: u16, pub flag_graphite_host: String, pub flag_help: bool, } pub fn parse_args() -> Args { let args...
Args
identifier_name
cli.rs
//! Provides the CLI option parser //! //! Used to parse the argv/config file into a struct that //! the server can consume and use as configuration data. use docopt::Docopt; static USAGE: &'static str = " Usage: statsd [options] statsd --help Options: -h, --help Print help information. -p, --p...
--graphite-port=<p> The port graphite/carbon is running on. [default: 2003]. --graphite-host=<p> The host graphite/carbon is running on. [default: 127.0.0.1] --admin-host=<p> The host to bind the management server on. [default: 127.0.0.1] --admin-port=<p> The port to bind the management server to....
--graphite Enable the graphite backend.
random_line_split
image.rs
extern crate piston_window; extern crate find_folder; use piston_window::*; fn main() { let opengl = OpenGL::V3_2; let mut window: PistonWindow = WindowSettings::new("piston: image", [300, 300]) .exit_on_esc(true) .graphics_api(opengl) .build() .unwrap(); let assets = ...
image(&rust_logo, c.transform, g); }); } }
window.set_lazy(true); while let Some(e) = window.next() { window.draw_2d(&e, |c, g, _| { clear([1.0; 4], g);
random_line_split
image.rs
extern crate piston_window; extern crate find_folder; use piston_window::*; fn main()
window.draw_2d(&e, |c, g, _| { clear([1.0; 4], g); image(&rust_logo, c.transform, g); }); } }
{ let opengl = OpenGL::V3_2; let mut window: PistonWindow = WindowSettings::new("piston: image", [300, 300]) .exit_on_esc(true) .graphics_api(opengl) .build() .unwrap(); let assets = find_folder::Search::ParentsThenKids(3, 3) .for_folder("assets").unwrap(); ...
identifier_body
image.rs
extern crate piston_window; extern crate find_folder; use piston_window::*; fn
() { let opengl = OpenGL::V3_2; let mut window: PistonWindow = WindowSettings::new("piston: image", [300, 300]) .exit_on_esc(true) .graphics_api(opengl) .build() .unwrap(); let assets = find_folder::Search::ParentsThenKids(3, 3) .for_folder("assets").unwrap(); ...
main
identifier_name
skip_split_operation.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::DIRECTIVE_SPLIT_OPERATION; use common::NamedItem; use graphql_ir::{FragmentDefinition, OperationDefinition, Program, T...
else { Transformed::Keep } } fn transform_fragment(&mut self, _: &FragmentDefinition) -> Transformed<FragmentDefinition> { Transformed::Keep } }
{ Transformed::Delete }
conditional_block
skip_split_operation.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::DIRECTIVE_SPLIT_OPERATION; use common::NamedItem; use graphql_ir::{FragmentDefinition, OperationDefinition, Program, T...
Transformed::Delete } else { Transformed::Keep } } fn transform_fragment(&mut self, _: &FragmentDefinition) -> Transformed<FragmentDefinition> { Transformed::Keep } }
.directives .named(*DIRECTIVE_SPLIT_OPERATION) .is_some() {
random_line_split
skip_split_operation.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::DIRECTIVE_SPLIT_OPERATION; use common::NamedItem; use graphql_ir::{FragmentDefinition, OperationDefinition, Program, T...
( &mut self, operation: &OperationDefinition, ) -> Transformed<OperationDefinition> { if operation .directives .named(*DIRECTIVE_SPLIT_OPERATION) .is_some() { Transformed::Delete } else { Transformed::Keep } ...
transform_operation
identifier_name
skip_split_operation.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ use crate::DIRECTIVE_SPLIT_OPERATION; use common::NamedItem; use graphql_ir::{FragmentDefinition, OperationDefinition, Program, T...
pub struct SkipSplitOperation; impl Transformer for SkipSplitOperation { const NAME: &'static str = "SkipSplitOperationTransform"; const VISIT_ARGUMENTS: bool = false; const VISIT_DIRECTIVES: bool = false; fn transform_operation( &mut self, operation: &OperationDefinition, ) -> T...
{ let mut transform = SkipSplitOperation {}; transform .transform_program(program) .replace_or_else(|| program.clone()) }
identifier_body
entry.rs
use memory::Frame; pub struct Entry(u64); impl Entry { pub fn is_unused(&self) -> bool
pub fn set_unused(&mut self) { self.0 = 0; } pub fn flags(&self) -> EntryFlags { EntryFlags::from_bits_truncate(self.0) } pub fn pointed_frame(&self) -> Option<Frame> { if self.flags().contains(PRESENT) { Some(Frame::containing_address(self.0 as usize & 0x000f...
{ self.0 == 0 }
identifier_body
entry.rs
use memory::Frame; pub struct Entry(u64); impl Entry { pub fn is_unused(&self) -> bool { self.0 == 0 } pub fn set_unused(&mut self) { self.0 = 0; } pub fn flags(&self) -> EntryFlags { EntryFlags::from_bits_truncate(self.0) } pub fn pointed_frame(&self) -> Option<...
} pub fn set(&mut self, frame: Frame, flags: EntryFlags) { assert!(frame.start_address() &!0x000fffff_fffff000 == 0); self.0 = (frame.start_address() as u64) | flags.bits(); } } bitflags! { flags EntryFlags: u64 { const PRESENT = 1 << 0, const WRITABLE = ...
{ None }
conditional_block
entry.rs
use memory::Frame; pub struct Entry(u64); impl Entry { pub fn is_unused(&self) -> bool { self.0 == 0 } pub fn
(&mut self) { self.0 = 0; } pub fn flags(&self) -> EntryFlags { EntryFlags::from_bits_truncate(self.0) } pub fn pointed_frame(&self) -> Option<Frame> { if self.flags().contains(PRESENT) { Some(Frame::containing_address(self.0 as usize & 0x000fffff_fffff000)) ...
set_unused
identifier_name
entry.rs
use memory::Frame;
pub fn is_unused(&self) -> bool { self.0 == 0 } pub fn set_unused(&mut self) { self.0 = 0; } pub fn flags(&self) -> EntryFlags { EntryFlags::from_bits_truncate(self.0) } pub fn pointed_frame(&self) -> Option<Frame> { if self.flags().contains(PRESENT) { ...
pub struct Entry(u64); impl Entry {
random_line_split
windowing.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. use compositor...
{ Click(MouseButton, TypedPoint2D<f32, DevicePixel>), MouseDown(MouseButton, TypedPoint2D<f32, DevicePixel>), MouseUp(MouseButton, TypedPoint2D<f32, DevicePixel>), } #[derive(Clone)] pub enum WindowNavigateMsg { Forward, Back, } /// Events that the windowing system sends to Servo. #[derive(Clone)...
MouseWindowEvent
identifier_name
windowing.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. use compositor...
fn present(&self); /// Return the size of the window with head and borders and position of the window values fn client_window(&self) -> (Size2D<u32>, Point2D<i32>); /// Set the size inside of borders and head fn set_inner_size(&self, size: Size2D<u32>); /// Set the window position fn set_po...
random_line_split
from_form.rs
use request::FormItems; /// Trait to create an instance of some type from an HTTP form. The /// [Form](struct.Form.html) type requires that its generic parameter implements /// this trait. /// /// This trait can be automatically derived via the /// [rocket_codegen](/rocket_codegen) plugin: /// /// ```rust /// #![featu...
/// [FormItems](struct.FormItems.html) iterator to iterate through the form /// key/value pairs. Be aware that form fields that are typically hidden from /// your application, such as `_method`, will be present while iterating. pub trait FromForm<'f>: Sized { /// The associated error to be returned when parsing fai...
random_line_split
from_form.rs
use request::FormItems; /// Trait to create an instance of some type from an HTTP form. The /// [Form](struct.Form.html) type requires that its generic parameter implements /// this trait. /// /// This trait can be automatically derived via the /// [rocket_codegen](/rocket_codegen) plugin: /// /// ```rust /// #![featu...
}
{ items.mark_complete(); Ok(items.inner_str()) }
identifier_body
from_form.rs
use request::FormItems; /// Trait to create an instance of some type from an HTTP form. The /// [Form](struct.Form.html) type requires that its generic parameter implements /// this trait. /// /// This trait can be automatically derived via the /// [rocket_codegen](/rocket_codegen) plugin: /// /// ```rust /// #![featu...
(items: &mut FormItems<'f>) -> Result<Self, Self::Error> { items.mark_complete(); Ok(items.inner_str()) } }
from_form_items
identifier_name
workernavigator.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use dom::bindings::codegen::Bindings::WorkerNavigato...
// https://html.spec.whatwg.org/multipage/#dom-navigator-appname fn AppName(&self) -> DOMString { navigatorinfo::AppName() } // https://html.spec.whatwg.org/multipage/#dom-navigator-appcodename fn AppCodeName(&self) -> DOMString { navigatorinfo::AppCodeName() } // https://...
fn TaintEnabled(&self) -> bool { navigatorinfo::TaintEnabled() }
random_line_split
workernavigator.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use dom::bindings::codegen::Bindings::WorkerNavigato...
pub fn new(global: &WorkerGlobalScope) -> Root<WorkerNavigator> { reflect_dom_object(box WorkerNavigator::new_inherited(), global, WorkerNavigatorBinding::Wrap) } } impl WorkerNavigatorMethods for WorkerNavigator { // https://html.spec.whatwg....
{ WorkerNavigator { reflector_: Reflector::new(), } }
identifier_body
workernavigator.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::WorkerNavigatorBinding; use dom::bindings::codegen::Bindings::WorkerNavigato...
(&self) -> DOMString { navigatorinfo::Platform() } // https://html.spec.whatwg.org/multipage/#dom-navigator-useragent fn UserAgent(&self) -> DOMString { navigatorinfo::UserAgent() } // https://html.spec.whatwg.org/multipage/#dom-navigator-appversion fn AppVersion(&self) -> DOMS...
Platform
identifier_name
checks.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/. */ //! Different checks done during the style sharing process in order to determine //! quickly whether it's worth to...
/// Whether two elements have the same same presentational attributes. pub fn have_same_presentational_hints<E>( target: &mut StyleSharingTarget<E>, candidate: &mut StyleSharingCandidate<E> ) -> bool where E: TElement, { target.pres_hints() == candidate.pres_hints() } /// Whether a given element has ...
{ match (target.style_attribute(), candidate.style_attribute()) { (None, None) => true, (Some(_), None) | (None, Some(_)) => false, (Some(a), Some(b)) => &*a as *const _ == &*b as *const _ } }
identifier_body
checks.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/. */ //! Different checks done during the style sharing process in order to determine //! quickly whether it's worth to...
} } /// Whether two elements have the same same presentational attributes. pub fn have_same_presentational_hints<E>( target: &mut StyleSharingTarget<E>, candidate: &mut StyleSharingCandidate<E> ) -> bool where E: TElement, { target.pres_hints() == candidate.pres_hints() } /// Whether a given eleme...
random_line_split
checks.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/. */ //! Different checks done during the style sharing process in order to determine //! quickly whether it's worth to...
<E>( target: &mut StyleSharingTarget<E>, candidate: &mut StyleSharingCandidate<E>, ) -> bool where E: TElement, { target.class_list() == candidate.class_list() } /// Whether a given element and a candidate match the same set of "revalidation" /// selectors. /// /// Revalidation selectors are those that...
have_same_class
identifier_name
recursion_limit_deref.rs
// Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a long chain of Deref impls // which will cause an overflow during the autoderef loop. #![allow(dead_code)] #![recursion_limit="10"] macro_rules! link { ($outer:ident, $inner:ident) => { struct $...
; impl Bottom { fn new() -> Bottom { Bottom } } link!(Top, A); link!(A, B); link!(B, C); link!(C, D); link!(D, E); link!(E, F); link!(F, G); link!(G, H); link!(H, I); link!(I, J); link!(J, K); link!(K, Bottom); fn main() { let t = Top::new(); let x: &Bottom = &t; //~ ERROR mismatched types ...
Bottom
identifier_name
recursion_limit_deref.rs
// Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a long chain of Deref impls // which will cause an overflow during the autoderef loop. #![allow(dead_code)] #![recursion_limit="10"] macro_rules! link { ($outer:ident, $inner:ident) => { struct $...
{ let t = Top::new(); let x: &Bottom = &t; //~ ERROR mismatched types //~^ error recursion limit }
identifier_body
recursion_limit_deref.rs
// Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a long chain of Deref impls // which will cause an overflow during the autoderef loop. #![allow(dead_code)] #![recursion_limit="10"] macro_rules! link { ($outer:ident, $inner:ident) => { struct $...
&self.0 } } } } struct Bottom; impl Bottom { fn new() -> Bottom { Bottom } } link!(Top, A); link!(A, B); link!(B, C); link!(C, D); link!(D, E); link!(E, F); link!(F, G); link!(G, H); link!(H, I); link!(I, J); link!(J, K); link!(K, Bottom); fn main() { let t...
impl std::ops::Deref for $outer { type Target = $inner; fn deref(&self) -> &$inner {
random_line_split
lib.rs
// =================================================================
// // Changes made to this file will be overwritten. If changes are // required to the generated code, the service_crategen project // must be updated to generate the changes. // // ================================================================= #![doc( html_logo_url = "https://raw.githubusercontent.com/rusoto...
// // * WARNING * // // This file is generated!
random_line_split
main.rs
/* Aurélien DESBRIÈRES aurelien(at)hackers(dot)camp License GNU GPL latest */ // Rust experimentations // Borrowing Aliasing in Rust struct Point { x: i32, y: i32, z: i32 } fn ma
{ let mut point = Point { x: 0, y: 0, z: 0 }; { let borrowed_point = &point; let another_borrow = &point; // Data can be accessed via the references an the original owner println!("Point has coordiantes: ({}, {}, {})", borrowed_point.x, another_borrow.y, point...
in()
identifier_name
main.rs
/* Aurélien DESBRIÈRES aurelien(at)hackers(dot)camp License GNU GPL latest */ // Rust experimentations // Borrowing Aliasing in Rust struct Point { x: i32, y: i32, z: i32 } fn main() {
// Change data via mutable reference mutable_borrow.x = 5; mutable_borrow.y = 2; mutable_borrow.z = 1; // Error! Can't borrow `point` as immutable because it's currently // borrowed as mutable. //let y = &point.y. // TODO ^ Try uncommenting this line ...
let mut point = Point { x: 0, y: 0, z: 0 }; { let borrowed_point = &point; let another_borrow = &point; // Data can be accessed via the references an the original owner println!("Point has coordiantes: ({}, {}, {})", borrowed_point.x, another_borrow.y, point.z)...
identifier_body
main.rs
/* Aurélien DESBRIÈRES aurelien(at)hackers(dot)camp License GNU GPL latest */ // Rust experimentations // Borrowing Aliasing in Rust struct Point { x: i32, y: i32, z: i32 } fn main() { let mut point = Point { x: 0, y: 0, z: 0 }; { let borrowed_point = &point; let another_borrow = &point; ...
mutable_borrow.x = 5; mutable_borrow.y = 2; mutable_borrow.z = 1; // Error! Can't borrow `point` as immutable because it's currently // borrowed as mutable. //let y = &point.y. // TODO ^ Try uncommenting this line // Error! Can't print because `println!`...
{ let mutable_borrow = &mut point; // Change data via mutable reference
random_line_split
typing.rs
use std::sync::Arc; #[cfg(all(feature = "tokio_compat", not(feature = "tokio")))] use tokio::time::delay_for as sleep; #[cfg(feature = "tokio")] use tokio::time::sleep; use tokio::{ sync::oneshot::{self, error::TryRecvError, Sender}, time::Duration, }; use crate::{error::Result, http::Http}; /// A struct to ...
(Sender<()>); impl Typing { /// Starts typing in the specified [`Channel`] for an indefinite period of time. /// /// Returns [`Typing`]. To stop typing, you must call the [`Typing::stop`] method on /// the returned [`Typing`] object or wait for it to be dropped. Note that on some /// clients, typin...
Typing
identifier_name