text stringlengths 8 4.13M |
|---|
use ash::vk;
use sourcerenderer_core::graphics::Format;
pub fn format_to_vk(format: Format, supports_d24: bool) -> vk::Format {
match format {
Format::RGBA8UNorm => vk::Format::R8G8B8A8_UNORM,
Format::RGBA8Srgb => vk::Format::R8G8B8A8_SRGB,
Format::R16UNorm => vk::Format::R16_UNORM,
... |
macro_rules! w {
($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)).unwrap())
}
macro_rules! w_scope {
($dst:expr, $($arg:tt)*) => {
$dst.write_fmt(format_args!($($arg)*)).unwrap();
$dst.indent();
}
}
macro_rules! w_end_scope {
($dst:expr, $($arg:tt)*) => {
$ds... |
use elfdb::{device::Device, tui, visuals::Visuals};
use failure::{format_err, Error, ResultExt};
use std::path::Path;
fn run<'a, V>(mut visuals: V, initial: Option<&Path>) -> Result<(), Error>
where
V: Visuals,
{
let mut device = Device::default();
if let Some(initial) = initial {
device.load_path... |
//! This the gzip compresion
//! We only need move the folder specified to peform a backup
use crate::backup::backup::Backup;
use crate::compressors::{Comprensable, CompressResult};
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use zip;
/// Struct for handle uncomprensed data
#[derive(Default)]
pu... |
#[cfg(test)]
mod tests {
use super::super::defaults::ENVIRONMENT;
use super::super::parser::{parse, parse_single};
use super::super::types::{Unit, UnitSet, Value};
use pretty_assertions::assert_eq;
use wasm_bindgen_test::*;
fn parse_helper(input: &'static str) -> Result<Value, ()> {
par... |
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)]
#[link(name = "windows")]
extern "system" {}
pub type EmailDataProviderConnection = *mut ::core::ffi::c_void;
pub type EmailDataProviderTriggerDetails = *mut ::core::ffi::c_void;
pub type EmailMailboxCreat... |
//! Threshold Filter
//!
//! This filter returns the `on_match` result if the level in the LogRecord is the same or more
//! specific than the configured level and the `on_mismatch` value otherwise. For example, if the
//! ThresholdFilter is configured with Level `Error` and the LogRecord contains Level `Debug` then
//... |
// Copyright 2020 - 2021 Alex Dukhno
//
// 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... |
type CoOrd = (i32, i32, i32);
const MOON_COUNT: usize = 4;
#[derive(Debug, Eq, PartialEq, Clone)]
struct State {
positions: [CoOrd; MOON_COUNT],
velocities: [CoOrd; MOON_COUNT],
}
fn parse_state(input: &'static str) -> State {
let moon_coords = input
.lines()
.map(|l| {
l.trim_... |
use serde::{Deserialize, Serialize};
use smart_default::SmartDefault;
#[derive(
Debug, Copy, Serialize, Deserialize, SmartDefault, PartialEq, Eq, Clone, Ord, PartialOrd,
)]
pub enum ConstGmObject {
#[serde(rename = "GMObject")]
#[default]
Const,
}
#[derive(
Debug, Copy, Serialize, Deserialize, Sma... |
mod build_macro;
mod implement;
mod implement_macro;
use build_macro::*;
use gen::*;
use implement_macro::*;
use quote::*;
use reader::*;
use syn::parse_macro_input;
/// A macro for generating Windows API bindings to a .rs file at build time.
///
/// This macro can be used to import Windows APIs from any Windows meta... |
//! This is crate wide documentation.
/// This is module level documentation.
pub mod functions;
|
use crate::renderer::rectangle::{Rectangle, Region};
use crate::renderer::Dimensions;
use unicode_segmentation::UnicodeSegmentation;
use wgpu_glyph::ab_glyph::{Font, FontArc};
use wgpu_glyph::{GlyphPositioner, Layout, SectionGeometry, Text};
use winit::dpi::{PhysicalPosition, PhysicalSize};
use winit::event::VirtualKey... |
use crate::responses::GenericResponse;
use std::fmt::{Debug, Display, Formatter};
pub use serde::Deserialize;
use crate::responses::listing::GenericListing;
use serde_json::Value;
///About Data for the User
#[derive(Deserialize, Clone)]
pub struct MeResponse {
#[serde(flatten)]
pub about: AboutUser,
/// ... |
extern crate regex;
use std::io;
use std::fs;
use std::io::BufRead;
use std::path::Path;
use std::collections::HashMap;
use std::collections::HashSet;
use regex::Regex;
fn main() {
let input = parse_input();
eprintln!("Found {} entries", input.passports.len());
println!("Found {} valid passports", input.v... |
/*
Gordon Adam
1107425
Struct that represents a message made up of a header, and possible questions and resource records
*/
use std::default;
use std::io::BufReader;
use std::io::net::ip::{SocketAddr};
use question::Question;
use resource::Resource;
use header::Header;
#[deriving(Default,Clone)]
pub struct Message ... |
#![warn(rust_2018_idioms, missing_docs, warnings, unused_extern_crates)]
//! Main data structures holding information about spanish auctions.
/// Auction concepts
pub mod concepts;
/// Spain provinces
pub mod provinces;
/// Auction types
pub mod types;
pub use self::types::*;
pub use chrono::NaiveDate;
pub use geo... |
use ggez::event::KeyMods;
bitflags! {
#[derive(Default)]
pub struct KeyMod: u8 {
const NONE = 0b00000000;
const SHIFT = 0b00000001;
const CTRL = 0b00000010;
const ALT = 0b00000100;
const LOGO = 0b00001000;
}
}
impl From<KeyMods> for KeyMod {
fn from(keymods... |
use proconio::input;
fn main() {
input! {
a: f64,
b: f64,
};
let f = |x: f64| -> f64 {
a / (1.0 + x).sqrt() + b * x
};
let mut ub = 1_000_000_000_000_000_000_u64;
let mut lb = 0;
while ub - lb > 2 {
let x1 = (lb * 2 + ub) / 3;
let x2 = (lb + ub * 2)... |
use fn_search_backend_db::models::Function;
use radix_trie::{Trie, TrieCommon};
use std::iter::FromIterator;
pub struct FnCache {
trie: Trie<String, Vec<i64>>,
}
impl FnCache {
fn new() -> Self {
FnCache { trie: Trie::new() }
}
/// returns at most num function ids with signature sig, starting... |
// Copyright 2016 PingCAP, 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-2.0
//
// Unless required by applicable law or agreed to i... |
//! A crate for parsing g-code programs, designed with embedded environments in
//! mind.
//!
//! Some explicit design goals of this crate are:
//!
//! - **embedded-friendly:** users should be able to use this crate without
//! requiring access to an operating system (e.g. `#[no_std]` environments or
//! WebAssembl... |
use std::collections::HashMap;
use std::io;
use std::io::Write;
pub fn day15(part_a: bool) {
// just use brute force?
let limit = if part_a { 2020 } else { 30000000 };
let mut line = String::new();
let mut last_said = HashMap::new();
match io::stdin().read_line(&mut line) {
Err(error) => ... |
use crate::controller::ControllerState;
use crate::coordination::{CoordinationMessage, CoordinationPayload};
use async_bincode::AsyncBincodeReader;
use futures::sync::mpsc::UnboundedSender;
use futures::{self, Future, Sink, Stream};
use hyper::{self, header::CONTENT_TYPE, Method, StatusCode};
use noria::consensus::Auth... |
//! Types for identifying/indexing and comparing the time between simulation frames.
//!
//! Many things in CrystalOrb are timestamped. Each frame of a [`World`](crate::world::World)
//! simulation are assigned a [`Timestamp`]. The corresponding
//! [snapshots](crate::world::World::SnapshotType), [commands](crate::worl... |
mod stdin_input;
mod stdout_output;
pub use stdin_input::StdinInput;
pub use stdout_output::StdoutOutput; |
#[doc = r" Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Unspecified"]
pub unused0: UNUSED0,
#[doc = "0x04 - Unspecified"]
pub unused1: UNUSED1,
#[doc = "0x08 - Unspecified"]
pub unused2: UNUSED2,
_reserved3: [u8; 4usize],
#[doc = "0x10 - Unspecified"]
pub un... |
/* origin: FreeBSD /usr/src/lib/msun/src/k_tan.c */
/*
* ====================================================
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ==========... |
// Copyright 2017 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 crate::event::Event;
use crate::{
shutdown::ShutdownSignal,
tls::{MaybeTlsSettings, TlsConfig},
};
use futures::{
compat::{AsyncRead01CompatExt, Future01CompatExt, Stream01CompatExt},
FutureExt, TryFutureExt, TryStreamExt,
};
use futures01::{sync::mpsc, Sink};
use serde::Serialize;
use std::error::E... |
use crate::errors::*;
use crate::SetupArgs;
use dinghy_build::build_env::append_path_to_env;
use dinghy_build::build_env::append_path_to_target_env;
use dinghy_build::build_env::envify;
use dinghy_build::build_env::set_env;
use dinghy_build::build_env::set_target_env;
use itertools::Itertools;
use std::io::Write;
#[cfg... |
// RGB standard library
// Written in 2020 by
// Dr. Maxim Orlovsky <orlovsky@pandoracore.com>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
// the public domain worldwide. This software is distributed without
// any warr... |
use crate::{
geom::{Scalar, Vector},
graphics::{Background, Color, Image}
};
use std::cmp::Ordering;
#[derive(Clone, Copy, Debug)]
/// A vertex for drawing items to the GPU
pub struct Vertex {
/// The position of the vertex in space
pub pos: Vector,
/// If there is a texture attached to this vertex... |
use allegro;
/*
pub fn update(_: &Platform, _: &mut GameMapDetail) -> Option<State> {
None
}
pub fn render(p: &Platform, detail: &GameMapDetail) {
detail.map.render(p);
}
pub fn handle_event(p: &Platform, detail: GameMapDetail, e: allegro::Event) {
match e {
allegro::KeyDown{keycode, ..} => {
... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Evening {}
|
use crate::domain::git::CocoCommit;
use crate::infrastructure::git::cmd_git::commit_message;
use crate::infrastructure::git::git_log_parser::GitMessageParser;
use core_model::coco_config::CocoCommitConfig;
use core_model::url_format;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
... |
// 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 std::sync::Arc;
use bevy::{
prelude::*,
input::{
keyboard::KeyboardInput,
mouse::{
MouseButtonInput,
MouseWheel
}
},
render::{
draw::DrawContext,
render_graph::RenderGraph,
renderer::RenderResourceBindings
},
window::{
... |
use std::collections::HashMap;
#[derive(Copy, Clone, Debug, Eq, Hash)]
struct Coord {
x: i32,
y: i32,
}
impl PartialEq for Coord {
fn eq(&self, other: &Coord) -> bool {
self.x == other.x && self.y == other.y
}
}
impl Coord {
pub fn manhattan_distance(&self, other: &Coord) -> u32 {
... |
//! Protocol of the websocket server
//!
//! The protocol uses JSON as coding and a request/answer id for every packet to know where to put
//! the answer.
use std::result;
use error::{Error, Result};
use bincode::{serialize, deserialize};
use hex_database::{Track, Playlist, Token, TrackKey, PlaylistKey, TokenId, T... |
use crate::{
hittable::HitRecord,
ray::Ray,
rtweekend::{fmin, random_double},
texture::{ConstTexture, Texture},
vec3::{random_in_unit_sphere, random_unit_vector, reflect, refract, Color, Point3},
};
use std::sync::Arc;
pub trait Material: Send + Sync {
fn scatter(
&self,
r_in: &... |
#[derive(Debug, Clone)]
pub struct MemBlock {
slc: Box<[u8]>,
size: (usize, usize),
}
impl MemBlock {
/// Create a new [`MemBlock`] from a size in pixel (x,y)
pub fn new(size: (usize, usize)) -> Self {
MemBlock {
slc: vec![0; size.0 * size.1 * 4].into_boxed_slice(),
size... |
/*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... |
use wasm_encoder::{
Component, ComponentExternName, PrimitiveValType, ComponentTypeRef,
ComponentTypeSection, ComponentImportSection,
};
use std::env;
use std::fs::File;
use std::io::Write;
fn main() -> std::io::Result<()> {
let mut types = ComponentTypeSection::new();
types
.function()
... |
use crate::mir::{Body, Expression, Id, Mir, VisibleExpressions};
use rustc_hash::FxHashSet;
use tracing::error;
impl Mir {
pub fn validate(&self) {
self.body
.validate(&mut FxHashSet::default(), im::HashSet::new());
}
}
impl Body {
pub fn validate(&self, defined_ids: &mut FxHashSet<Id>... |
pub mod system;
pub mod todo;
use crate::config::Config;
use crate::helpers::{database, email, handler};
use actix_web::middleware::errhandlers::ErrorHandlers;
use actix_web::{http, web, App, HttpServer};
use std::sync::Arc;
pub fn init_services(cnfg: Arc<Config>) {
let db_pool = database::init_pool(&... |
use liblumen_alloc::erts::term::prelude::*;
#[native_implemented::function(erlang:is_map/1)]
pub fn result(term: Term) -> Term {
term.is_boxed_map().into()
}
|
use std::borrow::Cow;
use std::char;
use std::ops::RangeInclusive;
use winnow::combinator::alt;
use winnow::combinator::cut_err;
use winnow::combinator::delimited;
use winnow::combinator::fail;
use winnow::combinator::opt;
use winnow::combinator::peek;
use winnow::combinator::preceded;
use winnow::combinator::repeat;
... |
use crate::error::Diagnostic;
use crate::util::{
format_doc, iter_use_idents, pyclass_ident_and_attrs, text_signature, AttrItemMeta,
AttributeExt, ClassItemMeta, ContentItem, ContentItemInner, ErrorVec, ItemMeta, ItemNursery,
ModuleItemMeta, SimpleItemMeta, ALL_ALLOWED_NAMES,
};
use proc_macro2::TokenStream... |
extern crate libc;
extern crate base64;
use std::env;
use std::ffi::CString;
use libc::c_char;
use std::str;
use std::slice;
#[repr(C)]
struct SoundData {
length: i32,
data: *mut c_char
}
#[link(name = "ttss")]
extern {
fn tts_init();
fn tts_msg(msg: *const c_char) -> SoundData;
}
fn main() {
i... |
//! # My Crate
//!
//! `my_crate` 是一个使得特定计算更方便的
//! 工具集合
//! # Art
//!
//! 一个描述美术信息的库。
// 对于有很多嵌套模块的情况,使用 pub use 将类型重导出到顶级结果对于 crate 的使用者来说
// 将会是大为不同的体验;
// pub use 提供了解耦组织 crate 内部结构和与终端用户体现的灵活性
pub use kinds::PrimaryColor;
pub use kinds::SecondaryColor;
pub use utils::mix;
pub mod kinds {
/// 采用 RGB 色彩模式的主要... |
mod filter;
pub use filter::*;
mod identity;
pub use identity::*;
|
use crate::parser::*;
use common::*;
use std::collections::HashMap;
use thiserror::Error;
pub trait IntoInstruction {
fn instruction_bits(&self) -> u8;
}
impl IntoInstruction for Source {
fn instruction_bits(&self) -> u8 {
match self {
Source::Expansion => 0b00_000000,
Source::... |
mod availability;
mod dungeon_availability;
mod location_availability;
mod rule;
pub use crate::lttp::logic::{
availability::Availability,
dungeon_availability::DungeonAvailability,
location_availability::LocationAvailability,
rule::Rule,
};
use serde::{
Deserialize,
Serialize,
};
use ts_rs::TS... |
//! HDMI
//!
//! Size: 128K
use core::marker::PhantomData;
use core::ops::{Deref, DerefMut};
use static_assertions::const_assert_eq;
pub const PADDR: usize = 0x01EE_0000;
const PHY_OFFSET: usize = 0x0001_0000;
pub const PHY_PADDR: usize = PADDR + PHY_OFFSET;
register! {
VersionId,
u32,
RW,
Fields [
... |
use crate::spec::{EncodingType, FramePointer, LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::apple_base::opts("macos");
base.cpu = "core2".into();
base.max_atomic_width = Some(128); // core2 support cmpxchg16b
base.frame_pointer = FramePointer::Always;
base.... |
use nix::fcntl::{open, fcntl, FcntlArg, OFlag};
use nix::unistd::{getpid};
use std::time::Duration;
use std::thread::sleep;
use libc::{flock, F_RDLCK, F_WRLCK, SEEK_SET};
use nix::sys::stat::Mode;
use std::os::raw::c_short;
fn main() {
let lock_file_path = "/tmp/lock_segment.test";
let lock_file ... |
/*
* Copyright © 2019-today Peter M. Stahl pemistahl@gmail.com
*
* 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 a... |
use std::convert::{TryInto, TryFrom};
use ebml_iterable::tools::{self as ebml_tools, Vint};
use ebml_iterable::tags::TagData;
use super::super::errors::WebmError;
///
/// An enum describing different block lacing options.
///
/// This enum is based on the definition for [Lacing](https://www.matroska.org/t... |
use rocket_contrib::databases::{database, diesel};
#[database("unkso_main_forums")]
pub struct UnksoMainForums(diesel::MysqlConnection);
#[database("titan_primary")]
pub struct TitanPrimary(diesel::MysqlConnection);
|
use futures::channel::{mpsc, oneshot};
use futures::{SinkExt, Future, TryFutureExt};
use futures::future::FutureExt;
use std::fmt::Debug;
use std::panic::AssertUnwindSafe;
// This is a hack required because the json-rpc crate is not updated to tokio 0.2.
// We should watch the `jsonrpsee` crate and switch to that once... |
#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::TEST {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut ... |
use super::types::Type;
use super::ast_printer::print_at_depth;
use super::types::IntegerTypeMetadata;
pub fn print_type (the_type: &Type, depth: isize) {
match the_type {
Type::Char(meta) => {
print_at_depth("Type: char".to_string(), depth);
print_int_meta(meta, depth + 1);
... |
#[macro_use]
extern crate error_chain;
extern crate tempdir;
extern crate walkdir;
use tempdir::TempDir;
use walkdir::WalkDir;
use std::fs;
use std::io::{self, BufRead};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::env;
const EXE_DIR: &'static str = "target/debug";
error_chain! {
foreign_li... |
use iron::prelude::*;
use iron::status;
use persistent::{Read, Write};
use hyper::header::*;
use hyper::mime::*;
use bodyparser;
use dal;
use std::ops::Deref;
use chrono::prelude::*;
use serde_json;
use std::str;
//use uuid;
//use bcrypt;
//use jsonwebtoken::{encode, Header};
//use configmisc;
use uuid;
use slog;
u... |
mod utils;
fn main() {
let data = utils::load_input("./data/day_8.txt").unwrap();
let instructions: Vec<(&str, i32)> = data
.lines()
.map(|l| {
let i: Vec<&str> = l.split(" ").collect();
(i[0], i[1].parse::<i32>().unwrap())
})
.collect();
println!("... |
use std::collections::HashMap;
use std::ops::Range;
use lalrpop_util::ParseError as LalrpopError;
use super::error::{ParseError, PolarError, PolarResult, RuntimeError};
use super::kb::KnowledgeBase;
use super::lexer::Token;
use super::rules::*;
use super::terms::*;
// TODO(gj): round up longhand `has_permission/3` a... |
//! LRAT proof generation for the Varisat SAT solver.
use std::{
io::{BufWriter, Write},
mem::replace,
};
use anyhow::Error;
use varisat_checker::{CheckedProofStep, CheckerData, ProofProcessor};
use varisat_formula::Lit;
/// Proof processor that generates an LRAT proof.
pub struct WriteLrat<'a> {
binary:... |
extern crate grpcio;
extern crate protos;
use std::env;
use std::sync::Arc;
use std::io;
use grpcio::{ChannelBuilder, EnvBuilder};
use protos::mykv::{Order};
use protos::mykv_grpc::MykvClient;
fn main() {
let args = env::args().collect::<Vec<_>>();
if args.len() != 2 {
panic!("Expected exactly four ... |
// 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 diesel::{self, prelude::*};
use rocket_contrib::json::Json;
use crate::componentes_curriculares_model::{
ComponentesCurriculares, InsertableComponenteCurricular, UpdatableComponenteCurricular,
};
use crate::schema;
use crate::DbConn;
#[post("/componentes_curriculares", data = "<componentes_curriculares>")]
p... |
use std::net::SocketAddrV4;
use std::sync::atomic::{AtomicU32, Ordering};
use futures::{stream::TryStreamExt, SinkExt, StreamExt};
use tokio::sync::mpsc::Sender;
use warp::{filters::ws::Message, http::header, reject::Rejection, Buf, Filter};
use uuid::Uuid;
use webrtc_unreliable::{Server as RtcServer, SessionEndpoint... |
#[doc = "Reader of register PTPPPSCR"]
pub type R = crate::R<u32, super::PTPPPSCR>;
#[doc = "Reader of field `PPSFREQ`"]
pub type PPSFREQ_R = crate::R<u8, u8>;
impl R {
#[doc = "Bits 0:3 - PPS frequency selection"]
#[inline(always)]
pub fn ppsfreq(&self) -> PPSFREQ_R {
PPSFREQ_R::new((self.bits & 0x... |
use super::*;
use std::ops::*;
impl BitOr<Mask> for WhiteMask {
type Output = Mask;
fn bitor(self, rhs: Mask) -> Self::Output {
self.0 | rhs
}
}
impl BitOr<WhiteMask> for Mask {
type Output = Mask;
fn bitor(self, rhs: WhiteMask) -> Self::Output {
self | rhs.0
}
}
impl BitAnd<Mas... |
//! Definitions for all methods used to set and query
//! the current state of the module
use super::Module;
use openmpt_sys;
use std::os::raw::*;
impl Module {
/// Select a sub-song from a multi-song module.
///
/// ### Parameters
/// * `subsong_num` : Index of the sub-song. -1 plays all sub-songs consecutively... |
#[doc = "Reader of register _3_ISC"]
pub type R = crate::R<u32, super::_3_ISC>;
#[doc = "Writer for register _3_ISC"]
pub type W = crate::W<u32, super::_3_ISC>;
#[doc = "Register _3_ISC `reset()`'s with value 0"]
impl crate::ResetValue for super::_3_ISC {
type Type = u32;
#[inline(always)]
fn reset_value() ... |
fn main() {
}
// end-msg: WARN crate `SNAKE` should have a snake case
// end-msg: NOTE #[warn(non_snake_case)] on by default
|
extern crate itertools;
use itertools::Itertools;
#[macro_use]
extern crate failure_derive;
extern crate failure;
use failure::Error;
extern crate serde;
#[macro_use]
extern crate lazy_static;
extern crate toml;
use swayipc::reply::{Node, NodeType, WindowChange, WindowEvent, WorkspaceChange, WorkspaceEvent};
use s... |
use std::path::PathBuf;
fn main() {
// Open Cargo.toml
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let manifest_path = format!("{manifest_dir}/Cargo.toml");
let manifest_str = std::fs::read_to_string(&manifest_path)
.unwrap_or_else(|e| panic!("Could not open {manifest_path}... |
extern crate copperline;
use copperline::Copperline;
mod rlisp;
use rlisp::{Eval, Parser, Scope, Tokenizer};
fn main() {
let cfg = copperline::Config {
encoding: copperline::Encoding::Utf8,
mode: copperline::EditMode::Emacs,
};
let mut cl = Copperline::new();
while let Ok(line) = c... |
use {
super::{Mass, Restitution},
vek::{Aabb, Vec3},
};
pub struct CollisionBody {
pub position: Vec3<f32>,
pub velocity: Option<Vec3<f32>>,
pub mass: Option<f32>,
pub input_velocity: Option<Vec3<f32>>,
pub restitution: Option<f32>,
pub aabb: Aabb<f32>,
}
impl CollisionBody {
pub f... |
use serde_derive::{Deserialize, Serialize};
use simble::Symbol;
#[derive(Copy, Clone, Debug, Serialize)]
#[serde(tag = "method", content = "params")]
pub enum ServerCommand {
SubscribeOrderbook { symbol: Symbol },
GetSymbol { symbol: Symbol },
}
#[derive(Copy, Clone, Debug, Serialize)]
pub struct Envelope<T> ... |
/// ```rust,ignore
/// 给定一个正整数,返回它在 Excel 表中相对应的列名称。
///
/// 例如,
///
/// 1 -> A
/// 2 -> B
/// 3 -> C
/// ...
/// 26 -> Z
/// 27 -> AA
/// 28 -> AB
/// ...
///
/// 示例 1:
///
/// 输入: 1
/// 输出: "A"
///
/// 示例 2:
///
/// 输入: 28
/// 输出: "AB"
///
/// 示例 3:
///
/// 输入: 701
/// 输出: "ZY"
///
///... |
// 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 float::Float;
use int::Int;
macro_rules! fp_overflow {
(infinity, $fty:ty, $sign: expr) => {
return {
<$fty as Float>::from_parts(
$sign,
<$fty as Float>::exponent_max() as <$fty as Float>::Int,
0 as <$fty as Float>::Int)
}
}
}
ma... |
// Copyright 2020-2021, The Tremor Team
//
// 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 agr... |
use crate::util::outputbuffer::OutputBuffer;
use serde::export::fmt::Debug;
pub mod gamma;
pub mod group;
pub mod identity;
/// After raytracing, a `PostProcessor` will be applied to the outputbuffer.
/// There are many options. If multiple postprocessor steps are required,
/// you can use a `PostProcessorGroup` whic... |
// 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 ... |
//! Command `new`
use crate::{
registry::{redep, Manifest, Registry},
result::Result,
};
use etc::{Etc, FileSystem, Write};
use serde::Serialize;
use std::{path::PathBuf, process::Command};
use toml::Serializer;
/// Genrate workspace
pub fn workspace(target: &PathBuf, registry: &Registry) -> Result<Manifest> {... |
pub mod obj;
pub mod ply;
|
use std::sync::Arc;
use arrow::datatypes::{DataType, Field, Fields, Schema, SchemaRef};
/// Prepare an arrow Schema for transport over the Arrow Flight protocol
///
/// Converts dictionary types to underlying types due to <https://github.com/apache/arrow-rs/issues/3389>
pub fn prepare_schema_for_flight(schema: Schema... |
use image::GenericImageView;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Image(pub(crate) image::RgbaImage);
impl Image {
pub fn new(data: &[u8]) -> Result<Self, image::ImageError> {
Ok(Self(image::load_from_memory(data)?.to_rgba8()))
}
pub fn width(&self) -> u32 {
self.0.width()
... |
pub struct Solution;
impl Solution {
pub fn roman_to_int(s: String) -> i32 {
fn rec(res: i32, bytes: &[u8]) -> i32 {
match bytes.split_first() {
None => res,
Some((&b'I', bytes)) => match bytes.split_first() {
Some((&b'V', bytes)) => rec(res +... |
pub mod server_fixture;
|
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
fn main() {
let path = Path::new("data/input.txt");
let mut file = File::open(&path).expect("File read error");
let mut s = String::new();
file.read_to_string(&mut s).unwrap();
let not_triangles_count = s.trim()
... |
use std::{cmp::Reverse, collections::BTreeSet};
use proconio::{input, marker::Usize1};
fn main() {
input! {
n: usize,
k: usize,
q: usize,
xy: [(Usize1, i64); q],
};
let mut a = vec![0; n];
let mut high = BTreeSet::new();
let mut low = BTreeSet::new();
for i in ... |
use core::any::TypeId;
use core::fmt::{self, Display};
use core::ops::Deref;
use num_bigint::{BigInt, Sign};
use num_traits::ToPrimitive;
use super::Float;
/// BigIntegers are arbitrary-width integers whose size is too large to fit in
/// an immediate/SmallInteger value.
#[derive(Clone, Hash)]
#[repr(transparent)]
p... |
use crate::Registration;
use anyhow::{Context, Result};
use std::collections::HashMap;
use std::fmt::Display;
/// Emit the data back to the host.
pub fn register(registration: &Registration) -> Result<()> {
let buffer =
serde_json::to_vec(registration).context("Could not turn registration to JSON.")?;
... |
extern crate log;
extern crate rocket;
extern crate rocket_contrib;
use rocket::State;
use rocket_contrib::json::Json;
use std::sync::{mpsc, Mutex, mpsc::Receiver};
use rocket::config::{Config, Environment, LoggingLevel};
#[allow(unused_imports)]
use log::{trace, debug, info, warn, error};
use crate::database::DB;
u... |
extern crate nalgebra_glm as glm;
use std::fs::File;
use std::io::Read;
use std::sync::{Arc, Mutex, RwLock};
use std::thread;
use std::{mem, os::raw::c_void, ptr};
mod shader;
mod util;
use glutin::event::{
DeviceEvent,
ElementState::{Pressed, Released},
Event, KeyboardInput,
VirtualKeyCode::{self, *}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.