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
distinct.rs
use std::collections::{HashMap, HashSet}; use std::collections::hash_state::DefaultState; use std::hash::{hash, Hash, SipHasher}; use std::default::Default; use communication::Data; use communication::pact::Exchange; use construction::{Stream, GraphBuilder}; use construction::operators::unary::UnaryNotifyExt; use se...
} notificator.notify_at(&time); } while let Some((time, _count)) = notificator.next() { elements.remove(&time); } }) } fn distinct_batch(&self) -> Stream<G, D> { let mut elements: HashMap<_, HashSet<_, Defaul...
{ session.give(datum); }
conditional_block
distinct.rs
use std::collections::{HashMap, HashSet}; use std::collections::hash_state::DefaultState;
use communication::pact::Exchange; use construction::{Stream, GraphBuilder}; use construction::operators::unary::UnaryNotifyExt; use serialization::Serializable; pub trait DistinctExtensionTrait { fn distinct(&self) -> Self; fn distinct_batch(&self) -> Self; } impl<G: GraphBuilder, D: Data+Hash+Eq+Serializa...
use std::hash::{hash, Hash, SipHasher}; use std::default::Default; use communication::Data;
random_line_split
distinct.rs
use std::collections::{HashMap, HashSet}; use std::collections::hash_state::DefaultState; use std::hash::{hash, Hash, SipHasher}; use std::default::Default; use communication::Data; use communication::pact::Exchange; use construction::{Stream, GraphBuilder}; use construction::operators::unary::UnaryNotifyExt; use se...
} fn distinct_batch(&self) -> Stream<G, D> { let mut elements: HashMap<_, HashSet<_, DefaultState<SipHasher>>> = HashMap::new(); let exch = Exchange::new(|x| hash::<_,SipHasher>(&x)); self.unary_notify(exch, "DistinctBlock", vec![], move |input, output, notificator| { while...
{ let mut elements: HashMap<_, HashSet<_, DefaultState<SipHasher>>> = HashMap::new(); let exch = Exchange::new(|x| hash::<_,SipHasher>(&x)); self.unary_notify(exch, "Distinct", vec![], move |input, output, notificator| { while let Some((time, data)) = input.pull() { l...
identifier_body
class.rs
//! Atom-class implementation. use std::ops::{BitXor, Sub, Range, RangeInclusive}; use std::iter::FromIterator; use std::fmt::{self, Debug}; use itertools::Itertools; use super::{Anchor, Atom, ByteOrChar, Element, Repetition, Sequence, Union}; use super::{Distance, Step}; use util::set::{self, Contains}; // -------...
} /// Create a new Class instance from an iterator of ClassMember instances. pub fn from_members<I>(m: I) -> Self where I: IntoIterator<Item=ClassMember<T>> { Class{members: m.into_iter().collect()} } /// Map the atoms in the class to a different atom type. pub fn map_atoms...
/// Create a new Class instance with members taken from the given iterator. pub fn new<I,U>(items: I) -> Self where I: IntoIterator<Item=U>, ClassMember<T>: From<U> { Class{members: Vec::from_iter(items.into_iter().map(|x| x.into()))}
random_line_split
class.rs
//! Atom-class implementation. use std::ops::{BitXor, Sub, Range, RangeInclusive}; use std::iter::FromIterator; use std::fmt::{self, Debug}; use itertools::Itertools; use super::{Anchor, Atom, ByteOrChar, Element, Repetition, Sequence, Union}; use super::{Distance, Step}; use util::set::{self, Contains}; // -------...
/// Fetch an iterator over the atoms specified in the class. pub fn iter<'a>(&'a self) -> impl Iterator<Item=T> + 'a where T: Step { self.members.iter().flat_map(|m| m.iter()) } } impl<T: Atom> Debug for Class<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "[{}...
{ self.members.iter() }
identifier_body
class.rs
//! Atom-class implementation. use std::ops::{BitXor, Sub, Range, RangeInclusive}; use std::iter::FromIterator; use std::fmt::{self, Debug}; use itertools::Itertools; use super::{Anchor, Atom, ByteOrChar, Element, Repetition, Sequence, Union}; use super::{Distance, Step}; use util::set::{self, Contains}; // -------...
(&self, cm: &'a ClassMember<T>) -> bool { self.iter_members().any(|m| cm == m) } } impl<T: Atom> set::Contains<T> for Class<T> { /// Check if any member of the class matches the given atom. fn contains(&self, x: T) -> bool { self.matches(x) } } impl<T: Atom + Step> set::IsSubsetOf<T> fo...
contains
identifier_name
xrspace.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; use cra...
} else { unreachable!() } } pub fn session(&self) -> &XRSession { &self.session } }
{ frame.target_ray_origin.map(cast_transform) }
conditional_block
xrspace.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; use cra...
(session: &XRSession) -> XRSpace { XRSpace { eventtarget: EventTarget::new_inherited(), session: Dom::from_ref(session), input_source: Default::default(), is_grip_space: false, } } fn new_inputspace_inner( session: &XRSession, inpu...
new_inherited
identifier_name
xrspace.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; use cra...
BaseSpace::TargetRay(source.id()) }; Space { base, offset: RigidTransform3D::identity(), } } else { panic!("invalid space found") } } } impl XRSpace { /// Gets pose represented by this space /// ...
} else if let Some(source) = self.input_source.get() { let base = if self.is_grip_space { BaseSpace::Grip(source.id()) } else {
random_line_split
xrspace.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::reflector::reflect_dom_object; use cra...
} impl XRSpace { /// Gets pose represented by this space /// /// The reference origin used is common between all /// get_pose calls for spaces from the same device, so this can be used to compare /// with other spaces pub fn get_pose(&self, base_pose: &Frame) -> Option<ApiPose> { if le...
{ if let Some(rs) = self.downcast::<XRReferenceSpace>() { rs.space() } else if let Some(j) = self.downcast::<XRJointSpace>() { j.space() } else if let Some(source) = self.input_source.get() { let base = if self.is_grip_space { BaseSpace::Grip(s...
identifier_body
roman-numerals-macro.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. //
// except according to those terms. // aux-build:roman_numerals.rs // ignore-stage1 #![feature(phase)] #[phase(plugin)] extern crate roman_numerals; pub fn main() { assert_eq!(rn!(MMXV), 2015); assert_eq!(rn!(MCMXCIX), 1999); assert_eq!(rn!(XXV), 25); assert_eq!(rn!(MDCLXVI), 1666); assert_eq!(r...
// 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
random_line_split
roman-numerals-macro.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!(rn!(MMXV), 2015); assert_eq!(rn!(MCMXCIX), 1999); assert_eq!(rn!(XXV), 25); assert_eq!(rn!(MDCLXVI), 1666); assert_eq!(rn!(MMMDCCCLXXXVIII), 3888); assert_eq!(rn!(MMXIV), 2014); }
main
identifier_name
roman-numerals-macro.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!(rn!(MMXV), 2015); assert_eq!(rn!(MCMXCIX), 1999); assert_eq!(rn!(XXV), 25); assert_eq!(rn!(MDCLXVI), 1666); assert_eq!(rn!(MMMDCCCLXXXVIII), 3888); assert_eq!(rn!(MMXIV), 2014); }
identifier_body
client.rs
// Copyright 2015, 2016 Ethcore (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 later version....
} impl HashFetch for Client { fn fetch(&self, hash: H256, on_done: Box<Fn(Result<PathBuf, Error>) + Send>) -> Result<(), Error> { debug!(target: "dapps", "Fetching: {:?}", hash); let url = try!( self.contract.resolve(hash.to_vec()).map(|content| match content { URLHintResult::Dapp(dapp) => { dapp.ur...
{ Client { contract: URLHintContract::new(contract), fetch: Mutex::new(FetchClient::default()), } }
identifier_body
client.rs
// Copyright 2015, 2016 Ethcore (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 later version....
else { Ok(path) } } debug!(target: "dapps", "Content fetched, validating hash ({:?})", hash); on_done(validate_hash(hash, result)) })).map_err(Into::into) } }
{ Err(Error::HashMismatch{ got: content_hash, expected: hash }) }
conditional_block
client.rs
// Copyright 2015, 2016 Ethcore (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 later version....
); debug!(target: "dapps", "Resolved {:?} to {:?}. Fetching...", hash, url); self.fetch.lock().request_async(&url, Default::default(), Box::new(move |result| { fn validate_hash(hash: H256, result: Result<PathBuf, FetchError>) -> Result<PathBuf, Error> { let path = try!(result); let mut file_reader = ...
}, URLHintResult::Content(content) => { content.url }, }).ok_or_else(|| Error::NoResolution)
random_line_split
client.rs
// Copyright 2015, 2016 Ethcore (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 later version....
(error: FetchError) -> Self { Error::Fetch(error) } } impl From<io::Error> for Error { fn from(error: io::Error) -> Self { Error::IO(error) } } /// Default Hash-fetching client using on-chain contract to resolve hashes to URLs. pub struct Client { contract: URLHintContract, fetch: Mutex<FetchClient>, } impl...
from
identifier_name
set_mat_col.rs
//! Given: //! //! `y <- alpha * A * x` //! //! Test that //! //! `y[i] = alpha * A[i, :] * x` //! //! for any valid `i` #![feature(custom_attribute)] #![feature(plugin)] #![plugin(quickcheck_macros)] extern crate approx; extern crate complex; extern crate linalg; extern crate quickcheck; extern crate rand; #[macro_...
use complex::{c64, c128}; use linalg::prelude::*; use quickcheck::TestResult; macro_rules! tests { ($($t:ident),+) => { $( #[quickcheck] fn $t((srow, scol): (u32, u32), (nrows, ncols): (u32, u32), i: u32) -> TestResult { enforce! {...
use linalg::prelude::*; use quickcheck::TestResult; mod transposed {
random_line_split
item-attributes.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...
mod test_stmt_multi_attr_outer { pub fn f() { #[attr1 = "val"] #[attr2 = "val"] static x: int = 10; #[attr1 = "val"] #[attr2 = "val"] fn f() { } #[attr1 = "val"] #[attr2 = "val"] mod mod1 { } mod rustrt { #[attr1...
random_line_split
item-attributes.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...
#[attr = "val"] mod mod1 { } mod rustrt { #[attr = "val"] extern { } } } } mod test_stmt_multi_attr_outer { pub fn f() { #[attr1 = "val"] #[attr2 = "val"] static x: int = 10; #[attr1 = "val"] ...
{ }
identifier_body
item-attributes.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...
() { } #[attr = "val"] mod mod1 { } mod rustrt { #[attr = "val"] extern { } } } } mod test_stmt_multi_attr_outer { pub fn f() { #[attr1 = "val"] #[attr2 = "val"] static x: int = 10; #[attr1 = "val"] ...
f
identifier_name
main.rs
extern crate rustbox; use std::env; use std::io::Result; use std::path::Path; mod filedata; use filedata::FileData; mod display; use display::Display; fn main() { let fd = match init_data() { Ok(v) => v, Err(e) => { println!("could not open specified file: {}", e); return; } }; let display = Displ...
}
{ let mut args = env::args().skip(1); if args.len() > 0 { let path_str = args.next().unwrap_or(String::new()); let path_str_copy = path_str.clone(); let path = Path::new(&path_str_copy); if path.exists() == false { Ok(FileData::new_with_name(path_str)) } else { FileData::from(path_str) ...
identifier_body
main.rs
extern crate rustbox; use std::env; use std::io::Result; use std::path::Path; mod filedata; use filedata::FileData; mod display; use display::Display; fn main() { let fd = match init_data() { Ok(v) => v, Err(e) =>
}; let display = Display::new(fd); display.run(); } //create a new data object from cmd args fn init_data() -> Result<FileData> { let mut args = env::args().skip(1); if args.len() > 0 { let path_str = args.next().unwrap_or(String::new()); let path_str_copy = path_str.clone(); let path = Path::new(&path_s...
{ println!("could not open specified file: {}", e); return; }
conditional_block
main.rs
extern crate rustbox; use std::env; use std::io::Result; use std::path::Path; mod filedata; use filedata::FileData;
mod display; use display::Display; fn main() { let fd = match init_data() { Ok(v) => v, Err(e) => { println!("could not open specified file: {}", e); return; } }; let display = Display::new(fd); display.run(); } //create a new data object from cmd args fn init_data() -> Result<FileData> { let mut...
random_line_split
main.rs
extern crate rustbox; use std::env; use std::io::Result; use std::path::Path; mod filedata; use filedata::FileData; mod display; use display::Display; fn main() { let fd = match init_data() { Ok(v) => v, Err(e) => { println!("could not open specified file: {}", e); return; } }; let display = Displ...
() -> Result<FileData> { let mut args = env::args().skip(1); if args.len() > 0 { let path_str = args.next().unwrap_or(String::new()); let path_str_copy = path_str.clone(); let path = Path::new(&path_str_copy); if path.exists() == false { Ok(FileData::new_with_name(path_str)) } else { FileData...
init_data
identifier_name
ptr.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 bindings::*; use heapsize::HeapSizeOf; use std::fmt::{self, Debug}; // Defines an Arc-like type that manages ...
ptr: data } } pub fn as_raw(&self) -> *mut $holder_type { self.ptr } } unsafe impl Send for $arc_type {} unsafe impl Sync for $arc_type {} impl Clone for $arc_type { fn clone(&self) -> $arc_type { ...
impl $arc_type { pub fn new(data: *mut $holder_type) -> $arc_type { debug_assert!(!data.is_null()); unsafe { $addref(data); } $arc_type {
random_line_split
write_vectored.rs
use crate::io::AsyncWrite; use futures_core::future::Future; use futures_core::task::{Context, Poll}; use std::io::{self, IoSlice}; use std::pin::Pin; /// Future for the [`write_vectored`](super::AsyncWriteExt::write_vectored) method. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"]...
<'a, 'b, W:?Sized> { writer: &'a mut W, bufs: &'a [IoSlice<'b>], } impl<W:?Sized + Unpin> Unpin for WriteVectored<'_, '_, W> {} impl<'a, 'b, W: AsyncWrite +?Sized + Unpin> WriteVectored<'a, 'b, W> { pub(super) fn new(writer: &'a mut W, bufs: &'a [IoSlice<'b>]) -> Self { Self { writer, bufs } }...
WriteVectored
identifier_name
write_vectored.rs
use crate::io::AsyncWrite; use futures_core::future::Future; use futures_core::task::{Context, Poll}; use std::io::{self, IoSlice}; use std::pin::Pin; /// Future for the [`write_vectored`](super::AsyncWriteExt::write_vectored) method. #[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"] pub struct WriteVectored<'a, 'b, W:?Sized> { writer: &'a mut W, bufs: &'a [IoSlice<'b>], } impl<W:?Sized + Unpin> Unpin for WriteVectored<'_, '_, W> {} impl<'a, 'b, W: AsyncWrite +?Sized + Unpin> WriteVectored<'a, 'b, W> { pub(super) fn n...
random_line_split
write_vectored.rs
use crate::io::AsyncWrite; use futures_core::future::Future; use futures_core::task::{Context, Poll}; use std::io::{self, IoSlice}; use std::pin::Pin; /// Future for the [`write_vectored`](super::AsyncWriteExt::write_vectored) method. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"]...
} impl<W: AsyncWrite +?Sized + Unpin> Future for WriteVectored<'_, '_, W> { type Output = io::Result<usize>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { let this = &mut *self; Pin::new(&mut this.writer).poll_write_vectored(cx, this.bufs) } }
{ Self { writer, bufs } }
identifier_body
htmlbodyelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::{Attr, AttrHelpers}; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull...
} pub trait HTMLBodyElementHelpers { fn get_background_color(&self) -> Option<RGBA>; } impl HTMLBodyElementHelpers for HTMLBodyElement { fn get_background_color(&self) -> Option<RGBA> { self.background_color.get() } } impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> { fn super_type<'b>...
{ let win = window_from_node(self).root(); win.r().SetOnunload(listener) }
identifier_body
htmlbodyelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::{Attr, AttrHelpers}; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull...
(&self, attr: JSRef<Attr>) { match self.super_type() { Some(ref s) => s.before_remove_attr(attr), _ => {} } match attr.local_name() { &atom!("bgcolor") => self.background_color.set(None), _ => {} } } }
before_remove_attr
identifier_name
htmlbodyelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::{Attr, AttrHelpers}; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull...
window.r().reflector().get_jsobject()); let evtarget: JSRef<EventTarget> = if FORWARDED_EVENTS.iter().any(|&event| &**name == event) { EventTargetCast::from_ref(window.r()) } else { EventTargetCas...
window.r().get_url(),
random_line_split
htmlbodyelement.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::attr::{Attr, AttrHelpers}; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull...
; evtarget.set_event_handler_uncompiled(cx, url, reflector, &name[2..], (**attr.value()).to_owned()); } match attr.local_name() { &atom!("bgcolor") => { self.backg...
{ EventTargetCast::from_ref(*self) }
conditional_block
prng.rs
use core::usize; use rng::Rng; // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use #[cfg(target_pointer_width = "32")] pub const OFFSET: usize = 1013904223; #[cfg(target_pointer_width = "32")] pub const MULTIPLIER: usize = 1664525; #[cfg(target_pointer_width = "64")] pub const OF...
(&mut self, seed: usize) { self.seed = seed; } } impl Rng for Prng { // http://indiegamr.com/generate-repeatable-random-numbers-in-js/ #[inline] fn next(&mut self) -> usize { self.seed = ((MULTIPLIER.wrapping_mul(self.seed)).wrapping_add(OFFSET)) % MAX; self.seed } }
set_seed
identifier_name
prng.rs
use core::usize; use rng::Rng; // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use #[cfg(target_pointer_width = "32")] pub const OFFSET: usize = 1013904223; #[cfg(target_pointer_width = "32")] pub const MULTIPLIER: usize = 1664525; #[cfg(target_pointer_width = "64")] pub const OF...
} impl Rng for Prng { // http://indiegamr.com/generate-repeatable-random-numbers-in-js/ #[inline] fn next(&mut self) -> usize { self.seed = ((MULTIPLIER.wrapping_mul(self.seed)).wrapping_add(OFFSET)) % MAX; self.seed } }
{ self.seed = seed; }
identifier_body
prng.rs
use core::usize; use rng::Rng; // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use #[cfg(target_pointer_width = "32")] pub const OFFSET: usize = 1013904223; #[cfg(target_pointer_width = "32")] pub const MULTIPLIER: usize = 1664525; #[cfg(target_pointer_width = "64")] pub const OF...
pub const MAX: usize = usize::MAX as usize; pub struct Prng { seed: usize, } impl Prng { #[inline] pub fn new() -> Self { Prng { // get a value for initial seed seed: &false as *const _ as usize, } } #[inline] pub fn seed(&self) -> usize { self.seed } ...
#[cfg(target_pointer_width = "64")] pub const MULTIPLIER: usize = 6364136223846793005;
random_line_split
state.rs
// Copyright 2015-2017 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 lat...
declare_test!{GeneralStateTest_stAttackTest, "GeneralStateTests/stAttackTest/"} declare_test!{GeneralStateTest_stBadOpcodeTest, "GeneralStateTests/stBadOpcode/"} declare_test!{GeneralStateTest_stCallCodes, "GeneralStateTests/stCallCodes/"} declare_test!{GeneralStateTest_stCallDelegateCodesCallCodeHomestead, "Gene...
{ json_chain_test(json_data) }
identifier_body
state.rs
// Copyright 2015-2017 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 lat...
let transaction: SignedTransaction = multitransaction.select(&state.indexes).into(); let result = || -> Result<_, EvmTestError> { Ok(EvmTestClient::from_pod_state(spec, pre.clone())? .transact(&env, transaction, trace::NoopVMTracer)) }; match result() { Err(err) => { print...
random_line_split
state.rs
// Copyright 2015-2017 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 lat...
(json_data: &[u8]) -> Vec<String> { json_chain_test(json_data) } declare_test!{GeneralStateTest_stAttackTest, "GeneralStateTests/stAttackTest/"} declare_test!{GeneralStateTest_stBadOpcodeTest, "GeneralStateTests/stBadOpcode/"} declare_test!{GeneralStateTest_stCallCodes, "GeneralStateTests/stCallCodes/"} declare...
do_json_test
identifier_name
lib.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // Various functions that seem to get used a lot #![feature(test)] extern crate test; use std::ops; pub mod bigint; /// Find the sum of a Vec pub fn sum<T: Copy + ops::Add<T, Output=T>>(v: &[T], initial: T) -> ...
(p: u64) -> bool { let n = (1.0 + (1.0 + 24.0*(p as f64)).sqrt()) / 6.0; n == n.floor() } /// Determine whether a number is a hexagonal number pub fn is_hexagonal(p: u64) -> bool { let n = (1.0 + (1.0 + 8.0*(p as f64)).sqrt()) / 4.0; n == n.floor() } /// Determine whether a number is prime pub fn is_p...
is_pentagonal
identifier_name
lib.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // Various functions that seem to get used a lot #![feature(test)] extern crate test; use std::ops; pub mod bigint; /// Find the sum of a Vec pub fn sum<T: Copy + ops::Add<T, Output=T>>(v: &[T], initial: T) -> ...
/// Determine whether a number is a pentagonal number pub fn is_pentagonal(p: u64) -> bool { let n = (1.0 + (1.0 + 24.0*(p as f64)).sqrt()) / 6.0; n == n.floor() } /// Determine whether a number is a hexagonal number pub fn is_hexagonal(p: u64) -> bool { let n = (1.0 + (1.0 + 8.0*(p as f64)).sqrt()) / 4.0...
/// Determine whether a number is a triangular number pub fn is_triangular(p: u64) -> bool { let n = (-1.0 + (1.0 + 8.0*(p as f64)).sqrt()) / 2.0; n == n.floor() && n > 0.0 }
random_line_split
lib.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // Various functions that seem to get used a lot #![feature(test)] extern crate test; use std::ops; pub mod bigint; /// Find the sum of a Vec pub fn sum<T: Copy + ops::Add<T, Output=T>>(v: &[T], initial: T) -> ...
/// Determine whether a number is a pentagonal number pub fn is_pentagonal(p: u64) -> bool { let n = (1.0 + (1.0 + 24.0*(p as f64)).sqrt()) / 6.0; n == n.floor() } /// Determine whether a number is a hexagonal number pub fn is_hexagonal(p: u64) -> bool { let n = (1.0 + (1.0 + 8.0*(p as f64)).sqrt()) / 4....
{ let n = (-1.0 + (1.0 + 8.0*(p as f64)).sqrt()) / 2.0; n == n.floor() && n > 0.0 }
identifier_body
lib.rs
// Copyright 2016 Peter Beard // Distributed under the GNU GPL v2. For full terms, see the LICENSE file. // // Various functions that seem to get used a lot #![feature(test)] extern crate test; use std::ops; pub mod bigint; /// Find the sum of a Vec pub fn sum<T: Copy + ops::Add<T, Output=T>>(v: &[T], initial: T) -> ...
digits[d as usize] = true; value *= 10; } for i in l..(k + 1) { if!digits[i as usize] { return false; } } for i in 0..l { if digits[i as usize] { return false; } } true } #[cfg(test)] mod tests { use super::*; use ...
{ return false; }
conditional_block
resolution.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/. */ //! Resolution values: //! //! https://drafts.csswg.org/css-values/#resolution use std::fmt::{self, Write}; use s...
(CSSFloat); impl Resolution { /// Returns this resolution value as dppx. #[inline] pub fn dppx(&self) -> CSSFloat { self.0 } } impl ToComputedValue for specified::Resolution { type ComputedValue = Resolution; #[inline] fn to_computed_value(&self, _: &Context) -> Self::ComputedValu...
Resolution
identifier_name
resolution.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/. */ //! Resolution values: //! //! https://drafts.csswg.org/css-values/#resolution use std::fmt::{self, Write}; use s...
} impl ToComputedValue for specified::Resolution { type ComputedValue = Resolution; #[inline] fn to_computed_value(&self, _: &Context) -> Self::ComputedValue { Resolution(self.to_dppx()) } #[inline] fn from_computed_value(computed: &Self::ComputedValue) -> Self { specified::R...
{ self.0 }
identifier_body
resolution.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/. */ //! Resolution values: //! //! https://drafts.csswg.org/css-values/#resolution use std::fmt::{self, Write}; use s...
impl ToComputedValue for specified::Resolution { type ComputedValue = Resolution; #[inline] fn to_computed_value(&self, _: &Context) -> Self::ComputedValue { Resolution(self.to_dppx()) } #[inline] fn from_computed_value(computed: &Self::ComputedValue) -> Self { specified::Resol...
self.0 } }
random_line_split
fixi.rs
use { fixity::{ fixity::Builder, path::Path, value::{Key, Value}, Config, Fixity, }, std::path::PathBuf, structopt::StructOpt, }; #[derive(Debug, StructOpt)] #[structopt(name = "fixi", about = "fixity content management")] struct Opt { #[structopt(flatten)] fixi_...
(fixi: Fixity, path: Path) -> Result<(), Error> { let stdout = tokio::io::stdout(); let bytes = fixi.bytes(path)?; let _ = bytes.read(stdout).await?; Ok(()) } async fn cmd_bytes_put(fixi: Fixity, path: Path, commit: bool) -> Result<(), Error> { if path.len() == 0 { return Err(Error::User( ...
cmd_bytes_get
identifier_name
fixi.rs
use { fixity::{ fixity::Builder, path::Path, value::{Key, Value}, Config, Fixity, }, std::path::PathBuf, structopt::StructOpt, }; #[derive(Debug, StructOpt)] #[structopt(name = "fixi", about = "fixity content management")] struct Opt { #[structopt(flatten)] fixi_...
Ls { #[structopt(short = "s", long = "start", parse(try_from_str = Key::from_cli_str))] start: Option<Key>, #[structopt(short = "e", long = "end", parse(try_from_str = Key::from_cli_str))] end: Option<Key>, }, } async fn cmd_map(fixi: Fixity, path: Path, subcmd: MapSubcmd) -> Res...
value: Value, },
random_line_split
fixi.rs
use { fixity::{ fixity::Builder, path::Path, value::{Key, Value}, Config, Fixity, }, std::path::PathBuf, structopt::StructOpt, }; #[derive(Debug, StructOpt)] #[structopt(name = "fixi", about = "fixity content management")] struct Opt { #[structopt(flatten)] fixi_...
let stdin = tokio::io::stdin(); let bytes = fixi.bytes(path)?; let _ = bytes.write(stdin).await?; if commit { let addr = bytes.commit().await?; println!("{:?}", addr); } else { println!("bytes staged"); } Ok(()) }
{ if path.len() == 0 { return Err(Error::User( "cannot get/put bytes to root of fixity repository".to_owned(), )); } // TODO: tokio docs recommend against this for interactive uses[1], so this // should be fixed eventually - when interactivity is prioritized a bit more. /...
identifier_body
subscription.rs
//! Helper types for converting types to `Result<T, FieldError<E>>`. //! //! Used in `#[graphql_subscription]` macros to convert result type aliases on //! subscription handlers to a concrete return type. use futures::Stream; use crate::{FieldError, GraphQLValue, IntoFieldError, ScalarValue}; /// Trait for wrapping ...
; /// This trait is used in `juniper::graphql_subscription` macro to get stream's /// item type that implements `GraphQLValue` from type alias provided /// by user. pub trait ExtractTypeFromStream<T, S> where S: ScalarValue, { /// Stream's return Value that will be returned if /// no errors occured. Is use...
ResultStreamResult
identifier_name
subscription.rs
//! Helper types for converting types to `Result<T, FieldError<E>>`. //! //! Used in `#[graphql_subscription]` macros to convert result type aliases on //! subscription handlers to a concrete return type. use futures::Stream; use crate::{FieldError, GraphQLValue, IntoFieldError, ScalarValue}; /// Trait for wrapping ...
/// of values. pub struct StreamItem; /// This struct is used in `ExtractTypeFromStream` implementation for results /// with streams of values inside. pub struct StreamResult; /// This struct is used in `ExtractTypeFromStream` implementation for streams /// of results of values inside. pub struct ResultStreamItem; /...
/// This struct is used in `ExtractTypeFromStream` implementation for streams
random_line_split
threading.rs
use std::sync::mpsc::{Receiver as MpscReceiver, TryRecvError}; use std::thread::Builder as ThreadBuilder; use super::connection::Connection; use super::Status; use ::internal::Timer; use ::model::GuildId; pub fn start(guild_id: GuildId, rx: MpscReceiver<Status>)
fn runner(rx: &MpscReceiver<Status>) { let mut sender = None; let mut receiver = None; let mut connection = None; let mut timer = Timer::new(20); 'runner: loop { loop { match rx.try_recv() { Ok(Status::Connect(info)) => { connection = match ...
{ let name = format!("Serenity Voice (G{})", guild_id); ThreadBuilder::new() .name(name) .spawn(move || runner(&rx)) .expect(&format!("[Voice] Error starting guild: {:?}", guild_id)); }
identifier_body
threading.rs
use std::sync::mpsc::{Receiver as MpscReceiver, TryRecvError}; use std::thread::Builder as ThreadBuilder; use super::connection::Connection; use super::Status; use ::internal::Timer; use ::model::GuildId; pub fn start(guild_id: GuildId, rx: MpscReceiver<Status>) { let name = format!("Serenity Voice (G{})", guild_i...
let mut sender = None; let mut receiver = None; let mut connection = None; let mut timer = Timer::new(20); 'runner: loop { loop { match rx.try_recv() { Ok(Status::Connect(info)) => { connection = match Connection::new(info) { ...
random_line_split
threading.rs
use std::sync::mpsc::{Receiver as MpscReceiver, TryRecvError}; use std::thread::Builder as ThreadBuilder; use super::connection::Connection; use super::Status; use ::internal::Timer; use ::model::GuildId; pub fn
(guild_id: GuildId, rx: MpscReceiver<Status>) { let name = format!("Serenity Voice (G{})", guild_id); ThreadBuilder::new() .name(name) .spawn(move || runner(&rx)) .expect(&format!("[Voice] Error starting guild: {:?}", guild_id)); } fn runner(rx: &MpscReceiver<Status>) { let mut sender...
start
identifier_name
config.rs
// CITA // Copyright 2016-2017 Cryptape Technologies LLC. // 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 License, or (at your option) any // later version. // Th...
() -> Self { let toml = r#" id_card=0 port = 40000 max_peer = 1 [[peers]] id_card=0 ip = "127.0.0.1" port = 40000 "#; toml::decode_str(toml).unwrap() } } #[cfg(test)] mod test { use super::NetConfig; ...
test_config
identifier_name
config.rs
// CITA // Copyright 2016-2017 Cryptape Technologies LLC. // 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 License, or (at your option) any // later version. // Th...
} #[cfg(test)] mod test { use super::NetConfig; extern crate toml; #[test] fn basics() { let toml = r#" port = 40000 max_peer = 2 [[peers]] ip = "127.0.0.1" port = 40001 [[peers]] ip = "127.0.0.1" ...
{ let toml = r#" id_card=0 port = 40000 max_peer = 1 [[peers]] id_card=0 ip = "127.0.0.1" port = 40000 "#; toml::decode_str(toml).unwrap() }
identifier_body
config.rs
// CITA // Copyright 2016-2017 Cryptape Technologies LLC. // 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 License, or (at your option) any // later version. // Th...
id_card=0 port = 40000 max_peer = 1 [[peers]] id_card=0 ip = "127.0.0.1" port = 40000 "#; toml::decode_str(toml).unwrap() } } #[cfg(test)] mod test { use super::NetConfig; extern crate toml; #[test] ...
let toml = r#"
random_line_split
cci_nested_lib.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 ...
} fail!(); } #[inline] pub fn new_int_alist<B:Copy>() -> alist<int, B> { fn eq_int(&&a: int, &&b: int) -> bool { a == b } return alist {eq_fn: eq_int, data: @mut ~[]}; } #[inline] pub fn new_int_alist_2<B:Copy>() -> alist<int, B> { #[inline] fn eq_int(&&a: int, &&b: int) -> bool { a == b } ...
{ return entry.value; }
conditional_block
cci_nested_lib.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 ...
#[inline] pub fn new_int_alist<B:Copy>() -> alist<int, B> { fn eq_int(&&a: int, &&b: int) -> bool { a == b } return alist {eq_fn: eq_int, data: @mut ~[]}; } #[inline] pub fn new_int_alist_2<B:Copy>() -> alist<int, B> { #[inline] fn eq_int(&&a: int, &&b: int) -> bool { a == b } return alist {eq_fn...
{ let eq_fn = lst.eq_fn; for lst.data.each |entry| { if eq_fn(entry.key, k) { return entry.value; } } fail!(); }
identifier_body
cci_nested_lib.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 ...
<A:Copy,B:Copy>(lst: alist<A,B>, k: A, v: B) { lst.data.push(Entry{key:k, value:v}); } pub fn alist_get<A:Copy,B:Copy>(lst: alist<A,B>, k: A) -> B { let eq_fn = lst.eq_fn; for lst.data.each |entry| { if eq_fn(entry.key, k) { return entry.value; } } fail!(); } #[inline] pub fn new_int_alist...
alist_add
identifier_name
cci_nested_lib.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
#[legacy_modes]; pub struct Entry<A,B> {key: A, value: B} pub struct alist<A,B> { eq_fn: @fn(A,A) -> bool, data: @mut ~[Entry<A,B>] } pub fn alist_add<A:Copy,B:Copy>(lst: alist<A,B>, k: A, v: B) { lst.data.push(Entry{key:k, value:v}); } pub fn alist_get<A:Copy,B:Copy>(lst: alist<A,B>, k: A) -> B { let eq_fn...
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms.
random_line_split
issue-2311-2.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 ...
} fn foo<A:Copy>(b: A) -> foo<A> { foo { x: b } } pub fn main() { }
{ fail!(); }
identifier_body
issue-2311-2.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 ...
} fn foo<A:Copy>(b: A) -> foo<A> { foo { x: b } } pub fn main() { }
pub fn bar<B,C:clam<A>>(&self, c: C) -> B { fail!(); }
random_line_split
issue-2311-2.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 ...
() { }
main
identifier_name
cstool.rs
//! Disassembles machine code use std::fmt::Display; use std::fs::File; use std::io; use std::io::prelude::*; use std::process::exit; use std::str::FromStr; use capstone::{self, prelude::*, Arch, Endian, EnumList, ExtraMode, Mode}; use clap::{App, Arg, ArgGroup}; use log::{debug, info}; const DEFAULT_CAPACITY: usize...
i.op_str().unwrap_or("") ) .is_ok(); if show_detail { let detail = cs.insn_detail(i).expect("Failed to get insn detail"); let output: &[(&str, String)] = &[ ("insn id:", format!("{:?}", i.id().0)), ("read regs:", reg_names(&cs,...
{ info!("Got {} bytes", code.len()); let mut cs = Capstone::new_raw(arch, mode, extra_mode, endian).expect_exit(); if show_detail { cs.set_detail(true).expect("Failed to set detail"); } let stdout = io::stdout(); let mut handle = stdout.lock(); for i in cs.disasm_all(code, addr).e...
identifier_body
cstool.rs
//! Disassembles machine code use std::fmt::Display; use std::fs::File; use std::io; use std::io::prelude::*; use std::process::exit; use std::str::FromStr; use capstone::{self, prelude::*, Arch, Endian, EnumList, ExtraMode, Mode}; use clap::{App, Arg, ArgGroup}; use log::{debug, info}; const DEFAULT_CAPACITY: usize...
() { // Lowercase arches let _arches: Vec<String> = Arch::variants() .iter() .map(|x| format!("{}", x).to_lowercase()) .collect(); let arches: Vec<&str> = _arches.iter().map(|x| x.as_str()).collect(); // Lowercase modes let _modes: Vec<String> = Mode::variants() .iter() ...
main
identifier_name
cstool.rs
//! Disassembles machine code use std::fmt::Display; use std::fs::File; use std::io; use std::io::prelude::*; use std::process::exit; use std::str::FromStr; use capstone::{self, prelude::*, Arch, Endian, EnumList, ExtraMode, Mode}; use clap::{App, Arg, ArgGroup}; use log::{debug, info}; const DEFAULT_CAPACITY: usize...
.get_matches(); let direct_input_bytes: Vec<u8> = if let Some(file_path) = matches.value_of(FILE_ARG) { let mut file = File::open(file_path).expect_exit(); let capacity = match file.metadata() { Err(_) => DEFAULT_CAPACITY, Ok(metadata) => metadata.len() as usize, ...
.arg(CODE_ARG) .required(true), )
random_line_split
main.rs
extern crate rusoto; use std::{thread, time}; use rusoto::rds::{RdsClient, CreateDBInstanceMessage, DescribeDBInstancesMessage}; use rusoto::{DefaultCredentialsProvider, Region}; use rusoto::default_tls_client; fn
() { let database_instance_name = "rusototester2"; let credentials = DefaultCredentialsProvider::new().unwrap(); // Security groups in the default VPC will need modification to let you access this from the internet: let rds_client = RdsClient::new(default_tls_client().unwrap(), credentials, Region::Us...
main
identifier_name
main.rs
extern crate rusoto; use std::{thread, time}; use rusoto::rds::{RdsClient, CreateDBInstanceMessage, DescribeDBInstancesMessage}; use rusoto::{DefaultCredentialsProvider, Region}; use rusoto::default_tls_client; fn main()
println!("Going to make the database instance."); let db_creation_result = rds_client.create_db_instance(&create_db_instance_request).unwrap(); println!("Created! \n\n{:?}", db_creation_result); // The endpoint isn't available until the DB is created, let's wait for it: let describe_instances_requ...
{ let database_instance_name = "rusototester2"; let credentials = DefaultCredentialsProvider::new().unwrap(); // Security groups in the default VPC will need modification to let you access this from the internet: let rds_client = RdsClient::new(default_tls_client().unwrap(), credentials, Region::UsEas...
identifier_body
main.rs
extern crate rusoto; use std::{thread, time}; use rusoto::rds::{RdsClient, CreateDBInstanceMessage, DescribeDBInstancesMessage}; use rusoto::{DefaultCredentialsProvider, Region}; use rusoto::default_tls_client; fn main() { let database_instance_name = "rusototester2"; let credentials = DefaultCredentialsProv...
backup_retention_period: Some(0), db_instance_identifier: database_instance_name.to_string(), db_instance_class: "db.t2.micro".to_string(), // name and login details should match `.env` in rusoto-rocket master_user_password: Some("TotallySecurePassword501".to_string()), m...
random_line_split
main.rs
extern crate rusoto; use std::{thread, time}; use rusoto::rds::{RdsClient, CreateDBInstanceMessage, DescribeDBInstancesMessage}; use rusoto::{DefaultCredentialsProvider, Region}; use rusoto::default_tls_client; fn main() { let database_instance_name = "rusototester2"; let credentials = DefaultCredentialsProv...
, None => { println!("Waiting for db to be available..."); thread::sleep(ten_seconds); continue; }, }; } let endpoint_address = endpoint.address.unwrap(); let endpoint_port = endpoint.port.unwrap(); println!("\n\nendpoint: ...
{ endpoint = endpoint_result.clone(); break; }
conditional_block
docker.rs
use crate::{command::studio::enter::{ARTIFACT_PATH_ENVVAR, CERT_PATH_ENVVAR, SSL_CERT_FILE_ENVVAR}, common::ui::UI, error::{Error, Result}, hcore::{crypto::CACHE_KEY_PATH_ENV_VAR, ...
(windows_base_tag: Option<&str>, target: target::PackageTarget) -> String { let version: Vec<&str> = VERSION.split('/').collect(); let (img, tag) = if let Some(t) = windows_base_tag { (DOCKER_WINDOWS_IMAGE, format!("{}-{}", t, version[0])) } else { (DOCKER_IMAGE, version[0].to_string()) ...
image_identifier
identifier_name
docker.rs
use crate::{command::studio::enter::{ARTIFACT_PATH_ENVVAR, CERT_PATH_ENVVAR, SSL_CERT_FILE_ENVVAR}, common::ui::UI, error::{Error, Result}, hcore::{crypto::CACHE_KEY_PATH_ENV_VAR, ...
package::target}}; habitat_core::locked_env_var!(SSL_CERT_FILE, lock_ssl_cert_file_env_var); #[test] #[cfg(feature = "supported_targets")] fn retrieve_supported_image_identifier() { assert_eq!(image_identifier(None, target::X86_64_DARWIN), format!("{}...
use crate::{command::studio::enter::SSL_CERT_FILE_ENVVAR, hcore::{fs::CACHE_SSL_PATH,
random_line_split
docker.rs
use crate::{command::studio::enter::{ARTIFACT_PATH_ENVVAR, CERT_PATH_ENVVAR, SSL_CERT_FILE_ENVVAR}, common::ui::UI, error::{Error, Result}, hcore::{crypto::CACHE_KEY_PATH_ENV_VAR, ...
fn pull_image(docker_cmd: &Path, image: &str) -> Result<()> { let mut cmd = Command::new(docker_cmd); cmd.arg("pull") .arg(image) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()); debug!("Running command: {:?}", cmd); let result = cmd.spawn() .expect("Docker com...
{ let mut cmd = Command::new(docker_cmd); cmd.arg("version").arg("--format='{{.Server.Os}}'"); debug!("Running command: {:?}", cmd); let result = cmd.output().expect("Docker command failed to spawn"); String::from_utf8_lossy(&result.stdout).contains("windows") }
identifier_body
extra.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/. */ //! Code for managing the layout data in the DOM. use util::{PrivateLayoutData, LayoutDataAccess, LayoutDataWrapp...
}
random_line_split
extra.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/. */ //! Code for managing the layout data in the DOM. use util::{PrivateLayoutData, LayoutDataAccess, LayoutDataWrapp...
(&self, chan: LayoutChan) { for n in self.traverse_preorder() { n.initialize_layout_data(chan.clone()); } } }
initialize_style_for_subtree
identifier_name
extra.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/. */ //! Code for managing the layout data in the DOM. use util::{PrivateLayoutData, LayoutDataAccess, LayoutDataWrapp...
/// Resets layout data and styles for a Node tree. /// /// FIXME(pcwalton): Do this as part of fragment building instead of in a traversal. fn initialize_style_for_subtree(&self, chan: LayoutChan) { for n in self.traverse_preorder() { n.initialize_layout_data(chan.clone()); ...
{ let mut layout_data_ref = self.mutate_layout_data(); match *layout_data_ref { None => { *layout_data_ref = Some(LayoutDataWrapper { chan: Some(chan), shared_data: SharedLayoutData { style: None }, data: box Private...
identifier_body
macros.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/. */ /// See docs of the `procedural-masquerade` crate. define_invoke_proc_macro!(cssparser_internal__invoke_proc_macro...
a>(buffer: &'a mut [u8], input: &'a str) -> Option<&'a str> { if let Some(buffer) = buffer.get_mut(..input.len()) { if let Some(first_uppercase) = input.bytes().position(|byte| matches!(byte, b'A'...b'Z')) { buffer.copy_from_slice(input.as_bytes()); ::std::ascii::AsciiExt::make_ascii...
nternal__to_lowercase<'
identifier_name
macros.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/. */ /// See docs of the `procedural-masquerade` crate. define_invoke_proc_macro!(cssparser_internal__invoke_proc_macro...
#[cfg(feature = "dummy_match_byte")] macro_rules! match_byte { ($value:expr, $($rest:tt)* ) => { match $value { $( $rest )+ } }; }
if let Some(buffer) = buffer.get_mut(..input.len()) { if let Some(first_uppercase) = input.bytes().position(|byte| matches!(byte, b'A'...b'Z')) { buffer.copy_from_slice(input.as_bytes()); ::std::ascii::AsciiExt::make_ascii_lowercase(&mut buffer[first_uppercase..]); // `bu...
identifier_body
macros.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/. */ /// See docs of the `procedural-masquerade` crate. define_invoke_proc_macro!(cssparser_internal__invoke_proc_macro...
( $input:expr, $( $match_body:tt )* ) => { { cssparser_internal__invoke_proc_macro! { cssparser_internal__assert_ascii_lowercase__max_len!( $( $match_body )* ) } { // MAX_LENGTH is generated by cssparser_internal__assert_ascii_lowercase__m...
/// # fn parse_hsla(_: RangeFull) -> Result<(), String> { Ok(()) } /// ``` #[macro_export] macro_rules! match_ignore_ascii_case {
random_line_split
macros.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/. */ /// See docs of the `procedural-masquerade` crate. define_invoke_proc_macro!(cssparser_internal__invoke_proc_macro...
lse { // Input is already lower-case Some(input) } } else { // Input is longer than buffer, which has the length of the longest expected string: // none of the expected strings would match. None } } #[cfg(feature = "dummy_match_byte")] macro_rules! match_...
buffer.copy_from_slice(input.as_bytes()); ::std::ascii::AsciiExt::make_ascii_lowercase(&mut buffer[first_uppercase..]); // `buffer` was initialized to a copy of `input` (which is &str so well-formed UTF-8) // then lowercased (which preserves UTF-8 well-formedness) ...
conditional_block
thrift_build.rs
// @generated by autocargo use std::env; use std::fs; use std::path::Path; use thrift_compiler::Config; #[rustfmt::skip] fn main() { // Rerun if this gets rewritten. println!("cargo:rerun-if-changed=thrift_build.rs"); let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided"); let out_di...
let include_srcs = vec![ ]; conf.include_srcs(include_srcs); conf }; conf .run(&[ "eden_config.thrift" ]) .expect("Failed while running thrift compilation"); }
{ conf.options(options); }
conditional_block
thrift_build.rs
// @generated by autocargo use std::env; use std::fs; use std::path::Path; use thrift_compiler::Config; #[rustfmt::skip] fn main()
.canonicalize() .expect("Failed to canonicalize base_path"); // TODO: replace canonicalize() with std::path::absolute() when // https://github.com/rust-lang/rust/pull/91673 is available (~Rust 1.60) // and remove this block. #[cfg(windows)] let base_path = P...
{ // Rerun if this gets rewritten. println!("cargo:rerun-if-changed=thrift_build.rs"); let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided"); let out_dir: &Path = out_dir.as_ref(); fs::write( out_dir.join("cratemap"), "eden_config crate", ).expect("Failed to wr...
identifier_body
thrift_build.rs
// @generated by autocargo use std::env; use std::fs; use std::path::Path; use thrift_compiler::Config; #[rustfmt::skip] fn main() { // Rerun if this gets rewritten. println!("cargo:rerun-if-changed=thrift_build.rs"); let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided"); let out_di...
let include_srcs = vec![ ]; conf.include_srcs(include_srcs); conf }; conf .run(&[ "eden_config.thrift" ]) .expect("Failed while running thrift compilation"); }
conf.options(options); }
random_line_split
thrift_build.rs
// @generated by autocargo use std::env; use std::fs; use std::path::Path; use thrift_compiler::Config; #[rustfmt::skip] fn
() { // Rerun if this gets rewritten. println!("cargo:rerun-if-changed=thrift_build.rs"); let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided"); let out_dir: &Path = out_dir.as_ref(); fs::write( out_dir.join("cratemap"), "eden_config crate", ).expect("Failed to...
main
identifier_name
issue-1049.rs
// Test overlong function signature pub unsafe fn reborrow_mut( &mut X: Abcde, ) -> Handle<NodeRef<marker::Mut, K, V, NodeType>, HandleType> { } pub fn merge( mut X: Abcdef, ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> { } impl Handle { pub fn merge( a: Abcd, ) -...
} // Long function without return type that should not be reformated. fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {} fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) { } fn veeeeeeeeeeeeeeeeeeeeeeery_long_name( ...
{ }
identifier_body
issue-1049.rs
// Test overlong function signature pub unsafe fn reborrow_mut( &mut X: Abcde, ) -> Handle<NodeRef<marker::Mut, K, V, NodeType>, HandleType> { } pub fn
( mut X: Abcdef, ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> { } impl Handle { pub fn merge( a: Abcd, ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> { } } // Long function without return type that should not be reformated. fn veeeeee...
merge
identifier_name
issue-1049.rs
// Test overlong function signature pub unsafe fn reborrow_mut( &mut X: Abcde, ) -> Handle<NodeRef<marker::Mut, K, V, NodeType>, HandleType> { }
impl Handle { pub fn merge( a: Abcd, ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> { } } // Long function without return type that should not be reformated. fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {} fn veeeee...
pub fn merge( mut X: Abcdef, ) -> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::Edge> { }
random_line_split
type_.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn array_length(&self) -> usize { unsafe { llvm::LLVMGetArrayLength(self.to_ref()) as usize } } pub fn field_types(&self) -> Vec<Type> { unsafe { let n_elts = llvm::LLVMCountStructElementTypes(self.to_ref()) as usize; if n_elts == 0 { ...
{ unsafe { llvm::LLVMGetVectorSize(self.to_ref()) as usize } }
identifier_body
type_.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
args.len() as c_uint, False)) } pub fn variadic_func(args: &[Type], ret: &Type) -> Type { let vec : &[TypeRef] = unsafe { mem::transmute(args) }; ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(), args.len() as c_uint, Tr...
pub fn func(args: &[Type], ret: &Type) -> Type { let vec : &[TypeRef] = unsafe { mem::transmute(args) }; ty!(llvm::LLVMFunctionType(ret.to_ref(), vec.as_ptr(),
random_line_split
type_.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(&self) -> Type { unsafe { Type::from_ref(llvm::LLVMGetElementType(self.to_ref())) } } /// Return the number of elements in `self` if it is a LLVM vector type. pub fn vector_length(&self) -> usize { unsafe { llvm::LLVMGetVectorSize(self.to_ref()) as usize ...
element_type
identifier_name
method-on-struct.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
// lldb-command:print arg1 // lldb-check:[...]$13 = -9 // lldb-command:print arg2 // lldb-check:[...]$14 = -10 // lldb-command:continue #![feature(box_syntax)] #![omit_gdb_pretty_printer_section] #[derive(Copy)] struct Struct { x: int } impl Struct { fn self_by_ref(&self, arg1: int, arg2: int) -> int { ...
// lldb-command:continue // OWNED MOVED // lldb-command:print *self // lldb-check:[...]$12 = Struct { x: 200 }
random_line_split
method-on-struct.rs
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(self: Box<Struct>, arg1: int, arg2: int) -> int { zzz(); // #break self.x + arg1 + arg2 } } fn main() { let stack = Struct { x: 100 }; let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); let owned = box Struct { x: 200 }; let _ = owned.self_by_ref(-5, -6); ...
self_owned
identifier_name
atomic-access-bool.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { unsafe { assert_eq!(*ATOMIC.get_mut(), false); ATOMIC.store(true, SeqCst); assert_eq!(*ATOMIC.get_mut(), true); ATOMIC.fetch_or(false, SeqCst); assert_eq!(*ATOMIC.get_mut(), true); ATOMIC.fetch_and(false, SeqCst); assert_eq!(*ATOMIC.get_mut(), false); ...
main
identifier_name
atomic-access-bool.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
{ unsafe { assert_eq!(*ATOMIC.get_mut(), false); ATOMIC.store(true, SeqCst); assert_eq!(*ATOMIC.get_mut(), true); ATOMIC.fetch_or(false, SeqCst); assert_eq!(*ATOMIC.get_mut(), true); ATOMIC.fetch_and(false, SeqCst); assert_eq!(*ATOMIC.get_mut(), false); ...
identifier_body
atomic-access-bool.rs
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
static mut ATOMIC: AtomicBool = ATOMIC_BOOL_INIT; fn main() { unsafe { assert_eq!(*ATOMIC.get_mut(), false); ATOMIC.store(true, SeqCst); assert_eq!(*ATOMIC.get_mut(), true); ATOMIC.fetch_or(false, SeqCst); assert_eq!(*ATOMIC.get_mut(), true); ATOMIC.fetch_and(false,...
use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; use std::sync::atomic::Ordering::*;
random_line_split
font.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="font" sub_properties="font-style ...
_ => { try!(write!(dest, "/")); try!(height.to_css(dest)); } } } try!(write!(dest, " ")); self.font_family.to_css(dest) } } </%helpers:shorthand>
{ if let DeclaredValue::Value(ref style) = *self.font_style { try!(style.to_css(dest)); try!(write!(dest, " ")); } if let DeclaredValue::Value(ref variant) = *self.font_variant { try!(variant.to_css(dest)); try!(write!(...
identifier_body
font.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="font" sub_properties="font-style ...
<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { if let DeclaredValue::Value(ref style) = *self.font_style { try!(style.to_css(dest)); try!(write!(dest, " ")); } if let DeclaredValue::Value(ref variant) = *self.font_variant { ...
to_css_declared
identifier_name
font.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="font" sub_properties="font-style ...
} size = Some(try!(font_size::parse(context, input))); break } #[inline] fn count<T>(opt: &Option<T>) -> u8 { if opt.is_some() { 1 } else { 0 } } if size.is_none() || (count(&style) + count(&weight) + count(&variant) + nb_normals) ...
{ variant = Some(value); continue }
conditional_block
font.mako.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ <%namespace name="helpers" file="/helpers.mako.rs" /> <%helpers:shorthand name="font" sub_properties="font-style ...
</%helpers:shorthand>
random_line_split