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
restyle_damage.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 restyle damage is a hint that tells layout which kind of operations may //! be needed in presence of incre...
#[doc = "Recompute actual inline_sizes and block_sizes."] #[doc = "Propagates up the flow tree because the computation is"] #[doc = "top-down."] const REFLOW = 0x20, #[doc = "Re-resolve generated content. \ Propagates up the flow tree because the computation is ...
Propagates up the flow tree because the computation is top-down."] const REFLOW_OUT_OF_FLOW = 0x10,
random_line_split
in-band-lifetimes.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 ...
{}
identifier_body
in-band-lifetimes.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 ...
(x: &'a u32, y: &u32) -> &'a u32 { x } } struct X<'a>(&'a u8); impl<'a> X<'a> { fn inner(&self) -> &'a u8 { self.0 } fn same_lifetime_as_parameter(&mut self, x: &'a u8) { self.0 = x; } } impl X<'b> { fn inner_2(&self) -> &'b u8 { self.0 } fn reference_already_int...
foo
identifier_name
in-band-lifetimes.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. //
// <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. #![allow(warnings)] #![feature(in_band_lifetimes)] fn foo(x: &'x u8) -> &'x u8 { x } fn foo2(x: &'a u8, y: &u8) -> &'a u8 { x } fn check_in_band_can_be_...
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
random_line_split
struct_change_field_name.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 ...
#[rustc_clean(label="TypeckTables", cfg="cfail2")] pub fn use_Y() { let x: Y = Y { y: 'c' }; } pub fn main() { }
{ embed.x.x as u32 //[cfail2]~^ ERROR no field `x` on type `X` }
identifier_body
struct_change_field_name.rs
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ pub y: u32 } pub struct EmbedX { x: X } pub struct Y { pub y: char } #[rustc_dirty(label="TypeckTables", cfg="cfail2")] pub fn use_X() -> u32 { let x: X = X { x: 22 }; //[cfail2]~^ ERROR struct `X` has no field named `x` x.x as u32 //[cfail2]~^ ERROR no field `x` on type `X` } #[rustc...
X
identifier_name
struct_change_field_name.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 ...
embed.x.x as u32 //[cfail2]~^ ERROR no field `x` on type `X` } #[rustc_clean(label="TypeckTables", cfg="cfail2")] pub fn use_Y() { let x: Y = Y { y: 'c' }; } pub fn main() { }
#[rustc_dirty(label="TypeckTables", cfg="cfail2")] pub fn use_EmbedX(embed: EmbedX) -> u32 {
random_line_split
task-comm-3.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
fn test00() { let number_of_tasks: isize = 16; let number_of_messages: isize = 4; println!("Creating tasks"); let (tx, rx) = channel(); let mut i: isize = 0; // Create and spawn threads... let mut results = Vec::new(); while i < number_of_tasks { let tx = tx.clone(); ...
{ println!("Starting test00_start"); let mut i: isize = 0; while i < count { println!("Sending Message"); ch.send(message + 0).unwrap(); i = i + 1; } println!("Ending test00_start"); }
identifier_body
task-comm-3.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
let value = rx.recv().unwrap(); sum += value; i = i + 1; } } // Join spawned threads... for r in results { r.join(); } println!("Completed: Final number is: "); println!("{}", sum); // assert (sum == (((number_of_threads * (number_of_threads - 1)) / ...
i = 0; while i < number_of_messages {
random_line_split
task-comm-3.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { let number_of_tasks: isize = 16; let number_of_messages: isize = 4; println!("Creating tasks"); let (tx, rx) = channel(); let mut i: isize = 0; // Create and spawn threads... let mut results = Vec::new(); while i < number_of_tasks { let tx = tx.clone(); results.p...
test00
identifier_name
namespace.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 gecko_bindings::structs::nsIAtom; use std::borrow::Borrow; use std::fmt; use std::ops::Deref; use string_cache...
#[derive(Hash)] pub struct WeakNamespace(WeakAtom); impl Deref for Namespace { type Target = WeakNamespace; #[inline] fn deref(&self) -> &WeakNamespace { let weak: *const WeakAtom = &*self.0; unsafe { &*(weak as *const WeakNamespace) } } } impl fmt::Display for Na...
#[derive(Debug, PartialEq, Eq, Clone, Default, Hash)] pub struct Namespace(pub Atom);
random_line_split
namespace.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 gecko_bindings::structs::nsIAtom; use std::borrow::Borrow; use std::fmt; use std::ops::Deref; use string_cache...
} impl Borrow<WeakNamespace> for Namespace { #[inline] fn borrow(&self) -> &WeakNamespace { self } } impl WeakNamespace { #[inline] pub unsafe fn new<'a>(atom: *mut nsIAtom) -> &'a Self { &*(atom as *const WeakNamespace) } #[inline] pub fn clone(&self) -> Namespace { ...
{ self.0.fmt(w) }
identifier_body
namespace.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 gecko_bindings::structs::nsIAtom; use std::borrow::Borrow; use std::fmt; use std::ops::Deref; use string_cache...
(WeakAtom); impl Deref for Namespace { type Target = WeakNamespace; #[inline] fn deref(&self) -> &WeakNamespace { let weak: *const WeakAtom = &*self.0; unsafe { &*(weak as *const WeakNamespace) } } } impl fmt::Display for Namespace { fn fmt(&self, w: &mut fmt::...
WeakNamespace
identifier_name
header_struct.rs
// Copyright 2016-17 Alexander Reece // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accord...
}
{ if self.class.fields().is_empty() { return Ok(()); } try!(writeln!(writer, "impl_properties! {{")); for field in self.class.fields() { try!(write!(writer, "({0}, {0}_mut, set_{0}, take_{0}) -> ", field.var_name())); let ty = field.ty().borrowed_typ...
identifier_body
header_struct.rs
// Copyright 2016-17 Alexander Reece // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accord...
try!(writeln!(writer, "impl_properties! {{")); for field in self.class.fields() { try!(write!(writer, "({0}, {0}_mut, set_{0}, take_{0}) -> ", field.var_name())); let ty = field.ty().borrowed_type(); try!(match (field.ty().is_copy(), field.ty().is_owned()) { ...
{ return Ok(()); }
conditional_block
header_struct.rs
// Copyright 2016-17 Alexander Reece // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accord...
<'a> { class: &'a Class, } impl<'a> HeaderStructWriter<'a> { pub fn new(class: &'a Class) -> Self { HeaderStructWriter { class: class } } pub fn write_to<W>(&self, writer: &mut W) -> io::Result<()> where W: io::Write { if self.class.fields().is_empty() {...
HeaderStructWriter
identifier_name
header_struct.rs
// Copyright 2016-17 Alexander Reece // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except accord...
(_, true) => writeln!(writer, "Option< &{} >,", ty), _ => writeln!(writer, "Option< Cow<{}> >,", ty) }); } try!(writeln!(writer, "}} // impl_properties")); Ok(()) } }
try!(match (field.ty().is_copy(), field.ty().is_owned()) { (true, _) => writeln!(writer, "Option< {} >,", ty),
random_line_split
io.rs
use {EventSet, Selector, PollOpt, Token}; use bytes::{Buf, MutBuf}; // Re-export the io::Result / Error types for convenience pub use std::io::{Read, Write, Result, Error}; /// A value that may be registered with an `EventLoop` pub trait Evented { #[doc(hidden)] fn register(&self, selector: &mut Selector, tok...
res } fn try_read(&mut self, buf: &mut [u8]) -> Result<Option<usize>>; } pub trait TryWrite { fn try_write_buf<B: Buf>(&mut self, buf: &mut B) -> Result<Option<usize>> where Self : Sized { let res = self.try_write(buf.bytes()); if let Ok(Some(cnt)) = res { ...
{ buf.advance(cnt); }
conditional_block
io.rs
use {EventSet, Selector, PollOpt, Token}; use bytes::{Buf, MutBuf}; // Re-export the io::Result / Error types for convenience pub use std::io::{Read, Write, Result, Error}; /// A value that may be registered with an `EventLoop` pub trait Evented { #[doc(hidden)] fn register(&self, selector: &mut Selector, tok...
<B: MutBuf>(&mut self, buf: &mut B) -> Result<Option<usize>> where Self : Sized { // Reads the length of the slice supplied by buf.mut_bytes into the buffer // This is not guaranteed to consume an entire datagram or segment. // If your protocol is msg based (instead of continuous str...
try_read_buf
identifier_name
io.rs
use {EventSet, Selector, PollOpt, Token}; use bytes::{Buf, MutBuf}; // Re-export the io::Result / Error types for convenience pub use std::io::{Read, Write, Result, Error}; /// A value that may be registered with an `EventLoop` pub trait Evented { #[doc(hidden)] fn register(&self, selector: &mut Selector, tok...
} impl<T: Write> TryWrite for T { fn try_write(&mut self, src: &[u8]) -> Result<Option<usize>> { self.write(src) .map(|cnt| Some(cnt)) .or_else(to_non_block) } } pub trait TryAccept { type Output; fn accept(&self) -> Result<Option<Self::Output>>; } /* * * ===== Helpe...
{ self.read(dst) .map(|cnt| Some(cnt)) .or_else(to_non_block) }
identifier_body
io.rs
use {EventSet, Selector, PollOpt, Token}; use bytes::{Buf, MutBuf}; // Re-export the io::Result / Error types for convenience pub use std::io::{Read, Write, Result, Error}; /// A value that may be registered with an `EventLoop` pub trait Evented { #[doc(hidden)] fn register(&self, selector: &mut Selector, tok...
where Self : Sized { // Reads the length of the slice supplied by buf.mut_bytes into the buffer // This is not guaranteed to consume an entire datagram or segment. // If your protocol is msg based (instead of continuous stream) you should // ensure that your buffer is large e...
} pub trait TryRead { fn try_read_buf<B: MutBuf>(&mut self, buf: &mut B) -> Result<Option<usize>>
random_line_split
sprite_displayer.rs
use nalgebra::na::{ Eye, Mat4 }; use std::sync::{ Arc, Mutex }; use std::num; use super::managed_display::{ ManagedDisplay, Texture }; use super::Drawable; static vertexShader: &'static str = " #version 110 uniform mat4 uMatrix; attribute vec2 iPosition; attribute vec2 iTexCoords; varying vec2 vTexCoords; void mai...
Ok(SpriteDisplayer { display: display, insideMatrix: Eye::new_identity(4), texture: texture, vertexBuffer: vb, indexBuffer: ib, program: program, uniforms: Mutex::new(uniforms) }) } pub fn set_rectangle_coords(&mut self, leftCoord: Option<f32>, topCoord: Option<f32>, rightCoord: Option<f32...
{ let texture = try!(display.load_texture(resourceName)); let vs = display.build_shader(super::raw::GLSL, super::raw::Vertex, vertexShader, "main").unwrap(); let fs = display.build_shader(super::raw::GLSL, super::raw::Fragment, fragmentShader, "main").unwrap(); let program = display.build_program(&[ &vs, &fs ]...
identifier_body
sprite_displayer.rs
use nalgebra::na::{ Eye, Mat4 }; use std::sync::{ Arc, Mutex }; use std::num; use super::managed_display::{ ManagedDisplay, Texture }; use super::Drawable; static vertexShader: &'static str = " #version 110 uniform mat4 uMatrix; attribute vec2 iPosition; attribute vec2 iTexCoords; varying vec2 vTexCoords; void mai...
uniforms.set_value("uMatrix", self.insideMatrix * matrix.clone()); self.display.draw(&self.vertexBuffer, &self.indexBuffer, &self.program, uniforms.deref()); } }
random_line_split
sprite_displayer.rs
use nalgebra::na::{ Eye, Mat4 }; use std::sync::{ Arc, Mutex }; use std::num; use super::managed_display::{ ManagedDisplay, Texture }; use super::Drawable; static vertexShader: &'static str = " #version 110 uniform mat4 uMatrix; attribute vec2 iPosition; attribute vec2 iTexCoords; varying vec2 vTexCoords; void mai...
(display: Arc<ManagedDisplay>, resourceName: &str) -> Result<SpriteDisplayer, String> { let texture = try!(display.load_texture(resourceName)); let vs = display.build_shader(super::raw::GLSL, super::raw::Vertex, vertexShader, "main").unwrap(); let fs = display.build_shader(super::raw::GLSL, super::raw::Fragment,...
new
identifier_name
lib.rs
pub struct Driver { age: u8, } impl Driver { pub fn new(age: u8) -> Driver { Driver { age } } pub fn get_age(&self) -> u8 { self.age } } pub trait Car { fn drive_car(&self); } pub struct RealCar {} impl Car for RealCar { fn drive_car(&self) { println!("Car has be...
else { self.real_car.drive_car(); } } } impl ProxyCar { pub fn new(driver: Driver) -> ProxyCar { ProxyCar { driver, real_car: RealCar {}, } } }
{ println!("Sorry, the driver is too young to drive.") }
conditional_block
lib.rs
pub struct Driver { age: u8, } impl Driver { pub fn new(age: u8) -> Driver { Driver { age } } pub fn get_age(&self) -> u8 { self.age } } pub trait Car { fn drive_car(&self); } pub struct
{} impl Car for RealCar { fn drive_car(&self) { println!("Car has been driven!"); } } pub struct ProxyCar { driver: Driver, real_car: RealCar, } impl Car for ProxyCar { fn drive_car(&self) { if self.driver.age <= 16 { println!("Sorry, the driver is too young to drive....
RealCar
identifier_name
lib.rs
pub struct Driver { age: u8, } impl Driver { pub fn new(age: u8) -> Driver
pub fn get_age(&self) -> u8 { self.age } } pub trait Car { fn drive_car(&self); } pub struct RealCar {} impl Car for RealCar { fn drive_car(&self) { println!("Car has been driven!"); } } pub struct ProxyCar { driver: Driver, real_car: RealCar, } impl Car for ProxyCar {...
{ Driver { age } }
identifier_body
builder.rs
use anyhow::Context; #[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Deserialize)] #[allow(non_camel_case_types)] pub enum Arch { #[serde(rename = "i686")] I686, #[serde(rename = "x86_64")] X86_64, #[serde(rename = "arm")] ARM, #[serde(rename = "armv6h")] ARMV6H, #[serde(rename =...
let current_dir = current_dir_buf.as_path(); let mut srcdest_arg = std::ffi::OsString::from("SRCDEST="); srcdest_arg.push(current_dir.join(srcdest)); let mut pkgdest_arg = std::ffi::OsString::from("PKGDEST="); pkgdest_arg.push(current_dir.join(pkgdest)); let mut logdest_a...
let current_dir_buf = std::env::current_dir()?;
random_line_split
builder.rs
use anyhow::Context; #[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Deserialize)] #[allow(non_camel_case_types)] pub enum Arch { #[serde(rename = "i686")] I686, #[serde(rename = "x86_64")] X86_64, #[serde(rename = "arm")] ARM, #[serde(rename = "armv6h")] ARMV6H, #[serde(rename =...
Ok::<_, anyhow::Error>(dest) }); } use futures::StreamExt as _; let mut paths = vec![]; while let Some(path) = futures_unordered.next().await { paths.push(path?); } Ok(paths) } }
{ let mut sig_dest = dest.clone().into_os_string(); sig_dest.push(".sig"); signer.sign(&dest, sig_dest).await?; }
conditional_block
builder.rs
use anyhow::Context; #[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Deserialize)] #[allow(non_camel_case_types)] pub enum Arch { #[serde(rename = "i686")] I686, #[serde(rename = "x86_64")] X86_64, #[serde(rename = "arm")] ARM, #[serde(rename = "armv6h")] ARMV6H, #[serde(rename =...
(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { match *self { Arch::I686 => "i686".fmt(f), Arch::X86_64 => "x86_64".fmt(f), Arch::ARM => "arm".fmt(f), Arch::ARMV6H => "armv6h".fmt(f), Arch::ARMV7H => "armv7h".fmt(f), A...
fmt
identifier_name
isatty.rs
//! Helper module which provides a function to test //! if stdout is a tty. cfg_if::cfg_if! { if #[cfg(unix)] { pub fn stdout_isatty() -> bool { unsafe { libc::isatty(libc::STDOUT_FILENO)!= 0 } } } else if #[cfg(windows)] { pub fn stdout_isatty() -> bool { type D...
} } }
// FIXME: Implement isatty on SGX pub fn stdout_isatty() -> bool { false
random_line_split
specular_reflection.rs
//! Defines a BRDF that describes specular reflection use std::f32; use enum_set::EnumSet; use linalg::Vector; use film::Colorf; use bxdf::{self, BxDF, BxDFType}; use bxdf::fresnel::Fresnel; /// Specular reflection BRDF that implements a specularly reflective material model
fresnel: Box<Fresnel + Send + Sync> } impl SpecularReflection { /// Create a specularly reflective BRDF with the reflective color and Fresnel term pub fn new(c: &Colorf, fresnel: Box<Fresnel + Send + Sync>) -> SpecularReflection { SpecularReflection { reflectance: *c, fresnel: fresnel } } } im...
pub struct SpecularReflection { /// Color of the reflective material reflectance: Colorf, /// Fresnel term for the reflection model
random_line_split
specular_reflection.rs
//! Defines a BRDF that describes specular reflection use std::f32; use enum_set::EnumSet; use linalg::Vector; use film::Colorf; use bxdf::{self, BxDF, BxDFType}; use bxdf::fresnel::Fresnel; /// Specular reflection BRDF that implements a specularly reflective material model pub struct SpecularReflection { /// Co...
(c: &Colorf, fresnel: Box<Fresnel + Send + Sync>) -> SpecularReflection { SpecularReflection { reflectance: *c, fresnel: fresnel } } } impl BxDF for SpecularReflection { fn bxdf_type(&self) -> EnumSet<BxDFType> { let mut e = EnumSet::new(); e.insert(BxDFType::Specular); e.insert...
new
identifier_name
specular_reflection.rs
//! Defines a BRDF that describes specular reflection use std::f32; use enum_set::EnumSet; use linalg::Vector; use film::Colorf; use bxdf::{self, BxDF, BxDFType}; use bxdf::fresnel::Fresnel; /// Specular reflection BRDF that implements a specularly reflective material model pub struct SpecularReflection { /// Co...
else { (Colorf::black(), Vector::broadcast(0.0), 0.0) } } }
{ let w_i = Vector::new(-w_o.x, -w_o.y, w_o.z); let c = self.fresnel.fresnel(-bxdf::cos_theta(w_o)) * self.reflectance / f32::abs(bxdf::cos_theta(&w_i)); (c, w_i, 1.0) }
conditional_block
TestLog1p.rs
/* * Copyright (C) 2016 The Android Open Source Project * * 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 app...
* limitations under the License. */ // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh. #pragma version(1) #pragma rs java_package_name(android.renderscript.cts) float __attribute__((kernel)) testLog1pFloatFloat(float inV) { return log1p(inV); } float2 __attribute__((kernel)) tes...
* See the License for the specific language governing permissions and
random_line_split
request_response.rs
use ansi_term::Colour::*; use crate::{MismatchResult, display_result}; use pact_matching::models::RequestResponseInteraction; use pact_matching::Mismatch; pub fn display_request_response_result( errors: &mut Vec<(Option<String>, String, Option<MismatchResult>)>, interaction: &RequestResponseInteraction, match_re...
Red.paint("FAILED") } else { Green.paint("OK") }; let header_results = match interaction.response.headers { Some(ref h) => Some(h.iter().map(|(k, v)| { (k.clone(), v.join(", "), if mismatches.iter().any(|m| { match *m { Mism...
{ match match_result { Ok(id) => { display_result( interaction.response.status, Green.paint("OK"), interaction.response.headers.clone().map(|h| h.iter().map(|(k, v)| { (k.clone(), v.join(", "), Green.paint("OK")) }).collect()), Green.paint("OK") ); error...
identifier_body
request_response.rs
use ansi_term::Colour::*;
use crate::{MismatchResult, display_result}; use pact_matching::models::RequestResponseInteraction; use pact_matching::Mismatch; pub fn display_request_response_result( errors: &mut Vec<(Option<String>, String, Option<MismatchResult>)>, interaction: &RequestResponseInteraction, match_result: &Result<Option<Strin...
random_line_split
request_response.rs
use ansi_term::Colour::*; use crate::{MismatchResult, display_result}; use pact_matching::models::RequestResponseInteraction; use pact_matching::Mismatch; pub fn
( errors: &mut Vec<(Option<String>, String, Option<MismatchResult>)>, interaction: &RequestResponseInteraction, match_result: &Result<Option<String>, MismatchResult>, description: &String ) { match match_result { Ok(id) => { display_result( interaction.response.status, Green.paint("O...
display_request_response_result
identifier_name
unwind.rs
Handling in LLVM" (llvm.org/docs/ExceptionHandling.html) and //! documents linked from it. //! These are also good reads: //! http://theofilos.cs.columbia.edu/blog/2013/09/22/base_abi/ //! http://monoinfinito.wordpress.com/series/exception-handling-in-c/ //! http://www.airs.com/blog/index.php?s=exception+f...
// unwinding or otherwise exiting the thread cleanly. rterrln!("thread panicked while panicking. aborting."); unsafe { intrinsics::abort() } } PANICKING.with(|s| s.set(true)); rust_panic(msg); } /// Register a callback to be invoked when a thread unwinds. /// /// This is an unsafe a...
// perform the unwinding. if panicking() { // If a thread panics while it's already unwinding then we // have limited options. Currently our preference is to // just abort. In the future we may consider resuming
random_line_split
unwind.rs
LLVM" (llvm.org/docs/ExceptionHandling.html) and //! documents linked from it. //! These are also good reads: //! http://theofilos.cs.columbia.edu/blog/2013/09/22/base_abi/ //! http://monoinfinito.wordpress.com/series/exception-handling-in-c/ //! http://www.airs.com/blog/index.php?s=exception+frames //! //...
n => { let f: Callback = unsafe { mem::transmute(n) }; let (file, line) = *file_line; f(&*msg, file, line); } } }; // Now that we've run all the necessary unwind callbacks, we actually // perform the unwinding. if panicking...
{ // Make sure the default failure handler is registered before we look at the // callbacks. static INIT: Once = ONCE_INIT; INIT.call_once(|| unsafe { register(failure::on_fail); }); // First, invoke call the user-defined callbacks triggered on thread panic. // // By the time that we see a ...
identifier_body
unwind.rs
LLVM" (llvm.org/docs/ExceptionHandling.html) and //! documents linked from it. //! These are also good reads: //! http://theofilos.cs.columbia.edu/blog/2013/09/22/base_abi/ //! http://monoinfinito.wordpress.com/series/exception-handling-in-c/ //! http://www.airs.com/blog/index.php?s=exception+frames //! //...
} unsafe { _GCC_specific_handler(exceptionRecord, establisherFrame, contextRecord, dispatcherContext, inner) } } } #[cfg(not(test))] /// Entry point of panic from the libcore crate. #[lang = "panic_fmt"] pub e...
{ // cleanup phase uw::_URC_INSTALL_CONTEXT }
conditional_block
unwind.rs
LLVM" (llvm.org/docs/ExceptionHandling.html) and //! documents linked from it. //! These are also good reads: //! http://theofilos.cs.columbia.edu/blog/2013/09/22/base_abi/ //! http://monoinfinito.wordpress.com/series/exception-handling-in-c/ //! http://www.airs.com/blog/index.php?s=exception+frames //! //...
( version: c_int, actions: uw::_Unwind_Action, exception_class: uw::_Unwind_Exception_Class, ue_header: *mut uw::_Unwind_Exception, context: *mut uw::_Unwind_Context ) -> uw::_Unwind_Reason_Code { unsafe { __gcc_personality_sj0(version, actions, except...
rust_eh_personality
identifier_name
lib.rs
html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(collections)] #![feature(exit_status)] #![feature(set_stdio)] #![feature(libc)] #!...
{ // { // "schema": version, // "crate": { parsed crate ... }, // "plugins": { output of plugins ... } // } let mut json = std::collections::BTreeMap::new(); json.insert("schema".to_string(), Json::String(SCHEMA_VERSION.to_string())); let plugins_json = res.into_iter() ...
identifier_body
lib.rs
terms. // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "rustdoc"] #![unstable(feature = "rustdoc")] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-lo...
"FILES"), optmulti("", "html-after-content", "files to include inline between the content and </body> of a rendered \ Markdown file or generated documentation", "FILES"), optopt("", "markdown-playground-url", "URL to send...
"files to include inline between <body> and the content of a rendered \ Markdown file or generated documentation",
random_line_split
lib.rs
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "rustdoc"] #![unstable(feature = "rustdoc")] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x...
{ krate: clean::Crate, json_plugins: Vec<plugins::PluginJson>, passes: Vec<String>, } pub fn main() { const STACK_SIZE: usize = 32000000; // 32MB let res = std::thread::Builder::new().stack_size(STACK_SIZE).spawn(move || { let s = env::args().collect::<Vec<_>>(); main_args(&s) ...
Output
identifier_name
lib.rs
// Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364) #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "rustdoc"] #![unstable(feature = "rustdoc")] #![staged_api] #![crate_type = "dylib"] #![crate_type = "rlib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x...
Err(e) => panic!("failed to write json: {}", e), } } Some(s) => { println!("unknown output format: {}", s); return 1; } } return 0; } /// Looks inside the command line arguments to extract the relevant input format /// and files and ...
{}
conditional_block
subclass.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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
pub(super) fn create_subclass_fn_wrapper( sub: SubclassName, super_fn_name: &QualifiedName, fun: &FuncToConvert, ) -> Box<FuncToConvert> { let self_ty = Some(sub.cpp()); Box::new(FuncToConvert { synthesized_this_type: self_ty.clone(), self_ty, ident: super_fn_name.get_final...
{ let mut subclasses_per_superclass: HashMap<QualifiedName, Vec<SubclassName>> = HashMap::new(); for api in apis.iter() { if let Api::Subclass { name, superclass } = api { subclasses_per_superclass .entry(superclass.clone()) .or_default() .pus...
identifier_body
subclass.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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
( sub: SubclassName, super_fn_name: &QualifiedName, fun: &FuncToConvert, ) -> Box<FuncToConvert> { let self_ty = Some(sub.cpp()); Box::new(FuncToConvert { synthesized_this_type: self_ty.clone(), self_ty, ident: super_fn_name.get_final_ident(), doc_attr: fun.doc_attr.c...
create_subclass_fn_wrapper
identifier_name
subclass.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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
} else { panic!("Unexpected self type parameter when creating subclass constructor"); } let mut existing_params = existing_params.into_iter(); let self_param = existing_params.next(); let boxed_holder_param: FnArg = parse_quote! { peer: rust::Box<#holder> }; let inputs = sel...
{ panic!("Unexpected self type parameter when creating subclass constructor"); }
conditional_block
subclass.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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in w...
self_ty: Some(cpp), synthesis, is_deleted: fun.is_deleted, }); let subclass_constructor_name = ApiName::new_with_cpp_name( &Namespace::new(), subclass_constructor_name, Some(sub.cpp().get_final_item().to_string()), ); (maybe_wrap, subclass_constructor_name...
original_name: None, unused_template_param: fun.unused_template_param, references: fun.references.clone(), synthesized_this_type: Some(cpp.clone()),
random_line_split
pptypedef.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
{ let_in(3u, |i| { assert!(i == 3i); }); //~^ ERROR expected `uint`, found `int` let_in(3i, |i| { assert!(i == 3u); }); //~^ ERROR expected `int`, found `uint` }
identifier_body
pptypedef.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
() { let_in(3u, |i| { assert!(i == 3i); }); //~^ ERROR expected `uint`, found `int` let_in(3i, |i| { assert!(i == 3u); }); //~^ ERROR expected `int`, found `uint` }
main
identifier_name
pptypedef.rs
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
let_in(3i, |i| { assert!(i == 3u); }); //~^ ERROR expected `int`, found `uint` }
fn main() { let_in(3u, |i| { assert!(i == 3i); }); //~^ ERROR expected `uint`, found `int`
random_line_split
gecko.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! Specified types for legacy Gecko-only properties. use crate::parser::{Parse, ParserContext}; use crate::valu...
(pub Rect<LengthPercentage>); impl Parse for IntersectionObserverRootMargin { fn parse<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { let rect = Rect::parse_with(context, input, parse_pixel_or_percent)?; Ok(IntersectionObserverR...
IntersectionObserverRootMargin
identifier_name
gecko.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ //! Specified types for legacy Gecko-only properties. use crate::parser::{Parse, ParserContext}; use crate::valu...
pub struct IntersectionObserverRootMargin(pub Rect<LengthPercentage>); impl Parse for IntersectionObserverRootMargin { fn parse<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>> { let rect = Rect::parse_with(context, input, parse_pixel_or_pe...
#[repr(transparent)]
random_line_split
doc_comment.rs
use crate::comment::CommentStyle; use std::fmt::{self, Display}; /// Formats a string as a doc comment using the given [`CommentStyle`]. #[derive(new)] pub(super) struct DocCommentFormatter<'a> { literal: &'a str, style: CommentStyle<'a>, } impl Display for DocCommentFormatter<'_> { fn fmt(&self, formatte...
() { test_doc_comment_is_formatted_correctly( " Lorem ipsum", "/// Lorem ipsum", CommentStyle::TripleSlash, ); } #[test] fn single_line_doc_comment_is_formatted_correctly() { test_doc_comment_is_formatted_correctly( "Lorem ipsum"...
literal_controls_leading_spaces
identifier_name
doc_comment.rs
use crate::comment::CommentStyle; use std::fmt::{self, Display}; /// Formats a string as a doc comment using the given [`CommentStyle`]. #[derive(new)] pub(super) struct DocCommentFormatter<'a> { literal: &'a str, style: CommentStyle<'a>, } impl Display for DocCommentFormatter<'_> { fn fmt(&self, formatte...
else { writeln!(formatter, "{}{}", opener, line)?; } } Ok(()) } } #[cfg(test)] mod tests { use super::*; #[test] fn literal_controls_leading_spaces() { test_doc_comment_is_formatted_correctly( " Lorem ipsum", "/// Lorem...
{ write!(formatter, "{}{}", opener, line)?; }
conditional_block
doc_comment.rs
use crate::comment::CommentStyle; use std::fmt::{self, Display}; /// Formats a string as a doc comment using the given [`CommentStyle`]. #[derive(new)] pub(super) struct DocCommentFormatter<'a> { literal: &'a str, style: CommentStyle<'a>, } impl Display for DocCommentFormatter<'_> { fn fmt(&self, formatte...
write!(formatter, "{}{}", opener, line)?; } else { writeln!(formatter, "{}{}", opener, line)?; } } Ok(()) } } #[cfg(test)] mod tests { use super::*; #[test] fn literal_controls_leading_spaces() { test_doc_comment_is_format...
while let Some(line) = lines.next() { let is_last_line = lines.peek().is_none(); if is_last_line {
random_line_split
sha1.rs
use std::num::Wrapping; use byteorder::ByteOrder; use byteorder::ReadBytesExt; use byteorder::WriteBytesExt; use byteorder::BigEndian as BE; static K1: u32 = 0x5A827999u32; static K2: u32 = 0x6ED9EBA1u32; static K3: u32 = 0x8F1BBCDCu32; static K4: u32 = 0xCA62C1D6u32; #[inline] fn circular_shift(bits: u32, Wrapping(...
for _ in 0..(512 - (offset + 8)) / 8 + 56 { msg.push(0u8); } } msg.write_u64::<BE>(msg_bit_len as u64); for i in 0..(msg.len() * 8 / 512) { let mut w = [0u32; 80]; let part = &msg[i * 64..(i+1) * 64]; { let mut reader = &part[..]; ...
msg.push(128u8);
random_line_split
sha1.rs
use std::num::Wrapping; use byteorder::ByteOrder; use byteorder::ReadBytesExt; use byteorder::WriteBytesExt; use byteorder::BigEndian as BE; static K1: u32 = 0x5A827999u32; static K2: u32 = 0x6ED9EBA1u32; static K3: u32 = 0x8F1BBCDCu32; static K4: u32 = 0xCA62C1D6u32; #[inline] fn
(bits: u32, Wrapping(word): Wrapping<u32>) -> u32 { word << (bits as usize) | word >> ((32u32 - bits) as usize) } #[allow(unused_must_use)] pub fn sha1(message: &[u8]) -> Vec<u8> { let mut hash: [u32; 5] = [0x67452301, 0xEFCDAB89, 0x98BADCFE, ...
circular_shift
identifier_name
sha1.rs
use std::num::Wrapping; use byteorder::ByteOrder; use byteorder::ReadBytesExt; use byteorder::WriteBytesExt; use byteorder::BigEndian as BE; static K1: u32 = 0x5A827999u32; static K2: u32 = 0x6ED9EBA1u32; static K3: u32 = 0x8F1BBCDCu32; static K4: u32 = 0xCA62C1D6u32; #[inline] fn circular_shift(bits: u32, Wrapping(...
#[allow(unused_must_use)] pub fn sha1(message: &[u8]) -> Vec<u8> { let mut hash: [u32; 5] = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]; let mut msg = message.to_vec(); ...
{ word << (bits as usize) | word >> ((32u32 - bits) as usize) }
identifier_body
sha1.rs
use std::num::Wrapping; use byteorder::ByteOrder; use byteorder::ReadBytesExt; use byteorder::WriteBytesExt; use byteorder::BigEndian as BE; static K1: u32 = 0x5A827999u32; static K2: u32 = 0x6ED9EBA1u32; static K3: u32 = 0x8F1BBCDCu32; static K4: u32 = 0xCA62C1D6u32; #[inline] fn circular_shift(bits: u32, Wrapping(...
else if offset >= 448 { msg.push(128u8); for _ in 0..(512 - (offset + 8)) / 8 + 56 { msg.push(0u8); } } msg.write_u64::<BE>(msg_bit_len as u64); for i in 0..(msg.len() * 8 / 512) { let mut w = [0u32; 80]; let part = &msg[i * 64..(i+1) * 64]; { ...
{ msg.push(128u8); for _ in 0..(448 - (offset + 8)) / 8 { msg.push(0u8); } }
conditional_block
main.rs
use std::default::Default; extern crate time; extern crate ansi_term; use ansi_term::Colour::{Red, Green, Yellow, Blue, Purple, Cyan}; extern crate mysql; use mysql::conn::MyOpts; use mysql::conn::pool::MyPool; use mysql::value::from_row; use std::collections::BTreeMap; pub mod error; use self::error::Error; pub ...
println!("--- END ---"); println!("\n--- {} ---", Yellow.bold().paint("JSON encode decode").to_string()); let json_str = "{\"code\":0,\"message\":\"OK\",\"data\":{\"keyword\":\"Rust, api, php, nginx\"},\"ip\":[\"192.168.0.168\",\"127.0.0.1\"]}"; println!("json_str: {}", Blue.paint(json_str.to_string())...
{ println!("--- {} ---", Red //.blink() .bold().paint("Test error Model").to_string()); let code = Error::get_code(&Error::Success); let message = Error::get_message(&Error::Success); println!("{{\"code\": {},\"message\":{:?}}}", code, message); println!("--- END ---"); pri...
identifier_body
main.rs
use std::default::Default; extern crate time; extern crate ansi_term; use ansi_term::Colour::{Red, Green, Yellow, Blue, Purple, Cyan}; extern crate mysql; use mysql::conn::MyOpts; use mysql::conn::pool::MyPool; use mysql::value::from_row; use std::collections::BTreeMap; pub mod error; use self::error::Error; pub ...
id: id, nickname: nickname, mobile: mobile, email: email, } }).collect() // Collect payments so now `QueryResult` is mapped to `Vec<T>` }).unwrap(); // Unwrap `Vec<T>` for ...
random_line_split
main.rs
use std::default::Default; extern crate time; extern crate ansi_term; use ansi_term::Colour::{Red, Green, Yellow, Blue, Purple, Cyan}; extern crate mysql; use mysql::conn::MyOpts; use mysql::conn::pool::MyPool; use mysql::value::from_row; use std::collections::BTreeMap; pub mod error; use self::error::Error; pub ...
}
bold().paint("SELECT")); let selected: Vec<model::user::UserModel> = pool.prep_exec("SELECT id, nickname, mobile, email FROM test.user", ()) .map(|result| { // In this closure we sill map `QueryResult` to `Vec<T>` // `QueryResult` is iterator over `MyResult<row, err>` so first call t...
conditional_block
main.rs
use std::default::Default; extern crate time; extern crate ansi_term; use ansi_term::Colour::{Red, Green, Yellow, Blue, Purple, Cyan}; extern crate mysql; use mysql::conn::MyOpts; use mysql::conn::pool::MyPool; use mysql::value::from_row; use std::collections::BTreeMap; pub mod error; use self::error::Error; pub ...
() { println!("--- {} ---", Red //.blink() .bold().paint("Test error Model").to_string()); let code = Error::get_code(&Error::Success); let message = Error::get_message(&Error::Success); println!("{{\"code\": {},\"message\":{:?}}}", code, message); println!("--- END ---"); p...
main
identifier_name
storageevent.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::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::StorageEve...
// https://html.spec.whatwg.org/multipage/#dom-storageevent-url fn Url(&self) -> DOMString { self.url.clone() } // https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea fn GetStorageArea(&self) -> Option<DomRoot<Storage>> { self.storage_area.get() } // http...
{ self.new_value.clone() }
identifier_body
storageevent.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::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::StorageEve...
(&self) -> Option<DOMString> { self.key.clone() } // https://html.spec.whatwg.org/multipage/#dom-storageevent-oldvalue fn GetOldValue(&self) -> Option<DOMString> { self.old_value.clone() } // https://html.spec.whatwg.org/multipage/#dom-storageevent-newvalue fn GetNewValue(&self...
GetKey
identifier_name
storageevent.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::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::StorageEve...
old_value: Option<DOMString>, new_value: Option<DOMString>, url: DOMString, storage_area: MutNullableDom<Storage> } impl StorageEvent { pub fn new_inherited(key: Option<DOMString>, old_value: Option<DOMString>, new_value: Option<DOMString>, ...
#[dom_struct] pub struct StorageEvent { event: Event, key: Option<DOMString>,
random_line_split
complexobject.rs
use libc::{c_double, c_int}; use pyport::Py_ssize_t; use object::*; #[repr(C)] #[derive(Copy, Clone)] pub struct Py_complex { pub real: c_double, pub imag: c_double } extern "C" { pub fn _Py_c_sum(left: Py_complex, right: Py_complex) -> Py_complex; pub fn _Py_c_diff(left: Py_complex, right: Py_complex...
// format_spec_len: Py_ssize_t) // -> *mut PyObject; }
//fn _PyComplex_FormatAdvanced(obj: *mut PyObject, // format_spec: *mut c_char,
random_line_split
complexobject.rs
use libc::{c_double, c_int}; use pyport::Py_ssize_t; use object::*; #[repr(C)] #[derive(Copy, Clone)] pub struct Py_complex { pub real: c_double, pub imag: c_double } extern "C" { pub fn _Py_c_sum(left: Py_complex, right: Py_complex) -> Py_complex; pub fn _Py_c_diff(left: Py_complex, right: Py_complex...
(op : *mut PyObject) -> c_int { let u : *mut PyTypeObject = &mut PyComplex_Type; (Py_TYPE(op) == u) as c_int } extern "C" { pub fn PyComplex_FromCComplex(v: Py_complex) -> *mut PyObject; pub fn PyComplex_FromDoubles(real: c_double, imag: c_double) -> *mut PyObject; ...
PyComplex_CheckExact
identifier_name
complexobject.rs
use libc::{c_double, c_int}; use pyport::Py_ssize_t; use object::*; #[repr(C)] #[derive(Copy, Clone)] pub struct Py_complex { pub real: c_double, pub imag: c_double } extern "C" { pub fn _Py_c_sum(left: Py_complex, right: Py_complex) -> Py_complex; pub fn _Py_c_diff(left: Py_complex, right: Py_complex...
#[inline(always)] pub unsafe fn PyComplex_CheckExact(op : *mut PyObject) -> c_int { let u : *mut PyTypeObject = &mut PyComplex_Type; (Py_TYPE(op) == u) as c_int } extern "C" { pub fn PyComplex_FromCComplex(v: Py_complex) -> *mut PyObject; pub fn PyComplex_FromDoubles(real: c_double, ...
{ PyObject_TypeCheck(op, &mut PyComplex_Type) }
identifier_body
app.rs
// Robigo Luculenta -- Proof of concept spectral path tracer in Rust // Copyright (C) 2014-2015 Ruud van Asseldonk // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by
// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License ...
// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version.
random_line_split
app.rs
// Robigo Luculenta -- Proof of concept spectral path tracer in Rust // Copyright (C) 2014-2015 Ruud van Asseldonk // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the L...
fn execute_task(task: &mut Task, scene: &Scene, img_tx: &mut Sender<Image>) { match *task { Task::Sleep => App::execute_sleep_task(), Task::Trace(ref mut trace_unit) => App::execute_trace_task(scene, trace_unit), Task::Plot(ref mut plot_u...
{ thread::spawn(move || { // Move img_tx into the proc. let mut owned_img_tx = img_tx; // There is no task yet, but the task scheduler expects // a completed task. Therefore, this worker is done sleeping. let mut task = Task::Sleep; // Co...
identifier_body
app.rs
// Robigo Luculenta -- Proof of concept spectral path tracer in Rust // Copyright (C) 2014-2015 Ruud van Asseldonk // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the L...
(plot_unit: &mut PlotUnit, units: &mut[Box<TraceUnit>]) { for unit in units { plot_unit.plot(&unit.mapped_photons); } } fn execute_gather_task(gather_unit: &mut GatherUnit, units: &mut[Box<PlotUnit>]) { for unit in units { ...
execute_plot_task
identifier_name
helical_joint.rs
use na::{self, DVectorSliceMut, Isometry3, RealField, Translation3, Unit, Vector3}; use crate::joint::{Joint, JointMotor, RevoluteJoint, UnitJoint}; use crate::math::{JacobianSliceMut, Velocity}; use crate::object::{BodyPartHandle, Multibody, MultibodyLink}; use crate::solver::{ConstraintSet, GenericNonlinearConstrain...
/// The rotational displacement along the joint axis. pub fn angle(&self) -> N { self.revo.angle() } } impl<N: RealField> Joint<N> for HelicalJoint<N> { #[inline] fn ndofs(&self) -> usize { 1 } fn body_to_parent(&self, parent_shift: &Vector3<N>, body_shift: &Vector3<N>) ->...
random_line_split
helical_joint.rs
use na::{self, DVectorSliceMut, Isometry3, RealField, Translation3, Unit, Vector3}; use crate::joint::{Joint, JointMotor, RevoluteJoint, UnitJoint}; use crate::math::{JacobianSliceMut, Velocity}; use crate::object::{BodyPartHandle, Multibody, MultibodyLink}; use crate::solver::{ConstraintSet, GenericNonlinearConstrain...
(&self) -> usize { // NOTE: we don't test if constraints exist to simplify indexing. 1 } fn position_constraint( &self, _: usize, multibody: &Multibody<N>, link: &MultibodyLink<N>, handle: BodyPartHandle<()>, dof_id: usize, jacobians: &mut...
num_position_constraints
identifier_name
helical_joint.rs
use na::{self, DVectorSliceMut, Isometry3, RealField, Translation3, Unit, Vector3}; use crate::joint::{Joint, JointMotor, RevoluteJoint, UnitJoint}; use crate::math::{JacobianSliceMut, Velocity}; use crate::object::{BodyPartHandle, Multibody, MultibodyLink}; use crate::solver::{ConstraintSet, GenericNonlinearConstrain...
fn default_damping(&self, out: &mut DVectorSliceMut<N>) { out.fill(na::convert(0.1f64)) } fn integrate(&mut self, parameters: &IntegrationParameters<N>, vels: &[N]) { self.revo.integrate(parameters, vels) } fn apply_displacement(&mut self, disp: &[N]) { self.revo.apply_di...
{ self.revo.jacobian_dot_mul_coordinates(vels) }
identifier_body
command.rs
use std::path::Path; pub struct Command { path: String, origin: String, destination: String, } #[derive(Debug)] pub enum CommandParseError { InvalidArgCount, InvalidPath, } impl Command { pub fn from_args<I: IntoIterator<Item = String>>(args: I) -> Result<Command, CommandParseError> { ...
(&self) -> &str { &self.destination } } fn read_path<T>(path: Option<T>) -> Result<String, CommandParseError> where T: AsRef<Path> + Into<String> { match path { None => Err(CommandParseError::InvalidArgCount), Some(path) => if path.as_ref().exists() { Ok(path.into()) ...
destination
identifier_name
command.rs
use std::path::Path; pub struct Command { path: String,
#[derive(Debug)] pub enum CommandParseError { InvalidArgCount, InvalidPath, } impl Command { pub fn from_args<I: IntoIterator<Item = String>>(args: I) -> Result<Command, CommandParseError> { let mut args = args.into_iter(); Ok(Command { path: try!(read_path(args.next())), ...
origin: String, destination: String, }
random_line_split
command.rs
use std::path::Path; pub struct Command { path: String, origin: String, destination: String, } #[derive(Debug)] pub enum CommandParseError { InvalidArgCount, InvalidPath, } impl Command { pub fn from_args<I: IntoIterator<Item = String>>(args: I) -> Result<Command, CommandParseError> { ...
pub fn destination(&self) -> &str { &self.destination } } fn read_path<T>(path: Option<T>) -> Result<String, CommandParseError> where T: AsRef<Path> + Into<String> { match path { None => Err(CommandParseError::InvalidArgCount), Some(path) => if path.as_ref().exists() { ...
{ &self.origin }
identifier_body
issue-15149.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 ...
{ // If we're the parent, copy our own binary to a tempr directory, and then // make it executable. let dir = TempDir::new("mytest").unwrap(); let me = os::self_exe_name().unwrap(); let dest = dir.path().join(format!("mytest{}", os::consts::EXE_SUFFIX)); fs::copy(&me, &dest).unwrap(); // Ap...
identifier_body
issue-15149.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 ...
test(); let (tx, rx) = channel(); TaskBuilder::new().native().spawn(proc() { tx.send(test()); }); rx.recv(); } fn test() { // If we're the parent, copy our own binary to a tempr directory, and then // make it executable. let dir = TempDir::new("mytest").unwrap(); let me = ...
{ return assert_eq!(args.get(0).as_slice(), "mytest"); }
conditional_block
issue-15149.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 ...
() { // If we're the parent, copy our own binary to a tempr directory, and then // make it executable. let dir = TempDir::new("mytest").unwrap(); let me = os::self_exe_name().unwrap(); let dest = dir.path().join(format!("mytest{}", os::consts::EXE_SUFFIX)); fs::copy(&me, &dest).unwrap(); //...
test
identifier_name
issue-15149.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 ...
} fn test() { // If we're the parent, copy our own binary to a tempr directory, and then // make it executable. let dir = TempDir::new("mytest").unwrap(); let me = os::self_exe_name().unwrap(); let dest = dir.path().join(format!("mytest{}", os::consts::EXE_SUFFIX)); fs::copy(&me, &dest).unwrap(...
rx.recv();
random_line_split
validitystate.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::ValidityStateBinding; use dom::bindings::global::Window; use dom::bindings::...
<'a>(&'a self) -> &'a Reflector { &self.reflector_ } }
reflector
identifier_name
validitystate.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::ValidityStateBinding; use dom::bindings::global::Window; use dom::bindings::...
state: u8, } impl ValidityState { pub fn new_inherited() -> ValidityState { ValidityState { reflector_: Reflector::new(), state: 0, } } pub fn new(window: JSRef<Window>) -> Temporary<ValidityState> { reflect_dom_object(box ValidityState::new_inherited(),...
reflector_: Reflector,
random_line_split
validitystate.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::ValidityStateBinding; use dom::bindings::global::Window; use dom::bindings::...
pub fn new(window: JSRef<Window>) -> Temporary<ValidityState> { reflect_dom_object(box ValidityState::new_inherited(), &Window(window), ValidityStateBinding::Wrap) } } impl Reflectable for ValidityState { fn reflector<'a>(&'a self) -> &'a Refl...
{ ValidityState { reflector_: Reflector::new(), state: 0, } }
identifier_body
pull.rs
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
{ pub server: Server, } impl Pull { /// Create a new Pull pub fn new(server: Server) -> Pull { Pull { server: server } } /// Run this thread. Creates a socket, binds to the `gossip_addr`, then processes messages as /// they are received. Uses a ZMQ pull socket, so inbound messages are...
Pull
identifier_name
pull.rs
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
} Rumor_Type::ServiceConfig => { self.server.insert_service_config(proto.into()); } Rumor_Type::ServiceFile => { self.server.insert_service_file(proto.into()); } Rumor_Type::Election =...
let health = proto.mut_member().get_health().into(); self.server.insert_member_from_rumor(member, health); } Rumor_Type::Service => { self.server.insert_service(proto.into());
random_line_split
pull.rs
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
trace_it!(GOSSIP: &self.server, TraceKind::RecvRumor, proto.get_from_id(), &proto); match proto.get_field_type() { Rumor_Type::Member => { let member = proto.mut_member().take_member().into(); let health = proto.mut_member().get_health().i...
{ warn!( "Not processing message from {} - it is blacklisted", proto.get_from_id() ); continue 'recv; }
conditional_block
mod.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 ...
#[deriving(Encodable, Decodable)] pub struct method_param { // the trait containing the method to be invoked trait_id: ast::def_id, // index of the method to be invoked amongst the trait's methods method_num: uint, // index of the type parameter (from those that are in scope) that is // the ty...
} // details for a method invoked with a receiver whose type is a type parameter // with a bounded trait.
random_line_split
mod.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 ...
Some(i) => { l_tcx = i.tcx; l_infcx = i; } } match infer::mk_eqty(l_infcx, t1_is_expected, infer::Misc(span), t1, t2) { result::Ok(()) => true, result::Err(ref terr) => { l_tcx.sess.span_err(span, msg() + ": " + ty::type_e...
{ l_tcx = tcx; l_infcx = infer::new_infer_ctxt(tcx); }
conditional_block
mod.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 ...
ty::note_and_explain_type_err(l_tcx, terr); false } } } // a list of mapping from in-scope-region-names ("isr") to the // corresponding ty::Region pub type isr_alist = @List<(ty::bound_region, ty::Region)>; trait get_and_find_region { fn get(&self, br: ty::bound_region) -> ty:...
{ let l_tcx; let l_infcx; match maybe_infcx { None => { l_tcx = tcx; l_infcx = infer::new_infer_ctxt(tcx); } Some(i) => { l_tcx = i.tcx; l_infcx = i; } } match infer::mk_eqty(l_infcx, t1_is_expected, infer::Misc(span), t1, t2) { resul...
identifier_body
mod.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 ...
{ // supertrait method invoked on "self" inside a default method // first field is supertrait ID; // second field is method index (relative to the *supertrait* // method list) method_super(ast::def_id, uint), // fully statically resolved method method_static(ast::def_id), // method in...
method_origin
identifier_name
tar.rs
use std::mem; use misc::*; #[ repr (C) ] struct BinaryHeader { name: [u8; 100], mode: [u8; 8], uid: [u8; 8], gid: [u8; 8], size: [u8; 12], mtime: [u8; 12], cksum: [u8; 8], typeflag: [u8; 1], linkname: [u8; 100], magic: [u8; 6], version: [u8; 2], uname: [u8; 32], gname: [u8; 32], dev_major: [u8; 8], de...
) -> Type { match typeflag [0] { b'0' => Type::Regular, b'1' => Type::Link, b'2' => Type::SymbolicLink, b'3' => Type::CharacterSpecial, b'4' => Type::BlockSpecial, b'5' => Type::Directory, b'6' => Type::Fifo, b'K' => Type::LongLink, b'L' => Type::LongName, _ => { panic! ( "Unrecognised ...
} fn tar_type ( typeflag: & [u8; 1],
random_line_split
tar.rs
use std::mem; use misc::*; #[ repr (C) ] struct BinaryHeader { name: [u8; 100], mode: [u8; 8], uid: [u8; 8], gid: [u8; 8], size: [u8; 12], mtime: [u8; 12], cksum: [u8; 8], typeflag: [u8; 1], linkname: [u8; 100], magic: [u8; 6], version: [u8; 2], uname: [u8; 32], gname: [u8; 32], dev_major: [u8; 8], de...
( slice: & [u8], ) -> Result <u64, TfError> { if slice [0] == 0 { Ok (0) } else if slice [0] == 0x80 { Ok (u64::from_be ( unsafe { * mem::transmute::<& u8, & u64> ( & slice [4]) } )) } else if slice [0] == 0xff { panic! () } else { let string = try! ( String::from_utf8 ( ...
tar_number_u64
identifier_name
tar.rs
use std::mem; use misc::*; #[ repr (C) ] struct BinaryHeader { name: [u8; 100], mode: [u8; 8], uid: [u8; 8], gid: [u8; 8], size: [u8; 12], mtime: [u8; 12], cksum: [u8; 8], typeflag: [u8; 1], linkname: [u8; 100], magic: [u8; 6], version: [u8; 2], uname: [u8; 32], gname: [u8; 32], dev_major: [u8; 8], de...
} else if binary_header.version!= * b" \0" { Err (TfError { error_message: format! ( "Unrecognised gnu tar version: {:?}", binary_header.version), }) } else { let size = try! ( tar_number_u64 ( & binary_header.size)); Ok (Header { name: tar_string ( & binary_...
{ if header_bytes.len () != 512 { panic! (); } let binary_header = unsafe { mem::transmute::<& u8, & BinaryHeader> ( & header_bytes [0]) }; if binary_header.magic != * b"ustar " { Err (TfError { error_message: format! ( "Unrecognised tar format: {:?} {:?}", binary_header.m...
identifier_body
repo_commit.rs
use rusqlite::{SqliteConnection,SqliteResult,SqliteRow}; use schemamama_rusqlite::{SqliteMigration}; use std::str::FromStr; use result::*; #[derive(Debug,Copy,Clone)] pub enum CommitState { Indexed, NotIndexed, } impl FromStr for CommitState { type Err = RepoError; fn from_str(s: &str) -> Result<Commi...
id: row0.get(0), repo_id: row0.get(1), state: try!(CommitState::from_str(&commit_state)), }) } } pub struct CreateCommitsTable; migration!(CreateCommitsTable, 3, "create commits table"); impl SqliteMigration for CreateCommitsTable { fn up(&self, conn: &SqliteConnect...
pub fn new_from_sql_row(row0: &SqliteRow) -> RepoResult<RepoCommit> { let commit_state: String = row0.get(2); Ok(RepoCommit {
random_line_split
repo_commit.rs
use rusqlite::{SqliteConnection,SqliteResult,SqliteRow}; use schemamama_rusqlite::{SqliteMigration}; use std::str::FromStr; use result::*; #[derive(Debug,Copy,Clone)] pub enum CommitState { Indexed, NotIndexed, } impl FromStr for CommitState { type Err = RepoError; fn from_str(s: &str) -> Result<Commi...
(&self) -> String { match *self { CommitState::Indexed => "Indexed".to_string(), CommitState::NotIndexed => "NotIndexed".to_string(), } } } #[derive(Debug,Clone)] pub struct RepoCommit { pub id: String, pub repo_id: String, pub state: CommitState, } impl RepoCom...
to_string
identifier_name