text stringlengths 8 4.13M |
|---|
use std::fmt;
use rand::{distributions::Standard, prelude::Distribution, seq::SliceRandom, Rng};
use crate::payload::Generator;
use super::{choose_or_not, common};
#[derive(Debug, Clone)]
pub(crate) struct EventGenerator {
pub(crate) titles: Vec<String>,
pub(crate) texts_or_messages: Vec<String>,
pub(cr... |
#[doc = "Reader of register AREF_CTRL"]
pub type R = crate::R<u32, super::AREF_CTRL>;
#[doc = "Writer for register AREF_CTRL"]
pub type W = crate::W<u32, super::AREF_CTRL>;
#[doc = "Register AREF_CTRL `reset()`'s with value 0"]
impl crate::ResetValue for super::AREF_CTRL {
type Type = u32;
#[inline(always)]
... |
use gdnative::prelude::*;
pub fn init_panic_hook() {
// To enable backtrace, you will need the `backtrace` crate to be included in your cargo.toml, or
// a version of Rust where backtrace is included in the standard library (e.g. Rust nightly as of the date of publishing)
// use backtrace::Backtrace;
... |
extern crate byteorder;
// #[cfg(test)]
// #[macro_use]
// extern crate quickcheck;
pub mod varint;
pub mod vbyte;
// #[cfg(test)]
// mod tests;
|
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate log;
extern crate env_logger;
extern crate docopt;
extern crate sat;
use std::path::Path;
use std::fs::File;
use std::io::Read;
use docopt::Docopt;
use sat::parse;
use sat::{Satness, SATSolver};
use sat::{naive, watch, nonchro};
// Write the Do... |
use crate::layout::{LayoutBox, Rect};
use crate::paint::entity::{DisplayCommand, DisplayList};
use crate::paint::utils::get_color;
pub fn render_borders(list: &mut DisplayList, layout_box: &LayoutBox) {
let color = match get_color(layout_box, "border-color") {
Some(color) => color,
_ => return,
... |
use table::{TableRow, TableHeader, Table};
use definitions::{ResultColumn, RusqlStatement, InsertDef, SelectDef};
use definitions::{AlterTableDef, AlterTable, Expression, FromClause, JoinOperator};
use definitions::{DeleteDef, InsertDataSource, UpdateDef, Order, JoinConstraint};
use definitions::{BinaryOperator};
use e... |
pub struct LeisureParameters {}
impl LeisureParameters {
pub fn new() -> LeisureParameters {
LeisureParameters {}
}
}
impl Default for LeisureParameters {
fn default() -> Self {
LeisureParameters::new()
}
}
|
//#![feature(test)]
#![feature(box_patterns)]
#![feature(cow_is_borrowed)]
extern crate fancy_regex;
pub mod builtin;
pub mod error;
pub mod globals;
pub mod loader;
pub mod parse;
pub mod test;
pub mod util;
pub mod value;
pub mod vm;
pub use crate::builtin::enumerator::*;
pub use crate::builtin::fiber::*;
pub use cra... |
use std::{
fs::File,
io::prelude::*,
net::{ TcpListener, TcpStream },
};
// let device = rodio::default_output_device().unwrap();
// let sink = Sink::new(&device);
// sink.append(source);
// thread::sleep(Duration::from_secs(10));
// sink.pause();
// thread::sleep(Duration::from_sec... |
use core::ptr::Unique;
use spin::Mutex;
use arch::cpuio::Port;
macro_rules! println {
($fmt:expr) => (print!(concat!($fmt, "\n")));
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
}
macro_rules! print {
($($arg:tt)*) => ({
use core::fmt::Write;
$crate::vga::WRITER.loc... |
//! We define the custom scalars present in the GitHub schema. More precise types could be provided here (see tests), as long as they are deserializable.
pub type X509Certificate = String;
pub type URI = String;
pub type HTML = String;
pub type GitTimestamp = String;
pub type GitSSHRemote = String;
pub type GitObjectI... |
use std::error::Error;
use std::fmt::Display;
use std::net::SocketAddr;
use std::path::PathBuf;
use native_dialog::FileDialog;
use skulpin::skia_safe::*;
use crate::app::{paint, AppState, StateArgs};
use crate::assets::{Assets, ColorScheme};
use crate::net::{Message, Peer};
use crate::ui::*;
use crate::util::get_wind... |
//
// Copyright 2021 The Project Oak 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 required by applicable law o... |
#![feature(trace_macros)]
trace_macros!(true);
#[macro_use]
extern crate native_versioning;
mod c {
pub type long = u16;
}
versioned_extern! {
static demo: c::long;
pub static demo2: usize;
#[cfg(test)]
#[doc = "hi"]
fn f() -> usize;
pub fn g();
}
pub fn main() { }
|
use builder::Builder;
pub fn gen_intrinsics(builder : &mut Builder) {
let int_type = builder.int32_type();
let string_type = builder.string_type();
let void_type = builder.void_type();
builder.declare_function(
"puts", vec!(string_type), int_type
);
builder.declare_variadic_function(
... |
use std::{
borrow::Borrow,
collections::{BTreeMap, BTreeSet},
};
use petgraph::{graph::NodeIndex, Graph};
use thiserror::Error;
use crate::{
binding::{apply_bindings, find_bindings, BindingStorage, Formula, FormulaError, ManualAnyFunctionBinding},
expr::{ExprPositionOwned, Expression, ExpressionExtension, Express... |
use std::time::Duration;
use std::time::Instant;
const INPUT_MAX: u8 = 8;
#[derive(Debug, PartialEq)]
struct Player {
name: String,
word: String,
found: bool,
time: Duration,
}
fn main() {
let mut p1 = get_player("player_1");
let mut p2 = get_player("player_2");
println!(
"******... |
#[allow(dead_code)]
mod rsbf {
use std::collections::HashMap;
fn jump_table(code: &str) -> HashMap<usize, usize> {
let mut jumps = HashMap::new();
let mut stack : Vec<usize> = Vec::new();
for (index, c) in code.char_indices() {
match c {
'[' => stack.push(ind... |
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_derive;
#[macro_use]
pub mod error;
pub mod audio_decoder;
pub mod audio_encoder;
pub mod filter;
pub mod filter_graph;
pub mod format_context;
pub mod frame;
pub mod order;
pub mod packet;
pub mod prelude;
pub mod probe;
pub mod stream;
pub mod subtitle_... |
extern crate rand;
use rand::Rng;
use std::io;
use std::cmp::Ordering;
fn main() {
println!("请猜测数字,1-100之间!");
let mut count = 0;
let rand_num = rand::thread_rng().gen_range(1, 101);
loop {
let mut number= String::new();
io::stdin().read_line(&mut number)
.ok().expect("获取... |
use std::thread;
use std::time::Duration;
fn spawned_not_completing () {
println!("--- 1 ---");
thread::spawn(|| {
for i in 1..10 {
println!("1. [spawned thread] {}", i);
thread::sleep(Duration::from_millis(1));
}
});
for i in 1..5 {
println!("1. [main th... |
#![doc = "generated by AutoRust 0.1.0"]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
use super::{models, API_VERSION};
#[non_exhaustive]
#[derive(Debug, thiserror :: Error)]
#[allow(non_camel_case_types)]
pub enum Error {
#[error(transparent)]
MetricBaseline_Get(#[from] metric_bas... |
mod stdout;
fn main() {
stdout::greeting();
}
|
use std::process::Command;
let mut echo_hello = Command::new("sh");
echo_hello.arg("-c")
.arg("echo hello");
let hello_1 = echo_hello.output().expect("failed to execute process");
let hello_2 = echo_hello.output().expect("failed to execute process"); |
use hex;
fn main() {
find_the_xor(
&hex::decode("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736")
.unwrap(),
);
}
fn score_ascii_byte(c: u8) -> i64 {
let c = if b'A' <= c && c <= b'Z' {
c - b'A' + b'a'
} else {
c
};
return match c as ch... |
/// A color.
#[derive(Debug)]
pub struct Color {
pub red: u8,
pub green: u8,
pub blue: u8,
pub alpha: u8
}
impl Color {
/// Create a color with a alpha value of 255
pub fn new(red: u8, green: u8, blue: u8) -> Color {
Color {
red,
green,
blue,
... |
use bevy::prelude::*;
use crate::{WINDOW_WIDTH, WINDOW_HEIGHT, Materials, collider::Collider};
const WALL_THICKNESS: f32 = 10.;
const WALL_LEFT_X: f32 = WALL_THICKNESS / 2. - WINDOW_WIDTH / 2.;
const WALL_RIGHT_X: f32 = WINDOW_WIDTH / 2. - WALL_THICKNESS / 2.;
const WALL_TOP_Y: f32 = WINDOW_HEIGHT / 2. - WALL_... |
use crate::requests::health_check_get::{HealthCheckRequester, Request as HealthCheckRequest};
use crate::requests::metrics_mixes_get::{MetricsMixRequester, Request as MetricsMixRequest};
use crate::requests::metrics_mixes_post::{MetricsMixPoster, Request as MetricsMixPost};
use crate::requests::presence_coconodes_post:... |
use crate::errors::SdError;
use libc::pid_t;
use nix::unistd;
use std::os::unix::net::UnixDatagram;
use std::{env, fmt, fs, path, time};
/// Check for systemd presence at runtime.
///
/// Return true if the system was booted with systemd.
/// This check is based on the presence of the systemd
/// runtime directory.
pu... |
mod cli;
mod proxy;
#[async_std::main]
async fn main() -> std::io::Result<()> {
match futures::try_join!(
cli::run(),
proxy::run(),
) {
Err(e) => {
println!("Ошибка в процессе выполнения программы.");
println!("Информация об ошибке: {}", e);
}
_ =>... |
use anyhow::Context;
use parse_duration::parse as parse_duration;
use poise::{
command,
serenity::model::{
guild::Guild,
id::{ChannelId, UserId},
misc::Mentionable,
},
};
use tokio::time::Instant;
use url::Url;
use crate::{
constants::{
DESCRIPTION_LENGTH_CUTOFF, LIVE_IN... |
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate azure_core;
pub use azure_storage::{Error, Result};
mod clients;
mod message_ttl;
mod number_of_messages;
mod pop_receipt;
pub mod prelude;
mod queue_service_properties;
mod queue_stored_access_policy;
pub mod requests;
p... |
#[doc = "Reader of register ADC_LHTR1"]
pub type R = crate::R<u32, super::ADC_LHTR1>;
#[doc = "Writer for register ADC_LHTR1"]
pub type W = crate::W<u32, super::ADC_LHTR1>;
#[doc = "Register ADC_LHTR1 `reset()`'s with value 0x0fff_0000"]
impl crate::ResetValue for super::ADC_LHTR1 {
type Type = u32;
#[inline(al... |
extern crate bit_set;
extern crate rand;
use bit_set::BitSet;
use std::collections::HashMap;
// how does this differ from
// use crate::model::*; ?
use super::mating::*;
use super::model::*;
use super::parameters::*;
use super::population_founding::*;
///
/// Structure for capturing the simulation state.
///
#[deri... |
#[macro_use]
pub mod irq;
pub mod eabi;
pub mod semihosting;
pub use self::irq::{IrqHandler, STACK_START, start};
pub use self::cpu::isr::{VectorTable, ExceptionVectors, IrqContext};
#[cfg(target_cpu = "cortex-m0")] pub mod cortex_m0;
#[cfg(target_cpu = "cortex-m0")] pub use self::cortex_m0 as cpu;
#[cfg(target_cpu ... |
fn nearest_bus(estimate: i32, available: &Vec<i32>) -> (i32, i32) {
// let value: Vec<(usize, i32)> = available.iter().enumerate().map(|(idx, x)| (idx, ((estimate / x) + 1) * x)).collect();
// println!("{:?}", value);
let (idx, bus) = available.iter().enumerate().min_by_key(|(idx, x)| ((estimate / **x)... |
use parser::ast::{IntSize, PrimitiveType, TypeKind};
pub trait AatbeSizeOf {
fn size_of(&self) -> usize;
fn smallest(&self) -> usize;
}
impl AatbeSizeOf for PrimitiveType {
fn size_of(&self) -> usize {
match self {
PrimitiveType::UInt(IntSize::Bits8) => 1,
PrimitiveType::UI... |
#![cfg_attr(feature = "flame_it", feature(plugin, custom_attribute))]
#![cfg_attr(feature = "flame_it", plugin(flamer))]
#[macro_use]
extern crate structopt;
extern crate url;
#[macro_use]
extern crate log;
extern crate fern;
#[cfg(feature = "flame_it")]
extern crate flame;
extern crate ytdl;
// mod decipher;
// mod d... |
use chip8::{Address, Register};
use std::fmt;
macro_rules! no_opcode {
($x: expr) => {
panic!(format!("No OpCode for 0x{:04X} yet!", $x));
};
}
pub enum OpCode {
Set(Register, u8),
Copy(Register, Register),
Add(Register, u8),
AddVy(Register, Register),
SubVx(Register, Register),
... |
mod stack;
use stack::List;
use crate::FunctionalWindow;
use alga::general::AbstractGroup;
use alga::general::Operator;
use std::marker::PhantomData;
#[derive(Clone)]
pub struct Elem<T> {
val: T,
agg: T,
}
struct FOA<Value, BinOp>
where
Value: AbstractGroup<BinOp> + Clone,
BinOp: Operator,
{
fron... |
use graph::{Graph, NodeT};
use numpy::{PyArray1, PyArray2};
use pyo3::prelude::*;
#[pyclass]
#[derive(Clone)]
pub(crate) struct EnsmallenGraph {
pub(crate) graph: Graph,
}
pub type PyContexts = Py<PyArray2<NodeT>>;
pub type PyWords = Py<PyArray1<NodeT>>;
pub type PyFrequencies = Py<PyArray1<f64>>; |
/*
* 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
*/
/// OrganizationCreateResponse : Response object for an organization creation.
#[derive(Clone, Debug,... |
use crate::vec3::Vec3;
pub fn to_ppm_color(color: &Vec3) -> (i32, i32, i32) {
let ppm: Vec3 = color.sqrt().clamp(0.0, 0.999) * 256.0;
let vals: (f64, f64, f64) = ppm.into();
(vals.0 as i32, vals.1 as i32, vals.2 as i32)
} |
use crate::search::search_field::TermId;
use fnv::FnvHashSet;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum FilterResult {
Vec(Vec<TermId>),
Set(FnvHashSet<TermId>),
}
impl FilterResult {
pub fn from_result(res: &[TermId]) -> FilterResult {
if res.len() > 100_000 {
FilterRes... |
enum_impl! {
/// Operating system
Os {
/// Unknown operating system
Unknown => "unknown",
/// AIX
AIX => "aix",
/// AMDHSA
AMDHSA => "amdhsa",
/// AMDPAL
AMDPAL => "amdpal",
/// Ananas
Ananas => "ananas",
/// CUDA
C... |
#![recursion_limit = "1024"]
#![allow(clippy::needless_return)]
mod app;
mod backend;
mod components;
mod data;
mod error;
mod examples;
mod page;
mod pages;
mod preferences;
mod spy;
mod utils;
use crate::app::Main;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn run_app() -> Result<(), JsValue> {
wasm_logg... |
use good_memory_allocator::SpinLockedAllocator;
use x86_64::{
structures::paging::{
mapper::MapToError, FrameAllocator, Mapper, Page, PageTableFlags, Size4KiB,
},
VirtAddr,
};
use crate::memory::MemoryError;
#[global_allocator]
static ALLOCATOR: SpinLockedAllocator = SpinLockedAllocator::empty();
... |
//! Basic "can I connect to a router" tests.
use crate::integration::common::*;
use wamp_proto::{transport::websocket::WebsocketTransport, uri::Uri, Client, ClientConfig};
#[tokio::test]
async fn connect_close() {
let router = start_router().await;
let url = router.get_url();
let client_config = ClientC... |
#![allow(unused_variables)]
fn main() {
let list = Vec::<i32>::new();
// 05.rs:2:9: 2:13 warning: unused variable: `list`, #[warn(unused_variables)] on by default
// 05.rs:2 let list = Vec::<i32>::new();
// ^~~~
// 아래것들 다 가능
// 이를 Parametric Polymorphism
let list2 = Vec... |
//! Pre-defined SOCP solver
use super::prelude::*;
use std::io::Write;
/// Second-order cone program
///
/// <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML' async></script>
///
/// The problem is
/// \\[
/// \\begin{array}{ll}
/// {\\rm minimize} & f^T x \\\\
/... |
fn main() {
let mut memory: Vec<i32> = vec![];
// Find the input noun and verb that cause the program to produce the output 19690720.
'outer: for noun in 0..100 {
for verb in 0..100 {
memory = parse("1,0,0,3,1,1,2,3,1,3,4,3,1,5,0,3,2,6,1,19,1,5,19,23,1,13,23,27,1,6,27,31,2,31,13,35,1,9,35,39,2,39,13,43... |
pub mod provider;
|
use error_chain::error_chain;
use url::Url;
error_chain! {
foreign_links {
UrlParse(url::ParseError);
}
errors {
CannotBeABase
}
}
pub fn get_url() -> Result<()> {
let s = "https://github.com/rust-lang/rust/issues?labels=E-easy&state=open";
let parsed = Url::parse(s)?;
pr... |
fn main() {
proconio::input! {
n: usize,
a: [u64; n],
}
let e = 1000000007;
let mut a: Vec<u64> = a.clone();
a.sort();
let mut pre = 0;
let mut ans = 1;
for i in (0..n).rev() {
if pre == 0 {
pre = a[i];
continue;
}
if pre ... |
extern crate termion;
// http://ticki.github.io/blog/making-terminal-applications-in-rust-with-termion/
use std::io::{stdin, stdout, Write};
use termion::event::Key;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
fn sub_min_1(x : u16, y: u16) -> u16 {
if x <= 1 {
1
} else {
x - ... |
/*===============================================================================================*/
// Copyright 2016 Kyle Finlay
//
// 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
//
// ... |
use windows_dll::dll;
use winapi::shared::{
ntdef::VOID,
minwindef::BOOL,
windef::HWND,
ntdef::PVOID,
basetsd::SIZE_T,
};
#[test]
fn link_ordinal() {
#[dll("uxtheme.dll")]
extern "system" {
#[link_ordinal = 137]
fn flush_menu_themes() -> VOID;
}
}
#[test]
fn link_ord... |
extern crate regex;
pub mod date_time_tuple;
pub mod date_tuple;
mod date_utils;
pub mod month_tuple;
pub mod time_tuple;
|
#![doc = "generated by AutoRust 0.1.0"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Resource {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(d... |
use std::fs;
use std::collections::HashMap;
fn main() {
let lines = fs::read_to_string("./in.in").expect("Smth went wrong smh");
part1(lines.clone());
part2(lines);
}
fn part1(n : String) {
println!("Part 1: {}", work(n, 3, 1));
}
fn part2(n : String) {
let mut trees : usize = 1;
... |
/* Service Data Object */
/* SDO Is A Client / Server Type */
use super::CANOpen;
use crate::stm32hal::{common, can::CanMsg};
const IDE: bool = false; // CANOpen only uses normal ID
const S_OFFSET: u8 = 0;
const E_OFFSET: u8 = 1;
const N_OFFSET: u8 = 2;
const CCS_OFFSET: ... |
// thread 'rustc' panicked at 'no entry found for key'
// prusti-interface/src/environment/polonius_info.rs:1169:9
fn foo(ptr: *mut i32) {
let _ = ptr as *mut i32;
}
fn main() {}
|
use kagura::component::Cmd;
use kagura::prelude::*;
use std::collections::VecDeque;
pub struct Cmds<C: Component> {
cmds: VecDeque<Cmd<C>>,
}
impl<C: Component> Cmds<C> {
pub fn new() -> Self {
Self {
cmds: VecDeque::new(),
}
}
pub fn pop(&mut self) -> Cmd<C> {
if ... |
/*
* 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
*/
/// OrganizationBilling : A JSON array of billing type.
#[derive(Clone, Debug, PartialEq, Serialize, ... |
use diesel::insert_into;
use diesel::prelude::*;
use crate::common::*;
table! {
use diesel::sql_types::{Integer, Nullable};
use super::MyEnumMapping;
test_nullable {
id -> Integer,
my_enum -> Nullable<MyEnumMapping>,
}
}
#[derive(Insertable, Queryable, Identifiable, Debug, PartialEq)]... |
use std::{env, io};
use crossbeam_channel::SendError;
use thiserror::Error;
use crate::finder::NoteFindMessage;
#[derive(Error, Debug)]
pub enum NottoError {
#[error("context {context} not found")]
ContextNotFound { context: String },
#[error("context error from environment variable - {source}")]
Cont... |
use anyhow::{format_err, Error};
use rand::{
distributions::{Distribution, Uniform},
thread_rng,
};
use reqwest::{header::HeaderMap, redirect::Policy, Client, Response, Url};
use serde::Serialize;
use std::{collections::HashMap, future::Future, thread::sleep, time::Duration};
#[derive(Debug, Clone)]
pub struct... |
use std::borrow::Borrow;
use std::ops::Deref;
/// Wrapper struct for representing ownership of values in vulkan that implement
/// the `Copy` trait.
pub struct VkOwned<A: Copy, F: Fn(A)> {
value: A,
destroy_fn: F
}
impl<A: Copy, F: Fn(A)> VkOwned<A, F> {
/// Takes ownership of the previously-unowned vulkan... |
mod linalg;
mod cube;
use cube::*;
fn main() {
let mut cube = Cube::new();
cube.turns("F D Y L2 B2 D' X' B U2 R' F2 Z L B' R' Z' F' L2 U X' Y R2 D' F' X' X' D F D' Y F D2 L2 U' X").unwrap();
cube.print_ascii();
}
|
//! Get info on members of your Slack team.
use id::*;
use rtm::Cursor;
use rtm::{Paging, Team};
use timestamp::Timestamp;
/// Delete the user profile photo
///
/// Wraps https://api.slack.com/methods/users.deletePhoto
/// Gets user presence information.
///
/// Wraps https://api.slack.com/methods/users.getPresence
... |
const KEY_HANDLE_LENGTH: isize = 64;
pub struct KeyHandle(*mut u8);
impl KeyHandle {
pub fn from(ptr: *mut u8) -> KeyHandle {
KeyHandle(ptr)
}
pub fn is_null(&self) -> bool {
println!("checking if key handle is null...");
for i in 0..KEY_HANDLE_LENGTH {
unsafe {
... |
use crate::geometry::{SimpleRect, Vec2};
use sdl2::{
render::{Canvas, Texture},
video::Window,
};
use super::{text::FontAtlas, rendering::Drawable};
pub struct Sprite<'a> {
tex: &'a Texture<'a>,
sdl_rect: Option<sdl2::rect::Rect>,
pub rect: SimpleRect,
pub angle: f64,
pub flip_horizontal: b... |
#[doc = "Register `DTXFSTS2` reader"]
pub type R = crate::R<DTXFSTS2_SPEC>;
#[doc = "Field `INEPTFSAV` reader - IN endpoint TxFIFO space available"]
pub type INEPTFSAV_R = crate::FieldReader<u16>;
impl R {
#[doc = "Bits 0:15 - IN endpoint TxFIFO space available"]
#[inline(always)]
pub fn ineptfsav(&self) ->... |
#![deny(missing_docs)]
//! Core library for picross frontends.
mod board;
mod cell;
mod picross;
mod puzzle;
pub use board::Board;
pub use cell::Cell;
pub use picross::Picross;
pub use puzzle::{Constraint, ConstraintEntry, ConstraintGroup, Puzzle};
|
use structopt::StructOpt;
mod day01;
#[derive(Debug, StructOpt)]
#[structopt(name = "Advent of Code 2020", about = "Yearly challenge")]
struct CommandLineParams {
#[structopt(short = "-d", long)]
day: i32,
input_file: String,
}
fn main() {
let params = CommandLineParams::from_args();
println!("... |
table! {
categories (id) {
id -> Int4,
title -> Varchar,
user_id -> Int4,
created_at -> Nullable<Timestamp>,
}
}
table! {
comments (id) {
id -> Int4,
description -> Varchar,
user_id -> Int4,
created_at -> Nullable<Timestamp>,
}
}
table! {... |
// ===============================================================================
// Authors: AFRL/RQQA
// Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division
//
// Copyright (c) 2017 Government of the United State of America, as represented by
// the Secretary of th... |
fn largest_i32 (list: &[i32]) -> i32 {
let mut largest = list[0] ;
for &item in list {
if item > largest {
largest = item ;
}
}
largest
}
fn largest_char (list: &[char]) -> char {
let mut largest = list[0] ;
for &item in list {
if item > largest {
largest = item ;
}
}
largest
}
fn largest<... |
use super::{
destination::PandasDestination,
transports::{
BigQueryPandasTransport, MsSQLPandasTransport, MysqlPandasTransport, OraclePandasTransport,
PostgresPandasTransport, SqlitePandasTransport,
},
};
use crate::errors::ConnectorXPythonError;
use connectorx::source_router::{SourceConn, S... |
use super::*;
pub fn handle_i_type(regfile: &mut [u32], mem: &mut [u8], bytes: &[u8], pc: &mut u32, _extensions: &Extensions) -> Result<(), ExecutionError> {
let opcode = get_opcode(bytes);
let rd = get_rd(bytes) as usize;
let f3 = get_f3(bytes);
let rs1 = get_rs1(bytes) as usize;
let f... |
use nia_protocol_rust::RemoveModifierRequest;
use crate::error::{NiaServerError, NiaServerResult};
use crate::protocol::NiaKey;
use crate::protocol::Serializable;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct NiaRemoveModifierRequest {
key: NiaKey,
}
impl NiaRemoveModifierRequest {
pub fn new(key: NiaKe... |
use ckb_types::{
core::{Capacity, Cycle},
packed::Byte32,
};
pub type TxVerifyCache = lru_cache::LruCache<Byte32, CacheEntry>;
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CacheEntry {
pub cycles: Cycle,
pub fee: Capacity,
}
impl CacheEntry {
pub fn new(cycles: Cycle, fee: Capacity) -> Sel... |
extern crate bspline;
use bspline::BSpline;
use std::ops::{Add, Mul};
extern crate trait_set;
use trait_set::trait_set;
extern crate num_traits;
#[cfg(not(feature = "nalgebra-support"))]
trait_set! {
pub trait Float = num_traits::Float;
}
#[cfg(feature = "nalgebra-support")]
extern crate nalgebra;
#[cfg(feature =... |
use std::io::{Read, Result as IoResult, Seek, SeekFrom};
#[derive(Debug)]
pub(crate) struct PeekReader<R: Read> {
pub inner: R,
pub peeked: Option<u8>,
}
impl<R: Read> Read for PeekReader<R> {
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
if buf.is_empty() {
return Ok(0);
... |
#![warn(
clippy::all,
clippy::nursery,
clippy::pedantic,
missing_copy_implementations,
missing_debug_implementations,
rust_2018_idioms,
unused_qualifications
)]
#![allow(
clippy::doc_markdown,
clippy::enum_glob_use,
clippy::module_name_repetitions,
clippy::must_use_candidate,... |
use apllodb_shared_components::{ApllodbResult, DatabaseName};
use apllodb_sql_parser::apllodb_ast;
use crate::ast_translator::AstTranslator;
impl AstTranslator {
pub fn database_name(
ast_database_name: apllodb_ast::DatabaseName,
) -> ApllodbResult<DatabaseName> {
DatabaseName::new(ast_databas... |
//#![deny(warnings)]
//#![allow(unused, deprecated)]
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
// #![feature(use_extern_macros)]
#[macro_use]
extern crate hyper;
#[macro_use]
extern crate log;
extern crate futures;
extern crate log4rs;
extern crate mta_status;
exter... |
mod aggregation;
mod group_by;
mod into_entries_iter;
mod query;
mod statement;
mod statement_expr;
mod round;
pub use aggregation::Aggregation;
pub use query::{QueryBuilder, Row};
pub use statement::Statement;
pub use statement_expr::StatementExpr;
#[cfg(test)]
mod test {
use super::*;
use crate::storage::{e... |
use std::{
collections::{BTreeMap, HashMap},
fmt::{Debug, Formatter},
};
use anyhow::{Context as _, Result};
use camino::Utf8PathBuf;
use regex::Regex;
use serde::{ser::SerializeMap, Deserialize, Serialize, Serializer};
// https://github.com/llvm/llvm-project/blob/llvmorg-17.0.0-rc2/llvm/tools/llvm-cov/Covera... |
use {
actix_web::HttpResponse,
actix_web::web::{Data, Json, Path},
uuid::Uuid,
crate::DBPool,
crate::util::{NotFoundMessage, ResponseType},
crate::wallet::*,
};
// ---- List all Wallets
#[get("/wallets")]
pub async fn list_wallets(pool: Data<DBPool>) -> HttpResponse {
let conn = crate::get... |
//! Marker for user selected entities.
/// Marker for user selected entities.
pub struct Selected;
|
// References - https://docs.rs/rodio/0.14.0/rodio/
// References - https://github.com/mohanson/space-invaders/
// References - https://github.com/mohanson/i8080/blob/master/src/bit.rs
use rodio::source::Source;
use std::fs::File;
use std::io::BufReader;
#[derive(Debug, Default)]
pub struct Invaderwavs {
pub sound... |
//! Asynchronous Metric Sink implementation that uses UDP sockets.
use cadence::{ErrorKind as MetricErrorKind, MetricError, MetricResult, MetricSink};
use log::*;
use std::{
future::Future,
io::Result,
net::{SocketAddr, ToSocketAddrs},
panic::{RefUnwindSafe, UnwindSafe},
pin::Pin,
};
use tokio::{... |
/*
* 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
*/
/// WidgetPalette : Color palette to apply.
/// Color palette to apply.
#[derive(Clone, Copy, Debug, Eq... |
use crate::components::player::PlayerType;
use oxygengine::prelude::*;
#[derive(Debug, Copy, Clone)]
pub struct Bullet(pub PlayerType);
impl Component for Bullet {
type Storage = VecStorage<Self>;
}
|
use std::str;
use crate::task::{Task, TaskBuilder};
use crate::util::pig::Pig;
use failure::Fallible;
/// Rust implementation of part of utf8_codepoint from Taskwarrior's src/utf8.cpp
///
/// Note that the original function will return garbage for invalid hex sequences;
/// this panics instead.
fn hex_to_unicode(valu... |
pub(crate) mod success;
|
use std::fmt;
use board::*;
pub struct Game {
pub board: Board,
}
#[derive(PartialEq, Debug)]
pub enum GameError {
MoveOutOfBounds,
CantPlayEmpty,
RegionTooSmall,
GameOver,
}
pub trait Player {
fn play(board: &Board) -> Option<(usize, usize)>;
}
impl Game {
pub fn new(width: usize, heigh... |
// src/parser.rs
use crate::ast::*;
use crate::lexer::*;
use crate::token::*;
use std::collections::HashMap;
type PrefixParseFn = fn(&mut Parser) -> Result<Expression, String>;
type InfixParseFn = fn(&mut Parser, Expression) -> Result<Expression, String>;
pub struct Parser {
pub l: Lexer,
pub cur_token: Toke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.