text
stringlengths
8
4.13M
// Copyright © 2018 winapi-rs developers // 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/licenses/MIT>, at your option. // All files in the project carrying such notice may not be copied, modi...
use std::sync::Arc; use json_utils::json::JsValue; use json_utils::query::Query; use crate::core::heq::HEq; use crate::core::property::Property; use crate::core::property::Value; use super::JsPath; use super::JsValueHEq; impl Property<JsValue, JsValue> for JsPath { fn id(&self) -> String { format!("JsPa...
use crate::ast::*; use nom::branch::alt; use nom::bytes::complete::tag; use nom::bytes::complete::take_while; use nom::bytes::complete::take_while1; use nom::combinator::opt; use nom::multi::many0; use nom::sequence::tuple; use nom::IResult; fn sp(i: &str) -> IResult<&str, &str> { let chars = " \t\r\n"; take_w...
// 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::smb2::{ header, requests::{self, query_info::InfoType}, }; pub const DEFAULT_BUFFER_LENGTH: &[u8; 4] = b"\xff\xff\x00\x00"; /// Builds a working default query info request. pub fn build_default_query_info_request( tree_id: Vec<u8>, session_id: Vec<u8>, file_id: Vec<u8>, ) -> ( Optio...
use std::io; #[derive(Debug, Clone, Copy)] enum Instruction { Noop, Addx(i64), } impl Instruction { fn num_cycles(self) -> u64 { match self { Instruction::Noop => 1, Instruction::Addx(_) => 2, } } } #[derive(Debug)] struct Cpu { reg_x: i64, } impl Default ...
pub struct Solution; impl Solution { pub fn is_anagram(s: String, t: String) -> bool { let mut cnt = vec![0i32; 26]; for c in s.chars() { cnt[c as usize - 'a' as usize] += 1; } for c in t.chars() { cnt[c as usize - 'a' as usize] -= 1; } cnt.it...
use crate::{ bed::{BedDataLine, Chrom, Coordinate}, bedgraph::BedGraphDataLine, traits::ToChromStartEndVal, }; impl<V: Clone> ToChromStartEndVal<V> for BedDataLine<V> { fn to_chrom_start_end_val( &self, ) -> (Chrom, Coordinate, Coordinate, Option<V>) { (self.chrom.clone(), self.star...
use std::io; use std::fs::File; use std::os::unix::io::{RawFd, FromRawFd, IntoRawFd, AsRawFd}; use mio::{Evented, Poll, Token, Ready, PollOpt}; use mio::unix::EventedFd; pub struct EventedIo<T> { inner: T, } impl<T> EventedIo<T> where T: io::Read + io::Write + AsRawFd, { pub fn new(inner: T) -> Self { ...
use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct Budget { pub budget_id: Option<i64>, pub owner: Option<String>, pub name: String, pub spend_limit: f64, pub period_length: i64, pub start_date: String } impl Budget { pub fn new(name: String, spend_lim...
use liblumen_alloc::erts::term::prelude::Term; /// Distribution is not supported at this time. Always returns `false`. #[native_implemented::function(erlang:is_alive/0)] pub fn result() -> Term { false.into() }
extern crate fixedbitset; #[macro_use] extern crate itertools; extern crate pest; #[macro_use] extern crate pest_derive; extern crate structopt; mod parser; mod pass; mod puzzle; use std::io; use std::io::BufRead; use parser::NonoParser; use parser::Rule; use pass::ContinuousRangeHint; use pass::ContinuousRangePass;...
#![cfg_attr( not(any( feature = "vulkan", feature = "gl", feature = "dx11", feature = "dx12", feature = "metal", )), allow(dead_code, unused_extern_crates, unused_imports) )] #[cfg(feature = "dx11")] extern crate gfx_backend_dx11 as back; #[cfg(feature = "dx12")] ext...
/* * If not stated otherwise in this file or this component's LICENSE file the * following copyright and licenses apply: * * Copyright 2022 RDK Management * * 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 cop...
use proconio::input; macro_rules! chmax { ($a: expr, $b: expr) => { if let Some(x) = $a { $a = Some(x.max($b)); } else { $a = Some($b); } }; } fn main() { input! { n: usize, k: usize, d: usize, a: [usize; n], }; let m...
#[doc = "Reader of register CR"] pub type R = crate::R<u32, super::CR>; #[doc = "Writer for register CR"] pub type W = crate::W<u32, super::CR>; #[doc = "Register CR `reset()`'s with value 0"] impl crate::ResetValue for super::CR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
extern crate app_dirs; extern crate preferences; #[macro_use] extern crate serde_derive; use app_dirs::{AppDataType, AppInfo, app_dir, app_root, get_app_root}; use preferences::Preferences; use std::path::PathBuf; const APP_INFO: AppInfo = AppInfo { name: "24daysofrust", author: "Zbigniew Siciarz", }; #[der...
// 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 ...
let mut token_map = HashMap::new(); for elem in &_tokvec { let one_tok: Vec<&str> = elem.split(",").collect(); token_map.insert(one_tok[0], one_tok[1]); println!("{:?}", token_map); }
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - control register"] pub cr: CR, _reserved1: [u8; 4usize], #[doc = "0x08 - device configuration register"] pub dcr1: DCR1, #[doc = "0x0c - device configuration register 2"] pub dcr2: DCR2, #[doc = "0x10 - devi...
//! [![GitHub actions](https://github.com/SOF3/willow/workflows/CI/badge.svg)](https://github.com/SOF3/willow/actions?query=workflow%3ACI) //! [![crates.io](https://img.shields.io/crates/v/willow.svg)](https://crates.io/crates/willow) //! [![crates.io](https://img.shields.io/crates/d/willow.svg)](https://crates.io/crat...
use quickcheck::TestResult; use rand::{thread_rng, Rng}; use super::*; use bat::bat_tests::create_mock_provided_bat; use bat::SuperBat; use map; use map::map_tests::gen_rand_valid_path_of_len; use pit::BottomlessPit; use player::player_tests::create_mock_directed_player; use player::Action; use wumpus::Wumpus; pub fn...
use std::error::Error; use std::fs; type MyResult = Result<(), Box<Error>>; fn main() -> MyResult { Ok(()) }
#[doc = "Reader of register IM"] pub type R = crate::R<u32, super::IM>; #[doc = "Writer for register IM"] pub type W = crate::W<u32, super::IM>; #[doc = "Register IM `reset()`'s with value 0"] impl crate::ResetValue for super::IM { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
// Smallest String With A Given Numeric Value // https://leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/582/week-4-january-22nd-january-28th/3619/ pub struct Solution; // First solution #[cfg(disable)] impl Solution { pub fn get_smallest_string(n: i32, k: i32) -> String { let n = n ...
use yew::prelude::*; // use yew_router::components::RouterAnchor; // use crate::app::Route; pub struct ApplicationHome {} pub enum Msg {} impl Component for ApplicationHome { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { ApplicationHom...
use crate::song::hash::{HashMd5, HashSha256}; use std::collections::HashMap; #[derive(Clone, Debug)] pub struct Converter { pub md5_to_sha256: HashMap<HashMd5, HashSha256>, pub sha256_to_md5: HashMap<HashSha256, HashMd5>, } impl Converter { pub fn new( md5_to_sha256: HashMap<HashMd5, HashSha256>, ...
//! Internal result and error types used to build InfluxQL parsers //! use nom::error::{ErrorKind as NomErrorKind, ParseError as NomParseError}; use nom::Parser; use std::borrow::Borrow; use std::fmt::{Display, Formatter}; /// This trait must be implemented in order to use the [`map_fail`] and /// [`expect`] functions...
use crate::vectors::{VectorProperties::* ,Vector3::Vector3, Vector4::*}; use crate::matrices::{Matrix44::*}; use std::ops; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Quaternion { x: f64, y: f64, z: f64, w: f64 } impl Default for Quaternion { fn default() -> Quaternion { Quaternion...
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0. //! A CBOR implementation of `ipld format` in Rust. #![deny(missing_docs)] mod error; mod node; mod value; pub use ipld_format::{FormatError, Link, Node, NodeStat, Resolver}; pub use self::error::{IpldCoreError, Result}; pub use self::node::IpldNode;...
use std::collections::HashMap; use order::{Order, OrderId, OrderStatus}; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub struct Portfolio { active_orders: HashMap<OrderId, Order>, closed_orders: HashMap<OrderId, Order> } impl Portfolio { pub fn new() -> Portfolio { Portfolio { ...
use super::super::commands::CommandResult; use super::super::{LayoutTree, TreeError}; use super::super::core::Direction; use super::super::core::container::{Container, ContainerType, Layout}; use petgraph::graph::NodeIndex; use rustwlc::WlcView; use uuid::Uuid; #[derive(Clone, Debug, Eq, PartialEq)] pub enum FocusErr...
use embedded_hal::digital::v2::OutputPin; pub struct Led<R, G, B> { red: R, green: G, blue: B, } // Allow unused results until I decide on std/nostd #[allow(unused_must_use)] impl<R, G, B> Led<R, G, B> where R: OutputPin, G: OutputPin, B: OutputPin, { pub(crate) fn new(red: R, green: G, bl...
#![feature(proc_macro_hygiene, decl_macro, never_type)] #[macro_use] extern crate lazy_static; #[macro_use] extern crate rocket; #[macro_use] extern crate serde_derive; extern crate rocket_contrib; use std::path::{Path, PathBuf}; use std::string::String; use rocket::outcome::IntoOutcome; use rocket::request::{self,...
use crate::termwiztermtab; use anyhow::bail; use crossbeam::channel::{bounded, Receiver, Sender}; use promise::Promise; use std::time::Duration; use termwiz::cell::unicode_column_width; use termwiz::lineedit::*; use termwiz::surface::Change; use termwiz::terminal::*; #[derive(Default)] struct PasswordPromptHost { ...
use std::fs; use std::io::Read; use rspirv::binary::Disassemble; fn main() { let matches = clap::App::new("rspirv-dis") .version(env!("CARGO_PKG_VERSION")) .about("SPIR-V binary module disassembler from the rspirv project") .arg(clap::Arg::with_name("input").index(1).required(true)) ...
// ignore-compare-mode-nll // revisions: base nll // [nll]compile-flags: -Zborrowck=mir // edition:2018 struct Xyz { a: u64, } trait Foo {} impl Xyz { async fn do_sth<'a>( &'a self, foo: &dyn Foo ) -> &dyn Foo { //[nll]~^ ERROR explicit lifetime required in the type of `foo` [E0621] ...
pub mod pkce; pub mod token; pub mod user; pub mod util;
pub mod apply; pub mod exception; pub mod fragment; pub mod message; mod module_function_arity; pub mod node; pub mod process; pub mod scheduler; pub mod string; pub mod term; #[cfg(test)] pub mod testing; pub mod time; pub mod timeout; pub use fragment::{HeapFragment, HeapFragmentAdapter}; pub use message::{Message, ...
use super::{ builtins_iter, tuple::tuple_hash, PyInt, PyIntRef, PySlice, PyTupleRef, PyType, PyTypeRef, }; use crate::{ atomic_func, class::PyClassImpl, common::hash::PyHash, function::{ArgIndex, FuncArgs, OptionalArg, PyComparisonValue}, protocol::{PyIterReturn, PyMappingMethods, PySequenceMeth...
// 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::builtins::Variable; use crate::bytecode::{Get, Instr, Label, Reg}; use crate::common::{NumTy, Result, Stage}; use crate::compile::{self, Ty}; use crate::pushdown::FieldSet; use crate::runtime::{self, Float, Int, Line, LineReader, Str, UniqueStr}; use crossbeam::scope; use crossbeam_channel::bounded; use has...
extern crate bootstrap_rs as bootstrap; extern crate gl_util as gl; extern crate parse_obj; use bootstrap::window::*; use gl::*; use gl::context::Context; use gl::shader::*; use parse_obj::Obj; static VERT_SOURCE: &'static str = r#" #version 330 core uniform mat4 model_transform; layout(location = 0) in vec4 positi...
#[macro_use] extern crate websocat; extern crate futures; extern crate tokio_core; extern crate tokio_stdin_stdout; extern crate env_logger; #[macro_use] extern crate structopt; use structopt::StructOpt; use tokio_core::reactor::Core; use websocat::{spec, Options, SpecifierClass, WebsocatConfiguration}; type Res...
// Copied from hyperium/hyper-tls#62e3376/src/stream.rs use bytes::{Buf, BufMut}; use futures::Poll; use std::fmt; use std::io::{self, Read, Write}; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_rustls::client::TlsStream; /// A stream that might be protected with TLS. pub enum MaybeHttpsStream<T> { /// A strea...
use common::movingai::Problem; use criterion::{criterion_group, criterion_main, Criterion}; use pathfinding::expansion_policy::bitgrid::jps::{create_tmap, JpsExpansionPolicy}; use pathfinding::expansion_policy::bitgrid::no_corner_cutting::NoCornerCutting; use pathfinding::expansion_policy::ExpansionPolicy; use pathfind...
fn main() { // functions experiments my_function(); f2(42, "meaning of life"); fn local_function() { println!("Can this work ?"); } local_function(); // expressions experiments let value = "Wednesday"; println!("value = {}", value); let value = "Shadow"; println!...
#[doc = "Reader of register SSEMUX0"] pub type R = crate::R<u32, super::SSEMUX0>; #[doc = "Writer for register SSEMUX0"] pub type W = crate::W<u32, super::SSEMUX0>; #[doc = "Register SSEMUX0 `reset()`'s with value 0"] impl crate::ResetValue for super::SSEMUX0 { type Type = u32; #[inline(always)] fn reset_va...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] pub struct DEVPROP_FILTER_EXPRESSION...
use http::HeaderValue; use pathfinder_common::AllowedOrigins; use tower_http::cors::{AllowOrigin, CorsLayer}; pub fn with_allowed_origins(allowed_origins: AllowedOrigins) -> CorsLayer { let allowed_origins = match allowed_origins { AllowedOrigins::Any => AllowOrigin::any(), AllowedOrigins::List(x) ...
use crate::comments::response::CommentResponse; use crate::error::reddit_error::RedditError; use crate::error::reddit_error::RedditError::InvalidDataType; use crate::message::response::Message; use crate::responses::listing::Listing; use crate::Error; use serde::de::Error as DeError; pub use serde::Deserialize; use ser...
use std::cmp::{max, PartialEq}; use std::mem; use std::mem::MaybeUninit; use std::ops::{Index, IndexMut}; use serde::{Deserialize, Serialize}; use super::Row; use crate::index::Line; /// Maximum number of buffered lines outside of the grid for performance optimization. const MAX_CACHE_SIZE: usize = 1_000; /// A rin...
//mod talk; mod talk; use talk::*; fn main(){ println!("Hello Wolrd"); talking(); }
use crate::result::{Error, Result}; use bincode::{deserialize, serialize}; use serde::de::DeserializeOwned; use serde::Serialize; use std::borrow::Borrow; use std::collections::HashMap; use std::marker::PhantomData; use std::path::Path; use std::sync::Arc; pub mod columns { #[derive(Debug)] /// SlotMeta Col...
//! This module implements much of printf in awk. //! //! We lean heavily on ryu and the std::fmt machinery; as such, most of the work is parsing //! awk-style format strings and translating them to individual calls to write!. //! //! TODO: Originally, frawk enforced that all Strs contained valid UTF-8. We have since a...
use super::doc_base::*; use super::var_doc; use super::vardoc_gen::*; use pine::ast::syntax_type::*; use pine::libs::{declare_vars, VarResult}; use pine::types::PineRef; use std::collections::BTreeMap; use std::rc::Rc; #[derive(Debug, PartialEq)] struct NameInfo { name: String, var_type: VarType, signatur...
#[allow(dead_code)] /// Generic Error type for the server pub struct GenericError { msg: String, kind: ErrorKind } impl GenericError { /// Create a new GenericError from a message and an error kind pub fn new(msg: String, kind: ErrorKind) -> Self { Self { msg, ...
use crate::{scene::Object, scene::Scene, Color, Vecf}; use image::{Pixel, Rgb, RgbImage}; use std::f32::consts::PI; use vecmath::{ vec3_add, vec3_cross, vec3_dot, vec3_len, vec3_neg, vec3_normalized, vec3_scale, vec3_sub, }; pub struct Ray { pub direction: Vecf, pub origin: Vecf, } impl Ray { pub fn n...
/// Construct a `ConstValue`. #[macro_export] macro_rules! value { ($($json:tt)+) => { $crate::value_internal!($($json)+) }; } #[macro_export] #[doc(hidden)] macro_rules! value_internal { // Done with trailing comma. (@array [$($elems:expr,)*]) => { $crate::value_internal_vec![$($elems,...
use std::cell::RefCell; use std::fmt; use std::rc::Rc; use crate::function::Function; use crate::value::Value; pub struct ObjUpvalue { pub is_open: bool, pub stack_slot: usize, pub value: RefCell<Value>, } pub struct ObjClosure { pub function: Rc<Function>, pub upvalues: Vec<Rc<RefCell<ObjUpvalue...
mod config; mod dns; mod htp; mod lws; mod requests; mod service; mod tunnels; mod udpx; mod xport; use fs2::FileExt; //use futures::stream::Stream; //se futures::Future; use log::{error, info}; use service::Service; use std::env; use std::fs::OpenOptions; use std::io::Write; use std::process; use tokio::runtime; use ...
use proconio::{input, marker::Chars}; use run_length::RunLength; fn main() { input! { _n: usize, s: Chars, }; let rle = RunLength::new(s.iter()).collect::<Vec<_>>(); let mut x = 0; for w in rle.windows(2) { let (c1, l1) = w[0]; let (c2, l2) = w[1]; if c1 == ...
#[doc = "Reader of register MACHWF1R"] pub type R = crate::R<u32, super::MACHWF1R>; #[doc = "Reader of field `RXFIFOSIZE`"] pub type RXFIFOSIZE_R = crate::R<u8, u8>; #[doc = "Reader of field `TXFIFOSIZE`"] pub type TXFIFOSIZE_R = crate::R<u8, u8>; #[doc = "Reader of field `OSTEN`"] pub type OSTEN_R = crate::R<bool, boo...
// 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 specs::prelude::*; use std::marker::PhantomData; use super::physics::Direction; use super::command::{GameCommand, GameCommandQueue}; #[derive(Component)] pub struct Legs;
use core::fmt; use serde::de::{self, Deserializer, Error, Unexpected}; use serde::ser::Serializer; use serde::{Deserialize, Serialize}; use coruscant_nbt::Compression; #[derive(Serialize, Debug)] #[serde(rename = "Player")] pub struct PlayerDat { #[serde(rename = "DataVersion")] data_version: i32, #[serd...
use std::collections::HashSet; /// /// Check if a string only contains unique characters (i.e. every character /// in the string occurs exactly once). /// /// Time Complexity: `O(n)` (`n * O(1)` insertions) /// Spacial Complexity: `O(n)` (worst case: all chars are unique) /// /// # Examples /// /// ``` /// use crac...
use std::{ borrow::Cow, collections::HashMap as StdHashMap, fmt::Display, hash::Hash, str::FromStr, }; use async_graphql_parser::{types::Field, Positioned}; use async_graphql_value::{from_value, to_value}; use hashbrown::HashMap; use indexmap::IndexMap; use serde::{de::DeserializeOwned, Serialize}; use crate::{ ...
use std::sync::Arc; use smallvec::SmallVec; use sourcerenderer_core::atomic_refcell::AtomicRefCell; use sourcerenderer_core::graphics::{ Backend, BufferInfo, BufferUsage, Device, MemoryUsage, }; /// We suballocate all mesh buffers from a large buffer /// to be able use indirect rendering. pub stru...
extern crate proc_macro; use proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, ItemStruct}; #[proc_macro_derive(Force)] pub fn derive_force(input: TokenStream) -> TokenStream { let item = parse_macro_input!(input as ItemStruct); let struct_name = item.ident; let (impl_generics, ty_ge...
// Search a 2D Matrix II // https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/587/week-4-february-22nd-february-28th/3650/ pub struct Solution; use std::cmp::Ordering::*; #[cfg(disable)] impl Solution { pub fn search_matrix(matrix: Vec<Vec<i32>>, target: i32) -> bool { let m ...
use board::stones::stone::Stone; struct GoSample { x: Vec<Stone>, y: Vec<f32>, } impl GoSample { pub fn new(x: Vec<Stone>, y: Vec<f32>) -> Self { GoSample { x, y } } } impl GoSample {}
/* * Open Service Cloud API * * Open Service Cloud API to manage different backend cloud services. * * The version of the OpenAPI document: 0.0.3 * Contact: wanghui71leon@gmail.com * Generated by: https://openapi-generator.tech */ #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct VpcResourceFragme...
use crate::NUMERICS; use arrow::array::{Array, ArrayRef}; use arrow::compute::kernels::numeric::sub_wrapping; use arrow::compute::shift; use arrow::datatypes::DataType; use datafusion::common::{Result, ScalarValue}; use datafusion::logical_expr::{PartitionEvaluator, Signature, TypeSignature, Volatility}; use once_cell:...
use std::net::UdpSocket; use std::io; use std::net::SocketAddr; use std::time; use std::str; use twinstick_logic::{BUFFER_SIZE, VERSION, FPS_60, FPS_120, DataType, GenericObject, TwinstickGame}; use chrono::Local; pub extern crate serde_derive; pub extern crate bincode; pub use bincode::{deserialize, serialize}; ...
use std::any::Any; use std::cmp; use std::marker::PhantomData; use std::ops::RangeInclusive; use self::vec_mutation::{RevertVectorMutation, VectorMutation, VectorMutationRandomStep, VectorMutationStep}; use crate::mutators::mutations::{Mutation, RevertMutation}; use crate::subvalue_provider::EmptySubValueProvider; use...
import front.ast; import front.ast.ann; import front.ast.method; import front.ast.ty; import front.ast.mutability; import front.ast.item; import front.ast.block; import front.ast.block_; import front.ast.block_index_entry; import front.ast.mod_index_entry; import front.ast.obj_field; import front.ast.decl; import front...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - FDCAN Core Release Register"] pub crel: CREL, #[doc = "0x04 - FDCAN Core Release Register"] pub endn: ENDN, _reserved2: [u8; 4usize], #[doc = "0x0c - This register is only writable if bits CCCR.CCE and CCCR.INIT are...
use crate::image::Color; #[derive(Clone)] pub struct Material { pub color: Color, pub ambient: f64, pub diffuse: f64, pub specular: f64, pub shininess: f64, pub reflection: f64 } impl Material { pub fn new(color: Color, ambient: f64, diffuse: f64, specular: f64, shininess: f64, ...
//! Audio generators. //! //! This provides audio generators which implements the [Generator] trait. //! //! It is part of the [audio ecosystem] of crates. //! //! # Examples //! //! ```rust //! use audio_generator::{Generator, Sine}; //! //! let mut g = Sine::new(440.0, 44100.0); //! assert_eq!(g.sample(), 0.0); //! a...
use fonttools::font::Table; use fonttools_cli::{open_font, read_args, save_font}; fn main() { let matches = read_args( "ttf-add-minimal-dsig", "Adds a minimal DSIG table if one is not present", ); let mut infont = open_font(&matches); if !infont.tables.contains_key(b"DSIG") { i...
use proconio::input; fn main() { input! { n: usize, m: usize, x: [i64; n], cy: [(usize, i64); m], }; let mut bonus = vec![0; n + 1]; for (c, y) in cy { bonus[c] = y; } let mut dp = vec![-1; n + 1]; dp[0] = 0; for x in x { let mut nxt_dp =...
mod vertex; use ecs::{Entity, ECS}; use renderer::{RendererDevice, MeshFlags}; use std::path::Path; use vertex::Vertex; pub fn load(ecs: &mut ECS) { let context = ecs.resources.get_mut::<RendererDevice>().unwrap(); ecs.add_entity(Entity::new().with(context.new_mesh( &Path::new("shaders/color.glsl"), ...
#![allow(clippy::all)] enum ParseResult { Incomplete(Vec<char>), SyntaxError(u32), } fn parse_chunks(chunks: &str) -> ParseResult { let mut open_chunks = vec![]; macro_rules! syntax_error_check { ($open:literal, $score:literal) => { if let Some($open) = open_chunks.pop() { ...
use super::*; #[derive(Debug, PartialEq)] pub struct Alias { pub to: String, pub from: String, } #[derive(Debug, PartialEq)] pub struct Undef { pub list: Vec<String>, } #[derive(Debug, PartialEq)] pub struct Rescue { pub body: Box<Node>, pub rescue: Vec<RescueClause>, pub otherwise: Box<Node>...
//! math.rs: Provides functionality for solving linear algebra problems. use std::cell::RefCell; use rand::{Rng,SeedableRng}; use rand::rngs::StdRng; fn _seedable_rand() -> f32 { thread_local! { pub static THREAD_FAST_RNG: RefCell<StdRng> = RefCell::new(StdRng::seed_from_u64(801289018191233)); } ...
pub mod binary; pub mod boolean; pub mod date; pub mod date_time; pub mod duration; pub mod float; pub mod integer; pub mod list; pub mod map; pub mod node; pub mod null; pub mod path; pub mod point; pub mod relation; pub mod string; pub mod time; pub use binary::BoltBytes; pub use boolean::BoltBoolean; pub use date::B...
//! This module describes a game map. use cursive; use game_item; use low_level; use std::cmp::{max, min}; //use decorators::decorators; use loggers::{log, logger}; //-------------------------------Constants------------------------------------// pub enum Direction { Left, Right, Up, Down, } // `LOC...
/// ACK packets are acknowledged by DATA or ERROR packets. /// the opcode is 4. /// /// The block number in an ACK echoes /// the block number of the DATA packet being acknowledged. /// /// A WRQ is acknowledged with an ACK packet having a /// block number of zero. use crate::tftp::shared::{Deserializable, Serial...
use std::{cell::RefCell, collections::HashMap, rc::Rc}; use crate::{ interpreter::RuntimeResult, literal::Literal, runtime_error::RuntimeError, token::Token, }; #[derive(PartialEq, Debug, Clone, Eq)] pub struct Environment { values: HashMap<String, Literal>, enclosing: Option<Rc<RefCell<Environment>>>, } ...
use std::sync::{ Arc, MutexGuard, }; use log::trace; use sourcerenderer_core::graphics::*; use sourcerenderer_core::platform::{ Event, Platform, Window, }; use sourcerenderer_core::{ Console, ThreadPoolBuilder, }; use crate::asset::loaders::{ FSContainer, ShaderLoader, }; use crate...
use std::io; const MAX_LIST_ITEMS: usize = 6; pub fn list() -> Vec<String>{ let mut items = Vec::new(); let mut read_in_str = String::new(); let mut count: usize = MAX_LIST_ITEMS + 1; while count > MAX_LIST_ITEMS { println!("How many items are in your list? (Max size is {})", MAX_LIST_ITEMS);...
fn main() { println!(r"cargo:rustc-link-search=../libtts"); println!(r"cargo:rustc-link-search=../libtts/flite/lib"); println!(r"cargo:rustc-link-lib=static=flite_cmu_us_slt"); println!(r"cargo:rustc-link-lib=static=flite_usenglish"); println!(r"cargo:rustc-link-lib=static=flite_cmulex"); printl...
//Defining and naming opcodes //Adressing modes: immediate, absolute, zeropage absolute, implied, Accumulator, indexed, zeropage indexed, indirect, pre-indexed indirect, post-indexed indirect, relative //Adressing lettercuts: IMM, ABS, ZBS, IMP, ACC, IND, ZND, INR, PNR, PID, REL //enum Opcode, ordered by opcode type, N...
use std::fs::File; use std::io::Write; use std::path::Path; use std::io::Read; use std::io::Error; use model::world::World; // Returns the file content as a string pub fn read_file(filepath: &str) -> String { let path = Path::new(filepath); let display = path.display(); let mut file = match File::open(&pa...
// Software rendering pipeline // // For each mesh m // For each vertex v (dim 4) in m // 1) Model to world space (MODEL matrix 4x4) // 2) World to camera space (VIEW matrix 4x4) // 3) Camera to homogeneous clip space (PROJECTION matrix 4x4), w = 1 // 4) Clipping + perspective divide (normalization) => NDC space [-1, 1...
// Copyright 2020 IOTA Stiftung // // 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 in w...
use super::ema::ema_func; use super::ema::series_rma; use super::sma::{declare_ma_var, wma_func}; use super::tr::tr_func; 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::...
//! PICL a LISP written in Rust //! It follows and extends the edn format defined by Clojure but it is not //! Clojure in Rust. #[macro_use] extern crate lazy_static; #[macro_use] pub mod utils; // Internal modules pub mod builtins; pub mod env; pub mod eval; pub mod float; pub mod interpretor; pub mod list; pub mod...