text stringlengths 8 4.13M |
|---|
// -*- rust -*-
iter two() -> int { put 0; put 1; }
fn main() {
let a: [mutable int] = [mutable -1, -1, -1, -1];
let p: int = 0;
for each i: int in two() {
for each j: int in two() { a[p] = 10 * i + j; p += 1; }
}
assert (a[0] == 0);
assert (a[1] == 1);
assert (a[2] == 10);
a... |
use actix::prelude::*;
/// Notify game of a disconnected participant
#[derive(Message)]
#[rtype(result = "()")]
pub struct Disconnected {
pub name: String,
pub participant_type: String,
}
/// Notify game of an unresponsive participant (not responding to pings)
#[derive(Message)]
#[rtype(result = "()")]
pub struct U... |
use super::*;
use log::info;
// TODO: probably move out proc gen
#[derive(Default)]
pub struct GamePlaySystem;
impl<'a> System<'a> for GamePlaySystem {
type SystemData = (
(
Entities<'a>,
WriteStorage<'a, Isometry>,
WriteStorage<'a, Blast>,
WriteStorage<'a, ... |
mod errors;
mod fork;
mod wg_config;
use futures::stream::TryStreamExt;
use ipnetwork::Ipv4Network;
use nix::fcntl::{open, OFlag};
use nix::mount::{mount, umount, MsFlags};
use nix::sched::{setns, unshare, CloneFlags};
use nix::sys::signal::{kill, SIGKILL};
use nix::sys::stat::Mode;
use nix::sys::wait::waitpid;
use ni... |
// #[macro_use] extern crate rocket;
#[derive(Debug)]
pub struct VersionHelper {
content: String,
}
impl VersionHelper {
pub async fn print_elapsed() {
use rocket::tokio::time::{sleep, Duration, Instant};
let start = Instant::now();
// let zz: () = start; // yields: found struct `st... |
use serde_derive::{Deserialize, Serialize};
use clipboard::{ClipboardContext, ClipboardProvider};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let mut view = web_view::builder()
.title("Emote Picker")
.user_data(())
.invoke_handler(|_wv, arg| {
handle_view_cmd(arg)
.map_err(|e| web_vi... |
type Con = Box<Connective>;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Connective {
Var(String),
Predicate(String, Vec<String>),
Not(Con),
And(Con, Con),
Or(Con, Con),
Implicate(Con, Con),
Biimplicate(Con, Con),
ForAll(String, Con),
Exists(String, Con),
// All(Vec<Con... |
//! Provides the bubble sort feature
/// Triggers one step of the bubble sort
pub fn iterate_over_bubble_sort(
array: &mut [u8],
index: &mut usize,
swapped: &mut bool,
) {
if array[*index - 1] > array[*index] {
array.swap(
*index - 1,
*index,
);
*swapped ... |
#![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 AvailableOperation {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub display: Option<Availab... |
#[doc = "Register `AHB2ENR` reader"]
pub type R = crate::R<AHB2ENR_SPEC>;
#[doc = "Register `AHB2ENR` writer"]
pub type W = crate::W<AHB2ENR_SPEC>;
#[doc = "Field `GPIOAEN` reader - IO port A clock enable"]
pub type GPIOAEN_R = crate::BitReader;
#[doc = "Field `GPIOAEN` writer - IO port A clock enable"]
pub type GPIOAE... |
use crate::operator::Operator;
use std::fmt::Formatter;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum Name<'a> {
Attribute(&'a str),
Operator(Operator),
}
impl Name<'_> {
pub fn as_str(&self) -> &str {
match self {
Name::Attribute(s) => *s,
Name::Operator(o) =... |
/// Since we're not using the standard Result (`core::result::Result`)
/// We can't use the `?` operator for injecting immediate return from a function in case of an `Err(..)`
///
/// So instead, we're adding a macro named `safe_try` that will function very similarly to the `?` of standard `Result`
#[macro_export]
ma... |
fn main() {
println!("cargo:rustc-link-lib=dylib=Cbc");
println!("cargo:rustc-link-lib=dylib=CoinUtils");
println!("cargo:rustc-link-lib=dylib=OsiClp");
}
|
#![allow(non_upper_case_globals)]
use core::{
iter::FusedIterator,
marker::PhantomData,
mem,
task::Poll,
pin::Pin,
};
use std::io;
use super::setup;
use crate::{
DeviceDescriptor,
InterfaceDescriptor,
Speed
};
use winapi::{
um::{
winnt::{
HANDLE,
GEN... |
mod day1;
mod util;
mod day2;
mod day3;
mod day4;
mod day5;
mod day6;
mod day7;
mod day8;
mod day9;
mod day10;
mod day11;
mod day12;
mod day13;
mod day14;
mod day15;
mod day16;
mod day17;
mod day18;
mod day19;
mod day20;
mod day21;
mod day22;
mod day23;
mod day24;
fn main() {
day1::day1();
day2::day2();
d... |
#[doc = "Register `CEVR` writer"]
pub type W = crate::W<CEVR_SPEC>;
#[doc = "Field `CFCF` writer - clear frame complete flag (whatever the I3C is acting as controller/target)"]
pub type CFCF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>;
#[doc = "Field `CRXTGTENDF` writer - clear target-initiated read end flag... |
use crate::parser::parser_defs;
pub fn vertical_line_relative(v: f32, position: (f32, f32)) -> parser_defs::SVGPoint {
parser_defs::SVGPoint {
x: position.0,
y: position.1 + v
}
}
pub fn horizontal_line_relative(h: f32, position: (f32, f32)) -> parser_defs::SVGPoint {
parser_defs... |
pub fn mincore(addr: u64, length: u64, vec: u64) -> u64 {
let addr = addr as usize;
let length = length as usize;
let vec = vec as usize;
println!("Syscall: mincore addr={:x} length={:x} vex={:x}", addr, length, vec);
0
}
|
use crate::*;
use numeric_types::*;
pub const CURSOR_IMAGE: &str = "cursor.png";
pub const INFO_BAR_IMAGE: &str = "infobar.png";
pub const UNIT_INFO_BAR_IMAGE: &str = "unit-infobar.png";
pub const ZERO_TILES: MapDistance = map_dist(0);
pub const ONE_TILE: MapDistance = map_dist(1);
pub const UNREACHABLE: MapDistance ... |
// use std::time::Duration;
// use anyhow::*;
// use graphql_client::*;
// use log::*;
// // use prettytable::*;
// use serde::*;
// use structopt::StructOpt;
// // use chrono::Utc;
// use chrono::Local;
// use csv::WriterBuilder;
// type URI = String;
// type DateTime = chrono::DateTime<Local>;
// #[derive(GraphQLQ... |
#[doc = "Register `FMC_PMEM` reader"]
pub type R = crate::R<FMC_PMEM_SPEC>;
#[doc = "Register `FMC_PMEM` writer"]
pub type W = crate::W<FMC_PMEM_SPEC>;
#[doc = "Field `MEMSET` reader - MEMSET"]
pub type MEMSET_R = crate::FieldReader;
#[doc = "Field `MEMSET` writer - MEMSET"]
pub type MEMSET_W<'a, REG, const O: u8> = cr... |
pub mod lobby;
pub mod out_of_lobby;
pub mod page_not_found;
|
use std::io;
// use std::io::Write;
// use std::io::Read;
// https://doc.rust-lang.org/std/io/prelude/index.html
// If not "prelude", we have to use io::Write and io::Read
use std::io::prelude::*;
use std::net::TcpListener;
use std::thread::spawn;
use hex_slice::AsHex;
/// Accept connections forever, spawning a thread... |
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
(source = $s:expr, $($r:tt)*) => {
let... |
use super::FileOperation;
use crate::error::{Error, UnderlyingError};
use std::path;
impl FileOperation {
pub fn get_relative_path<'a>(
&self,
relative_to_path: &'a path::Path,
) -> Result<&'a path::Path, Error> {
let file_path = match self {
FileOperation::Create(path) => p... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - TIM12 control register 1"]
pub timx_cr1: TIMX_CR1,
_reserved1: [u8; 6usize],
#[doc = "0x08 - slave mode control register"]
pub timx_smcr: TIMX_SMCR,
#[doc = "0x0c - TIM12 Interrupt enable register"]
pub timx_die... |
use crate::headers::from_headers::*;
use crate::resources::Trigger;
use crate::ResourceQuota;
use azure_core::headers::{
continuation_token_from_headers_optional, item_count_from_headers, session_token_from_headers,
};
use chrono::{DateTime, Utc};
use http::response::Response;
#[derive(Debug, Clone, PartialEq)]
pu... |
use std::hash::Hash;
use bloom_filter::BloomFilter;
use hash::{DefaultHasher, NthHash};
// parameter `s`
const GROWTH_FACTOR: usize = 2;
/// Scalable bloom filter.
///
/// See the [paper] about scalable bloom filters.
///
/// [paper]: http://haslab.uminho.pt/cbm/files/dbloom.pdf
///
/// # Note
///
/// For simplicity,... |
use core::{raw, slice};
use def;
use std::default::Default;
use std::cell::RefCell;
use std::rc::Rc;
use std::{mem, os, iter, ptr, io};
use std::sync::{Arc};
use page::{Page, PageManager, PageHeader, DbRecord, RecordFlags, DbKey, DbValue, PageFlags};
use libc;
#[repr(C)]
pub struct TransactionInfo {
pub magic_id: ... |
pub mod entity;
pub mod enum_event_data;
pub mod event_data;
use proc_macro2::Span;
use syn::{Attribute, Meta, NestedMeta, Path};
/// Attempt to assign a value to a variable, failing if the variable is already populated.
///
/// Prevents attributes from being defined twice
macro_rules! try_set {
($i:ident, $v:exp... |
use crate::error::Error;
use laz::las::laszip::LazVlr;
use crate::reader::{read_point_from, PointReader};
use std::fmt::Debug;
/// Module with functions and structs specific to brigde the las crate and laz crate to allow
/// writing & reading LAZ data
use std::io::{Cursor, Read, Seek, SeekFrom, Write};
use crate::write... |
//! # Efficient and safe bytes
//!
//! [`Bytes`] can be used when secret byte sequences ([`ByteSeq`]) are used but
//! they are too slow for using hacspec in a release version that interacts with
//! other Rust code, i.e. requires a lot conversions between [`U8`] and [`u8`].
#![allow(non_snake_case, dead_code)]
use su... |
use std::fs::File;
use std::io::{Read, BufReader, Result};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::mem;
use byteorder::{BigEndian, ReadBytesExt};
use bytecode::*;
use cst::ConstantTable;
use environment::Environment;
use io;
pub const INVALID_FUNCTION_ID: u32 = 0xFFFFFFFF;
pub struct Function ... |
use rand::prelude::*;
pub fn run() {
let mut test_runner = TestRunner::new(vec![
Box::from(WinterBooking),
Box::from(SummerBooking),
]);
let results = test_runner.compare_strategies(1_000_000);
println!("{:#?}", results);
}
struct TestRunner {
rng: ThreadRng,
booking_strategie... |
use crate::backend::result::Result;
use diesel::r2d2::ConnectionManager;
use diesel::sqlite::SqliteConnection;
use r2d2::Pool;
pub type DbPool = Pool<ConnectionManager<SqliteConnection>>;
pub fn create_pool(database_url: &str) -> Result<DbPool> {
let manager = ConnectionManager::new(database_url);
let pool = ... |
use std::{cell::RefCell, rc::Rc};
use chiropterm::*;
use crate::ui::{UI, UIContext};
use super::{Widgetlike, common::WidgetCommon};
pub struct WidgetMenu<'frame, T: Widgetlike> {
pub ui: UI,
pub(in super) state: Rc<RefCell<WidgetCommon<T>>>,
pub menu: Menu<'frame>,
pub(in super) brush_offset: CellVe... |
/*
* 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
*/
/// SloHistoryResponse : A service level objective history response.
#[derive(Clone, Debug, PartialEq... |
use std::mem;
use super::{Table, TableId, TableIterator, TableRow};
/// Flag table does not hold Rows. Designed for 0 sized 'flag' components
#[derive(Default, Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct SparseFlagTable<Id, Row>
where
Id: TableId,
Row: TableRow + Default,
{
ids: Vec<Id... |
use std::hash::{Hash, Hasher};
use std::io::{BufReader, Read};
use std::path::Path;
use std::pin::Pin;
use anyhow::*;
use bevy_math::{vec2, IVec2, UVec2, Vec4};
use bevy_utils::AHasher;
use xml::attribute::OwnedAttribute;
use xml::reader::{EventReader, XmlEvent};
use crate::tmx::map::Map;
use crate::TmxLoadContext;
... |
pub mod color;
pub mod document;
pub mod intersection;
pub mod layers;
pub mod operation;
pub mod response;
pub use intersection::Quad;
pub use operation::Operation;
pub use response::DocumentResponse;
pub type LayerId = u64;
#[derive(Debug, Clone, PartialEq)]
pub enum DocumentError {
LayerNotFound,
InvalidPath,
... |
extern crate chrono;
extern crate futures;
extern crate log;
extern crate tokio;
extern crate tokio_timer;
extern crate trust_dns;
extern crate trust_dns_server;
use std::time::{Duration, Instant};
use futures::future::Either;
use futures::{Future, Stream};
use std::str::FromStr;
use tokio::runtime::current_thread::R... |
#![feature(proc_macro_hygiene, decl_macro)]
mod blockchain;
mod criptografia;
mod models;
use blockchain::*;
use models::report::*;
use std::env;
use std::io::prelude::*;
use std::sync::RwLock;
#[macro_use]
extern crate rocket;
use rocket::config::{Config, Environment};
use rocket::http::RawStr;
use rocket::http::S... |
//! Declare functions defined in out-of-line asm files.
//!
//! Kernel calling conventions differ from userspace calling conventions,
//! so we also define inline function wrappers which reorder the arguments
//! so that they match with the kernel convention as closely as possible,
//! to minimize the amount of out-of-... |
pub mod account;
pub mod block;
pub mod message;
pub mod node;
pub mod tip;
pub mod utxo;
|
mod flags;
mod memory;
mod opcode;
mod pointers;
mod registers;
use flags::Flags;
use memory::Memory;
use opcode::Opcode;
use pointers::Pointer;
use registers::Register;
use std::fmt;
#[derive(Clone, Copy, Default)]
pub struct Cpu {
a: Register,
b: Register,
c: Register,
d: Register,
e: Register,
... |
use std::{ops::Range, path::PathBuf};
use anyhow::Result;
use las_rs::point::Format;
use pasture_core::{
containers::PointBuffer,
containers::{PerAttributeVecPointStorage, PointBufferExt},
layout::attributes,
math::AABB,
nalgebra::{Point3, Vector3},
};
use super::point_layout_from_las_point_format... |
fn run_program(ops: &mut [u32]) -> bool {
let mut position = 0;
loop {
let instruction = ops[position];
match instruction {
1 => {
// Add
let arg1 = ops[ops[position + 1] as usize];
let arg2 = ops[ops[position + 2] as usize];
... |
#[doc = "Register `PRIVCFGR2` reader"]
pub type R = crate::R<PRIVCFGR2_SPEC>;
#[doc = "Register `PRIVCFGR2` writer"]
pub type W = crate::W<PRIVCFGR2_SPEC>;
#[doc = "Field `PRIV37` reader - Privilege enable on event input x (x = 42 to 37)"]
pub type PRIV37_R = crate::BitReader;
#[doc = "Field `PRIV37` writer - Privilege... |
#[feature(globs)];
#[link_args="-lJudy"];
use capi::*;
use std::ptr::{mut_null,to_unsafe_ptr};
use std::cast;
use std::sys::size_of;
pub mod capi {
use std::libc::{c_void, c_int, c_ulong};
pub type Pvoid_t = *mut c_void;
pub type PPvoid_t = *mut Pvoid_t;
pub type Pcvoid_t = *c_void;
pub type Word_... |
// _ _
// | |_| |__ ___ ___ __ _
// | __| '_ \ / _ \/ __/ _` |
// | |_| | | | __/ (_| (_| |
// \__|_| |_|\___|\___\__,_|
//
// licensed under the MIT license <http://opensource.org/licenses/MIT>
//
// util.rs
// various utility functions for doings things we need to do.
// std imports
us... |
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(unused_must_use)]
extern crate rustls;
extern crate bytes;
extern crate webpki;
extern crate webpki_roots;
extern crate mio;
use bytes::{Bytes, BytesMut, Buf, BufMut, IntoBuf, BigEndian};
use header::rustls::{Session, ProtocolVersion... |
use web_sys::HtmlImageElement;
use wasm_bindgen::JsCast;
use js_sys::Promise;
use wasm_bindgen_futures::JsFuture;
use futures::channel::oneshot::Sender;
use wasm_bindgen::JsValue;
/// This struct represent an image.
/// It is useful when using the [Sprite struct](../sprite/struct.Sprite.html).
///
/// # Example
///
... |
// On peut créer une hiérarchie de modules.
pub mod instrument {
pub fn clarinette() {
println!("Une clarinette joue Rhapsody in Blue");
}
}
mod voix {
fn tenor() {
}
}
|
#[doc = "Reader of register ADV_PARAMS"]
pub type R = crate::R<u32, super::ADV_PARAMS>;
#[doc = "Writer for register ADV_PARAMS"]
pub type W = crate::W<u32, super::ADV_PARAMS>;
#[doc = "Register ADV_PARAMS `reset()`'s with value 0xe0"]
impl crate::ResetValue for super::ADV_PARAMS {
type Type = u32;
#[inline(alw... |
use std::str;
use std::io::{Write};
use std::process::{Command, Stdio};
fn main() {
let tmux_window_info_format = "tmux,#{window_index},#{window_name}#{window_flags},(#{window_panes} panes)";
let tmux_list_windows_args = ["list-windows", "-F", tmux_window_info_format];
let output_tmux = Command::new("tmux... |
#[doc = "Register `WPCR2` reader"]
pub type R = crate::R<WPCR2_SPEC>;
#[doc = "Register `WPCR2` writer"]
pub type W = crate::W<WPCR2_SPEC>;
#[doc = "Field `TCLKPREP` reader - tCLK-PREPARE"]
pub type TCLKPREP_R = crate::FieldReader;
#[doc = "Field `TCLKPREP` writer - tCLK-PREPARE"]
pub type TCLKPREP_W<'a, REG, const O: ... |
use ctaphid_dispatch::app as ctaphid;
#[allow(unused_imports)]
use crate::msp;
use crate::{Authenticator, TrussedRequirements, UserPresence};
use trussed::interrupt::InterruptFlag;
impl<UP, T> ctaphid::App<'static> for Authenticator<UP, T>
where
UP: UserPresence,
T: TrussedRequirements,
{
fn commands(&sel... |
use std::io;
use std::io::prelude::*;
use std::fs::File;
use toml:: { Parser, Decoder, Value };
use rustc_serialize:: { Decodable };
#[derive(RustcDecodable, RustcEncodable, Debug, PartialEq, Default)]
pub struct Config {
app: AppConfig,
window: WinConfig,
}
#[derive(RustcDecodable, RustcEncodable, Debug, Pa... |
use std::env;
use std::fs;
use std::io;
use intcode;
fn main() {
let input_path: &String = &env::args().nth(1).unwrap();
let input_data = read_input(&input_path).unwrap();
let mut c = intcode::Computer::new(input_data.clone());
c.mem[1] = 12;
c.mem[2] = 2;
c.run().unwrap();
println!("Part ... |
use super::{InterpreterKind, MAXIMUM_PYPY_MINOR, MAXIMUM_PYTHON_MINOR, MINIMUM_PYTHON_MINOR};
use crate::target::{Arch, Os};
use crate::Target;
use anyhow::{format_err, Context, Result};
use fs_err as fs;
use serde::Deserialize;
use std::fmt::Write as _;
use std::io::{BufRead, BufReader};
use std::path::Path;
const PY... |
extern crate cupi;
extern crate mio;
use mio::{EventLoop, Handler, Token, EventSet};
use cupi::{CuPi};
use cupi::sys::Edge;
const TERM_TOKEN: Token = Token(0);
const PRESS_TOKEN: Token = Token(1);
const DEBOUNCE_TOKEN: Token = Token(2);
struct PressHandler {
pressed: bool
}
impl Handler for PressHandl... |
use std::collections::VecDeque;
#[derive(Debug, Clone)]
#[allow(dead_code)]
enum Pattern {
Wildcard,
LogicVariable(String),
MemoryVariable(String),
// Repeats are hard. Need to think about thing closely
// RepeatZeroOrMore(Box<Pattern>),
Concat(Box<Pattern>, Box<Pattern>),
StringConstant(S... |
use crate::input::{Input, InputState};
use crate::rom::Rom;
use crate::video::Video;
use cpu::{Cpu, CpuStep};
use mapper::Mapper;
use ppu::{Ppu, PpuStep};
use std::cell::Cell;
use std::ops::{Generator, GeneratorState};
use std::pin::Pin;
use std::u8;
pub mod cpu;
pub mod mapper;
pub mod ppu;
#[derive(Clone)]
pub stru... |
use std::time::Duration;
use log::error;
use redis::aio::Connection;
use serde::de::DeserializeOwned;
use serde::Serialize;
use crate::error::{Error, Result};
use redis::RedisResult;
use crate::service::ICacheService;
use async_trait::async_trait;
///缓存服务
pub struct RedisService {
pub client: redis::Client,
}
im... |
use solana_sdk_bpf_utils::info;
#[derive(Debug)]
pub enum ProgramError {
CannotPayoutToLosers,
CannotPayoutToSubset,
InvalidInput,
InvalidCommand,
InvalidTallyKey,
InvalidPayoutOrder,
MaxPollCapacity,
MaxTallyCapacity,
MissingSigner,
PollAlreadyCreated,
PollAlreadyFinished,
... |
use crate::block::Block;
use crate::chunk::ChunkGridCoordinate;
use crate::chunk::{Chunk, CHUNK_DEPTH, CHUNK_WIDTH};
use crate::world::generation::HeightMap;
use crate::world::generation::WorldSeed;
use math::geometry::Rect;
use math::vector::Vector2;
use math::random::noise::{CombinedNoise, LayeredNoiseOptions};
use ... |
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::cast_precision_loss)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_possible_wrap)]
use std::sync::mpsc;
use intcode;
// This code just serves as an interface between the Intcode computer and the user - it makes
// no effort to automatically play... |
use std::str;
fn main() {
let test_cases = [("Spenglerium", "Ee"), ("Zeddemorium", "Zr"),
("Venkmine", "Kn"), ("Stantzon", "Zt"), ("Melintzum", "Nn"), ("Tullium", "Ty")];
for test_case in test_cases.iter(){
if check(test_case.0, test_case.1) == true{
println!("The symbol {} works for {... |
use color_eyre::eyre::{Result, WrapErr};
use futures::future;
use tokio::sync::mpsc;
use tokio::sync::mpsc::{Receiver, Sender};
use tokio::task::JoinHandle;
use crate::messages::{Command, CommandResult};
use reqwest::Client;
use std::time::Duration;
pub async fn dispatcher(
mut command_source: Receiver<Command>,... |
#[doc = "Register `DCR2` reader"]
pub type R = crate::R<DCR2_SPEC>;
#[doc = "Register `DCR2` writer"]
pub type W = crate::W<DCR2_SPEC>;
#[doc = "Field `PRESCALER` reader - Clock prescaler"]
pub type PRESCALER_R = crate::FieldReader;
#[doc = "Field `PRESCALER` writer - Clock prescaler"]
pub type PRESCALER_W<'a, REG, con... |
pub type __time_t = ::std::os::raw::c_long;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __u32 = ::std::os::raw::c_uint;
pub type __s32 = ::std::os::raw::c_int;
pub type __s16 = ::std::os::raw::c_short;
pub type __u16 = ::std::os::raw::c_ushort;
#[repr(C)]
pub struct uinput_user_dev {
pub name: [::std... |
// Problem 40 - Champernowne's constant
//
// An irrational decimal fraction is created by concatenating the positive
// integers:
//
// 0.12345678910[1]112131415161718192021...
//
// It can be seen that the 12th digit of the fractional part is 1.
//
// If d(n) represents the n-th digit of the fractional part, ... |
//
// Copyright (C) 2020 Abstract Horizon
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Apache License v2.0
// which accompanies this distribution, and is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// Contributors:
// Daniel Send... |
#[macro_use]
mod obsmodule;
obs_declare_module!("obs-module-rust", "Rust OBS module example");
obs_module_author!("Stéphane Lepin");
#[no_mangle]
pub extern fn obs_module_load() -> bool
{
println!("Rust module loaded!");
true
}
#[no_mangle]
pub extern fn obs_module_unload() -> ()
{
println!("Rust module ... |
use std::collections::HashMap;
mod matrix_keyboard;
mod matrix_mice;
mod razer_report;
mod soft_keyboard;
pub use self::razer_report::Color;
use errors::{Error, ErrorKind, Result};
use hidapi::{HidApi, HidDevice};
use log::Level;
use std::ffi::CString;
use std::thread;
use std::time;
use self::matrix_keyboard::Matri... |
/*
chapter 4
syntax and semantics
*/
fn main() {
let mut a = 5; {
let b = &mut a; // -+ &mut borrow starts here
*b += 1; // |
} // -+ ... and ends here
println!("{}", a); // <- try to borrow x here
}
// output should be:
/*
*/
|
pub mod commit_txs_scanner;
pub mod entry;
pub(crate) mod container;
pub(crate) mod orphan;
pub(crate) mod pending;
pub(crate) mod proposed;
pub use self::entry::{DefectEntry, TxEntry};
const DEFAULT_BYTES_PER_CYCLES: f64 = 0.000_17f64;
/// Virtual bytes(aka vbytes) is a concept to unify the size and cycles of a tr... |
use std::io;
fn main() {
loop {
println!("Qual'è la posizione nella serie di fibonacci del numero che stai cercando?");
let mut x = String::new();
io::stdin().read_line(&mut x)
.expect("Failed to read file");
// Parse user input
let x: u8 = match x.trim().parse... |
use std::path::PathBuf;
use clap::Clap;
// use minmarkdown;
// mingen new <content_path> - creates a new content file in contents/<content_path>
// mingen new site <sitename> - creates a new site
// mingen server - launches server that shows live updates
#[derive(Clap, Debug)]
enum Args {
/// generate new mingen c... |
use serde::Deserialize;
#[derive(Clone, Debug, Deserialize)]
pub struct AddPodcast {
name: String,
url: String,
}
fn add_podcast_info_db(conn: &SqliteConnection, podcast: AddPodcast) -> Result<String, String> {
return Ok("hello".to_string())
} |
#[cfg(feature = "sled-storage")]
use gluesql::{parse, Glue, Payload::*, Row, Value};
use std::fs::File;
use std::io::prelude::*;
use std::rc::Rc;
use crate::applic_folder::compileargs::*;
use crate::applic_folder::get_storage::get_storage;
pub fn dump_sql(my_input: &TheInput, seen: &Seen) -> std::io::Result<()> {
... |
extern crate reducto;
use reducto::deflate::Deflate;
use reducto::lz77::LZ77;
use std::fs::File;
use std::io::{BufReader, Read};
use std::path::Path;
fn main() {
// example from https://www.researchgate.net/figure/An-example-of-LZ77-encoding_fig4_322296027
let test_sample = "aacaacabcabaaac";
let mut defl... |
pub mod fun;
use fun::Fun;
pub mod local;
use local::Local;
pub mod property;
use property::Property;
pub mod modules;
// use modules::Module;
use core::pos::BiPos;
#[derive(Debug, Clone)]
pub struct Statement{
pub kind: StatementKind,
pub pos: BiPos,
}
#[derive(Debug, Clone)]
pub enum StatementKind{
Pro... |
use std::future::Future;
use std::path::Path;
use std::process::Stdio;
use futures::sink::SinkExt;
use futures::stream;
use futures::stream::{Stream, StreamExt};
use heim::process::Process;
use tokio::fs::OpenOptions;
use tokio::process::Command;
use tokio::sync::broadcast;
use tokio_util::codec::{FramedRead, FramedWr... |
use crate::api::routes::run_server;
use crate::db::db::Database;
use std::env;
mod api;
mod db;
#[tokio::main]
async fn main() {
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be specified");
let listen_address = env::var("LISTEN").expect("LISTEN must be specified");
let database = ... |
use std::ops;
pub trait Vector<T>
where
T: ops::Add<Output = T>
+ ops::Sub<Output = T>
+ ops::Mul<Output = T>
+ ops::Div<Output = T>
+ Copy
+ Clone,
{
const DIMS: usize;
fn zero() -> Self;
fn get(&self, i: usize) -> T;
fn set(&mut self, i: usize, value: T);
... |
use super::*;
use std::convert::Into;
use dataview::Pod;
use log::debug;
use memflow::*;
use memflow_derive::*;
const SIZE_4KB: u64 = size::kb(4) as u64;
#[repr(C)]
#[derive(Copy, Clone, ByteSwap)]
pub struct PhysicalMemoryRun<T: Pod + ByteSwap> {
pub base_page: T,
pub page_count: T,
}
#[repr(C)]
#[derive(... |
#![allow(dead_code)]
use cli_integration_test::IntegrationTestEnvironment;
use short::BIN_NAME;
fn cmd_help() {
let e = IntegrationTestEnvironment::new("cmd_help");
let mut command = e.command(BIN_NAME).unwrap();
let r = command.assert();
r.stderr(
r#" short 0.0.2
Vincent Herlemont <vincentherl... |
use crate::models::{ComicId, ComicIdInvalidity, Token};
use crate::util::{ensure_is_authorized, ensure_is_valid};
use actix_web::{error, web, HttpResponse, Result};
use actix_web_grants::permissions::AuthDetails;
use anyhow::anyhow;
use database::models::{Comic as DatabaseComic, Item as DatabaseItem, LogEntry, Occurren... |
mod bin_gen;
mod memory;
pub use {bin_gen::*, memory::*};
|
//! Type definitions for the queues used in this crate.
use heapless::Vec;
use heapless::{
consts,
spsc::{Consumer, Producer, Queue},
ArrayLength,
};
pub use crate::error::InternalError;
pub use crate::Command;
// Queue item types
pub type ComItem = Command;
pub type ResItem<BufLen> = Result<Vec<u8, BufL... |
pub enum UpdateType {
Add,
Change
}
impl UpdateType {
pub fn as_str(&self) -> &'static str {
match self {
UpdateType::Add => "A",
UpdateType::Change => "C"
}
}
}
|
use text_unit::TextUnit;
use text_unit::TextRange;
pub struct ParseError {
pub location: Location,
pub error_kind: ParseErrorKind,
}
pub enum Location {
Offset(TextUnit),
Range(TextRange),
}
pub enum ParseErrorKind {
} |
use cosmwasm_std::{
log, to_binary, Api, CanonicalAddr, CosmosMsg, Decimal, Env, Extern, HandleResponse,
HandleResult, HumanAddr, Order, Querier, QueryRequest, StdError, StdResult, Storage, Uint128,
WasmMsg, WasmQuery,
};
use crate::state::{
pool_info_read, pool_info_store, read_config, read_state, rew... |
//!
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::fmt::Write;
use super::pattern::Pattern;
pub enum BinaryOperator {
Plus,
Minus,
Times,
Divided,
Power,
Mod,
}
pub enum UnaryOp {
Log,
Exp,
Sin,
Cos,
Tan,
Sqrt,
}
pub enum ... |
use std::iter;
use std::mem;
use crate::data::*;
use crate::solver::*;
pub struct GridSolver {
grid: Grid,
clues: Clues,
stats: GridSolverStats,
changed_rows: Vec <bool>,
changed_cols: Vec <bool>,
line_solver: LineSolver,
state: State,
vertical: bool,
index: LineSize,
index_changed: bool,
}
enum State ... |
use self::error;
use console::style;
use log::*;
use std::path::PathBuf;
use std::process;
use structopt::{
clap::crate_authors, clap::crate_description, clap::crate_version, clap::AppSettings, StructOpt,
};
use uvm_cli::{options::ColorOption, set_colors_enabled, set_loglevel};
use uvm_core::unity::Component;
use ... |
use crate::{f32s, f64s, sparse::SparseMatrix};
use simd_aligned::{MatrixD, Rows};
/// Represents one class of the SVM model.
#[derive(Clone, Debug)]
#[doc(hidden)]
pub(crate) struct Class<M32> {
/// The label of this class
pub(crate) label: i32,
// /// The number of support vectors in this class
// pu... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 0x04],
#[doc = "0x04 - OctoSPI IO Manager Port 1 Configuration Register"]
pub p1cr: P1CR,
#[doc = "0x08 - OctoSPI IO Manager Port 2 Configuration Register"]
pub p2cr: P2CR,
}
#[doc = "P1CR (rw) register accessor: OctoS... |
struct Node {
pub bits: [bool; 24]
}
impl Node {
pub fn new(string: String) -> Node {
let mut collector = [true; 24];
for (i, character) in string.split(' ').into_iter().enumerate() {
collector[i] = character == "1";
}
Node{bits: collector}
}
fn get_hamming_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.