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
issue-35668.rs
// Copyright 2016 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
fn func<'a, T>(a: &'a [T]) -> impl Iterator<Item=&'a T> { a.iter().map(|a| a*a) //~^ ERROR binary operation `*` cannot be applied to type `&T` } fn main() { let a = (0..30).collect::<Vec<_>>(); for k in func(&a) { println!("{}", k); } }
// <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.
random_line_split
sudoku.rs
// http://rosettacode.org/wiki/Sudoku #![feature(core)] #![feature(step_by)] use std::fmt; use std::str::FromStr; const BOARD_WIDTH: usize = 9; const BOARD_HEIGHT: usize = 9; const GROUP_WIDTH: usize = 3; const GROUP_HEIGHT: usize = 3; const MAX_NUMBER: usize = 9; type BITS = u16; const MASK_ALL: BITS = 0x1ff; const ...
() -> Sudoku { Sudoku { map: [[MASK_ALL; BOARD_WIDTH]; BOARD_HEIGHT] } } fn get(&self, x: usize, y: usize) -> u32 { match self.map[y][x].count_ones() { 0 => INVALID_CELL, 1 => self.map[y][x].trailing_zeros() + 1, _ => 0 } } fn set(&mut self, ...
new
identifier_name
sudoku.rs
// http://rosettacode.org/wiki/Sudoku #![feature(core)] #![feature(step_by)] use std::fmt; use std::str::FromStr; const BOARD_WIDTH: usize = 9; const BOARD_HEIGHT: usize = 9; const GROUP_WIDTH: usize = 3; const GROUP_HEIGHT: usize = 3; const MAX_NUMBER: usize = 9; type BITS = u16; const MASK_ALL: BITS = 0x1ff; const ...
next }; puzzle.map[next.unwrap()][x] = bit; } // Check each group for y0 in (0..BOARD_HEIGHT).step_by(GROUP_WIDTH) { for x0 in (0..BOARD_WIDTH).step_by(GROUP_HEIGHT) { let next = { ...
{ continue }
conditional_block
sudoku.rs
// http://rosettacode.org/wiki/Sudoku #![feature(core)] #![feature(step_by)] use std::fmt; use std::str::FromStr; const BOARD_WIDTH: usize = 9; const BOARD_HEIGHT: usize = 9; const GROUP_WIDTH: usize = 3; const GROUP_HEIGHT: usize = 3; const MAX_NUMBER: usize = 9; type BITS = u16; const MASK_ALL: BITS = 0x1ff; const ...
} impl fmt::Display for Sudoku { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let hbar = "+---+---+---+"; for y in (0.. BOARD_HEIGHT) { if y % GROUP_HEIGHT == 0 { try!(writeln!(f, "{}", hbar)); } for x in (0.. BOARD_WIDTH) { ...
{ let mut sudoku = Sudoku::new(); for (y, line) in s.lines().filter(|l| !l.is_empty()).enumerate() { let line = line.trim_matches(|c: char| c.is_whitespace()); for (x, c) in line.chars().enumerate() { if let Some(d) = c.to_digit(10) { if d != ...
identifier_body
sudoku.rs
// http://rosettacode.org/wiki/Sudoku #![feature(core)] #![feature(step_by)] use std::fmt; use std::str::FromStr; const BOARD_WIDTH: usize = 9; const BOARD_HEIGHT: usize = 9; const GROUP_WIDTH: usize = 3; const GROUP_HEIGHT: usize = 3; const MAX_NUMBER: usize = 9; type BITS = u16; const MASK_ALL: BITS = 0x1ff; const ...
for y in (0.. BOARD_HEIGHT) { let next = { let mut it = (0.. BOARD_WIDTH) .filter(|&x| puzzle.map[y][x] & bit!= 0); let next = it.next(); if next.is_none() || it.next().is_some() { continue } ...
// Check each rows
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![cfg(test)] #![feature(plugin, test)] extern crate app_units; extern crate cssparser; extern crate euclid; #[ma...
mod attr; mod cache; mod keyframes; mod logical_geometry; mod media_queries; mod owning_handle; mod parsing; mod properties; mod rule_tree; mod str; mod stylesheets; mod stylist; mod value; mod viewport; mod writing_modes { use style::logical_geometry::WritingMode; use style::properties::{INITIAL_SERVO_VALUES,...
extern crate style_traits; extern crate test; mod animated_properties;
random_line_split
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![cfg(test)] #![feature(plugin, test)] extern crate app_units; extern crate cssparser; extern crate euclid; #[ma...
}
{ assert_eq!(get_writing_mode(INITIAL_SERVO_VALUES.get_inheritedbox()), WritingMode::empty()) }
identifier_body
lib.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #![cfg(test)] #![feature(plugin, test)] extern crate app_units; extern crate cssparser; extern crate euclid; #[ma...
() { assert_eq!(get_writing_mode(INITIAL_SERVO_VALUES.get_inheritedbox()), WritingMode::empty()) } }
initial_writing_mode_is_empty
identifier_name
ssh_keys.rs
use std::marker::PhantomData; use hyper::method::Method; use response; use request::RequestBuilder; use request::DoRequest; impl<'t> RequestBuilder<'t, response::SshKeys> { pub fn create(self, name: &str, pub_key: &str) -> RequestBuilder<'t, response::SshKey> { // POST: "https://api.digitalocean.com/v2/a...
pub fn destroy(self) -> RequestBuilder<'t, response::HeaderOnly> { // DELETE: "https://api.digitalocean.com/v2/account/keys/$ID" // OR // DELETE: "https://api.digitalocean.com/v2/account/keys/$FINGER" RequestBuilder { method: Method::Delete, auth: self.auth, ...
{ // PUT: "https://api.digitalocean.com/v2/account/keys/$ID" // OR // PUT: "https://api.digitalocean.com/v2/account/keys/$FINGER" // body: // "name" : "new_name" RequestBuilder { method: Method::Put, url: self.url, auth: self.auth,...
identifier_body
ssh_keys.rs
use std::marker::PhantomData; use hyper::method::Method; use response; use request::RequestBuilder; use request::DoRequest; impl<'t> RequestBuilder<'t, response::SshKeys> { pub fn create(self, name: &str, pub_key: &str) -> RequestBuilder<'t, response::SshKey> { // POST: "https://api.digitalocean.com/v2/a...
body: None, } } } impl<'t> DoRequest<response::SshKey> for RequestBuilder<'t, response::SshKey> {}
RequestBuilder { method: Method::Delete, auth: self.auth, url: self.url, resp_t: PhantomData,
random_line_split
ssh_keys.rs
use std::marker::PhantomData; use hyper::method::Method; use response; use request::RequestBuilder; use request::DoRequest; impl<'t> RequestBuilder<'t, response::SshKeys> { pub fn create(self, name: &str, pub_key: &str) -> RequestBuilder<'t, response::SshKey> { // POST: "https://api.digitalocean.com/v2/a...
(self, name: &str) -> RequestBuilder<'t, response::SshKey> { // PUT: "https://api.digitalocean.com/v2/account/keys/$ID" // OR // PUT: "https://api.digitalocean.com/v2/account/keys/$FINGER" // body: // "name" : "new_name" RequestBuilder { method: Method::P...
update
identifier_name
named_anon_conflict.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
return None; // inapplicable }; debug!("try_report_named_anon_conflict: named = {:?}", named); debug!( "try_report_named_anon_conflict: anon_arg_info = {:?}", anon_arg_info ); debug!( "try_report_named_anon_conflict: region_info = ...
random_line_split
named_anon_conflict.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
}
{ match *region { ty::ReStatic => true, ty::ReFree(ref free_region) => match free_region.bound_region { ty::BrNamed(..) => true, _ => false, }, ty::ReEarlyBound(ebr) => ebr.has_name(), _ => false, } }
identifier_body
named_anon_conflict.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(&self) -> Option<ErrorReported> { let (span, sub, sup) = self.get_regions(); debug!( "try_report_named_anon_conflict(sub={:?}, sup={:?})", sub, sup ); // Determine whether the sub and sup consist of one named region ('a) // and one anonymous...
try_report_named_anon_conflict
identifier_name
named_anon_conflict.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
; debug!("try_report_named_anon_conflict: named = {:?}", named); debug!( "try_report_named_anon_conflict: anon_arg_info = {:?}", anon_arg_info ); debug!( "try_report_named_anon_conflict: region_info = {:?}", region_info ); ...
{ return None; // inapplicable }
conditional_block
ciphersuite.rs
struct Ciphersuite { code: u16, kex_algo: ~str, sig_algo: ~str, cipher: ~str, cipher_keylen: u8, mac: ~str } impl Ciphersuite { static fn new(suite: u16, kex_algo: ~str, sig_algo: ~str, cipher: ~str, cipher_keylen: u8, mac: ~str) -> Ciphersuite { Ciphersuite { ...
out } } #[cfg(test)] mod tests { #[test] fn test() { let psk = Ciphersuite::from_code(0x008A); io::println(fmt!("%?", psk)); } }
_ => fail ~"Unknown mac" };
random_line_split
ciphersuite.rs
struct
{ code: u16, kex_algo: ~str, sig_algo: ~str, cipher: ~str, cipher_keylen: u8, mac: ~str } impl Ciphersuite { static fn new(suite: u16, kex_algo: ~str, sig_algo: ~str, cipher: ~str, cipher_keylen: u8, mac: ~str) -> Ciphersuite { Ciphersuite { code: s...
Ciphersuite
identifier_name
network.rs
extern crate byteorder; use std::io::prelude::*; use std::io::{ Result, Error, ErrorKind, }; use std::net::{ TcpListener, TcpStream, SocketAddr, IpAddr, Ipv4Addr, }; use std::thread::{ Builder, JoinHandle, }; use std::sync::mpsc::{ channel, Sender, Receiver, }; use s...
match establish_connection( &mut stream ) { Ok( _ ) => { response[ 0 ] = RESPONSE_CODE_OK; if let Err( e ) = send_data( &mut stream, &response ) { error!( "{}", e ); error!( "Deni...
info!( "Connection request from {}", peer_addr ); let mut response : [u8; 3] = [0; 3]; // Establish a proper client connection
random_line_split
network.rs
extern crate byteorder; use std::io::prelude::*; use std::io::{ Result, Error, ErrorKind, }; use std::net::{ TcpListener, TcpStream, SocketAddr, IpAddr, Ipv4Addr, }; use std::thread::{ Builder, JoinHandle, }; use std::sync::mpsc::{ channel, Sender, Receiver, }; use s...
( &self ) -> u8 { self.data[ 0 ] } } impl Server { pub fn new() -> Server { let ( stream_sender, stream_receiver ) = channel::<TcpStream>(); let builder = Builder::new().name( String::from( "Server thread" ) ); let listener = TcpListener::bind( "0.0.0.0:9090" ).expect( "Couldn'...
get_type
identifier_name
network.rs
extern crate byteorder; use std::io::prelude::*; use std::io::{ Result, Error, ErrorKind, }; use std::net::{ TcpListener, TcpStream, SocketAddr, IpAddr, Ipv4Addr, }; use std::thread::{ Builder, JoinHandle, }; use std::sync::mpsc::{ channel, Sender, Receiver, }; use s...
if count!= PROTOCOL_HEADER.len() { return Err( Error::new( ErrorKind::Other, "Invalid number of bytes received." ) ); } for i in 0..PROTOCOL_HEADER.len() { if header[ i ]!= PROTOCOL_HEADER[ i ] { return Err( Error::new( ErrorKind::Other, "Invalid header received." ) ); ...
{ return Err( Error::new( ErrorKind::Other, "Connection closed." ) ); }
conditional_block
document_loader.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/. */ //! Tracking of pending loads in a document. //! https://html.spec.whatwg.org/multipage/#the-end use dom::binding...
self.blocking_loads.remove(idx.expect(&format!("unknown completed load {:?}", load))); } pub fn is_blocked(&self) -> bool { // TODO: Ensure that we report blocked if parsing is still ongoing. !self.blocking_loads.is_empty() } pub fn inhibit_events(&mut self) { self.event...
/// Mark an in-progress network request complete. pub fn finish_load(&mut self, load: &LoadType) { let idx = self.blocking_loads.iter().position(|unfinished| *unfinished == *load);
random_line_split
document_loader.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/. */ //! Tracking of pending loads in a document. //! https://html.spec.whatwg.org/multipage/#the-end use dom::binding...
(existing: &DocumentLoader) -> DocumentLoader { DocumentLoader::new_with_thread(existing.resource_thread.clone(), None, None) } /// We use an `Arc<ResourceThread>` here in order to avoid file descriptor exhaustion when there /// are lots of iframes. pub fn new_with_thread(resource_thread: Arc<R...
new
identifier_name
document_loader.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/. */ //! Tracking of pending loads in a document. //! https://html.spec.whatwg.org/multipage/#the-end use dom::binding...
/// We use an `Arc<ResourceThread>` here in order to avoid file descriptor exhaustion when there /// are lots of iframes. pub fn new_with_thread(resource_thread: Arc<ResourceThread>, pipeline: Option<PipelineId>, initial_load: Option<Url>) ...
{ DocumentLoader::new_with_thread(existing.resource_thread.clone(), None, None) }
identifier_body
recursion_limit.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 ...
// this via an attribute on the crate like `#![recursion_limit="22"]`. This pass // just peeks and looks for that attribute. use session::Session; use syntax::ast; use syntax::attr::AttrMetaMethods; use std::str::FromStr; pub fn update_recursion_limit(sess: &Session, krate: &ast::Crate) { for attr in krate.attrs....
// There are various parts of the compiler that must impose arbitrary limits // on how deeply they recurse to prevent stack overflow. Users can override
random_line_split
recursion_limit.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 ...
(sess: &Session, krate: &ast::Crate) { for attr in krate.attrs.iter() { if!attr.check_name("recursion_limit") { continue; } if let Some(s) = attr.value_str() { if let Some(n) = FromStr::from_str(s.get()) { sess.recursion_limit.set(n); ...
update_recursion_limit
identifier_name
recursion_limit.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 attr in krate.attrs.iter() { if !attr.check_name("recursion_limit") { continue; } if let Some(s) = attr.value_str() { if let Some(n) = FromStr::from_str(s.get()) { sess.recursion_limit.set(n); return; } } ...
identifier_body
recursion_limit.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 ...
} span_err!(sess, attr.span, E0296, "malformed recursion limit attribute, \ expected #![recursion_limit=\"N\"]"); } }
{ sess.recursion_limit.set(n); return; }
conditional_block
bookmarks.rs
/* * Copyright (c) 2016-2018 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, ...
self.error(&err.to_string()); } self.components.mg.emit(DeleteCompletionItem); }, _ => (), } } pub fn set_tags(&self, tags: Option<String>) { // Do not edit tags when the user press Escape. if le...
if let Err(err) = self.model.bookmark_manager.delete(url) {
random_line_split
bookmarks.rs
/* * Copyright (c) 2016-2018 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, ...
(&self) { let mut command = self.model.command_text.split_whitespace(); match command.next() { Some("open") | Some("win-open") | Some("private-win-open") => if let Some(url) = command.next() { // Do not show message when deleting a bookmark in completion. ...
delete_selected_bookmark
identifier_name
bookmarks.rs
/* * Copyright (c) 2016-2018 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, ...
, _ => (), } } pub fn set_tags(&self, tags: Option<String>) { // Do not edit tags when the user press Escape. if let Some(tags) = tags { let tags: Vec<_> = tags.split(',') .map(|tag| tag.trim().to_lowercase()) .filter(|tag|!tag.is_em...
{ // Do not show message when deleting a bookmark in completion. if let Err(err) = self.model.bookmark_manager.delete(url) { self.error(&err.to_string()); } self.components.mg.emit(DeleteCompletionItem); ...
conditional_block
bookmarks.rs
/* * Copyright (c) 2016-2018 Boucher, Antoni <bouanto@zoho.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, ...
/// Delete the bookmark selected in completion. pub fn delete_selected_bookmark(&self) { let mut command = self.model.command_text.split_whitespace(); match command.next() { Some("open") | Some("win-open") | Some("private-win-open") => if let Some(url) = command.nex...
{ if let Some(url) = self.widgets.webview.get_uri() { match self.model.bookmark_manager.delete(&url) { Ok(true) => self.components.mg.emit(Info(format!("Deleted bookmark: {}", url))), Ok(false) => self.info_page_not_in_bookmarks(), Err(err) => self.err...
identifier_body
code_lexer.rs
pub struct CodeLexer<'a> { pub source: &'a str, } impl<'a> CodeLexer<'a> { pub fn new(source: &'a str) -> CodeLexer<'a> { CodeLexer { source: source } } pub fn is_keyword(&self, identifier: &str) -> bool { match identifier { "if" | "for" | "model" | "while" | "match" | "use...
pub fn end_of_code_block(&self) -> Option<usize> { self.end_of_block('{', '}') } pub fn end_of_code_statement(&self) -> Option<usize> { self.next_instance_of(';') } pub fn block_delimiters(&self) -> (Option<usize>, Option<usize>) { (self.next_instance_of('{'), self.end_of...
{ self.source.chars().position(|c| c == search_char) }
identifier_body
code_lexer.rs
pub struct CodeLexer<'a> { pub source: &'a str, } impl<'a> CodeLexer<'a> { pub fn new(source: &'a str) -> CodeLexer<'a> { CodeLexer { source: source } } pub fn is_keyword(&self, identifier: &str) -> bool { match identifier { "if" | "for" | "model" | "while" | "match" | "use...
(&self) -> Option<usize> { self.end_of_block('{', '}') } pub fn end_of_code_statement(&self) -> Option<usize> { self.next_instance_of(';') } pub fn block_delimiters(&self) -> (Option<usize>, Option<usize>) { (self.next_instance_of('{'), self.end_of_block('{', '}')) } }
end_of_code_block
identifier_name
code_lexer.rs
pub struct CodeLexer<'a> { pub source: &'a str, } impl<'a> CodeLexer<'a> { pub fn new(source: &'a str) -> CodeLexer<'a> { CodeLexer { source: source } } pub fn is_keyword(&self, identifier: &str) -> bool { match identifier { "if" | "for" | "model" | "while" | "match" | "use...
'A'...'Z' | 'a'...'z' | '_' => true, '0'...'9' if index > 0 => true, _ => false, }) .map(|(_, c)| c) .collect::<String>() } pub fn end_of_block(&self, start_char: char, end_char: char) -> Option<usize> { let mut scope = 0...
.chars() .enumerate() .take_while(|&(index, c)| match c {
random_line_split
talker_handler.rs
use crate::talker::Talker; pub struct TalkerHandlerBase { pub category: String, pub model: String, pub label: String, } impl TalkerHandlerBase { pub fn new(category: &str, model: &str, label: &str) -> Self { Self { category: category.to_string(), model: model.to_string(...
pub fn model<'a>(&'a self) -> &'a String { &self.model } pub fn label<'a>(&'a self) -> &'a String { &self.label } } pub trait TalkerHandler { fn base<'a>(&'a self) -> &'a TalkerHandlerBase; fn category<'a>(&'a self) -> &'a String { &self.base().category } fn mo...
{ &self.category }
identifier_body
talker_handler.rs
use crate::talker::Talker; pub struct TalkerHandlerBase { pub category: String, pub model: String, pub label: String, } impl TalkerHandlerBase { pub fn new(category: &str, model: &str, label: &str) -> Self { Self { category: category.to_string(), model: model.to_string(...
&self.base().label } fn make(&self) -> Result<Box<dyn Talker>, failure::Error>; }
&self.base().model } fn label<'a>(&'a self) -> &'a String {
random_line_split
talker_handler.rs
use crate::talker::Talker; pub struct TalkerHandlerBase { pub category: String, pub model: String, pub label: String, } impl TalkerHandlerBase { pub fn new(category: &str, model: &str, label: &str) -> Self { Self { category: category.to_string(), model: model.to_string(...
<'a>(&'a self) -> &'a String { &self.base().label } fn make(&self) -> Result<Box<dyn Talker>, failure::Error>; }
label
identifier_name
performancepainttiming.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::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_obj...
fn new_inherited(metric_type: PaintMetricType, start_time: f64) -> PerformancePaintTiming { let name = match metric_type { PaintMetricType::FirstPaint => DOMString::from("first-paint"), PaintMetricType::FirstContentfulPaint => DOMString::from("first-contentful-paint"), ...
impl PerformancePaintTiming {
random_line_split
performancepainttiming.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::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_obj...
}
{ let entry = PerformancePaintTiming::new_inherited(metric_type, start_time); reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap) }
identifier_body
performancepainttiming.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::PerformancePaintTimingBinding; use dom::bindings::reflector::reflect_dom_obj...
(global: &GlobalScope, metric_type: PaintMetricType, start_time: f64) -> DomRoot<PerformancePaintTiming> { let entry = PerformancePaintTiming::new_inherited(metric_type, start_time); reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap) } }
new
identifier_name
writer.rs
use std::fs::OpenOptions; use std::io::{Error,Write}; use std::path::Path; use byteorder::{BigEndian, WriteBytesExt}; use SMF; use ::{Event,AbsoluteEvent,MetaEvent,MetaCommand,SMFFormat}; /// An SMFWriter is used to write an SMF to a file. It can be either /// constructed empty and have tracks added, or created fro...
storage.push(to_write); continuation = true; if cur == 0 { break; } } storage.reverse(); storage } // Write a variable length value. Return number of bytes written. pub fn write_vtime(val: u64, writer: &mut dyn Write) -> Result<u32,Error> { ...
{ // we're writing a continuation byte, so set the bit to_write |= cont_mask; }
conditional_block
writer.rs
use std::fs::OpenOptions; use std::io::{Error,Write}; use std::path::Path; use byteorder::{BigEndian, WriteBytesExt}; use SMF; use ::{Event,AbsoluteEvent,MetaEvent,MetaCommand,SMFFormat}; /// An SMFWriter is used to write an SMF to a file. It can be either /// constructed empty and have tracks added, or created fro...
let mut writer = SMFWriter::new_with_division_and_format (smf.format, smf.division); for track in smf.tracks.iter() { let mut length = 0; let mut saw_eot = false; let mut vec = Vec::new(); writer.start_track_header(&mut vec); for ...
} /// Create a writer that has all the tracks from the given SMF already added pub fn from_smf(smf: SMF) -> SMFWriter {
random_line_split
writer.rs
use std::fs::OpenOptions; use std::io::{Error,Write}; use std::path::Path; use byteorder::{BigEndian, WriteBytesExt}; use SMF; use ::{Event,AbsoluteEvent,MetaEvent,MetaCommand,SMFFormat}; /// An SMFWriter is used to write an SMF to a file. It can be either /// constructed empty and have tracks added, or created fro...
(val: u64, writer: &mut dyn Write) -> Result<u32,Error> { let storage = SMFWriter::vtime_to_vec(val); writer.write_all(&storage[..])?; Ok(storage.len() as u32) } fn start_track_header(&self, vec: &mut Vec<u8>) { vec.push(0x4D); vec.push(0x54); vec.push(0x72); ...
write_vtime
identifier_name
workletglobalscope.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_traits::ScriptToDevtoolsControlMsg; use dom::bindings::inheritance::Castable; use dom::bindings::root...
.evaluate_js_on_global_with_result(&*script, rval.handle_mut()) } /// Register a paint worklet to the script thread. pub fn register_paint_worklet(&self, name: Atom, properties: Vec<Atom>, painter: Box<Painter>) { self.to_script_thread_sender .send(MainThreadScriptMsg::Registe...
debug!("Evaluating Dom."); rooted!(in (self.globalscope.get_cx()) let mut rval = UndefinedValue()); self.globalscope
random_line_split
workletglobalscope.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_traits::ScriptToDevtoolsControlMsg; use dom::bindings::inheritance::Castable; use dom::bindings::root...
(&self) -> ServoUrl { self.base_url.clone() } /// The worklet executor. pub fn executor(&self) -> WorkletExecutor { self.executor.clone() } /// Perform a worklet task pub fn perform_a_worklet_task(&self, task: WorkletTask) { match task { WorkletTask::Test(ta...
base_url
identifier_name
lib.rs
#![feature(type_macros)] //! # Goal //! //! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available //! to systems. //! //! We want to define systems that operate on lists of components, are...
(ticks_per_second: u32) { let events_thread = ticker(ticks_per_second, true); let _ = events_thread.join(); } pub fn ticker(ticks_per_second: u32, sleep: bool) -> thread::JoinHandle<()> { let step = Duration::from_secs(1) / ticks_per_second; let mut last_tick = Instant::now(); thread::spawn(move || { loop { ...
run
identifier_name
lib.rs
#![feature(type_macros)] //! # Goal //! //! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available //! to systems. //! //! We want to define systems that operate on lists of components, are...
else { tick::trigger(step); events::next_tick(); last_tick = Instant::now(); events::run_events(); } } }) }
{ if sleep { thread::sleep(Duration::from_millis(1)); } }
conditional_block
lib.rs
#![feature(type_macros)] //! # Goal //! //! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available //! to systems. //! //! We want to define systems that operate on lists of components, are...
}) }
{ let step = Duration::from_secs(1) / ticks_per_second; let mut last_tick = Instant::now(); thread::spawn(move || { loop { let current_time = Instant::now(); let next_tick = last_tick + step; if next_tick > current_time { if sleep { thread::sleep(Duration::from_millis(1)); } } else { ...
identifier_body
lib.rs
#![feature(type_macros)] //! # Goal //!
//! to systems. //! //! We want to define systems that operate on lists of components, are //! triggered by other systems through events. //! //! # Implementation //! //! For each component type there will be a list that is a tuple of an //! entity ID and the component values. There will also be a map from //! entity ...
//! We want to define components, store them in an efficient manner and //! make them accessible to systems. //! //! We want to define events along with their types and make them available
random_line_split
encodings.rs
// preprocessing pub const PRG_CONTRADICTORY_OBS: &str = include_str!("encodings/contradictory_obs.lp"); pub const PRG_GUESS_INPUTS: &str = include_str!("encodings/guess_inputs.lp"); // minimal inconsistent cores pub const PRG_MICS: &str = include_str!("encodings/mics.lp"); // basic sign consistency pub const PRG_SIG...
input(E,\"unknown\") :- exp(E). vertex(\"unknown\"). elabel(\"unknown\", V,1) :- addeddy(V). :- addeddy(U), addeddy(V),U!=V."; pub const PRG_BEST_EDGE_START: &str = " % guess one edge start to add 0{addedge(or(V),X,1); addedge(or(V),X,-1)}1 :- vertex(or(V)), edge_end(X). % add only one edge!!! :- addedge(Y1,X,1...
0{addeddy(or(V))} :- vertex(or(V)). % new inputs through repair
random_line_split
bndstx.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn
() { run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(ESI, ECX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 27, 28, ...
bndstx_1
identifier_name
bndstx.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn bndstx_1()
fn bndstx_2() { run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(RDI, RBX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &...
{ run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(ESI, ECX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 27, 28, 14]...
identifier_body
bndstx.rs
use ::Reg::*; use ::RegScale::*; fn bndstx_1() { run_test(&Instruction { mnemonic: Mnemonic::BNDSTX, operand1: Some(IndirectScaledIndexed(ESI, ECX, One, Some(OperandSize::Unsized), None)), operand2: Some(Direct(BND3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, ...
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*;
random_line_split
not_understood.rs
use crate::messages::Message; use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NotUnderstood { pub path: Vec<String>, } impl Message for NotUnderstood { fn name(&self) -> String { String::from("NOT_UNDERSTOOD") } } impl PartialEq for NotUnders...
// Assert assert_eq!(name, "NOT_UNDERSTOOD"); } #[test] fn test_asoutgoing() { // Arrange let message = NotUnderstood { path: vec![] }; let message_ref = message.clone(); // Act let outgoing = message.as_outgoing(); // Assert assert...
let name = message.name();
random_line_split
not_understood.rs
use crate::messages::Message; use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NotUnderstood { pub path: Vec<String>, } impl Message for NotUnderstood { fn name(&self) -> String
} impl PartialEq for NotUnderstood { fn eq(&self, other: &Self) -> bool { self.path == other.path } } #[cfg(test)] mod tests { use super::*; #[test] fn test_name() { // Arrange let message = NotUnderstood { path: vec![] }; // Act let name = message.name()...
{ String::from("NOT_UNDERSTOOD") }
identifier_body
not_understood.rs
use crate::messages::Message; use serde_derive::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct
{ pub path: Vec<String>, } impl Message for NotUnderstood { fn name(&self) -> String { String::from("NOT_UNDERSTOOD") } } impl PartialEq for NotUnderstood { fn eq(&self, other: &Self) -> bool { self.path == other.path } } #[cfg(test)] mod tests { use super::*; #[test] ...
NotUnderstood
identifier_name
config_dump.rs
/* * Copyright 2021 Google LLC * * 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 required by applicable law or agreed t...
Err(err) => { *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR; *response.body_mut() = Body::from(format!("failed to create config dump: {err}")); } } response } fn create_config_dump_json( cluster_manager: SharedClusterManager, filter_manager: Shared...
{ *response.status_mut() = StatusCode::OK; response .headers_mut() .insert("Content-Type", HeaderValue::from_static("application/json")); *response.body_mut() = Body::from(body); }
conditional_block
config_dump.rs
/* * Copyright 2021 Google LLC * * 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 required by applicable law or agreed t...
( cluster_manager: SharedClusterManager, filter_manager: SharedFilterManager, ) -> Result<String, serde_json::Error> { let endpoints = { let cluster_manager = cluster_manager.read(); // Clone the list of endpoints immediately so that we don't hold on // to the cluster manager's lock ...
create_config_dump_json
identifier_name
config_dump.rs
/* * Copyright 2021 Google LLC * * 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 required by applicable law or agreed t...
fn create_config_dump_json( cluster_manager: SharedClusterManager, filter_manager: SharedFilterManager, ) -> Result<String, serde_json::Error> { let endpoints = { let cluster_manager = cluster_manager.read(); // Clone the list of endpoints immediately so that we don't hold on // to...
{ let mut response = Response::new(Body::empty()); match create_config_dump_json(cluster_manager, filter_manager) { Ok(body) => { *response.status_mut() = StatusCode::OK; response .headers_mut() .insert("Content-Type", HeaderValue::from_static("app...
identifier_body
config_dump.rs
/* * Copyright 2021 Google LLC * * 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 required by applicable law or agreed t...
clusters: vec![ClusterDump { name: "default-quilkin-cluster", endpoints, }], filterchain: FilterChainDump { filters }, }; serde_json::to_string_pretty(&dump) } #[cfg(test)] mod tests { use super::handle_request; use crate::cluster::cluster_manager::Clust...
}; let dump = ConfigDump {
random_line_split
class-attributes-1.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 ...
{ name: ~str, } impl Drop for cat { #[cat_dropper] fn drop(&mut self) { error2!("{} landed on hir feet", self. name); } } #[cat_maker] fn cat(name: ~str) -> cat { cat{name: name,} } pub fn main() { let _kitty = cat(~"Spotty"); }
cat
identifier_name
class-attributes-1.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 ...
} impl Drop for cat { #[cat_dropper] fn drop(&mut self) { error2!("{} landed on hir feet", self. name); } } #[cat_maker] fn cat(name: ~str) -> cat { cat{name: name,} } pub fn main() { let _kitty = cat(~"Spotty"); }
struct cat { name: ~str,
random_line_split
class-attributes-1.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 ...
} #[cat_maker] fn cat(name: ~str) -> cat { cat{name: name,} } pub fn main() { let _kitty = cat(~"Spotty"); }
{ error2!("{} landed on hir feet" , self . name); }
identifier_body
local_transactions.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
}
}
random_line_split
local_transactions.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
let to_remove = self.transactions .iter() .filter(|&(_, status)|!status.is_current()) .map(|(hash, _)| *hash) .take(number_of_old - self.max_old) .collect::<Vec<_>>(); for hash in to_remove { self.transactions.remove(&hash); } } } #[cfg(test)] mod tests { use util::U256; use ethkey::{Rand...
{ return; }
conditional_block
local_transactions.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
pub fn mark_mined(&mut self, tx: SignedTransaction) { self.transactions.insert(tx.hash(), Status::Mined(tx)); self.clear_old(); } pub fn contains(&self, hash: &H256) -> bool { self.transactions.contains_key(hash) } pub fn all_transactions(&self) -> &LinkedHashMap<H256, Status> { &self.transactions } ...
{ self.transactions.insert(tx.hash(), Status::Dropped(tx)); self.clear_old(); }
identifier_body
local_transactions.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
(&self) -> bool { *self == Status::Pending || *self == Status::Future } } /// Keeps track of local transactions that are in the queue or were mined/dropped recently. #[derive(Debug)] pub struct LocalTransactionsList { max_old: usize, transactions: LinkedHashMap<H256, Status>, } impl Default for LocalTransactions...
is_current
identifier_name
lib.rs
// This is a part of rust-encoding. // Copyright (c) 2013-2015, Kang Seonghoon. // See README.md and LICENSE.txt for details. //! # Encoding 0.3.0-dev //! //! Character encoding support for Rust. (also known as `rust-encoding`) //! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/), //! and al...
cfg(test)] mod tests { use super::*; #[test] fn test_decode() { fn test_one(input: &[u8], expected_result: &str, expected_encoding: &str) { let (result, used_encoding) = decode( input, DecoderTrap::Strict, all::ISO_8859_1 as EncodingRef); let result = result....
use all::{UTF_8, UTF_16LE, UTF_16BE}; if input.starts_with(&[0xEF, 0xBB, 0xBF]) { (UTF_8.decode(&input[3..], trap), UTF_8 as EncodingRef) } else if input.starts_with(&[0xFE, 0xFF]) { (UTF_16BE.decode(&input[2..], trap), UTF_16BE as EncodingRef) } else if input.starts_with(&[0xFF, 0xFE]) { ...
identifier_body
lib.rs
// This is a part of rust-encoding. // Copyright (c) 2013-2015, Kang Seonghoon. // See README.md and LICENSE.txt for details. //! # Encoding 0.3.0-dev //! //! Character encoding support for Rust. (also known as `rust-encoding`) //! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/), //! and al...
#[cfg(test)] mod tests { use super::*; #[test] fn test_decode() { fn test_one(input: &[u8], expected_result: &str, expected_encoding: &str) { let (result, used_encoding) = decode( input, DecoderTrap::Strict, all::ISO_8859_1 as EncodingRef); let result = resul...
(fallback_encoding.decode(input, trap), fallback_encoding) } }
conditional_block
lib.rs
// This is a part of rust-encoding. // Copyright (c) 2013-2015, Kang Seonghoon. // See README.md and LICENSE.txt for details. //! # Encoding 0.3.0-dev //! //! Character encoding support for Rust. (also known as `rust-encoding`) //! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/), //! and al...
//! //! ### Data Table //! //! By default, Encoding comes with ~480 KB of data table ("indices"). //! This allows Encoding to encode and decode legacy encodings efficiently, //! but this might not be desirable for some applications. //! //! Encoding provides the `no-optimized-legacy-encoding` Cargo feature //! to reduc...
random_line_split
lib.rs
// This is a part of rust-encoding. // Copyright (c) 2013-2015, Kang Seonghoon. // See README.md and LICENSE.txt for details. //! # Encoding 0.3.0-dev //! //! Character encoding support for Rust. (also known as `rust-encoding`) //! It is based on [WHATWG Encoding Standard](http://encoding.spec.whatwg.org/), //! and al...
ut: &[u8], trap: DecoderTrap, fallback_encoding: EncodingRef) -> (Result<String, Cow<'static, str>>, EncodingRef) { use all::{UTF_8, UTF_16LE, UTF_16BE}; if input.starts_with(&[0xEF, 0xBB, 0xBF]) { (UTF_8.decode(&input[3..], trap), UTF_8 as EncodingRef) } else if input.starts_with(&[0xFE,...
de(inp
identifier_name
gdb-pretty-struct-and-enums.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...
c_style_enum: CStyleEnum, mixed_enum: MixedEnum, } enum NestedEnum { NestedVariant1(NestedStruct), NestedVariant2 { abc: NestedStruct } } fn main() { let regular_struct = RegularStruct { the_first_field: 101, the_second_field: 102.5, the_third_field: false, the_fou...
random_line_split
gdb-pretty-struct-and-enums.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...
{ MixedEnumCStyleVar, MixedEnumTupleVar(u32, u16, bool), MixedEnumStructVar { field1: f64, field2: i32 } } struct NestedStruct { regular_struct: RegularStruct, tuple_struct: TupleStruct, empty_struct: EmptyStruct, c_style_enum: CStyleEnum, mixed_enum: MixedEnum, } enum NestedEnum { ...
MixedEnum
identifier_name
gdb-pretty-struct-and-enums.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...
{ () }
identifier_body
extendablemessageevent.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::ExtendableMessageEventBinding; use dom::bindings::codegen::Bindings::Extenda...
// https://w3c.github.io/ServiceWorker/#extendablemessage-event-origin-attribute fn Origin(&self) -> DOMString { self.origin.clone() } // https://w3c.github.io/ServiceWorker/#extendablemessage-event-lasteventid-attribute fn LastEventId(&self) -> DOMString { self.lastEventId.clone(...
{ self.data.get() }
identifier_body
extendablemessageevent.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::ExtendableMessageEventBinding; use dom::bindings::codegen::Bindings::Extenda...
impl ExtendableMessageEvent { pub fn dispatch_jsval(target: &EventTarget, scope: &GlobalScope, message: HandleValue) { let Extendablemessageevent = ExtendableMessageEvent::new( scope, atom!("message"), false, false, message, DOMStri...
random_line_split
extendablemessageevent.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::ExtendableMessageEventBinding; use dom::bindings::codegen::Bindings::Extenda...
(&self) -> DOMString { self.lastEventId.clone() } // https://dom.spec.whatwg.org/#dom-event-istrusted fn IsTrusted(&self) -> bool { self.event.IsTrusted() } }
LastEventId
identifier_name
constellation_msg.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/. */ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling...
pub type PanicMsg = (Option<PipelineId>, String, String); #[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)] pub struct WindowSizeData { /// The size of the initial layout viewport, before parsing an /// http://www.w3.org/TR/css-device-adapt/#initial-viewport pub initial_viewport: TypedSize2D<Viewp...
} }
random_line_split
constellation_msg.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/. */ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling...
} impl ConvertPipelineIdFromWebRender for webrender_traits::PipelineId { fn from_webrender(&self) -> PipelineId { PipelineId { namespace_id: PipelineNamespaceId(self.0), index: PipelineIndex(self.1), } } } /// [Policies](https://w3c.github.io/webappsec-referrer-policy/...
{ let PipelineNamespaceId(namespace_id) = self.namespace_id; let PipelineIndex(index) = self.index; webrender_traits::PipelineId(namespace_id, index) }
identifier_body
constellation_msg.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/. */ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling...
() -> PipelineId { PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(0), } } } impl fmt::Display for PipelineId { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let PipelineNamespaceId(namespace_id) = self.namespace_id; let...
fake_root_pipeline_id
identifier_name
ioapiset.rs
// 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. // All files in the project carrying such notice may not be copied, modified, or distributed // except according ...
pub fn GetOverlappedResultEx( hFile: HANDLE, lpOverlapped: LPOVERLAPPED, lpNumberOfBytesTransferred: LPDWORD, dwMilliseconds: DWORD, bAlertable: BOOL, ) -> BOOL; pub fn CancelSynchronousIo( hThread: HANDLE, ) -> BOOL; }
lpOverlapped: LPOVERLAPPED, ) -> BOOL; pub fn CancelIo( hFile: HANDLE, ) -> BOOL;
random_line_split
select_with_weak.rs
use std::pin::Pin; use std::task::Context; use std::task::Poll; use futures::stream::{Fuse, Stream}; pub trait SelectWithWeakExt: Stream { fn select_with_weak<S>(self, other: S) -> SelectWithWeak<Self, S> where S: Stream<Item = Self::Item>, Self: Sized; } impl<T> SelectWithWeakExt for T where T: Stream, { fn...
} /// An adapter for merging the output of two streams. /// /// The merged stream produces items from either of the underlying streams as /// they become available, and the streams are polled in a round-robin fashion. /// Errors, however, are not merged: you get at most one error at a time. /// /// Finishes when stro...
{ new(self, other) }
identifier_body
select_with_weak.rs
use std::pin::Pin; use std::task::Context; use std::task::Poll; use futures::stream::{Fuse, Stream}; pub trait SelectWithWeakExt: Stream { fn select_with_weak<S>(self, other: S) -> SelectWithWeak<Self, S> where S: Stream<Item = Self::Item>, Self: Sized; } impl<T> SelectWithWeakExt for T where T: Stream, { fn...
<S>(self, other: S) -> SelectWithWeak<Self, S> where S: Stream<Item = Self::Item>, Self: Sized, { new(self, other) } } /// An adapter for merging the output of two streams. /// /// The merged stream produces items from either of the underlying streams as /// they become available, and the streams are polled i...
select_with_weak
identifier_name
select_with_weak.rs
use std::pin::Pin; use std::task::Context; use std::task::Poll; use futures::stream::{Fuse, Stream}; pub trait SelectWithWeakExt: Stream { fn select_with_weak<S>(self, other: S) -> SelectWithWeak<Self, S> where S: Stream<Item = Self::Item>, Self: Sized; } impl<T> SelectWithWeakExt for T where T: Stream, { fn...
} } } }
Poll::Ready(Some(item)) => return Poll::Ready(Some(item)), Poll::Ready(None) | Poll::Pending => (), }
random_line_split
panic-runtime-abort.rs
// Copyright 2016 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 ...
() {} #[no_mangle] pub extern fn __rust_start_panic() {} #[no_mangle] pub extern fn rust_eh_personality() {}
__rust_maybe_catch_panic
identifier_name
panic-runtime-abort.rs
// Copyright 2016 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 ...
// compile-flags:-C panic=abort // no-prefer-dynamic #![feature(panic_runtime)] #![crate_type = "rlib"] #![no_std] #![panic_runtime] #[no_mangle] pub extern fn __rust_maybe_catch_panic() {} #[no_mangle] pub extern fn __rust_start_panic() {} #[no_mangle] pub extern fn rust_eh_personality() {}
// except according to those terms.
random_line_split
panic-runtime-abort.rs
// Copyright 2016 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
issue-27362.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// aux-build:issue-27362.rs // ignore-cross-compile // ignore-test This test fails on beta/stable #32019 extern crate issue_27362; pub use issue_27362 as quux; // @matches issue_27362/quux/fn.foo.html '//pre' "pub const fn foo()" // @matches issue_27362/quux/fn.bar.html '//pre' "pub const unsafe fn bar()" // @matches...
// 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.
random_line_split
places_sidebar.rs
// Copyright 2013-2015, 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 <http://opensource.org/licenses/MIT> //! GtkPlacesSidebar — Sidebar that displays frequently-used places in the file system use f...
#[cfg(gtk_3_12)] pub fn get_local_only(&self) -> bool { unsafe { to_bool(ffi::gtk_places_sidebar_get_local_only(GTK_PLACES_SIDEBAR(self.unwrap_widget()))) } } #[cfg(gtk_3_14)] pub fn set_show_enter_location(&self, show_enter_location: bool) { unsafe { ffi::gtk_places_sidebar_set_sh...
random_line_split
places_sidebar.rs
// Copyright 2013-2015, 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 <http://opensource.org/licenses/MIT> //! GtkPlacesSidebar — Sidebar that displays frequently-used places in the file system use f...
self) -> bool { unsafe { to_bool(ffi::gtk_places_sidebar_get_show_connect_to_server(GTK_PLACES_SIDEBAR(self.unwrap_widget()))) } } #[cfg(gtk_3_12)] pub fn set_local_only(&self, local_only: bool) { unsafe { ffi::gtk_places_sidebar_set_local_only(GTK_PLACES_SIDEBAR(self.unwrap_widget()), to_g...
t_show_connect_to_server(&
identifier_name
places_sidebar.rs
// Copyright 2013-2015, 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 <http://opensource.org/licenses/MIT> //! GtkPlacesSidebar — Sidebar that displays frequently-used places in the file system use f...
pub fn set_show_connect_to_server(&self, show_connect_to_server: bool) { unsafe { ffi::gtk_places_sidebar_set_show_connect_to_server(GTK_PLACES_SIDEBAR(self.unwrap_widget()), to_gboolean(show_connect_to_server)) } } pub fn get_show_connect_to_server(&self) -> bool { unsafe { to_...
unsafe { to_bool(ffi::gtk_places_sidebar_get_show_desktop(GTK_PLACES_SIDEBAR(self.unwrap_widget()))) } }
identifier_body
url.rs
use std::marker::PhantomData; use std::time::Duration; use irc::client::prelude::*; use lazy_static::lazy_static; use regex::Regex; use crate::plugin::*; use crate::utils::Url; use crate::FrippyClient; use self::error::*; use crate::error::ErrorKind as FrippyErrorKind; use crate::error::FrippyError; use failure::Fa...
fn find_title(body: &str) -> Result<Self, UrlError> { Self::find_by_delimiters(body, ["<title", ">", "</title>"]) } // TODO Improve logic fn get_usefulness(self, url: &str) -> Self { let mut usefulness = 0; for word in WORD_RE.find_iter(&self.0) { let w = word.as_s...
{ Self::find_by_delimiters(body, ["property=\"og:title\"", "content=\"", "\""]) }
identifier_body
url.rs
use std::marker::PhantomData; use std::time::Duration; use irc::client::prelude::*; use lazy_static::lazy_static; use regex::Regex; use crate::plugin::*; use crate::utils::Url; use crate::FrippyClient; use self::error::*; use crate::error::ErrorKind as FrippyErrorKind; use crate::error::FrippyError; use failure::Fa...
(max_kib: usize) -> Self { UrlTitles { max_kib, phantom: PhantomData, } } fn grep_url<'a>(&self, msg: &'a str) -> Option<Url<'a>> { let captures = URL_RE.captures(msg)?; debug!("Url captures: {:?}", captures); Some(captures.get(2)?.as_str().into(...
new
identifier_name
url.rs
use std::marker::PhantomData; use std::time::Duration; use irc::client::prelude::*; use lazy_static::lazy_static; use regex::Regex; use crate::plugin::*; use crate::utils::Url; use crate::FrippyClient; use self::error::*; use crate::error::ErrorKind as FrippyErrorKind; use crate::error::FrippyError; use failure::Fa...
} _ => ExecutionStatus::Done, } } fn execute_threaded( &self, client: &Self::Client, message: &Message, ) -> Result<(), FrippyError> { if let Command::PRIVMSG(_, ref content) = message.command { let title = self.url(content).conte...
{ ExecutionStatus::Done }
conditional_block
url.rs
use std::marker::PhantomData; use std::time::Duration; use irc::client::prelude::*; use lazy_static::lazy_static; use regex::Regex; use crate::plugin::*; use crate::utils::Url; use crate::FrippyClient; use self::error::*; use crate::error::ErrorKind as FrippyErrorKind; use crate::error::FrippyError; use failure::Fa...
body[start..] .find(delimiters[2]) .map(|offset| start + offset) .map(|end| &body[start..end]) }) }) .and_then(|s| s.and_then(|s| s)) .ok_or(ErrorKind::MissingTi...
random_line_split
aead.rs
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. use std::error::Error; use std::fmt::{self, Display, Formatter}; use std::io::{self, ErrorKind, Read, Write}; use as_bytes::AsBytes; use...
assert_eq!(&output[..], CIPHERTEXT); assert_eq!(tag, TAG); } #[cold] pub fn selftest_decrypt() { let mut output = Vec::with_capacity(CIPHERTEXT.len()); decrypt(KEY, NONCE, AAD, CIPHERTEXT, TAG, &mut output) .expect("selftest failure"); assert_eq!(&output[...
random_line_split
aead.rs
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. use std::error::Error; use std::fmt::{self, Display, Formatter}; use std::io::{self, ErrorKind, Read, Write}; use as_bytes::AsBytes; use ch...
(b: &mut Bencher, aad: &[u8], data: &[u8]) { let key = [!0; 32]; let nonce = [!0; 12]; let mut buf = Vec::with_capacity(data.len()); b.bytes = data.len() as u64; b.iter(|| { buf.clear(); encrypt(black_box(&key), black_box(&nonce), bla...
bench_encrypt
identifier_name
aead.rs
1305::Poly1305; use simd::u32x4; const CHACHA20_COUNTER_OVERFLOW: u64 = ((1 << 32) - 1) * 64; /// Encrypts a byte slice and returns the authentication tag. /// /// # Example /// /// ``` /// use chacha20_poly1305_aead::encrypt; /// /// let key = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, /// ...
{ bench_decrypt(b, &[!0; 16], &[!0; 65536]) }
identifier_body
characterdata.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/. */ //! DOM bindings for `CharacterData`. use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::...
#[inline] pub fn append_data(&self, data: &str) { self.data.borrow_mut().push_str(data); self.content_changed(); } fn content_changed(&self) { let node = self.upcast::<Node>(); node.dirty(NodeDamage::OtherNodeDamage); } } impl CharacterDataMethods for CharacterData...
self.data.borrow() }
random_line_split
characterdata.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/. */ //! DOM bindings for `CharacterData`. use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::...
(&self) -> &str { &(*self.unsafe_get()).data.borrow_for_layout() } } /// Split the given string at the given position measured in UTF-16 code units from the start. /// /// * `Err(())` indicates that `offset` if after the end of the string /// * `Ok((before, None, after))` indicates that `offset` is between...
data_for_layout
identifier_name