text stringlengths 8 4.13M |
|---|
pub use self::device::Device;
pub use self::device::Adapter;
pub use self::device::AdapterType;
pub use self::instance::Instance;
pub use self::surface::Surface;
pub use self::surface::Swapchain;
pub use self::surface::SwapchainError;
pub use self::surface::WSIFence;
pub use self::command::CommandBuffer;
pub use self::... |
// Copyright (c) 2018-2022 Ministerio de Fomento
// Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC)
// 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 ... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[repr(transparent)]
#[doc(hidden)]
pub struct IVariablePhotoCapturedEventArgs(pub ::windows::core::IInspectable);
unsafe impl ::windows::core::Interface for IVariablePhotoCapturedEventArgs {... |
use std::collections::HashMap;
use std::io::{self, Read};
fn get_input() -> u32 {
let mut data = String::new();
io::stdin().read_to_string(&mut data).expect("Couldn't read stdin");
data.trim().parse().expect("Bad input")
}
fn layer(cell: u32) -> u32 {
(((cell - 1) as f64).sqrt().floor() as u32 + 1) / ... |
extern crate nalgebra as na;
extern crate piston_window;
extern crate itertools;
#[macro_use]
pub mod traits;
pub mod objects;
fn main() {
}
|
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::str::FromStr;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Copy, Default)]
pub enum Edition {
E2015,
E2018,
#[default]
E2021,
}
impl FromStr for Edition {
type Err = Box<dyn std::error:... |
fn rle_init() {}
|
use winapi::um::winuser::RAWHID;
use winapi::shared::hidpi::{PHIDP_PREPARSED_DATA, HidP_Input, HidP_GetUsageValue, HIDP_STATUS_SUCCESS, HIDP_STATUS_INCOMPATIBLE_REPORT_ID, HidP_GetUsages};
use winapi::shared::hidusage::USAGE;
use winapi::shared::ntdef::{PCHAR, ULONG, LONG};
use event::RawEvent;
use devices::{JoystickSt... |
//! Provides utilities for operating on the filesystem.
use std::fs::{self, create_dir_all, File};
use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
use notion_fail::{ExitCode, FailExt, Fallible, NotionFail, ResultExt};
pub fn touch(path: &Path) -> Fallible<File> {
if !path.is_file() {
let ... |
pub mod combinators;
pub mod modes;
pub mod random;
pub mod loading;
mod builder_ext;
mod plugin;
pub use builder_ext::*;
pub use plugin::*;
game_lib::fix_bevy_derive!(game_lib::bevy);
|
use text_grid::*;
#[test]
fn column_u8() {
struct Source {
a: u8,
b: u8,
}
impl CellsSource for Source {
fn fmt(f: &mut CellsFormatter<&Self>) {
f.column("a", |x| x.a);
f.column("b", |x| x.b);
}
}
do_test(
vec![Source { a: 100, b: 20... |
extern crate num_bigint;
extern crate num_traits;
extern crate hex;
extern crate rand;
extern crate openssl;
mod dh;
use num_bigint::{BigUint};
use num_bigint::*;
use num_traits::*;
use openssl::symm::{decrypt, Cipher, Crypter,encrypt};
use num_bigint::Sign::*;
use dh::*;
fn main() {
let mut alice = Dh::new();
... |
use crate::protocol::parts::option_part::{OptionId, OptionPart};
use crate::protocol::parts::option_value::OptionValue;
// The part is sent from the client to signal whether the implicit LOB
// streaming is started so that the server does not commit the current
// transaction even with auto-commit on while LOB streami... |
use std::sync::{Arc, RwLock};
use resources::*;
use sop::TweenState;
use state::*;
use storyboard::*;
use tween::*;
pub fn move_camera_to_tile(tile_x: usize, tile_y: usize, duration: f32) -> Story {
Story::Start(Box::new(MoveCameraToTile::new(tile_x, tile_y, duration)))
}
pub struct MoveCameraToTile {
start_... |
#[derive(Default)]
pub struct ResetLevel(pub bool);
|
#![deny(warnings)]
use clap::{App, Arg};
use ipmpsc::{Receiver, SharedRingBuffer};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let matches = App::new("ipmpsc-send")
.about("ipmpsc sender example")
.version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS"))
.arg... |
#![allow(unused)]
use std::f32::{consts::TAU, EPSILON};
// work around cargo bug
use crate::{
position::{SignedTilePosition, WorldCoords},
TilePosition,
};
pub fn floats_equal(f1: f32, f2: f32) -> bool {
(f1 - f2).abs() < EPSILON
}
#[allow(
clippy::as_conversions,
clippy::cast_precision_loss,
... |
use std::error::Error;
use tokio::sync::oneshot;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let (tx, rx) = oneshot::channel();
tokio::spawn(async move {
if let Err(_) = tx.send("abc") {
println!("failed send");
}
});
let r = rx.await?;
println!("r... |
//! A provider of ordered timestamps, exposed as a [`SequenceNumber`].
use std::sync::atomic::{AtomicU64, Ordering};
use crossbeam_utils::CachePadded;
use data_types::SequenceNumber;
/// A concurrency-safe provider of totally ordered [`SequenceNumber`] values.
///
/// Given a single [`TimestampOracle`] instance, the... |
use juniper::{GraphQLInputObject, GraphQLObject};
#[derive(GraphQLInputObject)]
struct ObjB {
id: i32,
}
#[derive(GraphQLObject)]
struct ObjA {
id: ObjB,
}
fn main() {}
|
//! Integration tests
pub mod health;
pub mod helpers;
pub mod user;
|
use bytes::{Bytes, BytesMut};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use data_types::{NamespaceId, TableId};
use dml::DmlWrite;
use generated_types::influxdata::pbdata::v1::DatabaseBatch;
use mutable_batch::MutableBatch;
use mutable_batch_lp::lines_to_batches;
use mutable_... |
use super::{Array, Index, Length, Slice};
use crate::htab;
use std::borrow::Borrow;
use std::collections::hash_map::RandomState;
use std::marker::PhantomData;
use std::{hash, iter};
struct Field<Q: ?Sized>(PhantomData<fn(&Q) -> &Q>);
impl<K: Borrow<Q>, Q: ?Sized + Eq + hash::Hash> htab::Field<K> for Field<Q> {
ty... |
use std::{fmt::Write, sync::Arc};
use crate::{
extensions::{Extension, ExtensionContext, ExtensionFactory, NextExecute, NextParseQuery},
parser::types::{ExecutableDocument, OperationType, Selection},
PathSegment, Response, ServerResult, Variables,
};
/// Logger extension
#[cfg_attr(docsrs, doc(cfg(feature... |
use parser::ArgumentParser;
use super::Store;
use super::{StoreTrue, StoreFalse};
use test_parser::{check_ok};
fn store_true(args: &[&str]) -> bool {
let mut verbose = false;
{
let mut ap = ArgumentParser::new();
ap.refer(&mut verbose)
.add_option(&["-t", "--true"], StoreTrue,
... |
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::ime::{Ime, ImeState};
use failure::ResultExt;
use fidl::endpoints::{ClientEnd, RequestStream, ServerEnd};
use fidl_fuchsia_ui_input as uii;
use ... |
use crate::clockin::{ClockAction, LineClockAction};
use crate::s_time::STime;
use gobble::*;
parser! {
(Date->(usize,usize,Option<isize>))
(common::UInt,last(ws__('/'),common::UInt),maybe(last(ws__('/'),common::Int)))
}
parser! {
(StrVal -> String)
or(common::Quoted,common::Ident)
}
parser! {
(Co... |
/*
Copyright 2020 Timo Saarinen
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
d... |
use rustc_hash::FxHashSet as HashSet;
pub const INPUT: &str = include_str!("../input.txt");
type Position = (i32, i32, i32);
pub fn parse_input(input: &str) -> HashSet<Position> {
let values = input
.trim()
.split(['\n', ','])
.map(|s| s.parse().unwrap())
.collect::<Vec<_>>();
... |
pub fn init_logging(modules: &[&str]) {
let mut logger = env_logger::Builder::new();
logger.format(|buffer, record: &log::Record| {
use std::io::Write;
use env_logger::fmt::Color;
let mut prefix_style = buffer.style();
let prefix;
match record.level() {
log::Level::Trace => {
prefix = "Trace: ";
... |
use std::net::UdpSocket as UdpSocketStd;
use tokio::net::UdpSocket as UdpSocketTokio;
use std::net::SocketAddr;
use tokio::reactor::Handle;
use std::io;
use super::TIMEOUT;
use std::time::Duration;
pub async fn udp_get(addr: &SocketAddr, data: Vec<u8>)
-> io::Result<Vec<u8>> {
let uss = UdpSocketStd::bind("0.... |
use crate::engine::messaging::messages::EntitySnapshot;
use std::collections::VecDeque;
use itertools::{diff_with, Diff};
const SNAPSHOT_HISTORY_MAX_SIZE: usize = 64;
pub struct SnapshotHistory {
history: VecDeque<SnapshotData>,
ack_baseline: Option<SnapshotData>,
}
struct SnapshotData {
pub entity_data... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::_2_CTL {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
use bitcoin::Network;
use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget, FeeEstimator};
use lightning_block_sync::BlockSource;
use tokio::runtime::Handle;
use self::{
bitcoind_client::BitcoindClient,
remote::{
block_source::RemoteBlockSource, broadcaster::RemoteBroadcaster... |
// Copyright 2022 Datafuse Labs.
//
// 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 ... |
extern crate libc;
extern crate std;
use super::os::errno;
pub fn anon_ram_alloc(size: usize) -> *mut libc::c_void {
// todo: handle flags, alignment
let addr = unsafe {
libc::mmap(
std::ptr::null_mut(),
size,
libc::PROT_READ | libc::PROT_WRITE,
... |
use dynlib::{VoidPtr,LoadWinDynLib,DynLibWin};
use std::alloc::Layout;
use crate::archives::packages::patches::{block::MAX_BLOCK_LENGTH};
type OodleLZDecompress = fn(
input: *mut u8, // buffer
input_size: u64, // buffer_size
output: *mut u8, // result
output_size: u64, // result_buffer_size... |
pub struct Dane {
pub port: u16,
pub pid: u32,
pub ile_graczy: i32,
pub zajecie_pamieci: u64,
pub obciazenie_serwera: f32,
pub zmienna1: String,
}
impl Dane{
pub fn new() -> Dane{
//let tablica_mem : Vec<u64> = vec![0u64; 10]; //20 wyzerowanych komórek
Dane {
po... |
#[derive(Debug, PartialEq)]
pub struct IO {
ports: Vec<u8>,
shift_offset: u8,
shift_value: u16,
}
impl IO {
pub fn new(ports: usize) -> IO {
IO {
ports: vec![0; ports],
shift_offset: 0,
shift_value: 0,
}
}
pub fn read(&self, port: usize) -> u... |
//! Iron middleware
/// Middleware for requests from the Matrix homeserver
mod matrix;
/// Middleware for requests from the Rocket.Chat server
mod rocketchat;
pub use self::matrix::AccessToken;
pub use self::rocketchat::RocketchatToken;
|
// error-pattern:unknown syntax expander
fn main() { #iamnotanextensionthatexists(""); } |
struct Solution;
impl Solution {
pub fn reverse(x: i32) -> i32 {
let (mut x, mut ret) = (x as i64, 0);
while x != 0 {
// pick the number at a time
ret = ret * 10 + x % 10;
// update the origin number
x = x / 10;
}
if ret > 2_i64.pow(3... |
use super::*;
impl<A: Array> From<A> for StackVec<A>
{
#[inline(always)]
fn from (
array: A,
) -> StackVec<A>
{
StackVec {
array: mem::ManuallyDrop::new(array),
len: A::LEN,
}
}
}
/// Grants [`Array`]s an [`.into_iter()`][`ArrayIntoIter::into_iter`]
... |
use sp_core::{Pair, Public, sr25519, H160, Bytes};
use bitg_runtime::{
AccountId, CurrencyId,
BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, SudoConfig, SystemConfig,
IndicesConfig, EvmConfig, StakingConfig, SessionConfig, AuthorityDiscoveryConfig,ContractsConfig,
WASM_BINARY,
TokenSymbol, TokensConfig,... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
use std::error::Error;
use std::fmt;
use std::time::SystemTime;
use rusqlite::{ Connection };
use reqwest::header;
//##: Global definitions
static USERAGENT: &str = "Hydra (PodcastIndex)/v0.1";
struct Podcast {
id: u64,
url: String,
title: String
}
#[derive(Debug)]
struct HydraError(String);
//##: Impleme... |
// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: MIT
use std::process;
use crate::{Choice, Error, Input, Message, Password, Question, Result};
/// The `dialog` backend.
///
/// This backend uses the external `dialog` program (not to be confused with this crate also called
/// `di... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//! X.509 parsing.
use crate::cert;
use crate::cert::der;
use crate::cert::der::Tag;
use crate::cert::Algo;
use crate::cert::Cert;
use crate::cert::Error;
use crate::ce... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use super::*;
/// Handles commands received from the peer, typically when we are acting in target role for A2DP
/// source and absolute volume support for... |
use std::{
future::Future,
pin::Pin,
task::{self, Poll},
time::Duration,
};
use pin_project_lite::pin_project;
use tokio::sync::oneshot;
use super::{
channel::{AddressSender, Sender},
MailboxError, SendError,
};
use crate::{clock::Sleep, handler::Message};
pub type Request<A, M> = MsgRequest<... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::IF1MCTL {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, ... |
#![feature(box_patterns)]
#![feature(repeat_generic_slice)]
#![feature(core_intrinsics)]
#[macro_use]
pub mod macros;
#[macro_use]
pub mod exec;
pub mod class;
pub mod gc;
extern crate libc;
extern crate llvm_sys as llvm;
extern crate rand;
extern crate rustc_hash;
|
use proconio::input;
use proconio::marker::Chars;
fn palindrome(s: &[char]) -> bool {
for l in 0..s.len() / 2 {
let r = s.len() - l - 1;
if s[l] != s[r] {
return false;
}
}
true
}
fn main() {
input! {
n: usize,
mut s: Chars,
};
if palindrome... |
extern crate sdl2;
use crate::cart::{Cart, CartConfig};
use crate::cart_header::{CartHardware, CartHeader};
use crate::cpu::Cpu;
use crate::frontend::{start_frontend, start_frontend_debug};
use crate::wla_symbols::WlaSymbols;
use failure::ResultExt;
use log::info;
use std::fs::File;
use std::io::{BufReader, Write};
us... |
use rocket_contrib::JSON;
use validation::user::UserSerializer;
use diesel::prelude::*;
use diesel;
use models::user::{UserModel, NewUser};
use schema::users;
use schema::users::dsl::*;
use helpers::db::DB;
#[post("/login", data = "<user_in>", format = "application/json")]
pub fn login(user_in: JSON<UserSerializer>... |
#![allow(clippy::single_match)]
use simple_logger::SimpleLogger;
use winit::{event_loop::EventLoop, window::WindowBuilder};
fn main() {
SimpleLogger::new().init().unwrap();
let event_loop = EventLoop::new();
let window = WindowBuilder::new().build(&event_loop).unwrap();
dbg!(window.available_monitors... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
#[repr(transparent)]
pub struct PhoneNumberFormat(pub i32);
impl PhoneNumberFormat {
pub const E164: Self = Self(0i32);
pub const International: Self = ... |
use super::*;
#[test]
fn with_greater_small_integer_right_returns_true() {
is_greater_than(|_, process| process.integer(-1), true)
}
#[test]
fn with_greater_small_integer_right_returns_false() {
is_greater_than(|_, process| process.integer(1), false)
}
#[test]
fn with_greater_big_integer_right_returns_true()... |
//! To run this code, clone the rusty_engine repository and run the command:
//!
//! cargo run --release --example sound
//! This is an example of playing sound by path. For playing music or sound effect presets, please
//! see the `music` or `sfx` examples.
use rusty_engine::prelude::*;
fn main() {
let mut ... |
use smart_contract::log;
use smart_contract::payload::Parameters;
use smart_contract_macros::smart_contract;
use serde_json::json;
// use uuid::Uuid;
use indradb::{Datastore, MemoryDatastore, Transaction, VertexQueryExt}; //::{MemoryDatastore};
// #[derive(Serialize, Deserialize)]
struct Contract {
store: MemoryD... |
pub const ECMA: u64 = 0xc96c5795d7870f42;
pub const ISO: u64 = 0xd800000000000000;
lazy_static! {
pub static ref ECMA_TABLE: [u64; 256] = make_table(ECMA);
pub static ref ISO_TABLE: [u64; 256] = make_table(ISO);
}
pub struct Digest {
table: [u64; 256],
initial: u64,
value: u64
}
pub trait Hasher6... |
use std::io::Read;
fn read<T: std::str::FromStr>() -> T {
let token: String = std::io::stdin()
.bytes()
.map(|c| c.ok().unwrap() as char)
.skip_while(|c| c.is_whitespace())
.take_while(|c| !c.is_whitespace())
.collect();
token.parse().ok().unwrap()
}
fn main() {
let... |
use num_bigint::BigInt;
use crate::function::PyFuncArgs;
use crate::pyobject::{PyContext, PyObjectRef, PyRef, PyResult, PyValue, TypeProtocol};
use crate::vm::VirtualMachine;
use super::objint;
use crate::obj::objtype::PyClassRef;
#[derive(Debug)]
pub struct PySlice {
// TODO: should be private
pub start: Op... |
pub mod qemu_virt;
|
pub mod client;
pub mod error;
pub mod server;
pub mod util;
#[cfg(test)]
mod tests {
use crate::client;
use crate::error;
use crate::server;
use crate::util;
#[test]
fn it_should_return_string_client() {
assert_eq!("subclient", client::client());
}
#[test]
fn it_should_re... |
#[doc = "Reader of register OR"]
pub type R = crate::R<u32, super::OR>;
#[doc = "Writer for register OR"]
pub type W = crate::W<u32, super::OR>;
#[doc = "Register OR `reset()`'s with value 0"]
impl crate::ResetValue for super::OR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
... |
use std::collections::{HashMap, HashSet};
use std::ops::RangeInclusive;
#[derive(Debug, Clone)]
struct Rule(RangeInclusive<i64>, RangeInclusive<i64>);
fn main() {
let mut lines = aoc::file_lines_iter("./day16.txt");
let mut rules : HashMap<String, Rule> = HashMap::new();
let mut line = lines.next().unwra... |
use failure::Error;
#[derive(Debug, Fail)]
pub enum AliEcsCtlError {
#[fail(display = "no monitor data for instance: {}", _0)]
NoMonitorData(String),
}
pub type Result<T> = ::std::result::Result<T, Error>;
|
// global variable
static START: i32 = 10;
// constant
const DECREMENT: i32 = 1;
fn main() {
// variables are mutable, mut keyword is optional
let mut c: i32 = START;
let d: i32 = 2; // unused variable
loop {
printf("%d\n", c);
c = c - DECREMENT;
if c == 0 {
... |
use enumflags2::BitFlags;
use failure_derive::Fail;
#[derive(Clone, Debug, PartialEq)]
pub struct CartHeader {
/// The title of the game. At most 16 bytes.
pub title: Vec<u8>,
/// Specifies what kind of physical cartridge this ROM comes with, e.g. a cartridge with a
/// memory bank controller.
pub... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
mod stack_with_min;
pub use self::stack_with_min::*;
|
mod error;
mod robot_client;
mod robot_command;
mod robot_config;
pub use error::*;
pub use robot_client::*;
pub use robot_command::*;
pub use robot_config::*;
|
mod models;
use models::*;
fn main() {
let c = Command::Create("s1".to_string());
let s = Stock::None.action(&c);
println!("{:?}", s);
let c2 = Command::Update(10);
let s2 = s.unwrap_or(Stock::None).action(&c2);
println!("{:?}", s2);
let s2_a = s2.clone().unwrap_or(Stock::None).action(&... |
pub struct AdventYear {
year: u16,
advents: Vec<Box<dyn Advent>>,
}
impl AdventYear {
pub fn new(year: u16, advents: Vec<Box<dyn Advent>>) -> Self {
Self { year, advents }
}
pub fn get_year(&self) -> u16 {
self.year
}
pub fn into_advents(self) -> Vec<Box<dyn Advent>> {
... |
// Copyright 2021 Datafuse Labs.
//
// 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 ... |
#[cfg(not(windows))]
fn compile_resource() {
// do nothing
}
#[cfg(windows)]
#[path = "src/view_assets_catalog.rs"]
pub(crate) mod resource_catalog;
#[cfg(windows)]
fn compile_resource() {
use resource_catalog as catalog;
use resw::*;
Build::with_two_languages(lang::LANG_CHS)
.resource(
... |
#[macro_use]
extern crate nom;
mod compiler;
mod parser;
mod vm;
fn main() {
vm::VM::run(vec![0, 8, 0, 6, 19, 64]);
let source = include_str!("../examples/first.🐛");
let parsed = parser::run(source);
println!("{:?}", parsed);
compiler::test(parsed);
}
|
use core::alloc::{AllocError, Layout};
use core::ptr::{self, NonNull};
/// Fallback for realloc that allocates a new region, copies old data
/// into the new region, and frees the old region.
#[inline]
pub unsafe fn realloc_fallback(
old_ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> Result... |
//! Helper struct that manages attributes.
//! It creates an `Attribute` instance if it does not exists or uses a cached one.
use std::cell::RefCell;
use std::collections::HashMap;
use std::fmt::{self, Debug};
use std::fs;
use std::path::Path;
use std::string::String;
use crate::utils::OrErr;
use crate::{Attribute, E... |
use crate::name::Name;
use crate::rr_type::RRType;
use crate::util::{hex::from_hex, StringBuffer};
use anyhow::{anyhow, bail, Result};
use std::net::{Ipv4Addr, Ipv6Addr};
use time::{Date, Time};
pub fn name_from_str(buf: &mut StringBuffer) -> Result<Name> {
buf.read::<Name>()
}
pub fn ipv4_from_str(buf: &mut Stri... |
// Copyright 2017 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 ... |
use cranelift_entity::entity_impl;
use intrusive_collections::linked_list::{Cursor, LinkedList};
use intrusive_collections::{LinkedListLink, UnsafeRef};
use super::*;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Block(u32);
entity_impl!(Block, "block");
impl Default for Block {
#[inline... |
use super::lgamma_r;
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn lgamma(x: f64) -> f64 {
lgamma_r(x).0
}
|
// auto generated, do not modify.
// created: Mon Feb 22 23:57:02 2016
// src-file: /QtWidgets/qerrormessage.h
// dst-file: /src/widgets/qerrormessage.rs
//
// header block begin =>
#![feature(libc)]
#![feature(core)]
#![feature(collections)]
extern crate libc;
use self::libc::*;
// <= header block end
// main bloc... |
use std::convert::TryInto;
use std::sync::Arc;
use liblumen_core::locks::Mutex;
use liblumen_alloc::erts::term::prelude::*;
use crate::executor::Executor;
#[native_implemented::label]
pub fn result(apply_returned: Term, executor: Term) -> Term {
let executor_boxed_resource: Boxed<Resource> = executor.try_into()... |
#![crate_type="lib"]
#![no_std]
#![feature(box_syntax, drop_types_in_const, compiler_builtins_lib)]
#![feature(lang_items, start, alloc, global_allocator, allocator_api, link_args)]
#![feature(slice_concat_ext)]
#[macro_use]
extern crate alloc;
extern crate libc;
extern crate nostd_io;
extern crate nostd_collections;... |
// Copyright 2019-2021 PureStake Inc.
// This file is part of Moonbeam.
// Moonbeam is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.... |
use {
super::*,
crate::{
app::*,
errors::ConfError,
path::PathAnchor,
},
regex::Regex,
ahash::AHashMap,
std::{
path::PathBuf,
},
};
/// Definition of how the user input should be checked
/// and maybe parsed to provide the arguments used
/// for execution or... |
/**
* author: KBuild<qwer7995@gmail.com>
* desc: file save example
*/
#![feature(io)] // use old_io
#![feature(path)] // use file path
#![feature(core)] // use as_slice
use std::old_io::{File, Append, ReadWrite};
use std::old_io::stdin;
use std::str::FromStr;
struct Book {
name : String,
cost : u32,
}
impl Boo... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// 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 ... |
use std::env;
fn main() {
let path = env::current_dir().unwrap();
let mut pir_cpp = path.clone();
pir_cpp.push("sealpir/pir.cpp");
let mut pir_server = path.clone();
pir_server.push("sealpir/pir_server.cpp");
let mut pir_client = path.clone();
pir_client.push("sealpir/pir_client.cpp");
... |
mod event;
mod event_manager;
mod event_writer;
mod oot;
pub use event_manager::EventManager;
pub use event_writer::EventWriter;
|
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::REPORTPER {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w... |
use itertools::Itertools;
use std::{
collections::{HashMap, HashSet, VecDeque},
io::{self, BufRead},
iter,
};
type Maze = HashMap<Point, Tile>;
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
struct Point(isize, isize);
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
enum Tile {
Wall,
Floor... |
use core::ffi::c_void;
use core::fmt::{self, Debug};
use core::mem::transmute;
use crate::erts::process::FrameWithArguments;
use crate::erts::term::closure::Definition;
use crate::erts::term::prelude::*;
use crate::erts::ModuleFunctionArity;
use crate::Arity;
use super::ffi::ErlangResult;
#[derive(Clone)]
pub struct... |
pub const TEXT_START_ADDR: i32 = 0x00400000;
pub const R_TYPES: [&str; 5] = ["add", "and", "or", "nor", "sub"];
pub const I_TYPES: [&str; 4] = ["addi", "andi", "ori", "li"];
/*
pub const REGISTER_IDENTIFIERS: [&str; 32] = ["$zero",
"$at",
"$v0",
"$v1",
"$a0",
"$a1",
"$a2",
"$a3",
"$t0"... |
#[doc = r"Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r"Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::PRUART {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &... |
pub fn run(path: &str) {
let freqs = parse_input(path);
let part_1_solution = part_1(&freqs);
println!("Day 1, part 1: {}", part_1_solution);
let part_2_solution = part_2(&freqs);
println!("Day 1, part 2: {}", part_2_solution);
}
pub fn parse_input(path: &str) -> Vec<i32> {
let data = std::fs... |
use crate::todo;
use crate::ui;
use crate::database;
use crate::key_binding;
use termion::{event::Key, raw::IntoRawMode, input::TermRead};
use tui::widgets::{Block, Borders, List, ListItem, Paragraph};
use tui::style::{Color, Modifier, Style};
use tui::layout::{Layout, Constraint, Direction};
use tui::text::{Span, Spa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.