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
set_watch_mode.rs
use std::io; use super::super::{WriteTo, WatchMode, WatchModeReader, WriteResult, Reader, ReaderStatus, MessageInner, Message}; #[derive(Debug, Eq, PartialEq, Clone)] pub struct SetWatchMode { mode: WatchMode, } #[derive(Debug)] pub struct SetWatchModeReader { inner: WatchModeReader, } impl SetWatchMode { ...
ReaderStatus::Pending, ReaderStatus::Complete(Message::SetWatchMode(SetWatchMode::new(WatchMode::All))) }; } }
ReaderStatus::Pending,
random_line_split
rayon.rs
use crate::{ProgressBar, ProgressBarIter}; use rayon::iter::{ plumbing::{Consumer, Folder, Producer, ProducerCallback, UnindexedConsumer}, IndexedParallelIterator, ParallelIterator, }; use std::convert::TryFrom; /// Wraps a Rayon parallel iterator. /// /// See [`ProgressIterator`](trait.ProgressIterator.html) ...
fn drive<C: Consumer<Self::Item>>(self, consumer: C) -> <C as Consumer<Self::Item>>::Result { let consumer = ProgressConsumer::new(consumer, self.progress); self.it.drive(consumer) } fn with_producer<CB: ProducerCallback<Self::Item>>( self, callback: CB, ) -> <CB as Pr...
{ self.it.len() }
identifier_body
rayon.rs
use crate::{ProgressBar, ProgressBarIter}; use rayon::iter::{ plumbing::{Consumer, Folder, Producer, ProducerCallback, UnindexedConsumer}, IndexedParallelIterator, ParallelIterator, }; use std::convert::TryFrom; /// Wraps a Rayon parallel iterator. /// /// See [`ProgressIterator`](trait.ProgressIterator.html) ...
(self, item: T) -> Self { self.progress.inc(1); ProgressFolder { base: self.base.consume(item), progress: self.progress, } } fn complete(self) -> C::Result { self.base.complete() } fn full(&self) -> bool { self.base.full() } } impl<S...
consume
identifier_name
rayon.rs
use crate::{ProgressBar, ProgressBarIter}; use rayon::iter::{ plumbing::{Consumer, Folder, Producer, ProducerCallback, UnindexedConsumer}, IndexedParallelIterator, ParallelIterator, }; use std::convert::TryFrom; /// Wraps a Rayon parallel iterator. /// /// See [`ProgressIterator`](trait.ProgressIterator.html) ...
} impl<T, C: Consumer<T>> Consumer<T> for ProgressConsumer<C> { type Folder = ProgressFolder<C::Folder>; type Reducer = C::Reducer; type Result = C::Result; fn split_at(self, index: usize) -> (Self, Self, Self::Reducer) { let (left, right, reducer) = self.base.split_at(index); ( ...
fn new(base: C, progress: ProgressBar) -> Self { ProgressConsumer { base, progress } }
random_line_split
issue-17441.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 _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^^ HELP consider using an implicit coercion to `&[usize]` instead // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _bar = Box::new(1_usize) as std::fmt::Debug; //~...
main
identifier_name
issue-17441.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 _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^^ HELP consider using an implicit coercion to `&[usize]` instead // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _bar = Box::new(1_usize) as std::fmt::Debug; //~^ E...
identifier_body
issue-17441.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. //
fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` //~^^ HELP consider using an implicit coercion to `&[usize]` instead // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. let _bar = Box::new(1_usize) as std::fmt::Debug;...
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms.
random_line_split
mod.rs
use lexer::dfa::*; use lexer::re::Test; use rust::RustWrite; use std::io::{self, Write}; #[cfg(test)] mod test; /// Generates a fn `__tokenize` based on the given DFA with the following signature: /// /// ```ignore /// fn tokenize(text: &str) -> Option<(usize, usize)> /// ``` /// /// This function returns `None` if t...
(&mut self, target_state: DFAStateIndex, index: &str) -> io::Result<()> { match self.dfa.state(target_state).kind { Kind::Accepts(nfa) => { rust!(self.out, "{}current_match = Some(({}, {}));", self.prefix, nf...
transition
identifier_name
mod.rs
use lexer::dfa::*; use lexer::re::Test; use rust::RustWrite; use std::io::{self, Write}; #[cfg(test)] mod test; /// Generates a fn `__tokenize` based on the given DFA with the following signature: /// /// ```ignore /// fn tokenize(text: &str) -> Option<(usize, usize)> /// ``` /// /// This function returns `None` if t...
struct Matcher<'m, W: Write+'m> { prefix: &'m str, dfa: &'m DFA, out: &'m mut RustWrite<W>, } impl<'m,W> Matcher<'m,W> where W: Write { fn tokenize(&mut self) -> io::Result<()> { rust!(self.out, "fn {}tokenize(text: &str) -> Option<(usize, usize)> {{", self.prefix); ...
{ let mut matcher = Matcher { prefix: prefix, dfa: dfa, out: out }; try!(matcher.tokenize()); Ok(()) }
identifier_body
mod.rs
use lexer::dfa::*; use lexer::re::Test; use rust::RustWrite; use std::io::{self, Write}; #[cfg(test)] mod test; /// Generates a fn `__tokenize` based on the given DFA with the following signature: /// /// ```ignore /// fn tokenize(text: &str) -> Option<(usize, usize)> /// ``` /// /// This function returns `None` if t...
Kind::Reject => { rust!(self.out, "return {}current_match;", self.prefix); return Ok(()); } } rust!(self.out, "{}current_state = {};", self.prefix, target_state.index()); rust!(self.out, "continue;"); Ok(()) } }
{ }
conditional_block
mod.rs
use lexer::dfa::*; use lexer::re::Test; use rust::RustWrite; use std::io::{self, Write}; #[cfg(test)] mod test; /// Generates a fn `__tokenize` based on the given DFA with the following signature: /// /// ```ignore /// fn tokenize(text: &str) -> Option<(usize, usize)> /// ``` /// /// This function returns `None` if t...
for (index, state) in self.dfa.states.iter().enumerate() { rust!(self.out, "{} => {{", index); try!(self.state(state)); rust!(self.out, "}}"); } rust!(self.out, "_ => {{ panic!(\"invalid state {{}}\", {}current_state); }}", self.prefix); ...
random_line_split
channel_list.rs
use ui::ncurses::*; use ui::{RIGHT_PANEL_WIDTH, CMD_ENTRY_HEIGHT, STATS_PANEL_HEIGHT, Position, Size}; use ui::window::BorderWindow; pub struct ChannelList { window: BorderWindow, channels: Vec<String>, } impl ChannelList { pub fn new(size: Size) -> ChannelList { let window = BorderWindow::new( ...
}, None => false, } } }
random_line_split
channel_list.rs
use ui::ncurses::*; use ui::{RIGHT_PANEL_WIDTH, CMD_ENTRY_HEIGHT, STATS_PANEL_HEIGHT, Position, Size}; use ui::window::BorderWindow; pub struct ChannelList { window: BorderWindow, channels: Vec<String>, } impl ChannelList { pub fn new(size: Size) -> ChannelList { let window = BorderWindow::new( ...
pub fn add_channel(&mut self, name: &str) { self.channels.push(name.to_string()); self.display_channel(self.channels.len() as i32 - 1, name); } pub fn remove_channel(&mut self, name: &str) -> bool { let index = self.channels.iter().position(|ref s| s.as_str() == name); ma...
{ mvwaddstr(self.window.inner.id, index, 1, &format!("{} - {}", index + 1, name)); wrefresh(self.window.inner.id); }
identifier_body
channel_list.rs
use ui::ncurses::*; use ui::{RIGHT_PANEL_WIDTH, CMD_ENTRY_HEIGHT, STATS_PANEL_HEIGHT, Position, Size}; use ui::window::BorderWindow; pub struct ChannelList { window: BorderWindow, channels: Vec<String>, } impl ChannelList { pub fn new(size: Size) -> ChannelList { let window = BorderWindow::new( ...
(&mut self, name: &str) -> bool { let index = self.channels.iter().position(|ref s| s.as_str() == name); match index { Some(index) => { self.channels.remove(index); // TODO: Separate this redraw code into its own function once this method is actually used ...
remove_channel
identifier_name
validitystate.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::codegen::Bindings::ValidityStateBin...
state: ValidityStatus::Valid } } pub fn new(window: &Window, element: &Element) -> Root<ValidityState> { reflect_dom_object(box ValidityState::new_inherited(element), window, ValidityStateBinding::Wrap) } } impl ValidityStat...
impl ValidityState { fn new_inherited(element: &Element) -> ValidityState { ValidityState { reflector_: Reflector::new(), element: JS::from_ref(element),
random_line_split
validitystate.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::codegen::Bindings::ValidityStateBin...
// https://html.spec.whatwg.org/multipage/#dom-validitystate-valid fn Valid(&self) -> bool { false } }
{ false }
identifier_body
validitystate.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::ValidityStateBinding; use dom::bindings::codegen::Bindings::ValidityStateBin...
(&self) -> bool { false } // https://html.spec.whatwg.org/multipage/#dom-validitystate-typemismatch fn TypeMismatch(&self) -> bool { false } // https://html.spec.whatwg.org/multipage/#dom-validitystate-patternmismatch fn PatternMismatch(&self) -> bool { false } ...
ValueMissing
identifier_name
udt.rs
extern crate cassandra; use cassandra::*; fn main() { let mut cluster = Cluster::new(); cluster.set_contact_points("127.0.0.1").unwrap(); match cluster.connect() { Ok(ref mut session) => { let schema = session.get_schema(); session.execute( "CREATE KEYSPACE examples WITH replic...
match field.1.get_type() { ValueType::VARCHAR => println!("{}", try!(field.1.get_string())), ValueType::INT => println!("{}", try!(field.1.get_int32())), ValueType::SET => for phone_numbers in try!(fi...
for field in fields_iter { println!("{}", field.0);
random_line_split
udt.rs
extern crate cassandra; use cassandra::*; fn main()
"CREATE TYPE examples.address \ (street text, city text, zip int, phone set<frozen<phone_numbers>>)" ,0 ); session.execute( "CREATE TABLE examples.udt (id timeuuid, address frozen<address>, PRIMARY KEY(id))", 0 ); insert_into_udt(&session, schema).unwrap(); s...
{ let mut cluster = Cluster::new(); cluster.set_contact_points("127.0.0.1").unwrap(); match cluster.connect() { Ok(ref mut session) => { let schema = session.get_schema(); session.execute( "CREATE KEYSPACE examples WITH replication = \ { 'class': 'SimpleStrategy', 'replic...
identifier_body
udt.rs
extern crate cassandra; use cassandra::*; fn main() { let mut cluster = Cluster::new(); cluster.set_contact_points("127.0.0.1").unwrap(); match cluster.connect() { Ok(ref mut session) => { let schema = session.get_schema(); session.execute( "CREATE KEYSPACE examples WITH replic...
(session: &Session) -> Result<(), CassandraError> { let query = "INSERT INTO examples.udt (id, address) VALUES (?,?)"; let mut statement = Statement::new(query, 2); let uuid_gen = UuidGen::new(); let udt_address = schema.get_udt("examples", "address"); let udt_phone = cass_keyspace_meta_user_type_by...
insert_into_udt
identifier_name