text stringlengths 8 4.13M |
|---|
use amethyst::core::nalgebra::Vector3;
use amethyst::ecs::prelude::{Component, DenseVecStorage, NullStorage};
use ncollide2d::shape;
pub struct Ball {
pub obj: shape::Ball<f32>,
}
pub struct Block {
pub life: i32,
}
#[derive(Default)]
pub struct Bounced;
pub struct Cube {
pub obj: shape::Cuboid<f32>,
}
... |
use crate::solutions::Solution;
use crate::util::int;
pub struct Day3 {}
impl Solution for Day3 {
fn part1(&self, input: String) {
print!(
"{}",
parse_input(&input)
.filter(satisfies_triangle_inequality)
.count()
);
}
fn part2(&self,... |
use std::{
collections::HashSet,
path::PathBuf,
sync::{mpsc::Sender, Arc, Mutex},
};
use wasmer::{imports, Function, ImportObject, Store, WasmerEnv};
use wasmer_wasi::WasiEnv;
use zellij_tile::data::{Event, EventType};
use super::{
pty_bus::PtyInstruction, screen::ScreenInstruction, AppInstruction, Pan... |
use nom::IResult;
pub fn demo() {
println!("Demoing a parser that pulls apart bits");
let bytes = vec![
0x00u8,
0xFFu8,
0x0Fu8,
];
print_bits(&bytes[..]);
}
fn print_bits(bytes: &[u8]) {
let mut print_me : Vec<String> = Vec::new();
let mut slice = bytes;
loop {
... |
extern crate encoding_rs;
extern crate byteorder;
extern crate yaml_rust;
extern crate getopts;
mod rsa;
use getopts::Options;
use yaml_rust::YamlLoader;
use std::fs;
use std::env;
fn main() {
// --- Adding cmd line arguments: ------------------
// -f: Path to input data yaml-file
let args: Vec<String> = ... |
use serde::de::DeserializeOwned;
use serde::Deserialize;
use std::error::Error;
use std::path::Path;
use crate::json;
use crate::page::Page;
#[derive(Debug, Deserialize)]
struct Content {
pages: Vec<String>,
}
#[derive(Debug)]
pub struct Notebook {
content: Content,
pub pages: Vec<Page>,
}
impl Notebook ... |
pub(crate) mod formatter {
use clap::{Arg, ArgMatches};
pub(crate) const HELP: &str = "Controls the presentation of output";
pub(crate) const LONG: &str = "formatter";
pub(crate) const NAME: &str = "FORMATTER";
pub(crate) const SHORT: &str = "f";
pub(crate) fn arg<'x, 'y>() -> Arg<'x, 'y> {
... |
use std::io::File;
use std::io::fs::PathExtensions;
use std::ptr;
use std::ffi::CString;
use gles::types::*;
// TODO: Everything is public :(
use gles::;
pub struct Shader {
shader_string: String,
shader_type: GLenum,
id: GLuint
}
impl Shader {
// Read the shader_string from the given filename and store in Sha... |
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct ValidateResourcePolicyOutput {
/// <p>Returns an error message if your policy doesn't pass validatation.</p>
pub validation_errors: std::option::Option<... |
use crate::protogen::protos::mock::mock_service_server::{MockService, MockServiceServer};
use crate::protogen::protos::mock::{MockRequest, MockResponse};
use futures::channel::mpsc;
use futures::SinkExt;
use std::env;
use std::time::{SystemTime, UNIX_EPOCH};
use tonic::transport::Server;
use tonic::{Request, Response, ... |
#[doc = "Register `APB2ENR` reader"]
pub type R = crate::R<APB2ENR_SPEC>;
#[doc = "Register `APB2ENR` writer"]
pub type W = crate::W<APB2ENR_SPEC>;
#[doc = "Field `SYSCFGEN` reader - SYSCFG clock enable"]
pub type SYSCFGEN_R = crate::BitReader<SYSCFGEN_A>;
#[doc = "SYSCFG clock enable\n\nValue on reset: 0"]
#[derive(Cl... |
use system_benchmarks::system::tokio::{build_nfqueue_system, run_system};
#[tokio::main]
async fn main() {
run_system(build_nfqueue_system).await
} |
use super::bit;
use super::bus::{Bus, IntrFlags};
pub struct Z80{
pub a: u8,
pub f: u8,
pub b: u8,
pub c: u8,
pub d: u8,
pub e: u8,
pub h: u8,
pub l: u8,
pub sp: u16,
pub pc: u16,
pub bus: Bus,
pub cyclesLeft: u8,
fetched: u8,
fetchedSigned: i8,
currentOpcode... |
struct Rectangulo {
ancho: u32,
alto: u32
}
fn area(rectangulo: &Rectangulo) -> u32 {
rectangulo.ancho * rectangulo.alto
}
fn main() {
//Ownsership
/*
* Cada valor en Rust tiene su propio Ownsership.
* solo puede existir un Ownsership a la vez.
* Si un Ownsership sale del alcance, el valor... |
use async_std::{io::{self, prelude::*, Write, ReadExt}, task};
pub async fn repl() -> io::Result<()> {
let stdin = io::stdin();
let mut stdout = io::stdout();
let mut line = String::new();
loop {
let n = stdin.read_line(&mut line).await?;
if n == 0 {
return Ok(());
... |
//! Buttons style
#![allow(clippy::module_name_repetitions)]
use iced::widget::button;
use iced::widget::button::Appearance;
use iced::{Background, Color, Vector};
use crate::gui::styles::style_constants::{
get_alpha_round_borders, get_alpha_round_containers, get_starred_color, BORDER_BUTTON_RADIUS,
BORDER_W... |
#![feature(start, core_intrinsics)]
#![no_std]
extern crate zinc;
use core::intrinsics::volatile_load;
use core::option::Option::Some;
use zinc::hal::k20::{pin, watchdog};
use zinc::hal::pin::Gpio;
use zinc::hal::cortex_m4::systick;
use zinc::util::support::wfi;
static mut i: u32 = 0;
static mut global_on: u32 = 0;... |
//! Vector graphics type primitives
pub mod bitmap;
/// Contains objects for the creation
/// of graphical text
pub mod text;
use std::ops::Add;
/// Perform a translation on an Object
/// by operating on their points
pub trait Translate {
fn point(&self) -> &Point;
fn points(&self) -> Option<&[Point]>
... |
use std::collections::HashMap;
fn both(starting_numbers: Vec<u32>, seek: usize) {
let (mut track, last_num) = starting_numbers.iter().enumerate().fold((HashMap::new(), 0), |mut res, (idx, item)| {
if idx != starting_numbers.len() - 1 {
res.0.insert(*item, idx as u32);
}
(res.0,... |
use crate::{
camera::CameraController,
interaction::navmesh::{data_model::Navmesh, selection::NavmeshSelection},
physics::Physics,
scene::clipboard::Clipboard,
sound::SoundSelection,
utils, GameEngine,
};
use rg3d::{
core::{
algebra::{UnitQuaternion, Vector3},
math::Matrix4Ex... |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use mutex::{Mutex, MutexGuard};
use raw_condvar::{RawCondvar};
/// A condition variable to wait on mutexes.
///
/// ... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
use super::Example;
pub mod aggregate;
pub mod threshold;
mod signature;
use signature::{message_to_elements, PrivateKey, Signature};
u... |
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(unused_variables)]
mod serial;
mod fields;
mod types;
// mod field;
mod newfield;
mod fxerror;
mod codegen;
use crate::newfield::{FXType, FXField, Message, Group, GroupInstance, GenericMessageBuilder};
// fn to_string<T>(value: &T) -> Result<String, FixError>
/... |
// 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 server::*;
use specs::*;
use server::component::channel::*;
use server::component::time::ThisFrame;
use server::protocol::server::GameFlag;
use server::protocol::{to_bytes, FlagUpdateType, ServerPacket};
use component::*;
pub struct LeaveUpdateSystem {
reader: Option<OnPlayerLeaveReader>,
}
#[derive(SystemData... |
#![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)]
PolicyTrackedResources_ListQueryResul... |
use std::fmt::{ Debug, Formatter, Result as FmtResult };
use std::hash::{ Hash, Hasher };
use std::cell::RefCell;
use std::rc::Rc;
use crate::vm::error::RuntimeError;
use crate::common::{ Value, Type };
#[derive(Clone, PartialEq, PartialOrd)]
pub struct Array {
pub vec: Rc<RefCell<Vec<Value>>>
}
impl Array {
pub... |
#[macro_use]
extern crate glium;
pub use glium::glutin;
use glium::index::PrimitiveType;
use glium::texture::unsigned_texture2d::UnsignedTexture2d;
use glium::texture::RawImage2d;
use glium::{Display, Surface};
pub struct FbNow {
pub events_loop: glutin::EventsLoop,
display: Display,
buffer_width: u32,
... |
use gtk::prelude::*;
use gtk::Application;
use gio::prelude::*;
use std::collections::HashMap;
use std::env::args;
use std::rc::Rc;
use std::cell::RefCell;
use std;
mod canvas;
mod buttons_events;
mod color;
mod point;
mod figure;
mod state;
mod handle_draw;
mod transformations;
use crate::canvas::{CairoCanvas, Canva... |
use std::process::Command;
use crate::Error;
pub fn run_wasm_pack() -> Result<(), Error> {
let mut child = Command::new("wasm-pack")
.args(&["build", "--target", "web"])
.spawn()?;
child.wait()?;
Ok(())
}
|
use std::borrow::Cow;
use std::error::Error;
use bytemuck::{Pod, PodCastError, try_cast_slice, pod_collect_to_vec};
use heed_traits::{BytesDecode, BytesEncode};
/// Describes a slice that must be [memory aligned] and
/// will be reallocated if it is not.
///
/// A [`Cow`] type is returned to represent this behavior.
... |
use notify_cell::{NotifyCell, NotifyCellObserver, WeakNotifyCell};
use parking_lot::RwLock;
use std::ffi::{OsString, OsStr};
use std::path::Path;
use std::result;
use std::sync::Arc;
use std::iter::Iterator;
use futures::{Async, Poll, Stream};
use std::os::unix::ffi::OsStrExt;
use std::usize;
use fuzzy_search::{Search ... |
use super::block_ptr::BlockPtr;
use super::from_bytes::FromBytes;
#[repr(packed)]
pub struct DslDatasetPhys {
pub dir_obj: u64, // DMU_OT_DSL_DIR
pub prev_snap_obj: u64, // DMU_OT_DSL_DATASET
pub prev_snap_txg: u64,
pub next_snap_obj: u64, // DMU_OT_DSL_DATASET
pub snapnames_zapobj: u64, // DMU_OT_... |
use dotenv;
use actix_web::{App, HttpServer };
use deadpool_postgres::{Config};
use tokio_postgres::{NoTls};
// json - postgres example
mod Json;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
// loading .env file
dotenv::dotenv().ok();
// creating postgres pool connection
let cfg = Conf... |
extern crate ws;
use ws::{connect, Handler, Sender, Handshake, Result, Message};
use std::process::Command;
use std::{thread, time};
struct Client {
out: Sender
}
impl Handler for Client {
fn on_open(&mut self, _: Handshake) -> Result<()> {
self.out.send("new session started, connected.")
}
... |
extern crate libc;
use std::{time, thread};
use std::thread::sleep;
use std::time::Duration;
extern "C" {
fn increment_by_one(input: *mut libc::c_int);
}
fn main() {
let mut input = 5;
let old = input;
unsafe { increment_by_one(&mut input) };
println!("{} + 1 = {}", old, input);
let mut numbe... |
use itertools::Itertools;
use clang::Cursor;
use features::Features;
use util::ResultOptionExt;
use super::{EMIT_STUBS, NameMap, add_to_name_map_checked, escape_ident, file_stem, mod_qual};
use super::output::OutputItems;
/**
Process a single macro definition.
*/
pub fn process_macro_defn(
defn_cur: Cursor,
o... |
#![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... |
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| ... |
use crate::bond::deposit_farm_share;
use crate::contract::{handle, init, query};
use crate::mock_querier::{mock_dependencies, WasmMockQuerier};
use crate::state::read_config;
use cosmwasm_std::testing::{mock_env, MockApi, MockStorage, MOCK_CONTRACT_ADDR};
use cosmwasm_std::{
from_binary, to_binary, Coin, CosmosMsg,... |
#[doc = "Register `CCMR2_input` reader"]
pub type R = crate::R<CCMR2_INPUT_SPEC>;
#[doc = "Register `CCMR2_input` writer"]
pub type W = crate::W<CCMR2_INPUT_SPEC>;
#[doc = "Field `CC3S` reader - Capture/compare 3 selection This bit-field defines the direction of the channel (input/output) as well as the used input. Not... |
use hyper::{Client, Url};
use hyper::header::{Authorization, Bearer};
use rustc_serialize::json;
use chrono::{Date, DateTime, UTC};
use std::io::prelude::*; // Required for read_to_string use later.
use api::error::TellerClientError;
pub type ApiServiceResult<T> = Result<T, TellerClientError>;
type AccountResponse ... |
#[doc = "Reader of register NPINTEN1"]
pub type R = crate::R<u32, super::NPINTEN1>;
#[doc = "Writer for register NPINTEN1"]
pub type W = crate::W<u32, super::NPINTEN1>;
#[doc = "Register NPINTEN1 `reset()`'s with value 0x40"]
impl crate::ResetValue for super::NPINTEN1 {
type Type = u32;
#[inline(always)]
fn... |
#[doc = "Register `CFGR2` reader"]
pub type R = crate::R<CFGR2_SPEC>;
#[doc = "Register `CFGR2` writer"]
pub type W = crate::W<CFGR2_SPEC>;
#[doc = "Field `LOCKUP_LOCK` reader - Cortex-M0 LOCKUP bit enable bit"]
pub type LOCKUP_LOCK_R = crate::BitReader<LOCKUP_LOCK_A>;
#[doc = "Cortex-M0 LOCKUP bit enable bit\n\nValue ... |
$NetBSD: patch-vendor_pnet__datalink-0.28.0_src_bpf.rs,v 1.1 2023/05/19 11:20:50 he Exp $
Don't assume that c_char is signed.
This applies fix from upstream:
https://github.com/libpnet/libpnet/commit/ce180d3bfe33b90ba0a68cb23802631387e3717b
--- ../vendor/pnet_datalink-0.28.0/src/bpf.rs.orig 1970-01-01 00:00:00.000000... |
/*
* 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
*/
/// TimeseriesWidgetDefinition : The timeseries visualization allows you to display the evolution of one... |
//! ITP1_2_Bの回答。
//! [https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_B](https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_B)
use std::io;
/// ITP1_2_Bの回答(エントリポイント)。
#[allow(dead_code)]
pub fn main() {
loop {
let mut line = String::new();
if let Ok(_) = io::stdin().... |
use crate::error::ViuResult;
use crate::printer::{adjust_offset, find_best_fit, Printer};
use crate::Config;
use image::{DynamicImage, GenericImageView};
use lazy_static::lazy_static;
use std::io::{BufReader, Read, Write};
#[allow(non_camel_case_types)]
pub struct iTermPrinter {}
lazy_static! {
static ref ITERM_S... |
pub mod delegate_registration_test;
pub mod multi_signature_registration_test;
pub mod second_signature_registration_test;
pub mod transfer_test;
pub mod vote_test;
|
#![no_std]//tests folder will execute seperately from main.rs so it needs its own #!s.
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)]
#![reexport_test_harness_main = "test_main"]
#![test_runner(bentos::test_runner)]//test_runner located in lib.rs, it can be reached by 'bentos::'
us... |
use ggez;
use ggez::event::{KeyCode, KeyMods};
use ggez::{ event,
graphics,
Context,
GameResult};
use std::time::{Duration, Instant};
use ggez::mint::Point2;
mod consts;
use consts::*;
mod window;
use window::build_window;
mod elements;
use elements::*;
struct GameState {
... |
//! Flags in leetcode-cli
//!
//! ```sh
//! FLAGS:
//! -d, --debug debug mode
//! -h, --help Prints help information
//! -V, --version Prints version information
//! ```
use crate::err::Error;
use clap::{Arg, ArgAction};
use env_logger::Env;
/// Abstract flag trait
pub trait Flag {
fn usa... |
use std::{fmt, ptr};
use std::ffi::{c_void, CStr};
use std::fmt::{Debug, Formatter};
use std::mem::{ManuallyDrop, transmute};
use std::os::raw::c_char;
use opendp::chain::{MeasureGlue, MetricGlue};
use opendp::core::{Domain, Measure, Measurement, Metric, Transformation};
use opendp::err;
use opendp::error::*;
use cra... |
use bincode::{deserialize, serialize};
use log::*;
use solana::cluster_info::FULLNODE_PORT_RANGE;
use solana::fullnode::new_fullnode_for_tests;
use solana::gossip_service::discover;
use solana_client::client::create_client;
use solana_client::thin_client::{retry_get_balance, ThinClient};
use solana_logger;
use solana_s... |
//! # Document
//!
//! In Typesense, documents are each one of the JSON elements that are stored in the collections.
//! A document to be indexed in a given collection must conform to the schema of the collection.
//!
use crate::collection::CollectionSchema;
use serde::{de::DeserializeOwned, Serialize};
/// Trait that... |
extern crate diesel;
extern crate rust_pdx_schedule;
use self::models::*;
use diesel::prelude::*;
use rust_pdx_schedule::*;
fn main() {
use self::schema::classoffering::dsl::*;
let connection = establish_connection();
let results = classoffering
.limit(5)
.load::<ClassOffering>(&connectio... |
pub fn delay(index: usize, mut size: f32) -> isize {
const SIZE_OFFSET: f32 = 0.06;
const SIZE_MULT: f32 = 1_000.0;
size += SIZE_OFFSET;
// Spread ratio between delays
const SPREAD: f32 = 0.3;
let base = size * SIZE_MULT;
let mult = (index as f32 * SPREAD) + 1.0;
let offset = if index... |
use bevy::prelude::*;
use sdl2::keyboard::Keycode;
use crate::{Keypress, MouseMotion};
pub struct GamePlugin;
#[derive(Debug)]
pub struct Position {
pub x: f32,
pub y: f32,
}
#[derive(Debug, Clone, Copy)]
pub struct Direction {
pub x: f32,
pub y: f32,
}
impl Direction {
pub fn new(x: f32, y: f3... |
use std::process::Command;
use std::{env, str};
use xtask::{check_host_side, install_targets};
/// List of all compilation targets we support.
///
/// This should generally list all of the bare-metal thumb targets starting at thumbv6.
static ALL_TARGETS: &[&str] = &[
"thumbv6m-none-eabi",
"thumbv7m-none-eabi",... |
impl Solution {
pub fn count_triplets(arr: Vec<i32>) -> i32 {
let n = arr.len();
let mut presum = vec![0;n + 1];
for i in 0..n{
presum[i + 1] = presum[i] ^ arr[i]
}
let mut res = 0;
for i in 0..n{
for k in (i + 1)..n{
if presum[... |
#[derive(Debug)]
pub struct Product<'s> {
pub id: u32,
pub name: &'s mut String,
pub price: f32,
}
impl<'s> Product<'s> {
pub fn new(id: u32, name: &'s mut String, price: f32) -> Product{
Product{
id,
name,
price,
}
}
} |
#![cfg_attr(feature = "unstable", feature(test))]
// Launch program : cargo run --release < input/input.txt
// Launch benchmark : cargo +nightly bench --features "unstable"
/*
Benchmark results:
running 5 tests
test tests::test_part_1 ... ignored
test tests::test_part_2 ... ignored
test bench::bench_... |
// This is a comment, and will be ignored by the compiler
// This is the main function
fn main() {
println!("Hello World!");
println!("I'm a Rustacean!");
}
|
use anyhow::anyhow;
use anyhow::Result as AnyResult;
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
use service_policy_kit::data::{Context, Interaction, Param};
#[derive(Debug, Serialize, Deserialize)]
pub struct Definitions {
pub providers: HashMap<String, ActionMapping>,
}
impl Defin... |
extern crate rand;
use rand::Rng;
use std::process::Command;
use std::io;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
// highscore file name
const HIGHSCORE_FILE: &str = "./highscore.dat";
// Just for clearing the screen
fn clear() {
let mut cmd;
if cfg!(t... |
#[cfg(not(any(feature = "type_a_alternative_faster_lut")))]
#[rustfmt::skip]
// Original Waveforms from Waveshare
pub(crate) const LUT_FULL_UPDATE: [u8; 30] =[
0x02, 0x02, 0x01, 0x11, 0x12, 0x12, 0x22, 0x22,
0x66, 0x69, 0x69, 0x59, 0x58, 0x99, 0x99, 0x88,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xB4, 0x13, 0x51,
... |
use ::{Result, Handle};
extern "C" {
pub fn MIC_Initialize(sharedmem: *mut u32, sharedmem_size: u32, control: u8, recording: u8, unk0: u8, unk1: u8, unk2: u8) -> Result;
pub fn MIC_Shutdown() -> Result;
pub fn MIC_GetSharedMemOffsetValue() -> u32;
pub fn MIC_ReadAudioData(outbuf: *mut u8, readsize: u... |
extern crate hyper;
extern crate select;
extern crate hyper_native_tls;
extern crate url;
extern crate serenity;
extern crate rand;
extern crate glob;
extern crate json;
use commands;
use self::hyper::Client;
use self::hyper::header::Connection;
use self::select::document::Document;
use self::select::predicate::{Clas... |
//! Mitochondria is the powerhouse of the `Cell`.
//!
//! This crate provides additional mutable containers for use cases not
//! covered by the triumvirate of `Cell`, `RefCell` and `UnsafeCell`.
#![deny(missing_docs)]
#![deny(unsafe_code)]
#![cfg_attr(feature = "no_std", no_std)]
#[cfg(feature = "no_std")]
extern c... |
use crate::daemon::*;
use crate::misc;
use crate::recovery::{RecoveryEvent, ReleaseFlags as RecoveryReleaseFlags};
use crate::release::{UpgradeEvent, UpgradeMethod};
use crate::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
use apt_cli_wrappers::AptUpgradeEvent;
use clap::ArgMatches;
use dbus::{
self, BusType, Connection, Con... |
pub use self::scene::*;
pub mod scene;
|
pub mod imr {
pub mod mr0 {
pub fn get() -> u32 {
unsafe {
core::ptr::read_volatile(0x40010400u32 as *const u32) & 0x1
}
}
pub fn set(val: u32) {
unsafe {
let mut reg = core::ptr::read_volatile(0x40010400u32 as *const u32);... |
mod attrs;
mod auto_figures;
mod embed_youtube;
mod fenced_blocks;
mod html;
mod pd_html;
mod quote_attrs;
mod syntax_highlight;
mod table_attrs;
mod transform_headers;
use lazy_static::lazy_static;
use regex::Regex;
pub use syntax_highlight::{dump_syntax_binary, dump_theme};
use auto_figures::AutoFigures;
use camino... |
use rand::rngs::ThreadRng;
use std::rc::Rc;
use super::{HitRecord, Shape};
use crate::aabb::AABB;
use crate::material::{isotropic::Isotropic, Material};
use crate::ray::Ray;
use crate::texture::Texture;
use crate::vec3::{Color, Vec3};
pub struct ConstantMedium {
boundary: Rc<dyn Shape>,
material: Rc<dyn Mater... |
#[doc = "Reader of register RCC_PLL1CFGR1"]
pub type R = crate::R<u32, super::RCC_PLL1CFGR1>;
#[doc = "Writer for register RCC_PLL1CFGR1"]
pub type W = crate::W<u32, super::RCC_PLL1CFGR1>;
#[doc = "Register RCC_PLL1CFGR1 `reset()`'s with value 0x0001_0031"]
impl crate::ResetValue for super::RCC_PLL1CFGR1 {
type Typ... |
//! This crate provides trait `RetainMut` which
//! provides `retain_mut` method for `Vec` and `VecDeque`.
//!
//! `retain_mut` is basically the same as `retain` except that
//! it gives mutable reference of items to the predicate function.
//!
//! Since there is no reason `retain` couldn't have been designed this way,... |
use super::value::Value;
impl Into<MultiValue> for Value {
fn into(self) -> MultiValue {
MultiValue::Single(self)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum MultiValue {
Single(Value),
Multi(Vec<Value>),
}
impl MultiValue {
pub fn iter(&self) -> impl I... |
#[doc = "Register `TTOCF` reader"]
pub type R = crate::R<TTOCF_SPEC>;
#[doc = "Register `TTOCF` writer"]
pub type W = crate::W<TTOCF_SPEC>;
#[doc = "Field `OM` reader - Operation Mode"]
pub type OM_R = crate::FieldReader;
#[doc = "Field `OM` writer - Operation Mode"]
pub type OM_W<'a, REG, const O: u8> = crate::FieldWr... |
#![feature(test)]
extern crate test;
macro_rules! isa {
($isa:ident) => {
mod $isa {
use reon::isa::encoding::{InstructionType, EncodeCursor, DecodeCursor, DecodeContext};
use reon::isa::$isa::*;
pub fn decode(data: &[u8]) -> Vec<Instruction> {
let ctx =... |
// Copyright (c) 2021 Thomas J. Otterson
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
use std::{
cell::RefCell,
fmt::{Debug, Error, Formatter},
rc::Rc,
};
use super::{
device::{DeviceRef, LevelChange},
trace::TraceRef,
};
/// A convenience alias fo... |
fn main() {
// tuples
let tup: (i32, f64, u8) = (500, 3.77, 100);
let (_x, y, _z) = tup;
println!("the value of 'y' is {}", y);
// arrays
let months = [
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
... |
use std::fs;
use std::path;
use std::io;
pub const DEFAULT_PATH: &'static str = "index.html";
pub fn new_root_dir(document_root: &str) -> Option<path::PathBuf> {
let path = path::Path::new(document_root);
if !path.exists() || !path.is_dir() {
return None
}
Some(path.to_path_buf())
}
pub fn g... |
use std::collections::HashSet;
use std::sync::Arc;
use meilidb_core::DocumentId;
use fst::{SetBuilder, set::OpBuilder};
use sdset::{SetOperation, duo::Union};
use crate::indexer::Indexer;
use crate::serde::{extract_document_id, Serializer, RamDocumentStore};
use crate::RankedMap;
use super::{Error, Index, InnerIndex... |
pub mod opaEngine;
|
/*
* 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
*/
/// SloListResponseMetadataPage : The object containing information about the pages of the list of SLOs.... |
use std::net::ToSocketAddrs;
use std::sync::{Arc, RwLock};
use std::vec::Vec;
extern crate rustls;
use crate::nts_ke::server::rustls::Session;
use rustls::TLSError;
use tokio_rustls::server::TlsStream;
use tokio_rustls::{
rustls::{NoClientAuth, ServerConfig},
TlsAcceptor,
};
use tokio::io;
use tokio::net::Tc... |
use std::io::Write;
use super::pascal;
pub const ROOM_WIDTH: u32 = 20;
pub const ROOM_HEIGHT: u32 = 8;
pub const ROOM_AREA: usize = (ROOM_WIDTH * ROOM_HEIGHT) as usize;
const ROOM_RECORD_SIZE: usize = 0x168;
const ROOM_RECORD_UNKNOWN_A_OFFSET: usize = 0x0;
const ROOM_RECORD_TILE_OFFSET: usize = 0x1;
const ROOM_RECOR... |
use std::any::Any;
use std::sync::mpsc::{SyncSender, Receiver};
use pnet_datalink::NetworkInterface;
use pnet_packet::Packet;
pub type CoreMessage = (u8, Vec<u8>);
pub type CoreSender = SyncSender<CoreMessage>;
pub type CoreReceiver = Receiver<CoreMessage>;
pub trait Plugin: Any{
fn on_load(&mut self, iface:&N... |
/*===============================================================================================*/
// 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
//
// ... |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
mod abstract_environment_test {
use sparta::datatype::AbstractDomain;
use sparta::datatype::AbstractEnvironment;
use ... |
use spidev::{SpiModeFlags, Spidev, SpidevOptions};
use std::io;
extern crate rfid_rs;
fn create_spi() -> io::Result<Spidev> {
let mut spi = Spidev::open("/dev/spidev0.0")?;
let options = SpidevOptions::new()
.bits_per_word(8)
.max_speed_hz(20_000)
.mode(SpiModeFlags::SPI_MODE_0)
... |
use fbs::FlatBufferBuilder;
use std::borrow::Cow;
use std::path::Path;
use typed_builder::TypedBuilder;
pub fn index(request: Request<'_>) -> anyhow::Result<()> {
log::debug!("Attempting to load repo in path: {:?}", &request.path);
let packages_path = request.path.join("packages");
std::fs::create_dir_all(... |
export ptr_eq;
fn ptr_eq<T>(a: @T, b: @T) -> bool {
let a_ptr: uint = unsafe::reinterpret_cast(a);
let b_ptr: uint = unsafe::reinterpret_cast(b);
ret a_ptr == b_ptr;
}
|
use std::io::{self, BufRead};
// use std::ops::{Add, Sub};
use std::collections::HashMap;
struct Words {
var2num: HashMap<String, i32>,
num2var: HashMap<i32, String>,
}
impl Words {
fn def(&mut self, strs: &[&str]) {
let var = String::from(strs[0]);
let num: i32 = strs[1].parse().unwrap();... |
use std::{collections::VecDeque, convert::TryInto, net::Ipv4Addr, u32, usize};
use super::socket::SocketID;
/// transport packet, following fishnet format
/**
* <pre>
* This conveys the header for reliable message transfer.
* This is carried in the payload of a Packet, and in turn the data being
* transferred... |
use crossterm::event::KeyCode;
use tui::{
backend::Backend,
layout::Rect,
style::{Color, Modifier, Style},
text::{Span, Spans},
widgets::{Block, Borders, Paragraph},
Frame,
};
#[derive(Debug, Clone)]
pub struct Input {
pub block: bool,
pub val: String,
pub title: String,
pub sty... |
#![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 operations {
use crate::models::*;
use reqwest::StatusCode;
use snafu::{ResultExt, Snafu};
pub async f... |
use actix::*;
use actix_web::{web, App, HttpServer};
mod api;
mod chat_server;
mod message;
mod route;
mod rpc;
mod session;
mod settings;
use crate::chat_server::ChatServer;
mod pb {
pub mod teddy {
tonic::include_proto!("rua.teddy.v1");
}
pub mod maine {
tonic::include_proto!("rua.maine.... |
#[macro_use] extern crate serde_json;
#[macro_use] extern crate serde_derive;
extern crate rmp_serde;
extern crate byteorder;
extern crate indy;
#[macro_use]
mod utils;
use utils::wallet::Wallet;
use utils::constants::{DID_TRUSTEE, VERKEY_TRUSTEE, METADATA, DID};
use indy::ErrorCode;
use std::time::Duration;
use std:... |
use super::agent_transport::*;
use super::*;
use crate::candidate::candidate_base::{CandidateBase, CandidateBaseConfig};
use crate::candidate::candidate_peer_reflexive::CandidatePeerReflexiveConfig;
use crate::util::*;
pub type ChanCandidateTx = Option<Arc<mpsc::Sender<Option<Arc<dyn Candidate + Send + Sync>>>>>;
pub... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.