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 |
|---|---|---|---|---|
comment4.rs | #![allow(dead_code)] // bar
//! Doc comment
fn test() {
// comment
// comment2
code(); /* leave this comment alone!
* ok? */
/* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a
* diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
* viverra ne... | * felis, pulvinar a semper sed, adipiscing id dolor. */
// Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooong comment that should be split
// println!("{:?}", rewrite_comment(subslice,
// false,
// comment_w... | * tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut
* libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit
* amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis | random_line_split |
comment4.rs | #![allow(dead_code)] // bar
//! Doc comment
fn test() {
// comment
// comment2
code(); /* leave this comment alone!
* ok? */
/* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a
* diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
* viverra ne... | () {}
/*
Regression test for issue #956
(some very important text)
*/
/*
fn debug_function() {
println!("hello");
}
// */
#[link_section=".vectors"]
#[no_mangle] // Test this attribute is preserved.
#[cfg_attr(rustfmt, rustfmt::skip)]
pub static ISSUE_1284: [i32; 16] = [];
| doc_comment | identifier_name |
tarball.rs | use flate2::{write::GzEncoder, Compression};
use std::{
fs::{self, File},
io::{self, Write},
path::{Path, MAIN_SEPARATOR},
};
use tar::Builder;
// todo: this is pretty involved. (re)factor this into its own crate
pub fn dir<W>(
buf: W,
path: &str,
) -> io::Result<()>
where
W: Write,
| }
}
}
Ok(())
}
{
let base_path = Path::new(path).canonicalize()?;
// todo: don't unwrap
let mut base_path_str = base_path.to_str().unwrap().to_owned();
if let Some(last) = base_path_str.chars().last() {
if last!= MAIN_SEPAR... | {
let mut archive = Builder::new(GzEncoder::new(buf, Compression::best()));
fn bundle<F>(
dir: &Path,
f: &mut F,
bundle_dir: bool,
) -> io::Result<()>
where
F: FnMut(&Path) -> io::Result<()>,
{
if fs::metadata(dir)?.is_dir() {
if bundle_dir {
... | identifier_body |
tarball.rs | use flate2::{write::GzEncoder, Compression};
use std::{
fs::{self, File},
io::{self, Write},
path::{Path, MAIN_SEPARATOR},
};
use tar::Builder;
// todo: this is pretty involved. (re)factor this into its own crate
pub fn dir<W>(
buf: W,
path: &str,
) -> io::Result<()>
where
W: Write,
{
let m... |
}
}
Ok(())
}
{
let base_path = Path::new(path).canonicalize()?;
// todo: don't unwrap
let mut base_path_str = base_path.to_str().unwrap().to_owned();
if let Some(last) = base_path_str.chars().last() {
if last!= MAIN_SEPARATOR {
... | {
f(&entry.path().as_path())?;
} | conditional_block |
tarball.rs | use flate2::{write::GzEncoder, Compression};
use std::{
fs::{self, File},
io::{self, Write},
path::{Path, MAIN_SEPARATOR},
};
use tar::Builder;
// todo: this is pretty involved. (re)factor this into its own crate
pub fn | <W>(
buf: W,
path: &str,
) -> io::Result<()>
where
W: Write,
{
let mut archive = Builder::new(GzEncoder::new(buf, Compression::best()));
fn bundle<F>(
dir: &Path,
f: &mut F,
bundle_dir: bool,
) -> io::Result<()>
where
F: FnMut(&Path) -> io::Result<()>,
{
... | dir | identifier_name |
tarball.rs | use flate2::{write::GzEncoder, Compression};
use std::{
fs::{self, File},
io::{self, Write},
path::{Path, MAIN_SEPARATOR},
};
use tar::Builder;
// todo: this is pretty involved. (re)factor this into its own crate
pub fn dir<W>(
buf: W,
path: &str,
) -> io::Result<()>
where
W: Write,
{
let m... | Ok(())
}
{
let base_path = Path::new(path).canonicalize()?;
// todo: don't unwrap
let mut base_path_str = base_path.to_str().unwrap().to_owned();
if let Some(last) = base_path_str.chars().last() {
if last!= MAIN_SEPARATOR {
base_path_str.push(... | } else {
f(&entry.path().as_path())?;
}
}
} | random_line_split |
parse.rs | use std::fmt;
use crate::error::EncryptedCryptEncodingError;
use crate::error::ParseError;
use lazy_static::lazy_static;
use regex::Regex;
use rmp_serde;
use serde::{Deserialize, Serialize};
const BASE64_CONFIG: base64::Config = base64::STANDARD_NO_PAD;
const BEGIN_CRYPT_STR: &'static str = "BEGIN CRYPT";
const BEG... | () {
let block = EncryptedCryptBlock {
algorithm: "test_algo".to_string(),
nonce: b"nonce".to_vec(),
ciphertext: b"this is some good ciphertext".to_vec(),
};
let armored = block.to_ascii_armor().unwrap();
let parsed = EncryptedCryptBlock::from_str(&armored).unwrap();
assert... | test_parsing_encrypted_crypt_block | identifier_name |
parse.rs | use std::fmt;
use crate::error::EncryptedCryptEncodingError;
use crate::error::ParseError;
use lazy_static::lazy_static;
use regex::Regex;
use rmp_serde;
use serde::{Deserialize, Serialize};
const BASE64_CONFIG: base64::Config = base64::STANDARD_NO_PAD;
const BEGIN_CRYPT_STR: &'static str = "BEGIN CRYPT";
const BEG... |
}
Ok(())
}
}
impl CryptFile {
pub fn is_crypt_file(contents: &str) -> bool {
IS_CRYPT_FILE_RE.is_match(contents)
}
pub fn has_unencrypted_crypt_blocks(&self) -> bool {
self.blocks.iter().any(|block| match block {
Block::UnencryptedCryptBlock(_) => true,
... | {
write!(f, "\n")?;
} | conditional_block |
parse.rs | use std::fmt;
use crate::error::EncryptedCryptEncodingError;
use crate::error::ParseError;
use lazy_static::lazy_static;
use regex::Regex;
use rmp_serde;
use serde::{Deserialize, Serialize};
const BASE64_CONFIG: base64::Config = base64::STANDARD_NO_PAD;
const BEGIN_CRYPT_STR: &'static str = "BEGIN CRYPT";
const BEG... | prev_end = end_idx;
}
if prev_end!= contents.len() - 1 {
let plaintext = &contents[(prev_end + END_CRYPT_LEN)..];
blocks.push(Block::Plaintext(plaintext.to_string()));
}
Ok(CryptFile { blocks })
}
}
#[test]
fn test_from_str_unencrypted() {
l... | )?)
} else {
Block::UnencryptedCryptBlock(matching_contents.trim().to_string())
};
blocks.push(block); | random_line_split |
parse.rs | use std::fmt;
use crate::error::EncryptedCryptEncodingError;
use crate::error::ParseError;
use lazy_static::lazy_static;
use regex::Regex;
use rmp_serde;
use serde::{Deserialize, Serialize};
const BASE64_CONFIG: base64::Config = base64::STANDARD_NO_PAD;
const BEGIN_CRYPT_STR: &'static str = "BEGIN CRYPT";
const BEG... |
}
#[derive(Debug)]
pub struct CryptFile {
pub blocks: Vec<Block>,
}
impl fmt::Display for CryptFile {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.blocks
.iter()
.map(|block| match block {
Block::Plaintext(text) => write!(f, "{}", text),
... | {
match self {
Block::Plaintext(_) | Block::UnencryptedCryptBlock(_) => false,
Block::EncryptedCryptBlock(_) => true,
}
} | identifier_body |
mod.rs | //! Cartridge emulation. There are multiple cartridge types with
//! different capabilities (bankable ROM/RAM, battery, RTC etc...).
use std::fmt::{Debug, Formatter, Error};
use std::path::{Path, PathBuf};
use std::fs::{File, OpenOptions};
use std::iter::repeat;
use ascii::AsciiCast;
use std::io::{SeekFrom, Read, Writ... | #[cfg(test)]
pub fn from_vec(rom: Vec<u8>) -> Cartridge {
Cartridge {
rom: rom,
ram: Vec::new(),
rom_bank: 1,
rom_banks: 2,
rom_offset: 0,
ram_offset: 0,
ram_wp: true,
bank_ram: false,
... |
/// Create a Cartridge instance from a ROM provided in a
/// Vec<u8>. Usefull for tests. Creates a MBC0 model without
/// banking. | random_line_split |
mod.rs | //! Cartridge emulation. There are multiple cartridge types with
//! different capabilities (bankable ROM/RAM, battery, RTC etc...).
use std::fmt::{Debug, Formatter, Error};
use std::path::{Path, PathBuf};
use std::fs::{File, OpenOptions};
use std::iter::repeat;
use ascii::AsciiCast;
use std::io::{SeekFrom, Read, Writ... | (rom_path: &Path) -> IoResult<Cartridge> {
let mut source = try!(File::open(rom_path));
let mut rom = Vec::new();
// There must always be at least two ROM banks
try!((&mut source).take(2 * ROM_BANK_SIZE as u64)
.read_to_end(&mut rom));
let model = models::from_id(r... | from_path | identifier_name |
mod.rs | //! Cartridge emulation. There are multiple cartridge types with
//! different capabilities (bankable ROM/RAM, battery, RTC etc...).
use std::fmt::{Debug, Formatter, Error};
use std::path::{Path, PathBuf};
use std::fs::{File, OpenOptions};
use std::iter::repeat;
use ascii::AsciiCast;
use std::io::{SeekFrom, Read, Writ... | Ok(())
}
}
// Each ROM bank is always 16KB
const ROM_BANK_SIZE: i32 = 16 * 1024;
mod offsets {
//! Various offset values to access special memory locations within the ROM
/// Title. Upper case ASCII 16bytes long, padded with 0s if shorter
pub const TITLE: usize = 0x134;
/// Cartridge ... | {
let name = match self.name() {
Some(s) => s,
None => "<INVALID>".to_string(),
};
let rombanks = self.rom_banks();
let (rambanks, rambanksize) = match self.parse_ram_banks() {
Some(n) => n,
None => (0, 0),
};
try!(... | identifier_body |
proxy.rs | //! use irc::client::prelude::Config;
//! use irc::client::data::ProxyType;
//!
//! # fn main() {
//! let config = Config {
//! nickname: Some("test".to_owned()),
//! server: Some("irc.example.com".to_owned()),
//! proxy_type: Some(ProxyType::Socks5),
//! proxy_server: Some("127.0.0.1".to_owned()),
//! ... | //! A feature which allow us to connect to IRC via a proxy.
//!
//! ``` | random_line_split | |
proxy.rs | //! A feature which allow us to connect to IRC via a proxy.
//!
//! ```
//! use irc::client::prelude::Config;
//! use irc::client::data::ProxyType;
//!
//! # fn main() {
//! let config = Config {
//! nickname: Some("test".to_owned()),
//! server: Some("irc.example.com".to_owned()),
//! proxy_type: Some(Prox... | {
/// Does not use any proxy.
None,
/// Use a SOCKS5 proxy.
/// DNS queries are also sent via the proxy.
Socks5,
}
| ProxyType | identifier_name |
lib.rs | #[macro_use]
extern crate failure;
#[macro_use]
extern crate lazy_static;
extern crate chrono;
extern crate mp3_duration;
extern crate rayon;
extern crate regex;
extern crate reqwest;
extern crate rss;
extern crate select;
extern crate url;
mod diecast;
mod spodcast;
mod util;
mod vortex_theatre;
use std::collection... | keys.sort();
keys.reverse();
let mut items: Vec<_> = keys
.par_iter()
.map(|url| {
if url.ends_with('*') {
None
} else if let Some(found) = rss_data
.items()
.iter()
.find(|item| item.link() == Some(url))
... | {
// Read podcast.urls and podcast.xml
let urls = match get_urls(podcast) {
Err(ref e) => {
print_error(e);
return;
}
Ok(urls) => urls,
};
let mut rss_data = match get_rss(podcast) {
Err(ref e) => {
print_error(e);
return;
... | identifier_body |
lib.rs | #[macro_use]
extern crate failure;
#[macro_use]
extern crate lazy_static;
extern crate chrono;
extern crate mp3_duration;
extern crate rayon;
extern crate regex;
extern crate reqwest;
extern crate rss;
extern crate select;
extern crate url;
mod diecast;
mod spodcast;
mod util;
mod vortex_theatre;
use std::collection... | (url: &str) -> Result<Item> {
// Get the html and build an Item.
let response = reqwest::blocking::get(url)?;
let body = response.text()?;
let document = Document::from(body.as_str());
process_document(url, &document)
}
pub fn handle(podcast: &str) {
// Read podcast.urls and podcast.xml
le... | get_item | identifier_name |
lib.rs | #[macro_use]
extern crate failure;
#[macro_use]
extern crate lazy_static;
extern crate chrono;
extern crate mp3_duration;
extern crate rayon;
extern crate regex;
extern crate reqwest;
extern crate rss;
extern crate select;
extern crate url;
mod diecast;
mod spodcast;
mod util;
mod vortex_theatre;
use std::collection... | .iter()
.find(|item| item.link() == Some(url))
{
Some(found.clone())
} else {
// Find any missing urls.
// println!("Missing {}", url);
let item = urls[url].clone().ok_or(|| ()).or_else(|_| get_item(url... | .map(|url| {
if url.ends_with('*') {
None
} else if let Some(found) = rss_data
.items() | random_line_split |
fn.rs | // Unlike C/C++, there's no restriction on the order of function definitions
fn main() {
// We can use this function here, and define it somewhere later
fizzbuzz_to(100);
}
// Function that returns a boolean value
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
// Corner case, early return
if rhs == 0... | } else if is_divisible_by(n, 5) {
println!("buzz");
} else {
println!("{}", n);
}
}
// When a function returns `()`, the return type can be omitted from the
// signature
fn fizzbuzz_to(n: u32) {
for n in range(1, n + 1) {
fizzbuzz(n);
}
} | println!("fizzbuzz");
} else if is_divisible_by(n, 3) {
println!("fizz"); | random_line_split |
fn.rs | // Unlike C/C++, there's no restriction on the order of function definitions
fn | () {
// We can use this function here, and define it somewhere later
fizzbuzz_to(100);
}
// Function that returns a boolean value
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
// Corner case, early return
if rhs == 0 {
return false;
}
// This is an expression, the `return` keyword i... | main | identifier_name |
fn.rs | // Unlike C/C++, there's no restriction on the order of function definitions
fn main() {
// We can use this function here, and define it somewhere later
fizzbuzz_to(100);
}
// Function that returns a boolean value
fn is_divisible_by(lhs: u32, rhs: u32) -> bool {
// Corner case, early return
if rhs == 0... | else if is_divisible_by(n, 5) {
println!("buzz");
} else {
println!("{}", n);
}
}
// When a function returns `()`, the return type can be omitted from the
// signature
fn fizzbuzz_to(n: u32) {
for n in range(1, n + 1) {
fizzbuzz(n);
}
}
| {
println!("fizz");
} | conditional_block |
fn.rs | // Unlike C/C++, there's no restriction on the order of function definitions
fn main() {
// We can use this function here, and define it somewhere later
fizzbuzz_to(100);
}
// Function that returns a boolean value
fn is_divisible_by(lhs: u32, rhs: u32) -> bool |
// Functions that "don't" return a value, actually return the unit type `()`
fn fizzbuzz(n: u32) -> () {
if is_divisible_by(n, 15) {
println!("fizzbuzz");
} else if is_divisible_by(n, 3) {
println!("fizz");
} else if is_divisible_by(n, 5) {
println!("buzz");
} else {
pr... | {
// Corner case, early return
if rhs == 0 {
return false;
}
// This is an expression, the `return` keyword is not necessary here
lhs % rhs == 0
} | identifier_body |
sip.rs | //! An implementation of SipHash.
#![allow(deprecated)] // the types in this module are deprecated
use crate::cmp;
use crate::marker::PhantomData;
use crate::mem;
use crate::ptr;
/// An implementation of SipHash 1-3.
///
/// This is currently the default hashing function used by standard library
/// (e.g., `collecti... | (&self) -> u64 {
let mut state = self.state;
let b: u64 = ((self.length as u64 & 0xff) << 56) | self.tail;
state.v3 ^= b;
S::c_rounds(&mut state);
state.v0 ^= b;
state.v2 ^= 0xff;
S::d_rounds(&mut state);
state.v0 ^ state.v1 ^ state.v2 ^ state.v3
}... | finish | identifier_name |
sip.rs | //! An implementation of SipHash.
#![allow(deprecated)] // the types in this module are deprecated
use crate::cmp;
use crate::marker::PhantomData;
use crate::mem;
use crate::ptr;
/// An implementation of SipHash 1-3.
///
/// This is currently the default hashing function used by standard library
/// (e.g., `collecti... | SipHasher13 { hasher: Hasher::new_with_keys(key0, key1) }
}
}
impl<S: Sip> Hasher<S> {
#[inline]
fn new_with_keys(key0: u64, key1: u64) -> Hasher<S> {
let mut state = Hasher {
k0: key0,
k1: key1,
length: 0,
state: State { v0: 0, v1: 0, v2: 0, ... | reason = "use `std::collections::hash_map::DefaultHasher` instead"
)]
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 { | random_line_split |
sip.rs | //! An implementation of SipHash.
#![allow(deprecated)] // the types in this module are deprecated
use crate::cmp;
use crate::marker::PhantomData;
use crate::mem;
use crate::ptr;
/// An implementation of SipHash 1-3.
///
/// This is currently the default hashing function used by standard library
/// (e.g., `collecti... |
// Buffered tail is now flushed, process new input.
let len = length - needed;
let left = len & 0x7; // len % 8
let mut i = needed;
while i < len - left {
// SAFETY: because `len - left` is the biggest multiple of 8 under
// `len`, and because `i` starts... | {
let length = msg.len();
self.length += length;
let mut needed = 0;
if self.ntail != 0 {
needed = 8 - self.ntail;
// SAFETY: `cmp::min(length, needed)` is guaranteed to not be over `length`
self.tail |= unsafe { u8to64_le(msg, 0, cmp::min(length, ne... | identifier_body |
sip.rs | //! An implementation of SipHash.
#![allow(deprecated)] // the types in this module are deprecated
use crate::cmp;
use crate::marker::PhantomData;
use crate::mem;
use crate::ptr;
/// An implementation of SipHash 1-3.
///
/// This is currently the default hashing function used by standard library
/// (e.g., `collecti... |
// Buffered tail is now flushed, process new input.
let len = length - needed;
let left = len & 0x7; // len % 8
let mut i = needed;
while i < len - left {
// SAFETY: because `len - left` is the biggest multiple of 8 under
// `len`, and because `i` start... | {
needed = 8 - self.ntail;
// SAFETY: `cmp::min(length, needed)` is guaranteed to not be over `length`
self.tail |= unsafe { u8to64_le(msg, 0, cmp::min(length, needed)) } << (8 * self.ntail);
if length < needed {
self.ntail += length;
retur... | conditional_block |
day1.rs | use std::io;
use common;
use std::collections::HashSet;
use std::error::Error;
fn dist(pos: (i32, i32)) -> i32 {
let (x, y) = pos;
return x.abs() + y.abs()
}
pub struct Day1 {
pos: (i32, i32),
dir: i32,
}
impl Day1 {
pub fn new() -> Day1 {
Day1{
pos: (0, 0),
dir:... |
#[test]
fn sample_part2() {
let mut instance = Day1::new();
assert_eq!("4", instance.part2(&mut "R8, R4, R4, R8".as_bytes()))
}
}
| {
let mut instance = Day1::new();
assert_eq!("8", instance.part1(&mut "R8, R4, R4, R8".as_bytes()))
} | identifier_body |
day1.rs | use std::io;
use common;
use std::collections::HashSet;
use std::error::Error;
fn dist(pos: (i32, i32)) -> i32 {
let (x, y) = pos;
return x.abs() + y.abs()
}
pub struct | {
pos: (i32, i32),
dir: i32,
}
impl Day1 {
pub fn new() -> Day1 {
Day1{
pos: (0, 0),
dir: (0),
}
}
fn walk(&mut self) -> (i32, i32) {
let backwards = if self.dir & 2 == 2 { -1 } else { 1 };
let (x, y) = self.pos;
self.pos = (x + bac... | Day1 | identifier_name |
day1.rs | use std::io;
use common;
use std::collections::HashSet;
use std::error::Error;
fn dist(pos: (i32, i32)) -> i32 {
let (x, y) = pos;
return x.abs() + y.abs()
}
pub struct Day1 {
pos: (i32, i32),
dir: i32,
}
impl Day1 {
pub fn new() -> Day1 {
Day1{
pos: (0, 0),
dir:... | let mut instance = Day1::new();
assert_eq!("8", instance.part1(&mut "R8, R4, R4, R8".as_bytes()))
}
#[test]
fn sample_part2() {
let mut instance = Day1::new();
assert_eq!("4", instance.part2(&mut "R8, R4, R4, R8".as_bytes()))
}
} | use common::Solution;
#[test]
fn sample_part1() { | random_line_split |
mod.rs | // Copyright 2014-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-MI... | () -> TargetOptions {
TargetOptions {
data_layout: String::new(),
linker: "cc".to_string(),
ar: "ar".to_string(),
pre_link_args: Vec::new(),
post_link_args: Vec::new(),
cpu: "generic".to_string(),
features: "".to_string(),
... | default | identifier_name |
mod.rs | // Copyright 2014-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-MI... | x86_64_unknown_linux_gnu,
i686_unknown_linux_gnu,
mips_unknown_linux_gnu,
mipsel_unknown_linux_gnu,
powerpc_unknown_linux_gnu,
arm_unknown_linux_gnueabi,
arm_unknown_linux_gnueabihf,
aarch64_unknown_linux_gnu,
x8... | }
)
}
load_specific!( | random_line_split |
mod.rs | // Copyright 2014-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-MI... |
// this would use a match if stringify! were allowed in pattern position
macro_rules! load_specific {
( $($name:ident),+ ) => (
{
$(mod $name;)*
let target = target.replace("-", "_");
if false { }
... | {
let mut f = try!(File::open(path).map_err(|e| e.to_string()));
let mut contents = Vec::new();
try!(f.read_to_end(&mut contents).map_err(|e| e.to_string()));
let obj = try!(json::from_reader(&mut &contents[..])
.map_err(|e| e.to_string()))... | identifier_body |
random.rs | // library imports
use rand;
use rand::Rng;
use rand::distributions::normal::{StandardNormal};
use super::matrix::*;
use matrix::traits::*;
#[allow(deprecated)]
/// Generate a random matrix of uniformly distributed numbers
pub fn rand_std_normal(rows: usize, cols : usize)-> MatrixF64 {
let mut m : Matrix<f64> = M... |
#[test]
fn test_rand_std_normal(){
let m1 = super::rand_std_normal(10, 10);
assert_eq!(m1.num_cells(), 100);
}
} | mod tests {
use api::*; | random_line_split |
random.rs | // library imports
use rand;
use rand::Rng;
use rand::distributions::normal::{StandardNormal};
use super::matrix::*;
use matrix::traits::*;
#[allow(deprecated)]
/// Generate a random matrix of uniformly distributed numbers
pub fn rand_std_normal(rows: usize, cols : usize)-> MatrixF64 {
let mut m : Matrix<f64> = M... |
} | {
let m1 = super::rand_std_normal(10, 10);
assert_eq!(m1.num_cells(), 100);
} | identifier_body |
random.rs | // library imports
use rand;
use rand::Rng;
use rand::distributions::normal::{StandardNormal};
use super::matrix::*;
use matrix::traits::*;
#[allow(deprecated)]
/// Generate a random matrix of uniformly distributed numbers
pub fn rand_std_normal(rows: usize, cols : usize)-> MatrixF64 {
let mut m : Matrix<f64> = M... | (){
let m1 = super::rand_std_normal(10, 10);
assert_eq!(m1.num_cells(), 100);
}
} | test_rand_std_normal | identifier_name |
const-enum-vector.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 ... | () {
match C[1] {
E::V1(n) => assert!(n == 0xDEADBEE),
_ => panic!()
}
match C[2] {
E::V0 => (),
_ => panic!()
}
}
| main | identifier_name |
const-enum-vector.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 ... | }
} | match C[2] {
E::V0 => (),
_ => panic!() | random_line_split |
client_ws.rs | use std::{pin::Pin, sync::{Arc}};
use async_tungstenite::{async_std::connect_async, tungstenite::http::Request};
use eyre::{
eyre,
Result,
Context as _,
};
use futures_util::{
future,
future::Future,
future::{
TryFutureExt,
},
stream::{
Stream,
StreamExt,
... | ,
msg => future::err(eyre!("Unsupported message type: {:?}", msg))
}
})
.inspect_err(|err| {
warn!("Client websocket read error: {:?}", err);
})
.take_while(|result| {
if let Ok(Some(_)) = result.as_ref() {
future::ready(t... | {
debug!("Client websocket closed");
future::ok(None)
} | conditional_block |
client_ws.rs | use std::{pin::Pin, sync::{Arc}};
use async_tungstenite::{async_std::connect_async, tungstenite::http::Request};
use eyre::{
eyre,
Result,
Context as _,
};
use futures_util::{
future,
future::Future,
future::{
TryFutureExt,
},
stream::{
Stream,
StreamExt,
... | <F, Fut, S>(
signal: Signal,
url: String,
aud: &str,
server_keys: &Arc<printspool_auth::ServerKeys>,
handle_data_channel: Arc<F>,
) -> Result<()>
where
F: Fn(
Signal,
Pin<Box<dyn Stream<Item = Message> +'static + Send + Send>>,
) -> Fut + Send + Sync +'static,
Fut: Future... | connect_to_client_ws | identifier_name |
client_ws.rs | use std::{pin::Pin, sync::{Arc}};
use async_tungstenite::{async_std::connect_async, tungstenite::http::Request};
use eyre::{
eyre,
Result,
Context as _,
};
use futures_util::{
future,
future::Future,
future::{
TryFutureExt,
},
stream::{
Stream,
StreamExt,
... | .header("Authorization", format!("Bearer {}", jwt))
.header(
"X-Host-Identity-Public-Key",
base64::encode(identity_public_key),
)
.header(
"X-Session-ID",
&session_id.0,
)
.body(())
.wrap_err("Error creating client websoc... | {
use crate::saltyrtc_chunk::{
ReliabilityMode,
ChunkDecoder,
ChunkEncoder,
};
let Signal {
session_id,
..
} = &signal;
let mode = ReliabilityMode::UnreliableUnordered;
let jwt = server_keys.create_signalling_jwt(aud)?;
let identity_public_key = &s... | identifier_body |
client_ws.rs | use std::{pin::Pin, sync::{Arc}};
use async_tungstenite::{async_std::connect_async, tungstenite::http::Request};
use eyre::{
eyre,
Result,
Context as _,
};
use futures_util::{
future,
future::Future,
future::{
TryFutureExt,
},
stream::{
Stream,
StreamExt,
... | .wrap_err("Error creating client websocket url")?;
let (ws_stream, _) = connect_async(request)
.await
.map_err(|err|
eyre!(
"Unable to connect to ws bridge ({}) (reason: {:?})",
url,
err,
)
)?;
let (
w... | "X-Session-ID",
&session_id.0,
)
.body(()) | random_line_split |
mul_add.rs | //! Implements vertical (lane-wise) floating-point `mul_add`.
macro_rules! impl_math_float_mul_add {
([$elem_ty:ident; $elem_count:expr]: $id:ident | $test_tt:tt) => {
impl $id {
/// Fused multiply add: `self * y + z`
#[inline]
pub fn mul_add(self, y: Self, z: Self) -> S... | assert_eq!(t, o.mul_add(o, o));
assert_eq!(t, o.mul_add(t, z));
assert_eq!(t, t.mul_add(o, z));
assert_eq!(f, t.mul_add(t, z));
assert_eq!(f, t.mul_add(o, t));
assert_eq!(t3, ... | random_line_split | |
cast.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// -*- rust -*-
pub fn main() {
let i: int = 'Q' as int;
assert_eq!(i, 0x51);
let u: u32 = i as u32;
assert_eq!(u, 0x51 as u32);
as... | // 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 | random_line_split |
cast.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
let i: int = 'Q' as int;
assert_eq!(i, 0x51);
let u: u32 = i as u32;
assert_eq!(u, 0x51 as u32);
assert_eq!(u, 'Q' as u32);
assert_eq!(i as u8, 'Q' as u8);
assert_eq!(i as u8 as i8, 'Q' as u8 as i8);
assert_eq!(0x51 as char, 'Q');
assert_eq!(true, 1 as bool);
assert_eq!(0 as u3... | identifier_body | |
cast.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
let i: int = 'Q' as int;
assert_eq!(i, 0x51);
let u: u32 = i as u32;
assert_eq!(u, 0x51 as u32);
assert_eq!(u, 'Q' as u32);
assert_eq!(i as u8, 'Q' as u8);
assert_eq!(i as u8 as i8, 'Q' as u8 as i8);
assert_eq!(0x51 as char, 'Q');
assert_eq!(true, 1 as bool);
assert_eq!(0 as... | main | identifier_name |
err.rs | use std::error::Error;
use std::fmt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::io;
/// The enum `ProcError` defines the possible errors
/// from constructor Proc.
#[derive(Debug)]
pub enum ProcError {
/// Can't read the sub-directory.
#[cfg(any(target_os = "linux", target_os = "android")... |
}
impl Error for ProcError {
/// The function `description` returns a short description of
/// the error.
fn description(&self) -> &str {
match *self {
#[cfg(any(target_os = "linux", target_os = "android"))]
ProcError::ReadDir(_) => "Can't read the sub-directory.",
#[cfg(targ... | {
write!(f, "{}", ::errno::errno())
} | identifier_body |
err.rs | use std::error::Error;
use std::fmt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::io;
/// The enum `ProcError` defines the possible errors
/// from constructor Proc.
#[derive(Debug)]
pub enum ProcError {
/// Can't read the sub-directory.
#[cfg(any(target_os = "linux", target_os = "android")... | (&self) -> Option<&Error> {
match *self {
#[cfg(any(target_os = "linux", target_os = "android"))]
ProcError::ReadDir(ref why) => Some(why),
#[cfg(target_os = "macos")]
_ => None,
}
}
}
| cause | identifier_name |
err.rs | use std::error::Error;
use std::fmt;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::io;
/// The enum `ProcError` defines the possible errors
/// from constructor Proc.
#[derive(Debug)]
pub enum ProcError {
/// Can't read the sub-directory.
#[cfg(any(target_os = "linux", target_os = "android")... | fn cause(&self) -> Option<&Error> {
match *self {
#[cfg(any(target_os = "linux", target_os = "android"))]
ProcError::ReadDir(ref why) => Some(why),
#[cfg(target_os = "macos")]
_ => None,
}
}
} |
/// The function `cause` returns the lower-level cause of
/// this error if any. | random_line_split |
lib.rs | //! Native C types and bindings of libR.
//!
//! ## Usage
//!
//! First, add the following to your Cargo.toml:
//!
//! ```lang=toml
//! [dependencies]
//! libr = 0.1
//! ```
//!
//! Next, add this to your crate root:
//!
//! ```
//! extern crate libr;
//! ```
//!
//! ## What is libr?
//!
//! The primary purpose of this... | //! }
//! }
//! ```
//!
extern crate libc;
mod va_list;
pub mod config;
pub mod defines;
#[allow(non_camel_case_types)]
pub mod ext;
pub mod math;
pub mod interface;
pub mod internals;
pub mod embedded;
pub mod s;
pub mod r;
pub mod version; | //! Rf_PrintValue(e);
//! R_tryEval(VECTOR_ELT(e, 0), R_GlobalEnv, &mut had_error);
//! Rf_unprotect(2);
//! Rembedded::Rf_endEmbeddedR(0); | random_line_split |
io.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... |
}
/// Writes to an owned, growable byte vector that supports seeking.
///
/// # Example
///
/// ```rust
/// # #![allow(unused_must_use)]
/// use rbml::io::SeekableMemWriter;
///
/// let mut w = SeekableMemWriter::new();
/// w.write([0, 1, 2]);
///
/// assert_eq!(w.unwrap(), vec!(0, 1, 2));
/// ```
pub struct Seekable... | {
Ok((offset + pos) as u64)
} | conditional_block |
io.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... | (b: &mut Bencher) {
do_bench_seekable_mem_writer(b, 100, 100)
}
#[bench]
fn bench_seekable_mem_writer_100_1000(b: &mut Bencher) {
do_bench_seekable_mem_writer(b, 100, 1000)
}
}
| bench_seekable_mem_writer_100_0100 | identifier_name |
io.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... |
#[inline]
fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> {
let new = try!(combine(style, self.pos, self.buf.len(), pos));
self.pos = new as uint;
Ok(())
}
}
#[cfg(test)]
mod tests {
extern crate test;
use super::SeekableMemWriter;
use std::io;
use t... | { Ok(self.pos as u64) } | identifier_body |
io.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... | /// ```
pub struct SeekableMemWriter {
buf: Vec<u8>,
pos: uint,
}
impl SeekableMemWriter {
/// Create a new `SeekableMemWriter`.
#[inline]
pub fn new() -> SeekableMemWriter {
SeekableMemWriter::with_capacity(BUF_CAPACITY)
}
/// Create a new `SeekableMemWriter`, allocating at least `... | /// w.write([0, 1, 2]);
///
/// assert_eq!(w.unwrap(), vec!(0, 1, 2)); | random_line_split |
allow_std.rs | use futures_core::task::{Context, Poll};
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead, IoSlice, IoSliceMut, SeekFrom};
use std::{fmt, io};
use std::pin::Pin;
/// A simple wrapper type which allows types which implement only
/// implem... |
fn consume(mut self: Pin<&mut Self>, amt: usize) {
self.0.consume(amt)
}
}
| {
let this: *mut Self = &mut *self as *mut _;
Poll::Ready(Ok(try_with_interrupt!(unsafe { &mut *this }.0.fill_buf())))
} | identifier_body |
allow_std.rs | use futures_core::task::{Context, Poll};
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead, IoSlice, IoSliceMut, SeekFrom};
use std::{fmt, io};
use std::pin::Pin;
/// A simple wrapper type which allows types which implement only
/// implem... | (&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
self.0.read_vectored(bufs)
}
#[cfg(feature = "read-initializer")]
unsafe fn initializer(&self) -> Initializer {
self.0.initial... | read | identifier_name |
allow_std.rs | use futures_core::task::{Context, Poll};
#[cfg(feature = "read-initializer")]
use futures_io::Initializer;
use futures_io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncBufRead, IoSlice, IoSliceMut, SeekFrom};
use std::{fmt, io};
use std::pin::Pin;
/// A simple wrapper type which allows types which implement only
/// implem... | impl<T> io::Write for AllowStdIo<T> where T: io::Write {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
}
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
self.0.write_vectored(bufs)
}
fn flush(&mut self) -> io::Result<()> {
... | random_line_split | |
impls_misc.rs | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | Unwind
}); |
impl_stable_hash_for!(enum ::rustc_target::spec::PanicStrategy {
Abort, | random_line_split |
any.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... |
}
/// Returns some mutable reference to the boxed value if it is of type `T`, or
/// `None` if it isn't.
#[unstable = "naming conventions around acquiring references may change"]
#[inline]
pub fn downcast_mut<'a, T:'static>(&'a mut self) -> Option<&'a mut T> {
if self.is::<T>() {
... | {
None
} | conditional_block |
any.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... | pub fn is<T:'static>(&self) -> bool {
// Get TypeId of the type this function is instantiated with
let t = TypeId::of::<T>();
// Get TypeId of the type in the trait object
let boxed = self.get_type_id();
// Compare both TypeIds on equality
t == boxed
}
/// ... | random_line_split | |
any.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... |
/// Returns some mutable reference to the boxed value if it is of type `T`, or
/// `None` if it isn't.
#[unstable = "naming conventions around acquiring references may change"]
#[inline]
pub fn downcast_mut<'a, T:'static>(&'a mut self) -> Option<&'a mut T> {
if self.is::<T>() {
... | {
if self.is::<T>() {
unsafe {
// Get the raw representation of the trait object
let to: TraitObject = transmute(self);
// Extract the data pointer
Some(transmute(to.data))
}
} else {
None
}
... | identifier_body |
any.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) -> TypeId { TypeId::of::<T>() }
}
///////////////////////////////////////////////////////////////////////////////
// Extension methods for Any trait objects.
// Implemented as three extension traits so that the methods can be generic.
////////////////////////////////////////////////////////////////////////////... | get_type_id | identifier_name |
unknown-renamed-lints.rs | #![deny(unknown_lints)]
//~^ NOTE lint level is defined
#![deny(renamed_and_removed_lints)]
//~^ NOTE lint level is defined
#![deny(x)]
//~^ ERROR unknown lint
#![deny(rustdoc::x)]
//~^ ERROR unknown lint: `rustdoc::x`
#![deny(intra_doc_link_resolution_failure)]
//~^ ERROR renamed to `rustdoc::broken_intra_doc_links`
#... | #![deny(rustdoc::non_autolinks)]
//~^ ERROR renamed to `rustdoc::bare_urls`
#![deny(private_doc_tests)]
//~^ ERROR renamed to `rustdoc::private_doc_tests`
#![deny(rustdoc)]
//~^ ERROR removed: use `rustdoc::all` instead
// Explicitly don't try to handle this case, it was never valid
#![deny(rustdoc::intra_doc_link_r... | random_line_split | |
rpath.rs | // Copyright 2012-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-MI... |
pub fn get_absolute_rpath(lib: &Path) -> ~str {
let mut p = os::make_absolute(lib);
p.pop();
// FIXME (#9639): This needs to handle non-utf8 paths
p.as_str().expect("non-utf8 component in rpath").to_owned()
}
pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
let install_prefix = env!... | {
libs.iter().map(|a| get_absolute_rpath(a)).collect()
} | identifier_body |
rpath.rs | // Copyright 2012-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-MI... |
let mut rpaths = rel_rpaths;
rpaths.push_all(abs_rpaths);
rpaths.push_all(fallback_rpaths);
// Remove duplicates
let rpaths = minimize_rpaths(rpaths);
return rpaths;
}
fn get_rpaths_relative_to_output(os: abi::Os,
output: &Path,
... | }
log_rpaths("relative", rel_rpaths);
log_rpaths("absolute", abs_rpaths);
log_rpaths("fallback", fallback_rpaths); | random_line_split |
rpath.rs | // Copyright 2012-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-MI... | (lib: &Path) -> ~str {
let mut p = os::make_absolute(lib);
p.pop();
// FIXME (#9639): This needs to handle non-utf8 paths
p.as_str().expect("non-utf8 component in rpath").to_owned()
}
pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
let install_prefix = env!("CFG_PREFIX");
let tl... | get_absolute_rpath | identifier_name |
rpath.rs | // Copyright 2012-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-MI... |
}
minimized
}
#[cfg(unix, test)]
mod test {
use std::os;
use back::rpath::{get_absolute_rpath, get_install_prefix_rpath};
use back::rpath::{minimize_rpaths, rpaths_to_flags, get_rpath_relative_to_output};
use syntax::abi;
use metadata::filesearch;
#[test]
fn test_rpaths_to_flags(... | {
minimized.push(rpath.clone());
} | conditional_block |
normal.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 ... |
impl LogNormal {
/// Construct a new `LogNormal` distribution with the given mean
/// and standard deviation. Fails if `std_dev < 0`.
pub fn new(mean: f64, std_dev: f64) -> LogNormal {
assert!(std_dev >= 0.0, "LogNormal::new called with `std_dev` < 0");
LogNormal { norm: Normal::new(mean, s... | pub struct LogNormal {
norm: Normal
} | random_line_split |
normal.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 ... |
#[test]
#[should_fail]
fn test_normal_invalid_sd() {
Normal::new(10.0, -1.0);
}
#[test]
fn test_log_normal() {
let mut lnorm = LogNormal::new(10.0, 10.0);
let mut rng = ::test::rng();
for _ in range(0u, 1000) {
lnorm.sample(&mut rng);
ln... | {
let mut norm = Normal::new(10.0, 10.0);
let mut rng = ::test::rng();
for _ in range(0u, 1000) {
norm.sample(&mut rng);
norm.ind_sample(&mut rng);
}
} | identifier_body |
normal.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 ... |
}
StandardNormal(ziggurat(
rng,
true, // this is symmetric
&ziggurat_tables::ZIG_NORM_X,
&ziggurat_tables::ZIG_NORM_F,
pdf, zero_case))
}
}
/// The normal distribution `N(mean, std_dev**2)`.
///
/// This uses the ZIGNOR variant of the Zi... | { ziggurat_tables::ZIG_NORM_R - x } | conditional_block |
normal.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 ... | () {
let mut lnorm = LogNormal::new(10.0, 10.0);
let mut rng = ::test::rng();
for _ in range(0u, 1000) {
lnorm.sample(&mut rng);
lnorm.ind_sample(&mut rng);
}
}
#[test]
#[should_fail]
fn test_log_normal_invalid_sd() {
LogNormal::new(10.0, -... | test_log_normal | identifier_name |
token.rs | use std::fmt::{Formatter, Result, Show};
use syntax::ast::pos::Position;
use syntax::ast::punc::Punctuator;
use syntax::ast::keyword::Keyword;
#[deriving(Clone, PartialEq)]
/// A single of token of Javascript code including its position
pub struct Token {
/// The token | pub data : TokenData,
/// The token's position
pub pos : Position
}
impl Token {
/// Create a new detailed token from the token data, line number and column number
pub fn new(data: TokenData, line_number: uint, column_number: uint) -> Token {
Token {
data: data,
pos: ... | random_line_split | |
token.rs | use std::fmt::{Formatter, Result, Show};
use syntax::ast::pos::Position;
use syntax::ast::punc::Punctuator;
use syntax::ast::keyword::Keyword;
#[deriving(Clone, PartialEq)]
/// A single of token of Javascript code including its position
pub struct Token {
/// The token
pub data : TokenData,
/// The token's ... | (&self, f: &mut Formatter) -> Result {
write!(f, "{}", self.data)
}
}
#[deriving(Clone, PartialEq)]
/// A single token of Javacript code - a single word, symbol or constant
pub enum TokenData {
/// A boolean literal, which is either `true` or `false`
TBooleanLiteral(bool),
/// The end of the fil... | fmt | identifier_name |
htmllabelelement.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::activation::{Activatable, ActivationSource, synthetic_click_activation};
use dom::attr::Attr;
use dom::bi... | (&self) -> Option<Root<HTMLFormElement>> {
self.form_owner()
}
// https://html.spec.whatwg.org/multipage/#dom-label-htmlfor
make_getter!(HtmlFor, "for");
// https://html.spec.whatwg.org/multipage/#dom-label-htmlfor
make_atomic_setter!(SetHtmlFor, "for");
// https://html.spec.whatwg.or... | GetForm | identifier_name |
htmllabelelement.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::activation::{Activatable, ActivationSource, synthetic_click_activation};
use dom::attr::Attr;
use dom::bi... |
fn is_instance_activatable(&self) -> bool {
true
}
// https://html.spec.whatwg.org/multipage/#run-pre-click-activation-steps
// https://html.spec.whatwg.org/multipage/#the-button-element:activation-behavior
fn pre_click_activation(&self) {
}
// https://html.spec.whatwg.org/multip... | {
self.upcast::<Element>()
} | identifier_body |
htmllabelelement.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::activation::{Activatable, ActivationSource, synthetic_click_activation};
use dom::attr::Attr;
use dom::bi... | }
impl HTMLLabelElementMethods for HTMLLabelElement {
// https://html.spec.whatwg.org/multipage/#dom-fae-form
fn GetForm(&self) -> Option<Root<HTMLFormElement>> {
self.form_owner()
}
// https://html.spec.whatwg.org/multipage/#dom-label-htmlfor
make_getter!(HtmlFor, "for");
// https://... | }
| random_line_split |
riscv32i_unknown_none_elf.rs | use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions};
pub fn | () -> Target {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(),
llvm_target: "riscv32".to_string(),
pointer_width: 32,
arch: "riscv32".to_string(),
options: TargetOptions {
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Som... | target | identifier_name |
riscv32i_unknown_none_elf.rs | use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
use crate::spec::{Target, TargetOptions};
pub fn target() -> Target | }
}
| {
Target {
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(),
llvm_target: "riscv32".to_string(),
pointer_width: 32,
arch: "riscv32".to_string(),
options: TargetOptions {
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
linker: Some("rust-lld".... | identifier_body |
macro-of-higher-order.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 val = higher_order!(subst ($x:expr, $y:expr, $foo:expr) => (($x + $y, $foo)));
assert_eq!(val, (3, "foo"));
outer!(2; expr);
assert_eq!(inner!(3), 5);
}
| main | identifier_name |
macro-of-higher-order.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 val = higher_order!(subst ($x:expr, $y:expr, $foo:expr) => (($x + $y, $foo)));
assert_eq!(val, (3, "foo"));
outer!(2; expr);
assert_eq!(inner!(3), 5);
} | identifier_body | |
macro-of-higher-order.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 ... |
// run-pass
macro_rules! higher_order {
(subst $lhs:tt => $rhs:tt) => ({
macro_rules! anon { $lhs => $rhs }
anon!(1_usize, 2_usize, "foo")
});
}
macro_rules! outer {
($x:expr; $fragment:ident) => {
macro_rules! inner { ($y:$fragment) => { $x + $y } }
}
}
fn main() {
... | random_line_split | |
script_msg.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 AnimationState;
use DocumentState;
use IFrameLoadInfo;
use MouseButton;
use MouseEventType;
use MozBrowserEven... | {
/// Indicates whether this pipeline is currently running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
/// 2D canvases may use the GPU and we don't want to give untrusted content ac... | ScriptMsg | identifier_name |
script_msg.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 AnimationState;
use DocumentState;
use IFrameLoadInfo;
use MouseButton;
use MouseEventType;
use MozBrowserEven... | }
/// Messages from the script to the constellation.
#[derive(Deserialize, Serialize)]
pub enum ScriptMsg {
/// Indicates whether this pipeline is currently running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Requests that a new 2D canvas thread be created. (This is done in th... | /// Requests that the constellation inform the compositor of the a cursor change.
SetCursor(Cursor),
/// Notifies the constellation that the viewport has been constrained in some manner
ViewportConstrained(PipelineId, ViewportConstraints), | random_line_split |
angle.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/. */
//! Computed angles.
use euclid::Radians;
use std::{f32, f64, fmt};
use std::f64::consts::PI;
use style_traits::T... | /// Gecko stores angles as singles, but does this computation using doubles.
/// See nsCSSValue::GetAngleValueInRadians.
/// This is significant enough to mess up rounding to the nearest
/// quarter-turn for 225 degrees, for example.
#[inline]
pub fn radians64(&self) -> f64 {
const RAD_P... |
/// Returns the amount of radians this angle represents as a `f64`.
/// | random_line_split |
angle.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/. */
//! Computed angles.
use euclid::Radians;
use std::{f32, f64, fmt};
use std::f64::consts::PI;
use style_traits::T... |
}
impl ToCss for Angle {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
where
W: fmt::Write,
{
let mut write = |value: CSSFloat, unit: &str| {
value.to_css(dest)?;
dest.write_str(unit)
};
match *self {
Angle::Degree(val) => write(val, ... | {
// Use the formula for calculating the distance between angles defined in SVG:
// https://www.w3.org/TR/SVG/animate.html#complexDistances
self.radians64().compute_squared_distance(&other.radians64())
} | identifier_body |
angle.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/. */
//! Computed angles.
use euclid::Radians;
use std::{f32, f64, fmt};
use std::f64::consts::PI;
use style_traits::T... | (a: Angle) -> Self {
Radians::new(a.radians())
}
}
| from | identifier_name |
to_client.rs | use crate::options::DeriveOptions;
use crate::params_style::ParamStyle;
use crate::rpc_attr::AttributeKind;
use crate::rpc_trait::crate_name;
use crate::to_delegate::{generate_where_clause_serialization_predicates, MethodRegistration};
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use syn::punctuated::Punctu... | .unwrap_or_else(|| options.params_style.clone())
{
ParamStyle::Named => {
quote! { // use object style serialization with field names taken from the function param names
serde_json::json!({
#(stringify!(#arg_names): #arg_names,)*
})
}
}
ParamStyle::Positional =... | {
let mut client_methods = vec![];
for method in methods {
match method {
MethodRegistration::Standard { method, .. } => {
let attrs = get_doc_comments(&method.trait_item.attrs);
let rpc_name = method.name();
let name = &method.trait_item.sig.ident;
let args = compute_args(&method.trait_item);
... | identifier_body |
to_client.rs | use crate::options::DeriveOptions;
use crate::params_style::ParamStyle;
use crate::rpc_attr::AttributeKind;
use crate::rpc_trait::crate_name;
use crate::to_delegate::{generate_where_clause_serialization_predicates, MethodRegistration};
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use syn::punctuated::Punctu... | _ => None,
}
}
fn get_first_type_argument(args: &syn::PathArguments) -> Option<syn::Type> {
match args {
syn::PathArguments::AngleBracketed(syn::AngleBracketedGenericArguments { args,.. }) => {
if!args.is_empty() {
match &args[0] {
syn::GenericArgument::Type(ty) => Some(ty.clone()),
_ => None,
... | } | random_line_split |
to_client.rs | use crate::options::DeriveOptions;
use crate::params_style::ParamStyle;
use crate::rpc_attr::AttributeKind;
use crate::rpc_trait::crate_name;
use crate::to_delegate::{generate_where_clause_serialization_predicates, MethodRegistration};
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use syn::punctuated::Punctu... | (methods: &[MethodRegistration], options: &DeriveOptions) -> Result<Vec<syn::ImplItem>> {
let mut client_methods = vec![];
for method in methods {
match method {
MethodRegistration::Standard { method,.. } => {
let attrs = get_doc_comments(&method.trait_item.attrs);
let rpc_name = method.name();
let n... | generate_client_methods | identifier_name |
handle.rs | use ffi::h5i::{hid_t, H5I_type_t, H5Iget_type, H5Iis_valid, H5Iinc_ref, H5Idec_ref,
H5I_INVALID_HID};
use ffi::h5i::H5I_type_t::*;
use error::Result;
use object::Object;
use std::sync::{Arc, Mutex, RwLock};
use std::collections::HashMap;
pub fn get_id_type(id: hid_t) -> H5I_type_t |
pub fn is_valid_id(id: hid_t) -> bool {
h5lock_s!({
let tp = get_id_type(id);
tp > H5I_BADID && tp < H5I_NTYPES
})
}
pub fn is_valid_user_id(id: hid_t) -> bool {
h5lock!({
H5Iis_valid(id) == 1
})
}
pub trait ID {
fn id(&self) -> hid_t;
}
pub trait FromID {
fn from_id... | {
h5lock_s!({
let tp = h5lock!(H5Iget_type(id));
let valid = id > 0 && tp > H5I_BADID && tp < H5I_NTYPES;
if valid { tp } else { H5I_BADID }
})
} | identifier_body |
handle.rs | use ffi::h5i::{hid_t, H5I_type_t, H5Iget_type, H5Iis_valid, H5Iinc_ref, H5Idec_ref,
H5I_INVALID_HID};
use ffi::h5i::H5I_type_t::*;
use error::Result;
use object::Object;
use std::sync::{Arc, Mutex, RwLock};
use std::collections::HashMap;
pub fn get_id_type(id: hid_t) -> H5I_type_t {
h5lock_s!({
... | () -> Handle {
Handle { id: Arc::new(RwLock::new(H5I_INVALID_HID)) }
}
pub fn id(&self) -> hid_t {
*self.id.read().unwrap()
}
pub fn invalidate(&self) {
*self.id.write().unwrap() = H5I_INVALID_HID;
}
#[allow(dead_code)] // FIXME: spurious rustc warning
pub fn incr... | invalid | identifier_name |
handle.rs | use ffi::h5i::{hid_t, H5I_type_t, H5Iget_type, H5Iis_valid, H5Iinc_ref, H5Idec_ref,
H5I_INVALID_HID};
use ffi::h5i::H5I_type_t::*;
use error::Result;
use object::Object;
use std::sync::{Arc, Mutex, RwLock};
use std::collections::HashMap;
pub fn get_id_type(id: hid_t) -> H5I_type_t {
h5lock_s!({
... |
}
pub fn decref(&self) {
h5lock!({
if is_valid_user_id(self.id()) {
H5Idec_ref(self.id());
}
// must invalidate all linked IDs because the library reuses them internally
if!is_valid_user_id(self.id()) &&!is_valid_id(self.id()) {
... | {
h5lock!(H5Iinc_ref(self.id()));
} | conditional_block |
handle.rs | use error::Result;
use object::Object;
use std::sync::{Arc, Mutex, RwLock};
use std::collections::HashMap;
pub fn get_id_type(id: hid_t) -> H5I_type_t {
h5lock_s!({
let tp = h5lock!(H5Iget_type(id));
let valid = id > 0 && tp > H5I_BADID && tp < H5I_NTYPES;
if valid { tp } else { H5I_BADID ... | use ffi::h5i::{hid_t, H5I_type_t, H5Iget_type, H5Iis_valid, H5Iinc_ref, H5Idec_ref,
H5I_INVALID_HID};
use ffi::h5i::H5I_type_t::*;
| random_line_split | |
test_delete.rs | use curl::http;
use super::server;
#[test]
pub fn test_delete_with_no_body() {
let srv = server!(
recv!(b"DELETE / HTTP/1.1\r\n\
Host: localhost:{PORT}\r\n\
Accept: */*\r\n\
\r\n"),
send!(b"HTTP/1.1 200 OK\r\n\
Content-Length: 5\r\n\r\... | #[test]
pub fn test_delete_binary_with_slice() {
let srv = server!(
recv!(b"DELETE / HTTP/1.1\r\n\
Host: localhost:{PORT}\r\n\
Accept: */*\r\n\
Content-Type: application/octet-stream\r\n\
Content-Length: 11\r\n\
\r\n\
... | }
| random_line_split |
test_delete.rs | use curl::http;
use super::server;
#[test]
pub fn test_delete_with_no_body() {
let srv = server!(
recv!(b"DELETE / HTTP/1.1\r\n\
Host: localhost:{PORT}\r\n\
Accept: */*\r\n\
\r\n"),
send!(b"HTTP/1.1 200 OK\r\n\
Content-Length: 5\r\n\r\... | let res = res.unwrap();
assert!(res.get_code() == 200);
assert!(res.get_body() == "Hello".as_bytes());
}
| {
let srv = server!(
recv!(b"DELETE / HTTP/1.1\r\n\
Host: localhost:{PORT}\r\n\
Accept: */*\r\n\
Content-Type: application/octet-stream\r\n\
Content-Length: 11\r\n\
\r\n\
Foo Bar Baz"),
send!(b"HTTP/1.1 2... | identifier_body |
test_delete.rs | use curl::http;
use super::server;
#[test]
pub fn | () {
let srv = server!(
recv!(b"DELETE / HTTP/1.1\r\n\
Host: localhost:{PORT}\r\n\
Accept: */*\r\n\
\r\n"),
send!(b"HTTP/1.1 200 OK\r\n\
Content-Length: 5\r\n\r\n\
Hello\r\n\r\n")
);
let res = http::handle()
... | test_delete_with_no_body | identifier_name |
lang.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 ... |
#[lang="malloc"]
pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
match context() {
OldTaskContext => {
return rustrt::rust_upcall_malloc_noswitch(td, size);
}
_ => {
let mut alloc = ::ptr::null();
do Local::borrow::<Task,()> |task| ... | {
let msg = fmt!("index out of bounds: the len is %d but the index is %d",
len as int, index as int);
do str::as_buf(msg) |p, _len| {
fail_(p as *c_char, file, line);
}
} | identifier_body |
lang.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 ... | (ptr: *c_uchar, len: uint) -> ~str {
str::raw::from_buf_len(ptr, len)
}
#[lang="annihilate"]
pub unsafe fn annihilate() {
::cleanup::annihilate()
}
#[lang="start"]
pub fn start(main: *u8, argc: int, argv: **c_char,
crate_map: *u8) -> int {
use rt;
use os;
unsafe {
let use_old... | strdup_uniq | identifier_name |
lang.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 ... |
}
}
// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
// inside a landing pad may corrupt the state of the exception handler. If a
// problem occurs, call exit instead.
#[lang="free"]
pub unsafe fn local_free(ptr: *c_char) {
::rt::local_heap::local_free(ptr);
}
#[lang="borrow_as_i... | {
let mut alloc = ::ptr::null();
do Local::borrow::<Task,()> |task| {
rtdebug!("task pointer: %x, heap pointer: %x",
to_uint(task),
to_uint(&task.heap));
alloc = task.heap.alloc(td as *c_void, size as uint) as *c_c... | conditional_block |
lang.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 ... | #[allow(non_camel_case_types)]
pub type rust_task = c_void;
pub mod rustrt {
use unstable::lang::rust_task;
use libc::{c_char, uintptr_t};
pub extern {
#[rust_stack]
unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t) -> *c_char;
#[rust_stack]
unsafe fn rust_upcall_... | random_line_split | |
lexical-scope-in-if.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... | () {
let x = 999;
let y = -1;
zzz();
sentinel();
if x < 1000 {
zzz();
sentinel();
let x = 1001;
zzz();
sentinel();
let x = 1002;
let y = 1003;
zzz();
sentinel();
} else {
unreachable!();
}
zzz();
s... | main | identifier_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.