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
unsound_collection_transmute.rs
use super::utils::is_layout_incompatible; use super::UNSOUND_COLLECTION_TRANSMUTE; use clippy_utils::diagnostics::span_lint; use clippy_utils::match_any_diagnostic_items; use rustc_hir::Expr; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; use rustc_span::symbol::{sym, Symbol}; // used to check for UNSO...
true } else { false } }, _ => false, } }
{ match (&from_ty.kind(), &to_ty.kind()) { (ty::Adt(from_adt, from_substs), ty::Adt(to_adt, to_substs)) => { if from_adt.did != to_adt.did || match_any_diagnostic_items(cx, to_adt.did, COLLECTIONS).is_none() { return false; } if from_substs ...
identifier_body
unsound_collection_transmute.rs
use super::utils::is_layout_incompatible; use super::UNSOUND_COLLECTION_TRANSMUTE; use clippy_utils::diagnostics::span_lint; use clippy_utils::match_any_diagnostic_items; use rustc_hir::Expr; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; use rustc_span::symbol::{sym, Symbol}; // used to check for UNSO...
.zip(to_substs.types()) .any(|(from_ty, to_ty)| is_layout_incompatible(cx, from_ty, to_ty)) { span_lint( cx, UNSOUND_COLLECTION_TRANSMUTE, e.span, &format!( "...
if from_substs .types()
random_line_split
unsound_collection_transmute.rs
use super::utils::is_layout_incompatible; use super::UNSOUND_COLLECTION_TRANSMUTE; use clippy_utils::diagnostics::span_lint; use clippy_utils::match_any_diagnostic_items; use rustc_hir::Expr; use rustc_lint::LateContext; use rustc_middle::ty::{self, Ty}; use rustc_span::symbol::{sym, Symbol}; // used to check for UNSO...
<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>, to_ty: Ty<'tcx>) -> bool { match (&from_ty.kind(), &to_ty.kind()) { (ty::Adt(from_adt, from_substs), ty::Adt(to_adt, to_substs)) => { if from_adt.did!= to_adt.did || match_any_diagnostic_items(cx, to_adt.did, COLLECTIONS).is_no...
check
identifier_name
libbuild.rs
#[allow(dead_code)] const VERSION_ENVVAR: &'static str = "PLAN_VERSION"; #[allow(dead_code)] mod builder { use std::env; use std::process::Command; use super::VERSION_ENVVAR; pub fn common() { super::version::write_file(version()); } pub fn version() -> String { match env::va...
.expect("Failed to read line from version file"); ver } } #[allow(dead_code)] mod util { use std::env; use std::fs::File; use std::io::Write; use std::path::Path; pub fn write_out_dir_file<P, S>(filename: P, content: S) where P: AsRef<Path>, S: AsRef<str>...
let f = File::open(ver_file).expect("Failed to open version file"); let mut reader = BufReader::new(f); let mut ver = String::new(); reader .read_line(&mut ver)
random_line_split
libbuild.rs
#[allow(dead_code)] const VERSION_ENVVAR: &'static str = "PLAN_VERSION"; #[allow(dead_code)] mod builder { use std::env; use std::process::Command; use super::VERSION_ENVVAR; pub fn common() { super::version::write_file(version()); } pub fn version() -> String { match env::va...
}
{ super::util::write_out_dir_file("VERSION", version); }
identifier_body
libbuild.rs
#[allow(dead_code)] const VERSION_ENVVAR: &'static str = "PLAN_VERSION"; #[allow(dead_code)] mod builder { use std::env; use std::process::Command; use super::VERSION_ENVVAR; pub fn common() { super::version::write_file(version()); } pub fn version() -> String { match env::va...
<S: AsRef<str>>(version: S) { super::util::write_out_dir_file("VERSION", version); } }
write_file
identifier_name
varlink_grammar.rs
pub use grammar::*; peg::parser! { grammar grammar() for str { /* Modeled after ECMA-262, 5th ed., 7.2. */ rule whitespace() -> &'input str = quiet!{$([''| '\t' | '\u{00A0}' | '\u{FEFF}' | '\u{1680}' | '\u{180E}' | '\u{2000}'..='\u{200A}' | '\u{202F}' | '\u{205F}' | '\u{3000}' ])} ...
use crate::trim_doc; rule vtypedef() -> Typedef<'input> = d:$(wce()*) "type" wce()+ n:$(name()) wce()* v:vstruct() { Typedef{name: n, doc: trim_doc(d), elt: VStructOrEnum::VStruct(Box::new(v))} } / d:$(wce()*) "type" wce()+ n:$(name()) wce()* v:venum(...
use crate::Typedef; use crate::VStructOrEnum;
random_line_split
hrtb-parse.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 foo11(t: Box<for<'a> Get(int) -> int>) { } fn foo20(t: for<'a> fn(int) -> int) { } fn foo21(t: for<'a> unsafe fn(int) -> int) { } fn foo22(t: for<'a> extern "C" fn(int) -> int) { } fn foo23(t: for<'a> unsafe extern "C" fn(int) -> int) { } fn foo30(t: for<'a> |int| -> int) { } fn foo31(t: for<'a> unsafe |int| -> i...
{ }
identifier_body
hrtb-parse.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 ...
<T: for<'a> Get<&'a int, &'a int>>(t: T) { } // Parse HRTB with explicit `for` in various sorts of types: fn foo10(t: Box<for<'a> Get<int, int>>) { } fn foo11(t: Box<for<'a> Get(int) -> int>) { } fn foo20(t: for<'a> fn(int) -> int) { } fn foo21(t: for<'a> unsafe fn(int) -> int) { } fn foo22(t: for<'a> extern "C" fn(...
foo01
identifier_name
hrtb-parse.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 foo00<T>(t: T) where T : for<'a> Get<&'a int, &'a int> { } fn foo01<T: for<'a> Get<&'a int, &'a int>>(t: T) { } // Parse HRTB with explicit `for` in various sorts of types: fn foo10(t: Box<for<'a> Get<int, int>>) { } fn foo11(t: Box<for<'a> Get(int) -> int>) { } fn foo20(t: for<'a> fn(int) -> int) { } fn fo...
trait Get<A,R> { fn get(&self, arg: A) -> R; } // Parse HRTB with explicit `for` in a where-clause:
random_line_split
logger.rs
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use crate::PythonLogLevel; use std::collections::HashMap; use std::convert::TryInto; use std::fmt::Write as FmtWrite; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path:...
(&self) {} }
flush
identifier_name
logger.rs
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use crate::PythonLogLevel; use std::collections::HashMap; use std::convert::TryInto; use std::fmt::Write as FmtWrite; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path:...
// Attempt to write to stdio, and write to the pantsd log if we fail (either because we don't // have a valid stdio instance, or because of an error). if destination.write_stderr_raw(log_bytes).is_err() { let mut maybe_file = inner.log_file.lock(); if let Some(ref mut file) = *maybe_file { ...
}
random_line_split
logger.rs
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). use crate::PythonLogLevel; use std::collections::HashMap; use std::convert::TryInto; use std::fmt::Write as FmtWrite; use std::fs::{File, OpenOptions}; use std::io::Write; use std::path:...
; writeln!(log_string, " {}", log_msg).unwrap(); log_string }; let log_bytes = log_string.as_bytes(); { let mut maybe_per_run_file = inner.per_run_logs.lock(); if let Some(ref mut file) = *maybe_per_run_file { // deliberately ignore errors writing to per-run log file ...
{ write!(log_string, " ({})", record.target()).unwrap(); }
conditional_block
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
// let color = shoot_ray(&state, ray); // scene.canvas().set_pixel(x, y, color); } // Increment future } } fn shoot_ray(state: &mut RenderState, ray: Ray) { // -> TColor { if state.recursion_level == 0 { // return black } { state.r...
{ // Precalculate bouding box transformations, etc let RenderPayload { scene, .. } = payload; // Iterate through each pixel let (width, height) = (512, 512); // let (width, height) = scene.canvas_dimensions(); // let (region_x, region_y) = scene.region_position(); ...
identifier_body
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
{ None, Uniform(i32), Random(i32) } pub struct RenderConfig { pub scene_name: &'static str, // Input scene dir pub output_name: &'static str, // Output file name pub width: u32, // Width of final image pub height: u32, // He...
SampleMode
identifier_name
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
{ state.recursion_level -= 1; } /* let intersection = { // let bvh = &state.bvh; // bvh.intersection(ray) }; if let Some(intersection) = intersection { // Found an intersection } */ // TColor::from_channels(0.0, 0.0, 0.0, ...
{ // return black }
conditional_block
lib.rs
// @Author: Cha Dowon <dowon> // @Date: 2016-11-20T11:01:12-05:00 // @Project: BeAM // @Filename: lib.rs // @Last modified by: dowon // @Last modified time: 2016-11-20T11:03:21-05:00 #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] #[macro_use] extern crate error_chain; extern crate log;...
} // Increment future } } fn shoot_ray(state: &mut RenderState, ray: Ray) { // -> TColor { if state.recursion_level == 0 { // return black } { state.recursion_level -= 1; } /* let intersection = { // let bvh = &state.bvh; /...
random_line_split
checkout.rs
use crate::{Command, CommandBoxClone, WorkOption, WorkResult}; use color_printer::{Color, ColorPrinter, ColorSpec}; use command_derive::CommandBoxClone; use gitlib::GitRepo; use std::{io::Write, path::PathBuf}; #[derive(Clone, CommandBoxClone)] pub struct CheckoutCommand { branch: String, } impl CheckoutCommand {...
(branch: String) -> Self { Self { branch } } } struct CheckoutCommandResult { branch: String, path: PathBuf, } impl Command for CheckoutCommand { fn process(&self, repo: GitRepo) -> WorkOption { if let Ok(true) = repo.checkout(&self.branch) { let result = CheckoutCommandRes...
new
identifier_name
checkout.rs
use crate::{Command, CommandBoxClone, WorkOption, WorkResult}; use color_printer::{Color, ColorPrinter, ColorSpec}; use command_derive::CommandBoxClone;
branch: String, } impl CheckoutCommand { pub fn new(branch: String) -> Self { Self { branch } } } struct CheckoutCommandResult { branch: String, path: PathBuf, } impl Command for CheckoutCommand { fn process(&self, repo: GitRepo) -> WorkOption { if let Ok(true) = repo.checkout...
use gitlib::GitRepo; use std::{io::Write, path::PathBuf}; #[derive(Clone, CommandBoxClone)] pub struct CheckoutCommand {
random_line_split
checkout.rs
use crate::{Command, CommandBoxClone, WorkOption, WorkResult}; use color_printer::{Color, ColorPrinter, ColorSpec}; use command_derive::CommandBoxClone; use gitlib::GitRepo; use std::{io::Write, path::PathBuf}; #[derive(Clone, CommandBoxClone)] pub struct CheckoutCommand { branch: String, } impl CheckoutCommand {...
else { None } } } impl WorkResult for CheckoutCommandResult { fn print(&self, printer: &mut ColorPrinter<'_>) { let mut cs = ColorSpec::new(); cs.set_intense(true); cs.set_fg(Some(Color::Yellow)); printer.color_context(&cs, |h| write!(h, " {}", self.branch)...
{ let result = CheckoutCommandResult { path: repo.path().into(), branch: self.branch.clone(), }; Some(Box::new(result)) }
conditional_block
dst-bad-assign-2.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 ...
(&self) -> isize { self.f } } pub fn main() { // Assignment. let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box<ToBar> = Box::new(Bar1 {f: 36}); f5.ptr = *z; //~^ ERROR t...
to_val
identifier_name
dst-bad-assign-2.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 to_val(&self) -> isize { self.f } } pub fn main() { // Assignment. let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box<ToBar> = Box::new(Bar1 {f: 36}); f5.ptr = *z; ...
{ Bar }
identifier_body
dst-bad-assign-2.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 ...
Bar } fn to_val(&self) -> isize { self.f } } pub fn main() { // Assignment. let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let z: Box<ToBar> = Box::new(Bar1 {f: 36}); ...
fn to_val(&self) -> isize; } impl ToBar for Bar1 { fn to_bar(&self) -> Bar {
random_line_split
content_type.rs
use mime::Mime; header! { /// `Content-Type` header, defined in /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-3.1.1.5) /// /// The `Content-Type` header field indicates the media type of the /// associated representation: either the representation enclosed in the /// message payload ...
/// /// let mut headers = Headers::new(); /// /// headers.set( /// ContentType(Mime(TopLevel::Text, SubLevel::Html, vec![])) /// ); /// ``` /// ``` /// use hyper::header::{Headers, ContentType}; /// use hyper::mime::{Mime, TopLevel, SubLevel, Attr, Value}; /// /// let...
/// ``` /// use hyper::header::{Headers, ContentType}; /// use hyper::mime::{Mime, TopLevel, SubLevel};
random_line_split
content_type.rs
use mime::Mime; header! { /// `Content-Type` header, defined in /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-3.1.1.5) /// /// The `Content-Type` header field indicates the media type of the /// associated representation: either the representation enclosed in the /// message payload ...
/// A constructor to easily create a `Content-Type: application/www-form-url-encoded` header. #[inline] pub fn form_url_encoded() -> ContentType { ContentType(mime!(Application/WwwFormUrlEncoded)) } /// A constructor to easily create a `Content-Type: image/jpeg` header. #[inline] ...
{ ContentType(mime!(Text/Html; Charset=Utf8)) }
identifier_body
content_type.rs
use mime::Mime; header! { /// `Content-Type` header, defined in /// [RFC7231](http://tools.ietf.org/html/rfc7231#section-3.1.1.5) /// /// The `Content-Type` header field indicates the media type of the /// associated representation: either the representation enclosed in the /// message payload ...
() -> ContentType { ContentType(mime!(Text/Plain; Charset=Utf8)) } /// A constructor to easily create a `Content-Type: text/html; charset=utf-8` header. #[inline] pub fn html() -> ContentType { ContentType(mime!(Text/Html; Charset=Utf8)) } /// A constructor to easily create a...
plaintext
identifier_name
huge-largest-array.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!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1); } #[cfg(target_pointer_width = "64")] pub fn main() { assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1); }
use std::mem::size_of; #[cfg(target_pointer_width = "32")] pub fn main() {
random_line_split
huge-largest-array.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 ...
#[cfg(target_pointer_width = "64")] pub fn main() { assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1); }
{ assert_eq!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1); }
identifier_body
huge-largest-array.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!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1); }
main
identifier_name
coerce-match-calls.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 _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) }; let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) }; // Check we don't get over-keen at propagating coercions in the case of casts. let x = if true { 42 } else { 42u8 } as u16; l...
main
identifier_name
coerce-match-calls.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 ...
// Check we don't get over-keen at propagating coercions in the case of casts. let x = if true { 42 } else { 42u8 } as u16; let x = match true { true => 42, false => 42u8 } as u16; }
let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) };
random_line_split
coerce-match-calls.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 _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) }; let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) }; // Check we don't get over-keen at propagating coercions in the case of casts. let x = if true { 42 } else { 42u8 } as u16; let ...
identifier_body
orf.rs
// Copyright 2014-2016 Johannes Köster, Martin Larralde. // Licensed under the MIT license (http://opensource.org/licenses/MIT) // This file may not be copied, modified, or distributed // except according to those terms. //! One-way orf finder algorithm. //! //! Complexity: O(n). //! //! # Example //! //! ``` //! use ...
for (index, &nuc) in self.seq.by_ref() { // update the codon if self.state.codon.len() >= 3 { self.state.codon.pop_front(); } self.state.codon.push_back(nuc); offset = (index + 1) % 3; // inside orf if self.stat...
let mut offset: usize;
random_line_split
orf.rs
// Copyright 2014-2016 Johannes Köster, Martin Larralde. // Licensed under the MIT license (http://opensource.org/licenses/MIT) // This file may not be copied, modified, or distributed // except according to those terms. //! One-way orf finder algorithm. //! //! Complexity: O(n). //! //! # Example //! //! ``` //! use ...
else if self.finder.start_codons.contains(&self.state.codon) { self.state.start_pos[offset] = Some(index); } if result.is_some() { return result; } } None } } #[cfg(test)] mod tests { use super::*; #[test] fn test_orf(...
// check if leaving orf if self.finder.stop_codons.contains(&self.state.codon) { // check if length is sufficient if index + 1 - self.state.start_pos[offset].unwrap() > self.finder.min_len { // build results ...
conditional_block
orf.rs
// Copyright 2014-2016 Johannes Köster, Martin Larralde. // Licensed under the MIT license (http://opensource.org/licenses/MIT) // This file may not be copied, modified, or distributed // except according to those terms. //! One-way orf finder algorithm. //! //! Complexity: O(n). //! //! # Example //! //! ``` //! use ...
{ pub start: usize, pub end: usize, pub offset: i8, } /// The current algorithm state. struct State { start_pos: [Option<usize>; 3], codon: VecDeque<u8>, } impl State { /// Create new state. pub fn new() -> Self { State { start_pos: [None, None, None], codon...
rf
identifier_name
addpd.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*;
use ::Reg::*; use ::RegScale::*; fn addpd_1() { run_test(&Instruction { mnemonic: Mnemonic::ADDPD, operand1: Some(Direct(XMM3)), operand2: Some(Direct(XMM3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 88, 219], OperandS...
use ::Operand::*;
random_line_split
addpd.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn addpd_1() { run_test(&Instruction { mnemonic: Mnemonic::ADDPD, operand1: Some(Direct(XMM3)), operand2: Some(Direct(XMM3...
fn addpd_3() { run_test(&Instruction { mnemonic: Mnemonic::ADDPD, operand1: Some(Direct(XMM4)), operand2: Some(Direct(XMM3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 88, 227], OperandSize::Qword) } fn addpd_4() { ...
{ run_test(&Instruction { mnemonic: Mnemonic::ADDPD, operand1: Some(Direct(XMM3)), operand2: Some(IndirectDisplaced(EDX, 627557726, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 88, 154, 9...
identifier_body
addpd.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; fn addpd_1() { run_test(&Instruction { mnemonic: Mnemonic::ADDPD, operand1: Some(Direct(XMM3)), operand2: Some(Direct(XMM3...
() { run_test(&Instruction { mnemonic: Mnemonic::ADDPD, operand1: Some(Direct(XMM3)), operand2: Some(IndirectDisplaced(EDX, 627557726, Some(OperandSize::Xmmword), None)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[102, 15, 88, 154...
addpd_2
identifier_name
output_buffer.rs
use sys::*; use std::cmp::min; use std::ptr::null_mut; /// This trait is intended to extend `usize` with safe downsize casts, so we can pass it as buffer /// length into odbc functions. pub trait OutputBuffer { fn buf_len<T>(&self) -> T where T: BufferLength; fn mut_buf_ptr(&mut self) -> *mut u8; }...
} impl BufferLength for SQLLEN { fn max_value() -> usize { Self::max_value() as usize } fn from_usize(len: usize) -> Self { len as Self } }
{ len as Self }
identifier_body
output_buffer.rs
use sys::*;
pub trait OutputBuffer { fn buf_len<T>(&self) -> T where T: BufferLength; fn mut_buf_ptr(&mut self) -> *mut u8; } impl OutputBuffer for [u8] { fn buf_len<T>(&self) -> T where T: BufferLength, { T::from_usize(min(self.len(), T::max_value())) } fn mut_buf_ptr(&mut...
use std::cmp::min; use std::ptr::null_mut; /// This trait is intended to extend `usize` with safe downsize casts, so we can pass it as buffer /// length into odbc functions.
random_line_split
output_buffer.rs
use sys::*; use std::cmp::min; use std::ptr::null_mut; /// This trait is intended to extend `usize` with safe downsize casts, so we can pass it as buffer /// length into odbc functions. pub trait OutputBuffer { fn buf_len<T>(&self) -> T where T: BufferLength; fn mut_buf_ptr(&mut self) -> *mut u8; }...
(&mut self) -> *mut u8 { if self.is_empty() { null_mut() } else { self.as_mut_ptr() } } } pub trait BufferLength { fn max_value() -> usize; fn from_usize(len: usize) -> Self; } impl BufferLength for SQLSMALLINT { fn max_value() -> usize { Self::m...
mut_buf_ptr
identifier_name
output_buffer.rs
use sys::*; use std::cmp::min; use std::ptr::null_mut; /// This trait is intended to extend `usize` with safe downsize casts, so we can pass it as buffer /// length into odbc functions. pub trait OutputBuffer { fn buf_len<T>(&self) -> T where T: BufferLength; fn mut_buf_ptr(&mut self) -> *mut u8; }...
else { self.as_mut_ptr() } } } pub trait BufferLength { fn max_value() -> usize; fn from_usize(len: usize) -> Self; } impl BufferLength for SQLSMALLINT { fn max_value() -> usize { Self::max_value() as usize } fn from_usize(len: usize) -> Self { len as Self...
{ null_mut() }
conditional_block
auto_args.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...
}; match params { Ok(($($x,)+ id)) => (self)(base, ready.into(), $($x,)+ Trailing(id)), Err(e) => ready.ready(Err(e)) } } } } } wrap!(A, B, C, D, E); wrap!(A, B, C, D); wrap!(A, B, C); wrap!(A, B); wrap!(A); wrap_with_trailing!(5, A, B, C, D, E); wrap_with_trailing!(4, A, B, C, D); wrap_w...
.map(|($($x,)+)| ($($x,)+ TRAILING::default())), 1 => from_params::<($($x,)+ TRAILING)>(params) .map(|($($x,)+ id)| ($($x,)+ id)), _ => Err(Error::invalid_params()),
random_line_split
auto_args.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...
} impl<B, OUT, T> WrapAsync<B> for fn(&B, Ready<OUT>, Trailing<T>) where B: Send + Sync +'static, OUT: Serialize, T: Default + Deserialize { fn wrap_rpc(&self, base: &B, params: Params, ready: ::jsonrpc_core::Ready) { let len = match params { Params::Array(ref v) => v.len(), Params::None => 0, _ => retur...
{ let len = match params { Params::Array(ref v) => v.len(), Params::None => 0, _ => return Err(errors::invalid_params("not an array", "")), }; let (id,) = match len { 0 => (T::default(),), 1 => try!(from_params::<(T,)>(params)), _ => return Err(Error::invalid_params()), }; (self)(base, Tra...
identifier_body
auto_args.rs
// Copyright 2015, 2016 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
(&self, base: &B, params: Params) -> Result<Value, Error> { ::v1::helpers::params::expect_no_params(params) .and_then(|()| (self)(base)) .map(to_value) } } impl<B, OUT> WrapAsync<B> for fn(&B, Ready<OUT>) where B: Send + Sync +'static, OUT: Serialize { fn wrap_rpc(&self, base: &B, params: Params, ready: ::j...
wrap_rpc
identifier_name
indent.rs
//! Indentation functions use remacs_macros::lisp_fn; use remacs_sys; use lisp::LispObject; use lisp::defsubr; /// Return the horizontal position of point. /// Beginning of line is column 0. /// This is calculated by adding together the widths of all the /// displayed representations of the character between the sta...
/// end of line when `selective-display' is t. Text that has an /// invisible property is considered as having width 0, unless /// `buffer-invisibility-spec' specifies that it is replaced by an /// ellipsis. #[lisp_fn] pub fn current_column() -> LispObject { LispObject::from_natnum(unsafe { remacs_sys::current_colu...
/// width of frame, which means that this function may return values /// greater than (frame-width). Whether the line is visible (if /// `selective-display' is t) has no effect; however, ^M is treated as
random_line_split
indent.rs
//! Indentation functions use remacs_macros::lisp_fn; use remacs_sys; use lisp::LispObject; use lisp::defsubr; /// Return the horizontal position of point. /// Beginning of line is column 0. /// This is calculated by adding together the widths of all the /// displayed representations of the character between the sta...
include!(concat!(env!("OUT_DIR"), "/indent_exports.rs"));
{ LispObject::from_natnum(unsafe { remacs_sys::current_column() }) }
identifier_body
indent.rs
//! Indentation functions use remacs_macros::lisp_fn; use remacs_sys; use lisp::LispObject; use lisp::defsubr; /// Return the horizontal position of point. /// Beginning of line is column 0. /// This is calculated by adding together the widths of all the /// displayed representations of the character between the sta...
() -> LispObject { LispObject::from_natnum(unsafe { remacs_sys::current_column() }) } include!(concat!(env!("OUT_DIR"), "/indent_exports.rs"));
current_column
identifier_name
glue.rs
//! // // Code relating to drop glue. use crate::common::IntPredicate; use crate::meth; use crate::traits::*; use rustc_middle::ty::{self, Ty}; pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, info: Option<Bx::Value>, ) -> (Bx::Value, Bx::Value) { let lay...
// Choose max of two known alignments (combined value must // be aligned according to more restrictive of the two). let align = match ( bx.const_to_opt_u128(sized_align, false), bx.const_to_opt_u128(unsized_align, false), ) { ...
{ if def.repr.packed() { unsized_align = sized_align; } }
conditional_block
glue.rs
//! // // Code relating to drop glue. use crate::common::IntPredicate; use crate::meth; use crate::traits::*; use rustc_middle::ty::{self, Ty}; pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, info: Option<Bx::Value>, ) -> (Bx::Value, Bx::Value) { let lay...
) { (Some(sized_align), Some(unsized_align)) => { // If both alignments are constant, (the sized_align should always be), then // pick the correct alignment statically. bx.const_usize(std::cmp::max(sized_align, unsized_align) as u64...
random_line_split
glue.rs
//! // // Code relating to drop glue. use crate::common::IntPredicate; use crate::meth; use crate::traits::*; use rustc_middle::ty::{self, Ty}; pub fn
<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, info: Option<Bx::Value>, ) -> (Bx::Value, Bx::Value) { let layout = bx.layout_of(t); debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}", t, info, layout); if!layout.is_unsized() { let size = bx.const_usize(la...
size_and_align_of_dst
identifier_name
glue.rs
//! // // Code relating to drop glue. use crate::common::IntPredicate; use crate::meth; use crate::traits::*; use rustc_middle::ty::{self, Ty}; pub fn size_and_align_of_dst<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, t: Ty<'tcx>, info: Option<Bx::Value>, ) -> (Bx::Value, Bx::Value)
let unit = layout.field(bx, 0); // The info in this case is the length of the str, so the size is that // times the unit size. ( bx.mul(info.unwrap(), bx.const_usize(unit.size.bytes())), bx.const_usize(unit.align.abi.bytes()), )...
{ let layout = bx.layout_of(t); debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}", t, info, layout); if !layout.is_unsized() { let size = bx.const_usize(layout.size.bytes()); let align = bx.const_usize(layout.align.abi.bytes()); return (size, align); } match t.ki...
identifier_body
inferred-suffix-in-pattern-range.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 ...
0.. 1 => { ~"not many" } _ => { ~"lots" } }; assert_eq!(x_message, ~"lots"); let y = 2i; let y_message = match y { 0.. 1 => { ~"not many" } _ => { ~"lots" } }; assert_eq!(y_message, ~"lots"); let z = 1u64; let z_message = match z { ...
let x = 2; let x_message = match x {
random_line_split
inferred-suffix-in-pattern-range.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 ...
() { let x = 2; let x_message = match x { 0.. 1 => { ~"not many" } _ => { ~"lots" } }; assert_eq!(x_message, ~"lots"); let y = 2i; let y_message = match y { 0.. 1 => { ~"not many" } _ => { ~"lots" } }; assert_eq!(y_message, ~"lots"); ...
main
identifier_name
inferred-suffix-in-pattern-range.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 ...
assert_eq!(z_message, ~"not many"); }
{ let x = 2; let x_message = match x { 0 .. 1 => { ~"not many" } _ => { ~"lots" } }; assert_eq!(x_message, ~"lots"); let y = 2i; let y_message = match y { 0 .. 1 => { ~"not many" } _ => { ~"lots" } }; assert_eq!(y_message, ~"lots"); ...
identifier_body
resource_task.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! A task that takes a URL and streams back the binary data. use about_loader; use data_loader; use file_loader;...
(&self, host: &str) -> bool { self.hsts_list.lock().unwrap().is_host_secure(host) } fn load(&mut self, mut load_data: LoadData, consumer: LoadConsumer) { self.user_agent.as_ref().map(|ua| { load_data.preserved_headers.set(UserAgent(ua.clone())); }); fn from_factory(...
is_host_sts
identifier_name
resource_task.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ //! A task that takes a URL and streams back the binary data. use about_loader; use data_loader; use file_loader;...
match result { Ok(_) => Ok(ProgressSender::Channel(progress_chan)), Err(_) => Err(()) } } LoadConsumer::Listener(target) => { target.invoke_with_listener(ResponseAction::HeadersAvailable(metadata)); Ok(ProgressSender::Listen...
let result = start_chan.send(LoadResponse { metadata: metadata, progress_port: progress_port, });
random_line_split
stats.rs
// Copyright (c) 2015-2017 Ivo Wetzel // 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 accordi...
/// Returns the calculated averages from the last tick. pub fn average(&self) -> Stats { self.averages } /// Resets the internal data used for average calculation, but does not /// reset the last calculated averages. pub fn reset(&mut self) { self.averages.bytes_sent = 0; ...
/// Steps the internal tick value used for average calculation. pub fn tick(&mut self) { self.tick = (self.tick + 1) % (self.config.send_rate + 1); }
random_line_split
stats.rs
// Copyright (c) 2015-2017 Ivo Wetzel // 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 accordi...
(config: Config) -> StatsCollector { StatsCollector { tick: 0, config: config, buckets: (0..config.send_rate + 1).map(|_| { Stats::default() }).collect::<Vec<Stats>>(), averages: Stats::default() } } /// Overrides the ...
new
identifier_name
stats.rs
// Copyright (c) 2015-2017 Ivo Wetzel // 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 accordi...
/// Sets the number of bytes sent for the current tick. pub fn set_bytes_sent(&mut self, bytes: u32) { let old_index = (self.tick as i32 + 1) % (self.config.send_rate + 1) as i32; let old_bytes = self.buckets[old_index as usize].bytes_sent; self.averages.bytes_sent = (self.averages.byt...
{ self.config = config; self.buckets = (0..config.send_rate + 1).map(|_| { Stats::default() }).collect::<Vec<Stats>>() }
identifier_body
lib.rs
//! Clients for comunicating with a [Kafka](http://kafka.apache.org/) //! cluster. These are: //! //! - `kafka::producer::Producer` - for sending message to Kafka //! - `kafka::consumer::Consumer` - for retrieving/consuming messages from Kafka //! - `kafka::client::KafkaClient` - a lower-level, general purpose client ...
where J: AsRef<client::ProduceMessage<'a, 'b>>, I: IntoIterator<Item=J>; }
&mut self, ack: client::RequiredAcks, ack_timeout: i32, messages: I) -> Result<Vec<client::TopicPartitionOffset>>
random_line_split
notifications.rs
use crate::AppState; use actix_web::{HttpResponse, Json, State}; use log::{debug, warn}; use potboiler_common::{db, types::Log}; use serde_derive::Deserialize; use std::{ ops::{Deref, DerefMut}, sync::{Arc, RwLock}, thread, }; use url::Url; #[derive(Clone, Debug)] pub struct Notifications { notifiers: ...
}); } } } #[derive(Deserialize)] pub struct UrlJson { url: String, } pub fn log_register(state: State<AppState>, body: Json<UrlJson>) -> HttpResponse { let conn = state.pool.get().unwrap(); let url = &body.url; debug!("Registering {:?}", url); match Url::parse(url) { ...
} Err(val) => { warn!("Failed to notify {:?}: {:?}", &local_notifier, val); } };
random_line_split
notifications.rs
use crate::AppState; use actix_web::{HttpResponse, Json, State}; use log::{debug, warn}; use potboiler_common::{db, types::Log}; use serde_derive::Deserialize; use std::{ ops::{Deref, DerefMut}, sync::{Arc, RwLock}, thread, }; use url::Url; #[derive(Clone, Debug)] pub struct
{ notifiers: Arc<RwLock<Vec<String>>>, } impl Notifications { pub fn new(conn: &db::Connection) -> Notifications { let mut notifiers = Vec::new(); for row in &conn .query("select url from notifications") .expect("notifications select works") { let url:...
Notifications
identifier_name
notifications.rs
use crate::AppState; use actix_web::{HttpResponse, Json, State}; use log::{debug, warn}; use potboiler_common::{db, types::Log}; use serde_derive::Deserialize; use std::{ ops::{Deref, DerefMut}, sync::{Arc, RwLock}, thread, }; use url::Url; #[derive(Clone, Debug)] pub struct Notifications { notifiers: ...
else { HttpResponse::NotFound().finish() } }
{ HttpResponse::NoContent().finish() }
conditional_block
atomic_fence_acq.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_fence_acq; use core::intrinsics::atomic_fence_rel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_fence_acq(); struct A<T> { v: UnsafeCell<T> ...
let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = data.clone(); thread::spawn(move || { let ptr: *mut T = clone.v.get(); unsafe { *ptr = $value; } unsafe { atomic_fence_rel() }; }); thread::sleep_ms(10); unsafe { atomic_fence_acq() }; let ptr: *mut T = data...
let a: A<T> = A::<T>::new(value);
random_line_split
atomic_fence_acq.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_fence_acq; use core::intrinsics::atomic_fence_rel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_fence_acq(); struct A<T> { v: UnsafeCell<T> ...
}
{ atomic_fence_acq_test!( 68, 500, 500 ); }
identifier_body
atomic_fence_acq.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_fence_acq; use core::intrinsics::atomic_fence_rel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_fence_acq(); struct A<T> { v: UnsafeCell<T> ...
(v: T) -> A<T> { A { v: UnsafeCell::<T>::new(v) } } } type T = usize; macro_rules! atomic_fence_acq_test { ($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::new(value); let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = dat...
new
identifier_name
raw.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 st_ino: c_ulonglong, }
pub st_atime_nsec: c_ulong, pub st_mtime: time_t, pub st_mtime_nsec: c_ulong, pub st_ctime: time_t, pub st_ctime_nsec: c_ulong,
random_line_split
raw.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 st_dev: c_ulonglong, pub __pad0: [c_uchar; 4], pub __st_ino: ino_t, pub st_mode: c_uint, pub st_nlink: c_uint, pub st_uid: uid_t, pub st_gid: gid_t, pub st_rdev: c_ulonglong, pub __pad3: [c_uchar; 4], pub st_size: c_longlong, pub st_blksize: blksize_t, pub st_block...
stat
identifier_name
checkrust.rs
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
else { 0xff } }) }
{ 0 }
conditional_block
checkrust.rs
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
#[no_mangle] pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { continue_if!(ap.arg::<c_double>().floor() == 6.28f64.floor()); continue_if!(ap.arg::<c_int>() == 16); continue_if!(ap.arg::<c_char>() == 'A' as c_char); continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!"))...
{ continue_if!(ap.arg::<c_double>().floor() == 3.14f64.floor()); continue_if!(ap.arg::<c_long>() == 12); continue_if!(ap.arg::<c_char>() == 'a' as c_char); continue_if!(ap.arg::<c_double>().floor() == 6.18f64.floor()); continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello")); continue_if!...
identifier_body
checkrust.rs
// Copyright 2018 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 ...
continue_if!(ap.arg::<c_int>() == 0x10000001); continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Valid!")); 0 } #[no_mangle] pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize { continue_if!(ap.arg::<c_double>().floor() == 3.14f64.floor()); continue_if!(ap.arg::<c_long>() == 12); ...
continue_if!(ap.arg::<c_int>() == -1); continue_if!(ap.arg::<c_char>() == 'A' as c_char); continue_if!(ap.arg::<c_char>() == '4' as c_char); continue_if!(ap.arg::<c_char>() == ';' as c_char); continue_if!(ap.arg::<c_int>() == 0x32);
random_line_split
checkrust.rs
// Copyright 2018 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 ...
(mut ap: VaList) -> usize { continue_if!(ap.arg::<c_double>().floor() == 3.14f64.floor()); continue_if!(ap.arg::<c_long>() == 12); continue_if!(ap.arg::<c_char>() == 'a' as c_char); continue_if!(ap.arg::<c_double>().floor() == 6.18f64.floor()); continue_if!(compare_c_str(ap.arg::<*const c_char>(), "...
check_list_2
identifier_name
task-comm-14.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...
use std::sync::mpsc::{channel, Sender}; use std::thread; pub fn main() { let (tx, rx) = channel(); // Spawn 10 threads each sending us back one isize. let mut i = 10; while (i > 0) { println!("{}", i); let tx = tx.clone(); thread::spawn({let i = i; move|| { child(i, &tx) }}); ...
#![feature(std_misc)]
random_line_split
task-comm-14.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...
(x: isize, tx: &Sender<isize>) { println!("{}", x); tx.send(x).unwrap(); }
child
identifier_name
task-comm-14.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...
} println!("main thread exiting"); } fn child(x: isize, tx: &Sender<isize>) { println!("{}", x); tx.send(x).unwrap(); }
{ let (tx, rx) = channel(); // Spawn 10 threads each sending us back one isize. let mut i = 10; while (i > 0) { println!("{}", i); let tx = tx.clone(); thread::spawn({let i = i; move|| { child(i, &tx) }}); i = i - 1; } // Spawned threads are likely killed before...
identifier_body
repos.rs
use std::env; use futures::{Future, Stream}; use tokio::runtime::Runtime; use hubcaps::{Credentials, Github, Result}; fn
() -> Result<()> { pretty_env_logger::init(); match env::var("GITHUB_TOKEN").ok() { Some(token) => { let mut rt = Runtime::new()?; let github = Github::new( concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")), Credentials::Token(token),...
main
identifier_name
repos.rs
use std::env; use futures::{Future, Stream}; use tokio::runtime::Runtime; use hubcaps::{Credentials, Github, Result}; fn main() -> Result<()>
}); handle.spawn(f.map_err(|_| ())); Ok(()) }), )?; Ok(()) } _ => Err("example missing GITHUB_TOKEN".into()), } }
{ pretty_env_logger::init(); match env::var("GITHUB_TOKEN").ok() { Some(token) => { let mut rt = Runtime::new()?; let github = Github::new( concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")), Credentials::Token(token), )?; ...
identifier_body
repos.rs
use std::env; use futures::{Future, Stream}; use tokio::runtime::Runtime; use hubcaps::{Credentials, Github, Result}; fn main() -> Result<()> { pretty_env_logger::init(); match env::var("GITHUB_TOKEN").ok() { Some(token) =>
}), )?; Ok(()) } _ => Err("example missing GITHUB_TOKEN".into()), } }
{ let mut rt = Runtime::new()?; let github = Github::new( concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")), Credentials::Token(token), )?; let handle = rt.executor(); rt.block_on( github ...
conditional_block
repos.rs
use std::env; use futures::{Future, Stream}; use tokio::runtime::Runtime; use hubcaps::{Credentials, Github, Result}; fn main() -> Result<()> { pretty_env_logger::init(); match env::var("GITHUB_TOKEN").ok() { Some(token) => { let mut rt = Runtime::new()?; let github = Github::...
let f = repo.languages(github.clone()).map(|langs| { for (language, bytes_of_code) in langs { println!("{}: {} bytes", language, bytes_of_code) } }); handle.spa...
println!("{}", repo.name);
random_line_split
span-preservation.rs
// For each of these, we should get the appropriate type mismatch error message, // and the function should be echoed. // aux-build:test-macros.rs #[macro_use] extern crate test_macros; #[recollect_attr] fn a() { let x: usize = "hello"; //~ ERROR mismatched types } #[recollect_attr] fn b(x: Option<isize>) -> us...
{ a: usize, b: usize } let x = Foo { a: 10isize }; //~ ERROR mismatched types let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` } #[recollect_attr] extern "C" fn bar() { 0 //~ ERROR mismatched types } #[recollect_attr] extern "C" fn baz() { 0 //~ ERROR mismatche...
Bar
identifier_name
span-preservation.rs
// For each of these, we should get the appropriate type mismatch error message, // and the function should be echoed. // aux-build:test-macros.rs #[macro_use] extern crate test_macros; #[recollect_attr] fn a() { let x: usize = "hello"; //~ ERROR mismatched types } #[recollect_attr] fn b(x: Option<isize>) -> us...
#[recollect_attr] extern "Rust" fn rust_abi() { 0 //~ ERROR mismatched types } #[recollect_attr] extern "\x43" fn c_abi_escaped() { 0 //~ ERROR mismatched types } fn main() {}
{ 0 //~ ERROR mismatched types }
identifier_body
rowiterator.rs
// Copyright 2016 Claus Matzinger // // 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 //
extern crate serde_json; use row::Row; use std::collections::HashMap; use self::serde_json::Value; use std::rc::Rc; #[derive(Debug)] pub struct RowIterator { rows: Vec<Value>, header: Rc<HashMap<String, usize>>, } impl RowIterator { pub fn new(mut rows: Vec<Value>, header: HashMap<String, usize>) -> Ro...
// 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 governing permissions and // limitations under the License.
random_line_split
rowiterator.rs
// Copyright 2016 Claus Matzinger // // 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 ...
{ rows: Vec<Value>, header: Rc<HashMap<String, usize>>, } impl RowIterator { pub fn new(mut rows: Vec<Value>, header: HashMap<String, usize>) -> RowIterator { let headers = Rc::new(header); rows.reverse(); RowIterator { rows: rows, header: headers, }...
RowIterator
identifier_name
rowiterator.rs
// Copyright 2016 Claus Matzinger // // 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 ...
pub fn len(&self) -> usize { self.rows.len() } } impl Iterator for RowIterator { type Item = Row; fn next(&mut self) -> Option<Row> { match self.rows.pop() { Some(i) => Some(Row::new(i.as_array().unwrap().to_vec(), self.header.clone())), _ => None, } ...
{ let headers = Rc::new(header); rows.reverse(); RowIterator { rows: rows, header: headers, } }
identifier_body
reset.rs
// Copyright 2021 lowRISC 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
pub const RESET_SOURCE_LEN: usize = 8; impl<'a> FromWire<'a> for ResetSource { fn from_wire<R: Read<'a>>(mut r: R) -> Result<Self, FromWireError> { let power_on_reset = r.read_be::<u8>()?!= 0; let low_power_reset = r.read_be::<u8>()?!= 0; let watchdog_reset = r.read_be::<u8>()?!= 0; ...
} /// The length of a ResetSource on the wire, in bytes.
random_line_split
reset.rs
// Copyright 2021 lowRISC 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
else { 0u8 })?; w.write_be(if self.lockup_reset { 1 } else { 0u8 })?; w.write_be(if self.sysreset { 1 } else { 0u8 })?; w.write_be(if self.software_reset { 1 } else { 0u8 })?; w.write_be(if self.fast_burnout_circuit { 1 } else { 0u8 })?; w.write_be(if self.security_breach_reset ...
{ 1 }
conditional_block
reset.rs
// Copyright 2021 lowRISC 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
<R: Read<'a>>(mut r: R) -> Result<Self, FromWireError> { let power_on_reset = r.read_be::<u8>()?!= 0; let low_power_reset = r.read_be::<u8>()?!= 0; let watchdog_reset = r.read_be::<u8>()?!= 0; let lockup_reset = r.read_be::<u8>()?!= 0; let sysreset = r.read_be::<u8>()?!= 0; ...
from_wire
identifier_name
reset.rs
// Copyright 2021 lowRISC 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
}
{ w.write_be(if self.power_on_reset { 1 } else { 0u8 })?; w.write_be(if self.low_power_reset { 1 } else { 0u8 })?; w.write_be(if self.watchdog_reset { 1 } else { 0u8 })?; w.write_be(if self.lockup_reset { 1 } else { 0u8 })?; w.write_be(if self.sysreset { 1 } else { 0u8 })?; ...
identifier_body
osm2mimir.rs
use clap::Parser; use futures::stream::StreamExt; use mimir::domain::model::configuration::ContainerConfig; use snafu::{ResultExt, Snafu}; use tracing::{instrument, warn}; use mimir::adapters::secondary::elasticsearch::{self, ElasticsearchStorage}; use mimir::domain::ports::primary::{generate_index::GenerateIndex, lis...
Ok(()) } #[instrument(skip_all)] async fn import_streets( streets: Vec<places::street::Street>, client: &ElasticsearchStorage, config: &ContainerConfig, ) -> Result<(), Error> { let streets = streets .into_iter() .map(|street| street.set_weight_from_admins()); let _index = clie...
{ import_pois( &mut osm_reader, &admins_geofinder, &settings.pois.config.clone().unwrap_or_default(), &client, &settings.container_poi, ) .await?; }
conditional_block
osm2mimir.rs
use clap::Parser; use futures::stream::StreamExt; use mimir::domain::model::configuration::ContainerConfig; use snafu::{ResultExt, Snafu}; use tracing::{instrument, warn}; use mimir::adapters::secondary::elasticsearch::{self, ElasticsearchStorage}; use mimir::domain::ports::primary::{generate_index::GenerateIndex, lis...
// #[cfg(test)] // mod tests { // use super::*; // use crate::elasticsearch::ElasticsearchStorage; // use common::config::load_es_config_for; // use common::document::ContainerDocument; // use futures::TryStreamExt; // use mimir::domain::model::query::Query; // use mimir::domain::ports::pr...
{ // This function rely on AdminGeoFinder::get_objs_and_deps // which use all available cpu/cores to decode osm file and cannot be limited by tokio runtime let pois = mimirsbrunn::osm_reader::poi::pois(osm_reader, poi_config, admins_geofinder) .context(PoiOsmExtractionSnafu)?; let pois: Vec<pla...
identifier_body
osm2mimir.rs
use clap::Parser; use futures::stream::StreamExt; use mimir::domain::model::configuration::ContainerConfig; use snafu::{ResultExt, Snafu}; use tracing::{instrument, warn}; use mimir::adapters::secondary::elasticsearch::{self, ElasticsearchStorage}; use mimir::domain::ports::primary::{generate_index::GenerateIndex, lis...
}, #[snafu(display("Poi Extraction from OSM PBF Error {}", source))] PoiOsmExtraction { source: mimirsbrunn::osm_reader::poi::Error, }, #[snafu(display("Poi Index Creation Error {}", source))] PoiIndexCreation { source: mimir::domain::model::error::Error, }, #[snafu(di...
StreetIndexCreation { source: mimir::domain::model::error::Error,
random_line_split
osm2mimir.rs
use clap::Parser; use futures::stream::StreamExt; use mimir::domain::model::configuration::ContainerConfig; use snafu::{ResultExt, Snafu}; use tracing::{instrument, warn}; use mimir::adapters::secondary::elasticsearch::{self, ElasticsearchStorage}; use mimir::domain::ports::primary::{generate_index::GenerateIndex, lis...
{ #[snafu(display("Settings (Configuration or CLI) Error: {}", source))] Settings { source: settings::Error }, #[snafu(display("OSM PBF Reader Error: {}", source))] OsmPbfReader { source: mimirsbrunn::osm_reader::Error, }, #[snafu(display("Elasticsearch Connection Pool {}", source))] ...
Error
identifier_name
unix.rs
extern crate thermal_printer; extern crate serial; extern crate serial_embedded_hal; use serial::{Baud19200, Bits8, ParityNone, Stop1, FlowNone}; use serial_embedded_hal::{Serial, PortSettings}; use thermal_printer::prelude::*; use std::thread::sleep; fn main() { println!("Opening serial port..."); let por...
}; println!("Serial port open"); let port = Serial::new("/dev/tty.usbserial-A700eX73", &port_settings) .expect("Failed to open serial port"); let (tx_port, _) = port.split(); let mut printer = ThermalPrinter::new(tx_port); printer.configure(11, 120, 40); println!("Feeding 3 line...
baud_rate: Baud19200, char_size: Bits8, parity: ParityNone, stop_bits: Stop1, flow_control: FlowNone,
random_line_split
unix.rs
extern crate thermal_printer; extern crate serial; extern crate serial_embedded_hal; use serial::{Baud19200, Bits8, ParityNone, Stop1, FlowNone}; use serial_embedded_hal::{Serial, PortSettings}; use thermal_printer::prelude::*; use std::thread::sleep; fn main()
printer.configure(11, 120, 40); println!("Feeding 3 lines"); printer.feed_n(3).expect("Feed lines failed"); println!("Running self test"); printer.run_test().expect("Self test failed"); sleep(std::time::Duration::from_secs(1)); println!("Done!") }
{ println!("Opening serial port..."); let port_settings = PortSettings { baud_rate: Baud19200, char_size: Bits8, parity: ParityNone, stop_bits: Stop1, flow_control: FlowNone, }; println!("Serial port open"); let port = Serial::new("/dev/tty.usbserial-A700eX...
identifier_body
unix.rs
extern crate thermal_printer; extern crate serial; extern crate serial_embedded_hal; use serial::{Baud19200, Bits8, ParityNone, Stop1, FlowNone}; use serial_embedded_hal::{Serial, PortSettings}; use thermal_printer::prelude::*; use std::thread::sleep; fn
() { println!("Opening serial port..."); let port_settings = PortSettings { baud_rate: Baud19200, char_size: Bits8, parity: ParityNone, stop_bits: Stop1, flow_control: FlowNone, }; println!("Serial port open"); let port = Serial::new("/dev/tty.usbserial-A70...
main
identifier_name
main.rs
// --- Day 7: Internet Protocol Version 7 --- // // While snooping around the local network of EBHQ, you compile a list of IP addresses (they're IPv7, of course; IPv6 is much too limited). You'd like to figure out which IPs support TLS (transport-layer snooping). // // An IP supports TLS if it has an Autonomous Bridge ...
{ // read input from file let mut f = File::open("input.txt").unwrap(); let mut input = String::new(); f.read_to_string(&mut input).ok(); // parse lines to IPAddress objects let addresses: Vec<IPAddress> = input.lines().map(|l| l.parse().unwrap()).collect(); // figure out answer A let ...
identifier_body
main.rs
// --- Day 7: Internet Protocol Version 7 --- // // While snooping around the local network of EBHQ, you compile a list of IP addresses (they're IPv7, of course; IPv6 is much too limited). You'd like to figure out which IPs support TLS (transport-layer snooping). // // An IP supports TLS if it has an Autonomous Bridge ...
() { // read input from file let mut f = File::open("input.txt").unwrap(); let mut input = String::new(); f.read_to_string(&mut input).ok(); // parse lines to IPAddress objects let addresses: Vec<IPAddress> = input.lines().map(|l| l.parse().unwrap()).collect(); // figure out answer A l...
main
identifier_name
main.rs
// --- Day 7: Internet Protocol Version 7 --- // // While snooping around the local network of EBHQ, you compile a list of IP addresses (they're IPv7, of course; IPv6 is much too limited). You'd like to figure out which IPs support TLS (transport-layer snooping). // // An IP supports TLS if it has an Autonomous Bridge ...
// xyx[xyx]xyx does not support SSL (xyx, but no corresponding yxy). // aaa[kek]eke supports SSL (eke in supernet with corresponding kek in hypernet; the aaa sequence is not related, because the interior character must be different). // zazbz[bzb]cdb supports SSL (zaz has no corresponding aza, but zbz has a correspondi...
// An IP supports SSL if it has an Area-Broadcast Accessor, or ABA, anywhere in the supernet sequences (outside any square bracketed sections), and a corresponding Byte Allocation Block, or BAB, anywhere in the hypernet sequences. An ABA is any three-character sequence which consists of the same character twice with a ...
random_line_split
skin.rs
// Copyright 2015 Birunthan Mohanathas // // Licensed under the MIT license <http://opensource.org/licenses/MIT>. This // file may not be copied, modified, or distributed except according to those // terms. use measure::Measureable; pub struct Skin<'a> { name: String, measures: Vec<Box<Measureable<'a> + 'a>>,...
(&self) -> &Vec<Box<Measureable<'a> + 'a>> { &self.measures } } #[test] fn test_name() { let skin = Skin::new("skin"); assert_eq!("skin", skin.name()); } #[test] fn test_add_measure() { use time_measure::TimeMeasure; let mut skin = Skin::new("skin"); skin.add_measure(Box::new(TimeMeas...
measures
identifier_name