text stringlengths 8 4.13M |
|---|
use std::sync::mpsc;
use std::sync::mpsc::channel;
use std::thread;
use std::time::*;
use std::sync::{Arc, Mutex};
use chrono::Local;
use rppal::gpio::Gpio;
use std::process::exit;
mod display;
mod keys;
mod ceiling;
mod clock_data;
mod player;
use display::*;
use keys::*;
use clock_data::*;
use ceiling::*;
use playe... |
use std::io::{stdout, Write};
use crossterm::{
cursor::MoveTo,
queue,
style::{style, Color, PrintStyledContent},
Result,
};
use super::variables::{Cell, Position, Size};
pub struct Map {
pub map: Vec<Vec<Cell>>,
pub size: Size,
}
impl Map {
pub fn new(map_size: Size, wall_cell_char: char... |
use super::super::{AccessType, Cpu, CpuMode, Cycles, Memory};
use util::bits::Bits as _;
const LOAD: bool = true;
const STORE: bool = false;
const POST: bool = false;
const PRE: bool = true;
const DEC: bool = false;
const INC: bool = true;
const WRITEBACK: bool = true;
const NO_WRITEBACK: bool = false;
const USER_... |
#[doc = "Reader of register RESULT_VAL2"]
pub type R = crate::R<u32, super::RESULT_VAL2>;
#[doc = "Reader of field `VALUE`"]
pub type VALUE_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Only used in case of Mutual cap with two counters (CSX = config.mutual_cap & config.csx_dual_cnt), this counter counts whe... |
use cope::singleton::react;
use cope_dom::elements::ElementBuilder;
use std::cell::Cell;
use web_sys::Element;
pub trait ElementBuilderClass {
fn class(self, name: &'static str, f: impl Fn() -> bool + 'static) -> Self;
}
impl<E: AsRef<Element>> ElementBuilderClass for ElementBuilder<E> {
fn class(self, name: ... |
#[doc = "Writer for register FMC_CSQICR"]
pub type W = crate::W<u32, super::FMC_CSQICR>;
#[doc = "Register FMC_CSQICR `reset()`'s with value 0"]
impl crate::ResetValue for super::FMC_CSQICR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Write proxy for field... |
use super::*;
impl<'ctx> Compiler<'ctx> {
pub fn codegen_pat(&self, vars: &mut Vars<'ctx>, pat_id: PatId, value: BasicValueEnum<'ctx>) {
let pat = &self.hir[pat_id];
match pat {
Pat::Lit(_) | hir::Pat::Ignore => {}
hir::Pat::Var { var, .. } => self.codegen_local_var(vars, *v... |
#[cfg(all(unix, not(target_os = "macos")))]
fn main() {
// add unix dependencies below
// println!("cargo:rustc-flags=-l readline");
}
#[cfg(target_os = "macos")]
fn main() {
// add macos dependencies below
// println!("cargo:rustc-flags=-l edit");
}
|
fn calculate_length(s: &String) -> usize {
s.len()
}
fn mutate(s: &mut String) {
s.push_str(", world");
}
fn no_dangle() -> String {
let s = String::from("hello");
s
}
fn main() {
let s1 = String::from("hello");
let len = calculate_length(&s1);
println!("length of {} is {}", s1, len);
... |
enum Movement {
// Variants
Up,
Down,
Left,
Right
}
fn move_insect(m: Movement){
// match is similar to switch
match m {
Movement::Up => println!("Moving to up"),
Movement::Down => println!("Moving to down"),
Movement::Left => println!("Moving to left"),
Movement::Right => println!("Movin... |
use lsp_types::*;
use rnix::{types::*, SyntaxNode, TextRange, TextSize, TokenAtOffset};
use std::{
collections::HashMap,
convert::TryFrom,
fmt::{Debug, Display, Formatter, Result},
path::PathBuf,
rc::Rc,
};
#[derive(Copy, Clone, PartialEq)]
pub enum Datatype {
Lambda,
Variable,
Attribut... |
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::iter::Peekable;
use std::str::Chars;
struct Lexer<'a> {
input: Peekable<Chars<'a>>,
}
enum Token {
LeftBrace,
RightBrace,
LeftBracket,
RightBracket,
Number { value: i32 },
Red,
EndOfFileToken,
}
impl<'a> Lexe... |
use bson::Document;
use crate::{
bson::doc,
client::session::TransactionPin,
cmap::{conn::PinnedConnectionHandle, Command, RawCommandResponse, StreamDescription},
error::Result,
operation::Retryability,
options::WriteConcern,
selection_criteria::SelectionCriteria,
};
use super::{OperationW... |
use std::cmp::Ordering;
use std::io;
use std::io::Write;
use rand::Rng;
pub fn run() -> Result<(), io::Error> {
println!("Guess a number!");
let secret_number = rand::thread_rng().gen_range(1, 101);
println!("secret number: {}", secret_number);
loop {
print!("Your guess: ");
io::stdo... |
pub fn largest_divisible_subset(nums: Vec<i32>) -> Vec<i32> {
if nums.len() == 0 {
return vec![];
}
let mut nums = nums;
nums.sort();
let n = nums.len();
let mut pointer: Vec<usize> = (0..n).collect();
let mut longest = vec![1; n];
let mut largest = 0;
let mut largest_index... |
#![feature(test)]
extern crate test;
extern crate panoradix;
use test::Bencher;
use panoradix::RadixSet;
#[bench]
fn stress_test(b: &mut Bencher) {
b.iter(|| {
let mut strings = RadixSet::<str>::new();
for word in WORDS.iter() {
strings.insert(word);
}
});
}
const WORDS... |
use mimir::rubber::Rubber;
/// Get creation date of an index as a timestamp.
pub fn get_index_creation_date(rubber: &mut Rubber, index: &str) -> Option<u64> {
let query = format!("/_cat/indices/{}?h=creation.date", index);
rubber
.get(&query)
.map_err(|err| warn!("could not query ES: {:?}", er... |
use crate::thin_client::ThinClient;
use std::net::SocketAddr;
use std::time::Duration;
pub fn create_client((rpc, tpu): (SocketAddr, SocketAddr), range: (u16, u16)) -> ThinClient {
let (_, transactions_socket) = solana_netutil::bind_in_range(range).unwrap();
ThinClient::new(rpc, tpu, transactions_socket)
}
pu... |
#[doc = "Register `MDIOS_CRDFR` reader"]
pub type R = crate::R<MDIOS_CRDFR_SPEC>;
#[doc = "Register `MDIOS_CRDFR` writer"]
pub type W = crate::W<MDIOS_CRDFR_SPEC>;
#[doc = "Field `CRDF` reader - CRDF"]
pub type CRDF_R = crate::FieldReader<u32>;
#[doc = "Field `CRDF` writer - CRDF"]
pub type CRDF_W<'a, REG, const O: u8>... |
//! Models for working with identities
use std::fmt;
use uuid::Uuid;
use validator::Validate;
use stq_static_resources::Provider;
use stq_types::UserId;
use schema::identities;
/// Payload for creating identity for users
#[derive(Debug, Serialize, Deserialize, Validate, Queryable, Insertable, Clone)]
#[table_name =... |
use std::fmt::Display;
use devise::{syn, Result};
use devise::ext::{SpanDiagnosticExt, quote_respanned};
use crate::http::uri;
use crate::syn::{Expr, Ident, Type, spanned::Spanned};
use crate::http_codegen::Optional;
use crate::syn_ext::IdentExt;
use crate::bang::uri_parsing::*;
use crate::proc_macro2::TokenStream;
u... |
fn main() {
let a: () = ();
let b = { 12; 87; 283 };
let c = { 12; 87; 283; };
let d = {};
let e = if false { };
let f = while false { };
println!("{:?} {:?} {:?} {:?} {:?} {:?}",
a, b, c, d, e, f);
}
|
use anyhow::{Context, Result};
const LIMIT_MESSAGES: &str = "--limit-messages=";
pub struct ParsedArgs {
pub cargo_args: Vec<String>,
pub limit_messages: usize,
pub help: bool,
}
impl ParsedArgs {
pub fn parse(mut passed_args: impl Iterator<Item = String>) -> Result<Self> {
let mut result = S... |
/**
* MIT License
*
* termusic - Copyright (c) 2021 Larry Hao
*
* 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 the rights
* to use, ... |
use crate::objectmemory::{Word, NIL_PTR, OOP};
use crate::utils::floor_divmod;
static RIGHT_MASKS: [i16; 17] = [
0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF,
0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, -1,
];
static ALL_ONES: i16 = -1;
#[derive(Debug, Default)]
pub stru... |
use std::io;
use std::net::SocketAddr;
use async_trait::async_trait;
use tokio::io::{AsyncRead, AsyncWrite};
use crate::utils::CommonAddr;
pub mod plain;
pub mod ws;
pub mod tls;
use plain::PlainStream;
trait IOStream: AsyncRead + AsyncWrite + Send + Sync + Unpin {}
#[async_trait]
pub trait AsyncConnect: Send + Sync... |
use crate::{
core::Context,
custom_client::ScraperScore,
embeds::{Author, Footer},
error::PpError,
util::{
constants::{AVATAR_URL, MAP_THUMB_URL, OSU_BASE},
datetime::how_long_ago_dynamic,
numbers::with_comma_int,
osu::prepare_beatmap_file,
CowUtils, ScoreExt,... |
use crate::blender_mesh_io;
use crate::draw_ui;
pub use blender_mesh_io::MeshExtension;
pub use draw_ui::DrawUI;
|
//! Contains various error enums.
/// Represents an error that arose during the "application" of an expression.
pub enum ApplicationError {
/// The expression in question lacked the appropriate number of arguments to proceed.
NumArgs(&'static str)
}
|
use proc_macro::TokenStream;
use quote::quote;
use std::iter::FromIterator;
use syn::parse::{Parse, ParseStream, Result};
use syn::punctuated::Punctuated;
use syn::{parse_macro_input, LitStr, Token};
mod keywords {
syn::custom_keyword!(say);
syn::custom_keyword!(loud);
}
struct Message {
pub message: LitS... |
#[doc = "Reader of register CH11_DBG_TCR"]
pub type R = crate::R<u32, super::CH11_DBG_TCR>;
impl R {}
|
use osqp_sys as ffi;
use std::mem;
use std::ptr;
use std::time::Duration;
use {float, Problem};
/// The linear system solver for OSQP to use.
#[derive(Clone, Debug, PartialEq)]
pub enum LinsysSolver {
Qdldl,
MklPardiso,
// Prevent exhaustive enum matching
#[doc(hidden)]
__Nonexhaustive,
}
macro_r... |
use crate::{bindings::Moebius, broadcaster::Broadcaster};
use ethers::prelude::*;
use log::info;
use std::sync::Arc;
pub struct MoebiusWatcher<M> {
#[allow(dead_code)]
client: Arc<M>,
moebius: Moebius<M>,
broadcaster: Broadcaster,
}
impl<M: Middleware + 'static> MoebiusWatcher<M> {
pub fn new(
... |
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(rename_all = "kebab-case")]
enum Opt {
Importance(reveal::importance::ImportanceOpt),
Curve(reveal::curve::CurveOpt),
Plot(reveal::plot::PlotOpt),
Convert(reveal::convert::ConvertOpt),
}
fn main() -> anyhow::Result<()> {
let opt = O... |
use std;
import std::task;
import std::comm;
#[test]
fn test_sleep() { task::sleep(1000000u); }
#[test]
fn test_unsupervise() {
fn f() { task::unsupervise(); fail; }
let foo = f;
task::spawn(foo);
}
#[test]
fn test_lib_spawn() {
fn foo() { log_err "Hello, World!"; }
let f = foo;
task::spawn(f... |
pub mod instruction;
pub mod interpreter;
pub mod parser;
|
pub mod format;
use md5::{Digest, Md5};
use std::path::PathBuf;
use tokio::task;
use url::Url;
pub fn file_name_from_url(url: &Url) -> String {
let path_segments = url.path_segments().unwrap();
let encoded = path_segments.last().unwrap();
let decode = percent_encoding::percent_decode(encoded.as_bytes());
... |
use crate::enums::{Align, CallbackTrigger, Color, Damage, Event, Font, FrameType, LabelType};
use crate::image::Image;
use crate::prelude::*;
use crate::utils::FlString;
use fltk_sys::output::*;
use std::{
ffi::{CStr, CString},
mem,
os::raw,
};
/// Creates an output widget
#[derive(WidgetBase, WidgetExt, I... |
use std::{
cmp,
io,
net::SocketAddr,
pin::Pin,
time::Duration,
};
use crate::{
diagnostics::*,
receive::Message,
server::{
OptionMessageExt,
Received,
},
};
use anyhow::Error;
use bytes::{
Buf,
Bytes,
BytesMut,
};
use futures::{
future::{
s... |
use super::super::prelude::{
HGDIOBJ
};
pub type GdiObject = HGDIOBJ; |
pub mod io;
pub mod debug;
pub mod multiboot;
|
// 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 ... |
// Copyright (c) 2017 oic developers
//
// 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. All files in the project carrying such notice may not be copied,
// mo... |
use utils::mod_pow;
use rand::{
Rng,
thread_rng
};
// MILLER-RABIN(n, t)
// INPUT: an odd integer `n >= 3` and security parameter `t >= 1`.
// OUTPUT: an answer to the question: "Is `n` prime?"
pub fn is_prime(candidate: u64) -> bool {
miller_rabin(candidate)
}
fn miller_rabin(candidate: u64) -> bool {
... |
fn main() {
// let mut x = 5;
// println!("The value of x is : {}",x);
// x = 6;
// println!("The value of x is : {}",x);
// 声明常量
// const MAX_POINTS: u32 = 100_000;
// shadowing
// let x = 5;
// let x = x + 1;
// let x = x * 2;
// println!("The value of x is : {}",x);
/... |
pub mod core;
pub mod transaction;
pub mod transport;
|
use arkecosystem_client::api::models::timestamp::Timestamp;
use serde_json::Value;
pub fn assert_timestamp_data(actual: &Timestamp, expected: &Value) {
assert_eq!(actual.epoch, expected["epoch"].as_u64().unwrap() as u32);
assert_eq!(actual.unix, expected["unix"].as_u64().unwrap() as u32);
assert_eq!(actual... |
use clap::{
App,
Arg,
ArgMatches,
};
use ham_core::{
ast_types::expression::{
Expression,
ExpressionBase,
},
stack::Stack,
};
use ham_manager::Manifest;
use question::Question;
use std::{
fs,
path::Path,
sync::Mutex,
};
fn commands() -> ArgMatches {
App::new("ham... |
//! Kafka Client
//!
//! Primary module of this library.
//!
//! Provides implementation for `KafkaClient` which is used to interact with Kafka
// pub re-export
pub use compression::Compression;
use error::{Result, Error};
use utils;
use protocol;
use connection::KafkaConnection;
use codecs::{ToByte, FromByte};
use s... |
fn main()
{
let mut a=23;
a= match (1,a)
{
(1,4)=>a+1,
(1,6..25)=>6,
_=>a+2
};
println!("{}",a);
}
|
use std::fmt;
use anyhow::Error;
use std::mem;
use unicode_normalization::UnicodeNormalization;
use zeroize::Zeroizing;
use crate::crypto::{gen_random_bytes, sha256_first_byte};
use crate::error::ErrorKind;
use crate::language::Language;
use crate::mnemonic_type::MnemonicType;
use crate::util::{checksum, BitWriter, Ite... |
//! Virtual machine errors.
/// A virtual machine error.
pub enum VmError {
/// An io error occurred.
Io(std::io::Error),
/// An instruction attempted to access an invalid register.
BadReg(u8),
/// An instruction invalid instruction was found.
BadInsn(u16),
/// An instruction attempted to overflow the st... |
use super::Dataset;
use super::Table;
impl<'c> Table<'c, Dataset> {
pub async fn by_id(&self, id: i32) -> Result<Dataset, sqlx::Error> {
sqlx::query_as(
r#"
SELECT "id", "short_name", "name", "description", "units"
FROM "dataset"
WHERE "id" = $1"#,
)
... |
fn main(){
let mut s1 = String::from("hello");
let s2 = &s1;
s1.push_str("World");
println!("{}", s2);
}
|
use crate::map::line::Line;
use crate::math::tuple::Tuple2;
use crate::math::util::float_zero;
use crate::math::vector::Vector2;
use crate::math::vector::Vector3;
use crate::world::world::World;
use crate::world::world::WORLD_CELL_SHIFT;
use std::collections::HashSet;
const GRAVITY: f32 = 0.028;
const FRICTION: f32 = ... |
//! Using [Message Passing] to Transfer Data Between Threads
//!
//! [message passing]: https://doc.rust-lang.org/book/ch16-02-threads.html
use std::error::Error;
use std::sync::mpsc;
use std::thread;
fn main() -> Result<(), Box<dyn Error>> {
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let ... |
use std::time::Duration;
use std::{collections::HashSet, sync::Arc};
use anyhow::Context;
use tokio::sync::{mpsc, oneshot};
use crate::core::GlobalRoot;
use crate::sequencer;
use crate::sequencer::error::SequencerError;
use crate::sequencer::reply::state_update::{DeployedContract, StateDiff};
use crate::sequencer::re... |
const PREAMBLE: usize = 25;
fn main() {
let input = std::fs::read_to_string("../input.txt").unwrap();
//let input = "35
//20
//15
//25
//47
//40
//62
//55
//65
//95
//102
//117
//150
//182
//127
//219
//299
//277
//309
//576";
let ... |
#[link(name = "ncurses")]
extern {
fn initscr();
fn endwin();
fn getch() -> u8;
fn mvaddch(y:i64, x:i64, c:u8);
fn refresh();
fn clear();
fn curs_set(on: i64);
fn cbreak();
fn nocbreak();
fn echo();
fn noecho();
}
pub fn addch(x:i64, y:i64, c: char){
unsafe {
mvaddch(y,x, c as u8);
... |
// https://beta.atcoder.jp/contests/abc002/tasks/abc002_3
macro_rules! scan {
($t:ty) => {
{
let mut line: String = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.trim().parse::<$t>().unwrap()
}
};
($($t:ty),*) => {
{
... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Access control register"]
pub acr: ACR,
#[doc = "0x04 - Power down key register"]
pub pdkeyr: PDKEYR,
#[doc = "0x08 - Flash non-secure key register"]
pub nskeyr: NSKEYR,
#[doc = "0x0c - Flash secure key register... |
use crate::animation::Animated;
use crate::audio::Player;
use crate::control;
use crate::image::Image;
use crate::map::Rect;
use anyhow::Result;
use getrandom::getrandom;
use randomize::PCG32;
use shipyard::EntityId;
use std::convert::TryInto;
use std::time::Instant;
use ultraviolet::{Vec2, Vec3};
#[derive(Debug, Part... |
pub trait Task {
fn run(&self);
fn is_stale(&self) -> bool;
}
|
#[doc = "Reader of register DDRCTRL_DRAMTMG6"]
pub type R = crate::R<u32, super::DDRCTRL_DRAMTMG6>;
#[doc = "Writer for register DDRCTRL_DRAMTMG6"]
pub type W = crate::W<u32, super::DDRCTRL_DRAMTMG6>;
#[doc = "Register DDRCTRL_DRAMTMG6 `reset()`'s with value 0x0202_0005"]
impl crate::ResetValue for super::DDRCTRL_DRAMT... |
// Copyright (c) 2019, Facebook, Inc.
// All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use cxx::CxxString;
use decl_provider::NoDeclProvider;
use hhbc_by_ref_compile::EnvFlags;
use oxidized::relative_path::Relativ... |
extern crate md5;
extern crate threadpool;
use std::collections::HashSet;
use std::{fs,fs::File};
use std::{io,io::Read};
use std::os::unix::fs::FileTypeExt;
use std::os::unix::fs::MetadataExt;
use std::path::PathBuf;
use std::sync::{Arc,Mutex};
use std::time::SystemTime;
use std::mem;
use threadpool::ThreadPool;
use... |
// Copyright 2018 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 ... |
extern crate piston;
extern crate graphics;
extern crate glutin_window;
extern crate opengl_graphics;
mod game;
mod level;
use piston::window::WindowSettings;
use piston::event::*;
use piston::input::keyboard::Key;
use glutin_window::GlutinWindow as Window;
use opengl_graphics::{ GlGraphics, OpenGL };
use game::Ga... |
extern crate bellperson;
extern crate blake2b_simd;
extern crate blake2s_simd;
extern crate byteorder;
extern crate ff;
extern crate paired;
extern crate rand;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate crypto;
#[cfg(test)]
extern crate digest;
pub mod circuit;
pub mod constants;
... |
//! Structs which contains the read data from binary documents
use std::io::{Cursor, Read};
use failure::{Error, ResultExt};
use crate::{
visitor::{Executor, ModelVisitor, Resources, XmlVisitor},
STR_ARSC,
};
#[derive(Debug)]
pub struct BufferedDecoder {
buffer: Box<[u8]>,
}
impl<T> From<T> for Buffere... |
#![no_std]
use core::{
ffi::c_void,
mem::{align_of, size_of},
ops::{Deref, DerefMut},
pin::Pin,
ptr::{self, NonNull},
};
use fnd::{
alloc::{Allocator, Layout, SystemAllocator},
containers::Array,
Unq,
};
#[cfg(not(any(target_pointer_width = "32", target_pointer_width = "64")))]
compil... |
use std::error::Error;
use std::fmt;
#[derive(Debug, Clone, PartialEq)]
pub struct ParseError {
message: String,
}
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter) -> std::result::Result<(), fmt::Error> {
write!(f, "Input error: {}", self.message)
}
}
impl Error for ParseE... |
use aoc_utils::read_file;
use day05::fold_polymer;
fn main() {
if let Ok(contents) = read_file("./input") {
let result: i32 = contents
.split("")
.filter_map(|s| if s == "" { None } else { s.chars().next() })
.fold(Vec::new(), fold_polymer)
.len() as i32;
... |
#[doc = "Register `DDRCTRL_ADDRMAP2` reader"]
pub type R = crate::R<DDRCTRL_ADDRMAP2_SPEC>;
#[doc = "Register `DDRCTRL_ADDRMAP2` writer"]
pub type W = crate::W<DDRCTRL_ADDRMAP2_SPEC>;
#[doc = "Field `ADDRMAP_COL_B2` reader - ADDRMAP_COL_B2"]
pub type ADDRMAP_COL_B2_R = crate::FieldReader;
#[doc = "Field `ADDRMAP_COL_B2... |
use std::rc::{Rc};
use ast::*;
use value::*;
use symbol::*;
use position::*;
use utils::*;
pub struct Env {
symbols: Vec<Value>
}
impl Env {
pub fn new() -> Env {
Env {
symbols: Vec::new()
}
}
pub fn get(&mut self, re: &SymbolRef) -> &mut Value {
let id = re.id();
while self.symbols.len() <= id {
... |
/**
* MIT License
*
* termusic - Copyright (c) 2021 Larry Hao
*
* 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 the rights
* to use, ... |
// Copyright 2019, 2020 Wingchain
//
// 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 rand;
use rand::Rng;
use rand::distributions::{Range, Sample};
use std::cmp;
use coordinate_utils::{overlaps_horizontal, overlaps_vertical, Rect, find_overlap_1d, overlaps};
const MAP_WIDTH: usize = 100;
const MAP_HEIGHT: usize = 100; // probably should be larger, but let's go with it
pub struct Dungeon {
ti... |
#[doc = "Reader of register INTR_M_MASKED"]
pub type R = crate::R<u32, super::INTR_M_MASKED>;
#[doc = "Reader of field `I2C_ARB_LOST`"]
pub type I2C_ARB_LOST_R = crate::R<bool, bool>;
#[doc = "Reader of field `I2C_NACK`"]
pub type I2C_NACK_R = crate::R<bool, bool>;
#[doc = "Reader of field `I2C_ACK`"]
pub type I2C_ACK_... |
use std::thread;
use std::time::Duration;
fn calculating_slowly(intensity: u32) -> u32 {
println!("Calculating slowly");
thread::sleep(Duration::from_secs(10));
intensity
}
fn main (){
println!("{}",calculating_slowly(5));
} |
table! {
posts (id) {
id -> Int4,
title -> Varchar,
body -> Text,
author_id -> Int4,
}
}
table! {
users (id) {
id -> Int4,
full_name -> Varchar,
email -> Text,
}
}
joinable!(posts -> users (author_id));
allow_tables_to_appear_in_same_query!(
... |
use crate::clocksync::ClockSyncer;
use std::borrow::Borrow;
/// The client interface while the client is in the initial [clock syncing
/// stage](super#stage-1---syncing-clock-stage).
#[derive(Debug)]
pub struct SyncingClock<ClockSyncerRefType>(ClockSyncerRefType)
where
ClockSyncerRefType: Borrow<ClockSyncer>;
im... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub mod usage_aggregates {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub a... |
fn main() {
println!("Hello, Github Action3");
}
|
//! This file contains look-up-tables used to set voltages used during
//! various categories of pixel refreshes.
#[rustfmt::skip]
pub(crate) const LUT_VCOM0: [u8; 44] = [
// The commented-out line below was used in a Ben Krasnow video explaining
// partial refreshes.
// 0x40, 0x17, 0x00, 0x00, 0x00, 0x02,
0x00, 0... |
/// Monotonic clock
pub trait Clock {
/// Return the current timestamp in ticks.
/// This is guaranteed to be monotonic, i.e. a call to now() will always return
/// a greater or equal value than earler calls.
fn now(&self) -> u64;
}
impl<T: Clock + ?Sized> Clock for &T {
fn now(&self) -> u64 {
... |
//! Old query API, where each operator is a single subgraph. Deprecated.
#![allow(missing_docs)]
use std::borrow::Cow;
use std::cell::RefCell;
use std::rc::Rc;
use super::context::Context;
use super::graph_ext::GraphExt;
use super::handoff::Iter;
use super::port::{RecvPort, SendCtx};
use crate::scheduled::graph::Hydr... |
#[macro_use]
extern crate thiserror;
pub mod admin;
pub mod system;
pub mod user;
|
// This file is part of dpdk. 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/dpdk/master/COPYRIGHT. No part of dpdk, including this file, may be copied, modified, propagated, or distributed except accordin... |
pub mod source;
pub use self::source::*;
pub mod gs;
pub use self::gs::*;
pub enum ObsData {}
|
#[doc = "Reader of register CTB_SW_STATUS"]
pub type R = crate::R<u32, super::CTB_SW_STATUS>;
#[doc = "Reader of field `OA0O_D51_STAT`"]
pub type OA0O_D51_STAT_R = crate::R<bool, bool>;
#[doc = "Reader of field `OA1O_D52_STAT`"]
pub type OA1O_D52_STAT_R = crate::R<bool, bool>;
#[doc = "Reader of field `OA1O_D62_STAT`"]... |
pub enum Texture {}
extern {
// pub fn rust_gs_texture_draw
// pub fn rust_gs_texture_destroy(this: *mut ImageFile);
}
|
use amethyst::core::{Hidden, Transform};
use amethyst::core::math::Vector3;
use amethyst::ecs::{Builder, Entity, EntityBuilder, World};
use amethyst::prelude::WorldExt;
use crate::components::{Fighter, Health, Mob, Name, Player, Tile};
use crate::map::{Map, TileType};
use crate::utils::sprite::{Sprite, SpriteHandler};... |
///
/// 解説 https://atcoder.jp/contests/abc196/editorial/930
///
fn dfs() {
}
fn main() {
proconio::input! {
H: u32,
W: u32,
A: u32,
B: u32
}
let mut dmap = vec![0; W*H];
// for x in dmap {
// println!("{:?}", x);
// }
let result = rec(A, W, 0, W*H... |
use byteutils;
use columnvalueops::ColumnValueOps;
use types::DbType;
use types::F64NoNaN;
use std::borrow::{Cow};
use std::fmt;
#[derive(Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub enum Variant {
Null,
Bytes(Vec<u8>),
StringLiteral(String),
SignedInteger(i64),
UnsignedInteger(u64),
Float... |
use util::{bitfields, bits::Bits, primitive_enum};
bitfields! {
/// 4000208h - IME - Interrupt Master Enable Register (R/W)
/// Bit Expl.
/// 0 Disable all interrupts (0=Disable All, 1=See [`InterruptEnable`])
/// 1-31 Not used
pub struct InterruptMasterEnable: u32 {
[0... |
/*
* Datadog API V1 Collection
*
* Collection of all Datadog Public endpoints.
*
* The version of the OpenAPI document: 1.0
* Contact: support@datadoghq.com
* Generated by: https://openapi-generator.tech
*/
/// TableWidgetRequest : Updated table widget.
#[derive(Clone, Debug, PartialEq, Serialize, Deseriali... |
use std::cell::RefCell;
use std::rc::Rc;
use super::super::nes::cartridge::cartridge::Cartridge;
use crate::ppu::ppu::Ppu;
pub const CARTRIDGE_SPACE_START: u16 = 0x4020;
const INTERNAL_RAM_START: u16 = 0x0000;
const INTERNAL_RAM_END: u16 = 0x1FFF;
const NES_PPU_REGISTER_START:u16 = 0x2000;
const NES_PPU_REGISTER_EN... |
use std::{convert::TryInto, path::PathBuf};
use anyhow::{bail, Result};
use futures::stream::StreamExt;
use mongodb::{
bson::{Bson, Document, RawDocumentBuf},
Client,
Collection,
Database,
};
use serde::de::DeserializeOwned;
use serde_json::Value;
use crate::{
bench::{drop_database, Benchmark, COL... |
use bson::{doc, Document};
use futures::{future::BoxFuture, FutureExt};
use crate::{
client::options::SessionOptions,
coll::options::CollectionOptions,
error::Result,
event::command::CommandEvent,
options::ReadConcern,
test::{log_uncaptured, EventClient},
ClientSession,
Collection,
};
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.