text stringlengths 8 4.13M |
|---|
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Entity {
pub id: u64,
pub name: Option<String>,
pub color: String,
pub sprite: Option<String>,
pub x: f64,
pub y: f64,
pub radius: f64,
#[serde(rename="entityType")]
pub entity_type: u64,
}
#[derive(Serialize, Deserialize, ... |
//! Essentially, all the engines here are based on the regexp approach.
//! The difference is that `regex` engine is the poor man's way where we
//! use our own regex pattern rule with the ripgrep executable together,
//! while `ctags` and `gtags` maintain theirs which are well polished.
mod ctags;
mod gtags;
mod rege... |
#[path = "erlang/abs_1.rs"]
pub mod abs_1;
#[path = "erlang/add_2.rs"]
pub mod add_2;
#[path = "erlang/and_2.rs"]
pub mod and_2;
#[path = "erlang/andalso_2.rs"]
pub mod andalso_2;
#[path = "erlang/append_element_2.rs"]
pub mod append_element_2;
#[path = "erlang/apply_2.rs"]
pub mod apply_2;
#[path = "erlang/atom_to_bin... |
use msfs::{
self,
sim_connect::{data_definition, Period, SimConnectRecv, SIMCONNECT_OBJECT_ID_USER},
};
#[data_definition]
#[derive(Debug)]
struct ControlSurfaces {
#[name = "ELEVATOR POSITION"]
#[unit = "Position"]
elevator: f64,
#[name = "AILERON POSITION"]
#[unit = "Position"]
ailero... |
pub struct Solution;
impl Solution {
pub fn max_envelopes(envelopes: Vec<Vec<i32>>) -> i32 {
let mut envelopes = envelopes;
envelopes.sort_unstable_by_key(|v| (v[0], -v[1]));
let mut dp = Vec::with_capacity(envelopes.len());
for v in envelopes {
if let Err(i) = dp.binary... |
use std::collections::HashMap;
fn main() {
let mut source : Vec<&str> = include_str!("./input_a.txt").lines().collect();
let mut amp = 0;
let amps = 50;
let mut programs: HashMap<usize, Program> = HashMap::new();
let mut p_outputs: HashMap<usize, Vec<isize>> = HashMap::new();
let mut p_inputs:... |
// Copyright 2016 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 ... |
use super::Part;
use crate::codec::{Decode, Encode};
use crate::{remote_type, RemoteEnum, RemoteObject};
remote_type!(
/// A solar panel. Obtained by calling `Part::solar_panel().`
object SpaceCenter.SolarPanel {
properties: {
{
Part {
/// Returns the part object for this solar ... |
// `without_binary_errors_badarg` in unit tests
// `with_binary_without_integer_start_errors_badarg` in unit tests
// `with_binary_with_positive_integer_start_without_integer_stop_errors_badarg` in unit tests
test_stdout!(
with_binary_with_start_less_than_or_equal_to_stop_returns_list_of_bytes,
"[0]\n[0, 1]\n[... |
/*!
*xmlparser* is a low-level, pull-based, zero-allocation
[XML 1.0](https://www.w3.org/TR/xml/) parser.
## Example
```rust
for token in xmlparser::Tokenizer::from("<tagname name='value'/>") {
println!("{:?}", token);
}
```
## Why a new library
The main idea of this library is to provide a fast, low-level and... |
pub mod genesis_block_util;
#[macro_export]
macro_rules! morgan_storage_controller {
() => {
(
"morgan_storage_controller".to_string(),
morgan_storage_api::id(),
)
};
}
use morgan_storage_api::storage_processor::process_instruction;
morgan_interface::morgan_entrypoint!(... |
use embedded_graphics::{
draw_target::DrawTarget,
prelude::{PixelColor, Point, Primitive},
primitives::{Circle, PrimitiveStyle, PrimitiveStyleBuilder, StrokeAlignment},
Drawable,
};
use embedded_gui::{
geometry::{measurement::MeasureSpec, BoundingBox, MeasuredSize},
widgets::{
graphical:... |
use std::fmt::Debug;
use proc_monadde_macro::*;
pub trait Parametrized<T>{}
pub trait Functor<T: Sized+Copy, O: Sized+Copy+Default> {
type UnderlyingO: Parametrized<O>;
fn map<F: Fn(T) -> O>(&self, f: F) -> Self::UnderlyingO;
}
pub trait Monad<T: Sized+Copy, O: Sized+Copy+Default> : Functor<T, O> {
fn flat... |
use super::GoGame;
use super::stone;
use super::NEIGHBOURS;
use super::DIAG_NEIGHBOURS;
use super::VIRT_LEN;
use super::MAX_SIZE;
use super::Vertex;
use super::PASS;
extern crate rand;
use rand::SeedableRng;
#[test]
fn stone_opponent() {
assert_eq!(stone::WHITE, stone::BLACK.opponent());
assert_eq!(stone::BLACK, ... |
use std::cmp;
use std::fmt;
use std::iter;
use std::ops::{Index, Range};
use unicode_width::UnicodeWidthStr;
use crate::buffer::units::{ByteIndex, BytePosition, CharPosition};
/// Underlying storage for the buffer contents.
///
/// The storage contains at least one (empty) line.
#[derive(Debug, PartialEq, Eq)]
pub s... |
extern crate zbx_sender;
use zbx_sender::{Response, Result, Sender};
use std::env;
fn send_one_value(command: &str) -> Result<Response> {
let sender = Sender::new(command.to_owned(), 10051);
sender.send(("host1", "key1", "value"))
}
fn main() {
let command = match env::args().nth(1) {
Some(cmd) =... |
use std::io::Read;
fn main() {
let mut input = String::new();
std::io::stdin().read_to_string(&mut input).unwrap();
let mut decks: Vec<std::collections::VecDeque<u8>> = input.split("\n\n").map(|deck| {
deck.lines().skip(1).map(|card| card.parse().unwrap()).collect()
}).collect();
while de... |
use std::fmt;
use super::super::geometry::Geometry;
use super::Item;
pub struct Wall{
pub geo:Geometry,
pub width: i32,
pub height: i32,
}
impl Item for Wall {
fn geometry(&self) -> &Geometry{
&self.geo
}
}
impl fmt::Display for Wall {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Res... |
//! An efficient data structure to sample from a discrete, fixed distribution.
//!
//! See: <https://www.keithschwarz.com/darts-dice-coins/> for an explanation.
use std::fmt::Debug;
use fastrand::Rng;
/// An efficient data structure to sample from a discrete, fixed distribution.
///
/// ```
/// use fuzzcheck::mutato... |
use crate::prelude::*;
use std::hash::{Hash, Hasher};
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug, PartialEq)]
pub struct VkSamplerCreateInfo {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkSamplerCreateFlagBits,
pub magFilter: VkFilter,
pub minFilter: Vk... |
pub type Id = String; |
use super::VarResult;
use crate::ast::stat_expr_types::VarIndex;
use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType};
use crate::helper::err_msgs::*;
use crate::helper::str_replace;
use crate::helper::{
ge1_param_i64, move_element, pine_ref_to_bool, pine_ref_to_f64, pine_ref_to_... |
mod builder_test;
mod macro_test;
fn setup_test_env() {
colored::control::set_override(true);
}
|
use std::os::raw::c_double;
#[repr(C)]
#[derive(Debug)]
pub struct VkMVKSwapchainPerformance {
pub lastFrameInterval: c_double,
pub averageFrameInterval: c_double,
pub averageFramesPerSecond: c_double,
}
|
use {
crate::switchboard::base::*,
crate::switchboard::hanging_get_handler::{HangingGetHandler, Sender},
crate::switchboard::switchboard_impl::SwitchboardImpl,
fidl_fuchsia_settings::{
DeviceRequest, DeviceRequestStream, DeviceSettings, DeviceWatchResponder,
},
fuchsia_async as fasync,
... |
use serde::{Serialize, Deserialize};
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
pub struct Point {
pub x: f64,
pub y: f64,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Polygon{
pub points: Vec<Point>,
pub edges: Vec<(usize,usize)>,
}
pub fn modular (val: i64, n: i64) -> usiz... |
use crate::cli;
use crate::intcode;
pub fn run() {
let filename = cli::aoc_filename("aoc_2019_05.txt");
let prog = intcode::read_from_file(filename);
println!("{:?}", intcode::one_off_output(&prog, Some(vec![1])));
println!("{:?}", intcode::one_off_output(&prog, Some(vec![5])));
}
|
use tracing::error;
use warp::http::StatusCode;
use super::VmInput;
use crate::state;
use crate::state::StatePtr;
use crate::vm;
pub async fn handler(
body: VmInput,
state_ptr: StatePtr,
) -> Result<Box<dyn warp::Reply>, warp::Rejection> {
if state::get_vm_pid(state_ptr.clone(), &body.vm_name)
.aw... |
use spin::Mutex;
use core::mem;
extern "C" {
fn gdt_flush(ptr: u32);
}
const MAX_ENTRIES: usize = 256;
pub const KRNL_CODE_SEL: u16 = 0x8;
pub const KRNL_DATA_SEL: u16 = 0x10;
#[repr(C, packed)]
#[derive(Copy, Clone, Default)]
struct GdtEntry {
limit: u16,
base_low: u16,
base_middle: u8,
access: u8,
gra... |
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::{Ident, LitStr};
pub(super) fn generate_bed_open_code(
id: &Ident,
path: &LitStr,
size: usize,
compressed: bool,
) -> TokenStream2 {
// TODO : At this point we just assume everything is sorted, but this
// is not actually ... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
use super::{acpi_table::*, phys_to_virt};
use alloc::boxed::Box;
use alloc::vec::Vec;
use apic::IoApic;
use ps2_mouse::{Mouse, MouseState};
use spin::Mutex;
use trapframe::TrapFrame;
const IO_APIC_NUM_REDIRECTIONS: u8 = 120;
const TABLE_SIZE: usize = 256;
pub typ... |
//!
//! An example of the time_calc crate in action.
//!
extern crate time_calc;
use time_calc::{
Bars,
Beats,
Bpm,
Division,
DivType,
Measure,
Ms,
Ppqn,
SampleHz,
Samples,
Ticks,
TimeSig,
};
// "Samples per second" is used to convert between samples and milliseconds.... |
//
// wallpaper.rs
// Copyright (C) 2019 Malcolm Ramsay <malramsay64@gmail.com>
// Distributed under terms of the MIT license.
//
use anyhow::{anyhow, Error};
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use crate::{CrystalFamily, Transform2};
#[derive(Clone, Serialize, Deserialize)]
pub struct Wa... |
use serenity::prelude::Context;
use serenity::model::channel::Message;
use serenity::framework::standard::{
CommandResult,
macros::command,
};
#[command]
pub fn ping(context: &mut Context, message: &Message) -> CommandResult {
message.reply(context, "Pong!")?;
Ok(())
} |
//给定一个正整数,返回它在 Excel 表中相对应的列名称。
//
// 例如,
//
// 1 -> A
// 2 -> B
// 3 -> C
// ...
// 26 -> Z
// 27 -> AA
// 28 -> AB
// ...
//
//
// 示例 1:
//
// 输入: 1
//输出: "A"
//
//
// 示例 2:
//
// 输入: 28
//输出: "AB"
//
//
// 示例 3:
//
// 输入: 701
//输出: "ZY"
//
//
impl Solution {
pub fn convert_to_title(n: i... |
// Copyright (c) 2016, Ben Boeckel
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of cond... |
use super::v2;
impl From<v2::License> for openapiv3::License {
fn from(v2: v2::License) -> Self {
openapiv3::License {
name: v2.name.unwrap_or_default(),
url: v2.url,
extensions: indexmap::IndexMap::new(),
}
}
}
|
use crate::{
beam::Beam, beam_iter::BeamIter, grid::Grid, position::TilePosition, ray::Ray,
ray_iter::RayIter, rays::rays_from, AngleRad, BeamIntersect,
};
#[derive(Debug, Default, PartialEq)]
pub struct Crossing {
pub valid: Option<TilePosition>,
pub invalid: Option<TilePosition>,
}
pub struct TileRa... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use crate::helpers::ID;
use crate::ui::UI;
use ezgui::{Color, EventCtx, GfxCtx, Key, ModalMenu};
use geom::{Duration, PolyLine};
use map_model::LANE_THICKNESS;
use sim::{AgentID, TripID, TripResult};
pub enum RouteViewer {
Inactive,
Hovering(Duration, AgentID, PolyLine),
Active(Duration, TripID, Option<Pol... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use std::{num::NonZeroU64, time::Duration};
use pathfinder_common::Chain;
use pathfinder_ethereum::{EthereumApi, EthereumStateUpdate};
use pathfinder_retry::Retry;
use primitive_types::H160;
use tokio::sync::mpsc;
use crate::state::sync::SyncEvent;
#[derive(Clone)]
pub struct L1SyncContext<EthereumClient> {
pub ... |
macro_rules! term_is_not_number {
($name:ident) => {
crate::runtime::context::term_is_not_number(stringify!($name), $name)
};
}
#[macro_export]
macro_rules! term_try_into_atom {
($name:ident) => {
crate::runtime::context::term_try_into_atom(stringify!($name), $name)
};
}
macro_rules! t... |
extern crate bindgen;
use std::env;
use std::path::{Path, PathBuf};
fn main() {
let target = env::var("TARGET").unwrap();
let mut lib_dir = Path::new("/");
if target.contains("windows") {
lib_dir = Path::new("C:\\Program Files\\PicoQuant\\HydraHarp-HHLibv30");
println!("cargo:rustc-link-s... |
// Copyright (c) 2017 Nikita Pekin and the xkcd_rs contributors
// See the README.md file at the top-level directory of this distribution.
//
// 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/li... |
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
/// The Delegator Contract
///
/// Instantiates all the other contracts, and acts as a facade to interact with them.
#[ink::contract]
mod newomegadelegator {
use newomega::NewOmega;
use newomega::FightResult;
use newomega::Move;
use newom... |
//! Provides types and functionality for the Discord [Overlay](https://discord.com/developers/docs/game-sdk/overlay)
pub mod events;
use crate::{Command, CommandKind, Error};
use serde::Serialize;
#[derive(Serialize)]
struct OverlayToggle {
/// Our process id, this lets Discord know what process it should try
... |
#[doc = "Reader of register CIFR"]
pub type R = crate::R<u32, super::CIFR>;
#[doc = "Reader of field `LSIRDYF`"]
pub type LSIRDYF_R = crate::R<bool, bool>;
#[doc = "Reader of field `LSERDYF`"]
pub type LSERDYF_R = crate::R<bool, bool>;
#[doc = "Reader of field `MSIRDYF`"]
pub type MSIRDYF_R = crate::R<bool, bool>;
#[do... |
use procon_reader::ProconReader;
fn main() {
let stdin = std::io::stdin();
let mut rd = ProconReader::new(stdin.lock());
let n: usize = rd.get();
let k: usize = rd.get();
let cp: Vec<(char, usize)> = (0..k)
.map(|_| {
let c: char = rd.get();
let p: usize = rd.get();... |
use std::time::SystemTime;
use serde::{Deserialize, Serialize};
use crate::land::MeshData;
/// Uniquely identifies a single unidirectional stream of data within a single network connection
#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq)]
pub enum StreamType {
TextChat,
PingPong,
WorldTileData
}
/// Enu... |
use std::result::Result;
use quicli::prelude::*;
use clap_port_flag::Port;
use futures::prelude::*;
use hyper::{self, service::service_fn, Body, Response, Server, StatusCode};
use mime_guess;
use tokio;
use Site;
pub fn serve(site: Site, port: &Port) -> Result<(), Error> {
let site = Box::new(site);
let sit... |
extern crate cmake;
use cmake::Config;
fn main() {
let dst = Config::new("external/CascLib")
.define("CASC_BUILD_STATIC_LIB", "ON")
.profile("Release")
.build();
println!("cargo:rustc-link-search=native={}/lib", dst.display());
println!("cargo:rustc-link-lib=static=casc");
pri... |
#![cfg_attr(not(feature = "std"), no_std)]
pub use self::meeting::Meeting;
use ink_lang as ink;
/**
活动合约
1. 由活动模板合约创建,每个模板匹配一个活动合约
2. 每个活动会独立部署一个合约(实例);
3. 所有合约的操作都是通过活动合约实现;
*/
#[ink::contract]
pub mod meeting {
use ink_prelude::vec::Vec;
use ink_storage::{
collections::HashMap as StorageMap,
... |
//! # Simple module to simulate a database layer.
//!
//! The module has a single method currently to provide a Vec<> of all cards.
use rustc_serialize::json;
// the include_str! macro embeds the file in the executable as a static string
const CARDS_JSON: &'static str = include_str!("../res/cards.json");
#[derive(Clo... |
#[doc = "Reader of register MTLTxQOMR"]
pub type R = crate::R<u32, super::MTLTXQOMR>;
#[doc = "Writer for register MTLTxQOMR"]
pub type W = crate::W<u32, super::MTLTXQOMR>;
#[doc = "Register MTLTxQOMR `reset()`'s with value 0x0007_0008"]
impl crate::ResetValue for super::MTLTXQOMR {
type Type = u32;
#[inline(al... |
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;
#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 998244353;
fn ... |
use clippy_utils::consts::constant_simple;
use clippy_utils::diagnostics::span_lint_and_sugg;
use clippy_utils::source::{indent_of, reindent_multiline, snippet_opt};
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::usage::contains_return_break_continue_macro;
use clippy_utils::{in_constant, is_lang_ctor... |
use super::CGFloat;
/// A point in a two-dimensional coordinate system.
///
/// See [documentation](https://developer.apple.com/documentation/coregraphics/cgpoint).
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, PartialOrd, PartialEq)]
pub struct CGPoint {
/// The x-coordinate of the point.
pub x: CGFloat,
... |
use super::evaluate::Evaluate;
use super::{
Callable, Category, ComplexType, DataType, PineClass, PineFrom, PineRef, PineStaticType,
PineType, Runnable, RuntimeErr, SecondType,
};
use crate::runtime::Ctx;
#[derive(Debug)]
pub struct CallObjEval<'a> {
obj: Box<dyn PineClass<'a> + 'a>,
create_val: fn() -... |
#[doc = "Reader of register PLLSTAT"]
pub type R = crate::R<u32, super::PLLSTAT>;
#[doc = "Reader of field `LOCK`"]
pub type LOCK_R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 0 - PLL Lock"]
#[inline(always)]
pub fn lock(&self) -> LOCK_R {
LOCK_R::new((self.bits & 0x01) != 0)
}
}
|
mod common;
use common::exe;
use duct::cmd;
use std::io::Write;
fn simple_test(stdin: &str, expected_stdout: &str) {
let stdout = cmd!(exe(), "bc").stdin_bytes(stdin).read().unwrap();
assert_eq!(stdout, expected_stdout);
}
fn file_test(file: &str, stdin: &str, expected_stdout: &str) {
let mut input_file = tempf... |
pub struct Configuration {
pub player_count: i8
}
pub fn parse_parameters(params : Vec<String>) -> Configuration {
if params.len() <= 1 {
panic!("error: Cantidad insuficiente de parametros");
}
let player_count: i8 = match params[1].parse() {
Ok(n) => {
n
},
... |
use super::traits::VPath;
use globset::{Glob, GlobMatcher, GlobSet, GlobSetBuilder};
#[derive(Clone)]
pub enum Globber {
Single(GlobMatcher),
Set(GlobSet),
}
impl Globber {
pub fn new<S: AsRef<str>>(pattern: S) -> Globber {
Globber::Single(Glob::new(pattern.as_ref()).unwrap().compile_matcher())
... |
use std::io::Write as _;
use criterion::{black_box, Criterion};
fn stream(c: &mut Criterion) {
for (name, content) in [
("demo.vte", &include_bytes!("../tests/demo.vte")[..]),
("rg_help.vte", &include_bytes!("../tests/rg_help.vte")[..]),
("rg_linus.vte", &include_bytes!("../tests/rg_linus.... |
// Test that Cell is considered invariant with respect to its
// type.
// revisions: base nll
// ignore-compare-mode-nll
//[nll] compile-flags: -Z borrowck=mir
use std::cell::Cell;
struct Foo<'a> {
x: Cell<Option<&'a isize>>,
}
fn use_<'short,'long>(c: Foo<'short>,
s: &'short isize,
... |
/*
This module provides an NFA compiler using Thompson's construction
algorithm. The compiler takes a regex-syntax::Hir as input and emits an NFA
graph as output. The NFA graph is structured in a way that permits it to be
executed by a virtual machine and also used to efficiently build a DFA.
The compiler deals with a... |
use input_i_scanner::InputIScanner;
use std::collections::VecDeque;
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
macro_rules! scan {
(($($t: ty),+)) => {
($(scan!($t)),+)
};
($t: ty) => {
_i_i.scan::<$t>() as $t... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#![feature(test)]
extern crate test;
mod option;
mod trait_object;
mod stack_alloc;
mod sneaky_stack_alloc;
mod proper_alloc;
mod invalidate;
mod alias;
|
use winit::{
dpi::{PhysicalPosition, PhysicalSize},
event::{Event, MouseScrollDelta, WindowEvent::*},
event_loop::{ControlFlow, EventLoop},
};
use crate::{
rendering::{Display, GUIRenderer, SimRenderer},
simulation::Simulation,
};
pub struct RenderDriver {
pub display: Display,
pub sim_ren... |
pub struct Edge {
pub point_1: usize,
pub point_2: usize,
pub length: f64,
}
use point::Point;
pub fn update_points_for_edge(orig_length: f64, p1: &mut Point, p2: &mut Point) {
let vec_diff = p1.current_position() - p2.current_position();
let edge_length_diff = vec_diff.norm() - orig_length;
... |
#![deny(warnings, missing_docs, missing_debug_implementations)]
//! The core library that allows you to match a regex against buffers and collect
//! the results. It also provides the ability to display this in a colorful way
//! to a terminal.
extern crate glob;
extern crate regex;
extern crate colored;
mod matcher;... |
use actix_web::Error;
use actix_web::HttpRequest;
use actix_web::HttpResponse;
use actix_web::Responder;
use auth::{claims::AccessToken, claims::RefreshToken};
use bigneon_db::models::User;
use crypto::sha2::Sha256;
use jwt::{Component, Header, Token};
use serde_json;
use uuid::Uuid;
#[derive(Serialize, Deserialize)]
... |
// Copyright 2016 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 ... |
use std::net::SocketAddrV4;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::mpsc;
mod command;
use nardol::error::NetCommsError;
use shared::ImplementedMessage;
use shared::user::UserLite;
use utils::input;
mod client;
use client::*;
use crate::client::open_database;
// ERROR HANDLING
fn main() -> Res... |
use crate::datastructure::DataStructure;
use crate::generator::Generator;
use crate::postprocessors::identity::IdentityPostProcessor;
use crate::postprocessors::PostProcessor;
use crate::raytracer::RayTracer;
use crate::renderer::Renderer;
use crate::shader::Shader;
pub struct RendererBuilder<'a> {
pub(self) gener... |
//! Compiles the language build configurations in configs/ into two files (one for the tokenizer, one for the rules)
//! so they can be inlined. These configs are included at compile time because they define the neccessary parameters to
//! run the rules for a language correctly. They are NOT user configuration.
use f... |
// Copyright (c) 2020 Sam Blenny
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
#![forbid(unsafe_code)]
use crate::framebuffer::{LINES, WIDTH};
use crate::pt::Pt;
/// ClipRect specifies a region of pixels. X and y pixel ranges are inclusive of
/// min and exclusive of max (i.e. it's min.x..max.x rather than min.x..... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
use rand::Rng;
use rand_distr::{Normal, Distribution};
use std::cmp;
use std::collections::HashMap;
use actix::prelude::*;
use serde::{Deserialize, Serialize};
const MAX_ASTEROID:i32 = 180;
const MIN_ASTEROID:i32 = 80;
#[derive(Copy, Clone, Message, Default, Serialize, Deserialize)]
#[rtype(result = "()")]
pub struc... |
pub mod utilities;
use crate::utilities::Verify;
use proffer::*;
#[test]
fn basic_gen() {
let struct_ = Struct::new("Basic")
.set_is_pub(true)
.add_attribute("#[derive(Clone)]")
.add_field(
Field::new("field1", "String")
.set_is_pub(true)
.add_at... |
//! Stops xidlehook completely at a specific index of the chain or at
//! the end. This is used to implement `--once` in the xidlehook
//! example application.
use crate::{Module, Progress, Result, TimerInfo};
use std::fmt;
use log::trace;
/// See the module-level documentation
#[derive(Clone, Copy)]
pub struct Sto... |
extern crate capstone;
use capstone::prelude::*;
const X86_CODE: &'static [u8] =
b"\x55\x48\x8b\x05\xb8\x13\x00\x00\xe9\x14\x9e\x08\x00\x45\x31\xe4";
fn main() {
let mut cs = Capstone::new()
.x86()
.mode(arch::x86::ArchMode::Mode64)
.detail(true)
.build()
.expect("Fai... |
use bevy::prelude::*;
use multimap::MultiMap;
use std::borrow::Cow;
use std::collections::HashMap;
use std::hash::Hash;
// IDEA: Can we instead implicitly declare indexes by passing in a ComponentIndex<T> to our systems?
// We don't actually want the full resource structure, since these should never be manually updat... |
fn main() {
let mut n = 1;
loop {
println!("Hello! {}", n);
n += 1;
std::thread::sleep_ms(1000);
}
}
|
use std::collections::HashMap;
use std::fs::File;
use std::path::{Path, PathBuf};
use clap::{app_from_crate, Arg};
use image::{ImageBuffer, RgbaImage, Rgba, ImageFormat};
use serde::{Deserialize, Deserializer};
use serde::de::Error;
fn main() {
let matches = app_from_crate!()
.arg(Arg::with_name("image-sr... |
use std::cell::Cell;
use hardware::pin::Pin;
use hardware::peripherals::digital_io::DigitalOutput;
use hardware::peripherals::digital_io::DigitalValue;
use hardware::peripherals::time::Time;
use wasp::motor::Direction;
use wasp::motor::StepperDriverConfig;
use wasp::motor::StepperDriver;
// Does not compile yet. ... |
pub fn square_of_sum(n: u32) -> u32 {
// unimplemented!("square of sum of 1...{}", n)
let mut ans = 0;
for i in 1..=n {
ans = ans + i;
}
ans = ans.pow(2);
return ans;
}
pub fn sum_of_squares(n: u32) -> u32 {
// unimplemented!("sum of squares of 1...{}", n)
let mut ans = 0;
f... |
// Copyright 2022 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#![warn(missing_docs)]
//! Convert between pinyin forms or zhuyin.
extern crate phf;
use std::str;
use std::string::String;
use std::vec::Vec;
// MAP_P2Z and MAP_Z2P static maps
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
static PINYIN_TONES: [[char; 5]; 6] =
[['a', 'ā', 'á', 'ǎ', 'à'],
['o', 'ō', 'ó',... |
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
use input_i_scanner::{scan_with, InputIScanner};
fn main() {
let stdin = std::io::stdin();
let mut _i_i = InputIScanner::from(stdin.lock());
let n = scan_with!(_i_i, usize);
let mut deg = vec![0; n];
for _ in 0..(n - 1) {
let (a, b) = scan_with!(_i_i, (usize, usize));
deg[a - 1] +=... |
fn main() {
println!("Hello, qemu!");
}
|
#![deny(warnings)]
#![deny(unsafe_code)]
#![no_main]
#![no_std]
extern crate panic_halt;
use cortex_m::asm;
use cortex_m_rt::entry;
use stm32l0xx_hal::{pac, prelude::*, rcc::Config};
#[entry]
fn main() -> ! {
let dp = pac::Peripherals::take().unwrap();
let cp = cortex_m::Peripherals::take().unwrap();
//... |
use std::ptr;
use std::f32;
use std::u32;
use std::ffi::CString;
use crate::Battery;
use crate::technology::Technology;
use crate::state::State;
/// Returns battery percentage.
///
/// # Panics
///
/// This function will panic if passed pointer is `NULL`
#[no_mangle]
pub unsafe extern fn battery_get_percentage(ptr: *... |
use ast::*;
use env::*;
use parse::parse;
use transform::*;
use util::resolve;
use std::vec::append;
use std::hashmap::HashMap;
fn new_env() -> CompileTimeEnv {
let env0 = ~[];
let env1 = extend(&env0, "lambda", TFun);
let env2 = extend(&env1, "quote", TQuote);
let env3 = extend(&env2, "syntax", TQuot... |
#![allow(unused)]
use azsys;
use std::fmt;
#[derive(PartialEq, Debug)]
pub enum AzReturnCode {
AzResultCoreOk = azsys::az_result_core_AZ_OK as isize,
AzResultCoreErrorCanceled = azsys::az_result_core_AZ_ERROR_CANCELED as isize,
AzResultCoreErrorArg = azsys::az_result_core_AZ_ERROR_ARG as isize,
AzRes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.