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
failure.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 ...
{ #[allow(ctypes)] extern { #[lang = "begin_unwind"] fn begin_unwind(fmt: &fmt::Arguments, file: &'static str, line: uint) -> !; } let (file, line) = *file_line; unsafe { begin_unwind(fmt, file, line) } }
identifier_body
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
match self.states[t.pc] { Range(lo, hi) => if lo <= c && c <= hi { if follow(t.with_pc(1 + t.pc), self.index, self.states, &mut self.next) { self.matched = true; // Cut off lower priority threads brea...
self.index.mutate_or_set(0, |i| 1 + i); self.matched = false; // Run through all the threads for t in self.threads.iter() {
random_line_split
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
}, Jump(..) | Save(..) => unreachable!() } } // Swap the thread buffers swap(&mut self.threads, &mut self.next); self.next.clear(); } /// Determine if we have a match, given the existing input. pub fn is_match(&self) -> bool { ...
{ self.matched = true; // Cut off lower priority threads break }
conditional_block
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
/// Add a thread to the list, if one with the same `pc` is not /// already present. fn add(&mut self, t: Thread) { if self.indices.insert(t.pc) { self.threads.push(t); } } /// Iterate over the list of threads. fn iter<'a>(&'a self) -> std::vec::Items<'a, Thread> { ...
{ self.threads.clear(); self.indices.clear(); }
identifier_body
vm.rs
//! Regular expression virtual machine. use std; use std::mem::swap; use collections::TrieSet; /// A single instruction in the program. pub enum Inst { /// Jump to all locations in the list simultaneously. This /// corresponds to `jmp` and `split` in the original paper. Jump(~[uint]), /// Match any...
(t: Thread, index: Option<u64>, states: &[Inst], threads: &mut ThreadList) -> bool { if t.pc == states.len() { true } else { match states[t.pc] { Jump(ref exits) => { let mut matched = false; for &exit in exits.iter() { matched |= f...
follow
identifier_name
user32.rs
// Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> #![feature(test)] #![cfg(windows)] extern crate user32; extern crate test; use user32::*; use test::black_box as bb; #[cfg(target_arch = "x86_64")] #[test] fn functions_x64() { bb(GetClassLongPtrA); bb(GetClassLongPtrW); bb(G...
bb(ClipCursor); bb(CloseClipboard); bb(CloseDesktop); bb(CloseWindow); bb(CloseWindowStation); bb(CountClipboardFormats); bb(CreateCaret); bb(CreateCursor); bb(CreateWindowExW); bb(DefWindowProcW); bb(DeferWindowPos); bb(DeleteMenu); bb(DeregisterShellHookWindow); ...
bb(ActivateKeyboardLayout); // bb(AddClipboardFormatListener); bb(AdjustWindowRect); bb(AdjustWindowRectEx); bb(AllowSetForegroundWindow); bb(AnimateWindow); bb(AnyPopup); bb(ArrangeIconicWindows); bb(AttachThreadInput); bb(BeginPaint); bb(BlockInput); bb(BringWindowToTo...
identifier_body
user32.rs
// Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> #![feature(test)] #![cfg(windows)] extern crate user32; extern crate test; use user32::*; use test::black_box as bb; #[cfg(target_arch = "x86_64")] #[test] fn functions_x64() { bb(GetClassLongPtrA); bb(GetClassLongPtrW); bb(G...
bb(SetWindowLongPtrA); bb(SetWindowLongPtrW); } #[test] fn functions() { bb(ActivateKeyboardLayout); // bb(AddClipboardFormatListener); bb(AdjustWindowRect); bb(AdjustWindowRectEx); bb(AllowSetForegroundWindow); bb(AnimateWindow); bb(AnyPopup); bb(ArrangeIconicWindows); bb(At...
bb(SetClassLongPtrA); bb(SetClassLongPtrW);
random_line_split
user32.rs
// Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> #![feature(test)] #![cfg(windows)] extern crate user32; extern crate test; use user32::*; use test::black_box as bb; #[cfg(target_arch = "x86_64")] #[test] fn functions_x64() { bb(GetClassLongPtrA); bb(GetClassLongPtrW); bb(G...
) { bb(ActivateKeyboardLayout); // bb(AddClipboardFormatListener); bb(AdjustWindowRect); bb(AdjustWindowRectEx); bb(AllowSetForegroundWindow); bb(AnimateWindow); bb(AnyPopup); bb(ArrangeIconicWindows); bb(AttachThreadInput); bb(BeginPaint); bb(BlockInput); bb(BringWindowT...
unctions(
identifier_name
test.rs
// Licensed under the Apache License, Version 2.0 (the "License"); you may // not use this file except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed unde...
() { let mut reg = Register::new("/home/flaper87/workspace/personal/rust-drops/build"); reg.load("drops_console"); reg.call("info", Some(json::Decoder::new(json::from_str("\"My String\"").unwrap()))); reg.call("info", None); }
test_register_console
identifier_name
test.rs
// Licensed under the Apache License, Version 2.0 (the "License"); you may // not use this file except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed unde...
{ let mut reg = Register::new("/home/flaper87/workspace/personal/rust-drops/build"); reg.load("drops_console"); reg.call("info", Some(json::Decoder::new(json::from_str("\"My String\"").unwrap()))); reg.call("info", None); }
identifier_body
test.rs
// Licensed under the Apache License, Version 2.0 (the "License"); you may // not use this file except in compliance with the License. You may obtain // a copy of the License at
// // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the Licen...
// // http://www.apache.org/licenses/LICENSE-2.0
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 https://mozilla.org/MPL/2.0/. */ #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate num_derive; #[mac...
/// https://w3c.github.io/mediasession/#enumdef-mediasessionplaybackstate #[repr(i32)] #[derive(Clone, Debug, Deserialize, Serialize)] pub enum MediaSessionPlaybackState { /// The browsing context does not specify whether it’s playing or paused. None_ = 1, /// The browsing context is currently playing media...
Self { title, artist: "".to_owned(), album: "".to_owned(), } } }
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 https://mozilla.org/MPL/2.0/. */ #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate num_derive; #[mac...
ContextMenu, Help, Progress, Wait, Cell, Crosshair, Text, VerticalText, Alias, Copy, Move, NoDrop, NotAllowed, Grab, Grabbing, EResize, NResize, NeResize, NwResize, SResize, SeResize, SwResize, WResize, EwResize, NsResiz...
Default, Pointer,
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 https://mozilla.org/MPL/2.0/. */ #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate num_derive; #[mac...
{ None, Default, Pointer, ContextMenu, Help, Progress, Wait, Cell, Crosshair, Text, VerticalText, Alias, Copy, Move, NoDrop, NotAllowed, Grab, Grabbing, EResize, NResize, NeResize, NwResize, SResize, SeResize, SwResize,...
Cursor
identifier_name
arrays.rs
// Copyright 2018 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under The General Public License (GPL), version 3. // Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed // under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI...
/// Array containing sign public key bytes. pub type SignPublicKey = [u8; SIGN_PUBLIC_KEY_LEN]; /// Array containing sign private key bytes. pub type SignSecretKey = [u8; SIGN_SECRET_KEY_LEN]; /// Array containing `XorName` bytes. pub type XorNameArray = [u8; XOR_NAME_LEN];
/// Array containing BLS public key. pub type BlsPublicKey = [u8; BLS_PUBLIC_KEY_LEN];
random_line_split
instr_kandw.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn kandw_1() { run_test(&Instruction { mnemonic: Mnemonic::KANDW, operand1: Some(Direct(K1))...
() { run_test(&Instruction { mnemonic: Mnemonic::KANDW, operand1: Some(Direct(K7)), operand2: Some(Direct(K2)), operand3: Some(Direct(K7)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[197, 236, 65, 255], OperandSize::Qword) }
kandw_2
identifier_name
instr_kandw.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn kandw_1() { run_test(&Instruction { mnemonic: Mnemonic::KANDW, operand1: Some(Direct(K1))...
{ run_test(&Instruction { mnemonic: Mnemonic::KANDW, operand1: Some(Direct(K7)), operand2: Some(Direct(K2)), operand3: Some(Direct(K7)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[197, 236, 65, 255], OperandSize::Qword) }
identifier_body
instr_kandw.rs
use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; #[test] fn kandw_1() { run_test(&Instruction { mnemonic: Mnemonic::KANDW, operand1: Some(Direct(K1))...
}
random_line_split
context.rs
::<usize>().expect("Couldn't parse environmental variable as usize") }) } impl Default for StyleSystemOptions { #[cfg(feature = "servo")] fn default() -> Self { use servo_config::opts; StyleSystemOptions { disable_style_sharing_cache: opts::get().disable_share_style_cache, ...
impl<E> ops::Deref for SequentialTaskList<E> where E: TElement, { type Target = Vec<SequentialTask<E>>; fn deref(&self) -> &Self::Target { &self.0 } } impl<E> ops::DerefMut for SequentialTaskList<E> where E: TElement, { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0...
random_line_split
context.rs
usize>().expect("Couldn't parse environmental variable as usize") }) } impl Default for StyleSystemOptions { #[cfg(feature = "servo")] fn default() -> Self { use servo_config::opts; StyleSystemOptions { disable_style_sharing_cache: opts::get().disable_share_style_cache, ...
#[cfg(feature = "gecko")] PostAnimation { el, tasks } => { unsafe { el.process_post_animation(tasks) }; } } } /// Creates a task to update various animation-related state on /// a given (pseudo-)element. #[cfg(feature = "gecko")] pub fn u...
{ unsafe { el.update_animations(before_change_style, tasks) }; }
conditional_block
context.rs
usize>().expect("Couldn't parse environmental variable as usize") }) } impl Default for StyleSystemOptions { #[cfg(feature = "servo")] fn default() -> Self { use servo_config::opts; StyleSystemOptions { disable_style_sharing_cache: opts::get().disable_share_style_cache, ...
(&self) -> Self { if self.0.is_none() { return EagerPseudoCascadeInputs(None) } let self_inputs = self.0.as_ref().unwrap(); let mut inputs: [Option<CascadeInputs>; EAGER_PSEUDO_COUNT] = Default::default(); for i in 0..EAGER_PSEUDO_COUNT { inputs[i] = self_...
clone
identifier_name
context.rs
usize>().expect("Couldn't parse environmental variable as usize") }) } impl Default for StyleSystemOptions { #[cfg(feature = "servo")] fn default() -> Self { use servo_config::opts; StyleSystemOptions { disable_style_sharing_cache: opts::get().disable_share_style_cache, ...
/// Inserts some flags into the map for a given element. pub fn insert_flags(&mut self, element: E, flags: ElementSelectorFlags) { let el = unsafe { SendElement::new(element) }; // Check the cache. If the flags have already been noted, we're done. if self.cache.iter().find(|&(_, ref x)...
{ SelectorFlagsMap { map: FnvHashMap::default(), cache: LRUCache::default(), } }
identifier_body
db-restore.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use backup_cli::{ backup_types::{ epoch_ending::restore::{EpochEndingRestoreController, EpochEndingRestoreOpt}, state_snapshot::restore::{StateSnapshotRestoreController, StateSnapshotRestoreOpt}, ...
EpochEnding { #[structopt(flatten)] opt: EpochEndingRestoreOpt, #[structopt(subcommand)] storage: StorageOpt, }, StateSnapshot { #[structopt(flatten)] opt: StateSnapshotRestoreOpt, #[structopt(subcommand)] storage: StorageOpt, }, Transa...
random_line_split
db-restore.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use backup_cli::{ backup_types::{ epoch_ending::restore::{EpochEndingRestoreController, EpochEndingRestoreOpt}, state_snapshot::restore::{StateSnapshotRestoreController, StateSnapshotRestoreOpt}, ...
() -> Result<()> { main_impl().await.map_err(|e| { error!("main_impl() failed: {}", e); e }) } async fn main_impl() -> Result<()> { Logger::new().level(Level::Info).read_env().init(); let _mp = MetricsPusher::start(); let opt = Opt::from_args(); let global_opt: GlobalRestoreOpt...
main
identifier_name
db-restore.rs
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; use backup_cli::{ backup_types::{ epoch_ending::restore::{EpochEndingRestoreController, EpochEndingRestoreOpt}, state_snapshot::restore::{StateSnapshotRestoreController, StateSnapshotRestoreOpt}, ...
async fn main_impl() -> Result<()> { Logger::new().level(Level::Info).read_env().init(); let _mp = MetricsPusher::start(); let opt = Opt::from_args(); let global_opt: GlobalRestoreOptions = opt.global.clone().try_into()?; match opt.restore_type { RestoreType::EpochEnding { opt, storage }...
{ main_impl().await.map_err(|e| { error!("main_impl() failed: {}", e); e }) }
identifier_body
main.rs
#![warn(rust_2018_idioms)] // while we're getting used to 2018 #![cfg_attr(feature = "deny-warnings", deny(warnings))] #![allow(clippy::blacklisted_name)] #![allow(clippy::explicit_iter_loop)] #![allow(clippy::redundant_closure)] #![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂 #![allo...
mod shell_quoting; mod standard_lib; mod test; mod timings; mod tool_paths; mod tree; mod tree_graph_features; mod unit_graph; mod update; mod vendor; mod verify_project; mod version; mod warn_on_failure; mod weak_dep_features; mod workspaces; mod yank; #[cargo_test] fn aaa_trigger_cross_compile_disabled_check() { ...
mod rustdocflags; mod rustflags; mod search;
random_line_split
main.rs
#![warn(rust_2018_idioms)] // while we're getting used to 2018 #![cfg_attr(feature = "deny-warnings", deny(warnings))] #![allow(clippy::blacklisted_name)] #![allow(clippy::explicit_iter_loop)] #![allow(clippy::redundant_closure)] #![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂 #![allo...
// This triggers the cross compile disabled check to run ASAP, see #5141 cargo_test_support::cross_compile::disabled(); }
identifier_body
main.rs
#![warn(rust_2018_idioms)] // while we're getting used to 2018 #![cfg_attr(feature = "deny-warnings", deny(warnings))] #![allow(clippy::blacklisted_name)] #![allow(clippy::explicit_iter_loop)] #![allow(clippy::redundant_closure)] #![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂 #![allo...
{ // This triggers the cross compile disabled check to run ASAP, see #5141 cargo_test_support::cross_compile::disabled(); }
_trigger_cross_compile_disabled_check()
identifier_name
unboxed-closure-sugar-region.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
// except according to those terms. // Test interaction between unboxed closure sugar and region // parameters (should be exactly as if angle brackets were used // and regions omitted). #![feature(unboxed_closures)] #![allow(dead_code)] use std::marker; trait Foo<'a,T> { type Output; fn dummy(&'a self) -> &...
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed
random_line_split
unboxed-closure-sugar-region.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 test<'a,'b>() { // Parens are equivalent to omitting default in angle. eq::< Foo<(isize,),Output=()>, Foo(isize) >(); // Here we specify'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. eq::< Foo<'static, (isize,),Output...
{ }
identifier_body
unboxed-closure-sugar-region.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 ...
(&self, x: &X) -> bool { true } } impl<X:?Sized> Eq<X> for X { } fn eq<A:?Sized,B:?Sized +Eq<A>>() { } fn same_type<A,B:Eq<A>>(a: A, b: B) { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. eq::< Foo<(isize,),Output=()>, Foo(isize) >(); // Her...
is_of_eq_type
identifier_name
recursion.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let n = test(1, 0, Nil, Nil); println!("{}", n); }
main
identifier_name
recursion.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 ...
}
pub fn main() { let n = test(1, 0, Nil, Nil); println!("{}", n);
random_line_split
recursion.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 test<T:Dot> (n:int, i:int, first:T, second:T) ->int { match n { 0 => {first.dot(second)} // Error message should be here. It should be a type error // to instantiate `test` at a type other than T. (See #4287) _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})} ...
{ self.head * other.head + self.tail.dot(other.tail) }
identifier_body
get_global_account_data.rs
//! `GET /_matrix/client/*/user/{userId}/account_data/{type}` pub mod v3 { //! `/v3/` ([spec]) //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3useruseridaccount_datatype use ruma_common::{api::ruma_api, events::AnyGlobalAccountDataEventContent, UserId}; use ruma_s...
}
random_line_split
get_global_account_data.rs
//! `GET /_matrix/client/*/user/{userId}/account_data/{type}` pub mod v3 { //! `/v3/` ([spec]) //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3useruseridaccount_datatype use ruma_common::{api::ruma_api, events::AnyGlobalAccountDataEventContent, UserId}; use ruma_s...
} impl Response { /// Creates a new `Response` with the given account data. pub fn new(account_data: Raw<AnyGlobalAccountDataEventContent>) -> Self { Self { account_data } } } }
{ Self { user_id, event_type } }
identifier_body
get_global_account_data.rs
//! `GET /_matrix/client/*/user/{userId}/account_data/{type}` pub mod v3 { //! `/v3/` ([spec]) //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3useruseridaccount_datatype use ruma_common::{api::ruma_api, events::AnyGlobalAccountDataEventContent, UserId}; use ruma_s...
(account_data: Raw<AnyGlobalAccountDataEventContent>) -> Self { Self { account_data } } } }
new
identifier_name
bench.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::Quirks...
} } fn parse_rules(css: &str) -> Vec<(StyleSource, CascadeLevel)> { let lock = SharedRwLock::new(); let media = Arc::new(lock.wrap(MediaList::empty())); let s = Stylesheet::from_str( css, ServoUrl::parse("http://localhost").unwrap(), Origin::Author, media, lock,...
}
random_line_split
bench.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::Quirks...
#[bench] fn bench_insertion_basic(b: &mut Bencher) { let r = RuleTree::new(); thread_state::initialize(ThreadState::SCRIPT); let rules_matched = parse_rules( ".foo { width: 200px; } \ .bar { height: 500px; } \ .baz { display: block; }", ); b.iter(|| { let _gc = Au...
{ let mut rules = rules.to_vec(); rules.push(( StyleSource::from_declarations(Arc::new(shared_lock.wrap( PropertyDeclarationBlock::with_one( PropertyDeclaration::Display(longhands::display::SpecifiedValue::Block), Importance::Normal, ), )))...
identifier_body
bench.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; use rayon; use servo_arc::Arc; use servo_url::ServoUrl; use style::context::Quirks...
(b: &mut Bencher) { let r = RuleTree::new(); thread_state::initialize(ThreadState::SCRIPT); let rules_matched = parse_rules( ".foo { width: 200px; } \ .bar { height: 500px; } \ .baz { display: block; }", ); b.iter(|| { let _gc = AutoGCRuleTree::new(&r); for...
bench_insertion_basic
identifier_name
atomic_max_acqrel.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_max_acqrel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T; struct
<T> { v: UnsafeCell<T> } unsafe impl Sync for A<T> {} impl<T> A<T> { fn new(v: T) -> A<T> { A { v: UnsafeCell::<T>::new(v) } } } type T = isize; macro_rules! atomic_max_acqrel_test { ($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::...
A
identifier_name
atomic_max_acqrel.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_max_acqrel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T; struct A<T> { v: UnsafeCell<T> } unsa...
($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::new(value); let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = data.clone(); thread::spawn(move || { let dst: *mut T = clone.v.get(); let src: T = $value; let old: T = unsafe { atom...
macro_rules! atomic_max_acqrel_test {
random_line_split
atomic_max_acqrel.rs
#![feature(core, core_intrinsics)] extern crate core; #[cfg(test)] mod tests { use core::intrinsics::atomic_max_acqrel; use core::cell::UnsafeCell; use std::sync::Arc; use std::thread; // pub fn atomic_max_acqrel<T>(dst: *mut T, src: T) -> T; struct A<T> { v: UnsafeCell<T> } unsa...
} type T = isize; macro_rules! atomic_max_acqrel_test { ($init:expr, $value:expr, $result:expr) => ({ let value: T = $init; let a: A<T> = A::<T>::new(value); let data: Arc<A<T>> = Arc::<A<T>>::new(a); let clone: Arc<A<T>> = data.clone(); thread::spawn(move || { let dst: *mut...
{ A { v: UnsafeCell::<T>::new(v) } }
identifier_body
lib.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. #[macro_use] extern crate quote; extern crate proc_macro; use proc_macro2::{Group, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::*; /// This crate provides a macr...
{ template_ident: Ident, substitutes: Punctuated<Substitution, Token![,]>, match_exp: Box<Expr>, template_arm: Arm, remaining_arms: Vec<Arm>, } impl Parse for MatchTemplate { fn parse(input: ParseStream<'_>) -> Result<Self> { let template_ident = input.parse()?; input.parse::<T...
MatchTemplate
identifier_name
lib.rs
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. #[macro_use] extern crate quote; extern crate proc_macro; use proc_macro2::{Group, TokenStream, TokenTree}; use quote::ToTokens; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::*; /// This crate provides a macr...
"#; let expect_output_stream: TokenStream = expect_output.parse().unwrap(); let mt: MatchTemplate = syn::parse_str(input).unwrap(); let output = mt.expand(); assert_eq!(output.to_string(), expect_output_stream.to_string()); } #[test] fn test_map() { let inpu...
VectorValue::Bar => EvalType::Bar, _ => unreachable!(), }
random_line_split
score.rs
use std::collections::HashMap; use std::cmp::Ordering; ///An enum to store whether a scale is major or minor. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Scale { Major, Minor } ///A type of staff display. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum StaffType { Piano, Normal } ///A...
() -> Attachments { Attachments { tie: false, start_slur: false, end_slur: false, start_beam: false, end_beam: false, articulation: Vec::new(), } } } impl Ord for Voice { fn cmp(&self, other: &Voice) -> Ordering { m...
default
identifier_name
score.rs
use std::collections::HashMap; use std::cmp::Ordering; ///An enum to store whether a scale is major or minor.
} ///A type of staff display. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum StaffType { Piano, Normal } ///A note with accidentals. #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct Note { pub base: u8, pub octave: i8, pub accidentals: i8, } ///The types of possible voices. #[derive...
#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Scale { Major, Minor
random_line_split
lib.rs
extern crate regex; pub mod errors; pub mod known_hosts; pub mod launchagent; pub mod ssh_config; #[macro_use] extern crate error_chain; use std::collections::HashMap; use std::fs::File;
use errors::*; use regex::Regex; pub enum Condition { Include(Regex), Exclude(Regex), Everything, // TODO: do we need this? } impl Condition { pub fn exclude_from(spec: &str) -> Result<(PathBuf, Condition)> { let mut split = spec.splitn(2, ','); let path = PathBuf::from( s...
use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf};
random_line_split
lib.rs
extern crate regex; pub mod errors; pub mod known_hosts; pub mod launchagent; pub mod ssh_config; #[macro_use] extern crate error_chain; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf}; use errors::*; use regex::Regex; pub enum Cond...
() { let from = Path::new("/dev/null"); let conds = Conditions::default(); assert_eq!( Host::named("foo*.oink.example.com", from).ineligible(&conds), true ); assert_eq!(Host::named("*", from).ineligible(&conds), true); assert_eq!( Host::named("foobar.oink.example.com", f...
test_host_eligibility
identifier_name
lib.rs
extern crate regex; pub mod errors; pub mod known_hosts; pub mod launchagent; pub mod ssh_config; #[macro_use] extern crate error_chain; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf}; use errors::*; use regex::Regex; pub enum Cond...
#[test] fn test_conditions_match() { let from = Path::new("/dev/null"); let host = Host::named("foo.bar.com", from); // empty conditions means the host goes in: { let conds = Conditions::default(); assert!(conds.eligible(&host)); } // An include for the host means the host goe...
{ let from = Path::new("/dev/null"); let conds = Conditions::default(); assert_eq!( Host::named("foo*.oink.example.com", from).ineligible(&conds), true ); assert_eq!(Host::named("*", from).ineligible(&conds), true); assert_eq!( Host::named("foobar.oink.example.com", from...
identifier_body
js.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/. */ //! Smart pointers for the JS-managed DOM objects. //! //! The DOM is made up of DOM objects whose lifetime is ent...
else { None } } } } impl<T: Reflectable> LayoutJS<T> { /// Get the reflector. pub unsafe fn get_jsobject(&self) -> *mut JSObject { debug_assert!(task_state::get().is_layout()); (**self.ptr).reflector().get_jsobject().get() } } impl<T> Copy for Layou...
{ Some(mem::transmute_copy(self)) }
conditional_block
js.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/. */ //! Smart pointers for the JS-managed DOM objects. //! //! The DOM is made up of DOM objects whose lifetime is ent...
<T> { ptr: NonZero<*const T>, } // JS<T> is similar to Rc<T>, in that it's not always clear how to avoid double-counting. // For now, we choose not to follow any such pointers. impl<T> HeapSizeOf for JS<T> { fn heap_size_of_children(&self) -> usize { 0 } } impl<T> JS<T> { /// Returns `LayoutJS...
JS
identifier_name
js.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/. */ //! Smart pointers for the JS-managed DOM objects. //! //! The DOM is made up of DOM objects whose lifetime is ent...
fn root(&self, untracked_reflector: *const Reflector) { debug_assert!(task_state::get().is_script()); unsafe { let mut roots = &mut *self.roots.get(); roots.push(untracked_reflector); assert!(!(*untracked_reflector).get_jsobject().is_null()) } } /...
} } /// Start tracking a stack-based root
random_line_split
utils.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 rustc::ast_map; use rustc::lint::Context; use rustc::middle::def; use syntax::ast; use syntax::ast::{TyPath, ...
(cx: &Context, did: ast::DefId, value: &str) -> bool { cx.tcx.get_attrs(did).iter().any(|attr| { match attr.node.value.node { ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => { match val.node { ast::LitStr(ref v, _) if &**v == value => { ...
match_lang_did
identifier_name
utils.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 rustc::ast_map; use rustc::lint::Context; use rustc::middle::def; use syntax::ast; use syntax::ast::{TyPath, ...
} /// Checks if a type has a #[servo_lang = "str"] attribute pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool { match ty.node { TyPath(..) => {}, _ => return false, } let def_id = match cx.tcx.def_map.borrow().get(&ty.id) { Some(&def::PathResolution { base_def: def:...
} }, _ => None }
random_line_split
utils.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 rustc::ast_map; use rustc::lint::Context; use rustc::middle::def; use syntax::ast; use syntax::ast::{TyPath, ...
} /// Checks if a type has a #[servo_lang = "str"] attribute pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool { match ty.node { TyPath(..) => {}, _ => return false, } let def_id = match cx.tcx.def_map.borrow().get(&ty.id) { Some(&def::PathResolution { base_def: def...
{ match ty.node { TyPath(_, Path {segments: ref seg, ..}) => { // So ast::Path isn't the full path, just the tokens that were provided. // I could muck around with the maps and find the full path // however the more efficient way is to simply reverse the iterators and zip...
identifier_body
note_pitch.rs
// Copyright 2017 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
pub struct NotePitch { value: f32, } impl NotePitch { pub fn new() -> NotePitch { NotePitch { value: 0.0 } } } impl Module for NotePitch { fn n_ctrl_out(&self) -> usize { 1 } fn handle_note(&mut self, midi_num: f32, _velocity: f32, on: bool) { if on { self.value = midi...
random_line_split
note_pitch.rs
// Copyright 2017 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
} fn process(&mut self, _control_in: &[f32], control_out: &mut [f32], _buf_in: &[&Buffer], _buf_out: &mut [Buffer]) { control_out[0] = self.value; } }
{ self.value = midi_num * (1.0 / 12.0) + (440f32.log2() - 69.0 / 12.0); }
conditional_block
note_pitch.rs
// Copyright 2017 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
{ value: f32, } impl NotePitch { pub fn new() -> NotePitch { NotePitch { value: 0.0 } } } impl Module for NotePitch { fn n_ctrl_out(&self) -> usize { 1 } fn handle_note(&mut self, midi_num: f32, _velocity: f32, on: bool) { if on { self.value = midi_num * (1.0 / 12.0) ...
NotePitch
identifier_name
note_pitch.rs
// Copyright 2017 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
fn process(&mut self, _control_in: &[f32], control_out: &mut [f32], _buf_in: &[&Buffer], _buf_out: &mut [Buffer]) { control_out[0] = self.value; } }
{ if on { self.value = midi_num * (1.0 / 12.0) + (440f32.log2() - 69.0 / 12.0); } }
identifier_body
extern-call-scrub.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 ...
else { count(data - 1u) + count(data - 1u) } } fn count(n: uint) -> uint { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) task::spawn(proc() { ...
{ data }
conditional_block
extern-call-scrub.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 ...
mod rustrt { use std::libc; #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) -> libc::uintptr_t; } } extern fn cb(data: libc::uintptr_t) -> libc::uintp...
use std::libc; use std::task;
random_line_split
extern-call-scrub.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 ...
pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) task::spawn(proc() { let result = count(12u); println!("result = {}", result); assert_eq!(result, 2048u); }); }
{ unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) } }
identifier_body
extern-call-scrub.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 ...
(data: libc::uintptr_t) -> libc::uintptr_t { if data == 1u { data } else { count(data - 1u) + count(data - 1u) } } fn count(n: uint) -> uint { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) } } pub fn main() { // Make sure we're on a task with smal...
cb
identifier_name
settings.rs
// The MIT License (MIT) // Copyright © 2014-2018 Miguel Peláez <kernelfreeze@outlook.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation // files (the “Software”), to deal in the Software without restriction, including without limitation...
&Vec<String> { &self.resourcepacks } }
cks(&self) ->
identifier_name
settings.rs
// The MIT License (MIT) // Copyright © 2014-2018 Miguel Peláez <kernelfreeze@outlook.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation // files (the “Software”), to deal in the Software without restriction, including without limitation...
gameplay: GameplaySettings { fov: 90, vsync: true }, resourcepacks: Vec::new(), } } /// Get window width pub fn width(&self) -> u32 { self.window.width } /// Set window width pub fn set_width(&mut self, value: u32) { self.window.width = value } /// Get window h...
fullscreen: false, maximized: true, multisampling: 0, gui_scale: 1.0, },
random_line_split
settings.rs
// The MIT License (MIT) // Copyright © 2014-2018 Miguel Peláez <kernelfreeze@outlook.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation // files (the “Software”), to deal in the Software without restriction, including without limitation...
Get user GUI scale pub fn scale(&self) -> f64 { self.window.gui_scale } /// Get enabled resourcepacks by filename pub fn resourcepacks(&self) -> &Vec<String> { &self.resourcepacks } }
eplay.fov } ///
identifier_body
mod.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/. */ //! Common [values][values] used in CSS. //! //! [values]: https://drafts.csswg.org/css-values/ #![deny(missing_d...
use selectors::parser::SelectorParseErrorKind; #[allow(unused_imports)] use std::ascii::AsciiExt; use std::fmt::{self, Debug}; use std::hash; use style_traits::{ToCss, ParseError, StyleParseErrorKind}; pub mod animated; pub mod computed; pub mod distance; pub mod generics; pub mod specified; /// A CSS float value. pu...
use Atom; pub use cssparser::{RGBA, Token, Parser, serialize_identifier, CowRcStr, SourceLocation}; use parser::{Parse, ParserContext};
random_line_split
mod.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/. */ //! Common [values][values] used in CSS. //! //! [values]: https://drafts.csswg.org/css-values/ #![deny(missing_d...
(&self, other: &Self) -> bool { self.as_atom() == other.as_atom() } } impl hash::Hash for KeyframesName { fn hash<H>(&self, state: &mut H) where H: hash::Hasher { self.as_atom().hash(state) } } impl Parse for KeyframesName { fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser...
eq
identifier_name
main.rs
extern crate piston; extern crate piston_window; extern crate vecmath; extern crate camera_controllers; #[macro_use] extern crate gfx; extern crate gfx_device_gl; extern crate glfw_window; use std::cell::RefCell; use std::rc::Rc; use piston_window::*; use piston::event::*; use piston::window::{ AdvancedWindow, WindowS...
Vertex::new([-1, -1, -1], [1, 1]), Vertex::new([ 1, -1, -1], [0, 1]), //right (1, 0, 0) Vertex::new([ 1, -1, -1], [0, 0]), Vertex::new([ 1, 1, -1], [1, 0]), Vertex::new([ 1, 1, 1], [1, 1]), Vertex::new([ 1, -1, 1], [0, 1]), //left (-1, 0, 0) Ve...
{ let (win_width, win_height) = (640, 480); let window = Rc::new(RefCell::new(GlfwWindow::new( OpenGL::_3_2, WindowSettings::new("piston-example-gfx_cube", [win_width, win_height]) .exit_on_esc(true) .samples(4) ).capture_cursor(true))); let events = PistonWindow::new(wi...
identifier_body
main.rs
extern crate piston; extern crate piston_window; extern crate vecmath; extern crate camera_controllers; #[macro_use] extern crate gfx; extern crate gfx_device_gl; extern crate glfw_window; use std::cell::RefCell; use std::rc::Rc; use piston_window::*; use piston::event::*; use piston::window::{ AdvancedWindow, WindowS...
} }
{ projection = get_projection(&e); }
conditional_block
main.rs
extern crate piston; extern crate piston_window; extern crate vecmath; extern crate camera_controllers; #[macro_use] extern crate gfx; extern crate gfx_device_gl; extern crate glfw_window; use std::cell::RefCell; use std::rc::Rc; use piston_window::*; use piston::event::*; use piston::window::{ AdvancedWindow, WindowS...
() { let (win_width, win_height) = (640, 480); let window = Rc::new(RefCell::new(GlfwWindow::new( OpenGL::_3_2, WindowSettings::new("piston-example-gfx_cube", [win_width, win_height]) .exit_on_esc(true) .samples(4) ).capture_cursor(true))); let events = PistonWindow::new(w...
main
identifier_name
main.rs
extern crate piston; extern crate piston_window; extern crate vecmath; extern crate camera_controllers; #[macro_use] extern crate gfx; extern crate gfx_device_gl; extern crate glfw_window; use std::cell::RefCell; use std::rc::Rc; use piston_window::*; use piston::event::*; use piston::window::{ AdvancedWindow, WindowS...
use piston::window::Window; let draw_size = w.window.borrow().draw_size(); CameraPerspective { fov: 90.0, near_clip: 0.1, far_clip: 1000.0, aspect_ratio: (draw_size.width as f32) / (draw_size.height as f32) }.projection() }; let model = vecmath::mat4_id(...
let get_projection = |w: &PistonWindow<GlfwWindow>| {
random_line_split
oesvertexarrayobject.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 canvas_traits::webgl::WebGLVersion; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, ...
fn new(ctx: &WebGLRenderingContext) -> DomRoot<OESVertexArrayObject> { reflect_dom_object( Box::new(OESVertexArrayObject::new_inherited(ctx)), &*ctx.global(), OESVertexArrayObjectBinding::Wrap, ) } fn spec() -> WebGLExtensionSpec { WebGLExtensionS...
impl WebGLExtension for OESVertexArrayObject { type Extension = OESVertexArrayObject;
random_line_split
oesvertexarrayobject.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 canvas_traits::webgl::WebGLVersion; use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, ...
{ reflector_: Reflector, ctx: Dom<WebGLRenderingContext>, } impl OESVertexArrayObject { fn new_inherited(ctx: &WebGLRenderingContext) -> OESVertexArrayObject { Self { reflector_: Reflector::new(), ctx: Dom::from_ref(ctx), } } } impl OESVertexArrayObjectMethods ...
OESVertexArrayObject
identifier_name
entry.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 F...
.context("Error writing header")?; } match coordinates { Ok(None) => Ok(None), Ok(Some(some)) => Ok(Some(Ok(some))), Err(e) => Ok(Some(Err(e))), } } } #[cfg(test)] mod tests { use std::path::PathBuf; use libimagstor...
{ let coordinates = self.get_coordinates(); let patterns = [ "gps.coordinates.latitude.degree", "gps.coordinates.latitude.minutes", "gps.coordinates.latitude.seconds", "gps.coordinates.longitude.degree", "gps.coordinates.longitude.minutes", ...
identifier_body
entry.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 F...
let coordinates = Coordinates { latitude: GPSValue::new(0, 0, 0), longitude: GPSValue::new(0, 0, 0), }; let res = entry.set_coordinates(coordinates); assert!(res.is_ok()); } #[test] fn test_setget_gps() { setup_logging(); let store ...
let mut entry = store.create(PathBuf::from("test_set_gps")).unwrap();
random_line_split
entry.rs
// // imag - the personal information management suite for the commandline // Copyright (C) 2015-2020 Matthias Beyer <mail@beyermatthias.de> and contributors // // This library 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 F...
() { setup_logging(); let store = get_store(); let mut entry = store.create(PathBuf::from("test_setget_gps")).unwrap(); let coordinates = Coordinates { latitude: GPSValue::new(0, 0, 0), longitude: GPSValue::new(0, 0, 0), }; let res = entry.set_...
test_setget_gps
identifier_name
group.rs
//! Fuctions and Structs for dealing with /etc/group use std::path::Path; use std::num::ParseIntError; use libc::gid_t; use entries::{Entries,Entry}; /// An entry from /etc/group #[derive(Debug, PartialEq, PartialOrd)] pub struct
{ /// Group Name pub name: String, /// Group Password pub passwd: String, /// Group ID pub gid: gid_t, /// Group Members pub members: Vec<String>, } impl Entry for GroupEntry { fn from_line(line: &str) -> Result<GroupEntry, ParseIntError> { let parts: Vec<&str> = lin...
GroupEntry
identifier_name
group.rs
//! Fuctions and Structs for dealing with /etc/group use std::path::Path; use std::num::ParseIntError; use libc::gid_t; use entries::{Entries,Entry}; /// An entry from /etc/group #[derive(Debug, PartialEq, PartialOrd)] pub struct GroupEntry { /// Group Name pub name: String, /// Group Password pub ...
get_entry_by_name_from_path(&Path::new("/etc/group"), name) } /// Return a `Vec<`[`GroupEntry`](struct.GroupEntry.html)`>` containing all /// [`GroupEntry`](struct.GroupEntry.html)'s for a given `&Path` pub fn get_all_entries_from_path(path: &Path) -> Vec<GroupEntry> { Entries::new(path).collect() } /// Ret...
/// Return a [`GroupEntry`](struct.GroupEntry.html) /// for a given `name` from `/etc/group` pub fn get_entry_by_name(name: &str) -> Option<GroupEntry> {
random_line_split
simplify.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
(bounds: Vec<clean::TyParamBound>) -> Vec<clean::TyParamBound> { bounds } fn trait_is_same_or_supertrait(cx: &DocContext, child: ast::DefId, trait_: ast::DefId) -> bool { if child == trait_ { return true } let def = ty::lookup_trait_def(cx.tcx(), child); let p...
ty_bounds
identifier_name
simplify.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
clean::ResolvedPath { did,.. } => { trait_is_same_or_supertrait(cx, did, trait_) } _ => false, } }) }
}; match poly_trait.trait_ {
random_line_split
simplify.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
}; true }) }); // And finally, let's reassemble everything let mut clauses = Vec::new(); clauses.extend(lifetimes.into_iter().map(|(lt, bounds)| { WP::RegionPredicate { lifetime: lt, bounds: bounds } })); clauses.extend(params.into_iter().map(|(k, v)| { ...
{ assert!(output.is_none()); *output = Some(rhs.clone()); }
conditional_block
simplify.rs
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn trait_is_same_or_supertrait(cx: &DocContext, child: ast::DefId, trait_: ast::DefId) -> bool { if child == trait_ { return true } let def = ty::lookup_trait_def(cx.tcx(), child); let predicates = ty::lookup_predicates(cx.tcx(), child); let generics = (&def....
{ bounds }
identifier_body
problem_14.rs
fn collatz(num: u32) -> u32 { if num == 1 { return num; } if num % 2 == 0 { num / 2 } else { (num * 3) + 1 } } fn main() { let mut max_terms: u32 = 0; let mut max_terms_number: u32 = 0; for i in 2..1_000_001 { let mut current_terms: u32 = 0; let...
current_terms += 1; if current_terms > max_terms { max_terms = current_terms; max_terms_number = i; } } // println!("collatz({}) -> {}", i, current_terms); } println!("Result: {}", max_terms_number); }
random_line_split
problem_14.rs
fn
(num: u32) -> u32 { if num == 1 { return num; } if num % 2 == 0 { num / 2 } else { (num * 3) + 1 } } fn main() { let mut max_terms: u32 = 0; let mut max_terms_number: u32 = 0; for i in 2..1_000_001 { let mut current_terms: u32 = 0; let mut resul...
collatz
identifier_name
problem_14.rs
fn collatz(num: u32) -> u32 { if num == 1
if num % 2 == 0 { num / 2 } else { (num * 3) + 1 } } fn main() { let mut max_terms: u32 = 0; let mut max_terms_number: u32 = 0; for i in 2..1_000_001 { let mut current_terms: u32 = 0; let mut result: u32 = i; while result!= 1 { result = col...
{ return num; }
conditional_block
problem_14.rs
fn collatz(num: u32) -> u32 { if num == 1 { return num; } if num % 2 == 0 { num / 2 } else { (num * 3) + 1 } } fn main()
{ let mut max_terms: u32 = 0; let mut max_terms_number: u32 = 0; for i in 2..1_000_001 { let mut current_terms: u32 = 0; let mut result: u32 = i; while result != 1 { result = collatz(result); current_terms += 1; if current_terms > max_terms { ...
identifier_body
client.rs
/* * Copyright 2015-2016 Torrie Fischer <tdfischer@hackerbots.net> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requi...
(&mut self, token: Option<&str>) -> AsyncPoll { let mut args = HashMap::new(); if let Some(next) = token { args.insert("since", next); args.insert("timeout", "5000"); } else { args.insert("full_state", "true"); } let url = self.url(ApiVersion::...
sync
identifier_name
client.rs
/*
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribut...
* Copyright 2015-2016 Torrie Fischer <tdfischer@hackerbots.net>
random_line_split
client.rs
/* * Copyright 2015-2016 Torrie Fischer <tdfischer@hackerbots.net> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requi...
fn url(&self, version: ApiVersion, endpoint: &str, args: &HashMap<&str, &str>) -> hyper::Url { let mut ret = self.baseurl.clone(); ret.path_mut().unwrap().append(&mut vec!["client".to_string()]); ret.path_mut().unwrap().append(&mut match version { ApiVersion::R0 => ...
{ let mut d = BTreeMap::new(); d.insert("user".to_string(), Json::String(username.to_string())); d.insert("password".to_string(), Json::String(password.to_string())); d.insert("type".to_string(), Json::String("m.login.password".to_string())); debug!("Logging in to matrix"); ...
identifier_body
gather_moves.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
assignment_id, assignment_span, assignee_id, mode); } // (keep in sync with move_error::report_cannot_move_out_of ) fn check_and_get_illegal_move_origin<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, ...
mode: euv::MutateMode) { move_data.add_assignment(bccx.tcx, assignee_loan_path,
random_line_split
gather_moves.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
pub fn gather_match_variant<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, move_data: &MoveData<'tcx>, _move_error_collector: &MoveErrorCollector<'tcx>, move_pat: &ast::Pat, ...
{ let kind = match move_reason { euv::DirectRefMove | euv::PatBindingMove => MoveExpr, euv::CaptureMove => Captured }; let move_info = GatherMoveInfo { id: move_expr_id, kind: kind, cmt: cmt, span_path_opt: None, }; gather_move(bccx, move_data, move_er...
identifier_body
gather_moves.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, move_data: &MoveData<'tcx>, move_error_collector: &MoveErrorCollector<'tcx>, move_pat: &ast::Pat, cmt: mc::cmt<'tcx>) { le...
gather_move_from_pat
identifier_name
issue-36082.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 ...
() { let mut r = 0; let s = 0; let x = RefCell::new((&mut r,s)); let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E0597] //[ast]~| NOTE temporary value dropped here while still borrowed //[ast]~| NOTE temporary value does not live long enough //[ast]...
main
identifier_name
issue-36082.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 ...
// revisions: ast mir //[mir]compile-flags: -Z borrowck=mir // FIXME(#49821) -- No tip about using a let binding use std::cell::RefCell; fn main() { let mut r = 0; let s = 0; let x = RefCell::new((&mut r,s)); let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E...
random_line_split
issue-36082.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 ...
//[ast]~^ NOTE temporary value needs to live until here
{ let mut r = 0; let s = 0; let x = RefCell::new((&mut r,s)); let val: &_ = x.borrow().0; //[ast]~^ ERROR borrowed value does not live long enough [E0597] //[ast]~| NOTE temporary value dropped here while still borrowed //[ast]~| NOTE temporary value does not live long enough //[ast]~| ...
identifier_body
mock_store.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; #[derive(Debug, PartialEq)] pub st...
(&self) -> MockStoreStats { MockStoreStats { sets: self.set_count.load(Ordering::SeqCst), gets: self.get_count.load(Ordering::SeqCst), misses: self.miss_count.load(Ordering::SeqCst), hits: self.hit_count.load(Ordering::SeqCst), } } } impl<T: Clone> Mo...
stats
identifier_name
mock_store.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; #[derive(Debug, PartialEq)] pub st...
gets: 2, misses: 1, hits: 1 } ); } }
store.stats(), MockStoreStats { sets: 1,
random_line_split
mock_store.rs
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; #[derive(Debug, PartialEq)] pub st...
} #[cfg(test)] mod test { use super::*; #[test] fn test_counts() { let store = MockStore::new(); assert_eq!( store.stats(), MockStoreStats { sets: 0, gets: 0, misses: 0, hits: 0 } )...
{ self.data.lock().expect("poisoned lock").clone() }
identifier_body