lang
stringclasses
10 values
seed
stringlengths
5
2.12k
rust
fn resolve_conflicts(&self) -> Result<()> { // while there still are conflicts we resolve them in our favor loop { let out = self .executer .exec(&format!("git diff --name-only --diff-filter=U"))?; let conflicts: Vec<&str> = out.lines().collect(); if conflicts.is_empty() { return Ok(()); } for conflict in conflicts { let file = conflict.trim(); self.executer
rust
IO(#[from] std::io::Error), #[error("Tried to delete non-existent key {0:?}")] KeyDelete(Vec<u8>), #[error("Key Error: {0}")] Key(String), #[error("Key not found: {0}")] KeyNotFound(String), #[error("Proof is missing data for query")] MissingData, #[error("Path Error: {0}")] Path(String), #[error("Proof Error: {0}")] Proof(String), #[cfg(feature = "full")]
rust
event: MouseEvent::Release(MouseButton::Left), position, offset, } if position.fits_in_rect(offset, self.last_size) => { self.open_popup() } _ => EventResult::Ignored, } } } impl SelectView<String> { /// Convenient method to use the label as value. pub fn add_item_str<S: Into<String>>(&mut self, label: S) { let label = label.into();
rust
// Filter and report JSON diagnostic messages from standard input for line in io::stdin().lock().lines() { let line = line.with_context(|| "Failed to read line from standard input")?; let diagnostic: Diagnostic = serde_json::from_str(&line) .with_context(|| format!("Failed to parse JSON from standard input: {:?}", line))?; // Ignore diagnostics that don't have a message if let Some(message) = diagnostic.message { if should_report_message(&message, &file_changes) { println!("{}", message.rendered);
rust
// fibonacci staircase pattern - TO-DO fn main() { let mut n = String::new(); io::stdin().read_line(&mut n) .expect("Err"); let n: u32 = n.trim().parse() .expect("input parse err"); let mut i1 = 0;
rust
use std::sync::Arc; use parking_lot::RwLock; use std::ops::{ Deref, DerefMut };
rust
// SPDX-License-Identifier: Apache-2.0 //! SEV microarchitecture-specific constants. /// `get_attestation` technology return value /// /// See <https://github.com/enarx/enarx-keepldr/issues/31> pub const TECH: usize = 1;
rust
pub use ast; pub use codegen; pub use parser; pub use preset_env; pub use transforms;
rust
worker.scope(indexes.len(), |scope, chunk| { for (idx, fe) in indexes.chunks(chunk) .zip(result.chunks_mut(chunk)) { scope.spawn(move |_| { let mut repr = F::zero().into_repr(); for (idx, fe) in idx.iter().zip(fe.iter_mut()) { repr.as_mut()[0] = *idx as u64;
rust
<gh_stars>1-10 #[allow(clippy::module_inception)] pub(crate) mod bininterval; pub(crate) mod singlevaluebininterval;
rust
} #[test] fn parse_loop() { assert_eq!(Program { instructions: vec![LoopEntry(1usize), LoopExit(0usize)] }, parse("[]".to_string())); } #[test] fn parse_program_with_all_instructions() { assert_eq!(Program { instructions: vec![Input, // 0 Inc(1u8), // 1 MoveRight(1usize), // 2
rust
let configs = format!("./devtools/deps/configs/{}", pod_name); let data = format!("./devtools/deps/data/{}", pod_name); DepsPod { configs, data } } } impl Paths for DepsPod {
rust
pub enum Cucumber { Empty, East, South, } impl Cucumber { pub fn next_move(self) -> (isize, isize) { match self { Cucumber::Empty => panic!(), Cucumber::East => (1, 0),
rust
pub mod expr; pub mod function; pub mod stmt;
rust
anchor.set(6.0, 2.0); jd.initialize(b1, b5.clone(), anchor); m_world .borrow_mut() .create_joint(&B2JointDefEnum::RevoluteJoint(jd.clone()));
rust
let path = env::current_dir().unwrap(); info!("Path: {:?}", path); let (mut api_client, guard) = test_helpers::start_server(false).await; let mut config = api_client .get_config(GetConfigRequest {}) .await .unwrap() .into_inner() .config .unwrap(); config.indexes_per_compute_cycle = LABELS_PER_ITER;
rust
(vec![12], 4), (vec![13], 4), (vec![14], 5), (vec![15], 5), (vec![16], 5),
rust
use futuresdr::blocks::Apply; use futuresdr::num_complex::Complex32; use futuresdr::runtime::Block; pub fn lin2db_block() -> Block { Apply::new(|x: &f32| 10.0 * x.log10()) } pub fn power_block() -> Block { Apply::new(|x: &Complex32| x.norm())
rust
proxy: None, // Enable it for use HTTP/S Proxy }; fn main() { let sip: CivicSip = CivicSip::new(CONFIG, None); let data = sip.exchange_code(AC_JWT).unwrap(); println!("data: {:?}", data); }
rust
self.bound .iter() .take(end_row) .skip(start_row) .map(|b| b + 1 - prompt_len)
rust
use ash::{version::DeviceV1_0, vk}; const USAGE: u32 = vk::BufferUsageFlags::INDEX_BUFFER.as_raw(); const MULTI: bool = true; pub type IndexBuffer<I> = GenericStagedBuffer<I, USAGE, MULTI>; impl<I> IndexBuffer<I> where
rust
} } pub fn contains(&self, remote_addr: &IpAddr) -> bool { for proxy in &self.0 { if proxy.contains(remote_addr) { return true; } } false } pub fn remove_trusted_ips(&self, sorted_ips: Vec<IpAddr>) -> Vec<IpAddr> {
rust
(1.58e-09, 3.36297374123, 285.3723810196), (1.61e-09, 1.21480182441, 1024.4302882891), (1.83e-09, 5.45168150656, 218.4069048687), (1.56e-09, 0.6432152487, 1029.8469142605), (1.51e-09, 5.30865874765, 348.8476468921),
rust
.unwrap() .nth(1) .unwrap() .unwrap() .0
rust
for i in terms { v.push(i.term) } let res: serde_json::Value = json!({ "res":{ "terms":v, "nowTerm":v.last().unwrap() } }); Ok(res)
rust
let mut dividend = 1; let mut divisor = 1; for i in 0..r { dividend *= n - i; divisor *= i + 1;
rust
fn handle(&mut self, msg: CheckDisplayName, _ctx: &mut Self::Context) -> Self::Result { let verifier = self.verifier.clone(); Box::pin( async move { trace!("Received a similarities check: {:?}", msg); verifier .check_similarities(msg.check.as_str(), msg.chain, None) .await .map(|violations| {
rust
assert!(app::is_compatible("v0.2.0", "v0.2.2")); assert!(!app::is_compatible("v0.1.0", "v0.2.0")); assert!(!app::is_compatible("v0.1.0", "v1.1.0")); assert!(app::is_compatible("v1.1.0", "v1.1.0")); assert!(app::is_compatible("v1.1.0", "v1.1.1")); assert!(app::is_compatible("v1.1.0", "v1.2.1")); assert!(app::is_compatible("v1.1.0", "v1.2.1"));
rust
macro_rules! str_to_command { ($command_str:expr, $args_vec:expr) => {{ let exec_vec = $command_str.split_whitespace(); $args_vec.extend(exec_vec.clone().skip(1).collect::<Vec<_>>()); exec_vec.collect::<Vec<_>>()[0].to_string() }};
rust
//.flag("-arch=sm_52") .flag("-prec-div=true") .flag("-prec-sqrt=true") .pic(true) .include("cuda_kernels") .include("/usr/local/cuda/include") .file("kernels/cast_kernels.cu") .file("kernels/reduce_kernels.cu") //.file("kernels/stats_kernels.cu") .file("kernels/special.cu")
rust
pub use instance::*; mod device; pub use device::*; mod receipt; pub use receipt::*; mod buffer; pub use buffer::*; mod texture; pub use texture::*;
rust
pub fn size_refl(&self) -> Equiv<N, N> { Equiv::refl() } pub fn push(mut self, item: Item) -> Vect<Item, Add<N, typenum::consts::U1>> { self.0.extend(std::iter::once(item));
rust
} Ok(vals) } fn read_bytes_padded<R: io::Read>(r: &mut R, len: usize) -> Result<Vec<u8>> { // string length is rounded to the nearest 4 bytes let buflen = if len % 4 == 0 { len } else { len + (4 - (len % 4)) };
rust
do_test(4); t1.join().unwrap(); t2.join().unwrap();
rust
// Copyright 2020 <NAME> // SPDX-License-Identifier: Apache-2.0 use crate::Error; use bee_common::packable::{Packable, Read, Write}; use bee_message::milestone::MilestoneIndex; #[derive(Clone, Debug, Eq, PartialEq)] pub struct SnapshotInfo { pub(crate) network_id: u64, pub(crate) snapshot_index: MilestoneIndex,
rust
use super::owned_entity::OwnedEntity; #[derive(Debug, Clone)] pub enum EntityAction<P: ProtocolType, E: Copy> { SpawnEntity(E, Vec<P::Kind>), DespawnEntity(E), OwnEntity(OwnedEntity<E>), DisownEntity(OwnedEntity<E>), RewindEntity(OwnedEntity<E>), InsertComponent(E, P::Kind), UpdateComponent(E, P::Kind), RemoveComponent(E, P),
rust
// Copyright 2020 nytopop (<NAME>) // // 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 according to those terms. mod event; mod freqset; mod tumbler; pub use event::{Filter as EventFilter, Id as EventId}; pub use freqset::FreqSet; pub use tumbler::Tumbler;
rust
// // Responses::Program(v) => println!("{}", v), // // Responses::Class(v) => println!("{}", v), // // Responses::FreeStyle(t) => t.display(), // } }
rust
} else { lamports }; Ok(system_instruction::create_account( wallet_address, new_account_address, lamports, space as u64,
rust
map_virtual_address, map_virtual_address_unlazily }; } } } pub mod interrupts { cfg_if::cfg_if! { if #[cfg(target_arch = "x86_64")] { pub use x86_64::instructions::interrupts::{ are_enabled as are_interrupts_enabled,
rust
floor.mesh = mesh; floor.trs.translate(0.0, -0.6, 0.0); floor.trs.scale(16.0, 0.1, 16.0); root.children.push(model.nodes.push(floor)); // White material
rust
time: datetime::Time { hours: 22, minutes: 54, seconds: 44.0 }, latitude: TryFrom::try_from(49.2741666667).unwrap(), longitude: TryFrom::try_from(-123.18533333334).unwrap(), mode: Mode::Autonomous }))) );
rust
{ const UPPER_BOUND: u32 = T::UPPER_BOUND; fn get(&self, index: u32) -> bool { match self { None => false, Some(bits) => bits.get(index), } }
rust
/** * 本项目内的模块定义。 * 不定义本文件,无法使用项目中的自定义模块。 * * @author <NAME> * @email <EMAIL> * @date 2019/11/07
rust
color ); yew::html! { <span style=style class="badge"> { &self.value } { if self.editable { yew::html! { <crate::components::Svg icon="x" size=16
rust
mod l0266; mod l1646; mod l1654; mod data_struct; fn main() { println!("Hello, world!"); }
rust
const A_USIZE: usize = 'a' as usize; use std::collections::HashSet; impl Solution { pub fn find_anagrams(s: String, p: String) -> Vec<i32> { let s = s.chars().collect::<Vec<char>>(); let p = p.chars().collect::<Vec<char>>(); let mut res = vec![]; if p.len()>s.len() { return res; } let mut p_counter = [0usize;26]; for c in &p {
rust
impl CachedData for CurrentHeadMessage { #[inline] fn cache_reader(&self) -> & dyn CacheReader { &self.body
rust
impl StaticContext { pub fn new(key: &str, value: &str) -> StaticContext { let mut m = HashMap::new(); m.insert(key.into(), d(value).trim().to_string()); StaticContext { aliases: m } } pub fn with(mut self, key: &str, value: &str) -> StaticContext { self.aliases.insert(key.into(), d(value).trim().to_string()); self } }
rust
None => {} } return None; } pub fn find_by_token(token: String) -> Option<User> { let sql = "select \n\ coalesce(u.id,a.id), coalesce(u.name, a.name), coalesce(u.email, a.email), coalesce(u.password, a.password) \n\ from zorya.tokens t \n\ left join zorya.users u on t.email = u.email \n\
rust
Playground::setup("cd_test_2", |dirs, _| { let actual = nu!( cwd: dirs.test(), r#" cd "{}" echo (pwd) "#, dirs.formats() );
rust
let mut rng = Xorshiftplus128Rng::new(&mut thread_rng()); println!("DEBUG: training (CUDA version)..."); sgd.reset_opt_stats(); sgd.init_param(&mut rng); for iter_nr in 0 .. 1000 { sgd.step(&mut train_data); if (iter_nr + 1) % 20 == 0 { println!("DEBUG: iter: {} stats: {:?}", iter_nr + 1, sgd.get_opt_stats()); sgd.reset_opt_stats(); } }
rust
} fn os_type(&self) -> Result<String, ReadoutError> { Ok(self .os_type_ctl .as_ref() .ok_or(MetricNotAvailable)? .value_string()?) } fn pretty_kernel(&self) -> Result<String, ReadoutError> { Ok(format!("{} {}", self.os_type()?, self.os_release()?)) } }
rust
impl Preferences for EncryptedPreferences { fn get_i32(&self, key: &str) -> Option<i32> { self.data.get(key).and_then(|v| match v { Value::I32(i32) => Some(i32.to_owned()),
rust
/// Set descriptor name of protobuf message #[clap(short, long)] descriptor: String, } impl CreateCollectionMetadataOptions { pub(super) async fn create(&self, config: &crate::Config) -> anyhow::Result<()> { let mut context = Context::new(config).await?; let response = context .submit_transaction(self.create_operation(), config.context_id.clone()) .await?; if let Err(err) = response { if err.code() == Code::AlreadyExists { eprintln!("ignoring existing collection: {}", self.name);
rust
#[test] #[should_panic] fn test_find_svgs_panic() { find_svgs(test_asset("/doesnt_exist")); } #[test] fn test_find_svgs() { assert_eq!(find_svgs(test_asset("/")), vec![test_asset("example.svg")]); assert_eq!( find_svgs(test_asset("example.svg")),
rust
#[derive(Packer)] #[packer(source = "tests/prefix")] struct Assets; assert_eq!( Assets::list().collect::<BTreeSet<_>>(), vec![ "tests/prefix/bar/baz", "tests/prefix/baz", "tests/prefix/xyzzy", ]
rust
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(tag = "type", content = "value")] pub enum ArgLabel { NoLabel, Labelled(String), Optional(String), } #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] #[serde(tag = "type", content = "value")] pub enum LongIdent {
rust
<gh_stars>10-100 fn main() { println!("Usage: `cargo run --bin day[01-25]`"); }
rust
let sk: SignerKey = encoded.parse().unwrap(); assert_eq!(sk, SignerKey::SIGNER_KEY_TYPE_ED25519(decoded)); } #[test] fn test_string_to_public_key() { let encoded = SPK; let decoded = uint256([ 216, 137, 24, 69, 91, 229, 19, 62, 173, 227, 178, 45, 215, 144, 101, 154, 163, 253, 33, 31, 108, 138, 64, 182, 177, 68, 174, 191, 48, 196, 121, 56, ]);
rust
<gh_stars>1-10 extern crate pwquality; use pwquality::PWQuality; fn main() { let pwq = PWQuality::new(); println!("{:?}", pwq.get_enforcing()); pwq.set_enforcing(false); println!("{:?}", pwq.get_enforcing()); println!("generated: {:?}", pwq.generate_password(1)); println!("score: {:?}", pwq.check("fdsi40trrg=()/5423nfds".to_owned(), None, None)); }
rust
user_id, error: UserError::new( ErrorCode::CanisterDidNotReply, format!( "Canister {} did not reply to the call", canister.canister_id() ), ), time, })
rust
/// warn-code = 3DIGIT /// warn-agent = ( uri-host [ ":" port ] ) / pseudonym /// ; the name or pseudonym of the server adding /// ; the Warning header field, for use in debugging /// ; a single "-" is recommended when agent unknown /// warn-text = quoted-string /// warn-date = DQUOTE HTTP-date DQUOTE /// ``` /// /// # Example values
rust
unimplemented!() } } // ## Operator Overloading impl PartialEq for BigInt { #[inline] fn eq(&self, other: &BigInt) -> bool { debug_assert!(self.test_invariant() && other.test_invariant());
rust
macro_rules! rev { (@ $mac:ident $(,$args:ident)* ; $a:expr ; $($c:expr),* ) => ( $mac!($($args),* ; $a $(,$c)* ) ); (@ $mac:ident $(,$args:ident)* ; $a:expr $(,$b:expr)* ; $($c:expr),* ) => ( rev!(@ $mac $(,$args)* ; $($b),* ; $a $(,$c)* ) ); ( $mac:ident $(,$args:ident)* ; $a:expr, ) => ( $mac!($($args),* ; $a ) ); ( $mac:ident $(,$args:ident)* ; $a:expr, $($b:expr,)* ) => ( rev!(@ $mac $(,$args)* ; $($b),* ; $a ) ); }
rust
mod post_start; pub use post_start::*; #[derive(Debug, Clone)] pub struct ComputerEnv { pub url: Option<Url>, pub token: Option<String>, }
rust
impl std::ops::Drop for HbBuffer { fn drop(&mut self) { unsafe { hb_buffer_destroy(self.raw); } } } pub(crate) struct HbFont { raw: *mut hb_font_t, } // Harbuzz is thread-safe
rust
#[doc = "Register `CTRLC` writer"] pub struct W(crate::W<CTRLC_SPEC>); impl core::ops::Deref for W { type Target = crate::W<CTRLC_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 }
rust
// Gate { name: None, gate_type: Some("RST"), periph: Some("RCC"), register: Some("APB1RSTR"), field: Some("I2C1RST"), description: None } impl ::bobbin_mcu::gate::GateRst for I2c1 { #[inline] fn gate_rst(&self) -> ::bobbin_bits::U1 { ::rcc::RCC.apb1rstr().i2c1rst() } #[inline] fn set_gate_rst<V: Into<::bobbin_bits::U1>>(&self, value: V) -> &Self { ::rcc::RCC.with_apb1rstr(|r| r.set_i2c1rst(value)); self } } // Gate { name: None, gate_type: Some("EN"), periph: Some("RCC"), register: Some("APB1ENR"), field: Some("I2C1EN"), description: None }
rust
**/ #[derive(Debug, PartialEq, Clone, Copy)] pub enum Symbol { Lparen, Rparen, Lbrack,
rust
fn nelem_delta() -> usize { NELEM_DELTA } // definitions #[derive(Serialize, Deserialize, Debug)] pub struct Array { #[serde(default = "nelem_delta")] nelem_delta: usize, }
rust
proptest! { #[test] fn flat_map((a, b) in (1..65536).prop_flat_map(|a| (Just(a), 0..a))) { assert!(a > b); } } proptest! { #[test]
rust
#[derive(Copy, Clone, Debug, PartialEq)] #[repr(C, align(16))] pub struct max_align_t([i64; 4]);
rust
} pub fn do_root_layout( theme: &NotationTheme, state: &NotationAppState, settings: &NotationSettings, layout_query: &mut LayoutQuery, panel_query: &ViewQuery<ControlView>, content_query: &ViewQuery<TabViewer>, entity: Entity, view: &Arc<NotationViewer>, ) { if theme._bypass_systems { return; } let engine = NotationLayout::new(&theme, &state, &settings); let constraint = LayoutConstraint::from((engine.state.window_width, engine.state.window_height));
rust
Some(v) => v.clone(), None => Operand::Consume(base.clone().unwrap().field(n)), }) .collect(); block.and(Rvalue::Aggregate(AggregateKind::Adt(adt_def, variant_index, substs), fields)) } ExprKind::Literal { .. } | ExprKind::Block { .. } | ExprKind::Match { .. } |
rust
{ pub fn new_box(name: String) -> Self { // This will handle closures that don't mutate themselves let f_on_update = Box::new(|e: &mut UpdateEvent| {}); Render { name, f_on_update } } } impl Render<fn(&mut UpdateEvent)> {
rust
values.push_back(Rc::new(token.into())); } Ok(Code { value_pointer: 0, values, labels, }) } /// This function updates the value_pointer to have the value of jump_location
rust
BottomRight, TopStart, TopEnd, BottomStart, BottomEnd, }
rust
match *a_region { // Check if this relationship is implied by a given. ty::ReEarlyBound(_) | ty::ReFree(_) => { if self.data.givens.contains(&(a_region, b_vid)) { debug!("given"); return false; } }
rust
type Output = Self; fn sub(self, other: Self) -> Self { Self { data: [ self.data[0] - other.data[0], self.data[1] - other.data[1], self.data[2] - other.data[2], ], }
rust
let mut context = Context::new(config).await?; let image = if let Some(file_name) = &self.file { let mut image_file = File::open(file_name)?; let mut image: Vec<u8> = Vec::new(); image_file.read_to_end(&mut image)?; image } else if let Some(data) = &self.data { base64::decode(data)? } else { eprintln!("Neither image file or data given"); return Err(anyhow::anyhow!("Required option missing")); };
rust
// Decode query result to a utf8 string let result_str = std::str::from_utf8(&response); // Log if there's an error if result_str.is_err() { log::error!("unable to decode result from bytes: {:#x?}", response); } // Wrap error with a better message, and return Result result_str .map_err(|e| { err_msg(&format!(
rust
impl Solution { pub fn reverse_string(s: &mut Vec<char>) { let s_len = s.len(); for idx in 0..s_len/2 { // swap s[idx] s[s_len - 1 - idx] s[idx] = (s[idx] as u8 ^ s[s_len - 1 - idx] as u8) as char; s[s_len - 1 - idx] = (s[idx] as u8 ^ s[s_len - 1 - idx] as u8) as char; s[idx] = (s[idx] as u8 ^ s[s_len - 1 - idx] as u8) as char; } }
rust
impl ITaskbarList2T for ITaskbarList4 {} impl ITaskbarList3T for ITaskbarList4 {} impl ITaskbarList4T for ITaskbarList4 {} /// Exposes the [`ITaskbarList4`](crate::shell::ITaskbarList4) methods. pub trait ITaskbarList4T: ITaskbarList3T { /// [`ITaskbarList4::SetTabProperties`](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist4-settabproperties) /// method. fn SetTabProperties(&self, hwnd_tab: HWND, stp_flags: shell::co::STPFLAG) -> WinResult<()> { unsafe { let vt = &**(self.ptr().0 as *mut *mut ITaskbarList4VT);
rust
if let Some(freq) = states.memory_label_highest { println!(" HIGHEST {}", freq.to_string()); } println!(); println!("Curves:"); for curve in states.curve_labels.iter() { println!( " {:>10} {:>10}", curve.freq.to_string(), curve.voltage.to_string() ); } println!(); } Ok(())
rust
crate::{context::AuthorizedUpdate, state::bucket::Collateral}, anchor_lang::prelude::*, }; pub fn handle(ctx: Context<AuthorizedUpdate>, allocations: Vec<Collateral>) -> ProgramResult { ctx.accounts .bucket
rust
.zip(data.chunks_exact_mut(PIXEL_BYTES)) { let dest_alpha = dest[3]; for (src, dest) in src.iter().zip(dest) { *dest = (*dest).saturating_add( ((*src).conv::<u16>() * (u8::MAX - dest_alpha).conv::<u16>() / u8::MAX.conv::<u16>()) .try_conv::<u8>() .expect("infallible"), ); } }
rust
} */ pub fn publish(&mut self, topic: &str, message: &str) { debug!("Publishing"); self._channel.basic_publish( types::EXCHANGE_NAME, topic, false, false, BasicProperties {
rust
try!(writeln!(dest, "#[derive(Clone, Debug)]")); try!(writeln!(dest, "pub enum Instruction {{")); dest.ident(); { for op in grammar["instructions"].members() { try!(writeln!(dest, "{name}({name}),", name=op["opname"])); } } dest.unident(); try!(writeln!(dest, "}}")); try!(writeln!(dest, "")); try!(writeln!(dest, "impl Instruction {{")); dest.ident(); { try!(writeln!(dest, "pub fn from_raw(opcode: OpCode, view: &mut RawInstructionView) -> Result<Self, ReadError> {{")); dest.ident(); { try!(writeln!(dest, "let instr = match opcode {{")); dest.ident(); { for op in grammar["instructions"].members() { try!(writeln!(dest, "OpCode::{name} => Instruction::{name}(try!({name}::read(view))),", name=op["opname"])); } } dest.unident(); try!(writeln!(dest, "}};"));
rust
#[inline] fn dh(&self, public: &ed25519::PublicKey) -> SharedSecret { self.exchange(public) } } impl Dh for ed25519::SecretKey { fn name() -> &'static str {
rust
} #[inline] pub fn as_str(&self) -> &str { str::from_utf8(self.as_slice()).unwrap_or("") } #[inline]
rust
} #[test] fn historical_event_for_date_range() { assert!(space_rx::send(&CompanyHistoryRequestBuilder::default().start("2017-06-22").end("2018-06-25").build().unwrap()).is_ok()); }
rust
#![allow(dead_code)] pub mod compiler; pub mod interpreter; pub mod vm; pub mod vmobjects;
rust
_ptr.with_not_null_return(0, |requirements| requirements.multisampling.unwrap_or(0)) } #[no_mangle] pub fn glutin_pixel_format_requirements_is_stereoscopy( _ptr: *mut ValueBox<PixelFormatRequirements>, ) -> bool { _ptr.with_not_null_return(false, |requirements| requirements.stereoscopy)
rust
pub const INDENTATION_STEP: u8 = 4; //////////////////////////////////////////////////////////////////////////////// /// A stack allocated string type that's convertible into /// [`PanicVal<'static>`](PanicVal),
rust
} impl Frame { pub fn from_address(&self, address: usize, num_pages: usize) -> Frame { Frame{ number: address / PAGE_SIZE, num_pages: num_pages, } } pub fn start_address(&self) -> PhysicalAddress { self.number * PAGE_SIZE }
rust
} fn parse_tuple_variant( ident: Ident, path_name: Option<String>, fields: Iter<'_, Field>, ) -> TokenStream { if fields.clone().count() != 1 { abort!(Diagnostic::new( Level::Error, "Tuple variants may only have a single field.".into() ))
rust
n = n / 10i64; num.push(rem); } for i in 1..num.len() { for j in 0..i { if num[i] < num[j] { num.swap(i, j); num[..i].sort_by_key(|&v| std::cmp::Reverse(v));
rust
return Ok(true); } Token::Pending => continue, } }
rust
pub mod account; pub mod login;