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 |
|---|---|---|---|---|
utmpx.rs | // This file is part of the uutils coreutils package.
//
// (c) Jian Zeng <anonymousknight96@gmail.com>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//
//! Aims to provide platform-independent methods to obtain login records
//!
//! **... |
/// A.K.A. ut.ut_user
pub fn user(&self) -> String {
chars2string!(self.inner.ut_user)
}
/// A.K.A. ut.ut_host
pub fn host(&self) -> String {
chars2string!(self.inner.ut_host)
}
/// A.K.A. ut.ut_line
pub fn tty_device(&self) -> String {
chars2string!(self.inner.u... | {
chars2string!(self.inner.ut_id)
} | identifier_body |
utmpx.rs | // This file is part of the uutils coreutils package.
//
// (c) Jian Zeng <anonymousknight96@gmail.com>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//
//! Aims to provide platform-independent methods to obtain login records
//!
//! **... |
}
}
}
| {
endutxent();
None
} | conditional_block |
utmpx.rs | // This file is part of the uutils coreutils package.
//
// (c) Jian Zeng <anonymousknight96@gmail.com>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//
//! Aims to provide platform-independent methods to obtain login records
//!
//! **... | pub const UT_LINESIZE: usize = 16;
pub const UT_NAMESIZE: usize = 32;
pub const UT_IDSIZE: usize = 8;
pub const UT_HOSTSIZE: usize = 128;
pub use libc::EMPTY;
pub use libc::BOOT_TIME;
pub use libc::OLD_TIME;
pub use libc::NEW_TIME;
pub use libc::USER_PROCESS;
pub use libc::INIT_... | random_line_split | |
main.rs | extern crate px8;
extern crate sdl2;
extern crate time;
extern crate rand;
#[macro_use]
extern crate log;
extern crate fern;
extern crate nalgebra;
use std::sync::{Arc, Mutex};
use px8::px8::math;
use px8::frontend;
use px8::gfx;
use px8::cartridge;
use px8::px8::RustPlugin;
use px8::config::Players;
use nalgebra::Ve... |
}
fn main() {
let logger_config = fern::DispatchConfig {
format: Box::new(|msg: &str, level: &log::LogLevel, _location: &log::LogLocation| {
format!("[{}][{}] {}",
time::now().strftime("%Y-%m-%d][%H:%M:%S").unwrap(),
level,
msg)
... | {
screen.lock().unwrap().cls();
for fighter in self.fighters.iter_mut() {
fighter.draw(screen.clone());
}
return 0.;
} | identifier_body |
main.rs | extern crate px8;
extern crate sdl2;
extern crate time;
extern crate rand;
#[macro_use]
extern crate log;
extern crate fern;
extern crate nalgebra;
use std::sync::{Arc, Mutex};
use px8::px8::math;
use px8::frontend;
use px8::gfx;
use px8::cartridge;
use px8::px8::RustPlugin;
use px8::config::Players;
use nalgebra::Ve... |
let war = FourmisWar::new("./fourmiswar.dpx8".to_string());
let mut frontend = match frontend::Frontend::init(px8::gfx::Scale::Scale4x, false, true, true) {
Err(error) => panic!("{:?}", error),
Ok(frontend) => frontend,
};
frontend.px8.register(war);
frontend.start("./gamecontro... | {
panic!("Failed to initialize global logger: {}", e);
} | conditional_block |
main.rs | extern crate px8;
extern crate sdl2;
extern crate time;
extern crate rand;
#[macro_use]
extern crate log;
extern crate fern;
extern crate nalgebra;
use std::sync::{Arc, Mutex};
use px8::px8::math;
use px8::frontend;
use px8::gfx;
use px8::cartridge;
use px8::px8::RustPlugin;
use px8::config::Players;
use nalgebra::Ve... | (x: u32, y: u32) -> Fighter {
Fighter {
pos: Vector2::new(x, y)
}
}
fn update(&mut self) {
}
fn draw(&mut self, screen: Arc<Mutex<gfx::Screen>>) {
screen.lock().unwrap().pset(self.pos.x as i32, self.pos.y as i32, 8);
}
}
pub struct FourmisWar {
pub sprite_... | new | identifier_name |
main.rs | extern crate px8;
extern crate sdl2;
extern crate time;
extern crate rand;
#[macro_use]
extern crate log;
extern crate fern;
extern crate nalgebra;
use std::sync::{Arc, Mutex};
use px8::px8::math;
use px8::frontend;
use px8::gfx;
use px8::cartridge;
use px8::px8::RustPlugin;
use px8::config::Players;
use nalgebra::Ve... | self.fighters.push(Fighter::new(40, 50));
match cartridge::Cartridge::parse(self.sprite_filename.clone(), false) {
Ok(c) => screen.lock().unwrap().set_sprites(c.gfx.sprites),
Err(e) => panic!("Impossible to load the assets {:?}", e),
}
return 0.;
}
fn u... | }
}
impl RustPlugin for FourmisWar {
fn init(&mut self, screen: Arc<Mutex<gfx::Screen>>) -> f64 { | random_line_split |
decl.rs | use joker::track::*;
use joker::token::StringLiteral;
use id::Id;
use fun::Fun;
use patt::{Patt, CompoundPatt};
use expr::Expr;
use punc::Semi;
#[derive(Debug, PartialEq, Clone, TrackingRef, TrackingMut, Untrack)]
pub enum Import {
// ES6: more import forms
ForEffect(Option<Span>, StringLiteral)
}
#[derive(D... | {
// ES6: more export forms
Var(Option<Span>, Vec<Dtor>, Semi),
Decl(Decl)
}
#[derive(Debug, PartialEq, Clone, TrackingRef, TrackingMut, Untrack)]
pub enum Decl {
Fun(Fun<Id>),
Let(Option<Span>, Vec<Dtor>, Semi),
Const(Option<Span>, Vec<ConstDtor>, Semi)
}
#[derive(Debug, PartialEq, Clone, Tr... | Export | identifier_name |
decl.rs | use joker::track::*;
use joker::token::StringLiteral;
use id::Id;
use fun::Fun;
use patt::{Patt, CompoundPatt};
use expr::Expr;
use punc::Semi;
#[derive(Debug, PartialEq, Clone, TrackingRef, TrackingMut, Untrack)]
pub enum Import {
// ES6: more import forms
ForEffect(Option<Span>, StringLiteral)
}
#[derive(D... | (lhs @ Patt::Compound(_), None) => Err(lhs),
(Patt::Compound(patt), Some(rhs)) => {
Ok(Dtor::from_compound_init(patt, rhs))
}
}
}
}
impl DtorExt for ConstDtor {
fn from_compound_init(lhs: CompoundPatt<Id>, rhs: Expr) -> ConstDtor {
ConstDtor::... | random_line_split | |
3_07_oscillating_objects.rs | // The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
//
// Example 5-07: Oscillating Objects
use nannou::prelude::*;
fn main() {
nannou::app(model).update(update).run();
}
struct Model {
// An array of type Oscillator
oscillators: Vec<Oscillator>,
}
#[derive(Clone)]
struct Oscillator {
... | }
fn model(app: &App) -> Model {
let rect = Rect::from_w_h(640.0, 360.0);
app.new_window()
.size(rect.w() as u32, rect.h() as u32)
.view(view)
.build()
.unwrap();
//let oscillators = vec![Oscillator::new(app.window_rect()); 10];
let oscillators = (0..10).map(|_| Oscillator::... | .rgba(0.5, 0.5, 0.5, 0.5)
.stroke(BLACK)
.stroke_weight(2.0);
} | random_line_split |
3_07_oscillating_objects.rs | // The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
//
// Example 5-07: Oscillating Objects
use nannou::prelude::*;
fn main() {
nannou::app(model).update(update).run();
}
struct | {
// An array of type Oscillator
oscillators: Vec<Oscillator>,
}
#[derive(Clone)]
struct Oscillator {
angle: Vector2,
velocity: Vector2,
amplitude: Vector2,
}
impl Oscillator {
fn new(rect: Rect) -> Self {
let angle = vec2(0.0, 0.0);
let velocity = vec2(random_f32() * 0.1 - 0.... | Model | identifier_name |
3_07_oscillating_objects.rs | // The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
//
// Example 5-07: Oscillating Objects
use nannou::prelude::*;
fn main() |
struct Model {
// An array of type Oscillator
oscillators: Vec<Oscillator>,
}
#[derive(Clone)]
struct Oscillator {
angle: Vector2,
velocity: Vector2,
amplitude: Vector2,
}
impl Oscillator {
fn new(rect: Rect) -> Self {
let angle = vec2(0.0, 0.0);
let velocity = vec2(random_f3... | {
nannou::app(model).update(update).run();
} | identifier_body |
main.rs | use std::io;
struct PrioData {
lists: Vec<PrioList>,
}
struct PrioList {
name: String,
items: Vec<String>,
}
impl PrioList {
fn new(name: &str, items: Vec<String>) -> PrioList {
PrioList {
name: name.to_string(),
items: items.clone(),
}
}
fn add_item(&m... |
}
fn main() {
let mut data = PrioData {
lists: vec![PrioList::new("High", vec!["something".to_string(), "something else".to_string()])]
};
loop {
let prompt = "What do you want to do? (Type \"back\" at any time to return to the previos menu)";
let choices = vec![
"1. V... | {
self.items.push(new_item.to_string());
} | identifier_body |
main.rs | use std::io;
struct PrioData {
lists: Vec<PrioList>,
}
struct PrioList {
name: String,
items: Vec<String>,
}
impl PrioList {
fn new(name: &str, items: Vec<String>) -> PrioList {
PrioList {
name: name.to_string(),
items: items.clone(),
}
}
fn add_item(&m... | if new_item == "back" {
break;
}
list.add_item(&new_item);
}
}
fn create_priority_list(data: &PrioData) {
println!("create list!");
}
fn switch_board(prompt: &str, choices: Vec<String>) -> String {
println!("\n{}", prompt);
for choice in choices {
println!(... | random_line_split | |
main.rs | use std::io;
struct PrioData {
lists: Vec<PrioList>,
}
struct PrioList {
name: String,
items: Vec<String>,
}
impl PrioList {
fn new(name: &str, items: Vec<String>) -> PrioList {
PrioList {
name: name.to_string(),
items: items.clone(),
}
}
fn add_item(&m... | (prompt: &str, choices: Vec<String>) -> String {
println!("\n{}", prompt);
for choice in choices {
println!("{}", choice);
}
let choice = read_line();
choice.to_string()
}
fn read_line() -> String{
let mut line = String::new();
io::stdin().read_line(&mut line)
.ok()
... | switch_board | identifier_name |
layout_debug.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/. */
//! Supports writing a trace file created during each layout scope
//! that can be viewed by an external tool to m... |
/// Begin a layout debug trace. If this has not been called,
/// creating debug scopes has no effect.
pub fn begin_trace(flow_root: FlowRef) {
assert!(state_key.get().is_none());
let flow_trace = json::encode(&flow_root.deref());
let state = State {
scope_stack: vec![box ScopeData::new("root".to_... | {
unsafe { DEBUG_ID_COUNTER.fetch_add(1, SeqCst) as u16 }
} | identifier_body |
layout_debug.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/. */
//! Supports writing a trace file created during each layout scope
//! that can be viewed by an external tool to m... | ;
#[macro_export]
macro_rules! layout_debug_scope(
($($arg:tt)*) => (
if cfg!(not(ndebug)) {
layout_debug::Scope::new(format!($($arg)*))
} else {
layout_debug::Scope
}
)
)
#[deriving(Encodable)]
struct ScopeData {
name: String,
pre: String,
post: Str... | Scope | identifier_name |
layout_debug.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/. */
//! Supports writing a trace file created during each layout scope
//! that can be viewed by an external tool to m... | pub fn begin_trace(flow_root: FlowRef) {
assert!(state_key.get().is_none());
let flow_trace = json::encode(&flow_root.deref());
let state = State {
scope_stack: vec![box ScopeData::new("root".to_string(), flow_trace)],
flow_root: flow_root,
};
state_key.replace(Some(RefCell::new(sta... | random_line_split | |
layout_debug.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/. */
//! Supports writing a trace file created during each layout scope
//! that can be viewed by an external tool to m... |
}
Scope
}
}
#[cfg(not(ndebug))]
impl Drop for Scope {
fn drop(&mut self) {
let maybe_refcell = state_key.get();
match maybe_refcell {
Some(refcell) => {
let mut state = refcell.borrow_mut();
let mut current_scope = state.scope_stack.p... | {} | conditional_block |
main.rs | #![cfg(not(test))]
extern crate zaldinar;
extern crate getopts;
macro_rules! print_err {
($($arg:tt)*) => (
{
use std::io::prelude::*;
if let Err(e) = write!(&mut ::std::io::stderr(), "{}\n", format_args!($($arg)*)) {
panic!("Failed to write to stderr.\
... | () {
let result = main_exits();
std::process::exit(result);
}
/// Separate function from main to ensure that everything is cleaned up by exiting scope before
/// program exits using std::process::exit();
fn main_exits() -> i32 {
// Because env::current_exe() will change if the executing file is moved, we n... | main | identifier_name |
main.rs | #![cfg(not(test))]
extern crate zaldinar;
extern crate getopts;
macro_rules! print_err {
($($arg:tt)*) => (
{
use std::io::prelude::*;
if let Err(e) = write!(&mut ::std::io::stderr(), "{}\n", format_args!($($arg)*)) {
panic!("Failed to write to stderr.\
... |
fn get_program() -> io::Result<PathBuf> {
// This joins current_dir() and current_exe(), resulting in an absolute path to of the current
// executable
let mut buf = try!(env::current_dir());
buf.push(&try!(env::current_exe()));
return Ok(buf);
}
fn main() {
let result = main_exits();
std... | {
println!("Can't restart using execv on this platform!");
return 1;
} | identifier_body |
main.rs | #![cfg(not(test))]
extern crate zaldinar;
extern crate getopts;
macro_rules! print_err {
($($arg:tt)*) => (
{
use std::io::prelude::*;
if let Err(e) = write!(&mut ::std::io::stderr(), "{}\n", format_args!($($arg)*)) {
panic!("Failed to write to stderr.\
... | };
let mut opts = getopts::Options::new();
opts.optopt("c", "config", "set config file name", "FILE");
opts.optflag("h", "help", "print this help menu");
opts.optflag("v", "version", "print program version");
// TODO: Bug getopts to use OsString
let matches = match opts.parse(args.collect::... | let display_program = match args.next() {
// TODO: some error catching of lossy strings here or not?
Some(v) => v,
None => original_program.as_os_str().to_string_lossy().into_owned(), | random_line_split |
draw_cache.rs | use std::cell::RefCell;
use std::fmt;
use ggez::{
graphics::{BlendMode, DrawParam, Drawable},
Context, GameResult,
};
pub trait TryIntoDrawable<T>
where
T: Drawable,
{
fn try_into_drawable(&self, ctx: &mut Context) -> GameResult<T>;
}
pub struct DrawCache<T, U>
where
T: TryIntoDrawable<U>,
... | (data: T) -> Self {
Self {
data,
cache: RefCell::new(None),
}
}
}
impl<T, U> AsRef<T> for DrawCache<T, U>
where
T: TryIntoDrawable<U>,
U: Drawable,
{
fn as_ref(&self) -> &T {
&self.data
}
}
impl<T, U> fmt::Debug for DrawCache<T, U>
where
T: Try... | new | identifier_name |
draw_cache.rs | use std::cell::RefCell;
use std::fmt;
use ggez::{
graphics::{BlendMode, DrawParam, Drawable},
Context, GameResult,
};
pub trait TryIntoDrawable<T>
where
T: Drawable,
{
fn try_into_drawable(&self, ctx: &mut Context) -> GameResult<T>;
}
pub struct DrawCache<T, U>
where
T: TryIntoDrawable<U>,
... | } | random_line_split | |
draw_cache.rs | use std::cell::RefCell;
use std::fmt;
use ggez::{
graphics::{BlendMode, DrawParam, Drawable},
Context, GameResult,
};
pub trait TryIntoDrawable<T>
where
T: Drawable,
{
fn try_into_drawable(&self, ctx: &mut Context) -> GameResult<T>;
}
pub struct DrawCache<T, U>
where
T: TryIntoDrawable<U>,
... |
fn set_blend_mode(&mut self, mode: Option<BlendMode>) {
if let Some(ref mut drawable) = *self.cache.get_mut() {
drawable.set_blend_mode(mode);
}
}
fn get_blend_mode(&self) -> Option<BlendMode> {
match *self.cache.borrow() {
None => None,
Some(... | {
let is_cached = self.cache.borrow().is_some();
if !is_cached {
let drawable = self.data.try_into_drawable(ctx)?;
self.cache.replace(Some(drawable));
}
self.cache
.borrow_mut()
.as_mut()
.unwrap()
.draw_ex(ctx, para... | identifier_body |
extensions.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 core::iter::FromIterator;
use core::nonzero::NonZero;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::... | let name = T::name().to_uppercase();
self.extensions.borrow_mut().insert(name, box TypedWebGLExtensionWrapper::<T>::new());
}
pub fn get_suported_extensions(&self) -> Vec<&'static str> {
self.extensions.borrow().iter()
.filter(|ref v| v.1.is_supported(&sel... | }
}
pub fn register<T:'static + WebGLExtension + JSTraceable + HeapSizeOf>(&self) { | random_line_split |
extensions.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 core::iter::FromIterator;
use core::nonzero::NonZero;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::... |
})
}
pub fn get_dom_object<T>(&self) -> Option<Root<T::Extension>>
where T:'static + WebGLExtension + JSTraceable + HeapSizeOf {
let name = T::name().to_uppercase();
self.extensions.borrow().get(&name).and_then(|extension| {
extension.as_any().downcast_ref::<Type... | {
None
} | conditional_block |
extensions.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 core::iter::FromIterator;
use core::nonzero::NonZero;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::... | () -> WebGLExtensionFeatures {
WebGLExtensionFeatures {
gl_extensions: HashSet::new(),
disabled_tex_types: DEFAULT_DISABLED_TEX_TYPES.iter().cloned().collect(),
not_filterable_tex_types: DEFAULT_NOT_FILTERABLE_TEX_TYPES.iter().cloned().collect(),
effective_tex_int... | default | identifier_name |
extensions.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 core::iter::FromIterator;
use core::nonzero::NonZero;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::... |
pub fn get_query_parameter_handler(&self, name: GLenum) -> Option<Ref<Box<WebGLQueryParameterFunc>>> {
ref_filter_map(self.features.borrow(), |features| {
features.query_parameter_handlers.get(&name).map(|item| &item.func)
})
}
fn register_all_extensions(&self) {
self.... | {
let handler = WebGLQueryParameterHandler {
func: f
};
self.features.borrow_mut().query_parameter_handlers.insert(name, handler);
} | identifier_body |
literals.rs | use nom::{self, IResult, digit, Slice};
use misc::{StrSpan, Location};
macro_rules! recognize2 (
($i:expr, $submac:ident!( $($args:tt)* )) => ({
use nom::Offset;
use nom::Slice;
match $submac!($i, $($args)*) {
$crate::IResult::Done(i,_) => {
let index = ($i).... | <'a> {
pub value: LiteralValue,
pub loc: Location<'a>
}
/// https://www.ecma-international.org/ecma-262/7.0/index.html#prod-LineTerminator
const LINE_TERMINATORS: &'static str = "\n\r\u{2028}\u{2029}";
// equivalent to: "\u{000a}\u{000d}\u{2028}\u{2029}";
/// null literal value parser
/// https://www.ecma-int... | Literal | identifier_name |
literals.rs | use nom::{self, IResult, digit, Slice};
use misc::{StrSpan, Location};
macro_rules! recognize2 (
($i:expr, $submac:ident!( $($args:tt)* )) => ({
use nom::Offset;
use nom::Slice;
match $submac!($i, $($args)*) {
$crate::IResult::Done(i,_) => {
let index = ($i).... | }
});
($i:expr, $f:expr) => (
recognize2!($i, call!($f))
);
);
/// [A literal value]
/// (https://github.com/estree/estree/blob/master/es5.md#literal)
///
/// This has to be used with the `Literal` struct
#[derive(Debug, PartialEq)]
pub enum LiteralValue {
Null,
Number(f64),
Str... | $crate::IResult::Error(e) => $crate::IResult::Error(e),
$crate::IResult::Incomplete(i) => $crate::IResult::Incomplete(i) | random_line_split |
lib.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/. */
extern crate proc_macro;
extern crate syn;
extern crate synstructure;
#[proc_macro_derive(DenyPublicFields)]
pub ... | {
let type_ = syn::parse_macro_input(input).unwrap();
let style = synstructure::BindStyle::Ref.into();
synstructure::each_field(&type_, &style, |binding| {
if binding.field.vis != syn::Visibility::Inherited {
panic!("Field `{}` should not be public",
binding.field.ide... | identifier_body | |
lib.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/. */
extern crate proc_macro;
extern crate syn;
extern crate synstructure;
#[proc_macro_derive(DenyPublicFields)]
pub ... |
"".to_owned()
});
"".to_owned()
}
| {
panic!("Field `{}` should not be public",
binding.field.ident.as_ref().unwrap_or(&binding.ident));
} | conditional_block |
lib.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/. */
extern crate proc_macro;
extern crate syn;
extern crate synstructure;
#[proc_macro_derive(DenyPublicFields)]
pub ... | let style = synstructure::BindStyle::Ref.into();
synstructure::each_field(&type_, &style, |binding| {
if binding.field.vis!= syn::Visibility::Inherited {
panic!("Field `{}` should not be public",
binding.field.ident.as_ref().unwrap_or(&binding.ident));
}
""... | }
fn expand_string(input: &str) -> String {
let type_ = syn::parse_macro_input(input).unwrap();
| random_line_split |
lib.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/. */
extern crate proc_macro;
extern crate syn;
extern crate synstructure;
#[proc_macro_derive(DenyPublicFields)]
pub ... | (input: &str) -> String {
let type_ = syn::parse_macro_input(input).unwrap();
let style = synstructure::BindStyle::Ref.into();
synstructure::each_field(&type_, &style, |binding| {
if binding.field.vis!= syn::Visibility::Inherited {
panic!("Field `{}` should not be public",
... | expand_string | identifier_name |
mir_codegen_switch.rs | // run-pass
enum Abc {
A(u8),
B(i8),
C,
D,
}
fn foo(x: Abc) -> i32 {
match x {
Abc::C => 3,
Abc::D => 4,
Abc::B(_) => 2, | match x {
Abc::D => true,
_ => false
}
}
fn main() {
assert_eq!(1, foo(Abc::A(42)));
assert_eq!(2, foo(Abc::B(-100)));
assert_eq!(3, foo(Abc::C));
assert_eq!(4, foo(Abc::D));
assert_eq!(false, foo2(Abc::A(1)));
assert_eq!(false, foo2(Abc::B(2)));
assert_eq!(false, f... | Abc::A(_) => 1,
}
}
fn foo2(x: Abc) -> bool { | random_line_split |
mir_codegen_switch.rs | // run-pass
enum Abc {
A(u8),
B(i8),
C,
D,
}
fn foo(x: Abc) -> i32 {
match x {
Abc::C => 3,
Abc::D => 4,
Abc::B(_) => 2,
Abc::A(_) => 1,
}
}
fn foo2(x: Abc) -> bool {
match x {
Abc::D => true,
_ => false
}
}
fn | () {
assert_eq!(1, foo(Abc::A(42)));
assert_eq!(2, foo(Abc::B(-100)));
assert_eq!(3, foo(Abc::C));
assert_eq!(4, foo(Abc::D));
assert_eq!(false, foo2(Abc::A(1)));
assert_eq!(false, foo2(Abc::B(2)));
assert_eq!(false, foo2(Abc::C));
assert_eq!(true, foo2(Abc::D));
}
| main | identifier_name |
mir_codegen_switch.rs | // run-pass
enum Abc {
A(u8),
B(i8),
C,
D,
}
fn foo(x: Abc) -> i32 {
match x {
Abc::C => 3,
Abc::D => 4,
Abc::B(_) => 2,
Abc::A(_) => 1,
}
}
fn foo2(x: Abc) -> bool {
match x {
Abc::D => true,
_ => false
}
}
fn main() | {
assert_eq!(1, foo(Abc::A(42)));
assert_eq!(2, foo(Abc::B(-100)));
assert_eq!(3, foo(Abc::C));
assert_eq!(4, foo(Abc::D));
assert_eq!(false, foo2(Abc::A(1)));
assert_eq!(false, foo2(Abc::B(2)));
assert_eq!(false, foo2(Abc::C));
assert_eq!(true, foo2(Abc::D));
} | identifier_body | |
abi.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]
pub fn data(&self) -> &'static AbiData {
&AbiDatas[self.index()]
}
pub fn name(&self) -> &'static str {
self.data().name
}
}
impl fmt::Show for Abi {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "\"{}\"", self.name())
}
}
impl fmt::S... | {
*self as uint
} | identifier_body |
abi.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... | assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
}
#[test]
fn lookup_baz() {
let abi = lookup("baz");
assert!(abi.is_none());
}
#[test]
fn indices_are_correct() {
for (i, abi_data) in AbiDatas.iter().enumerate() {
assert_eq!(i, abi_data.abi.index());
}
} | fn lookup_cdecl() {
let abi = lookup("cdecl"); | random_line_split |
abi.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... | () {
let abi = lookup("cdecl");
assert!(abi.is_some() && abi.unwrap().data().name == "cdecl");
}
#[test]
fn lookup_baz() {
let abi = lookup("baz");
assert!(abi.is_none());
}
#[test]
fn indices_are_correct() {
for (i, abi_data) in AbiDatas.iter().enumerate() {
assert_eq!(i, abi_data.abi.ind... | lookup_cdecl | identifier_name |
test.rs | extern crate vote;
extern crate safex;
use vote::utils::get_address_methods::get_omniwalletorg;
use vote::utils::get_address_methods::OmniList;
use vote::voting::poll_genesis::{PollRound, PollHash, PollPersona};
use vote::voting::vote_genesis::{VoteRound};
use vote::voting::validate_genesis::{VotingOutcome};
use safex... | () {
//PollRound::make_poll();
//VoteRound::form_vote();
println!("{:?}", VotingOutcome::validate_outcome());
/*
let the_keys = KeyPair::create().unwrap();
let omni_list = get_omniwalletorg(56);
let our_keys = PollPersona::import_keys();
let keys = our_keys.return_keys();
let our_po... | main | identifier_name |
test.rs | extern crate vote;
extern crate safex;
use vote::utils::get_address_methods::get_omniwalletorg;
use vote::utils::get_address_methods::OmniList;
use vote::voting::poll_genesis::{PollRound, PollHash, PollPersona};
use vote::voting::vote_genesis::{VoteRound};
use vote::voting::validate_genesis::{VotingOutcome};
use safex... |
if list_elements[thethings].balance > 0 {
int_new += 1;
println!("#{:?}", int_new);
println!("address: {:?}", &list_elements[thethings].address);
println!("safe exchange coin balance: {:?}", &list_elements[thethings].balance);
... | for thethings in 0..list_elements.len() { | random_line_split |
test.rs | extern crate vote;
extern crate safex;
use vote::utils::get_address_methods::get_omniwalletorg;
use vote::utils::get_address_methods::OmniList;
use vote::voting::poll_genesis::{PollRound, PollHash, PollPersona};
use vote::voting::vote_genesis::{VoteRound};
use vote::voting::validate_genesis::{VotingOutcome};
use safex... |
print!("\n");
let contains_or = the_list.check_existence("15N8mbsRwiwyQpsTUcGfETpStYkTFjcHvh".to_string());
print!("Does the address contain? 15N8mbsRwiwyQpsTUcGfETpStYkTFjcHvh : {:?} \n", contains_or);
let mut int_new = 0;
for thethings in 0..list_elements.len() {
if list_... | {
//PollRound::make_poll();
//VoteRound::form_vote();
println!("{:?}", VotingOutcome::validate_outcome());
/*
let the_keys = KeyPair::create().unwrap();
let omni_list = get_omniwalletorg(56);
let our_keys = PollPersona::import_keys();
let keys = our_keys.return_keys();
let our_poll ... | identifier_body |
cr1.rs | #[doc = "Register `CR1` reader"]
pub struct R(crate::R<CR1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target |
}
impl From<crate::R<CR1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR1_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Field `CR1` reader - Compare Register for Channel 1"]
pub struct CR1_R(crate::FieldReader<u16, u16>);
impl CR1_R {
pub(crate) fn new(bits: u16) -> Self {
CR1_R(... | {
&self.0
} | identifier_body |
cr1.rs | #[doc = "Register `CR1` reader"]
pub struct R(crate::R<CR1_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CR1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR1_SPEC>) ... | (&self) -> CR1_R {
CR1_R::new((self.bits & 0xffff) as u16)
}
}
#[doc = "Channel 1 Compare Value\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr1](index.html) module"]
pub struct CR1_... | cr1 | identifier_name |
cr1.rs | #[doc = "Register `CR1` reader"]
pub struct R(crate::R<CR1_SPEC>);
impl core::ops::Deref for R { | &self.0
}
}
impl From<crate::R<CR1_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CR1_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Field `CR1` reader - Compare Register for Channel 1"]
pub struct CR1_R(crate::FieldReader<u16, u16>);
impl CR1_R {
pub(crate) fn new(bits: u16) -> ... | type Target = crate::R<CR1_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target { | random_line_split |
bitfield-enum-repr-c.rs | #![allow(
dead_code,
non_snake_case,
non_camel_case_types, | impl Foo {
pub const Bar: Foo = Foo(2);
}
impl Foo {
pub const Baz: Foo = Foo(4);
}
impl Foo {
pub const Duplicated: Foo = Foo(4);
}
impl Foo {
pub const Negative: Foo = Foo(-3);
}
impl ::std::ops::BitOr<Foo> for Foo {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
... | non_upper_case_globals
)]
| random_line_split |
bitfield-enum-repr-c.rs | #![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl Foo {
pub const Bar: Foo = Foo(2);
}
impl Foo {
pub const Baz: Foo = Foo(4);
}
impl Foo {
pub const Duplicated: Foo = Foo(4);
}
impl Foo {
pub const Negative: Foo = Foo(-3);
}
impl ::std::ops::BitO... |
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Foo(pub ::std::os::raw::c_int);
| {
self.0 &= rhs.0;
} | identifier_body |
bitfield-enum-repr-c.rs | #![allow(
dead_code,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
impl Foo {
pub const Bar: Foo = Foo(2);
}
impl Foo {
pub const Baz: Foo = Foo(4);
}
impl Foo {
pub const Duplicated: Foo = Foo(4);
}
impl Foo {
pub const Negative: Foo = Foo(-3);
}
impl ::std::ops::BitO... | (self, other: Self) -> Self {
Foo(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for Foo {
#[inline]
fn bitand_assign(&mut self, rhs: Foo) {
self.0 &= rhs.0;
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Foo(pub ::std::os::raw::c_int);
| bitand | identifier_name |
prompt.rs |
use std::env::{current_dir, home_dir};
use std::env;
use ansi_term::Colour::Purple;
use ansi_term::Colour::Green;
use ansi_term::Colour::Red;
pub struct Prompt {
user: String,
cwd: String,
error: i8,
}
impl Prompt {
pub fn new() -> Prompt {
let mut prompt = Prompt {
user: match env... |
pub fn update_error(&mut self, error: i8) {
self.error = error;
}
}
#[cfg(test)]
mod tests{
#[allow(unused_imports)]
use std::env::{current_dir,home_dir};
use super::*;
#[test]
fn updated_cwd() {
let mut testp = Prompt::new();
testp.update_cwd();
assert... | {
let mut cwd = current_dir().unwrap().as_path().to_str().expect("Failed : path -> str").to_string();
let homedir = home_dir().unwrap().as_path().to_str().expect("Failed : path -> str").to_string();
self.cwd = if cwd.starts_with(homedir.as_str()) {
Green.paint(format!("~{}", cwd.spl... | identifier_body |
prompt.rs |
use std::env::{current_dir, home_dir};
use std::env;
use ansi_term::Colour::Purple;
use ansi_term::Colour::Green;
use ansi_term::Colour::Red;
pub struct Prompt {
user: String,
cwd: String,
error: i8,
}
impl Prompt {
pub fn new() -> Prompt {
let mut prompt = Prompt {
user: match env... | else {
format!("{}:{} > ", self.user, self.cwd)
}
}
pub fn update_cwd(&mut self) {
let mut cwd = current_dir().unwrap().as_path().to_str().expect("Failed : path -> str").to_string();
let homedir = home_dir().unwrap().as_path().to_str().expect("Failed : path -> str").to_stri... | {
format!("{} {}:{} > ", Red.paint(format!("\u{2718} {}", self.error)).to_string(), self.user, self.cwd)
} | conditional_block |
prompt.rs |
use std::env::{current_dir, home_dir};
use std::env;
use ansi_term::Colour::Purple;
use ansi_term::Colour::Green;
use ansi_term::Colour::Red;
pub struct Prompt {
user: String,
cwd: String,
error: i8,
}
impl Prompt {
pub fn new() -> Prompt {
let mut prompt = Prompt {
user: match env... | (&mut self) {
let mut cwd = current_dir().unwrap().as_path().to_str().expect("Failed : path -> str").to_string();
let homedir = home_dir().unwrap().as_path().to_str().expect("Failed : path -> str").to_string();
self.cwd = if cwd.starts_with(homedir.as_str()) {
Green.paint(format!("~... | update_cwd | identifier_name |
prompt.rs | use std::env::{current_dir, home_dir};
use std::env;
use ansi_term::Colour::Purple;
use ansi_term::Colour::Green;
use ansi_term::Colour::Red;
pub struct Prompt {
user: String,
cwd: String,
error: i8,
}
impl Prompt {
pub fn new() -> Prompt {
let mut prompt = Prompt {
user: match env:... | #[cfg(test)]
mod tests{
#[allow(unused_imports)]
use std::env::{current_dir,home_dir};
use super::*;
#[test]
fn updated_cwd() {
let mut testp = Prompt::new();
testp.update_cwd();
assert_eq!(testp.get_cwd(), current_dir().ok()
.expect("Couldn't get current ... | }
| random_line_split |
signalfd.rs | //! Interface for the `signalfd` syscall.
//!
//! # Signal discarding
//! When a signal can't be delivered to a process (or thread), it will become a pending signal.
//! Failure to deliver could happen if the signal is blocked by every thread in the process or if
//! the signal handler is still handling a previous sign... | (mask: &SigSet, flags: SfdFlags) -> Result<SignalFd> {
let fd = try!(signalfd(SIGNALFD_NEW, mask, flags));
Ok(SignalFd(fd))
}
pub fn set_mask(&mut self, mask: &SigSet) -> Result<()> {
signalfd(self.0, mask, SfdFlags::empty()).map(|_| ())
}
pub fn read_signal(&mut self) -> Resu... | with_flags | identifier_name |
signalfd.rs | //! Interface for the `signalfd` syscall.
//!
//! # Signal discarding
//! When a signal can't be delivered to a process (or thread), it will become a pending signal.
//! Failure to deliver could happen if the signal is blocked by every thread in the process or if
//! the signal handler is still handling a previous sign... |
#[test]
fn create_signalfd_with_opts() {
let mask = SigSet::empty();
let fd = SignalFd::with_flags(&mask, SfdFlags::SFD_CLOEXEC | SfdFlags::SFD_NONBLOCK);
assert!(fd.is_ok());
}
#[test]
fn read_empty_signalfd() {
let mask = SigSet::empty();
let mut fd = Sig... | {
let mask = SigSet::empty();
let fd = SignalFd::new(&mask);
assert!(fd.is_ok());
} | identifier_body |
signalfd.rs | //! Interface for the `signalfd` syscall.
//!
//! # Signal discarding
//! When a signal can't be delivered to a process (or thread), it will become a pending signal.
//! Failure to deliver could happen if the signal is blocked by every thread in the process or if
//! the signal handler is still handling a previous sign... |
#[test]
fn check_siginfo_size() {
assert_eq!(mem::size_of::<libc::signalfd_siginfo>(), SIGNALFD_SIGINFO_SIZE);
}
#[test]
fn create_signalfd() {
let mask = SigSet::empty();
let fd = SignalFd::new(&mask);
assert!(fd.is_ok());
}
#[test]
fn create_signalfd... | use super::*;
use std::mem;
use libc; | random_line_split |
texture.rs | }
pub struct Solid {
pub m: Box<dyn MaterialModel + Sync + Send>
}
impl Medium for Solid {
fn material_at(&self, _pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send> {
&self.m
}
}
pub struct CheckeredYPlane {
pub m1: Box<dyn MaterialModel + Sync + Send>,
pub m2: Box<dyn MaterialMod... | use na::{Vector3};
use material::model::MaterialModel;
pub trait Medium : Sync{
fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>; | random_line_split | |
texture.rs | use na::{Vector3};
use material::model::MaterialModel;
pub trait Medium : Sync{
fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>;
}
pub struct Solid {
pub m: Box<dyn MaterialModel + Sync + Send>
}
impl Medium for Solid {
fn material_at(&self, _pt: Vector3<f64>) -> &Box<dy... |
}
| {
let zig = if (pt[0].abs() / self.xsize) as i32 % 2 == 0 { pt[0] > 0. } else { pt[0] <= 0. };
let zag = if (pt[2].abs() / self.zsize) as i32 % 2 == 0 { pt[2] > 0. } else { pt[2] <= 0. };
// zig XOR zag
return if !zig != !zag { &self.m1 } else { &self.m2 };
} | identifier_body |
texture.rs | use na::{Vector3};
use material::model::MaterialModel;
pub trait Medium : Sync{
fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>;
}
pub struct Solid {
pub m: Box<dyn MaterialModel + Sync + Send>
}
impl Medium for Solid {
fn material_at(&self, _pt: Vector3<f64>) -> &Box<dy... | else { pt[2] <= 0. };
// zig XOR zag
return if!zig!=!zag { &self.m1 } else { &self.m2 };
}
}
| { pt[2] > 0. } | conditional_block |
texture.rs | use na::{Vector3};
use material::model::MaterialModel;
pub trait Medium : Sync{
fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send>;
}
pub struct Solid {
pub m: Box<dyn MaterialModel + Sync + Send>
}
impl Medium for Solid {
fn material_at(&self, _pt: Vector3<f64>) -> &Box<dy... | (m1: Box<dyn MaterialModel + Sync + Send>, m2: Box<dyn MaterialModel + Sync + Send>, xsize: f64, zsize: f64) -> CheckeredYPlane {
CheckeredYPlane { m1, m2, xsize, zsize}
}
}
impl Medium for CheckeredYPlane {
fn material_at(&self, pt: Vector3<f64>) -> &Box<dyn MaterialModel + Sync + Send> {
let ... | new | identifier_name |
chain.rs | // Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level
// directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// optio... | ,
Nil => return res,
}
}
}
/// Returns a pointer to the first element in the chain.
pub fn first(& self) -> Option<(& Val, & Term)> {
use self::Chain::* ;
match * self {
Cons(ref val, ref term, _, _) => Some( (val, term) ),
Nil => None,
}
}
/** Checks if a chain is em... | {
res = Some( (val, term) ) ;
chain = & ** tail
} | conditional_block |
chain.rs | // Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level
// directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// optio... | <
T, F: Fn(T, & Val, & Term, & Info) -> T
>(& self, init: T, f: F) -> T {
use self::Chain::* ;
let mut chain = self ;
let mut val = init ;
while let Cons(ref v, ref trm, ref inf, ref tail) = * chain {
val = f(val, v, trm, inf) ;
chain = & * tail
}
val
}
/** Returns the lon... | fold | identifier_name |
chain.rs | // Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level
// directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// optio... | }
/** Reverses a chain. */
#[inline]
pub fn rev(self) -> Self {
self.rev_append(Chain::Nil)
}
}
impl<Val: Domain> Chain<Val, TermSet> {
/** Maps to `Chain<Val, ()>`, calling a function on each element. */
pub fn map_to_unit<
Input, F: Fn(& mut Input, Val, Term, TermSet)
>(mut self, f: F, i: & mu... | self = * tail
}
that | random_line_split |
chain.rs | // Copyright 2015 Adrien Champion. See the COPYRIGHT file at the top-level
// directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// optio... |
/// Returns a pointer to the first element in the chain.
pub fn first(& self) -> Option<(& Val, & Term)> {
use self::Chain::* ;
match * self {
Cons(ref val, ref term, _, _) => Some( (val, term) ),
Nil => None,
}
}
/** Checks if a chain is empty. */
#[inline]
pub fn is_empty(& self) ... | {
use self::Chain::* ;
let mut chain = self ;
let mut res = None ;
loop {
match * chain {
Cons(ref val, ref term, _, ref tail) => {
res = Some( (val, term) ) ;
chain = & ** tail
},
Nil => return res,
}
}
} | identifier_body |
issue-14456.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 ... |
test();
let (tx, rx) = channel();
native::task::spawn(proc() {
tx.send(test());
});
rx.recv();
}
fn child() {
io::stdout().write_line("foo").unwrap();
io::stderr().write_line("bar").unwrap();
assert_eq!(io::stdin().read_line().err().unwrap().kind, io::EndOfFile);
}
fn test(... | {
return child()
} | conditional_block |
issue-14456.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | let mut p = Command::new(args.get(0).as_slice()).arg("child")
.stdin(process::Ignored)
.stdout(process::Ignored)
.stderr(process::Ignored)
.spawn().unwrap();
assert!(p.... |
fn test() {
let args = os::args(); | random_line_split |
issue-14456.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 args = os::args();
let mut p = Command::new(args.get(0).as_slice()).arg("child")
.stdin(process::Ignored)
.stdout(process::Ignored)
.stderr(process::Ignored)
.... | test | identifier_name |
issue-14456.rs | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
fn child() {
io::stdout().write_line("foo").unwrap();
io::stderr().write_line("bar").unwrap();
assert_eq!(io::stdin().read_line().err().unwrap().kind, io::EndOfFile);
}
fn test() {
let args = os::args();
let mut p = Command::new(args.get(0).as_slice()).arg("child")
... | {
let args = os::args();
if args.len() > 1 && args.get(1).as_slice() == "child" {
return child()
}
test();
let (tx, rx) = channel();
native::task::spawn(proc() {
tx.send(test());
});
rx.recv();
} | identifier_body |
const-float-classify.rs | // compile-flags: -Zmir-opt-level=0
// run-pass
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
#![feature(const_trait_impl)]
// Don't promote
const fn nop<T>(x: T) -> T { x }
macro_rules! const_assert {
($a:expr, $b:expr) => {
{
const _: () = assert!($a == $b);
... | suite_inner!(f32 $($tt)*);
}
fn f64() {
suite_inner!(f64 $($tt)*);
}
}
}
macro_rules! suite_inner {
(
$ty:ident [$( $fn:ident ),*]
$val:expr => [$($out:ident),*]
$( $tail:tt )*
) => {
$( const_assert!($ty::$fn($val), $out); ... | ( $( $tt:tt )* ) => {
fn f32() { | random_line_split |
const-float-classify.rs | // compile-flags: -Zmir-opt-level=0
// run-pass
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
#![feature(const_trait_impl)]
// Don't promote
const fn nop<T>(x: T) -> T { x }
macro_rules! const_assert {
($a:expr, $b:expr) => {
{
const _: () = assert!($a == $b);
... |
}
// The result of the `is_sign` methods are not checked for correctness, since LLVM does not
// guarantee anything about the signedness of NaNs. See
// https://github.com/rust-lang/rust/issues/55131.
suite! {
[is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
-0.... | {
false
} | identifier_body |
const-float-classify.rs | // compile-flags: -Zmir-opt-level=0
// run-pass
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
#![feature(const_trait_impl)]
// Don't promote
const fn nop<T>(x: T) -> T { x }
macro_rules! const_assert {
($a:expr, $b:expr) => {
{
const _: () = assert!($a == $b);
... | ;
impl const PartialEq<NonDet> for bool {
fn eq(&self, _: &NonDet) -> bool {
true
}
fn ne(&self, _: &NonDet) -> bool {
false
}
}
// The result of the `is_sign` methods are not checked for correctness, since LLVM does not
// guarantee anything about the signedness of NaNs. See
// https:... | NonDet | identifier_name |
switch.rs | use core::cell::Cell;
use core::ops::Bound;
use core::sync::atomic::Ordering;
use alloc::sync::Arc;
use spin::RwLock;
use crate::context::signal::signal_handler;
use crate::context::{arch, contexts, Context, Status, CONTEXT_ID};
#[cfg(target_arch = "x86_64")]
use crate::gdt;
use crate::interrupt::irq::PIT_TICKS;
use... |
arch::CONTEXT_SWITCH_LOCK.store(false, Ordering::SeqCst);
}
#[thread_local]
static SWITCH_RESULT: Cell<Option<SwitchResult>> = Cell::new(None);
unsafe fn runnable(context: &Context, cpu_id: usize) -> bool {
// Switch to context if it needs to run, is not currently running, and is owned by the current CPU
... | {
// TODO: unreachable_unchecked()?
core::intrinsics::abort();
} | conditional_block |
switch.rs | use core::cell::Cell;
use core::ops::Bound;
use core::sync::atomic::Ordering;
use alloc::sync::Arc;
use spin::RwLock;
use crate::context::signal::signal_handler;
use crate::context::{arch, contexts, Context, Status, CONTEXT_ID};
#[cfg(target_arch = "x86_64")]
use crate::gdt;
use crate::interrupt::irq::PIT_TICKS;
use... | .current()
.expect("context::switch: not inside of context"));
from_context_guard = from_context_lock.write();
from_context_guard.ticks += ticks as u64 + 1; // Always round ticks up
}
for (pid, context_lock) in contexts.iter() {
let mut ... | {
// TODO: Better memory orderings?
//set PIT Interrupt counter to 0, giving each process same amount of PIT ticks
let ticks = PIT_TICKS.swap(0, Ordering::SeqCst);
// Set the global lock to avoid the unsafe operations below from causing issues
while arch::CONTEXT_SWITCH_LOCK.compare_exchange_weak(f... | identifier_body |
switch.rs | use core::cell::Cell;
use core::ops::Bound;
use core::sync::atomic::Ordering;
use alloc::sync::Arc;
use spin::RwLock;
use crate::context::signal::signal_handler;
use crate::context::{arch, contexts, Context, Status, CONTEXT_ID};
#[cfg(target_arch = "x86_64")]
use crate::gdt;
use crate::interrupt::irq::PIT_TICKS;
use... | () -> bool {
// TODO: Better memory orderings?
//set PIT Interrupt counter to 0, giving each process same amount of PIT ticks
let ticks = PIT_TICKS.swap(0, Ordering::SeqCst);
// Set the global lock to avoid the unsafe operations below from causing issues
while arch::CONTEXT_SWITCH_LOCK.compare_exch... | switch | identifier_name |
switch.rs | use core::cell::Cell;
use core::ops::Bound;
use core::sync::atomic::Ordering;
use alloc::sync::Arc;
use spin::RwLock;
use crate::context::signal::signal_handler;
use crate::context::{arch, contexts, Context, Status, CONTEXT_ID};
#[cfg(target_arch = "x86_64")]
use crate::gdt;
use crate::interrupt::irq::PIT_TICKS;
use... | } | random_line_split | |
main.rs | use std::ops::{Add, Sub, Mul, Div};
fn do_operation<F, V>(f: F, v1: V, v2: V) -> V
where
F: Fn(V, V) -> V,
V: Add + Sub + Mul + Div {
f(v1, v2)
}
pub fn rpn(raw: &str) -> f64 {
let mut stack = Vec::new();
for c in raw.split(' ') {
if let Some(i) = c.parse::<f64>().ok() {
... |
#[test]
fn long_equation() {
let mut eq = "2 ".to_string();
for _ in 0..2000000 {
eq.push_str("2 + ");
}
eq.push_str("1 +");
assert_eq!(4000003.0, rpn(&eq));
}
} | {
rpn("54 4 6 O + \\ /");
} | identifier_body |
main.rs | use std::ops::{Add, Sub, Mul, Div};
fn do_operation<F, V>(f: F, v1: V, v2: V) -> V
where
F: Fn(V, V) -> V,
V: Add + Sub + Mul + Div {
f(v1, v2)
}
pub fn rpn(raw: &str) -> f64 {
let mut stack = Vec::new();
for c in raw.split(' ') {
if let Some(i) = c.parse::<f64>().ok() {
... | () {
assert_eq!(-2503.0, rpn("2 0 /"));
}
#[test]
#[should_panic]
fn invalid_input_1() {
rpn("");
}
#[test]
#[should_panic]
fn invalid_input_2() {
rpn("14 4 6 8 +. /");
}
#[test]
#[should_panic]
fn invalid_input_3() {
rpn("POTATO");
... | divide_by_zero | identifier_name |
main.rs | use std::ops::{Add, Sub, Mul, Div};
fn do_operation<F, V>(f: F, v1: V, v2: V) -> V
where
F: Fn(V, V) -> V,
V: Add + Sub + Mul + Div {
f(v1, v2)
}
pub fn rpn(raw: &str) -> f64 {
let mut stack = Vec::new();
for c in raw.split(' ') {
if let Some(i) = c.parse::<f64>().ok() {
... | if r == 0.0
{
panic!("Division by zero not allowed");
}
do_operation(|l, r| l / r, l, r)
},
_ => panic!("Unknown character {:?}", c),
};
stack.push(result);
}
if stack.len()!= 1
{
... | "+" => do_operation(|l, r| l + r, l, r),
"-" => do_operation(|l, r| l - r, l, r),
"*" => do_operation(|l, r| l * r, l, r),
"/" =>
{ | random_line_split |
eth.rs | // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any lat... | Ok(Work {
pow_hash: pow_hash.into(),
seed_hash: seed_hash.into(),
target: target.into(),
number: Some(block_number),
})
} else {
Ok(Work {
pow_hash: pow_hash.into(),
seed_hash: seed_hash.into(),
target: target.into(),
number: None
})
}
}).unwrap_or(Err(err... |
if no_new_work_timeout > 0 && b.block().header().timestamp() + no_new_work_timeout < get_time().sec as u64 {
Err(errors::no_new_work())
} else if self.options.send_block_number_in_get_work {
let block_number = b.block().header().number(); | random_line_split |
eth.rs | // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any lat... |
fn call(&self, meta: Self::Metadata, request: CallRequest, num: Trailing<BlockNumber>) -> BoxFuture<Bytes> {
let request = CallRequest::into(request);
let signed = try_bf!(fake_sign::sign_call(request, meta.is_dapp()));
let num = num.unwrap_or_default();
let result = self.client.call(&signed, Default::defau... | {
self.send_raw_transaction(raw)
} | identifier_body |
eth.rs | // Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any lat... | (&self, hash: RpcH256, index: Index) -> BoxFuture<Option<Transaction>> {
Box::new(future::done(
self.transaction(TransactionId::Location(BlockId::Hash(hash.into()), index.value()))
))
}
fn transaction_by_block_number_and_index(&self, num: BlockNumber, index: Index) -> BoxFuture<Option<Transaction>> {
Box::n... | transaction_by_block_hash_and_index | identifier_name |
basic_lib.rs | #![ warn( missing_docs ) ]
#![ warn( missing_debug_implementations ) ]
#![ allow( dead_code ) ]
// #![no_std]
//!
//! Tools for writing and runnint tests.
//!
//! # Sample
//! ``` rust
//! use wtest_basic::*;
//!
//! //
//!
//! fn _pass1()
//! {
//! assert_eq!( true, true );
//! }
//!
//! //
//!
//! fn _pass2()
//! ... | // $( #[test] fn paste!([< $Name _test >])() { $Name() } )*
// }
}
// /// Pass only if callback fails either returning error or panicing.
//
// pub fn should_throw< R, F : FnOnce() -> anyhow::Result< R > >( f : F ) -> anyhow::Result< R >
// {
// f()
// }
//
// #[panic_handler]
// fn panic( info : &core::pani... | random_line_split | |
basic_shape.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/. */
//! CSS handling for the computed value of
//! [`basic-shape`][basic-shape]s
//!
//! [basic-shape]: https://drafts... |
dest.write_str("at ")?;
self.position.to_css(dest)?;
dest.write_str(")")
}
}
| {
self.semiaxis_x.to_css(dest)?;
dest.write_str(" ")?;
self.semiaxis_y.to_css(dest)?;
dest.write_str(" ")?;
} | conditional_block |
basic_shape.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/. */
//! CSS handling for the computed value of
//! [`basic-shape`][basic-shape]s
//!
//! [basic-shape]: https://drafts... |
}
| {
dest.write_str("ellipse(")?;
if (self.semiaxis_x, self.semiaxis_y) != Default::default() {
self.semiaxis_x.to_css(dest)?;
dest.write_str(" ")?;
self.semiaxis_y.to_css(dest)?;
dest.write_str(" ")?;
}
dest.write_str("at ")?;
self.po... | identifier_body |
basic_shape.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/. */
//! CSS handling for the computed value of
//! [`basic-shape`][basic-shape]s
//!
//! [basic-shape]: https://drafts... | pub type BasicShape = GenericBasicShape<LengthOrPercentage, LengthOrPercentage, LengthOrPercentage>;
/// The computed value of `inset()`
pub type InsetRect = GenericInsetRect<LengthOrPercentage>;
/// A computed circle.
pub type Circle = GenericCircle<LengthOrPercentage, LengthOrPercentage, LengthOrPercentage>;
/// A... | random_line_split | |
basic_shape.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/. */
//! CSS handling for the computed value of
//! [`basic-shape`][basic-shape]s
//!
//! [basic-shape]: https://drafts... | <W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
dest.write_str("circle(")?;
self.radius.to_css(dest)?;
dest.write_str(" at ")?;
self.position.to_css(dest)?;
dest.write_str(")")
}
}
impl ToCss for Ellipse {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result wh... | to_css | identifier_name |
selectors.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::{Parser, ParserInput, ToCss};
use selectors::parser::SelectorList;
use style::selector_parser::{Sel... | <'i, 't>(input: &mut Parser<'i, 't>) -> Result<SelectorList<SelectorImpl>, ParseError<'i>> {
let mut ns = Namespaces::default();
ns.prefixes.insert("svg".into(), (ns!(svg), ()));
let parser = SelectorParser {
stylesheet_origin: Origin::UserAgent,
namespaces: &ns,
};
SelectorList::par... | parse_selector | identifier_name |
selectors.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::{Parser, ParserInput, ToCss};
use selectors::parser::SelectorList;
use style::selector_parser::{Sel... |
#[test]
fn test_selectors() {
assert_roundtrip!(parse_selector, "div");
assert_roundtrip!(parse_selector, "svg|circle");
assert_roundtrip!(parse_selector, "p:before", "p::before");
assert_roundtrip!(parse_selector, "[border=\"0\"]:-servo-nonzero-border ~ ::-servo-details-summary");
}
| {
let mut ns = Namespaces::default();
ns.prefixes.insert("svg".into(), (ns!(svg), ()));
let parser = SelectorParser {
stylesheet_origin: Origin::UserAgent,
namespaces: &ns,
};
SelectorList::parse(&parser, input)
} | identifier_body |
selectors.rs | /* This Source Code Form is subject to the terms of the Mozilla Public | * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::{Parser, ParserInput, ToCss};
use selectors::parser::SelectorList;
use style::selector_parser::{SelectorImpl, SelectorParser};
use style::stylesheets::{Origin, Namespaces... | random_line_split | |
stack.rs | // Copyright 2016 coroutine-rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accordi... |
return ret.map_err(StackError::IoError);
}
}
Err(StackError::ExceedsMaximumSize(max_stack_size - add))
}
}
unsafe impl Send for Stack {}
/// A very simple and straightforward implementation of `Stack`.
///
/// Allocates stack space using virtual memory, whose pages w... | {
if let Ok(stack) = ret {
ret = unsafe { sys::protect_stack(&stack) };
}
} | conditional_block |
stack.rs | // Copyright 2016 coroutine-rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accordi... |
}
/// Represents any kind of stack memory.
///
/// `FixedSizeStack` as well as `ProtectedFixedSizeStack`
/// can be used to allocate actual stack space.
#[derive(Debug)]
pub struct Stack {
top: *mut c_void,
bottom: *mut c_void,
}
impl Stack {
/// Creates a (non-owning) representation of some stack memory... | {
match *self {
StackError::ExceedsMaximumSize(_) => None,
StackError::IoError(ref e) => Some(e),
}
} | identifier_body |
stack.rs | // Copyright 2016 coroutine-rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accordi... | {
/// Contains the maximum amount of memory allowed to be allocated as stack space.
ExceedsMaximumSize(usize),
/// Returned if some kind of I/O error happens during allocation.
IoError(io::Error),
}
impl Display for StackError {
fn fmt(&self, fmt: &mut Formatter) -> FmtResult {
match *sel... | StackError | identifier_name |
stack.rs | // Copyright 2016 coroutine-rs Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accordi... | assert_eq!(stack.len(), sys::min_stack_size());
unsafe { write_bytes(stack.bottom() as *mut u8, 0x1d, stack.len()) };
}
#[test]
fn stack_size_too_large() {
let stack_size = sys::max_stack_size() &!(sys::page_size() - 1);
match FixedSizeStack::new(stack_size) {
... | unsafe { write_bytes(stack.bottom() as *mut u8, 0x1d, stack.len()) };
let stack = ProtectedFixedSizeStack::new(0).unwrap(); | random_line_split |
build.rs | //! This tiny build script ensures that rocket_codegen is not compiled with an
//! incompatible version of rust.
extern crate yansi;
extern crate version_check;
use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version ... | () {
let ok_channel = supports_features();
let ok_version = is_min_version(MIN_VERSION);
let ok_date = is_min_date(MIN_DATE);
let print_version_err = |version: &str, date: &str| {
eprintln!("{} {}. {} {}.",
White.paint("Installed version is:"),
Yellow.paint(f... | main | identifier_name |
build.rs | //! This tiny build script ensures that rocket_codegen is not compiled with an
//! incompatible version of rust.
extern crate yansi;
extern crate version_check;
use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version ... | if!ok_channel {
eprintln!("{} {}",
Red.paint("Error:").bold(),
White.paint("Rocket requires a nightly or dev version of Rust."));
print_version_err(&*version, &*date);
eprintln!("{}{}{}",
... | Yellow.paint(format!("{} ({})", MIN_VERSION, MIN_DATE)));
};
match (ok_channel, ok_version, ok_date) {
(Some(ok_channel), Some((ok_version, version)), Some((ok_date, date))) => { | random_line_split |
build.rs | //! This tiny build script ensures that rocket_codegen is not compiled with an
//! incompatible version of rust.
extern crate yansi;
extern crate version_check;
use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version ... |
},
_ => {
println!("cargo:warning={}", "Rocket was unable to check rustc compatibility.");
println!("cargo:warning={}", "Build may fail due to incompatible rustc version.");
}
}
}
| {
eprintln!("{} {}",
Red.paint("Error:").bold(),
White.paint("Rocket codegen requires a more recent version of rustc."));
eprintln!("{}{}{}",
Blue.paint("Use `"),
White.paint("rustup u... | conditional_block |
build.rs | //! This tiny build script ensures that rocket_codegen is not compiled with an
//! incompatible version of rust.
extern crate yansi;
extern crate version_check;
use yansi::Color::{Red, Yellow, Blue, White};
use version_check::{supports_features, is_min_version, is_min_date};
// Specifies the minimum nightly version ... | eprintln!("{}{}{}",
Blue.paint("See the getting started guide ("),
White.paint("https://rocket.rs/guide/getting-started/"),
Blue.paint(") for more information."));
panic!("Aborting compilation due to incompatib... | {
let ok_channel = supports_features();
let ok_version = is_min_version(MIN_VERSION);
let ok_date = is_min_date(MIN_DATE);
let print_version_err = |version: &str, date: &str| {
eprintln!("{} {}. {} {}.",
White.paint("Installed version is:"),
Yellow.paint(form... | identifier_body |
app_chooser.rs | // This file is part of rgtk.
//
// rgtk is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// rgtk is distributed in the hop... | } else {
Some(gtk::FFIWidget::wrap_widget(tmp_pointer as *mut ffi::C_GtkWidget))
}
}
fn get_content_info(&self) -> Option<String> {
unsafe {
FromGlibPtr::borrow(
ffi::gtk_app_chooser_get_content_type(GTK_APP_CHOOSER(self.unwrap_widget())))
... |
if tmp_pointer.is_null() {
None | random_line_split |
app_chooser.rs | // This file is part of rgtk.
//
// rgtk is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// rgtk is distributed in the hop... |
fn get_content_info(&self) -> Option<String> {
unsafe {
FromGlibPtr::borrow(
ffi::gtk_app_chooser_get_content_type(GTK_APP_CHOOSER(self.unwrap_widget())))
}
}
fn refresh(&self) -> () {
unsafe { ffi::gtk_app_chooser_refresh(GTK_APP_CHOOSER(self.unwrap_wi... | {
let tmp_pointer = unsafe { ffi::gtk_app_chooser_get_app_info(GTK_APP_CHOOSER(self.unwrap_widget())) };
if tmp_pointer.is_null() {
None
} else {
Some(gtk::FFIWidget::wrap_widget(tmp_pointer as *mut ffi::C_GtkWidget))
}
} | identifier_body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.