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 ... |
use projecteuler::factorial;
fn main() {
dbg!(solve(1, vec![0, 1, 2]));
dbg!(solve(1_000_000, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]));
}
fn solve(mut n: usize, mut digits: Vec<usize>) -> usize {
n -= 1;
let mut ret = 0;
while digits.len() > 0 {
let m: usize = factorial::factorial(digits.len()... |
extern crate progress_streams;
use progress_streams::ProgressWriter;
use std::io::{Cursor, Write};
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread;
use std::time::Duration;
fn main() {
let total = Arc::new(AtomicUsize::new(0));
let mut file = Cursor::new(Vec::new());
le... |
//! Models for sonar go here
use auth::pw::SaltyPassword;
use chrono::NaiveDateTime;
use db::Connection;
use diesel;
use diesel::prelude::*;
use diesel::result::QueryResult;
use schema::{users, pings, auth_tokens};
#[derive(Identifiable, Queryable)]
pub struct User {
pub id: i32,
pub username: String,
pass... |
pub extern crate glium;
extern crate cgmath;
mod types;
pub mod camera;
pub mod transform;
pub mod graphics;
pub mod mesh;
pub use graphics::{Target, Shader, Renderer};
pub use mesh::Mesh;
pub use types::{Mat4, Scalar};
#[macro_export]
macro_rules! implement_uniforms {
($tyname: ty, $( $field: ident ),*) => {
... |
use crate::base::misc::util::{downcast_to_usize};
use crate::api::account_info;
use std::cell::Cell;
use std::rc::Rc;
use crate::api::config::Config;
pub fn get_account_sequence(config: &Config, account: String) -> u32 {
let seq_rc = Rc::new(Cell::new(0u64));
account_info::api::request(config, acco... |
use anyhow::Result;
use hxcmp::{matrix, tests};
// fn main() -> Result<()> {
// matrix::run()?;
// Ok(())
// }
use clap::{load_yaml, App};
fn main() -> Result<()> {
// The YAML file is found relative to the current file, similar to how modules are found
let yaml = load_yaml!("cli.yaml");
let match... |
use std::time::Instant;
use std::io;
use std::env;
trait Futoshiki {
fn blocking_indexes(&self, r: u32, c: u32) -> Vec<usize>;
fn next_index(&self, flag: char) -> Option<(u32, u32)>;
fn forward_check(&self, value: u32, blocking_indexes_vec: &Vec<usize>, flag: char) -> bool;
fn can_put_num(&self, r: u3... |
use std::path::{Path, PathBuf};
use std::process;
use crate::config::mimetype;
pub fn stringify_mode(mode: u32) -> String {
const LIBC_FILE_VALS: [(libc::mode_t, char); 7] = [
(libc::S_IFREG, '-'),
(libc::S_IFDIR, 'd'),
(libc::S_IFLNK, 'l'),
(libc::S_IFSOCK, 's'),
(libc::S_... |
extern crate piston;
extern crate glutin_window;
extern crate graphics;
extern crate opengl_graphics;
// extern crate blas_src;
extern crate openblas_src;
use piston::window::WindowSettings;
use piston::event_loop::{Events, EventLoop, EventSettings};
use piston::input::RenderEvent;
use glutin_window::GlutinWindow;
us... |
//! Implementation details of the `#[sabi_extern_fn]` attribute.
use std::mem;
use as_derive_utils::return_spanned_err;
use proc_macro::TokenStream as TokenStream1;
use proc_macro2::{Span, TokenStream as TokenStream2, TokenTree};
use quote::{quote, ToTokens};
use syn::{Expr, ItemFn};
use crate::parse_or_compile_e... |
use crate::{rendering::Display, simulation::Simulation, timing::TIMING_DATABASE};
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
pub struct PerfApp;
impl PerfApp {
pub fn update(&mut self, ctx: &egui::CtxRef, _display: &Display, _simulation: &Simulation) {
egui::SidePan... |
use super::window::Window;
use std::borrow::Borrow;
use std::marker::PhantomData;
use std::rc::Rc;
use std::sync::Arc;
use vulkano::command_buffer::DynamicState;
use vulkano::device::{Device, DeviceExtensions, Queue};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract};
use vulkano::image;
... |
#![allow(unused_imports, non_camel_case_types, non_snake_case)]
extern crate libc;
extern crate glib;
extern crate glib_sys;
pub mod kb;
pub mod nvti;
pub mod ast;
pub use self::kb::*;
pub use self::nvti::*;
pub use self::ast::*;
// https://developer.gnome.org/glib/stable/glib-Basic-Types.html#D
pub type gchar = s... |
// 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 sourcerenderer_core::Platform;
use sourcerenderer_core::platform::FileWatcher;
use std::sync::Arc;
use sourcerenderer_core::platform::{Window, ThreadHandle};
use std::error::Error;
use sourcerenderer_vulkan::{VkBackend, VkInstance, VkSurface, VkDevice, VkSwapchain};
use ndk::native_window::NativeWindow;
use ndk_sys... |
use std::io::BufRead;
fn get_input() -> std::vec::Vec<[bool; 31]> {
std::io::BufReader::new(std::fs::File::open("input.txt").unwrap_or_else(|_| {
panic!(
"current dir: {}",
std::env::current_dir().unwrap().display()
)
}))
.lines()
.map(|s| -> [bool; 31] {
... |
pub use crate::{Type, Ty};
use intern::Intern;
pub struct LayoutCtx<'t, 'l> {
pub defaults: DefaultLayouts<'t, 'l>,
interner: &'l LayoutInterner<'t, 'l>,
types: &'t crate::ty::TyCtx<'t>,
}
pub struct DefaultLayouts<'t, 'l> {
pub unit: TyLayout<'t, 'l>,
pub bool: TyLayout<'t, 'l>,
pub char: TyL... |
mod helloTriangleApplication;
fn main() {
let mut app = helloTriangleApplication::HelloTriangleApplication::init();
app.main_loop();
} |
//! The module implements an HTTP/2 client driven by Tokio's async IO.
//!
//! It exports the `H2Client` struct, which exposes the main client API.
use std::io;
use std::fmt;
use std::error::Error;
use solicit::http::{self as http2, StaticHeader};
mod tokio_layer;
mod client_wrapper;
mod connectors;
mod tls;
pub us... |
use {
crate::{
demos::{Chunk, Demo},
types::{Hitable, HitableList, Ray, Sphere, Vec3},
Camera,
},
rand::Rng,
};
pub struct SimpleAntialiasing;
impl Demo for SimpleAntialiasing {
fn name(&self) -> &'static str {
"simple-antialiasing"
}
fn world(&self) -> Option<H... |
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::GString;
use glib_sys;
use std::box... |
use crate::utl;
use colored::*;
use std::io::Write;
// note: just a quick direct translation of my C code from the early 90s ;)
/// Classification results
pub struct C12nResults {
model_class_names: Vec<String>,
result: Vec<Vec<i32>>,
confusion: Vec<Vec<i32>>,
// TODO eventually remove some to the ab... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
use std::net::SocketAddr;
use serde::{Deserialize, Serialize};
use saoleile_derive::NetworkEvent;
use crate::event::NetworkEvent;
#[derive(Clone, Debug, Deserialize, NetworkEvent, Serialize)]
pub struct DisconnectEvent { }
#[derive(Clone, Debug, Deserialize, NetworkEvent, Serialize)]
pub struct DroppedNetworkEvent... |
fn main() {
let mut s = String::from("Hello");
change_str(&mut s);
println!("{}", s);
}
fn change_str(some_str: &mut String) {
some_str.push_str(", World!");
}
|
// MinIO Rust Library for Amazon S3 Compatible Cloud Storage
// Copyright 2022 MinIO, Inc.
//
// 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... |
mod apis;
mod models;
|
use super::v2;
pub(crate) fn invalid_referenceor<T>(message: String) -> openapiv3::ReferenceOr<T> {
debug_assert!(false, "{}", message);
openapiv3::ReferenceOr::ref_(&message)
}
impl<T> From<v2::Reference> for openapiv3::ReferenceOr<T> {
#[allow(clippy::only_used_in_recursion)]
fn from(v2: v2::Referen... |
pub struct ApiKeyAuthor(String);
#[derive(Debug)]
pub enum ApiKeyError {
BadCount,
Missing,
Invalid,
}
|
mod question;
use anyhow::Error;
use serde::Deserialize;
// use std::error::Error;
use question::Question;
use wasm_bindgen::prelude::*;
use yew::prelude::*;
use yew::{
format::{Json, Nothing},
prelude::*,
services::fetch::{FetchService, FetchTask, Request, Response},
};
use yew::services::ConsoleService;... |
use std::collections::HashMap;
use juniper::GraphQLObject;
use serde::Deserialize;
#[derive(Deserialize, Clone)]
pub struct Recipe {
pub name: String,
#[serde(default)]
pub notes: Option<String>,
pub tags: Vec<String>,
#[serde(default)]
pub image: Option<String>,
#[serde(default)]
pub ... |
//
// shape.rs
//
// Copyright (C) 2019 Malcolm Ramsay <malramsay64@gmail.com>
// Distributed under terms of the MIT license.
//
pub use super::Transform2;
pub mod components;
pub mod line_shape;
pub mod lj_shape;
pub mod molecular_shape2;
pub use components::*;
pub use line_shape::*;
pub use lj_shape::*;
pub use m... |
//! Utilities for importing catalog and data from files
//! MORE COMING SOON: <https://github.com/influxdata/influxdb_iox/issues/7744>
use bytes::Bytes;
use data_types::{
partition_template::{
NamespacePartitionTemplateOverride, TablePartitionTemplateOverride, PARTITION_BY_DAY_PROTO,
},
ColumnSet, ... |
use std::collections::HashSet;
use juniper::FieldResult;
use super::context::Context;
use crate::error::Error;
use crate::recipe::Recipe;
use crate::review::Review;
pub struct Query;
#[juniper::graphql_object(context = Context)]
impl Query {
/// Find a recipe by name
pub fn recipe(name: String, context: &Co... |
pub struct Solution;
impl Solution {
pub fn is_self_crossing(x: Vec<i32>) -> bool {
if x.len() < 4 {
return false;
}
let mut i = 3;
let mut x0 = 0;
let mut x1 = 0;
let mut x2 = x[0] as i64;
let mut x3 = x[1] as i64;
let mut x4 = x[2] as i6... |
use join::Join;
use proconio::input;
fn main() {
input! {
n: usize,
};
let mut x = Vec::new();
if n % 4 > 0 {
x.push(n % 4);
}
x.extend(vec![4; n / 4]);
let m = x.iter().map(|d| d * 2).sum::<usize>();
println!("{}", m);
println!("{}", x.iter().join(""));
}
|
use crate::{
core::{
color::Color,
visitor::{
Visit,
Visitor,
VisitResult
}
},
scene::base::{
BaseBuilder,
Base,
AsBase
}
};
#[derive(Clone)]
pub struct SpotLight {
hotspot_cone_angle: f32,
falloff_angle_delta: ... |
use crate::{DocBase, VarType};
const DESCRIPTION: &'static str = r#"
Stochastic. It is calculated by a formula: `100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length))`
"#;
const ARGUMENT: &'static str = r#"
**source (series)** Source series.
**high (series)** Series of high.
**low (serie... |
use super::Root;
pub struct Provider {
root: &Root
}
impl Provider {
pub fn new(root: &Root) -> Provider {
Provider {
root: root
}
}
}
|
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::module_name_repetitions)]
#[macro_use]
extern crate assert_float_eq;
pub mod matrix;
mod number_traits;
pub mod quaternion;
pub mod vector;
|
use criterion::{black_box, criterion_group, criterion_main, Benchmark, BenchmarkId, Criterion};
use serde_json::Value;
use std::{collections::HashMap, fs, io::Read, path::Path};
use vector::{
transforms::{wasm::Wasm, Transform},
Event,
};
fn parse_event_artifact(path: impl AsRef<Path>) -> vector::Result<Event>... |
use crate::lexer::*;
/// `'` *single_quoted_string_character** `'`
pub(crate) fn single_quoted_string(i: Input) -> StringResult {
let (i, _) = char('\'')(i)?;
let (i, contents) = many0(single_quoted_string_character)(i)?;
let (i, _) = char('\'')(i)?;
let mut string = String::new();
for s in content... |
use clap::{App, Arg};
use env_logger;
use pickup::printer::Printer;
use pickup::reader::Reader;
use pickup::storage::FileStorage;
use pickup::{Pickup, PickupOpts};
use std::io;
fn main() -> io::Result<()> {
env_logger::init();
let stdio = io::stdin();
let stdin = stdio.lock();
let stdout = io::stdout(... |
use yew::prelude::*;
use yew_router::components::RouterAnchor;
use crate::app::AppRoute;
pub struct SsoHome {}
pub enum Msg {}
impl Component for SsoHome {
type Message = Msg;
type Properties = ();
fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
SsoHome {}
}
fn update(&... |
use crate::{id, proof, Result};
use chrono::{self, prelude::*};
use crev_common::{
self,
serde::{as_rfc3339_fixed, from_rfc3339_fixed},
};
use serde_yaml;
use std::{default::Default, fmt};
const BEGIN_BLOCK: &str = "-----BEGIN CREV PROJECT REVIEW-----";
const BEGIN_SIGNATURE: &str = "-----BEGIN CREV PROJECT RE... |
pub mod client_dao;
pub mod user_dao; |
#[macro_use] extern crate clap;
use std::{ io, ffi, process };
const STATUS_ERROR: i32 = 1;
const ERROR_NO_COMMAND: &'static str = "You must supply a command argument";
fn make_command<It: Iterator<Item = S>, S: AsRef<ffi::OsStr>>(mut args: It) -> process::Command {
let mut cmd = process::Command::new(args.next... |
use projecteuler::digits;
use projecteuler::helper;
fn main() {
helper::check_bench(|| {
solve();
});
assert_eq!(solve(), 8581146);
dbg!(solve());
}
fn solve() -> usize {
/*
maximum number below ten million:
9_999_999
square of 9: 81
7*9^2 = 576
*/
let mut count = ... |
use super::gl;
use super::*;
use image::{DynamicImage, GenericImageView};
use std::ffi::c_void;
use std::path::Path;
use math::Mat4;
use generational_arena::Index;
#[derive(Clone, Copy)]
pub enum TextureWrapping {
ClampToEdge = gl::CLAMP_TO_EDGE as isize,
}
#[derive(Clone, Copy)]
pub enum TextureFiltering {
S... |
use std::fs;
use std::include_str;
use std::path::PathBuf;
use std::process::Command;
use crate::patcher::{get_patcher_name, PatcherCommand, PatcherConfiguration};
use futures::executor::block_on;
use tokio::sync::mpsc;
use web_view::{Content, Handle, WebView};
/// 'Opaque" struct that can be used to update the UI.
p... |
use coi::{container, Inject};
pub trait Trait1: Inject {
fn a(&self) -> &'static str;
}
pub trait Trait2: Inject {
fn b(&self) -> &'static str;
}
#[derive(Inject)]
#[coi(provides dyn Trait1 as ImplTrait1Provider with Impl)]
#[coi(provides dyn Trait2 as ImplTrait2Provider with Impl)]
struct Impl;
impl Trait1... |
use std::fmt;
use crate::block::Block;
use crate::block_exit::BlockExit;
use crate::cmd_options::CmdOptions;
use crate::command::Command;
use crate::counters::{CodelChooser, Counters, DirectionPointer};
// TODO: this file is too big, needs being split up
// TODO: we needs tests (also for other modules)
// TODO: needs... |
use crate::prelude::*;
use std::os::raw::c_void;
use std::ptr;
#[repr(C)]
#[derive(Debug)]
pub struct VkCommandBufferBeginInfo {
pub sType: VkStructureType,
pub pNext: *const c_void,
pub flags: VkCommandBufferUsageFlagBits,
pub pInheritanceInfo: *const VkCommandBufferInheritanceInfo,
}
impl VkCommand... |
use std::ops::{Deref, DerefMut};
use failure::Error;
use crate::client;
/// This marks that something is a driver, that is it manages an instance of
/// something used to remote control a browser.
pub trait Driver {
/// Shut down the driver.
fn close(&mut self) -> Result<(), Error>;
}
/// This is designed t... |
use super::*;
impl From<Row> for Trace {
fn from(row: Row) -> Self {
Self {
id: row.get("id"),
name: row.get("name"),
created_at: row.get("created_at"),
updated_at: row.get("updated_at"),
}
}
}
#[async_trait]
impl Create<Trace> for Client {
a... |
use crate::libbb::appletlib::bb_show_usage;
use crate::libbb::bb_pwd::xuid2uname;
use libc::c_char;
use libc::c_int;
use libc::geteuid;
/*
* Mini whoami implementation for busybox
*
* Copyright (C) 2000 Edward Betts <edward@debian.org>.
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/... |
extern crate kiss3d;
extern crate nalgebra as na;
use kiss3d::light::Light;
use kiss3d::window::Window;
use nphysics3d::force_generator::DefaultForceGeneratorSet;
use nphysics3d::joint::DefaultJointConstraintSet;
use nphysics3d::object::ColliderDesc;
use nphysics3d::object::{BodyStatus, RigidBodyDesc};
use nphysics3d... |
pub mod register_form;
|
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ... |
use std::default::Default;
use std::fmt;
use std::fs::File;
use std::io::{BufReader, Read};
use std::path::{Path, PathBuf};
use glob::glob;
use serde::{Deserialize, Serialize};
use slog::Logger;
use crate::errors::PsqlpackErrorKind::*;
use crate::errors::{PsqlpackError, PsqlpackResult, PsqlpackResultExt};
use crate::... |
use shared_library::dynamic_library::DynamicLibrary;
use utilities::prelude::*;
use crate::impl_vk_handle;
use crate::loader::*;
use crate::prelude::*;
use crate::Extensions;
use std::collections::HashSet;
use std::fmt;
use std::mem::MaybeUninit;
use std::ptr;
use std::sync::Arc;
use std::os::raw::c_char;
use std::o... |
#[macro_use]
extern crate webframework;
use webframework::{Database, Form, Former, Renderer, Tag, Content, Server, path::*, Store, Serialize, Error};
use std::sync::Arc;
#[derive(Default, Form, Store, Serialize, Clone)]
struct Bullet {
#[id] #[form(type="text", min=1, max=512)] id: u64,
#[form(name="Descripti... |
macro_rules! ok_or_panic {
{ $e:expr } => {
match $e {
Ok(x) => x,
Err(err) => panic!("{} failed with {}", stringify!($e), err),
}
};
}
pub mod paths;
pub mod sandbox;
|
use crate::score::ex_score::ExScore;
use serde::Serialize;
#[derive(Clone, Debug, Serialize, Default)]
pub struct Judge {
pub early_pgreat: i32,
pub late_pgreat: i32,
pub early_great: i32,
pub late_great: i32,
pub early_good: i32,
pub late_good: i32,
pub early_bad: i32,
pub late_bad: i3... |
table! {
grounds (id) {
id -> Int8,
types -> Varchar,
vertexes -> Json,
angles -> Json,
vectors -> Json,
}
}
allow_tables_to_appear_in_same_query!(
grounds
); |
use json_utils::json::JsNumber;
pub trait IntoJsNumber {
fn into_js_number(self) -> JsNumber;
}
impl IntoJsNumber for JsNumber {
fn into_js_number(self) -> JsNumber {
self
}
}
impl IntoJsNumber for usize {
fn into_js_number(self) -> JsNumber {
self.into()
}
}
impl IntoJsNumber for... |
extern crate cmake;
fn main() {
let dst = cmake::build("");
println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=axal");
// TODO: Generate this from the cmake file
println!("cargo:rustc-link-lib=dylib=GL");
println!("cargo:rustc-link-lib=dylib=Qt... |
extern crate color;
extern crate nalgebra;
extern crate rand;
extern crate arc_swap;
extern crate dyn_clone;
mod geom;
mod image;
mod ppm;
mod raycasting;
mod renderer;
mod types;
mod material;
use arc_swap::ArcSwap;
use crate::geom::hittable::Hittable;
use crate::geom::sphere::Sphere;
use crate::types::{Vector3f, Ve... |
use crate::{parser::ParserSettings, Runner, SMResult, AST};
impl Default for Runner {
fn default() -> Self {
Self { parser: ParserSettings { file: String::from("anonymous"), refine: true }, ctx: Default::default() }
}
}
impl Runner {
pub(crate) fn parse(&mut self, s: &str) -> SMResult<()> {
... |
#[doc = "Reader of register ITLINE7"]
pub type R = crate::R<u32, super::ITLINE7>;
#[doc = "Reader of field `EXTI4`"]
pub type EXTI4_R = crate::R<bool, bool>;
#[doc = "Reader of field `EXTI5`"]
pub type EXTI5_R = crate::R<bool, bool>;
#[doc = "Reader of field `EXTI6`"]
pub type EXTI6_R = crate::R<bool, bool>;
#[doc = "R... |
//! Clones a git repository and publishes it to crates.io.
use xshell::{cmd, Shell};
fn main() -> anyhow::Result<()> {
let sh = Shell::new()?;
let user = "matklad";
let repo = "xshell";
cmd!(sh, "git clone https://github.com/{user}/{repo}.git").run()?;
sh.change_dir(repo);
let test_args = ["-... |
use bitboard::base::BB;
use iterable::Iterable;
use iterable::ElemIterator;
use iterable::ElemSquareIterator;
use iterable::ElemRowColIterator;
impl Iterable<uint> for BB {
fn at(&self, idx:uint) -> uint {
((*self) & (0x1u64 << idx) != 0) as uint
}
fn at_sq(&self, row:uint, col:uint) -> uint {
let idx =... |
mod disk;
mod errors;
pub use self::errors::Result;
use std::path::{Path, PathBuf};
pub struct Resource {
pub path: PathBuf,
}
pub trait ResourceReader {}
pub trait ResourceWriter {}
pub trait ResourceManager {
type R: ResourceReader;
type W: ResourceWriter;
fn get_resource(&self, path: &Path) -> ... |
//!
//! The Semaphone CI pipeline demo library.
//!
use futures::{future, prelude::*};
use hyper::{Body, Request, Response, Server};
///
/// The blocking method which runs the HTTP server.
///
pub fn run(port: u16) {
let addr = ([0, 0, 0, 0], port).into();
println!("Starting the HTTP server at {}", addr);
... |
mod vehicle;
use rapier3d::na::ArrayStorage;
use rapier3d::na::Const;
use rapier3d::prelude::*;
use vehicle::Vehicle;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct World {
gravity: rapier3d::na::base::Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
integration_parameters: IntegrationParam... |
pub mod allocator;
pub mod lock;
pub mod kauth;
pub mod fs;
pub mod process;
pub mod random;
pub use self::lock::read_write::RwLock;
pub use self::lock::group::LockGroup;
pub use self::lock::attributes::LockGroupAttribute;
pub use self::lock::attributes::LockAttribute;
pub use self::kauth::KAuthResult;
pub use self::k... |
use std::ffi::OsStr;
use menmos_client::{Query, Type};
use crate::MenmosFS;
use super::{Error, Result};
impl MenmosFS {
async fn rm_rf(&self, blob_id: &str) -> anyhow::Result<()> {
let mut working_stack = vec![(String::from(blob_id), Type::Directory)];
while !working_stack.is_empty() {
... |
use serde::*;
use serde_xml_rs::*;
use std::fs::File;
use std::io::Read;
//use std::path::PathBuf;
//use serde::de::value::UsizeDeserializer;
//use std::num::ParseIntError;
//--------------- serverconfig
#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct Property {
pub name: String,
pub value: Str... |
use super::{utils::heap_object_impls, HeapObjectTrait};
use crate::{
heap::{object_heap::HeapObject, Heap, Int, List, Tag, Text},
utils::{impl_debug_display_via_debugdisplay, impl_eq_hash_ord_via_get, DebugDisplay},
};
use derive_more::Deref;
use itertools::Itertools;
use rustc_hash::FxHashMap;
use std::{
f... |
#![allow(unused)]
use runestick::{ContextError, Item, Mut, Object, Ref, Shared, Tuple, Value};
use runestick_macros::{Any, FromValue, ToValue};
#[derive(Any)]
#[rune(name = "Bar")]
struct Foo {}
#[derive(Any)]
struct Bar {}
#[test]
fn test_rename() {
let mut module = runestick::Module::new();
module.ty::<Fo... |
//! Locale implementation for MacOS X
use std::borrow::ToOwned;
use std::env::var;
use std::fs::{metadata, File};
use std::io::{BufRead, Error, Result, BufReader};
use std::path::{Path, PathBuf};
use super::{LocaleFactory, Numeric, Time};
/// The directory inside which locale files are found.
///
/// For example, th... |
//! Classes for describing instruction formats.
|
#[doc = "Reader of register MDIOS_DINR12"]
pub type R = crate::R<u32, super::MDIOS_DINR12>;
#[doc = "Reader of field `DIN12`"]
pub type DIN12_R = crate::R<u16, u16>;
impl R {
#[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"]
#[inline(always)]
pub fn din12(&self) -> DIN12_R {
... |
mod config;
mod world;
mod renderer;
mod init;
mod media;
mod dom;
mod mainloop;
mod controller;
mod physics;
mod squares;
use init::init;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLO... |
use std::rc::Rc;
use yew::prelude::*;
use yew_functional::{function_component, use_state};
#[function_component(Counter)]
pub fn state() -> Html {
let (counter, set_counter) = use_state(|| 0);
let onclick = {
let counter = Rc::clone(&counter);
Callback::from(move |_| set_counter(*counter + 1))
... |
#![allow(dead_code)]
use crate::vec3::Vec3;
#[derive(Copy, Clone)]
pub struct Ray {
a: Vec3,
b: Vec3,
}
impl Ray {
pub fn new(v1: Vec3, v2: Vec3) -> Self {
Self {
a: v1,
b: v2,
}
}
pub fn origin(&self) -> Vec3 {
self.a
}
pub fn direction(&... |
use std::{ env, process };
use std::path::Path;
use std::fmt::Write;
extern crate gethostname;
use gethostname::gethostname;
extern crate git2;
use git2::{ Error, ErrorCode, Repository, StatusOptions };
fn get_branch_name(repo: &Repository) -> Result<String, Error> {
let head = match repo.head() {
Ok(he... |
use cgmath::{EuclideanSpace, InnerSpace};
use futures::executor::block_on;
use imgui::*;
use imgui_wgpu::Renderer;
use imgui_winit_support;
use imguizmo::{Gizmo, Mode, Operation, Rect};
use std::time::Instant;
use winit::{
dpi::LogicalSize,
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent... |
pub fn round_float(n: f64, d_points: usize) -> String {
let rounder = (10 ^ d_points) as f64;
let answer = (n * rounder).round() / rounder;
return format!("{:.*}", d_points, answer);
}
#[allow(dead_code)]
fn build_str() -> String {
let mut s = String::new();
s.push_str("Hello, world!");
return s;
}
|
use ndarray::prelude::*;
use pyo3::prelude::*;
#[pyclass]
#[pyo3(name = "DistanceMatrix")]
pub struct PyDistanceMatrix {
distance_matrix: Array2<f32>,
}
impl PyDistanceMatrix {
pub fn new_with_distance_matrix(distance_matrix: Array2<f32>) -> PyDistanceMatrix {
PyDistanceMatrix { distance_matrix }
... |
use read_input::prelude::*;
fn main() {
let x: f64 = input().msg("Please enter a number \n").get();
println!("Your first number is {}", x);
let y: f64 = input().msg("Please enter a number \n").get();
println!("Your second number is {}", y);
let op: char = input().msg("Please enter an operation \... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {
#[cfg(feature = "Win32_Foundation")]
pub fn BrowseForGPO(lpbrowseinfo: *mut GPOBROWSEINFO) -> ::windows_sys::core::HRESULT;
#[cfg(feature = "Win32_Fo... |
pub struct Solution;
#[derive(Debug, PartialEq, Eq)]
pub struct TreeNode {
pub val: i32,
pub left: Tree,
pub right: Tree,
}
use std::cell::RefCell;
use std::rc::Rc;
type Tree = Option<Rc<RefCell<TreeNode>>>;
impl Solution {
pub fn recover_tree(root: &mut Tree) {
let tl = left_mistake(root).u... |
use super::*;
#[test]
fn reverse() {
assert_eq!(Op::Reverse().perform(10, 9), 0);
}
#[test]
fn cut_positive() {
assert_eq!(Op::Cut(3).perform(10, 0), 7);
assert_eq!(Op::Cut(3).perform(10, 2), 9);
assert_eq!(Op::Cut(3).perform(10, 3), 0);
assert_eq!(Op::Cut(3).perform(10, 9), 6);
}
#[test]
fn cut_... |
#[macro_use]
extern crate nom;
extern crate num;
use std::ops::{Add, Mul, Div, Sub};
use num::pow;
use num::traits::PrimInt;
use num::integer::Integer;
use num::rational::{Ratio, BigRational};
use num::bigint::{BigInt, Sign, ToBigInt, BigUint, ParseBigIntError};
use nom::InputLength;
use nom::{error_to_list, IResult... |
fn main() {
println!("🔓 Challenge 15");
println!("Code in 'cipher/src/padding.rs'");
}
|
fn main(){ println!("Hello fellow reader!"); }
|
#[doc = "Reader of register FDCAN_ILS"]
pub type R = crate::R<u32, super::FDCAN_ILS>;
#[doc = "Writer for register FDCAN_ILS"]
pub type W = crate::W<u32, super::FDCAN_ILS>;
#[doc = "Register FDCAN_ILS `reset()`'s with value 0"]
impl crate::ResetValue for super::FDCAN_ILS {
type Type = u32;
#[inline(always)]
... |
use std::collections::BTreeMap;
use std::string::ToString;
use std::default::Default;
use rustc_serialize::json::{Json,ToJson};
use parse::*;
use parse::Presence::*;
use record;
use record::{Record, PartialRecord};
make_record_type!(ContactGroup, PartialContactGroup, "ContactGroup",
name: String => "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.