text stringlengths 8 4.13M |
|---|
use std::{num::NonZeroU32, sync::mpsc};
use vulkayes_core::log;
use vulkayes_window::winit::winit;
use winit::window::Window;
#[derive(Debug)]
pub enum InputEvent {
Exit,
WindowSize([NonZeroU32; 2])
}
impl super::ApplicationState {
/// Creates new `ApplicationState`. Uses the current thread as input thread and st... |
use std::fs::create_dir_all;
use std::path::PathBuf;
use anyhow::*;
use thiserror::private::PathAsDisplay;
use firefly_session::{Options, OutputType};
use firefly_util::emit::Emit;
use crate::diagnostics::*;
use crate::interner::{InternedInput, Interner};
pub trait CompilerOutput: CompilerDiagnostics + Interner {
... |
use std::fmt;
use std::fmt::Formatter;
use board::stones::group::GoGroup;
use board::stones::stone::Stone;
use display::display::GoDisplay;
use display::goshow::GoShow;
use go_rules::go_action::GoAction;
impl fmt::Display for Stone {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", ma... |
use crate::blockBufferPool::db::columns as cf;
use crate::blockBufferPool::db::{Backend, Column, DbCursor, IWriteBatch, TypedColumn};
use crate::blockBufferPool::BlocktreeError;
use crate::result::{Error, Result};
use byteorder::{BigEndian, ByteOrder};
use rocksdb::{
self, ColumnFamily, ColumnFamilyDescriptor, DB... |
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)]
#[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)]
#[repr(C)]
pub struct APPLETIDLIST {
pub count: i32,
pub pIIDList: *mut ::windows::core::GUID,
}
impl APPLETIDLIST {}
i... |
use crate::graph::JsGraph;
use crate::layout::force_simulation::coordinates::JsCoordinates;
use js_sys::Function;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn fm3(
graph: &JsGraph,
min_size: usize,
step_iteration: usize,
_shrink_node: Function,
_shrink_edge: Function,
_link_distance_acc... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//! Generated certificate test data.
//!
//! Do not edit this file by hand; regenerate it with
//! `src/cert/testdata/generate.sh` instead. You'll need to install the
//... |
// 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 ... |
// *****************************************************************************
//
// This program 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 2 of the License, or (at your option) any la... |
//use std::os;
use std::path::PathBuf;
use std::env;
//use std::old_path;// would prefer os::change_dir() to not need this
// really just a wrapper around os::change_dir()
// returns 0 for success and 1 for failure
pub fn ch_dir(dest: PathBuf) -> i32 {
match env::set_current_dir(&dest) {
Ok(..) => 0,
... |
use actix_service::{Service, Transform, Void};
use futures::future::{ok, FutureResult};
use futures::{Async, Future, Poll};
use super::counter::{Counter, CounterGuard};
/// InFlight - new service for service that can limit number of in-flight
/// async requests.
///
/// Default number of in-flight requests is 15
pub ... |
//! Smart contract with initialization function.
use near_bindgen::near_bindgen;
use borsh::{BorshDeserialize, BorshSerialize};
#[near_bindgen]
#[derive(Default, BorshDeserialize, BorshSerialize)]
struct Incrementer {
value: u32,
}
#[near_bindgen(init => new)]
impl Incrementer {
pub fn inc(&mut self, by: u32... |
use std::fmt;
use std::fmt::{Display};
use std::panic;
use std::sync::{Arc, Mutex};
use pa;
use signal::ExprSignal;
use sample::Signal;
pub struct Player {
pa: pa::PortAudio,
stream_settings: pa::OutputStreamSettings<i8>,
stream: Option<pa::Stream<pa::NonBlocking, pa::Output<i8>>>,
}
#[derive(Copy, Clone... |
use rbatis_macro_driver::CRUDTable;
use serde::Deserialize;
use serde::Serialize;
use wallets_macro::{db_append_shared, db_sub_struct, DbBeforeSave, DbBeforeUpdate};
use crate::kits;
use crate::ma::dao::{self, Shared};
#[db_append_shared]
#[derive(PartialEq, Serialize, Deserialize, Clone, Debug, Default, CRUDTable, ... |
// This file is Copyright its original authors, visible in version control
// history.
//
// This file is 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.
// You may... |
//! Optional transform.
#![deny(missing_docs)]
use crate::{event::Event, transforms::Transform};
/// Optional transform.
/// Passes events through the specified transform is any, otherwise passes them,
/// as-is.
/// Useful to avoid boxing the transforms.
pub struct Optional<T: Transform>(pub Option<T>);
impl<T: Tr... |
mod command;
pub use command::_Command; |
struct UserInfo{
name :String
}
// impl user_info {
// fn GetUserInfoName(&self) {
// }
// }
fn main() {
println!("Hello, world!");
}
|
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Lobby {}
|
/*
* Copyright © 2019-today Peter M. Stahl pemistahl@gmail.com
*
* 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 a... |
pub use VkDebugUtilsMessengerCallbackDataFlagsEXT::*;
#[repr(u32)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VkDebugUtilsMessengerCallbackDataFlagsEXT {
VK_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_NULL_BIT = 0,
}
use crate::SetupVkFlags;
#[repr(C)]
#[derive(Clone, Copy, Eq, PartialEq, Hash)]
pub struct Vk... |
use rustgrep::Config;
use std::{env, process};
fn main() {
let conf = Config::new(env::args()).unwrap_or_else(|err| {
println!("Problem parsing arguments: {}", err);
process::exit(1);
});
println!("Searching for '{}'\nIn file '{}'", &conf.query, &conf.file);
if let Err(e) = rustgrep::... |
//! Supporting redcode types
use std::fmt;
/// Address in a core
pub type Address = u32;
/// `Field` Value
pub type Value = i16;
/// Process ID
pub type Pid = u16;
/// P-space PIN
pub type Pin = Pid;
/// Operations that a redcode processor can perform
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum OpCode
... |
/*
* Copyright 2020 Draphar
*
* 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 writi... |
use std::collections::HashMap;
pub struct Action {
pub id: String,
pub player_id: String,
pub exec_id: String,
pub data: HashMap<String, ActionData>,
}
impl Action {
pub fn new(_pid: &str, _eid: &str) -> Action {
let id = [_pid, _eid].join("");
let player_id = _pid.to_string();
... |
use crate::Error;
use std::sync::Mutex;
pub(crate) struct ServiceReference {
counter: &'static Mutex<usize>,
close: Box<dyn Fn() + Send + Sync>,
}
impl ServiceReference {
pub fn new<S, E>(
counter: &'static Mutex<usize>,
allow_multiple: bool,
start: S,
close: E,
) -> cra... |
#[cfg(not(target_os = "fuchsia"))]
use crate::backend::fd::AsFd;
#[cfg(any(feature = "fs", not(target_os = "fuchsia")))]
use crate::{backend, io};
#[cfg(feature = "fs")]
use {
crate::ffi::{CStr, CString},
crate::path::{self, SMALL_PATH_BUFFER_SIZE},
alloc::vec::Vec,
};
/// `chdir(path)`—Change the current ... |
use std::collections::HashSet;
use std::fmt;
use firefly_diagnostics::{SourceSpan, Span, Spanned};
use firefly_intern::Ident;
use firefly_syntax_base::*;
use firefly_util::emit::Emit;
use crate::printer::PrettyPrinter;
use super::*;
#[derive(Debug, Clone, Spanned, PartialEq, Eq)]
pub struct Module {
#[span]
... |
use crate::prelude::*;
#[repr(C)]
#[derive(Debug)]
pub struct VkSparseImageMemoryRequirements {
pub formatProperties: VkSparseImageFormatProperties,
pub imageMipTailFirstLod: u32,
pub imageMipTailSize: VkDeviceSize,
pub imageMipTailOffset: VkDeviceSize,
pub imageMipTailStride: VkDeviceSize,
}
|
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;
#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;
fn... |
use aoc_runner_derive::{aoc, aoc_generator};
#[derive(Debug, PartialEq)]
enum Command {
North,
South,
East,
West,
Left,
Right,
Forward,
}
#[derive(Debug, PartialEq)]
struct Instruction {
command: Command,
value: i32,
}
#[derive(Debug)]
struct Ferry {
direction: i16,
x: i32... |
use alloc::boxed::Box;
use alloc::vec::Vec;
use lazy_static::lazy_static;
use pc_keyboard::{layouts, DecodedKey, HandleControl, Keyboard, ScancodeSet1};
use spin::Mutex;
use x86_64::instructions::port::Port;
lazy_static! {
static ref KEYBOARD: Mutex<Keyboard<layouts::Us104Key, ScancodeSet1>> = Mutex::new(
... |
#![allow(dead_code)]
use std::fs::File;
use std::io::Write;
use crate::{code_writer::VmCodeWriter, parser::VmParser};
pub struct VmTranslator {
parser: VmParser,
writer: VmCodeWriter,
}
impl VmTranslator {
pub fn new() -> Self {
Self {
parser: VmParser::new(),
writer: VmCo... |
#[doc = "Reader of register RX_ORDSET"]
pub type R = crate::R<u32, super::RX_ORDSET>;
#[doc = "Reader of field `RXORDSET`"]
pub type RXORDSET_R = crate::R<u8, u8>;
#[doc = "Reader of field `RXSOP3OF4`"]
pub type RXSOP3OF4_R = crate::R<bool, bool>;
#[doc = "Reader of field `RXSOPKINVALID`"]
pub type RXSOPKINVALID_R = cr... |
use std::collections::HashMap;
use std::fs;
use std::time::Instant;
fn main() {
let start = Instant::now();
let str_test = fs::read_to_string("example.txt").expect("Error in reading file");
let mut test_rules : Rules = Rules {the_rules: HashMap::new(), contained_in: HashMap::new()};
test_rules.parse_a... |
use crate::{types::BigS, types::ShuffleProof as Proof, Error, Module, Trait};
use crypto::{
helper::Helper,
proofs::shuffle::ShuffleProof,
types::{
BigT, BigY, Cipher as BigCipher, ElGamalParams, ModuloOperations, PublicKey,
},
};
use num_bigint::BigUint;
use num_traits::One;
use sp_std::{vec, v... |
//player.rs
//
//
use super::item_bag::ItemBag as Bag;
use quicksilver::{geom::Vector, graphics::Color};
pub struct Player {
pub pos: Vector,
pub ch: char, // xxx
pub money: i32,
pub energy: i32,
pub name: String,
pub satchel: Bag,
pub color: Color,
pub act: bool,
}
impl Player {
pu... |
use std::collections::HashMap;
use std::panic::{panic_any, UnwindSafe};
use std::{cell::RefCell, ops::Neg, rc::Rc};
use crate::callable::LuxCallable;
use crate::function::LuxFunction;
use crate::literal::Literal;
use crate::stmt::Stmt;
use crate::token::Token;
use crate::{
clock::Clock, environment::Environment, e... |
//https://leetcode.com/problems/find-the-highest-altitude/
use std::cmp::max;
impl Solution {
pub fn largest_altitude(gain: Vec<i32>) -> i32 {
let mut highest_altitude = 0;
let mut current_altitude = 0;
for int in &gain {
current_altitude += int;
highest_alt... |
use crate::{
builtins::{
builtin_func::PyNativeFunction,
descriptor::PyMethodDescriptor,
tuple::{IntoPyTuple, PyTupleRef},
PyBaseException, PyBaseExceptionRef, PyDictRef, PyModule, PyStrRef, PyType, PyTypeRef,
},
convert::ToPyObject,
function::{IntoPyNativeFn, PyMethodFla... |
use commons::math::*;
use ggez::conf::WindowMode;
use ggez::event::{self, Button, EventHandler, KeyCode, KeyMods, MouseButton};
use ggez::graphics::Color;
use ggez::{graphics, timer, Context, ContextBuilder, GameError, GameResult};
use nalgebra::{Point2, Vector2};
use specs::prelude::*;
use specs::{World, WorldExt};
us... |
use std::fs;
fn get_direction(seats: &Vec<Vec<char>>, row: usize, col: usize, row_dir: i32, col_dir: i32) -> bool {
let row = row as i32 + row_dir;
let col = col as i32 + col_dir;
if row < 0 || col < 0 || row >= seats.len() as i32 || col >= seats[0].len() as i32 {
return false;
}
match seat... |
use std::fmt;
use proc_macro2::Span;
use proc_macro_error::{Diagnostic, Level};
/// URL of the GraphQL specification (October 2021 Edition).
pub(crate) const SPEC_URL: &str = "https://spec.graphql.org/October2021";
pub(crate) enum Scope {
EnumDerive,
InputObjectDerive,
InterfaceAttr,
InterfaceDerive,... |
extern crate winapi;
extern crate ole32;
use std::ptr;
use std::mem;
use self::winapi::*;
#[derive(Debug)]
pub struct AudioSource {
audio_client: *mut IAudioClient,
render_client: *mut IAudioRenderClient,
channels: u32,
max_frames_in_buffer: u32,
bytes_per_frame: u32,
bytes_per_sample: u32,
... |
fn main() {
let mut sum = 0;
let bit_exp: u32 = 4;
let bit_frac: u32 = 3;
for exp in 0..2u64.pow(bit_exp) - 1 {
for frac in 0..2u64.pow(bit_frac) {
let mut e: f64 = exp as f64;
let mut m: f64 = 1.0;
if exp == 0 {
e = 1.0;
m = 0.... |
fn hello() {
println!("hello world");
}
fn demo(bool parameter) {
if parameter {
println!("One");
} else {
println!("Two");
}
}
fn factorial(i32 n) {
let mut result = 1;
for i in 1..n {
result = result * i;
}
println!("{}", result);
} |
// 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 ... |
/*
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 std::io;
use std::pin::Pin;
use std::task::Context;
use std::task::Poll;
use anyhow::anyhow;
use anyhow::Context as _;
use anyhow::Result;
use futures::io::BufWriter;
use futures::AsyncRead;
use futures::AsyncReadExt as _;
use futures::AsyncWrite;
use futures::AsyncWriteExt as _;
use crate::proto::kex;
use crate:... |
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri... |
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use super::super::VmmAction;
use logger::{Metric, METRICS};
use request::{Body, Error, ParsedRequest};
use vmm::vmm_config::logger::LoggerConfig;
pub fn parse_put_logger(body: &Body) -> Result<ParsedReque... |
//! Starting and maintaining processes, and the main entry point
use super::{sub_process::launch_python, Command, Handle, SharedReceiver, SubProcessEvent};
use anyhow::Context;
use pathfinder_common::Chain;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::{broadcast, mpsc, Mutex};
use tracing::Instrument;
... |
/*************************************************************************
* ph0llux:4fcc63e8c9eac6fae126761c91ea5dca3e9f6303efb0efc6939d58f2c124774c
*************************************************************************/
//! stdext module
// - STD
use std::env;
use std::num::ParseIntError;
// - internal
use crate... |
use {
super::ControlSettings,
derive_new::new,
rough::{
amethyst::{
controls::{HideCursor, WindowFocus},
core::{ecs::prelude::*, timing::Time, transform::Transform},
derive::SystemDesc,
renderer::Camera,
shrev::{EventChannel, ReaderId},
... |
use crate::generator::Generator;
/// An iterator constructed from a [Generator].
///
/// See [Generator::iter].
pub struct Iter<G> {
generator: G,
}
impl<G> Iter<G> {
pub(super) fn new(generator: G) -> Self {
Self { generator }
}
}
impl<G> Iterator for Iter<G>
where
G: Generator,
{
type I... |
// because registry is global and tests are concurrent, there is no way to test for completely
// empty registry
use liblumen_alloc::erts::term::prelude::*;
use crate::erlang;
use crate::erlang::registered_0::result;
use crate::test::with_process_arc;
#[test]
fn includes_registered_process_name() {
with_process_... |
use bintree_strrepr::Tree;
pub fn to_dotstring(tree: &Tree) -> String {
match tree {
Tree::Node { value, left, right } => {
format!("{}{}{}", value, to_dotstring(left), to_dotstring(right))
}
Tree::End => ".".to_string(),
}
}
pub fn from_dotstring(dotstr: &str) -> Tree {
... |
use telegram_bot::*;
use crate::game::Coord;
#[derive(Eq, PartialEq)]
pub enum GameState {
Normal,
Solved,
GameOver,
}
pub trait GridGame {
fn get_state(&self) -> GameState;
fn get_text(&self) -> String;
fn to_inline_keyboard(&self) -> InlineKeyboardMarkup;
fn interact(&mut self, coord: C... |
use std::cmp::min;
use num::range;
use uuid::Uuid;
use crate::Result;
pub mod ed25519;
/// 公開鍵アルゴリズムの機能を表す構造体。
///
pub struct PublicKeyImpl {
id: &'static str,
generate_key_pair: fn() -> Box<dyn KeyPair + 'static>,
generate_key_pair_from: fn(u64) -> Box<dyn KeyPair + 'static>,
restore_key_pair: fn(&[u8]) ->... |
// Input interface
pub trait Input {
// Computes fan strength
fn compute(&mut self) -> f64;
}
|
use entry::{Entry, Sequence};
/// A Write Buffer takes an `Entry` and returns `Sequence` data that facilitates reading entries
/// from the Write Buffer at a later time.
pub trait WriteBuffer: Sync + Send + std::fmt::Debug + 'static {
/// Send an `Entry` to the write buffer and return information that can be used ... |
/*
* Copyright (c) 2022, United States Government, as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All rights reserved.
*
* The RACE - Runtime for Airspace Concept Evaluation platform is licensed
* under the Apache License, Version 2.0 (the "License"); you may not use... |
/*-------------------------------
view.rs
画面描画関連を一つにまとめる
まとめた関数を、core_state.rsのggez EventHandlerに渡す
ゲーム内処理についてはgame_state.rsを参照のこと
* render_game() : ゲームの状況に合わせて、適切な部分を描画するおまとめ関数
* render_player(): プレイヤー周りを描画する
* render_enemy() :
* debug_render() :
* render_title() :
* render_titl... |
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)]
pub enum LaneType {
Unknown = -1,
Top = 0,
Middle = 1,
Bottom = 2,
Count = 3,
}
|
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type RequestingFocusOnKeyboardInputEventArgs = *mut ::core::ffi::c_void;
pub type SearchSuggestion = *mut ::core::ffi::c_void;
#[repr(transparent)]
pub stru... |
pub mod identify;
pub mod model_builder;
pub use model_builder::ModelBuilder;
pub use identify::code_ident;
pub use identify::java_ident;
pub use identify::js_ident;
pub use identify::rust_ident;
pub use identify::c_sharp_ident;
|
use crate::typegen::schema_types::{Type, TypeKind};
use crate::typegen::languages::TypeSection;
const RESERVED_WORDS: &'static [&'static str] = &[
"as", "break", "const", "continue", "crate", "else", "enum", "extern", "FALSE", "fn", "for",
"if", "impl", "in", "let", "loop", "match", "mod", "move", "mut", "pub"... |
extern crate mio;
extern crate tempdir;
extern crate mio_uds;
use std::io::{self, Write, Read};
use std::io::ErrorKind::WouldBlock;
use tempdir::TempDir;
use mio::*;
use mio_uds::*;
macro_rules! t {
($e:expr) => (match $e {
Ok(e) => e,
Err(e) => panic!("{} failed with {}", stringify!($e), e),
... |
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::swc_common;
use crate::swc_common::comments::Comments;
use crate::swc_common::errors::Diagnostic;
use crate::swc_common::errors::DiagnosticBuilder;
use crate::swc_common::errors::Emitter;
use crate::swc_common::errors::Handler;
use cr... |
use crate::error::{Error, Result};
use core::{
cmp::Ordering,
ffi::{c_long, c_ulong},
fmt,
mem::{self, MaybeUninit},
ptr::NonNull,
str::FromStr,
};
use std::{alloc, ffi::CString};
pub(crate) mod comparison;
pub(crate) mod conversions;
pub(crate) mod ops;
/// Multiple precision integer value.
#... |
#![feature(test)]
extern crate rtfmt;
extern crate test;
use std::collections::BTreeMap;
use rtfmt::{Generator, Value};
#[test]
fn pattern() {
assert_eq!("Hello, {name}!", Generator::new("Hello, {name}!").unwrap().pattern());
}
#[test]
fn literal() {
assert_eq!("hello", &Generator::new("hello").unwrap().co... |
pub(crate) mod event;
pub(crate) mod event_builder;
pub(crate) mod event_manager;
pub(crate) mod event_packet_writer;
pub(crate) mod event_type;
|
//! Contains components related to input, such as text modals
pub mod text_input_modal;
|
pub mod test_struct{
#[derive(Debug)]
pub struct User{
pub name:String,
pub age : u32,
pub password: String
}
impl User{
pub fn createUser(name:String,age:u32,password:String)->User{ //关联函数,和结构体相关联 User::createUser
User{name,age,password}
... |
//! 异步 virtio 前端驱动
#![no_std]
#![feature(llvm_asm)]
mod sbi;
mod log;
mod config;
mod util;
mod dma;
pub mod queue;
pub mod mmio;
pub mod block;
extern crate alloc;
pub type Result<T = ()> = core::result::Result<T, VirtIOError>;
// pub use mmio::*;
// pub use queue::*;
// pub use block::*;
/// 虚拟设备错误
#[derive(Debug... |
use super::editor::*;
use super::notebook::*;
///
/// Implementations of this trait host a scripting language used with FlowBetween.
///
pub trait FloScriptHost : Send+Sync {
type Notebook : FloScriptNotebook;
type Editor : FloScriptEditor;
///
/// Retrieves the script notebook for this host
... |
use super::*;
use super::masks::*;
impl Mask {
pub fn knight_attacks(self) -> Mask {
let x = self;
let a = ((x << 17) | (x >> 15)) & !A;
let b = ((x << 10) | (x >> 6)) & !(A | B);
let c = ((x << 15) | (x >> 17)) & !H;
let d = ((x << 6) | (x >> 10)) & !(G | H);
a | b ... |
mod color;
mod common;
mod mode;
mod opt;
use crate::common::*;
fn main() {
Opt::from_args().run();
}
|
use proconio::input;
fn main() {
input! {
x: i32,
y: i32
}
if (y % 2) == 0 && (y - 2 * x) >= 0 && (4 * x - y) >= 0 {
println!("Yes");
} else {
println!("No");
}
}
|
use byteorder::LittleEndian;
use crate::io::BufMut;
use crate::mysql::io::BufMutExt;
use crate::mysql::protocol::{AuthPlugin, Capabilities, Encode};
// https://dev.mysql.com/doc/dev/mysql-server/8.0.12/page_protocol_connection_phase_packets_protocol_handshake_response.html
// https://mariadb.com/kb/en/connection/#han... |
mod prueba;
use std::collections::HashMap;
use std::fs::File;
use std::io;
use std::io::BufRead;
use std::path::Path;
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
where P: AsRef<Path>, {
let file = File::open(filename)?;
Ok(io::BufReader::new(file).lines())
}
fn main(){
... |
// 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 ... |
use liblumen_alloc::erts::process::Process;
use liblumen_alloc::erts::term::prelude::*;
#[native_implemented::function(erlang:get_keys/0)]
pub fn result(process: &Process) -> Term {
process.get_keys()
}
|
#![crate_name = "needletail"]
//! Needletail is a crate to quickly and easily parse FASTA and FASTQ sequences out of
//! streams/files and manipulate and analyse that data.
//!
//! A contrived example of how to use it:
//! ```
//! extern crate needletail;
//! use needletail::{parse_fastx_file, Sequence, FastxReader};
/... |
use bstr::ByteSlice;
use crate::Channel;
use mint::Vector3;
use smallvec::SmallVec;
use std::{fmt, mem};
/// An alias for the type used for the `Joint::name`.
///
/// This is a byte string which may be valid `utf8`.
pub type JointName = SmallVec<[u8; mem::size_of::<String>()]>;
/// A `Joint` in a bvh skeleton.
#[deri... |
pub mod corridor;
pub mod cryobay;
pub mod cryocontrol;
pub mod slush_lobby;
pub use self::corridor::*;
pub use self::cryobay::*;
pub use self::cryocontrol::*;
pub use self::slush_lobby::*;
|
use nannou::color::{Hsl, IntoLinSrgba, Srgb};
pub trait Srgb8Extension {
fn into_hsl(&self) -> Hsl;
}
impl Srgb8Extension for Srgb<u8> {
fn into_hsl(&self) -> Hsl {
self.into_lin_srgba().into()
}
}
|
use anyhow::{anyhow, Context, Error, Result};
use crate::data;
use log::LevelFilter;
use log::{debug, error, info};
fn init() {
let _ = env_logger::builder()
.is_test(true)
.filter_level(LevelFilter::Debug)
.try_init();
}
fn do_test(name: &'static str, data: &'static str) -> Result<()> {... |
use std::{fs, collections::HashSet};
fn main() {
let binding = fs::read_to_string("input.txt").expect("Could not read input file");
let mut lines = binding.lines();
for line in lines {
println!("{}", line);
for i in 14..line.len() {
let mut slice = &line[i-14..i];
... |
use proconio::input;
fn main() {
input! {
h: usize,
w: usize,
a: [[u8; w]; h],
};
for i in 0..h {
for j in 0..w {
if a[i][j] == 0 {
print!(".");
} else {
let ch = (b'A' + a[i][j] - 1) as char;
print!("{... |
extern crate test;
use stringify::Stringify;
use std::ffi::{CStr, CString};
use std::borrow::Cow;
use self::test::Bencher;
#[bench]
fn convert_to_cow_str_bench(b: &mut Bencher) {
let i32var: i32 = 1;
b.iter(|| i32var.convert_to_cow_str());
}
#[bench]
fn convert_to_cstr_bench(b: &mut Bencher) {
let i32var: i32 ... |
extern crate snap;
use wasm_rpc_macros::export;
use snap::Encoder;
use std::io;
use std::io::Write;
#[export]
pub fn run(data: Vec<u8>) -> Vec<u8> {
Encoder::new().compress_vec(&data).unwrap()
}
|
use std::time::Duration;
use std::iter::Iterator;
use std::u64::{MAX as U64_MAX};
/// A retry strategy driven by exponential back-off.
///
/// The power corresponds to the number of past attempts.
#[derive(Clone)]
pub struct ExponentialBackoff {
current: u64,
base: u64
}
impl ExponentialBackoff {
/// Cons... |
use std::any::Any;
use std::marker::PhantomData;
use crate::{DefaultMutator, Mutator};
pub type VoidMutator = UnitMutator<()>;
impl DefaultMutator for () {
type Mutator = VoidMutator;
#[no_coverage]
fn default_mutator() -> Self::Mutator {
Self::Mutator::new((), 0.0)
}
}
pub type PhantomDataM... |
use specs::World;
use input::Input;
pub fn add_input_resource(world: &mut World) {
world.add_resource::<Input>(Input::default());
}
|
pub mod allocator;
pub mod init;
|
/*!
Builders used to set up a fuzz test.
This module contains 5 types to build a fuzz test: `FuzzerBuilder[1–5]`.
The idea is to help you specify each part of the fuzzer progressively:
1. the function to fuzz
2. the [mutator](crate::Mutator) to generate arguments to the test function (called “inputs” or “test cases”)... |
use graph::Graph;
use binary_heap::PriorityTuple;
mod binary_search_tree;
mod binary_heap;
mod graph;
use binary_heap::BinaryHeap;
fn main() {
let mut graph = Graph::new(9);
// 3x3 grid where all nodes are connected on their cardinal directions
// 1 2 3
// 4 5 6
// 7 8 9
graph.add_edge(1,2);
... |
// Code based on https://github.com/defuz/sublimate/blob/master/src/core/syntax/style.rs
// released under the MIT license by @defuz
/// The foreground, background and font style
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct Style {
/// Foreground color.
pub foreground: Color,... |
pub mod fns {
/// Adds one to the number given.
///
/// # Examples
///
/// ```
/// let five = 5;
///
/// assert_eq!(6, mrust::plus_one(five));
/// ```
pub fn plus_one(num: i32) -> i32 {
num + 1
}
/// Reduces one to the number given.
///
/// # Examples
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.