file_name large_stringlengths 4 69 | prefix large_stringlengths 0 26.7k | suffix large_stringlengths 0 24.8k | middle large_stringlengths 0 2.12k | fim_type large_stringclasses 4
values |
|---|---|---|---|---|
restyle_hints.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
#[cfg(feature = "gecko")]
use crat... |
if (raw.0 & (nsRestyleHint::eRestyle_ForceDescendants.0 | nsRestyleHint::eRestyle_Force.0))!=
0
{
raw.0 &=!nsRestyleHint::eRestyle_Force.0;
hint.insert(RestyleHint::RECASCADE_SELF);
}
if (raw.0 & nsRestyleHint::eRestyle_ForceDescendants.0)!= 0 {
... | {
raw.0 &= !nsRestyleHint::eRestyle_Subtree.0;
raw.0 &= !nsRestyleHint::eRestyle_SomeDescendants.0;
hint.insert(RestyleHint::RESTYLE_DESCENDANTS);
} | conditional_block |
restyle_hints.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
#[cfg(feature = "gecko")]
use crat... | (&self) -> bool {
self.intersects(
RestyleHint::RESTYLE_SELF |
RestyleHint::RECASCADE_SELF |
(Self::replacements() &!Self::for_animations()),
)
}
/// Propagates this restyle hint to a child element.
pub fn propagate(&mut self, traversal_flags: &Tr... | has_non_animation_invalidations | identifier_name |
text.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 types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... | let mut has_any = false;
macro_rules! write_value {
($line:path => $css:expr) => {
if self.contains($line) {
if has_any {
dest.write_str(" ")?;
}
dest.write_str($css)?;
ha... | random_line_split | |
text.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 types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... | (style: &StyleBuilder) -> Self {
use values::computed::Display;
// Start with no declarations if this is an atomic inline-level box;
// otherwise, start with the declarations in effect and add in the text
// decorations that this block specifies.
let mut result = match style.get... | from_style | identifier_name |
text.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 types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... |
}
impl ToCss for TextDecorationLine {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: Write,
{
let mut has_any = false;
macro_rules! write_value {
($line:path => $css:expr) => {
if self.contains($line) {
if has_a... | {
if self.sides_are_logical {
debug_assert_eq!(self.first, TextOverflowSide::Clip);
self.second.to_css(dest)?;
} else {
self.first.to_css(dest)?;
dest.write_str(" ")?;
self.second.to_css(dest)?;
}
Ok(())
} | identifier_body |
text.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 types for text properties.
#[cfg(feature = "servo")]
use properties::StyleBuilder;
use std::fmt::{se... |
Ok(())
}
}
/// A struct that represents the _used_ value of the text-decoration property.
///
/// FIXME(emilio): This is done at style resolution time, though probably should
/// be done at layout time, otherwise we need to account for display: contents
/// and similar stuff when we implement it.
///
///... | {
dest.write_str("none")?;
} | conditional_block |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... |
}
impl PMF<f32> {
pub fn scale(&mut self, scale: f32) {
for e in &mut self.inner {
e.value *= scale;
}
}
}
| {
let cdf = self.cdf();
let lower = cdf
.binary_search_by(|p| p.partial_cmp(&LogProb(0.025f64.ln())).unwrap())
.unwrap_or_else(|i| i);
let upper = cdf
.binary_search_by(|p| p.partial_cmp(&LogProb(0.975f64.ln())).unwrap())
.unwrap_or_else(|i| i);
... | identifier_body |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... | }
/// Return maximum a posteriori probability estimate (MAP).
pub fn map(&self) -> &T {
let mut max = self.iter().next().unwrap();
for e in self.iter() {
if e.prob >= max.prob {
max = e;
}
}
&max.value
}
}
impl<T: Clone + Sized + ... | LogProb::ln_cumsum_exp(self.inner.iter().map(|e| e.prob)).collect_vec() | random_line_split |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... | (&self) -> slice::Iter<Entry<T>> {
self.inner.iter()
}
pub fn cdf(&self) -> Vec<LogProb> {
LogProb::ln_cumsum_exp(self.inner.iter().map(|e| e.prob)).collect_vec()
}
/// Return maximum a posteriori probability estimate (MAP).
pub fn map(&self) -> &T {
let mut max = self.iter... | iter | identifier_name |
pmf.rs | use std::slice;
use itertools::Itertools;
use bio::stats::LogProb;
#[derive(Clone, Debug)]
pub struct Entry<T: Clone> {
pub value: T,
pub prob: LogProb,
}
#[derive(Clone, Debug)]
pub struct PMF<T: Clone> {
inner: Vec<Entry<T>>,
}
impl<T: Clone + Sized> PMF<T> {
/// Create a new PMF from sorted vect... |
}
&max.value
}
}
impl<T: Clone + Sized + Copy> PMF<T> {
/// Return the 95% credible interval.
pub fn credible_interval(&self) -> (T, T) {
let cdf = self.cdf();
let lower = cdf
.binary_search_by(|p| p.partial_cmp(&LogProb(0.025f64.ln())).unwrap())
.unwr... | {
max = e;
} | conditional_block |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... |
}
| {
self.cpu.ppu.rendering_enabled()
} | identifier_body |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... | }
}
}
pub struct EmulatorBuilder {
cart: Cart,
settings: Settings,
pub screen: Box<screen::Screen>,
pub audio_out: Box<audio::AudioOut>,
pub io: Box<IO>,
}
impl EmulatorBuilder {
pub fn new(cart: Cart, settings: Settings) -> EmulatorBuilder {
EmulatorBuilder... | trace_cpu: false,
disassemble_functions: false,
| random_line_split |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... |
builder.io = Box::new(io::sdl::SdlIO::new(event_pump.clone()));
builder
}
pub fn build(self) -> Emulator {
let settings = Rc::new(self.settings);
let dispatcher = cpu::dispatcher::Dispatcher::new();
let cart: Rc<UnsafeCell<Cart>> = Rc::new(UnsafeCell::new(self... | {
builder.audio_out = Box::new(audio::sdl::SDLAudioOut::new(sdl));
} | conditional_block |
lib.rs | #![feature(test)]
#![feature(plugin)]
#![feature(asm)]
#![feature(naked_functions)]
#![plugin(dynasm)]
#![allow(unused_features)]
#![allow(unknown_lints)]
#![allow(new_without_default)]
#![allow(match_same_arms)]
#[cfg(target_arch = "x86_64")]
extern crate dynasmrt;
#[macro_use]
extern crate bitflag... | (&mut self) {
self.cpu.run_frame();
}
pub fn halted(&self) -> bool {
self.cpu.halted()
}
#[cfg(feature = "debug_features")]
pub fn mouse_pick(&self, px_x: i32, px_y: i32) {
self.cpu.ppu.mouse_pick(px_x, px_y);
}
pub fn rendering_enabled(&self) -> bool ... | run_frame | identifier_name |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... |
/// Rounds up `n` to the nearest multiple of `k`
fn round_up(n: usize, k: usize) -> usize {
let r = n % k;
if r == 0 {
n
} else {
n + k - r
}
}
let align_of_b = mem::align_of::<B>();
let size_of_a = mem::size_of::<A>();
let size_of_b = ... | {
n - n % k
} | identifier_body |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... | pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[allow(missing_docs, non_camel_case_types)]
#[derive(Clone, Copy, Debug)]
#[simd]
pub struct f64x2(pub f64, pub f64);
/// Sum the elements of a slice using SIMD ops
///
/// # Benchmarks
///
/// Size: 1 million elements
///
/// ``` ignore
/// test bench::f32::plai... | pub mod traits;
#[allow(missing_docs, non_camel_case_types)]
#[derive(Clone, Copy, Debug)]
#[simd] | random_line_split |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... | <T>(slice: &[T]) -> T where
T: Simd,
{
use std::ops::Add;
use traits::Vector;
let (head, body, tail) = T::Vector::cast(slice);
let sum = body.iter().map(|&x| x).fold(T::Vector::zeroed(), Add::add).sum();
let sum = head.iter().map(|&x| x).fold(sum, Add::add);
tail.iter().map(|&x| x).fold(su... | sum | identifier_name |
lib.rs | //! [Experimental] Generic programming with SIMD
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, plugin(quickcheck_macros))]
#![deny(missing_docs)]
#![deny(warnings)]
#![feature(core)]
#![feature(plugin)]
#![feature(simd)]
#[cfg(test)] extern crate test as stdtest;
#[cfg(test)] extern crate approx;
#[cfg(test)] e... | else {
let head_end = body_start;
let head_len = (head_end - head_start) / size_of_a;
let body_len = (body_end - body_start) / size_of_b;
let tail_start = body_end;
let tail_len = (tail_end - tail_start) / size_of_a;
let head = mem::transmute(raw::Slice { data: head_s... | {
(slice, &[], &[])
} | conditional_block |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... | .select((dependencies::all_columns, crates::name))
.order((dependencies::optional, crates::name))
.load(conn)
}
pub fn max<T>(versions: T) -> semver::Version
where
T: IntoIterator<Item = semver::Version>,
{
versions.into_iter().max().unwrap_or_else(|| {
... | pub fn dependencies(&self, conn: &PgConnection) -> QueryResult<Vec<(Dependency, String)>> {
Dependency::belonging_to(self)
.inner_join(crates::table) | random_line_split |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... | ;
let conn = req.db_conn()?;
let krate = Crate::by_name(crate_name).first::<Crate>(&*conn)?;
let version = Version::belonging_to(&krate)
.filter(versions::num.eq(semver))
.first(&*conn)
.map_err(|_| {
human(&format_args!(
"crate `{}` does not have a version `... | {
return Err(human(&format_args!("invalid semver: {}", semver)));
} | conditional_block |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... | (req: &mut Request) -> CargoResult<Response> {
let (version, krate) = match req.params().find("crate_id") {
Some(..) => version_and_crate(req)?,
None => {
let id = &req.params()["version_id"];
let id = id.parse().unwrap_or(0);
let conn = req.db_conn()?;
... | show | identifier_name |
version.rs | use std::collections::HashMap;
use conduit::{Request, Response};
use conduit_router::RequestParams;
use diesel;
use diesel::pg::Pg;
use diesel::pg::upsert::*;
use diesel::prelude::*;
use semver;
use serde_json;
use time::{Duration, Timespec, now_utc, strptime};
use url;
use Crate;
use app::RequestApp;
use db::Request... |
}
/// Handles the `GET /versions` route.
// FIXME: where/how is this used?
pub fn index(req: &mut Request) -> CargoResult<Response> {
use diesel::expression::dsl::any;
let conn = req.db_conn()?;
// Extract all ids requested.
let query = url::form_urlencoded::parse(req.query_string().unwrap_or("").as_... | {
let features = row.6
.map(|s| serde_json::from_str(&s).unwrap())
.unwrap_or_else(HashMap::new);
Version {
id: row.0,
crate_id: row.1,
num: semver::Version::parse(&row.2).unwrap(),
updated_at: row.3,
created_at: row.4,
... | identifier_body |
netc.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_addr: in_addr,
pub sin_zero: [u8; 8],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct sockaddr_in6 {
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_flowinfo: u32,
pub sin6_addr: in6_addr,
pub sin6_scop... | sockaddr_in | identifier_name |
netc.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | pub s_addr: in_addr_t,
}
#[derive(Copy, Clone)]
#[repr(align(4))]
#[repr(C)]
pub struct in6_addr {
pub s6_addr: [u8; 16],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct sockaddr_in {
pub s... | #[derive(Copy, Clone)]
#[repr(C)]
pub struct in_addr { | random_line_split |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn | (high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result<Vec<f64>, Err> {
let mut psar = vec![NAN; high.len()];
if high.len() < 2 {
return Err(Err::NotEnoughtData);
};
let mut long = false;
if high[0] + low[0] <= high[1] + low[1] {
long = true;
}
let mut sar;
let mu... | psar | identifier_name |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn psar(high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result... | sar = high[0];
}
psar[0] = sar;
let mut af = iaf;
for i in 1..high.len() {
sar = (extreme - sar) * af + sar;
if long {
if i >= 2 && (sar > low[i - 2]) {
sar = low[i - 2]
};
if sar > low[i - 1] {
sar = low[i -... | {
let mut psar = vec![NAN; high.len()];
if high.len() < 2 {
return Err(Err::NotEnoughtData);
};
let mut long = false;
if high[0] + low[0] <= high[1] + low[1] {
long = true;
}
let mut sar;
let mut extreme;
if long {
extreme = high[0];
sar = low[0];
... | identifier_body |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn psar(high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result... |
psar[i] = sar;
}
Ok(psar)
}
| {
af = iaf;
sar = extreme;
long = !long;
if !long {
extreme = low[i];
} else {
extreme = high[i];
}
} | conditional_block |
psar.rs | use std::f64::NAN;
use error::Err;
/// Parabolic SAR
/// iaf : increment acceleration factor / starting acceleration. Usually 0.02
/// maxaf : max acceleration factor. Usually 0.2
/// Hypothesis : assuming long for initial conditions
/// Formula :
pub fn psar(high: &[f64], low: &[f64], iaf: f64, maxaf: f64) -> Result... | extreme = high[i];
}
} else {
if i >= 2 && sar < high[i - 2] {
sar = high[i - 2]
};
if sar < high[i - 1] {
sar = high[i - 1]
};
if af < maxaf && low[i] < extreme {
af += iaf;
... | 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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{ParserContext, Parse};
#[allow(unused_imports)... | (self) -> f32 {
use std::f32::consts::PI;
self.radians() * 360. / (2. * PI)
}
/// Returns `0deg`.
pub fn zero() -> Self {
Self::from_degrees(0.0, false)
}
/// Returns an `Angle` parsed from a `calc()` expression.
pub fn from_calc(radians: CSSFloat) -> Self {
Ang... | degrees | identifier_name |
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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{ParserContext, Parse};
#[allow(unused_imports)... |
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
Angle {
value: *computed,
was_calc: false,
}
}
}
impl Angle {
/// Creates an angle with the given value in degrees.
pub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self {
Angle { v... | {
self.value
} | 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/. */
//! Specified angles.
use cssparser::{Parser, Token};
use parser::{ParserContext, Parse};
#[allow(unused_imports)... | Angle { value: ComputedAngle::Rad(value), was_calc }
}
/// Returns the amount of radians this angle represents.
#[inline]
pub fn radians(self) -> f32 {
self.value.radians()
}
/// Returns the amount of degrees this angle represents.
#[inline]
pub fn degrees(self) -> f32 ... | random_line_split | |
helper.rs | use std::time::Duration;
use xpath_reader::Reader;
/// Note that the requirement of the `var` (variant) token is rather ugly but
/// required,
/// which is a limitation of the current Rust macro implementation.
///
/// Note that the macro wont expand if you miss ommit the last comma.
/// If this macro is ever extracte... | <'d>(
reader: &'d Reader<'d>,
path: &str,
) -> Result<Option<Duration>, ::xpath_reader::Error> {
let s: Option<String> = reader.read(path)?;
match s {
Some(millis) => Ok(Some(Duration::from_millis(
millis.parse().map_err(::xpath_reader::Error::custom_err)?,
))),
None ... | read_mb_duration | identifier_name |
helper.rs | use std::time::Duration;
use xpath_reader::Reader;
/// Note that the requirement of the `var` (variant) token is rather ugly but
/// required,
/// which is a limitation of the current Rust macro implementation.
///
/// Note that the macro wont expand if you miss ommit the last comma.
/// If this macro is ever extracte... | }
impl ::std::fmt::Display for $enum {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result
{
let s = match *self {
$(
$enum::$variant => $str,
)+
};
wri... | )
)
}
} | random_line_split |
helper.rs | use std::time::Duration;
use xpath_reader::Reader;
/// Note that the requirement of the `var` (variant) token is rather ugly but
/// required,
/// which is a limitation of the current Rust macro implementation.
///
/// Note that the macro wont expand if you miss ommit the last comma.
/// If this macro is ever extracte... | {
let s: Option<String> = reader.read(path)?;
match s {
Some(millis) => Ok(Some(Duration::from_millis(
millis.parse().map_err(::xpath_reader::Error::custom_err)?,
))),
None => Ok(None),
}
} | identifier_body | |
shootout-spectralnorm.rs | use core::from_str::FromStr;
use core::iter::ExtendedMutableIter;
#[inline]
fn A(i: i32, j: i32) -> i32 {
(i+j) * (i+j+1) / 2 + i + 1
}
fn dot(v: &[f64], u: &[f64]) -> f64 {
let mut sum = 0.0;
for v.eachi |i, &v_i| {
sum += v_i * u[i];
}
sum
}
fn mult_Av(v: &mut [f64], out: &mut [f64]) {
... | }
println(fmt!("%.9f", f64::sqrt(dot(u,v) / dot(v,v)) as float));
} | for 8.times {
mult_AtAv(u, v, tmp);
mult_AtAv(v, u, tmp); | random_line_split |
shootout-spectralnorm.rs | use core::from_str::FromStr;
use core::iter::ExtendedMutableIter;
#[inline]
fn A(i: i32, j: i32) -> i32 {
(i+j) * (i+j+1) / 2 + i + 1
}
fn dot(v: &[f64], u: &[f64]) -> f64 {
let mut sum = 0.0;
for v.eachi |i, &v_i| {
sum += v_i * u[i];
}
sum
}
fn mult_Av(v: &mut [f64], out: &mut [f64]) {
... | (v: &mut [f64], out: &mut [f64], tmp: &mut [f64]) {
mult_Av(v, tmp);
mult_Atv(tmp, out);
}
#[fixed_stack_segment]
fn main() {
let n: uint = FromStr::from_str(os::args()[1]).get();
let mut u = vec::from_elem(n, 1f64), v = u.clone(), tmp = u.clone();
for 8.times {
mult_AtAv(u, v, tmp);
... | mult_AtAv | identifier_name |
shootout-spectralnorm.rs | use core::from_str::FromStr;
use core::iter::ExtendedMutableIter;
#[inline]
fn A(i: i32, j: i32) -> i32 |
fn dot(v: &[f64], u: &[f64]) -> f64 {
let mut sum = 0.0;
for v.eachi |i, &v_i| {
sum += v_i * u[i];
}
sum
}
fn mult_Av(v: &mut [f64], out: &mut [f64]) {
for vec::eachi_mut(out) |i, out_i| {
let mut sum = 0.0;
for vec::eachi_mut(v) |j, &v_j| {
sum += v_j / (A(i ... | {
(i+j) * (i+j+1) / 2 + i + 1
} | identifier_body |
request_proxy.rs | use std::io::Read;
use std::net::SocketAddr;
use conduit; | #[allow(missing_debug_implementations)]
pub struct RequestProxy<'a> {
pub other: &'a mut (Request + 'a),
pub path: Option<&'a str>,
pub method: Option<conduit::Method>,
}
impl<'a> Request for RequestProxy<'a> {
fn http_version(&self) -> semver::Version {
self.other.http_version()
}
fn c... | use conduit::Request;
use semver;
// Can't derive Debug because of Request. | random_line_split |
request_proxy.rs | use std::io::Read;
use std::net::SocketAddr;
use conduit;
use conduit::Request;
use semver;
// Can't derive Debug because of Request.
#[allow(missing_debug_implementations)]
pub struct RequestProxy<'a> {
pub other: &'a mut (Request + 'a),
pub path: Option<&'a str>,
pub method: Option<conduit::Method>,
}
... |
fn host(&self) -> conduit::Host {
self.other.host()
}
fn virtual_root(&self) -> Option<&str> {
self.other.virtual_root()
}
fn path(&self) -> &str {
self.path.map(|s| &*s).unwrap_or_else(|| self.other.path())
}
fn query_string(&self) -> Option<&str> {
self.oth... | {
self.other.scheme()
} | identifier_body |
request_proxy.rs | use std::io::Read;
use std::net::SocketAddr;
use conduit;
use conduit::Request;
use semver;
// Can't derive Debug because of Request.
#[allow(missing_debug_implementations)]
pub struct RequestProxy<'a> {
pub other: &'a mut (Request + 'a),
pub path: Option<&'a str>,
pub method: Option<conduit::Method>,
}
... | (&self) -> Option<u64> {
self.other.content_length()
}
fn headers(&self) -> &conduit::Headers {
self.other.headers()
}
fn body(&mut self) -> &mut Read {
self.other.body()
}
fn extensions(&self) -> &conduit::Extensions {
self.other.extensions()
}
fn mut_ext... | content_length | identifier_name |
main.rs | // Task : Guess number game
// Date : 10 Sept 2016
// Author : Vigneshwer
extern crate rand;
use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn main() |
match guess.cmp(&secret_number) {
Ordering::Less => println!("Too Small"),
Ordering::Greater => println!("Too big"),
Ordering::Equal => {
println!("Win");
break;
}
}
}
}
| {
println!("Guess the Number game!");
let secret_number = rand::thread_rng().gen_range(1,101);
// println!("You secret number is {}", secret_number);
loop {
println!("Enter the number in your mind");
let mut guess = String::new();
io::stdin().read_line(&mut guess).expect("Fa... | identifier_body |
main.rs | // Task : Guess number game
// Date : 10 Sept 2016
// Author : Vigneshwer
extern crate rand;
use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn | () {
println!("Guess the Number game!");
let secret_number = rand::thread_rng().gen_range(1,101);
// println!("You secret number is {}", secret_number);
loop {
println!("Enter the number in your mind");
let mut guess = String::new();
io::stdin().read_line(&mut guess).expect(... | main | identifier_name |
main.rs | // Task : Guess number game | use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn main() {
println!("Guess the Number game!");
let secret_number = rand::thread_rng().gen_range(1,101);
// println!("You secret number is {}", secret_number);
loop {
println!("Enter the number in your mind");
let mut guess = Strin... | // Date : 10 Sept 2016
// Author : Vigneshwer
extern crate rand;
| random_line_split |
text_run.rs | 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 api::{ColorF, FontInstanceFlags, GlyphInstance, RasterSpace, Shadow};
use api::units::{LayoutToWorldTransform, LayoutVector2D, RasterPixelScale, DeviceP... | // Ensure the last block is added in the case
// of an odd number of glyphs.
if (self.glyphs.len() & 1)!= 0 {
request.push(gpu_block);
}
assert!(request.current_used_block_num() <= MAX_VERTEX_TEXTURE_WIDTH);
}
}
}
pub type TextRu... | {
request.push(ColorF::from(self.font.color).premultiplied());
// this is the only case where we need to provide plain color to GPU
let bg_color = ColorF::from(self.font.bg_color);
request.push([bg_color.r, bg_color.g, bg_color.b, 1.0]);
let mut gpu_block = [... | conditional_block |
text_run.rs | 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 api::{ColorF, FontInstanceFlags, GlyphInstance, RasterSpace, Shadow};
use api::units::{LayoutToWorldTransform, LayoutVector2D, RasterPixelScale, Dev... | request.push(ColorF::from(self.font.color).premultiplied());
// this is the only case where we need to provide plain color to GPU
let bg_color = ColorF::from(self.font.bg_color);
request.push([bg_color.r, bg_color.g, bg_color.b, 1.0]);
let mut gpu_block = [0.... | frame_state: &mut FrameBuildingState,
) {
// corresponds to `fetch_glyph` in the shaders
if let Some(mut request) = frame_state.gpu_cache.request(&mut self.common.gpu_cache_handle) { | random_line_split |
text_run.rs | 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 api::{ColorF, FontInstanceFlags, GlyphInstance, RasterSpace, Shadow};
use api::units::{LayoutToWorldTransform, LayoutVector2D, RasterPixelScale, DeviceP... | .scale_factors();
// Round the scale up to the nearest power of 2, but don't exceed 8.
let scale = scale_factors.0.max(scale_factors.1).min(8.0).max(1.0);
let rounded_up = 2.0f32.powf(scale.log2().ceil());
RasterSpace::Local(rounded_up... | {
let prim_spatial_node = spatial_tree.get_spatial_node(prim_spatial_node_index);
if prim_spatial_node.is_ancestor_or_self_zooming {
if low_quality_pinch_zoom {
// In low-quality mode, we set the scale to be 1.0. However, the device-pixel
// scale selected for... | identifier_body |
text_run.rs | 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 api::{ColorF, FontInstanceFlags, GlyphInstance, RasterSpace, Shadow};
use api::units::{LayoutToWorldTransform, LayoutVector2D, RasterPixelScale, DeviceP... | (&self) -> &Self::Target {
&self.common
}
}
impl ops::DerefMut for TextRunTemplate {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.common
}
}
impl From<TextRunKey> for TextRunTemplate {
fn from(item: TextRunKey) -> Self {
let common = PrimTemplateCommonData::with_key... | deref | identifier_name |
keyboard.rs | use serde::Deserialize;
use smithay::wayland::seat::Keysym;
pub use smithay::{
backend::input::KeyState,
wayland::seat::{keysyms as KeySyms, ModifiersState as KeyModifiers},
};
use xkbcommon::xkb;
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
pub enum KeyModifier {
Ctrl,
Alt,
Shift,
Logo,... | (Vec<KeyModifier>);
impl From<KeyModifiersDef> for KeyModifiers {
fn from(src: KeyModifiersDef) -> Self {
src.0.into_iter().fold(
KeyModifiers {
ctrl: false,
alt: false,
shift: false,
caps_lock: false,
logo: false,
... | KeyModifiersDef | identifier_name |
keyboard.rs | use serde::Deserialize;
use smithay::wayland::seat::Keysym;
pub use smithay::{
backend::input::KeyState,
wayland::seat::{keysyms as KeySyms, ModifiersState as KeyModifiers},
};
use xkbcommon::xkb;
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
pub enum KeyModifier {
Ctrl,
Alt,
Shift,
Logo,... | match xkb::keysym_from_name(&name, xkb::KEYSYM_NO_FLAGS) {
KeySyms::KEY_NoSymbol => match xkb::keysym_from_name(&name, xkb::KEYSYM_CASE_INSENSITIVE) {
KeySyms::KEY_NoSymbol => Err(<D::Error as Error>::invalid_value(
Unexpected::Str(&name),
&"One of the keysym name... | use serde::de::{Error, Unexpected};
let name = String::deserialize(deserializer)?;
//let name = format!("KEY_{}", code); | random_line_split |
combaseapi.rs | // Copyright © 2016 winapi-rs developers
// 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.
// All files in the project carrying such notice may not be copied, modi... | ppMalloc: *mut LPMALLOC
) -> HRESULT}
STRUCT!{struct ServerInformation {
dwServerPid: DWORD,
dwServerTid: DWORD,
ui64ServerAddress: UINT64,
}}
pub type PServerInformation = *mut ServerInformation;
DECLARE_HANDLE!(CO_MTA_USAGE_COOKIE, CO_MTA_USAGE_COOKIE__); | dwMemContext: DWORD, | random_line_split |
error.rs | use std::io;
use std::fmt;
use std::error::Error;
/// Result type for using with [`EmuleadError`].
pub type EmuleadResult<T> = Result<T, EmuleadError>;
/// Error type using for the project errors.
#[derive(Debug)]
pub enum EmuleadError {
/// IO Error
Io(io::Error),
/// Rotate bytes error used in [`network... | }
} |
fn from(err: io::Error) -> EmuleadError {
EmuleadError::Io(err) | random_line_split |
error.rs | use std::io;
use std::fmt;
use std::error::Error;
/// Result type for using with [`EmuleadError`].
pub type EmuleadResult<T> = Result<T, EmuleadError>;
/// Error type using for the project errors.
#[derive(Debug)]
pub enum EmuleadError {
/// IO Error
Io(io::Error),
/// Rotate bytes error used in [`network... | (&self) -> Option<&Error> {
match *self {
EmuleadError::Io(ref err) => Some(err),
_ => None
}
}
}
impl From<io::Error> for EmuleadError {
fn from(err: io::Error) -> EmuleadError {
EmuleadError::Io(err)
}
}
| cause | identifier_name |
error.rs | use std::io;
use std::fmt;
use std::error::Error;
/// Result type for using with [`EmuleadError`].
pub type EmuleadResult<T> = Result<T, EmuleadError>;
/// Error type using for the project errors.
#[derive(Debug)]
pub enum EmuleadError {
/// IO Error
Io(io::Error),
/// Rotate bytes error used in [`network... |
}
impl From<io::Error> for EmuleadError {
fn from(err: io::Error) -> EmuleadError {
EmuleadError::Io(err)
}
}
| {
match *self {
EmuleadError::Io(ref err) => Some(err),
_ => None
}
} | identifier_body |
middlewares.rs | use config::Config;
use db;
use hyper::header::UserAgent;
use hyper::method::Method;
use nickel::{Continue, Halt, MediaType, Middleware, MiddlewareResult, Request, Response};
use nickel::status::StatusCode;
use plugin::Extensible;
use r2d2::{Config as PoolConfig, Pool};
use r2d2_postgres::{PostgresConnectionManager as ... | <'mw, 'conn>(&self, req: &mut Request<'mw, 'conn, D>, rep: Response<'mw, D>) -> MiddlewareResult<'mw, D> {
req.extensions_mut().insert::<ConfigMiddleware>(self.config.clone());
Ok(Continue(rep))
}
}
pub struct PostgresMiddleware {
pub pool: Pool<Manager>,
}
impl PostgresMiddleware {
pub fn... | invoke | identifier_name |
middlewares.rs | use config::Config;
use db;
use hyper::header::UserAgent;
use hyper::method::Method;
use nickel::{Continue, Halt, MediaType, Middleware, MiddlewareResult, Request, Response};
use nickel::status::StatusCode;
use plugin::Extensible;
use r2d2::{Config as PoolConfig, Pool};
use r2d2_postgres::{PostgresConnectionManager as ... |
}
}
| {
res.set(StatusCode::Forbidden);
res.set(MediaType::Json);
let mut stream = res.start()?;
if let Err(err) = stream.write_all(r#"{"data": "Access denied", "success": false}"#.as_bytes()) {
stream.bail(format!("[AuthMiddleware] Unable to halt request: {}", ... | conditional_block |
middlewares.rs | use config::Config;
use db;
use hyper::header::UserAgent;
use hyper::method::Method;
use nickel::{Continue, Halt, MediaType, Middleware, MiddlewareResult, Request, Response};
use nickel::status::StatusCode;
use plugin::Extensible;
use r2d2::{Config as PoolConfig, Pool};
use r2d2_postgres::{PostgresConnectionManager as ... |
}
impl Key for ConfigMiddleware {
type Value = Arc<Config>;
}
impl<D> Middleware<D> for ConfigMiddleware {
fn invoke<'mw, 'conn>(&self, req: &mut Request<'mw, 'conn, D>, rep: Response<'mw, D>) -> MiddlewareResult<'mw, D> {
req.extensions_mut().insert::<ConfigMiddleware>(self.config.clone());
... | {
ConfigMiddleware { config: config }
} | identifier_body |
middlewares.rs | use config::Config;
use db;
use hyper::header::UserAgent;
use hyper::method::Method;
use nickel::{Continue, Halt, MediaType, Middleware, MiddlewareResult, Request, Response};
use nickel::status::StatusCode;
use plugin::Extensible;
use r2d2::{Config as PoolConfig, Pool};
use r2d2_postgres::{PostgresConnectionManager as ... | } {
Ok(Continue(res))
} else {
res.set(StatusCode::Forbidden);
res.set(MediaType::Json);
let mut stream = res.start()?;
if let Err(err) = stream.write_all(r#"{"data": "Access denied", "success": false}"#.as_bytes()) {
stream.bai... | }
_ => false, | random_line_split |
version.rs | use std::str::FromStr;
use cargo_edit::VersionExt;
use crate::errors::*;
#[derive(Clone, Debug)]
pub enum TargetVersion {
Relative(BumpLevel),
Absolute(semver::Version),
}
impl TargetVersion {
pub fn bump(
&self,
current: &semver::Version,
metadata: Option<&str>,
) -> CargoRe... |
}
#[derive(Debug, Clone, Copy)]
pub enum BumpLevel {
Major,
Minor,
Patch,
/// Strip all pre-release flags
Release,
Rc,
Beta,
Alpha,
}
impl BumpLevel {
pub fn variants() -> &'static [&'static str] {
&["major", "minor", "patch", "release", "rc", "beta", "alpha"]
}
}
imp... | {
TargetVersion::Relative(BumpLevel::Release)
} | identifier_body |
version.rs | use std::str::FromStr;
use cargo_edit::VersionExt;
use crate::errors::*;
#[derive(Clone, Debug)]
pub enum TargetVersion {
Relative(BumpLevel),
Absolute(semver::Version),
}
impl TargetVersion {
pub fn bump(
&self,
current: &semver::Version,
metadata: Option<&str>,
) -> CargoRe... | version.increment_alpha()?;
}
};
if let Some(metadata) = metadata {
version.metadata(metadata)?;
}
Ok(())
}
} | }
BumpLevel::Beta => {
version.increment_beta()?;
}
BumpLevel::Alpha => { | random_line_split |
version.rs | use std::str::FromStr;
use cargo_edit::VersionExt;
use crate::errors::*;
#[derive(Clone, Debug)]
pub enum TargetVersion {
Relative(BumpLevel),
Absolute(semver::Version),
}
impl TargetVersion {
pub fn bump(
&self,
current: &semver::Version,
metadata: Option<&str>,
) -> CargoRe... | (
self,
version: &mut semver::Version,
metadata: Option<&str>,
) -> CargoResult<()> {
match self {
BumpLevel::Major => {
version.increment_major();
}
BumpLevel::Minor => {
version.increment_minor();
}
... | bump_version | identifier_name |
filetable.rs | /*
* Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores).
*
* M3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Genera... | log!(
FILES,
"FileEPs[{}] = EP:{},FD:{}", i, ep, fd
);
self.file_eps[i] = Some(FileEP {
fd: fd,
ep: ep,
});
... | for i in 0..MAX_EPS {
if self.file_eps[i].is_none() { | random_line_split |
filetable.rs | /*
* Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores).
*
* M3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Genera... | (&self, s: &mut VecSink) {
let count = self.files.iter().filter(|&f| f.is_some()).count();
s.push(&count);
for fd in 0..MAX_FILES {
if let Some(ref f) = self.files[fd] {
let file = f.borrow();
s.push(&fd);
s.push(&file.file_type());
... | serialize | identifier_name |
filetable.rs | /*
* Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores).
*
* M3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Genera... |
pub fn alloc(&mut self, file: FileHandle) -> Result<Fd, Error> {
for fd in 0..MAX_FILES {
if self.files[fd].is_none() {
self.set(fd, file);
return Ok(fd);
}
}
Err(Error::new(Code::NoSpace))
}
pub fn get(&self, fd: Fd) -> Opti... | {
self.alloc(file.clone()).map(|fd| FileRef::new(file, fd))
} | identifier_body |
filetable.rs | /*
* Copyright (C) 2018, Nils Asmussen <nils@os.inf.tu-dresden.de>
* Economic rights: Technische Universitaet Dresden (Germany)
*
* This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores).
*
* M3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Genera... |
}
// TODO be smarter here
let mut i = self.file_ep_victim;
for _ in 0..MAX_EPS {
if let Some(ref mut fep) = self.file_eps[i] {
log!(
FILES,
"FileEPs[{}] = EP:{},FD: switching from {} to {}",
i, fep.... | {
for i in 0..MAX_EPS {
if self.file_eps[i].is_none() {
log!(
FILES,
"FileEPs[{}] = EP:{},FD:{}", i, ep, fd
);
self.file_eps[i] = Some(FileEP {
... | conditional_block |
code_object.rs | use std::os::raw::c_void;
use native::*;
use native::CodeObject as CodeObjectHandle;
use super::{get_info, ErrorStatus};
pub struct CodeObject {
pub handle: CodeObjectHandle,
}
impl CodeObject {
pub fn version(&self) -> Result<String, ErrorStatus> |
pub fn type_info(&self) -> Result<CodeObjectType, ErrorStatus> {
get_info(|x| self.get_info(CodeObjectInfo::Type, x))
}
pub fn isa(&self) -> Result<ISA, ErrorStatus> {
get_info(|x| self.get_info(CodeObjectInfo::ISA, x))
}
pub fn machine_model(&self) -> Result<MachineModel, ErrorS... | {
get_info(|x| self.get_info(CodeObjectInfo::Version, x)).map(|x: [u8; 64]| {
let x = x.splitn(2, |c| *c == 0).next().unwrap_or(&[]);
String::from_utf8_lossy(x).to_string()
})
} | identifier_body |
code_object.rs | use std::os::raw::c_void;
use native::*;
use native::CodeObject as CodeObjectHandle;
use super::{get_info, ErrorStatus};
pub struct CodeObject {
pub handle: CodeObjectHandle,
}
impl CodeObject {
pub fn version(&self) -> Result<String, ErrorStatus> {
get_info(|x| self.get_info(CodeObjectInfo::Version,... |
pub fn profile(&self) -> Result<Profile, ErrorStatus> {
get_info(|x| self.get_info(CodeObjectInfo::Profile, x))
}
pub fn default_float_rounding_mode(&self) -> Result<DefaultFloatRoundingMode, ErrorStatus> {
get_info(|x| {
self.get_info(CodeObjectInfo::DefaultFloatRoundingMode, ... | }
pub fn machine_model(&self) -> Result<MachineModel, ErrorStatus> {
get_info(|x| self.get_info(CodeObjectInfo::MachineModel, x))
} | random_line_split |
code_object.rs | use std::os::raw::c_void;
use native::*;
use native::CodeObject as CodeObjectHandle;
use super::{get_info, ErrorStatus};
pub struct CodeObject {
pub handle: CodeObjectHandle,
}
impl CodeObject {
pub fn version(&self) -> Result<String, ErrorStatus> {
get_info(|x| self.get_info(CodeObjectInfo::Version,... | (&self) -> Result<DefaultFloatRoundingMode, ErrorStatus> {
get_info(|x| {
self.get_info(CodeObjectInfo::DefaultFloatRoundingMode, x)
})
}
fn get_info(&self, attr: CodeObjectInfo, v: *mut c_void) -> HSAStatus {
unsafe { hsa_code_object_get_info(self.handle, attr, v) }
}
}... | default_float_rounding_mode | identifier_name |
mod.rs | use piston_window;
use piston_window::{Context, G2d, Glyphs, RenderArgs, Transformed};
use piston_window::types::Scalar;
use rusttype::{Rect, Scale, VMetrics};
use {GameState, InnerState, Progress};
mod text;
/// Draws the game state.
pub fn | (state: &GameState,
render_args: RenderArgs,
context: Context,
graphics: &mut G2d,
glyphs: &mut Glyphs) {
let black = [0.0, 0.0, 0.0, 1.0];
let white = [1.0, 1.0, 1.0, 1.0];
piston_window::clear(black, graphics);
let border = 32.0; // thickness of border,... | draw | identifier_name |
mod.rs | use piston_window;
use piston_window::{Context, G2d, Glyphs, RenderArgs, Transformed};
use piston_window::types::Scalar;
use rusttype::{Rect, Scale, VMetrics};
use {GameState, InnerState, Progress};
mod text;
/// Draws the game state.
pub fn draw(state: &GameState,
render_args: RenderArgs,
co... | },
border + ascent as Scalar + shake);
draw("Copyright 1942",
&|bounding_box| border - bounding_box.min.x as Scalar,
render_args.height as Scalar - border + descent as Scalar + shake);
draw(&fps_text,
&|bounding_box| {
ren... | draw("This is some text.",
&|bounding_box| {
render_args.width as Scalar - border -
bounding_box.max.x as Scalar | random_line_split |
mod.rs | use piston_window;
use piston_window::{Context, G2d, Glyphs, RenderArgs, Transformed};
use piston_window::types::Scalar;
use rusttype::{Rect, Scale, VMetrics};
use {GameState, InnerState, Progress};
mod text;
/// Draws the game state.
pub fn draw(state: &GameState,
render_args: RenderArgs,
co... | let pixels = text::points_to_pixels(points);
let VMetrics { ascent, descent,.. } = glyphs.font
.v_metrics(Scale::uniform(pixels));
let fps_text = format!("{} FPS", state.fps);
let mut draw = |text, x: &Fn(Rect<f32>) -> Scalar, y| {
let bounding_box = text::bounding... | {
let black = [0.0, 0.0, 0.0, 1.0];
let white = [1.0, 1.0, 1.0, 1.0];
piston_window::clear(black, graphics);
let border = 32.0; // thickness of border, in pixels
let (title, shake) = match state.state {
InnerState::Falling(progress) => {
((render_args.height as Scalar - border)... | identifier_body |
check.rs | use petgraph::prelude::*;
use crate::{MIME};
fn from_u8_singlerule(file: &[u8], rule: &super::MagicRule) -> bool {
// Check if we're even in bounds
let bound_min =
rule.start_off as usize;
let bound_max =
rule.start_off as usize +
rule.val_len as usize +
rule.region_len as usize;
if (file.len()) < bo... | y.push(x[i as usize] & mask[i as usize]);
}
},
None => y = x.to_vec(),
}
if y.iter().eq(rule.val.iter()) {
return true;
}
}
}
false
}
/// Test every given rule by walking graph
/// TODO: Not loving the code duplication here.
pub fn from_u8_walker(
file: &[u8],
mimetype: MIME,
... | random_line_split | |
check.rs | use petgraph::prelude::*;
use crate::{MIME};
fn from_u8_singlerule(file: &[u8], rule: &super::MagicRule) -> bool {
// Check if we're even in bounds
let bound_min =
rule.start_off as usize;
let bound_max =
rule.start_off as usize +
rule.val_len as usize +
rule.region_len as usize;
if (file.len()) < bo... | //println!("\t{:?} / {:?}", x, rule.val);
assert_eq!(x.len(), mask.len());
for i in 0..std::cmp::min(x.len(), mask.len()) {
x[i] &= mask[i];
val[i] = val[i] & mask[i];
}
//println!("\t & {:?} => {:?}", mask, x);
return rule.val.iter().eq(x.iter());
}
}
}
else {
... | {
//println!("Region == 0");
match rule.mask {
None => {
//println!("\tMask == None");
let x: Vec<u8> = file.iter().skip(bound_min).take(bound_max - bound_min).map(|&x| x).collect();
//println!("\t{:?} / {:?}", x, rule.val);
//println!("\tIndent: {}, Start: {}", rule.indent_level, rule.star... | conditional_block |
check.rs | use petgraph::prelude::*;
use crate::{MIME};
fn from_u8_singlerule(file: &[u8], rule: &super::MagicRule) -> bool | //println!("\tMask == None");
let x: Vec<u8> = file.iter().skip(bound_min).take(bound_max - bound_min).map(|&x| x).collect();
//println!("\t{:?} / {:?}", x, rule.val);
//println!("\tIndent: {}, Start: {}", rule.indent_level, rule.start_off);
return rule.val.iter().eq(x.iter());
},
Some(ref mas... | {
// Check if we're even in bounds
let bound_min =
rule.start_off as usize;
let bound_max =
rule.start_off as usize +
rule.val_len as usize +
rule.region_len as usize;
if (file.len()) < bound_max {
return false;
}
if rule.region_len == 0 {
//println!("Region == 0");
match rule.mask {
... | identifier_body |
check.rs | use petgraph::prelude::*;
use crate::{MIME};
fn | (file: &[u8], rule: &super::MagicRule) -> bool {
// Check if we're even in bounds
let bound_min =
rule.start_off as usize;
let bound_max =
rule.start_off as usize +
rule.val_len as usize +
rule.region_len as usize;
if (file.len()) < bound_max {
return false;
}
if rule.region_len == 0 {
//pr... | from_u8_singlerule | identifier_name |
lifetime.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 ... |
mc::cat_deref(_, _, mc::UnsafePtr(..)) => {
ty::ReStatic
}
mc::cat_deref(_, _, mc::BorrowedPtr(_, r)) |
mc::cat_deref(_, _, mc::Implicit(_, r)) => {
r
}
mc::cat_downcast(ref cmt, _) |
mc::cat_deref(ref c... | {
ty::ReScope(self.bccx.tcx.region_maps.var_scope(local_id))
} | conditional_block |
lifetime.rs | // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn scope(&self, cmt: &mc::cmt) -> ty::Region {
//! Returns the maximal region scope for the which the
//! lvalue `cmt` is guaranteed to be valid without any
//! rooting etc, and presuming `cmt` is not mutated.
match cmt.cat {
mc::cat_rvalue(temp_scope) => {
... | {
//! Reports an error if `loan_region` is larger than `max_scope`
if !self.bccx.is_subregion_of(self.loan_region, max_scope) {
Err(self.report_error(err_out_of_scope(max_scope, self.loan_region)))
} else {
Ok(())
}
} | identifier_body |
lifetime.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 ... | (&self, max_scope: ty::Region) -> R {
//! Reports an error if `loan_region` is larger than `max_scope`
if!self.bccx.is_subregion_of(self.loan_region, max_scope) {
Err(self.report_error(err_out_of_scope(max_scope, self.loan_region)))
} else {
Ok(())
}
}
f... | check_scope | identifier_name |
lifetime.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 ... | cmt_original: cmt.clone()};
ctxt.check(&cmt, None)
}
///////////////////////////////////////////////////////////////////////////
// Private
struct GuaranteeLifetimeContext<'a, 'tcx: 'a> {
bccx: &'a BorrowckCtxt<'a, 'tcx>,
// the scope of the function body for the ... | random_line_split | |
specialization-basics.rs | // run-pass
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Tests a variety of basic specialization scenarios and method
// dispatch for them.
trait Foo {
fn foo(&self) -> &'static str;
}
impl<T> Foo for T {
default fn foo(&self) -> &'static str {
"generic"
}
}... | assert!(NotClone.foo() == "generic");
assert!(0u8.foo() == "generic Clone");
assert!(vec![NotClone].foo() == "generic");
assert!(vec![0u8].foo() == "generic Vec");
assert!(vec![0i32].foo() == "Vec<i32>");
assert!(0i32.foo() == "i32");
assert!(String::new().foo() == "String");
assert!((()... | struct MarkedAndClone;
impl MyMarker for MarkedAndClone {}
fn main() { | random_line_split |
specialization-basics.rs | // run-pass
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Tests a variety of basic specialization scenarios and method
// dispatch for them.
trait Foo {
fn foo(&self) -> &'static str;
}
impl<T> Foo for T {
default fn foo(&self) -> &'static str {
"generic"
}
}... | (&self) -> &'static str {
"(u8, u8)"
}
}
impl<T: Clone> Foo for Vec<T> {
default fn foo(&self) -> &'static str {
"generic Vec"
}
}
impl Foo for Vec<i32> {
fn foo(&self) -> &'static str {
"Vec<i32>"
}
}
impl Foo for String {
fn foo(&self) -> &'static str {
"Stri... | foo | identifier_name |
specialization-basics.rs | // run-pass
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
// Tests a variety of basic specialization scenarios and method
// dispatch for them.
trait Foo {
fn foo(&self) -> &'static str;
}
impl<T> Foo for T {
default fn foo(&self) -> &'static str {
"generic"
}
}... |
}
struct NotClone;
trait MyMarker {}
impl<T: Clone + MyMarker> Foo for T {
default fn foo(&self) -> &'static str {
"generic Clone + MyMarker"
}
}
#[derive(Clone)]
struct MarkedAndClone;
impl MyMarker for MarkedAndClone {}
fn main() {
assert!(NotClone.foo() == "generic");
assert!(0u8.foo() ... | {
"i32"
} | identifier_body |
sample.rs | use ffi::*;
use caps::Caps;
use buffer::Buffer;
use videoframe::VideoFrame;
use std::mem;
use std::ptr;
use reference::Reference;
use miniobject::MiniObject;
unsafe impl Send for Sample {}
#[derive(Clone)]
pub struct Sample{
sample: MiniObject
}
impl Sample{
pub unsafe fn new(sample: *mut GstSample) -> Option<Samp... | (&self) -> Option<Buffer>{
unsafe{
let buffer = gst_sample_get_buffer(mem::transmute(self.gst_sample()));
if buffer!= ptr::null_mut(){
Buffer::new(gst_mini_object_ref(buffer as *mut GstMiniObject) as *mut GstBuffer)
}else{
None
}
}
}
//... | buffer | identifier_name |
sample.rs | use ffi::*;
use caps::Caps;
use buffer::Buffer;
use videoframe::VideoFrame;
use std::mem;
use std::ptr;
use reference::Reference;
use miniobject::MiniObject;
unsafe impl Send for Sample {}
#[derive(Clone)]
pub struct Sample{
sample: MiniObject
}
impl Sample{
pub unsafe fn new(sample: *mut GstSample) -> Option<Samp... |
/// Get the segment associated with sample
pub fn segment(&self) -> GstSegment{
unsafe{
(*gst_sample_get_segment(mem::transmute(self.gst_sample())))
}
}
/// Get a video frame from this sample if it contains one
pub fn video_frame(&self) -> Option<VideoFrame>{
l... | {
unsafe{
let caps = gst_sample_get_caps(mem::transmute(self.gst_sample()));
if caps != ptr::null_mut(){
Caps::new(gst_mini_object_ref(caps as *mut GstMiniObject) as *mut GstCaps)
}else{
None
}
}
} | identifier_body |
sample.rs | use ffi::*;
use caps::Caps;
use buffer::Buffer;
use videoframe::VideoFrame;
use std::mem;
use std::ptr;
use reference::Reference;
use miniobject::MiniObject;
unsafe impl Send for Sample {}
#[derive(Clone)]
pub struct Sample{
sample: MiniObject
}
impl Sample{
pub unsafe fn new(sample: *mut GstSample) -> Option<Samp... |
impl Reference for Sample{
fn reference(&self) -> Sample{
Sample{
sample: self.sample.reference()
}
}
} | self.sample.transfer() as *mut GstSample
}
} | random_line_split |
error.rs | use wasm_core::value::Value;
#[allow(dead_code)]
#[repr(i32)]
#[derive(Debug, Copy, Clone)]
pub enum ErrorCode {
Success = 0,
Generic = 1,
Eof = 2,
Shutdown = 3,
PermissionDenied = 4,
OngoingIo = 5,
InvalidInput = 6,
BindFail = 7,
NotFound = 8
}
impl ErrorCode {
pub fn to_re... | (&self) -> i32 {
-(*self as i32)
}
}
impl From<::std::io::ErrorKind> for ErrorCode {
fn from(other: ::std::io::ErrorKind) -> ErrorCode {
use std::io::ErrorKind::*;
match other {
NotFound => ErrorCode::NotFound,
PermissionDenied => ErrorCode::PermissionDenied,
... | to_i32 | identifier_name |
error.rs | use wasm_core::value::Value;
#[allow(dead_code)]
#[repr(i32)]
#[derive(Debug, Copy, Clone)]
pub enum ErrorCode {
Success = 0,
Generic = 1,
Eof = 2,
Shutdown = 3,
PermissionDenied = 4,
OngoingIo = 5,
InvalidInput = 6,
BindFail = 7,
NotFound = 8
}
impl ErrorCode {
pub fn to_re... |
pub fn to_i32(&self) -> i32 {
-(*self as i32)
}
}
impl From<::std::io::ErrorKind> for ErrorCode {
fn from(other: ::std::io::ErrorKind) -> ErrorCode {
use std::io::ErrorKind::*;
match other {
NotFound => ErrorCode::NotFound,
PermissionDenied => ErrorCode::P... | {
Value::I32(self.to_i32())
} | identifier_body |
error.rs | use wasm_core::value::Value;
#[allow(dead_code)]
#[repr(i32)]
#[derive(Debug, Copy, Clone)]
pub enum ErrorCode { | Success = 0,
Generic = 1,
Eof = 2,
Shutdown = 3,
PermissionDenied = 4,
OngoingIo = 5,
InvalidInput = 6,
BindFail = 7,
NotFound = 8
}
impl ErrorCode {
pub fn to_ret(&self) -> Value {
Value::I32(self.to_i32())
}
pub fn to_i32(&self) -> i32 {
-(*self as ... | random_line_split | |
stuff.rs | use x11::{xlib, xinput2};
use std::{mem, slice};
use std::ffi::{CStr, CString};
pub fn desc_flags<'a>(flags: i32, desc: &'a [&str]) -> Vec<&'a str>
|
pub fn enumerate_devices(display: *mut xlib::Display)
{
let mut ndevices = 0;
let devices_ptr = unsafe { xinput2::XIQueryDevice(display, xinput2::XIAllDevices, &mut ndevices) };
let xi_devices = unsafe { slice::from_raw_parts(devices_ptr, ndevices as usize) };
let dev_use = ["unk", "XIMasterPointer",... | {
(0 .. desc.len()).filter(|i| flags & (1 << i) != 0).map(|i| desc[i]).collect()
} | identifier_body |
stuff.rs | use x11::{xlib, xinput2};
use std::{mem, slice};
use std::ffi::{CStr, CString};
pub fn desc_flags<'a>(flags: i32, desc: &'a [&str]) -> Vec<&'a str>
{
(0.. desc.len()).filter(|i| flags & (1 << i)!= 0).map(|i| desc[i]).collect()
}
pub fn | (display: *mut xlib::Display)
{
let mut ndevices = 0;
let devices_ptr = unsafe { xinput2::XIQueryDevice(display, xinput2::XIAllDevices, &mut ndevices) };
let xi_devices = unsafe { slice::from_raw_parts(devices_ptr, ndevices as usize) };
let dev_use = ["unk", "XIMasterPointer", "XIMasterKeyboard", "XISl... | enumerate_devices | identifier_name |
stuff.rs | use x11::{xlib, xinput2};
use std::{mem, slice};
use std::ffi::{CStr, CString};
pub fn desc_flags<'a>(flags: i32, desc: &'a [&str]) -> Vec<&'a str>
{
(0.. desc.len()).filter(|i| flags & (1 << i)!= 0).map(|i| desc[i]).collect()
}
pub fn enumerate_devices(display: *mut xlib::Display)
{
let mut ndevices = 0;
... | println!("-- device {} {:?} is a {} (paired with {})", dev.deviceid, name, dev_use[dev._use as usize], dev.attachment);
for i in 0.. dev.num_classes as isize
{
let class = unsafe { *dev.classes.offset(i) };
let _type = unsafe { (*class)._type };
let ci_str = ... | let dev_class = ["XIKeyClass", "XIButtonClass", "XIValuatorClass", "XIScrollClass", "4", "5", "6", "7", "XITouchClass"];
for dev in xi_devices
{
let name = unsafe{ CStr::from_ptr(dev.name) }; | random_line_split |
stuff.rs | use x11::{xlib, xinput2};
use std::{mem, slice};
use std::ffi::{CStr, CString};
pub fn desc_flags<'a>(flags: i32, desc: &'a [&str]) -> Vec<&'a str>
{
(0.. desc.len()).filter(|i| flags & (1 << i)!= 0).map(|i| desc[i]).collect()
}
pub fn enumerate_devices(display: *mut xlib::Display)
{
let mut ndevices = 0;
... |
else { CString::new("(null)").unwrap() };
format!("number {}, name {:?}, min {}, max {}, res {}, mode {}",
val_c.number, name, val_c.min, val_c.max, val_c.resolution, val_c.mode)
},
xinput2::XIScrollClass => {
... | {
unsafe {
let ptr = xlib::XGetAtomName(display, val_c.label);
let val = CStr::from_ptr(ptr).to_owned();
xlib::XFree(ptr as *mut _);
val
}
} | conditional_block |
float.rs | use crate::msgpack::encode::*;
#[test]
fn pass_pack_f32() |
#[test]
fn pass_pack_f64() {
use std::f64;
let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
write_f64(&mut &mut buf[..], f64::INFINITY).ok().unwrap();
assert_eq!([0xcb, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], buf);
}
| {
let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00];
write_f32(&mut &mut buf[..], 3.4028234e38_f32).ok().unwrap();
assert_eq!([0xca, 0x7f, 0x7f, 0xff, 0xff], buf);
} | identifier_body |
float.rs | use crate::msgpack::encode::*;
#[test]
fn pass_pack_f32() {
let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00]; | write_f32(&mut &mut buf[..], 3.4028234e38_f32).ok().unwrap();
assert_eq!([0xca, 0x7f, 0x7f, 0xff, 0xff], buf);
}
#[test]
fn pass_pack_f64() {
use std::f64;
let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
write_f64(&mut &mut buf[..], f64::INFINITY).ok().unwrap();
assert... | random_line_split | |
float.rs | use crate::msgpack::encode::*;
#[test]
fn pass_pack_f32() {
let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00];
write_f32(&mut &mut buf[..], 3.4028234e38_f32).ok().unwrap();
assert_eq!([0xca, 0x7f, 0x7f, 0xff, 0xff], buf);
}
#[test]
fn | () {
use std::f64;
let mut buf = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
write_f64(&mut &mut buf[..], f64::INFINITY).ok().unwrap();
assert_eq!([0xcb, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], buf);
}
| pass_pack_f64 | identifier_name |
lib.rs | //! Get information concerning the build target.
macro_rules! return_cfg {
($i:ident : $s:expr) => ( if cfg!($i = $s) { return $s; } );
($i:ident : $s:expr, $($t:expr),+) => ( return_cfg!($i: $s); return_cfg!($i: $($t),+) );
}
/// Collection of functions to give information on the build target.
pub struct Target;
i... |
/// Pointer width; given by `target_pointer_width`.
pub fn pointer_width() -> &'static str {
return_cfg!(target_pointer_width: "32", "64");
"unknown"
}
// TODO: enable once it's not experimental API.
// pub fn vendor() -> &'static str {
// return_cfg!(target_vendor: "apple", "pc");
// "unknown"
// }
}
| {
return_cfg!(target_os: "windows", "macos", "ios", "linux", "android", "freebsd", "dragonfly", "bitrig", "openbsd", "netbsd");
"unknown"
} | identifier_body |
lib.rs |
macro_rules! return_cfg {
($i:ident : $s:expr) => ( if cfg!($i = $s) { return $s; } );
($i:ident : $s:expr, $($t:expr),+) => ( return_cfg!($i: $s); return_cfg!($i: $($t),+) );
}
/// Collection of functions to give information on the build target.
pub struct Target;
impl Target {
/// Architecture; given by `target_... | //! Get information concerning the build target. | random_line_split | |
lib.rs | //! Get information concerning the build target.
macro_rules! return_cfg {
($i:ident : $s:expr) => ( if cfg!($i = $s) { return $s; } );
($i:ident : $s:expr, $($t:expr),+) => ( return_cfg!($i: $s); return_cfg!($i: $($t),+) );
}
/// Collection of functions to give information on the build target.
pub struct Target;
i... | () -> &'static str {
return_cfg!(target_pointer_width: "32", "64");
"unknown"
}
// TODO: enable once it's not experimental API.
// pub fn vendor() -> &'static str {
// return_cfg!(target_vendor: "apple", "pc");
// "unknown"
// }
}
| pointer_width | identifier_name |
fs.rs | use std::env;
use std::fs;
#[derive(Debug, Copy, Clone)]
pub enum LlamaFile {
SdCardImg,
NandImg,
NandCid,
AesKeyDb,
Otp,
Boot9,
Boot11,
}
#[cfg(not(target_os = "windows"))]
fn make_filepath(filename: &str) -> String {
format!("{}/.config/llama/{}", env::var("HOME").unwrap(), filename)... | } | Ok(file) | random_line_split |
fs.rs | use std::env;
use std::fs;
#[derive(Debug, Copy, Clone)]
pub enum | {
SdCardImg,
NandImg,
NandCid,
AesKeyDb,
Otp,
Boot9,
Boot11,
}
#[cfg(not(target_os = "windows"))]
fn make_filepath(filename: &str) -> String {
format!("{}/.config/llama/{}", env::var("HOME").unwrap(), filename)
}
#[cfg(target_os = "windows")]
fn make_filepath(filename: &str) -> String... | LlamaFile | identifier_name |
fat_type.rs | // Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! Loaded representation for runtime types.
use diem_types::{account_address::AccountAddress, vm_status::StatusCode};
use move_core_types::{
identifier::Identifier,
language_storage::{StructTag, TypeTag},
value::{MoveStruct... | .ty_args
.iter()
.map(|ty| ty.subst(ty_args))
.collect::<PartialVMResult<_>>()?,
layout: self
.layout
.iter()
.map(|ty| ty.subst(ty_args))
.collect::<PartialVMResult<_>>()?,
})
... | name: self.name.clone(),
abilities: self.abilities,
ty_args: self | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.