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 |
|---|---|---|---|---|
os_str.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 ... | use vec::Vec;
use str;
use string::String;
use mem;
#[derive(Clone, Hash)]
pub struct Buf {
pub inner: Vec<u8>
}
pub struct Slice {
pub inner: [u8]
}
impl Debug for Slice {
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.to_string_lossy().fmt(formatter)
}
}
imp... |
use borrow::Cow;
use fmt::{self, Debug}; | random_line_split |
os_str.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 ... | (&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.as_slice().fmt(formatter)
}
}
impl Buf {
pub fn from_string(s: String) -> Buf {
Buf { inner: s.into_bytes() }
}
pub fn from_str(s: &str) -> Buf {
Buf { inner: s.as_bytes().to_vec() }
}
pub fn as_s... | fmt | identifier_name |
get.rs | use super::Block;
pub struct GetBlock<'a> {
inner: &'a Block,
get_pos: usize,
}
pub struct GetIter<'a> {
blocks: &'a [Block],
idx: usize,
// offset of the first u8 in the first block
init_pos: usize,
}
#[inline]
pub(super) fn iter<'a>(blocks: &'a [Block], init_pos: usize) -> GetIter<'a> {
... |
} else if!inner.is_empty() {
return Some(GetBlock::new(inner));
}
}
None
}
}
| {
return Some(GetBlock::with_index(inner, pos));
} | conditional_block |
get.rs | use super::Block;
pub struct GetBlock<'a> {
inner: &'a Block,
get_pos: usize,
}
pub struct GetIter<'a> {
blocks: &'a [Block],
idx: usize,
// offset of the first u8 in the first block
init_pos: usize,
}
| #[inline]
pub(super) fn iter<'a>(blocks: &'a [Block], init_pos: usize) -> GetIter<'a> {
GetIter {
blocks,
idx: 0,
init_pos,
}
}
impl<'a> GetBlock<'a> {
#[inline]
fn new(inner: &'a Block) -> Self {
GetBlock {
inner,
get_pos: inner.read_pos(),
... | random_line_split | |
get.rs | use super::Block;
pub struct GetBlock<'a> {
inner: &'a Block,
get_pos: usize,
}
pub struct GetIter<'a> {
blocks: &'a [Block],
idx: usize,
// offset of the first u8 in the first block
init_pos: usize,
}
#[inline]
pub(super) fn iter<'a>(blocks: &'a [Block], init_pos: usize) -> GetIter<'a> {
... | (inner: &'a Block) -> Self {
GetBlock {
inner,
get_pos: inner.read_pos(),
}
}
#[inline]
fn with_index(inner: &'a Block, index: usize) -> Self {
GetBlock {
inner,
get_pos: inner.read_pos() + index,
}
}
#[inline]
pub... | new | identifier_name |
get.rs | use super::Block;
pub struct GetBlock<'a> {
inner: &'a Block,
get_pos: usize,
}
pub struct GetIter<'a> {
blocks: &'a [Block],
idx: usize,
// offset of the first u8 in the first block
init_pos: usize,
}
#[inline]
pub(super) fn iter<'a>(blocks: &'a [Block], init_pos: usize) -> GetIter<'a> {
... |
#[inline]
fn with_index(inner: &'a Block, index: usize) -> Self {
GetBlock {
inner,
get_pos: inner.read_pos() + index,
}
}
#[inline]
pub fn read_pos(&self) -> usize {
self.get_pos
}
#[inline]
pub fn write_pos(&self) -> usize {
s... | {
GetBlock {
inner,
get_pos: inner.read_pos(),
}
} | identifier_body |
url.rs | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 ... | {
obj: CFURLRef,
}
impl Drop for CFURL {
fn drop(&mut self) {
unsafe {
CFRelease(self.as_CFTypeRef())
}
}
}
impl TCFType<CFURLRef> for CFURL {
#[inline]
fn as_concrete_TypeRef(&self) -> CFURLRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(... | CFURL | identifier_name |
url.rs | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! A URL type for ... | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
// | random_line_split | |
one.rs | #![feature(core, zero_one)]
extern crate core;
#[cfg(test)]
mod tests {
use core::num::One;
// pub trait Zero {
// /// The "zero" (usually, additive identity) for this type.
// fn zero() -> Self;
// }
// pub trait One {
// /// The "one" (usually, multiplicative identity) for t... | () {
let value: T = T::one();
assert_eq!(value, 0x0001);
}
}
| one_test1 | identifier_name |
one.rs | #![feature(core, zero_one)]
extern crate core;
#[cfg(test)]
mod tests {
use core::num::One;
// pub trait Zero {
// /// The "zero" (usually, additive identity) for this type.
// fn zero() -> Self;
// }
// pub trait One {
// /// The "one" (usually, multiplicative identity) for t... | // )*)
// }
// zero_one_impl! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
// macro_rules! zero_one_impl_float {
// ($($t:ty)*) => ($(
// impl Zero for $t {
// #[inline]
// fn zero() -> Self { 0.0 }
// }
// impl One for $t... | // }
// impl One for $t {
// #[inline]
// fn one() -> Self { 1 }
// } | random_line_split |
one.rs | #![feature(core, zero_one)]
extern crate core;
#[cfg(test)]
mod tests {
use core::num::One;
// pub trait Zero {
// /// The "zero" (usually, additive identity) for this type.
// fn zero() -> Self;
// }
// pub trait One {
// /// The "one" (usually, multiplicative identity) for t... |
}
| {
let value: T = T::one();
assert_eq!(value, 0x0001);
} | identifier_body |
lib.rs | #![feature(asm, lang_items)]
#![no_std]
const GPFSEL2: u32 = 0x3F20_0008;
const GPSET0: u32 = 0x3F20_001C;
const GPCLR0: u32 = 0x3F20_0028;
const ARM_TIMER_CTL: u32 = 0x3F00_B408;
const ARM_TIMER_CNT: u32 = 0x3F00_B420;
const GPIO20: u32 = 1 << 20;
const GPIO21: u32 = 1 << 21;
const GPIO22: u32 = 1 << 22;
const TIM... |
#[no_mangle]
pub unsafe fn __aeabi_unwind_cpp_pr0() {
loop {}
}
#[lang = "eh_personality"]
extern fn eh_personality() {}
#[lang = "panic_fmt"]
extern fn panic_fmt() ->! {
loop {}
}
| {
unsafe { *(address as *mut u32) }
} | identifier_body |
lib.rs | #![feature(asm, lang_items)]
#![no_std]
const GPFSEL2: u32 = 0x3F20_0008;
const GPSET0: u32 = 0x3F20_001C;
const GPCLR0: u32 = 0x3F20_0028;
const ARM_TIMER_CTL: u32 = 0x3F00_B408;
const ARM_TIMER_CNT: u32 = 0x3F00_B420;
const GPIO20: u32 = 1 << 20;
const GPIO21: u32 = 1 << 21;
const GPIO22: u32 = 1 << 22;
const TIM... | () {
loop {}
}
#[lang = "eh_personality"]
extern fn eh_personality() {}
#[lang = "panic_fmt"]
extern fn panic_fmt() ->! {
loop {}
}
| __aeabi_unwind_cpp_pr0 | identifier_name |
lib.rs | #![feature(asm, lang_items)]
#![no_std]
const GPFSEL2: u32 = 0x3F20_0008;
const GPSET0: u32 = 0x3F20_001C;
const GPCLR0: u32 = 0x3F20_0028;
const ARM_TIMER_CTL: u32 = 0x3F00_B408;
const ARM_TIMER_CNT: u32 = 0x3F00_B420;
const GPIO20: u32 = 1 << 20;
const GPIO21: u32 = 1 << 21;
const GPIO22: u32 = 1 << 22;
const TIM... |
}
last_state.wrapping_add(TIMEOUT)
}
fn write_gpio_register(address: u32, value: u32) {
unsafe { *(address as *mut u32) = value };
}
fn read_gpio_register(address: u32) -> u32 {
unsafe { *(address as *mut u32) }
}
#[no_mangle]
pub unsafe fn __aeabi_unwind_cpp_pr0() {
loop {}
}
#[lang = "eh_pers... | {
break;
} | conditional_block |
lib.rs | #![feature(asm, lang_items)]
#![no_std]
const GPFSEL2: u32 = 0x3F20_0008;
const GPSET0: u32 = 0x3F20_001C;
const GPCLR0: u32 = 0x3F20_0028;
const ARM_TIMER_CTL: u32 = 0x3F00_B408;
const ARM_TIMER_CNT: u32 = 0x3F00_B420;
const GPIO20: u32 = 1 << 20;
const GPIO21: u32 = 1 << 21;
const GPIO22: u32 = 1 << 22;
const TIM... |
timer_state = wait_for_timeout(timer_state, TIMEOUT);
write_gpio_register(GPCLR0, GPIO20);
write_gpio_register(GPSET0, GPIO21);
timer_state = wait_for_timeout(timer_state, TIMEOUT);
}
}
fn wait_for_timeout(last_state: u32, timeout: u32) -> u32{
loop {
let current_time... | write_gpio_register(GPCLR0, GPIO21);
write_gpio_register(blue_gpio, GPIO22);
blue_gpio = if blue_gpio == GPSET0 { GPCLR0 } else { GPSET0 }; | random_line_split |
main.rs | // Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
#![deny(warnings)]
// Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to... | #![allow(clippy::match_ref_pats)]
// Subjective style.
#![allow(
clippy::len_without_is_empty,
clippy::redundant_field_names,
clippy::too_many_arguments
)]
// Default isn't as big a deal as people seem to think it is.
#![allow(clippy::new_without_default, clippy::new_ret_no_self)]
// Arc<Mutex> can be more clear ... | random_line_split | |
main.rs | // Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
#![deny(warnings)]
// Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to... | () {
let options = Options::from_args();
// When the request is executed, perform this operation
let operation = MockOperation {
op: Ok(Some(Operation::new())),
duration: None,
};
// The request our server expects to receive
let mut request = ExecuteRequest::new();
let mut digest = Digest::new()... | main | identifier_name |
align.rs | use internal;
#[repr(u32)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub enum Align {
Auto = 0,
FlexStart = 1,
Center = 2,
FlexEnd = 3,
Stretch = 4,
Baseline = 5,
SpaceBetween = 6, | }
impl From<Align> for internal::YGAlign {
fn from(a: Align) -> internal::YGAlign {
match a {
Align::Auto => internal::YGAlign::YGAlignAuto,
Align::FlexStart => internal::YGAlign::YGAlignFlexStart,
Align::Center => internal::YGAlign::YGAlignCenter,
Align::FlexEnd => internal::YGAlign::YGAlignFlexEnd,
... | SpaceAround = 7, | random_line_split |
align.rs | use internal;
#[repr(u32)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub enum Align {
Auto = 0,
FlexStart = 1,
Center = 2,
FlexEnd = 3,
Stretch = 4,
Baseline = 5,
SpaceBetween = 6,
SpaceAround = 7,
}
impl From<Ali... | (a: internal::YGAlign) -> Align {
match a {
internal::YGAlign::YGAlignAuto => Align::Auto,
internal::YGAlign::YGAlignFlexStart => Align::FlexStart,
internal::YGAlign::YGAlignCenter => Align::Center,
internal::YGAlign::YGAlignFlexEnd => Align::FlexEnd,
internal::YGAlign::YGAlignStretch => Align::Stretch... | from | identifier_name |
align.rs | use internal;
#[repr(u32)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Clone)]
#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))]
pub enum Align {
Auto = 0,
FlexStart = 1,
Center = 2,
FlexEnd = 3,
Stretch = 4,
Baseline = 5,
SpaceBetween = 6,
SpaceAround = 7,
}
impl From<Ali... |
}
| {
match a {
internal::YGAlign::YGAlignAuto => Align::Auto,
internal::YGAlign::YGAlignFlexStart => Align::FlexStart,
internal::YGAlign::YGAlignCenter => Align::Center,
internal::YGAlign::YGAlignFlexEnd => Align::FlexEnd,
internal::YGAlign::YGAlignStretch => Align::Stretch,
internal::YGAlign::YGAlignB... | identifier_body |
modular_inverse.rs | // http://rosettacode.org/wiki/Modular_inverse
#[cfg(not(test))]
fn main() {
println!("{:?}", mul_inv(42, 2017));
}
fn mul_inv(a: i32, b: i32) -> Option<i32> {
let (gcd, mut x, _) = egcd(a, b);
if gcd!= 1 { // No multiplicative inverse exists
return None;
}
if x < 0 {
x += b;
}... | } | random_line_split | |
modular_inverse.rs | // http://rosettacode.org/wiki/Modular_inverse
#[cfg(not(test))]
fn | () {
println!("{:?}", mul_inv(42, 2017));
}
fn mul_inv(a: i32, b: i32) -> Option<i32> {
let (gcd, mut x, _) = egcd(a, b);
if gcd!= 1 { // No multiplicative inverse exists
return None;
}
if x < 0 {
x += b;
}
Some(x % b)
}
fn egcd(a: i32, b: i32) -> (i32, i32, i32) {
if a... | main | identifier_name |
modular_inverse.rs | // http://rosettacode.org/wiki/Modular_inverse
#[cfg(not(test))]
fn main() {
println!("{:?}", mul_inv(42, 2017));
}
fn mul_inv(a: i32, b: i32) -> Option<i32> {
let (gcd, mut x, _) = egcd(a, b);
if gcd!= 1 |
if x < 0 {
x += b;
}
Some(x % b)
}
fn egcd(a: i32, b: i32) -> (i32, i32, i32) {
if a == 0 {
return (b, 0, 1);
}
let (g, y, x) = egcd(b % a, a);
(g, x - (b / a) * y, y)
}
#[test]
fn test() {
assert_eq!(mul_inv(42, 2017), Some(1969));
}
| { // No multiplicative inverse exists
return None;
} | conditional_block |
modular_inverse.rs | // http://rosettacode.org/wiki/Modular_inverse
#[cfg(not(test))]
fn main() {
println!("{:?}", mul_inv(42, 2017));
}
fn mul_inv(a: i32, b: i32) -> Option<i32> |
fn egcd(a: i32, b: i32) -> (i32, i32, i32) {
if a == 0 {
return (b, 0, 1);
}
let (g, y, x) = egcd(b % a, a);
(g, x - (b / a) * y, y)
}
#[test]
fn test() {
assert_eq!(mul_inv(42, 2017), Some(1969));
}
| {
let (gcd, mut x, _) = egcd(a, b);
if gcd != 1 { // No multiplicative inverse exists
return None;
}
if x < 0 {
x += b;
}
Some(x % b)
} | identifier_body |
const-extern-fn.rs | // run-pass
#![feature(const_extern_fn)]
const extern "C" fn foo1(val: u8) -> u8 {
val + 1
}
const extern "C" fn foo2(val: u8) -> u8 {
val + 1
}
const unsafe extern "C" fn bar1(val: bool) -> bool {
!val
}
const unsafe extern "C" fn bar2(val: bool) -> bool {
!val
}
fn main() {
let a: [u8; foo1(25... | let bar2_res = unsafe { bar2(false) };
assert!(bar1_res);
assert_eq!(bar1_res, bar2_res);
let _foo1_cast: extern "C" fn(u8) -> u8 = foo1;
let _foo2_cast: extern "C" fn(u8) -> u8 = foo2;
let _bar1_cast: unsafe extern "C" fn(bool) -> bool = bar1;
let _bar2_cast: unsafe extern "C" fn(bool) -> ... |
let bar1_res = unsafe { bar1(false) }; | random_line_split |
const-extern-fn.rs | // run-pass
#![feature(const_extern_fn)]
const extern "C" fn foo1(val: u8) -> u8 {
val + 1
}
const extern "C" fn foo2(val: u8) -> u8 {
val + 1
}
const unsafe extern "C" fn bar1(val: bool) -> bool {
!val
}
const unsafe extern "C" fn bar2(val: bool) -> bool {
!val
}
fn | () {
let a: [u8; foo1(25) as usize] = [0; 26];
let b: [u8; foo2(25) as usize] = [0; 26];
assert_eq!(a, b);
let bar1_res = unsafe { bar1(false) };
let bar2_res = unsafe { bar2(false) };
assert!(bar1_res);
assert_eq!(bar1_res, bar2_res);
let _foo1_cast: extern "C" fn(u8) -> u8 = foo1;
... | main | identifier_name |
const-extern-fn.rs | // run-pass
#![feature(const_extern_fn)]
const extern "C" fn foo1(val: u8) -> u8 {
val + 1
}
const extern "C" fn foo2(val: u8) -> u8 {
val + 1
}
const unsafe extern "C" fn bar1(val: bool) -> bool {
!val
}
const unsafe extern "C" fn bar2(val: bool) -> bool |
fn main() {
let a: [u8; foo1(25) as usize] = [0; 26];
let b: [u8; foo2(25) as usize] = [0; 26];
assert_eq!(a, b);
let bar1_res = unsafe { bar1(false) };
let bar2_res = unsafe { bar2(false) };
assert!(bar1_res);
assert_eq!(bar1_res, bar2_res);
let _foo1_cast: extern "C" fn(u8) -> u8 ... | {
!val
} | identifier_body |
span_length.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 result = Command::new("sh")
.arg("-c")
.arg(&format!("{} {}",
rustc,
main_file.as_str()
.unwrap()))
... | }
// rustc is passed to us with --out-dir and -L etc., so we
// can't exec it directly | random_line_split |
span_length.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 main() {
let args: Vec<String> = env::args().collect();
let rustc = &args[1];
let tmpdir = Path::new(&args[2]);
let main_file = tmpdir.join("span_main.rs");
for _ in 0..100 {
let n = thread_rng().gen_range(3, 20);
{
let _ = write!(&mut File::create(&main_file).unwr... | {
let mut rng = thread_rng();
// a subset of the XID_start Unicode table (ensuring that the
// compiler doesn't fail with an "unrecognised token" error)
let (lo, hi): (u32, u32) = match rng.gen_range(1u32, 4u32 + 1) {
1 => (0x41, 0x5a),
2 => (0xf8, 0x1ba),
3 => (0x1401, 0x166c),
... | identifier_body |
span_length.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 ... | () -> char {
let mut rng = thread_rng();
// a subset of the XID_start Unicode table (ensuring that the
// compiler doesn't fail with an "unrecognised token" error)
let (lo, hi): (u32, u32) = match rng.gen_range(1u32, 4u32 + 1) {
1 => (0x41, 0x5a),
2 => (0xf8, 0x1ba),
3 => (0x1401... | random_char | identifier_name |
merl.rs | //! The MERL Material represents the surface's properties through data loaded from a
//! [MERL BRDF Database file](http://www.merl.com/brdf/). The material loads and parses
//! the data then hands it off to its BRDF which will be used to actually compute the
//! surface properties
//!
//! # Scene Usage Example
//! The ... |
}
| {
let bxdfs = alloc.alloc_slice::<&BxDF>(1);
bxdfs[0] = alloc.alloc(bxdf::Merl::new(&self.brdf[..], self.n_theta_h, self.n_theta_d, self.n_phi_d));
BSDF::new(bxdfs, 1.0, &hit.dg)
} | identifier_body |
merl.rs | //! The MERL Material represents the surface's properties through data loaded from a
//! [MERL BRDF Database file](http://www.merl.com/brdf/). The material loads and parses
//! the data then hands it off to its BRDF which will be used to actually compute the
//! surface properties
//!
//! # Scene Usage Example
//! The ... | //! },
//! ...
//! ]
//! ```
use std::iter;
use std::path::Path;
use std::fs::File;
use std::io::BufReader;
use byteorder::{LittleEndian, ReadBytesExt};
use light_arena::Allocator;
use bxdf::{self, BSDF, BxDF};
use material::Material;
use geometry::Intersection;
/// Material that uses measured data to model ... | //! "file": "./black-oxidized-steel.binary" | random_line_split |
merl.rs | //! The MERL Material represents the surface's properties through data loaded from a
//! [MERL BRDF Database file](http://www.merl.com/brdf/). The material loads and parses
//! the data then hands it off to its BRDF which will be used to actually compute the
//! surface properties
//!
//! # Scene Usage Example
//! The ... | <'a, 'b, 'c>(&'a self, hit: &Intersection<'a, 'b>,
alloc: &'c Allocator) -> BSDF<'c> where 'a: 'c {
let bxdfs = alloc.alloc_slice::<&BxDF>(1);
bxdfs[0] = alloc.alloc(bxdf::Merl::new(&self.brdf[..], self.n_theta_h, self.n_theta_d, self.n_phi_d));
BSDF::new(bxdfs, 1.0, &hit... | bsdf | identifier_name |
html.rs | //! A simple parser for a tiny subset of HTML.
//!
//! Can parse basic opening and closing tags, and text nodes.
//!
//! Not yet supported:
//!
//! * Comments
//! * Doctypes and processing instructions
//! * Self-closing tags
//! * Non-well-formed markup
//! * Character entities
use dom;
use std::collections::HashMap;... | self.pos += next_pos;
return cur_char;
}
/// Read the current character without consuming it.
fn next_char(&self) -> char {
self.input[self.pos..].chars().next().unwrap()
}
/// Does the current input start with the given string?
fn starts_with(&self, s: &str) -> bool {
... | fn consume_char(&mut self) -> char {
let mut iter = self.input[self.pos..].char_indices();
let (_, cur_char) = iter.next().unwrap();
let (next_pos, _) = iter.next().unwrap_or((1, ' ')); | random_line_split |
html.rs | //! A simple parser for a tiny subset of HTML.
//!
//! Can parse basic opening and closing tags, and text nodes.
//!
//! Not yet supported:
//!
//! * Comments
//! * Doctypes and processing instructions
//! * Self-closing tags
//! * Non-well-formed markup
//! * Character entities
use dom;
use std::collections::HashMap;... | (&mut self) -> String {
self.consume_while(|c| match c {
'a'...'z' | 'A'...'Z' | '0'...'9' => true,
_ => false
})
}
/// Parse a list of name="value" pairs, separated by whitespace.
fn parse_attributes(&mut self) -> dom::AttrMap {
let mut attributes = HashMap:... | parse_tag_name | identifier_name |
remove.rs | // STD Dependencies -----------------------------------------------------------
use std::fmt;
// Internal Dependencies ------------------------------------------------------
use ::bot::{Bot, BotConfig};
use ::core::{EventQueue, Message};
use ::action::{ActionHandler, ActionGroup, MessageActions};
// Action Implemen... | }
else {
vec![]
}
}
}
impl fmt::Display for Action {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "[Action] [RemoveUploader] {}", self.nickname)
}
}
| {
if server.remove_uploader(&self.nickname) {
MessageActions::Send::private(
&self.message,
format!(
"The user `{}` is now no longer allowed to upload effects on {}.",
self.nickname, server.name
... | conditional_block |
remove.rs | // STD Dependencies -----------------------------------------------------------
use std::fmt;
// Internal Dependencies ------------------------------------------------------
use ::bot::{Bot, BotConfig};
use ::core::{EventQueue, Message};
use ::action::{ActionHandler, ActionGroup, MessageActions};
// Action Implemen... | (&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "[Action] [RemoveUploader] {}", self.nickname)
}
}
| fmt | identifier_name |
remove.rs | // STD Dependencies -----------------------------------------------------------
use std::fmt;
// Internal Dependencies ------------------------------------------------------
use ::bot::{Bot, BotConfig};
use ::core::{EventQueue, Message};
use ::action::{ActionHandler, ActionGroup, MessageActions};
// Action Implemen... |
}
impl ActionHandler for Action {
fn run(&mut self, bot: &mut Bot, _: &BotConfig, _: &mut EventQueue) -> ActionGroup {
if let Some(server) = bot.get_server(&self.message.server_id) {
if server.remove_uploader(&self.nickname) {
MessageActions::Send::private(
... | {
Box::new(Action {
message: message,
nickname: nickname
})
} | identifier_body |
remove.rs | // STD Dependencies -----------------------------------------------------------
use std::fmt;
// Internal Dependencies ------------------------------------------------------
use ::bot::{Bot, BotConfig};
use ::core::{EventQueue, Message};
use ::action::{ActionHandler, ActionGroup, MessageActions};
// Action Implemen... | pub struct Action {
message: Message,
nickname: String
}
impl Action {
pub fn new(message: Message, nickname: String) -> Box<Action> {
Box::new(Action {
message: message,
nickname: nickname
})
}
}
impl ActionHandler for Action {
fn run(&mut self, bot: &mut B... | random_line_split | |
file.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::FileBinding;
use dom::bindings::codegen::Bindings::FileBinding::FileMethods;... | },
}
}
#[allow(unrooted_must_root)]
pub fn new(global: &GlobalScope, blob_impl: BlobImpl,
name: DOMString, modified: Option<i64>, typeString: &str) -> DomRoot<File> {
reflect_dom_object(Box::new(File::new_inherited(blob_impl, name, modified, typeString)),
... | Some(m) => m,
None => {
let time = time::get_time();
time.sec * 1000 + (time.nsec / 1000000) as i64
} | random_line_split |
file.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::FileBinding;
use dom::bindings::codegen::Bindings::FileBinding::FileMethods;... | (&self) -> i64 {
self.modified
}
}
| LastModified | identifier_name |
pool.rs | use std::{mem, fmt};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::ops::{Index, IndexMut};
use std::marker::PhantomData;
use std::collections::LinkedList;
use std::ops::{Deref, DerefMut};
use std::ptr;
pub mod tests;
/// Arc is the only valid way to access an item in
/// the pool. It is returned by alloc,... | <'a>(&'a mut self, i: usize) -> &'a mut SlotHeader {
unsafe {
let ptr = self.buffer.clone()
.offset((i * self.slot_size) as isize);
mem::transmute(ptr)
}
}
fn raw_contents_for<'a>(&'a mut self, i: usize) -> *mut u8 {
unsafe {
self.buffe... | header_for | identifier_name |
pool.rs | use std::{mem, fmt};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::ops::{Index, IndexMut};
use std::marker::PhantomData;
use std::collections::LinkedList;
use std::ops::{Deref, DerefMut};
use std::ptr;
pub mod tests;
/// Arc is the only valid way to access an item in
/// the pool. It is returned by alloc,... | let h = self.header_for(index);
loop {
let old = h.ref_count.load(Ordering::Relaxed);
assert!(old > 0, "Release called on [{}] which has no refs!", index);
let swap = h.ref_count
.compare_and_swap(old, old-1, Ordering::Relaxed);
... |
// Decrease the ref count for the cell at the given index
pub fn release(&mut self, index: usize) {
let mut is_free = false;
{ // Make the borrow checker happy | random_line_split |
pool.rs | use std::{mem, fmt};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::ops::{Index, IndexMut};
use std::marker::PhantomData;
use std::collections::LinkedList;
use std::ops::{Deref, DerefMut};
use std::ptr;
pub mod tests;
/// Arc is the only valid way to access an item in
/// the pool. It is returned by alloc,... |
}
/// Returns the number of live items. O(1) running time.
pub fn live_count(&self) -> usize {
self.tail.load(Ordering::Relaxed) - self.free_list.len()
}
}
/// Internal Functions
impl <T> Pool<T> {
// Returns an item from the free list, or
// tries to allocate a new one from the buff... | {
self.free_list.push_back(index);
} | conditional_block |
pool.rs | use std::{mem, fmt};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::ops::{Index, IndexMut};
use std::marker::PhantomData;
use std::collections::LinkedList;
use std::ops::{Deref, DerefMut};
use std::ptr;
pub mod tests;
/// Arc is the only valid way to access an item in
/// the pool. It is returned by alloc,... |
}
/// A pool represents a fixed number of ref-counted objects.
/// The pool treats all given space as an unallocated
/// pool of objects. Each object is prefixed with a header.
/// The header is formatted as follows:
/// * V1
/// - [0..2] ref_count: u16
///
pub struct Pool<T> {
item_type: PhantomData<T>,
b... | {
if self.index != other.index {
false
} else {
unsafe {
self.pool as *const _ == other.pool as *const _
}
}
} | identifier_body |
response.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bytes::Bytes;
use futures::{
channel::oneshot,
stream::{Stream, StreamExt},
};
use gotham::{handl... |
}
pub struct StreamBody<S> {
stream: S,
mime: Mime,
pub partial: bool,
}
impl<S> StreamBody<S> {
pub fn new(stream: S, mime: Mime) -> Self {
Self {
stream,
mime,
partial: false,
}
}
}
impl<S> TryIntoResponse for StreamBody<S>
where
S: Strea... | {
let bytes = self.bytes.into();
let mime_header: HeaderValue = self.mime.as_ref().parse()?;
let size = bytes.len().try_into()?;
state.put(PendingResponseMeta::immediate(size));
Response::builder()
.header(CONTENT_TYPE, mime_header)
.status(StatusCode::O... | identifier_body |
response.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bytes::Bytes;
use futures::{
channel::oneshot,
stream::{Stream, StreamExt},
};
use gotham::{handl... | <IR: TryIntoResponse, F: ErrorFormatter>(
res: Result<IR, HttpError>,
mut state: State,
formatter: &F,
) -> Result<(State, Response<Body>), (State, HandlerError)> {
let res = res.and_then(|c| {
c.try_into_response(&mut state)
.context("try_into_response failed!")
.map_err(H... | build_response | identifier_name |
response.rs | /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
use anyhow::{Context, Error};
use bytes::Bytes;
use futures::{
channel::oneshot,
stream::{Stream, StreamExt},
};
use gotham::{handl... | impl<B> BytesBody<B> {
pub fn new(bytes: B, mime: Mime) -> Self {
Self { bytes, mime }
}
}
impl<B> TryIntoResponse for BytesBody<B>
where
B: Into<Bytes>,
{
fn try_into_response(self, state: &mut State) -> Result<Response<Body>, Error> {
let bytes = self.bytes.into();
let mime_he... | }
| random_line_split |
time_measure.rs | // Copyright 2014 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.
extern crate time;
use measure::Measureable;
pub struct TimeMeasure {
name: String,
value: time::Tm,
}... | TimeMeasure {
name: name.to_string(),
value: time::now(),
}
}
}
impl<'a> Measureable<'a> for TimeMeasure {
fn name(&'a self) -> &'a str {
self.name.as_slice()
}
fn update(&'a mut self) {
self.value = time::now();
}
fn number_value(&'a se... | pub fn new(name: &str) -> TimeMeasure { | random_line_split |
time_measure.rs | // Copyright 2014 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.
extern crate time;
use measure::Measureable;
pub struct TimeMeasure {
name: String,
value: time::Tm,
}... | (&'a self) -> f32 {
self.value.to_timespec().sec as f32
}
fn string_value(&'a self) -> String {
time::strftime("%H:%M", &self.value).unwrap_or(String::new())
}
}
| number_value | identifier_name |
time_measure.rs | // Copyright 2014 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.
extern crate time;
use measure::Measureable;
pub struct TimeMeasure {
name: String,
value: time::Tm,
}... |
fn string_value(&'a self) -> String {
time::strftime("%H:%M", &self.value).unwrap_or(String::new())
}
}
| {
self.value.to_timespec().sec as f32
} | identifier_body |
driver.rs | use futures::Async;
use futures::Future;
use futures::Poll;
use futures::Stream;
use futures::task;
use tokio_io::AsyncRead;
use tokio_io::AsyncWrite;
use tokio_io::codec::FramedRead;
use irc;
use irc::active::Active;
use irc::codec::IrcCodec;
use irc::message::Message;
use irc::pending::Pending;
use irc::send::SendD... | ,
Processing(mut op) => {
match try!(op.poll()) {
Async::Ready(client) => driver_continue(Ready(client)),
Async::NotReady => driver_not_ready(Processing(op)),
}
},
}
}
fn poll_error(&mut self) -> Poll<(), i... | {
if let Async::Ready(result) = try!(self.recv.poll()) {
if let Some(message) = result {
let op = client.handle(message);
driver_continue(Processing(op))
} else {
driver_err(irc::Error::Other(... | conditional_block |
driver.rs | use futures::Async;
use futures::Future;
use futures::Poll;
use futures::Stream;
use futures::task;
| use tokio_io::AsyncWrite;
use tokio_io::codec::FramedRead;
use irc;
use irc::active::Active;
use irc::codec::IrcCodec;
use irc::message::Message;
use irc::pending::Pending;
use irc::send::SendDriver;
use world::World;
pub enum Client {
Pending(Pending),
Active(Active),
}
impl Client {
fn handle(self, mes... | use tokio_io::AsyncRead; | random_line_split |
driver.rs | use futures::Async;
use futures::Future;
use futures::Poll;
use futures::Stream;
use futures::task;
use tokio_io::AsyncRead;
use tokio_io::AsyncWrite;
use tokio_io::codec::FramedRead;
use irc;
use irc::active::Active;
use irc::codec::IrcCodec;
use irc::message::Message;
use irc::pending::Pending;
use irc::send::SendD... | (&mut self) -> Poll<(), ()> {
self.poll_error().map_err(|e| info!("driver error: {}", e))
}
}
| poll | identifier_name |
nvcounter_syscall.rs | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
}
impl<'c, C: NvCounter<'c>> kernel::Driver for NvCounterSyscall<'c, C> {
fn command(&self, minor_num: usize, _: usize, _: usize, app: AppId) -> ReturnCode {
match minor_num {
0 => ReturnCode::SUCCESS,
1 => self.read_and_increment(app),
_ => ReturnCode::ENOSUPPORT,
... | {
self.grant.enter(app, |app_data, _| {
app_data.callback = callback;
ReturnCode::SUCCESS
}).unwrap_or(ReturnCode::ENOMEM)
} | identifier_body |
nvcounter_syscall.rs | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
}
fn increment_done(&self, status: ReturnCode) {
let callback_app = self.current_app.get();
self.op_ongoing.set(false);
let mut callback_code = 1;
if status == ReturnCode::SUCCESS {
self.value.set(self.value.get() + 1);
callback_code = 2;
}
... | {
self.handle_failed_init();
} | conditional_block |
nvcounter_syscall.rs | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | (&self, status: ReturnCode) {
let callback_app = self.current_app.get();
self.op_ongoing.set(false);
let mut callback_code = 1;
if status == ReturnCode::SUCCESS {
self.value.set(self.value.get() + 1);
callback_code = 2;
}
self.do_next_op(Some(callb... | increment_done | identifier_name |
nvcounter_syscall.rs | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | // given callback code -- specify an id if usize::max_value() if no callback
// is necessary.
fn do_next_op(&self, callback_id: Option<usize>, callback_code: usize) {
use ReturnCode::SuccessWithValue;
// TODO: Fairness? This seems to be the common approach but it gives
// priority to... | // Scans through the apps and starts the next increment, if any app wants an
// increment. This will also call the callback for app callback_id with the | random_line_split |
aggregate.rs | use std::fmt;
use data::{Data, Number};
use expr::Expr;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum AggregateFunction {
Average,
Count,
Sum,
}
impl AggregateFunction {
pub fn from_name(name: &str) -> Option<Self> {
match name.to_lowercase().as_ref() {
"avg" => Some(Aggreg... |
}
| {
let mut agg = AggregateFunction::from_name(name).unwrap().aggregate();
input.iter().for_each(|value| agg.apply(value.clone()));
agg.final_value()
} | identifier_body |
aggregate.rs | use std::fmt;
use data::{Data, Number};
use expr::Expr;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum AggregateFunction {
Average,
Count,
Sum,
}
impl AggregateFunction {
pub fn from_name(name: &str) -> Option<Self> {
match name.to_lowercase().as_ref() {
"avg" => Some(Aggreg... |
#[derive(Clone, Debug, PartialEq)]
pub enum Aggregate {
Average(Number, i64),
Count(i64),
Sum(Number),
}
impl Aggregate {
pub fn apply(&mut self, value: Data) {
match (self, value) {
(&mut Aggregate::Average(ref mut acc, ref mut count), Data::Number(ref d)) => {
*ac... | &AggregateFunction::Sum => write!(f, "sum"),
}
}
} | random_line_split |
aggregate.rs | use std::fmt;
use data::{Data, Number};
use expr::Expr;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum AggregateFunction {
Average,
Count,
Sum,
}
impl AggregateFunction {
pub fn from_name(name: &str) -> Option<Self> {
match name.to_lowercase().as_ref() {
"avg" => Some(Aggreg... | ,
(&mut Aggregate::Count(_), Data::Null) => {},
(&mut Aggregate::Count(ref mut acc), _) => *acc += 1,
(&mut Aggregate::Sum(ref mut acc), Data::Number(ref n)) => *acc += n.clone(),
_ => {},
}
}
pub fn final_value(&self) -> Data {
match self {
... | {
*acc += d.clone();
*count += 1;
} | conditional_block |
aggregate.rs | use std::fmt;
use data::{Data, Number};
use expr::Expr;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum AggregateFunction {
Average,
Count,
Sum,
}
impl AggregateFunction {
pub fn from_name(name: &str) -> Option<Self> {
match name.to_lowercase().as_ref() {
"avg" => Some(Aggreg... | () {
let input = data_vec![0.0, -1.2, 2.4, 3.6];
let expected = Data::Number(Number::Float(4.8));
assert_eq!(expected, apply_agg("sum", input));
}
#[test]
fn sum_mixed() {
let input = data_vec![Data::Null, 1, true, false, 2.0, "foo"];
let expected = Data::Number(Numb... | sum_floats | identifier_name |
eval.rs | #![cfg(test)]
use std::collections::{HashMap};
use spine;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RtVal {
Closure(usize),
Int(i32),
True, | let mut st = ProgSt {
steps: 5_000,
test_output: Vec::new(),
closures: Vec::new(),
};
let jump = eval_term(&mut st, HashMap::new(), &prog.body);
assert_eq!(jump.cont, prog.halt_cont);
assert_eq!(jump.args.len(), 1);
st.test_output
}
struct ProgSt<'p> {
steps: i32,
test_output: Vec<... | False,
}
pub fn eval(prog: &spine::ProgDef) -> Vec<RtVal> { | random_line_split |
eval.rs | #![cfg(test)]
use std::collections::{HashMap};
use spine;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RtVal {
Closure(usize),
Int(i32),
True,
False,
}
pub fn eval(prog: &spine::ProgDef) -> Vec<RtVal> {
let mut st = ProgSt {
steps: 5_000,
test_output: Vec::new(),
closures: Vec::new(),
... | else { else_cont }.clone(),
args: vec![],
},
}
}
fn eval_val(vars: &HashMap<spine::Var, RtVal>, val: &spine::Val) -> RtVal {
match *val {
spine::Val::Int(number) => RtVal::Int(number),
spine::Val::Var(ref var) => vars.get(var).expect("undefined var").clone(),
spine::Val::True => RtVal::T... | { then_cont } | conditional_block |
eval.rs | #![cfg(test)]
use std::collections::{HashMap};
use spine;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RtVal {
Closure(usize),
Int(i32),
True,
False,
}
pub fn eval(prog: &spine::ProgDef) -> Vec<RtVal> {
let mut st = ProgSt {
steps: 5_000,
test_output: Vec::new(),
closures: Vec::new(),
... | }
}
return jump;
}
},
spine::Term::Letfun(ref fun_defs, ref body) => {
let mut inner_vars = vars;
for (idx, fun_def) in fun_defs.iter().enumerate() {
let rt_val = RtVal::Closure(st.closures.len() + idx);
inner_vars.insert(fun_def.var.clone(), rt_val);
... | {
if st.steps <= 0 {
panic!("eval step limit exceeded");
} else {
st.steps = st.steps - 1;
}
match *term {
spine::Term::Letcont(ref cont_defs, ref body) => {
let mut jump = eval_term(st, vars.clone(), &**body);
'jumper: loop {
for cont_def in cont_defs.iter() {
if cont... | identifier_body |
eval.rs | #![cfg(test)]
use std::collections::{HashMap};
use spine;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RtVal {
Closure(usize),
Int(i32),
True,
False,
}
pub fn eval(prog: &spine::ProgDef) -> Vec<RtVal> {
let mut st = ProgSt {
steps: 5_000,
test_output: Vec::new(),
closures: Vec::new(),
... | {
cont: spine::ContName,
args: Vec<RtVal>,
}
fn eval_term<'p>(st: &mut ProgSt<'p>, vars: HashMap<spine::Var, RtVal>,
term: &'p spine::Term) -> Jump
{
if st.steps <= 0 {
panic!("eval step limit exceeded");
} else {
st.steps = st.steps - 1;
}
match *term {
spine::Term::Letcont(ref cont_defs,... | Jump | identifier_name |
audiodestinationnode.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::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use dom::baseaudiocontext::BaseAudioContext;
use dom::bindings... |
#[allow(unrooted_must_root)]
pub fn new(
global: &GlobalScope,
context: &BaseAudioContext,
options: &AudioNodeOptions,
) -> DomRoot<AudioDestinationNode> {
let node = AudioDestinationNode::new_inherited(context, options);
reflect_dom_object(Box::new(node), global, A... | {
let node_options =
options.unwrap_or(2, ChannelCountMode::Max, ChannelInterpretation::Speakers);
AudioDestinationNode {
node: AudioNode::new_inherited_for_id(
context.destination_node(),
context,
node_options,
1,
... | identifier_body |
audiodestinationnode.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::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use dom::baseaudiocontext::BaseAudioContext;
use dom::bindings... | {
node: AudioNode,
}
impl AudioDestinationNode {
fn new_inherited(
context: &BaseAudioContext,
options: &AudioNodeOptions,
) -> AudioDestinationNode {
let node_options =
options.unwrap_or(2, ChannelCountMode::Max, ChannelInterpretation::Speakers);
AudioDestinati... | AudioDestinationNode | identifier_name |
audiodestinationnode.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::audionode::{AudioNode, MAX_CHANNEL_COUNT};
use dom::baseaudiocontext::BaseAudioContext;
use dom::bindings... | #[dom_struct]
pub struct AudioDestinationNode {
node: AudioNode,
}
impl AudioDestinationNode {
fn new_inherited(
context: &BaseAudioContext,
options: &AudioNodeOptions,
) -> AudioDestinationNode {
let node_options =
options.unwrap_or(2, ChannelCountMode::Max, ChannelInte... | use dom::bindings::root::DomRoot;
use dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
| random_line_split |
mod.rs |
use elmesque::Element;
use position::{Padding, Point};
pub mod split;
/// Unique identifier for Canvasses.
pub type CanvasId = usize;
/// The kind of Canvas.
#[derive(Clone, Debug)]
pub struct Canvas {
/// The Kind of Canvas (i.e. Split, Floating, etc).
pub kind: Kind,
/// The position of the Canvas wit... | () -> Canvas {
Canvas {
xy: [0.0, 0.0],
element: ::elmesque::element::empty(),
padding: Padding::none(),
kind: Kind::NoCanvas,
set_since_last_drawn: false,
}
}
}
/// The different kinds of Canvases available to the user.
#[derive(Clone, D... | empty | identifier_name |
mod.rs |
use elmesque::Element;
use position::{Padding, Point};
pub mod split;
/// Unique identifier for Canvasses.
pub type CanvasId = usize;
/// The kind of Canvas.
#[derive(Clone, Debug)]
pub struct Canvas {
/// The Kind of Canvas (i.e. Split, Floating, etc).
pub kind: Kind,
/// The position of the Canvas wit... |
}
/// The different kinds of Canvases available to the user.
#[derive(Clone, Debug)]
pub enum Kind {
/// Represents a placeholder Canvas.
NoCanvas,
/// A split of another Canvas.
Split(split::State),
// /// A floating / draggable Canvas.
// Floating(floating::State),
}
impl Kind {
/// Do... | {
Canvas {
xy: [0.0, 0.0],
element: ::elmesque::element::empty(),
padding: Padding::none(),
kind: Kind::NoCanvas,
set_since_last_drawn: false,
}
} | identifier_body |
mod.rs | use elmesque::Element;
use position::{Padding, Point};
pub mod split;
/// Unique identifier for Canvasses.
pub type CanvasId = usize;
/// The kind of Canvas.
#[derive(Clone, Debug)]
pub struct Canvas {
/// The Kind of Canvas (i.e. Split, Floating, etc).
pub kind: Kind,
/// The position of the Canvas with... | }
/// The different kinds of Canvases available to the user.
#[derive(Clone, Debug)]
pub enum Kind {
/// Represents a placeholder Canvas.
NoCanvas,
/// A split of another Canvas.
Split(split::State),
// /// A floating / draggable Canvas.
// Floating(floating::State),
}
impl Kind {
/// Do t... | kind: Kind::NoCanvas,
set_since_last_drawn: false,
}
}
| random_line_split |
borrowck-vec-pattern-nesting.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 mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = &mut vec;
match vec {
[_a.., //~ ERROR cannot move out
_b] => {} //~ NOTE attempting to move value to here
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
}
fn e() {
let mut vec = vec!(bo... | d | identifier_name |
borrowck-vec-pattern-nesting.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 main() {} | //~^ NOTE attempting to move value to here
} | random_line_split |
borrowck-vec-pattern-nesting.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 ... | //~ ERROR cannot move out
//~^ NOTE attempting to move value to here
//~^^ NOTE and here
//~^^^ NOTE and here
_ => {}
}
let a = vec[0]; //~ ERROR cannot move out
//~^ NOTE attempting to move value to here
}
fn main() {}
| {} | conditional_block |
borrowck-vec-pattern-nesting.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 b() {
let mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = &mut vec;
match vec {
[_b..] => {
vec[0] = box 4; //~ ERROR cannot assign
}
}
}
fn c() {
let mut vec = vec!(box 1, box 2, box 3);
let vec: &mut [Box<isize>] = &mut vec;
match vec {
... | {
let mut vec = [box 1, box 2, box 3];
match vec {
[box ref _a, _, _] => {
vec[0] = box 4; //~ ERROR cannot assign
}
}
} | identifier_body |
regions-relate-bound-regions-on-closures-to-inference-variables.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 ... | {
mk_cand(self)
}
}
fn main() {
let v = vec![];
let cx = Ctxt { x: &v };
let mut foo = Foo { cx: &cx };
assert_eq!(foo.bother(), 22); // just so the code is not dead, basically
} | mut mk_cand: Box<for<'b> FnMut(&mut Foo<'b, 'tcx>) -> isize>)
-> isize | random_line_split |
regions-relate-bound-regions-on-closures-to-inference-variables.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 foo(&mut self) -> isize {
22
}
fn elaborate_bounds(
&mut self,
mut mk_cand: Box<for<'b> FnMut(&mut Foo<'b, 'tcx>) -> isize>)
-> isize
{
mk_cand(self)
}
}
fn main() {
let v = vec![];
let cx = Ctxt { x: &v };
let mut foo = Foo { cx: &cx };
... | {
self.elaborate_bounds(Box::new(|this| {
// (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`,
// where `'f0` and `'f1` are fresh, free regions that
// result from the bound regions on the closure, and `'2`
// is a region inference variable created by the call. D... | identifier_body |
regions-relate-bound-regions-on-closures-to-inference-variables.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 ... | <'a,'tcx:'a> {
cx: &'a Ctxt<'tcx>,
}
impl<'a,'tcx> Foo<'a,'tcx> {
fn bother(&mut self) -> isize {
self.elaborate_bounds(Box::new(|this| {
// (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`,
// where `'f0` and `'f1` are fresh, free regions that
// result from the bo... | Foo | identifier_name |
day01.rs | use std::collections::HashSet;
use std::io;
use std::io::prelude::*;
use common;
#[derive(Default)]
pub struct Day01 {}
impl Day01 {
pub fn new() -> Day01 {
Default::default()
}
}
impl common::Solution for Day01 {
fn part1(&mut self, input: &mut dyn io::Read) -> String {
let reader = io:... |
}
}
}
}
#[cfg(test)]
mod tests {
use common::Solution;
use super::*;
#[test]
fn samples_part1() {
let mut instance = Day01::new();
let sample1 = "+1\n+1\n+1";
let sample2 = "+1\n+1\n-2";
let sample3 = "-1\n-2\n-3";
assert_eq!("3", inst... | {
freqs.insert(sum);
} | conditional_block |
day01.rs | use std::collections::HashSet;
use std::io;
use std::io::prelude::*;
use common;
#[derive(Default)]
pub struct Day01 {}
impl Day01 {
pub fn new() -> Day01 {
Default::default()
}
}
impl common::Solution for Day01 {
fn part1(&mut self, input: &mut dyn io::Read) -> String {
let reader = io:... | freqs.insert(0);
let mut sum = 0;
let nums: Vec<i32> = reader
.lines()
.map(|x| x.unwrap().parse().unwrap())
.collect();
loop {
for amount in &nums {
sum += amount;
if freqs.contains(&sum) {
... | random_line_split | |
day01.rs | use std::collections::HashSet;
use std::io;
use std::io::prelude::*;
use common;
#[derive(Default)]
pub struct Day01 {}
impl Day01 {
pub fn new() -> Day01 {
Default::default()
}
}
impl common::Solution for Day01 {
fn part1(&mut self, input: &mut dyn io::Read) -> String {
let reader = io:... | (&mut self, input: &mut dyn io::Read) -> String {
let reader = io::BufReader::new(input);
let mut freqs = HashSet::new();
freqs.insert(0);
let mut sum = 0;
let nums: Vec<i32> = reader
.lines()
.map(|x| x.unwrap().parse().unwrap())
.collect();
... | part2 | identifier_name |
linear_congruential_generator.rs | // Implements http://rosettacode.org/wiki/Linear_congruential_generator
use std::num::Wrapping as w;
trait LinearCongruentialGenerator {
fn seed(&mut self, seed: u32);
fn next(&mut self) -> u32;
}
struct BSDLinearCongruentialGenerator {
state: w<u32>
}
impl BSDLinearCongruentialGenerator {
fn new(see... | MSLinearCongruentialGenerator { state: w(seed) }
}
}
impl LinearCongruentialGenerator for MSLinearCongruentialGenerator {
fn seed(&mut self, seed: u32) {
self.state = w(seed);
}
fn next(&mut self) -> u32 {
self.state = w((w(214013) * self.state + w(2531011)).0 % (1 << 31));
... | }
impl MSLinearCongruentialGenerator {
fn new(seed: u32) -> MSLinearCongruentialGenerator { | random_line_split |
linear_congruential_generator.rs | // Implements http://rosettacode.org/wiki/Linear_congruential_generator
use std::num::Wrapping as w;
trait LinearCongruentialGenerator {
fn seed(&mut self, seed: u32);
fn next(&mut self) -> u32;
}
struct | {
state: w<u32>
}
impl BSDLinearCongruentialGenerator {
fn new(seed: u32) -> BSDLinearCongruentialGenerator {
BSDLinearCongruentialGenerator { state: w(seed) }
}
}
impl LinearCongruentialGenerator for BSDLinearCongruentialGenerator {
fn seed(&mut self, seed: u32) {
self.state = w(seed... | BSDLinearCongruentialGenerator | identifier_name |
tag.rs | use syn;
use quote;
use nom::{space, digit};
use std::str::from_utf8;
use asn1_cereal::tag;
// FIXME: Documenation
/// Parse a string as an ASN.1 tag definition.
///
/// IE: /\[ (UNIVERSAL|APPLICATION|CONTEXT|PRIVATE|) [0-9]+ \]/
named!(pub parse_tag<quote::Tokens>, chain!(
space? ~
tag: delimited!(
tag!("[... | tagnum: digit ~
space? ~
constructed: tag!("PRIMITIVE")? ~
space?,
|| {
let class = match class.map(|e| from_utf8(e).unwrap()).unwrap_or("CONTEXT") {
"UNIVERSAL" => "::asn1_cereal::tag::Class::Universal",
"APPLICATION" => "::asn1_cereal::tag::Class::Applicatio... | space? ~ | random_line_split |
error_codes.rs | extern crate num_traits;
use self::num_traits::int::PrimInt;
use indy::IndyError;
use utils::error;
use error::prelude::{VcxError, VcxErrorKind};
pub fn map_indy_error<T, C: PrimInt>(rtn: T, error_code: C) -> Result<T, u32> {
if error_code == C::zero() {
return Ok(rtn);
}
Err(map_indy_error_code... | 200 => error::INVALID_WALLET_HANDLE.code_num,
203 => error::WALLET_ALREADY_EXISTS.code_num,
206 => error::WALLET_ALREADY_OPEN.code_num,
212 => error::WALLET_RECORD_NOT_FOUND.code_num,
213 => error::DUPLICATE_WALLET_RECORD.code_num,
306 => error::CREATE_POOL_CONFIG.code_nu... | 100 ... 111 => error::INVALID_LIBINDY_PARAM.code_num,
113 => error::LIBINDY_INVALID_STRUCTURE.code_num, | random_line_split |
error_codes.rs | extern crate num_traits;
use self::num_traits::int::PrimInt;
use indy::IndyError;
use utils::error;
use error::prelude::{VcxError, VcxErrorKind};
pub fn map_indy_error<T, C: PrimInt>(rtn: T, error_code: C) -> Result<T, u32> {
if error_code == C::zero() {
return Ok(rtn);
}
Err(map_indy_error_code... |
pub fn map_indy_error_code<C: PrimInt>(error_code: C) -> u32 {
let error_code = match error_code.to_u32() {
Some(n) => {
error!("MAPPING ERROR: {:?} -- {}", n, error::error_message(&n));
n
}
None => return error::UNKNOWN_LIBINDY_ERROR.code_num
};
if error_c... | {
match error.error_code as u32 {
100 ... 111 => VcxError::from_msg(VcxErrorKind::InvalidLibindyParam, error.message),
113 => VcxError::from_msg(VcxErrorKind::LibindyInvalidStructure, error.message),
114 => VcxError::from_msg(VcxErrorKind::IOError, error.message),
200 => VcxError::fr... | identifier_body |
error_codes.rs | extern crate num_traits;
use self::num_traits::int::PrimInt;
use indy::IndyError;
use utils::error;
use error::prelude::{VcxError, VcxErrorKind};
pub fn map_indy_error<T, C: PrimInt>(rtn: T, error_code: C) -> Result<T, u32> {
if error_code == C::zero() {
return Ok(rtn);
}
Err(map_indy_error_code... | (error: IndyError) -> VcxError {
match error.error_code as u32 {
100... 111 => VcxError::from_msg(VcxErrorKind::InvalidLibindyParam, error.message),
113 => VcxError::from_msg(VcxErrorKind::LibindyInvalidStructure, error.message),
114 => VcxError::from_msg(VcxErrorKind::IOError, error.message... | map_rust_indy_sdk_error | identifier_name |
references_and_borrowing.rs | pub fn references_and_borrowing() {
println!("***References and Borrowing***");
let v1 = vec![1, 2, 3, 4];
let v2 = vec![3, 4, 5, 6];
let res = foo_one(&v1, &v2); // borrowing a reference
println!("result is {}", res);
println!("v1[0] is {}", v1[0]);
let mut x = 5;
{
let y = &... | (v1: &Vec<i32>, v2: &Vec<i32>) -> i32 {
v1[0] + v2[0]
}
| foo_one | identifier_name |
references_and_borrowing.rs | pub fn references_and_borrowing() | }
println!("");
let mut v4 = vec![1, 2, 3];
{
let v_r = &mut v4;
v_r.push(8);
}
println!("v4[3] is {}", v4[3]);
println!("");
}
fn foo_one(v1: &Vec<i32>, v2: &Vec<i32>) -> i32 {
v1[0] + v2[0]
}
| {
println!("***References and Borrowing***");
let v1 = vec![1, 2, 3, 4];
let v2 = vec![3, 4, 5, 6];
let res = foo_one(&v1, &v2); // borrowing a reference
println!("result is {}", res);
println!("v1[0] is {}", v1[0]);
let mut x = 5;
{
let y = &mut x;
*y += 1;
}
... | identifier_body |
references_and_borrowing.rs | pub fn references_and_borrowing() {
println!("***References and Borrowing***");
let v1 = vec![1, 2, 3, 4];
let v2 = vec![3, 4, 5, 6];
let res = foo_one(&v1, &v2); // borrowing a reference
println!("result is {}", res);
println!("v1[0] is {}", v1[0]);
let mut x = 5;
{
let y = &... | println!("v4[3] is {}", v4[3]);
println!("");
}
fn foo_one(v1: &Vec<i32>, v2: &Vec<i32>) -> i32 {
v1[0] + v2[0]
} | let v_r = &mut v4;
v_r.push(8);
} | random_line_split |
geometry.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 cssparser::ToCss;
use euclid::length::Length;
use euclid::num::Zero;
use euclid::point::Point2D;
use euclid::r... |
#[inline]
fn mul(self, other: i32) -> Au {
Au(self.0.wrapping_mul(other))
}
}
impl Div<i32> for Au {
type Output = Au;
#[inline]
fn div(self, other: i32) -> Au {
Au(self.0 / other)
}
}
impl Rem<i32> for Au {
type Output = Au;
#[inline]
fn rem(self, other: i32... | type Output = Au; | random_line_split |
geometry.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 cssparser::ToCss;
use euclid::length::Length;
use euclid::num::Zero;
use euclid::point::Point2D;
use euclid::r... |
}
impl fmt::Debug for Au {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}px", self.to_f64_px())
}
}
impl ToCss for Au {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
write!(dest, "{}px", self.to_f64_px())
}
}
impl Add for Au {
type O... | {
e.emit_f64(self.to_f64_px())
} | identifier_body |
geometry.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 cssparser::ToCss;
use euclid::length::Length;
use euclid::num::Zero;
use euclid::point::Point2D;
use euclid::r... | (self, factor: f32) -> Au {
Au(((self.0 as f32) * factor) as i32)
}
#[inline]
pub fn from_px(px: i32) -> Au {
Au((px * AU_PER_PX) as i32)
}
#[inline]
pub fn from_page_px(px: Length<PagePx, f32>) -> Au {
Au((px.get() * (AU_PER_PX as f32)) as i32)
}
/// Rounds th... | scale_by | identifier_name |
geometry.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 cssparser::ToCss;
use euclid::length::Length;
use euclid::num::Zero;
use euclid::point::Point2D;
use euclid::r... |
else { return Au(self.0 - res) };
}
#[inline]
pub fn from_f32_px(px: f32) -> Au {
Au((px * (AU_PER_PX as f32)) as i32)
}
#[inline]
pub fn from_pt(pt: f64) -> Au {
Au::from_f64_px(pt_to_px(pt))
}
#[inline]
pub fn from_f64_px(px: f64) -> Au {
... | { return Au(self.0 - res + AU_PER_PX) } | conditional_block |
idt.rs | use arch::segmentation::{self, SegmentSelector};
use super::bit_field::BitField;
use super::{HandlerFunc, InterruptVector};
/// Interrupt descriptor table.
pub struct Idt([Entry; 256]);
/// An entry of the interrupt descriptor table.
#[derive(Debug, Clone, Copy)]
#[repr(C, packed)]
pub struct Entry {
pointer_low:... | pointer_low: 0,
pointer_middle: 0,
pointer_high: 0,
options: BitField::new(0),
reserved: 0,
};
EntryOptions::minimal(&mut entry);
entry
}
} |
/// Create a missing entry.
fn missing() -> Self {
let mut entry = Entry {
gdt_selector: SegmentSelector::new(0), | random_line_split |
idt.rs | use arch::segmentation::{self, SegmentSelector};
use super::bit_field::BitField;
use super::{HandlerFunc, InterruptVector};
/// Interrupt descriptor table.
pub struct Idt([Entry; 256]);
/// An entry of the interrupt descriptor table.
#[derive(Debug, Clone, Copy)]
#[repr(C, packed)]
pub struct Entry {
pointer_low:... |
}
impl Entry {
/// Create a new entry using the handler and GDT selector.
fn new(gdt_selector: SegmentSelector, handler: HandlerFunc) -> Self {
let pointer = handler as u64;
let mut entry = Entry {
gdt_selector: gdt_selector,
pointer_low: pointer as u16,
poi... | {
use super::dtables::{DescriptorTablePointer, lidt};
use core::mem::size_of;
let ptr = DescriptorTablePointer {
base: self as *const _ as u64,
limit: (size_of::<Self>() - 1) as u16,
};
unsafe { lidt(&ptr) };
} | identifier_body |
idt.rs | use arch::segmentation::{self, SegmentSelector};
use super::bit_field::BitField;
use super::{HandlerFunc, InterruptVector};
/// Interrupt descriptor table.
pub struct Idt([Entry; 256]);
/// An entry of the interrupt descriptor table.
#[derive(Debug, Clone, Copy)]
#[repr(C, packed)]
pub struct Entry {
pointer_low:... | (self, index: u16) -> Self {
let mut options = self.0.options;
options.set_range(0..3, index);
self.0.options = options;
self
}
}
impl Idt {
/// Create a new IDT.
pub fn new() -> Idt {
Idt([Entry::missing(); 256])
}
/// Set an interrupt vector using a handle... | set_stack_index | identifier_name |
alpine.rs | use std::io::Write;
use std::fs::File;
use std::path::Path;
use unshare::{Command, Stdio};
use rand::{thread_rng, Rng};
use super::super::super::file_util::create_dir;
use super::super::context::{Context};
use super::super::capsule;
use super::super::packages;
use process_util::capture_stdout;
use builder::distrib::{... | ctx.build_deps.remove(&istr);
if ctx.packages.insert(istr.clone()) {
to_install.push(istr);
}
}
} else {
unsupp.push(*i);
continue;
}
}
if to_instal... | {
try!(self.bootstrap(ctx));
let mut to_install = vec!();
let mut unsupp = vec!();
for i in features.iter() {
if let Some(lst) = build_deps(*i) {
for i in lst.into_iter() {
if !ctx.packages.contains(i) {
if ctx.build... | identifier_body |
alpine.rs | use std::io::Write;
use std::fs::File;
use std::path::Path;
use unshare::{Command, Stdio};
use rand::{thread_rng, Rng};
use super::super::super::file_util::create_dir;
use super::super::context::{Context};
use super::super::capsule;
use super::super::packages;
use process_util::capture_stdout;
use builder::distrib::{... | (ctx: &mut Context, version: &String)
-> Result<(), String>
{
try!(capsule::ensure_features(ctx, &[capsule::AlpineInstaller]));
try_msg!(create_dir("/vagga/root/etc/apk", true),
"Error creating apk dir: {err}");
let mirror = ctx.settings.alpine_mirror.clone()
.unwrap_or(choose_mirror());
... | setup_base | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.