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 |
|---|---|---|---|---|
version.rs | use std::fmt;
/// LibRaw library version.
#[derive(Debug,PartialEq,Eq,PartialOrd,Ord)]
pub struct Version {
inner: u32,
}
impl Version {
/// Creates a new version with the given major, minor, and patch numbers.
pub fn new(major: u8, minor: u8, patch: u8) -> Version {
Version {
inner: (... | /// Returns the patch version number.
pub fn patch(&self) -> u8 {
((self.inner & 0x0000FF) >> 0) as u8
}
}
impl fmt::Display for Version {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fmt.write_fmt(format_args!("{}.{}.{}", self.major(), self.minor(), self.patch())... | random_line_split | |
comment.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::utils::{DOMString, Fallible, null_str_as_empty}; | use dom::document::AbstractDocument;
use dom::node::{AbstractNode, ScriptView, CommentNodeTypeId, Node};
use dom::window::Window;
/// An HTML comment.
pub struct Comment {
element: CharacterData,
}
impl Comment {
/// Creates a new HTML comment.
pub fn new(text: ~str, document: AbstractDocument) -> Comment... | use dom::characterdata::CharacterData; | random_line_split |
comment.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::utils::{DOMString, Fallible, null_str_as_empty};
use dom::characterdata::CharacterData;
use dom... | {
element: CharacterData,
}
impl Comment {
/// Creates a new HTML comment.
pub fn new(text: ~str, document: AbstractDocument) -> Comment {
Comment {
element: CharacterData::new(CommentNodeTypeId, text, document)
}
}
pub fn Constructor(owner: @mut Window, data: &DOMStri... | Comment | identifier_name |
const-pattern-irrefutable.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | // Check that the `NOTE`s still work with an item here (cf. issue #35115).
}
| {} | identifier_body |
const-pattern-irrefutable.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {} // Check that the `NOTE`s still work with an item here (cf. issue #35115).
}
| f | identifier_name |
const-pattern-irrefutable.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | pub const b: u8 = 2;
pub const d: u8 = 2;
}
use foo::b as c;
use foo::d;
const a: u8 = 2;
fn main() {
let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
let d = 4; //~ ERROR refutable pa... | // option. This file may not be copied, modified, or distributed
// except according to those terms.
mod foo { | random_line_split |
main.rs | //! FXCM Native Data Downloader
//!
//! See README.txt for more information
#![feature(custom_derive, plugin, libc, conservative_impl_trait, unboxed_closures)]
extern crate libc;
extern crate tickgrinder_util;
extern crate redis;
extern crate time;
extern crate futures;
extern crate postgres;
extern crate uuid;
exter... | }
impl CTick {
pub fn to_tick(&self, decimals: usize) -> Tick {
let multiplier = 10usize.pow(decimals as u32) as f64;
let bid_pips = self.bid * multiplier;
let ask_pips = self.ask * multiplier;
Tick {
timestamp: self.timestamp as u64,
bid: bid_pips as usize,... | #[repr(C)]
struct CTick {
timestamp: uint64_t,
bid: c_double,
ask: c_double, | random_line_split |
main.rs | //! FXCM Native Data Downloader
//!
//! See README.txt for more information
#![feature(custom_derive, plugin, libc, conservative_impl_trait, unboxed_closures)]
extern crate libc;
extern crate tickgrinder_util;
extern crate redis;
extern crate time;
extern crate futures;
extern crate postgres;
extern crate uuid;
exter... | {
timestamp: uint64_t,
bid: c_double,
ask: c_double,
}
impl CTick {
pub fn to_tick(&self, decimals: usize) -> Tick {
let multiplier = 10usize.pow(decimals as u32) as f64;
let bid_pips = self.bid * multiplier;
let ask_pips = self.ask * multiplier;
Tick {
tim... | CTick | identifier_name |
main.rs | //! FXCM Native Data Downloader
//!
//! See README.txt for more information
#![feature(custom_derive, plugin, libc, conservative_impl_trait, unboxed_closures)]
extern crate libc;
extern crate tickgrinder_util;
extern crate redis;
extern crate time;
extern crate futures;
extern crate postgres;
extern crate uuid;
exter... | ,
Command::TransferHistData{src, dst} => {
transfer_data(src, dst, self.cs.clone());
Response::Ok
},
Command::Kill => {
thread::spawn(|| {
thread::sleep(std::time::Duration::from_secs(3));... | {
Response::Error{
status: String::from("The FXCM Native Data Downloader doesn't support cancelling downloads."),
}
} | conditional_block |
file.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::FileBinding;
use dom::bindings::codegen::Bindings::FileBinding::FileMethods;... | use dom::bindings::root::DomRoot;
use dom::bindings::str::DOMString;
use dom::blob::{Blob, BlobImpl, blob_parts_to_bytes};
use dom::globalscope::GlobalScope;
use dom::window::Window;
use dom_struct::dom_struct;
use net_traits::filemanager_thread::SelectedFile;
use time;
#[dom_struct]
pub struct File {
blob: Blob,
... | use dom::bindings::inheritance::Castable;
use dom::bindings::reflector::reflect_dom_object; | random_line_split |
file.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::FileBinding;
use dom::bindings::codegen::Bindings::FileBinding::FileMethods;... | {
blob: Blob,
name: DOMString,
modified: i64,
}
impl File {
#[allow(unrooted_must_root)]
fn new_inherited(blob_impl: BlobImpl, name: DOMString,
modified: Option<i64>, type_string: &str) -> File {
File {
blob: Blob::new_inherited(blob_impl, type_string.to_ow... | File | identifier_name |
file.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::FileBinding;
use dom::bindings::codegen::Bindings::FileBinding::FileMethods;... |
},
}
}
#[allow(unrooted_must_root)]
pub fn new(global: &GlobalScope, blob_impl: BlobImpl,
name: DOMString, modified: Option<i64>, typeString: &str) -> DomRoot<File> {
reflect_dom_object(box File::new_inherited(blob_impl, name, modified, typeString),
... | {
let time = time::get_time();
time.sec * 1000 + (time.nsec / 1000000) as i64
} | conditional_block |
file.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::FileBinding;
use dom::bindings::codegen::Bindings::FileBinding::FileMethods;... |
#[allow(unrooted_must_root)]
pub fn new(global: &GlobalScope, blob_impl: BlobImpl,
name: DOMString, modified: Option<i64>, typeString: &str) -> DomRoot<File> {
reflect_dom_object(box File::new_inherited(blob_impl, name, modified, typeString),
global,
... | {
File {
blob: Blob::new_inherited(blob_impl, type_string.to_owned()),
name: name,
// https://w3c.github.io/FileAPI/#dfn-lastModified
modified: match modified {
Some(m) => m,
None => {
let time = time::get_time()... | identifier_body |
multicast.rs | use super::addr::Ipv4Addr;
use libc::in_addr;
use std::fmt;
#[repr(C)]
#[derive(Copy)]
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
impl fmt::Debug for ip_mreq {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result |
}
impl ip_mreq {
pub fn new(group: Ipv4Addr, interface: Option<Ipv4Addr>) -> ip_mreq {
ip_mreq {
imr_multiaddr: group.0,
imr_interface: interface.unwrap_or(Ipv4Addr::any()).0
}
}
}
| {
write!(fmt, "ip_mreq {{ imr_multiaddr: {{ s_addr: 0x{:x} }}, imr_interface: {{ s_addr: 0x{:x} }} }}",
self.imr_multiaddr.s_addr, self.imr_interface.s_addr)
} | identifier_body |
multicast.rs | use super::addr::Ipv4Addr;
use libc::in_addr;
use std::fmt; | pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
impl fmt::Debug for ip_mreq {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "ip_mreq {{ imr_multiaddr: {{ s_addr: 0x{:x} }}, imr_interface: {{ s_addr: 0x{:x} }} }}",
self.imr_mu... |
#[repr(C)]
#[derive(Copy)] | random_line_split |
multicast.rs | use super::addr::Ipv4Addr;
use libc::in_addr;
use std::fmt;
#[repr(C)]
#[derive(Copy)]
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
impl fmt::Debug for ip_mreq {
fn | (&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "ip_mreq {{ imr_multiaddr: {{ s_addr: 0x{:x} }}, imr_interface: {{ s_addr: 0x{:x} }} }}",
self.imr_multiaddr.s_addr, self.imr_interface.s_addr)
}
}
impl ip_mreq {
pub fn new(group: Ipv4Addr, interface: Option<Ipv4Addr>) ... | fmt | identifier_name |
main.rs | // See LICENSE file for copyright and license details.
#[macro_use]
extern crate glium;
extern crate time;
extern crate image;
extern crate cgmath;
#[cfg(target_os = "android")]
extern crate android_glue;
mod fs;
use std::path::{Path};
use std::f32::consts::{PI};
use std::thread;
use std::time::Duration;
use glium... | }
fn update_timer(&mut self) {
let fixed_time_stamp = 1_000_000_000 / FPS;
let now = time::precise_time_ns();
self.accumulator += now - self.previous_clock;
self.previous_clock = now;
while self.accumulator >= fixed_time_stamp {
self.accumulator -= fixed_tim... | {
let model_pos = Vector3{x: 1.0, y: 0.0, z: 0.0};
let model_mat: [[f32; 4]; 4] = Matrix4::from_translation(model_pos).into();
let view_mat: [[f32; 4]; 4] = view_matrix(
self.camera_angle_x, self.camera_angle_y, self.zoom, self.aspect).into();
let uniforms = uniform! {
... | identifier_body |
main.rs | // See LICENSE file for copyright and license details.
#[macro_use]
extern crate glium;
extern crate time;
extern crate image;
extern crate cgmath;
#[cfg(target_os = "android")]
extern crate android_glue;
mod fs;
use std::path::{Path};
use std::f32::consts::{PI};
use std::thread;
use std::time::Duration;
use glium... | (angle_x: Rad<f32>, angle_y: Rad<f32>, zoom: f32, aspect: f32) -> Matrix4<f32> {
let perspective_mat = cgmath::perspective(Rad::new(PI / 4.0), aspect, 0.1, 100.0);
let tr_mat = Matrix4::from_translation(Vector3{x: 0.0, y: 0.0, z: -zoom});
let angle_x_m = Matrix4::from(Matrix3::from_angle_z(angle_x));
le... | view_matrix | identifier_name |
main.rs | // See LICENSE file for copyright and license details.
#[macro_use]
extern crate glium;
extern crate time;
extern crate image;
extern crate cgmath;
#[cfg(target_os = "android")]
extern crate android_glue;
mod fs;
use std::path::{Path};
use std::f32::consts::{PI};
use std::thread;
use std::time::Duration;
use glium... | let (x, y) = win_size(display);
x as f32 / y as f32
}
fn create_display() -> glium::Display {
let gl_version = glutin::GlRequest::GlThenGles {
opengles_version: (2, 0),
opengl_version: (2, 1),
};
glutin::WindowBuilder::new()
.with_gl(gl_version)
.with_depth_buffer(24)
... | random_line_split | |
selection_behavior.rs | use crate::{api::prelude::*, proc_macros::*};
/// Used for selection.
pub enum SelectionAction {
ToggleSelection,
}
/// The `SelectionBehaviorState` handles the `SelectionBehavior` widget.
#[derive(Default, AsAny)]
pub struct SelectionBehaviorState {
target: Entity,
}
impl State for SelectionBehaviorState {
... | (self, id: Entity, _: &mut BuildContext) -> Self {
self.name("SelectionBehavior")
.selected(true)
.on_click(move |ctx, _| {
ctx.send_message(SelectionAction::ToggleSelection, id);
false
})
}
}
| template | identifier_name |
selection_behavior.rs | use crate::{api::prelude::*, proc_macros::*};
/// Used for selection.
pub enum SelectionAction {
ToggleSelection,
}
/// The `SelectionBehaviorState` handles the `SelectionBehavior` widget.
#[derive(Default, AsAny)]
pub struct SelectionBehaviorState {
target: Entity,
} | impl State for SelectionBehaviorState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.target = (*ctx.widget().get::<u32>("target")).into();
toggle_flag("selected", &mut ctx.get_widget(self.target));
ctx.get_widget(self.target).update(false);
}
fn messages(
&... | random_line_split | |
client.rs | use connection::{ConnectionInfo, IntoConnectionInfo, Connection, connect, PubSub, connect_pubsub,
ConnectionLike};
use types::{RedisResult, Value};
/// The client type.
#[derive(Debug, Clone)]
pub struct Client {
connection_info: ConnectionInfo,
}
/// The client acts as connector to the redis se... | try!(self.get_connection()).req_packed_command(cmd)
}
fn req_packed_commands(&self,
cmd: &[u8],
offset: usize,
count: usize)
-> RedisResult<Vec<Value>> {
try!(self.get_connection()).req_p... | }
impl ConnectionLike for Client {
fn req_packed_command(&self, cmd: &[u8]) -> RedisResult<Value> { | random_line_split |
client.rs | use connection::{ConnectionInfo, IntoConnectionInfo, Connection, connect, PubSub, connect_pubsub,
ConnectionLike};
use types::{RedisResult, Value};
/// The client type.
#[derive(Debug, Clone)]
pub struct Client {
connection_info: ConnectionInfo,
}
/// The client acts as connector to the redis se... | <T: IntoConnectionInfo>(params: T) -> RedisResult<Client> {
Ok(Client { connection_info: try!(params.into_connection_info()) })
}
/// Instructs the client to actually connect to redis and returns a
/// connection object. The connection object can be used to send
/// commands to the server. Th... | open | identifier_name |
client.rs | use connection::{ConnectionInfo, IntoConnectionInfo, Connection, connect, PubSub, connect_pubsub,
ConnectionLike};
use types::{RedisResult, Value};
/// The client type.
#[derive(Debug, Clone)]
pub struct Client {
connection_info: ConnectionInfo,
}
/// The client acts as connector to the redis se... |
}
| {
self.connection_info.db
} | identifier_body |
length.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/. */
//! Generic types for CSS values related to length.
use values::computed::ExtremumLength;
/// A generic value fo... | <LengthOrPercentageOrNone> {
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
#[animation(error)]
ExtremumLength(ExtremumLength),
}
| MaxLength | identifier_name |
length.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/. */
//! Generic types for CSS values related to length.
use values::computed::ExtremumLength;
/// A generic value fo... | Clone,
ComputeSquaredDistance,
Copy,
Debug,
PartialEq,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
ToCss,
)]
pub enum MozLength<LengthOrPercentageOrAuto> {
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
#[animation(error)]
ExtremumLength(ExtremumLength),
}
... | #[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(
Animate, | random_line_split |
mod.rs | pub mod xfloat;
use super::rand::base::system::{get_seed, refresh_seed};
use super::rand::Solver;
use super::rand::base::RAND_MAX;
pub trait Rand<T=Self> {
fn rand() -> Self;
fn range(min: T, max: T) -> Self;
}
macro_rules! impl_rand_trait {
($($t: ty)*) => (
$(
impl Rand for $t {
... | () -> Self {
(u8::rand() % 128) as char
}
fn range(min: Self, max: Self) -> Self {
let result = f64::rand() * (((max as u8 - min as u8) as f64 + 1.0) / RAND_MAX as f64);
(result as u8 + min as u8) as char
}
}
impl Rand<usize> for String {
fn rand() -> Self {
let mut res... | rand | identifier_name |
mod.rs | pub mod xfloat;
use super::rand::base::system::{get_seed, refresh_seed};
use super::rand::Solver;
use super::rand::base::RAND_MAX;
pub trait Rand<T=Self> {
fn rand() -> Self;
fn range(min: T, max: T) -> Self;
}
macro_rules! impl_rand_trait {
($($t: ty)*) => (
$(
impl Rand for $t {
... |
result += &_char.to_string();
}
}
fn range(min: usize, max: usize) -> Self {
let long = usize::range(min, max);
let mut result = "".to_string();
for _ in 0..long {
let _char = char::range(1 as char, 127 as char);
result += &_char.to_strin... | {
break result;
} | conditional_block |
mod.rs | pub mod xfloat;
use super::rand::base::system::{get_seed, refresh_seed};
use super::rand::Solver;
use super::rand::base::RAND_MAX;
pub trait Rand<T=Self> {
fn rand() -> Self;
fn range(min: T, max: T) -> Self;
}
macro_rules! impl_rand_trait {
($($t: ty)*) => (
$(
impl Rand for $t {
... |
fn range(min: Self, max: Self) -> Self {
let result = f64::rand() * (((max as u8 - min as u8) as f64 + 1.0) / RAND_MAX as f64);
(result as u8 + min as u8) as char
}
}
impl Rand<usize> for String {
fn rand() -> Self {
let mut result = "".to_string();
loop {
let ... | {
(u8::rand() % 128) as char
} | identifier_body |
mod.rs | pub mod xfloat; | pub trait Rand<T=Self> {
fn rand() -> Self;
fn range(min: T, max: T) -> Self;
}
macro_rules! impl_rand_trait {
($($t: ty)*) => (
$(
impl Rand for $t {
fn rand() -> Self {
let mut solver = Solver::new();
let mut _base = solver.get_b... |
use super::rand::base::system::{get_seed, refresh_seed};
use super::rand::Solver;
use super::rand::base::RAND_MAX;
| random_line_split |
lib.rs | // Copyright 2018 Mozilla
//
// 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 to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language go... | random_line_split | |
arg_matcher.rs | // Std
use std::collections::hash_map::{Entry, Iter};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::ops::Deref;
use std::mem;
// Internal
use args::{ArgMatches, MatchedArg, SubCommand};
use args::AnyArg;
use args::settings::ArgSettings;
#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct ... | ;
} else if let Some(num) = o.max_vals() {
debugln!("ArgMatcher::needs_more_vals: max_vals...{}", num);
return!((ma.vals.len() as u64) > num);
} else if o.min_vals().is_some() {
debugln!("ArgMatcher::needs_more_vals: min_vals...true");
... | {
num != (ma.vals.len() as u64)
} | conditional_block |
arg_matcher.rs | // Std
use std::collections::hash_map::{Entry, Iter};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::ops::Deref;
use std::mem;
// Internal
use args::{ArgMatches, MatchedArg, SubCommand};
use args::AnyArg;
use args::settings::ArgSettings;
#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct ... |
pub fn subcommand(&mut self, sc: SubCommand<'a>) { self.0.subcommand = Some(Box::new(sc)); }
pub fn subcommand_name(&self) -> Option<&str> { self.0.subcommand_name() }
pub fn iter(&self) -> Iter<&str, MatchedArg> { self.0.args.iter() }
pub fn inc_occurrence_of(&mut self, arg: &'a str) {
deb... | { self.0.args.entry(arg) } | identifier_body |
arg_matcher.rs | // Std
use std::collections::hash_map::{Entry, Iter};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::ops::Deref;
use std::mem;
// Internal
use args::{ArgMatches, MatchedArg, SubCommand};
use args::AnyArg;
use args::settings::ArgSettings;
#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct ... | // let len = ma.vals.len() + 1;
ma.vals.push(val.to_owned());
}
pub fn needs_more_vals<'b, A>(&self, o: &A) -> bool
where
A: AnyArg<'a, 'b>,
{
debugln!("ArgMatcher::needs_more_vals: o={}", o.name());
if let Some(ma) = self.get(o.name()) {
if let Some(... | occurs: 0,
vals: Vec::with_capacity(1),
}); | random_line_split |
arg_matcher.rs | // Std
use std::collections::hash_map::{Entry, Iter};
use std::collections::HashMap;
use std::ffi::OsStr;
use std::ops::Deref;
use std::mem;
// Internal
use args::{ArgMatches, MatchedArg, SubCommand};
use args::AnyArg;
use args::settings::ArgSettings;
#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct ... | (&mut self, name: &'a str) { self.0.args.insert(name, MatchedArg::new()); }
pub fn contains(&self, arg: &str) -> bool { self.0.args.contains_key(arg) }
pub fn is_empty(&self) -> bool { self.0.args.is_empty() }
pub fn usage(&mut self, usage: String) { self.0.usage = Some(usage); }
pub fn arg_names(&'... | insert | identifier_name |
string-lit.rs | // rustfmt-force_format_strings: true
// rustfmt-error_on_line_overflow: false
// Long string literals
fn | () -> &'static str {
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAaAA \
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
let str = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | main | identifier_name |
string-lit.rs | // rustfmt-force_format_strings: true
// rustfmt-error_on_line_overflow: false
// Long string literals
fn main() -> &'static str {
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAaAA \
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAA... | LIMINATE_DUPLICATE_FUNCTIONS=1 -s EVAL_CTORS=1"]
extern "C" {}
| conditional_block | |
string-lit.rs | // rustfmt-force_format_strings: true
// rustfmt-error_on_line_overflow: false
// Long string literals
fn main() -> &'static str {
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAaAA \
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAA... |
"stuffin'"
}
fn issue682() {
let a = "hello \\ o/";
let b = a.replace("\\ ", "\\");
}
fn issue716() {
println!(
"forall x. mult(e(), x) = x /\\
forall x. mult(x, x) = e()"
);
}
fn issue_1282() {
{
match foo {
Permission::AndroidPermissionAccessLocati... | let unicode4 = "☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃"; | random_line_split |
string-lit.rs | // rustfmt-force_format_strings: true
// rustfmt-error_on_line_overflow: false
// Long string literals
fn main() -> &'static str |
filename.replace(" ", "\\");
let xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx =
funktion("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
let unicode = "a̐éö̲\r\n";
let unicode2 = "Löwe 老虎 Léopard";
let unicode3 = "中华Việt Nam";
let unicode4 = ... | {
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAaAA \
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa";
let str = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | identifier_body |
mod.rs | use self::parse::{Parser, RawChunk};
use super::{Graph, Node};
use anyhow::{bail, Error};
use std::fmt;
mod parse;
enum Chunk {
Raw(String),
Package,
License,
Repository,
Features,
}
pub struct Pattern(Vec<Chunk>);
impl Pattern {
pub fn new(format: &str) -> Result<Pattern, Error> {
l... |
Chunk::License => {
if let Some(license) = &package.manifest().metadata().license {
write!(fmt, "{}", license)?;
}
}
Chunk::Repository => {
... | {
let proc_macro_suffix = if package.proc_macro() {
" (proc-macro)"
} else {
""
};
write!(
fmt,
... | conditional_block |
mod.rs | use self::parse::{Parser, RawChunk};
use super::{Graph, Node};
use anyhow::{bail, Error};
use std::fmt;
mod parse;
enum Chunk {
Raw(String),
Package,
License,
Repository,
Features,
}
pub struct Pattern(Vec<Chunk>);
impl Pattern {
pub fn new(format: &str) -> Result<Pattern, Error> {
l... | "{} v{}{}",
package.name(),
package.version(),
proc_macro_suffix
)?;
let source_id = package.package_id().source_id();
... | {
let node = self.graph.node(self.node_index);
match node {
Node::Package {
package_id,
features,
..
} => {
let package = self.graph.package_for_id(*package_id);
for chunk in &self.pattern.0 {
... | identifier_body |
mod.rs | use self::parse::{Parser, RawChunk};
use super::{Graph, Node};
use anyhow::{bail, Error};
use std::fmt;
mod parse;
enum Chunk {
Raw(String),
Package,
License,
Repository,
Features,
}
pub struct Pattern(Vec<Chunk>);
impl Pattern {
pub fn new(format: &str) -> Result<Pattern, Error> {
l... | <'a> {
pattern: &'a Pattern,
graph: &'a Graph<'a>,
node_index: usize,
}
impl<'a> fmt::Display for Display<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let node = self.graph.node(self.node_index);
match node {
Node::Package {
package_id,
... | Display | identifier_name |
mod.rs | use self::parse::{Parser, RawChunk};
use super::{Graph, Node};
use anyhow::{bail, Error};
use std::fmt;
mod parse;
enum Chunk {
Raw(String),
Package,
License,
Repository,
Features,
}
pub struct Pattern(Vec<Chunk>);
impl Pattern {
pub fn new(format: &str) -> Result<Pattern, Error> {
l... | ""
};
write!(
fmt,
"{} v{}{}",
package.name(),
package.version(),
proc_m... | " (proc-macro)"
} else { | random_line_split |
assert_dep_graph.rs | //! This pass is only used for the UNIT TESTS and DEBUGGING NEEDS
//! around dependency graph construction. It serves two purposes; it
//! will dump graphs in graphviz form to disk, and it searches for
//! `#[rustc_if_this_changed]` and `#[rustc_then_this_would_need]`
//! annotations. These annotations can be used to t... |
// Find annotations supplied by user (if any).
let (if_this_changed, then_this_would_need) = {
let mut visitor =
IfThisChanged { tcx, if_this_changed: vec![], then_this_would_need: vec![] };
visitor.process_attrs(hir::CRATE_HIR_ID);
tcx.hir().visit_a... | {
return;
} | conditional_block |
assert_dep_graph.rs | //! This pass is only used for the UNIT TESTS and DEBUGGING NEEDS
//! around dependency graph construction. It serves two purposes; it
//! will dump graphs in graphviz form to disk, and it searches for
//! `#[rustc_if_this_changed]` and `#[rustc_then_this_would_need]`
//! annotations. These annotations can be used to t... | (&mut self, hir_id: hir::HirId) {
let def_id = self.tcx.hir().local_def_id(hir_id);
let def_path_hash = self.tcx.def_path_hash(def_id.to_def_id());
let attrs = self.tcx.hir().attrs(hir_id);
for attr in attrs {
if attr.has_name(sym::rustc_if_this_changed) {
let... | process_attrs | identifier_name |
assert_dep_graph.rs | //! This pass is only used for the UNIT TESTS and DEBUGGING NEEDS
//! around dependency graph construction. It serves two purposes; it
//! will dump graphs in graphviz form to disk, and it searches for
//! `#[rustc_if_this_changed]` and `#[rustc_then_this_would_need]`
//! annotations. These annotations can be used to t... | .map(|c| if c == '_' || c.is_alphanumeric() { c } else { '_' })
.collect();
debug!("n={:?} s={:?}", n, s);
dot::Id::new(s).unwrap()
}
fn node_label(&self, n: &&'q DepNode) -> dot::LabelText<'_> {
dot::LabelText::label(format!("{:?}", n))
}
}
// Given an optiona... | .chars() | random_line_split |
assert_dep_graph.rs | //! This pass is only used for the UNIT TESTS and DEBUGGING NEEDS
//! around dependency graph construction. It serves two purposes; it
//! will dump graphs in graphviz form to disk, and it searches for
//! `#[rustc_if_this_changed]` and `#[rustc_then_this_would_need]`
//! annotations. These annotations can be used to t... |
fn node_label(&self, n: &&'q DepNode) -> dot::LabelText<'_> {
dot::LabelText::label(format!("{:?}", n))
}
}
// Given an optional filter like `"x,y,z"`, returns either `None` (no
// filter) or the set of nodes whose labels contain all of those
// substrings.
fn node_set<'q>(
query: &'q DepGraphQuer... | {
let s: String = format!("{:?}", n)
.chars()
.map(|c| if c == '_' || c.is_alphanumeric() { c } else { '_' })
.collect();
debug!("n={:?} s={:?}", n, s);
dot::Id::new(s).unwrap()
} | identifier_body |
mod.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | assert_eq!(ten.mul(two), ten * two);
assert_eq!(ten.div(two), ten / two);
assert_eq!(ten.rem(two), ten % two);
}
#[cfg(test)]
mod tests {
use core::option::Option;
use core::option::Option::{Some, None};
use core::num::Float;
#[test]
fn from_str_issue7588() {
let u : Option<... | random_line_split | |
mod.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
i32_val = i32_val.wrapping_add(1);
assert_eq!("-2147483648".parse::<i32>().ok(), Some(i32_val));
assert_eq!("-2147483649".parse::<i32>().ok(), None);
let mut i64_val: i64 = 9_223_372_036_854_775_807;
assert_eq!("9223372036854775807".parse::<i64>().ok(), Some(i64_val));
... | {
let mut i8_val: i8 = 127;
assert_eq!("127".parse::<i8>().ok(), Some(i8_val));
assert_eq!("128".parse::<i8>().ok(), None);
i8_val = i8_val.wrapping_add(1);
assert_eq!("-128".parse::<i8>().ok(), Some(i8_val));
assert_eq!("-129".parse::<i8>().ok(), None);
let mut... | identifier_body |
mod.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let x1 : Option<f64> = f64::from_str_radix("-123.456", 10).ok();
assert_eq!(x1, Some(-123.456));
let x2 : Option<f32> = f32::from_str_radix("123.456", 10).ok();
assert_eq!(x2, Some(123.456));
let x3 : Option<f32> = f32::from_str_radix("-0.0", 10).ok();
assert_eq!(x3,... | test_from_str_radix_float | identifier_name |
arc_types.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/. */
//! This file lists all arc FFI types and defines corresponding addref
//! and release functions. This list corres... | (self) -> RawServoRuleNodeStrong {
let ptr = self.ptr();
mem::forget(self);
unsafe { mem::transmute(ptr) }
}
pub fn from_ffi<'a>(ffi: &'a &RawServoRuleNode) -> &'a Self {
unsafe { &*(ffi as *const &RawServoRuleNode as *const StrongRuleNode) }
}
}
#[no_mangle]
pub unsafe ext... | into_strong | identifier_name |
arc_types.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/. */
//! This file lists all arc FFI types and defines corresponding addref
//! and release functions. This list corres... |
#[no_mangle]
pub unsafe extern "C" fn Servo_RuleNode_Release(obj: &RawServoRuleNode) {
let ptr = StrongRuleNode::from_ffi(&obj);
ptr::read(ptr as *const StrongRuleNode);
}
| {
mem::forget(StrongRuleNode::from_ffi(&obj).clone());
} | identifier_body |
arc_types.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/. */
//! This file lists all arc FFI types and defines corresponding addref
//! and release functions. This list corres... | impl_arc_ffi!(Locked<MediaList> => RawServoMediaList
[Servo_MediaList_AddRef, Servo_MediaList_Release]);
impl_arc_ffi!(Locked<MediaRule> => RawServoMediaRule
[Servo_MediaRule_AddRef, Servo_MediaRule_Release]);
impl_arc_ffi!(Locked<NamespaceRule> => RawServoNamespaceRule
[Serv... | [Servo_Keyframe_AddRef, Servo_Keyframe_Release]);
impl_arc_ffi!(Locked<KeyframesRule> => RawServoKeyframesRule
[Servo_KeyframesRule_AddRef, Servo_KeyframesRule_Release]);
| random_line_split |
main.rs | #[macro_use] extern crate nickel;
extern crate postgres;
extern crate time;
extern crate rustc_serialize;
use nickel::{Nickel, JsonBody, FormBody};
use nickel::status::StatusCode;
use postgres::{Connection, SslMode};
use std::collections::HashMap;
use rustc_serialize::json::{Json, ToJson};
use std::collections::BTreeM... | (server: &mut nickel::Nickel){
server.utilize(router! {
get "/" => |request, response| {
"Hello world!"
}
post "/insert/:table_name" => |req, res| {
//let bdata = try_with!(response, {
//request.json_as::<HashMap>().map_err(|e| (StatusCode::BadRequest,... | init_routing | identifier_name |
main.rs | #[macro_use] extern crate nickel;
extern crate postgres;
extern crate time;
extern crate rustc_serialize;
use nickel::{Nickel, JsonBody, FormBody};
use nickel::status::StatusCode;
use postgres::{Connection, SslMode};
use std::collections::HashMap;
use rustc_serialize::json::{Json, ToJson};
use std::collections::BTreeM... |
fn start_server(){
let mut server = Nickel::new();
init_routing(&mut server);
server.listen("127.0.0.1:6767");
}
fn init_database(){
let conn = Connection::connect("postgres://livia:postgrespass@localhost/livia", SslMode::None).unwrap();
conn.execute("CREATE EXTENSION IF NOT EXISTS hstore", &[])... | {
server.utilize(router! {
get "/" => |request, response| {
"Hello world!"
}
post "/insert/:table_name" => |req, res| {
//let bdata = try_with!(response, {
//request.json_as::<HashMap>().map_err(|e| (StatusCode::BadRequest, e))
//});
... | identifier_body |
main.rs | #[macro_use] extern crate nickel;
extern crate postgres;
extern crate time;
extern crate rustc_serialize;
use nickel::{Nickel, JsonBody, FormBody};
use nickel::status::StatusCode;
use postgres::{Connection, SslMode};
use std::collections::HashMap;
use rustc_serialize::json::{Json, ToJson};
use std::collections::BTreeM... | conn.execute("CREATE TABLE IF NOT EXISTS table_metadata (
id SERIAL PRIMARY KEY,
name TEXT UNIQUE NOT NULL,
creation_time TIMESTAMP NOT NULL,
battery_mapping HSTORE NOT NULL
)", &[]).unwrap();
let mut battery_... | random_line_split | |
regions-assoc-type-region-bound.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | { } | identifier_body | |
regions-assoc-type-region-bound.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | fn main() { } | random_line_split | |
regions-assoc-type-region-bound.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | <'a,F: Foo<'a>>(f: &'a F) {
// This call would be illegal, because it results in &'a F::Value,
// and the only way we know that `F::Value : 'a` is because of the
// trait declaration.
f.get();
}
fn main() { }
| takes_foo | identifier_name |
time_passes.rs | //! Process `-Z time-passes` output
use rustc_perf_collector::Pass;
use errors::{Result, ResultExt};
pub fn process_output(name: &str, output: Vec<u8>) -> Result<Vec<Pass>> {
let output = String::from_utf8(output)
.chain_err(|| format!("unable to convert output of {} to UTF-8", name))?;
let mut passes... |
}
| {
self.runs += 1;
for a in &mut self.state {
let b = match b.iter().find(|p| p.name == a.name) {
Some(b) => b,
None => bail!("expected name {} to exist in both a and b", a.name),
};
a.time = a.time + ((b.time - a.time) / (self.runs as ... | identifier_body |
time_passes.rs | //! Process `-Z time-passes` output
use rustc_perf_collector::Pass;
use errors::{Result, ResultExt};
pub fn process_output(name: &str, output: Vec<u8>) -> Result<Vec<Pass>> {
let output = String::from_utf8(output) | for line in output.lines() {
if line.starts_with("time: ") {
let time = &line["time: ".len()..line.find(";").unwrap()];
let time: f64 = time.parse().chain_err(|| format!("parsed time: {:?}", time))?;
let mem = &line[line.find("rss: ").unwrap() + 5..line.find("MB").unwrap... | .chain_err(|| format!("unable to convert output of {} to UTF-8", name))?;
let mut passes = Vec::new();
| random_line_split |
time_passes.rs | //! Process `-Z time-passes` output
use rustc_perf_collector::Pass;
use errors::{Result, ResultExt};
pub fn process_output(name: &str, output: Vec<u8>) -> Result<Vec<Pass>> {
let output = String::from_utf8(output)
.chain_err(|| format!("unable to convert output of {} to UTF-8", name))?;
let mut passes... | else {
//info!("unhandled line: {}", line);
}
}
Ok(passes)
}
pub struct PassAverager {
pub state: Vec<Pass>,
runs: u64
}
impl PassAverager {
pub fn new(state: Vec<Pass>) -> Self {
Self {
state: state,
runs: 0,
}
}
pub fn averag... | {
// XXX: sub passes currently cause problems because their names are inconsistent in
// incremental runs, especially codegen passes
//let time = &line[" time: ".len()..line.find(";").unwrap()];
//let time: f64 = time.parse().chain_err(|| format!("parsed time: {:?}", tim... | conditional_block |
time_passes.rs | //! Process `-Z time-passes` output
use rustc_perf_collector::Pass;
use errors::{Result, ResultExt};
pub fn | (name: &str, output: Vec<u8>) -> Result<Vec<Pass>> {
let output = String::from_utf8(output)
.chain_err(|| format!("unable to convert output of {} to UTF-8", name))?;
let mut passes = Vec::new();
for line in output.lines() {
if line.starts_with("time: ") {
let time = &line["time: ... | process_output | identifier_name |
typeck-default-trait-impl-constituent-types-2.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn main() {
is_mytrait::<MyS>();
is_mytrait::<(MyS2, MyS)>();
//~^ ERROR the trait `MyTrait` is not implemented for the type `MyS2`
}
| {} | identifier_body |
typeck-default-trait-impl-constituent-types-2.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
is_mytrait::<MyS>();
is_mytrait::<(MyS2, MyS)>();
//~^ ERROR the trait `MyTrait` is not implemented for the type `MyS2`
}
| main | identifier_name |
typeck-default-trait-impl-constituent-types-2.rs | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
impl!MyTrait for MyS2 {}
fn is_mytrait<T: MyTrait>() {}
fn main() {
is_mytrait::<MyS>();
is_mytrait::<(MyS2, MyS)>();
//~^ ERROR the trait `MyTrait` is not implemented for the type `MyS2`
} | impl MyTrait for .. {}
struct MyS;
struct MyS2; | random_line_split |
overlaydb.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... |
#[test]
fn overlaydb_negative() {
let mut trie = OverlayDB::new_temp();
let h = trie.insert(b"hello world");
trie.commit().unwrap();
trie.remove(&h);
trie.remove(&h); //bad - sends us into negative refs.
assert_eq!(trie.get(&h), None);
assert!(trie.commit().is_err());
}
#[test]
fn overlaydb_complex() {
let m... | {
let mut trie = OverlayDB::new_temp();
let h = trie.insert(b"hello world");
trie.commit().unwrap();
trie.remove(&h);
assert_eq!(trie.get(&h), None);
trie.revert();
assert_eq!(trie.get(&h).unwrap(), DBValue::from_slice(b"hello world"));
} | identifier_body |
overlaydb.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... |
}
// Replace above match arm with this once https://github.com/rust-lang/rust/issues/15287 is done.
//Some((d, rc)) if rc + memrc > 0 => Some(d),
_ => None,
}
}
fn contains(&self, key: &H256) -> bool {
// return ok if positive; if negative, check backing - might be enough references there to make
/... | {
None
} | conditional_block |
overlaydb.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... | (&mut self, key: H256, value: DBValue) { self.overlay.emplace(key, value); }
fn remove(&mut self, key: &H256) { self.overlay.remove(key); }
}
#[test]
#[cfg_attr(feature="dev", allow(blacklisted_name))]
fn overlaydb_revert() {
let mut m = OverlayDB::new_temp();
let foo = m.insert(b"foo"); // insert foo.
le... | emplace | identifier_name |
overlaydb.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... | assert!(!m.contains(&bar)); // bar is gone.
}
#[test]
fn overlaydb_overlay_insert_and_remove() {
let mut trie = OverlayDB::new_temp();
let h = trie.insert(b"hello world");
assert_eq!(trie.get(&h).unwrap(), DBValue::from_slice(b"hello world"));
trie.remove(&h);
assert_eq!(trie.get(&h), None);
}
#[test]
... | m.remove(&foo); // remove foo.
assert!(!m.contains(&foo)); // foo is gone.
assert!(m.contains(&bar)); // bar is here.
m.revert(); // revert the last two operations.
assert!(m.contains(&foo)); // foo is here. | random_line_split |
jensens_device.rs | // http://rosettacode.org/wiki/Jensen's_Device
fn harmonic_sum<F>(lo:usize, hi:usize, term: F ) -> f32
where F : Fn(f32) -> f32 {
(lo..hi+1).fold(0.0, |acc, item| acc + term(item as f32))
}
#[cfg(not(test))]
fn | () {
println!("{}", harmonic_sum(1, 100, |i| 1.0 / i) );
}
#[test]
fn test_harm_sum() {
let term = |i| 1.0 / i;
assert_eq!( harmonic_sum(1, 100, &term), 5.187378);
assert_eq!( harmonic_sum(1, 50, &term), 4.4992056);
assert_eq!( harmonic_sum(1, 1000, &term), 7.4854784);
assert_eq!( harmonic_sum(... | main | identifier_name |
jensens_device.rs | // http://rosettacode.org/wiki/Jensen's_Device
fn harmonic_sum<F>(lo:usize, hi:usize, term: F ) -> f32
where F : Fn(f32) -> f32 {
(lo..hi+1).fold(0.0, |acc, item| acc + term(item as f32))
}
#[cfg(not(test))]
fn main() {
println!("{}", harmonic_sum(1, 100, |i| 1.0 / i) );
}
#[test]
fn test_harm_sum() { | let term = |i| 1.0 / i;
assert_eq!( harmonic_sum(1, 100, &term), 5.187378);
assert_eq!( harmonic_sum(1, 50, &term), 4.4992056);
assert_eq!( harmonic_sum(1, 1000, &term), 7.4854784);
assert_eq!( harmonic_sum(1, 2, &term), 1.5);
} | random_line_split | |
jensens_device.rs | // http://rosettacode.org/wiki/Jensen's_Device
fn harmonic_sum<F>(lo:usize, hi:usize, term: F ) -> f32
where F : Fn(f32) -> f32 {
(lo..hi+1).fold(0.0, |acc, item| acc + term(item as f32))
}
#[cfg(not(test))]
fn main() {
println!("{}", harmonic_sum(1, 100, |i| 1.0 / i) );
}
#[test]
fn test_harm_sum() | {
let term = |i| 1.0 / i;
assert_eq!( harmonic_sum(1, 100, &term), 5.187378);
assert_eq!( harmonic_sum(1, 50, &term), 4.4992056);
assert_eq!( harmonic_sum(1, 1000, &term), 7.4854784);
assert_eq!( harmonic_sum(1, 2, &term), 1.5);
} | identifier_body | |
mod.rs | // Copyright 2015-2017 Intecture Developers.
//
// Licensed under the Mozilla Public License 2.0 <LICENSE or
// https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied,
// modified, or distributed except according to those terms.
//! OS abstractions for `Service`.
mod debian;
mod homebrew;
mod launchctl;
mo... | use tokio_core::reactor::Handle;
/// Specific implementation of `Service`
#[derive(Clone, Copy, Serialize, Deserialize)]
pub enum Provider {
Debian,
Homebrew,
Launchctl,
Rc,
Redhat,
Systemd,
}
pub trait ServiceProvider {
fn available(&Telemetry) -> Result<bool> where Self: Sized;
fn ru... | pub use self::rc::Rc;
pub use self::redhat::Redhat;
pub use self::systemd::Systemd;
use telemetry::Telemetry; | random_line_split |
mod.rs | // Copyright 2015-2017 Intecture Developers.
//
// Licensed under the Mozilla Public License 2.0 <LICENSE or
// https://www.tldrlegal.com/l/mpl-2.0>. This file may not be copied,
// modified, or distributed except according to those terms.
//! OS abstractions for `Service`.
mod debian;
mod homebrew;
mod launchctl;
mo... | {
Debian,
Homebrew,
Launchctl,
Rc,
Redhat,
Systemd,
}
pub trait ServiceProvider {
fn available(&Telemetry) -> Result<bool> where Self: Sized;
fn running(&self, &Handle, &str) -> ExecutableResult;
fn action(&self, &Handle, &str, &str) -> ExecutableResult;
fn enabled(&self, &Hand... | Provider | identifier_name |
arbitrary_self_types_struct.rs | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | (self: Rc<Self>) -> i32 {
self.y
}
}
fn main() {
let foo = Rc::new(Foo {x: 3, y: 4});
assert_eq!(3, foo.x());
assert_eq!(4, foo.y());
}
| y | identifier_name |
arbitrary_self_types_struct.rs | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
}
fn main() {
let foo = Rc::new(Foo {x: 3, y: 4});
assert_eq!(3, foo.x());
assert_eq!(4, foo.y());
}
| {
self.y
} | identifier_body |
arbitrary_self_types_struct.rs | // Copyright 2017 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 ... | use std::rc::Rc;
struct Foo {
x: i32,
y: i32,
}
impl Foo {
fn x(self: &Rc<Self>) -> i32 {
self.x
}
fn y(self: Rc<Self>) -> i32 {
self.y
}
}
fn main() {
let foo = Rc::new(Foo {x: 3, y: 4});
assert_eq!(3, foo.x());
assert_eq!(4, foo.y());
} | random_line_split | |
utilities.rs | use consts::MAP_HEIGHT;
use consts::MAP_WIDTH;
use tcod::console::*;
use tcod::Console;
use object::Object;
use map::Map;
use tcod::console::blit;
use consts::COLOR_DARK_WALL;
use consts::COLOR_DARK_GROUND;
pub fn render_all(root: &mut Root, con: &mut Offscreen, objects: &[Object], map: &Map) {
for y in 0..MAP_... | (root: &mut Root, player: &mut Object, map: &Map) -> bool {
use tcod::input::Key;
use tcod::input::KeyCode::*;
let key = root.wait_for_keypress(true);
match key {
Key { code: Enter, alt: true,.. } => {
let fullscreen = root.is_fullscreen();
root.set_fullscreen(!fullscr... | handle_keys | identifier_name |
utilities.rs | use consts::MAP_HEIGHT;
use consts::MAP_WIDTH;
use tcod::console::*;
use tcod::Console;
use object::Object;
use map::Map;
use tcod::console::blit;
use consts::COLOR_DARK_WALL;
use consts::COLOR_DARK_GROUND;
pub fn render_all(root: &mut Root, con: &mut Offscreen, objects: &[Object], map: &Map) |
pub fn handle_keys(root: &mut Root, player: &mut Object, map: &Map) -> bool {
use tcod::input::Key;
use tcod::input::KeyCode::*;
let key = root.wait_for_keypress(true);
match key {
Key { code: Enter, alt: true,.. } => {
let fullscreen = root.is_fullscreen();
root.se... | {
for y in 0..MAP_HEIGHT {
for x in 0..MAP_WIDTH {
let wall = map[x as usize][y as usize].block_sight;
if wall {
con.set_char_background(x, y, COLOR_DARK_WALL, BackgroundFlag::Set);
} else {
con.set_char_background(x, y, COLOR_DARK_GROUND... | identifier_body |
utilities.rs | use consts::MAP_HEIGHT;
use consts::MAP_WIDTH;
use tcod::console::*;
use tcod::Console;
use object::Object;
use map::Map;
use tcod::console::blit;
use consts::COLOR_DARK_WALL;
use consts::COLOR_DARK_GROUND;
pub fn render_all(root: &mut Root, con: &mut Offscreen, objects: &[Object], map: &Map) {
for y in 0..MAP_... | Key { code: Down,.. } => player.move_by(0, 1, map),
Key { code: Left,.. } => player.move_by(-1, 0, map),
Key { code: Right,.. } => player.move_by(1, 0, map),
_ => {},
}
false
} |
Key { code: Escape, ..} => return true,
Key { code: Up, ..} => player.move_by(0, -1, map), | random_line_split |
printer.rs | use piston_window::*;
use piston_window::types::*;
use piston_window::character::CharacterCache;
/// Prints text to the screen
pub struct Printer {
pub font_size: FontSize,
pub glyphs: Glyphs,
pub ctx: Context,
line_nr: u32,
left_padding: Scalar,
}
impl Printer {
/// Create a new Printer
... | }
/// Print without ending with a new line
pub fn print(&mut self, string: &str, color: Color, g2d: &mut G2d) {
text::Text::new_color(color, self.font_size)
.draw(
string,
&mut self.glyphs,
&self.ctx.draw_state,
self.ctx.t... | self.left_padding = 0.0; | random_line_split |
printer.rs | use piston_window::*;
use piston_window::types::*;
use piston_window::character::CharacterCache;
/// Prints text to the screen
pub struct Printer {
pub font_size: FontSize,
pub glyphs: Glyphs,
pub ctx: Context,
line_nr: u32,
left_padding: Scalar,
}
impl Printer {
/// Create a new Printer
... | ;
// Calculate height
let mut y = Scalar::from(self.line_nr * self.font_size * 2);
if is_superscript {
y -= Scalar::from(text.font_size);
}
// Draw text
text.draw(
&c.to_string(),
&mut self.glyphs... | {
color_text_full
} | conditional_block |
printer.rs | use piston_window::*;
use piston_window::types::*;
use piston_window::character::CharacterCache;
/// Prints text to the screen
pub struct Printer {
pub font_size: FontSize,
pub glyphs: Glyphs,
pub ctx: Context,
line_nr: u32,
left_padding: Scalar,
}
impl Printer {
/// Create a new Printer
... |
/// Print and end with a new line
pub fn print_ln(&mut self, string: &str, color: Color, g2d: &mut G2d) {
self.print(string, color, g2d);
self.newline();
}
/// Parse and print a molecule string in basic (non-nesting) LaTeX format, as provided by feroxide
pub fn print_molecule_s... | {
text::Text::new_color(color, self.font_size)
.draw(
string,
&mut self.glyphs,
&self.ctx.draw_state,
self.ctx.transform.trans(self.left_padding, Scalar::from(self.line_nr * self.font_size * 2)),
g2d,
);
... | identifier_body |
printer.rs | use piston_window::*;
use piston_window::types::*;
use piston_window::character::CharacterCache;
/// Prints text to the screen
pub struct Printer {
pub font_size: FontSize,
pub glyphs: Glyphs,
pub ctx: Context,
line_nr: u32,
left_padding: Scalar,
}
impl Printer {
/// Create a new Printer
... | (&mut self, string: &str, color: Color, g2d: &mut G2d) {
self.print(string, color, g2d);
self.newline();
}
/// Parse and print a molecule string in basic (non-nesting) LaTeX format, as provided by feroxide
pub fn print_molecule_string(&mut self, molecule_string: &str, color: Color, g2d: &... | print_ln | identifier_name |
pascalstring.rs | // PascalString: Pascal Formatted string(heading number of characters)
use super::{PSDLoadingError, BinaryLoaderUtils};
use std;
use std::io::prelude::*;
pub fn read_from_file(mut fp: std::fs::File, pad_align: usize) -> Result<(Vec<u8>, usize, std::fs::File), PSDLoadingError>
| {
fp.read_u8().map_err(PSDLoadingError::from).and_then(|len| if len == 0
{
let mut pad_buffer = vec![0u8; pad_align - 1];
fp.read_exact(&mut pad_buffer).map_err(PSDLoadingError::from).map(|()| (Vec::new(), pad_align, fp))
}
else
{
let padded_size = (((1.0 + len as f32) / 4.0).ceil() * 4.0) as usize;
let mu... | identifier_body | |
pascalstring.rs | // PascalString: Pascal Formatted string(heading number of characters)
use super::{PSDLoadingError, BinaryLoaderUtils};
use std;
use std::io::prelude::*;
pub fn | (mut fp: std::fs::File, pad_align: usize) -> Result<(Vec<u8>, usize, std::fs::File), PSDLoadingError>
{
fp.read_u8().map_err(PSDLoadingError::from).and_then(|len| if len == 0
{
let mut pad_buffer = vec![0u8; pad_align - 1];
fp.read_exact(&mut pad_buffer).map_err(PSDLoadingError::from).map(|()| (Vec::new(), pad_al... | read_from_file | identifier_name |
pascalstring.rs | // PascalString: Pascal Formatted string(heading number of characters)
use super::{PSDLoadingError, BinaryLoaderUtils};
use std;
use std::io::prelude::*;
pub fn read_from_file(mut fp: std::fs::File, pad_align: usize) -> Result<(Vec<u8>, usize, std::fs::File), PSDLoadingError>
{
fp.read_u8().map_err(PSDLoadingError::... |
else
{
let padded_size = (((1.0 + len as f32) / 4.0).ceil() * 4.0) as usize;
let mut bytes = vec![0u8; len as usize];
let mut pad_bytes = vec![0u8; padded_size - len as usize - 1];
fp.read_exact(&mut bytes).and_then(|()| fp.read_exact(&mut pad_bytes)).map_err(PSDLoadingError::from)
.map(|()| (bytes, padde... | {
let mut pad_buffer = vec![0u8; pad_align - 1];
fp.read_exact(&mut pad_buffer).map_err(PSDLoadingError::from).map(|()| (Vec::new(), pad_align, fp))
} | conditional_block |
pascalstring.rs | // PascalString: Pascal Formatted string(heading number of characters)
| use std;
use std::io::prelude::*;
pub fn read_from_file(mut fp: std::fs::File, pad_align: usize) -> Result<(Vec<u8>, usize, std::fs::File), PSDLoadingError>
{
fp.read_u8().map_err(PSDLoadingError::from).and_then(|len| if len == 0
{
let mut pad_buffer = vec![0u8; pad_align - 1];
fp.read_exact(&mut pad_buffer).map... | use super::{PSDLoadingError, BinaryLoaderUtils}; | random_line_split |
lib.rs |
use std::str::FromStr;
use std::string::ToString;
#[derive(Debug, PartialEq)]
pub enum StatementType {
Normal,
For,
If
}
#[derive(Debug, PartialEq)]
pub enum IndentChange {
None,
Increase,
Decrease
}
#[derive(Debug)]
pub struct Line {
line: String,
indent_change: IndentChange,
statement_type: Stat... | ,
IndentChange::Decrease => {
let statement_type = self.statement_stack.pop().unwrap();
assert_eq!(statement_type, &line.statement_type);
self.change_indent(-1);
self.print_indent();
},
IndentChange::None => self.print_indent()
};
println!("... | {
self.print_indent();
self.change_indent(1);
self.statement_stack.push(&line.statement_type);
} | conditional_block |
lib.rs | use std::str::FromStr;
use std::string::ToString;
#[derive(Debug, PartialEq)] | Normal,
For,
If
}
#[derive(Debug, PartialEq)]
pub enum IndentChange {
None,
Increase,
Decrease
}
#[derive(Debug)]
pub struct Line {
line: String,
indent_change: IndentChange,
statement_type: StatementType
}
impl Line {
pub fn parse<T: AsRef<str>> (line_str: T) -> Line {
let line_str_ref = li... | pub enum StatementType { | random_line_split |
lib.rs |
use std::str::FromStr;
use std::string::ToString;
#[derive(Debug, PartialEq)]
pub enum StatementType {
Normal,
For,
If
}
#[derive(Debug, PartialEq)]
pub enum IndentChange {
None,
Increase,
Decrease
}
#[derive(Debug)]
pub struct Line {
line: String,
indent_change: IndentChange,
statement_type: Stat... |
}
impl FromStr for Line {
type Err = String;
fn from_str(s: &str) -> Result<Line, String> {
Ok(Line::parse(s))
}
}
#[derive(Debug)]
pub struct Document {
lines: Vec<Line>
}
#[derive(Debug)]
struct DocumentRenderer<'a> {
doc: &'a Document,
statement_stack: Vec<&'a StatementType>,
cur_indent: usize... | {
let line_str_ref = line_str.as_ref().trim();
let mut split_line = line_str_ref.split(" ");
let first_token = split_line.next();
let (indent_change, statement_type) = match first_token {
Some("FOR") => (IndentChange::Increase, StatementType::For),
Some("NEXT") => (IndentChange::Decrease, S... | identifier_body |
lib.rs |
use std::str::FromStr;
use std::string::ToString;
#[derive(Debug, PartialEq)]
pub enum StatementType {
Normal,
For,
If
}
#[derive(Debug, PartialEq)]
pub enum IndentChange {
None,
Increase,
Decrease
}
#[derive(Debug)]
pub struct Line {
line: String,
indent_change: IndentChange,
statement_type: Stat... | (&mut self) {
for line in self.doc.lines.iter() {
match line.indent_change {
IndentChange::Increase => {
self.print_indent();
self.change_indent(1);
self.statement_stack.push(&line.statement_type);
},
IndentChange::Decrease => {
let statement_t... | render | identifier_name |
test_high_producers.rs | //! Test data production using high level producers.
use std::collections::HashMap;
use std::time::{Duration, Instant};
use futures::stream::{FuturesUnordered, StreamExt};
use rdkafka::client::DefaultClientContext;
use rdkafka::config::ClientConfig;
use rdkafka::error::{KafkaError, RDKafkaErrorCode};
use rdkafka::me... |
e => {
panic!("Unexpected return value: {:?}", e);
}
}
}
| {
assert_eq!(
kafka_error.to_string(),
"Message production error: UnknownPartition (Local: Unknown partition)"
);
assert_eq!(owned_message.topic(), "topic");
let headers = owned_message.headers().unwrap();
assert_eq!(headers.cou... | conditional_block |
test_high_producers.rs | //! Test data production using high level producers.
use std::collections::HashMap;
use std::time::{Duration, Instant};
use futures::stream::{FuturesUnordered, StreamExt};
use rdkafka::client::DefaultClientContext;
use rdkafka::config::ClientConfig;
use rdkafka::error::{KafkaError, RDKafkaErrorCode};
use rdkafka::me... | .await;
match res {
Ok(_) => panic!("send unexpectedly succeeded"),
Err((KafkaError::MessageProduction(RDKafkaErrorCode::QueueFull), _)) => start.elapsed(),
Err((e, _)) => panic!("got incorrect error: {}", e),
}
};
// Sending a message with no time... | {
// Connect to a nonexistent Kafka broker with a long message timeout and a
// tiny producer queue, so we can fill up the queue for a while by sending a
// single message.
let mut config = HashMap::new();
config.insert("bootstrap.servers", "");
config.insert("message.timeout.ms", "5000");
c... | identifier_body |
test_high_producers.rs | //! Test data production using high level producers.
use std::collections::HashMap;
use std::time::{Duration, Instant};
use futures::stream::{FuturesUnordered, StreamExt};
use rdkafka::client::DefaultClientContext;
use rdkafka::config::ClientConfig;
use rdkafka::error::{KafkaError, RDKafkaErrorCode};
use rdkafka::me... | () {
let producer = future_producer(HashMap::new());
let future = producer.send(
FutureRecord::to("topic")
.payload("payload")
.key("key")
.partition(100) // Fail
.headers(
OwnedHeaders::new()
.add("0", "A")
... | test_future_producer_send_fail | identifier_name |
test_high_producers.rs | //! Test data production using high level producers.
use std::collections::HashMap;
use std::time::{Duration, Instant};
use futures::stream::{FuturesUnordered, StreamExt};
use rdkafka::client::DefaultClientContext;
use rdkafka::config::ClientConfig;
use rdkafka::error::{KafkaError, RDKafkaErrorCode};
use rdkafka::me... | let headers = owned_message.headers().unwrap();
assert_eq!(headers.count(), 3);
assert_eq!(headers.get_as::<str>(0).unwrap(), ("0", Ok("A")));
assert_eq!(headers.get_as::<str>(1).unwrap(), ("1", Ok("B")));
assert_eq!(headers.get_as::<str>(2).unwrap(), ("2", Ok... | assert_eq!(
kafka_error.to_string(),
"Message production error: UnknownPartition (Local: Unknown partition)"
);
assert_eq!(owned_message.topic(), "topic"); | random_line_split |
wrapper.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 core::nonzero::NonZero;
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::DomObject;... |
fn as_any<'a>(&'a self) -> &'a Any {
self
}
}
impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTraceable + HeapSizeOf +'static {
pub fn dom_object(&self) -> Option<Root<T::Extension>> {
self.extension.get()
}
}
| {
T::name()
} | identifier_body |
wrapper.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 core::nonzero::NonZero;
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::DomObject;... | }
fn enable(&self, ext: &WebGLExtensions) {
T::enable(ext);
}
fn name(&self) -> &'static str {
T::name()
}
fn as_any<'a>(&'a self) -> &'a Any {
self
}
}
impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTraceable + HeapSizeOf +'static {
pub fn ... | }
}
fn is_supported(&self, ext: &WebGLExtensions) -> bool {
self.extension.get().is_some() || T::is_supported(ext) | random_line_split |
wrapper.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 core::nonzero::NonZero;
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::DomObject;... | (&self) -> &'static str {
T::name()
}
fn as_any<'a>(&'a self) -> &'a Any {
self
}
}
impl<T> TypedWebGLExtensionWrapper<T> where T: WebGLExtension + JSTraceable + HeapSizeOf +'static {
pub fn dom_object(&self) -> Option<Root<T::Extension>> {
self.extension.get()
}
}
| name | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.