text
stringlengths
8
4.13M
#[cfg(test)] mod tests { use counter::Counter; use rand::Rng; #[test] fn test_composite_add_sub() { let mut counts = Counter::<_>::init( "able babble table babble rabble table able fable scrabble".split_whitespace(), ); // add or subtract an iterable of the same type...
fn main() { proconio::input!{mut a:u64,b:u64,mut c:u64,d:u64}; let x = (c+b-1)/b; let y = (a+d-1)/d; println!("{}", if x<=y{"Yes"}else{"No"}) }
use std::{mem::size_of, rc::Rc}; use ash::vk; use gpu_allocator::{vulkan::Allocation, MemoryLocation}; use super::allocator::Allocator; const DEFAULT_STAGING_BUFFER_SIZE: u64 = 16 * 1024 * 1024; struct StagingBuffer { buffer: vk::Buffer, alloc: Allocation, mapping: *mut u8, pos: u64, size: u64, ...
use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use super::types; use super::types::MalType::{List, Symbol, Vector}; use super::types::{new_list, MalResult, MalValue}; pub struct EnvData { data: HashMap<String, MalValue>, outer: Option<Env>, } /// Main Trait to interact with a Make A ...
use std::env; fn main() { let args = env::args(); for (k, v) in args.enumerate() { println!("args[{}] = {}", k, v); } }
use std::io::{stdin}; fn main() { let mut buf = String::new(); stdin().read_line(&mut buf).unwrap(); let value = buf.trim().parse::<i32>().unwrap(); let result = match value { x if x % 4 == 0 && x % 100 != 0 => 1, x if x % 4 == 0 && x % 400 == 0 => 1, _ => 0, }; prin...
//! Clint use riscv::{csr, interrupt}; use e310x::CLINT; pub struct Clint<'a>(pub &'a CLINT); impl<'a> Clone for Clint<'a> { fn clone(&self) -> Self { *self } } impl<'a> Copy for Clint<'a> { } impl<'a> Clint<'a> { /// Read mtime register. pub fn get_mtime(&self) -> ::aonclk::Ticks<u64> { ...
#[doc = "Reader of register HWCFGR1"] pub type R = crate::R<u32, super::HWCFGR1>; #[doc = "Writer for register HWCFGR1"] pub type W = crate::W<u32, super::HWCFGR1>; #[doc = "Register HWCFGR1 `reset()`'s with value 0x3110_0000"] impl crate::ResetValue for super::HWCFGR1 { type Type = u32; #[inline(always)] f...
use std::rc::Rc; #[derive(Debug)] struct FileName { name: Rc<String>, ext: Rc<String>, } fn ref_counter() { let name = Rc::new(String::from("main")); let ext = Rc::new(String::from("rs")); for _ in 0..3 { println!("{:?}", FileName { name: name.clone(), ext: ext.clone(), }); } } f...
#[derive(Debug, PartialEq)] pub enum ElmCode<'a> { Comment, Declaration, Ignore, Function(Function<'a>), Type(Type<'a>), } #[derive(Debug, PartialEq)] pub enum ElmModule<'a> { All, List(Vec<TypeOrFunction<'a>>), } type Name<'a> = &'a str; type Definition<'a> = &'a str; type TypeSignature ...
pub struct Solution; impl Solution { pub fn count_smaller(nums: Vec<i32>) -> Vec<i32> { Solver::new(nums).solve() } } struct Solver { nums: Vec<i32>, count: Vec<i32>, index: Vec<usize>, dummy: Vec<usize>, } impl Solver { fn new(nums: Vec<i32>) -> Self { let n = nums.len();...
use hyper::service::{make_service_fn, service_fn}; use hyper::{Body, Client, Request, Response, Server}; use hyper_tls::HttpsConnector; use std::net::SocketAddr; use std::sync::Arc; const STRIPPED: [&str; 6] = [ "content-length", "transfer-encoding", "accept-encoding", "content-encoding", "host", ...
use crate::actors_manager::ActorProxyReport; use crate::envelope::{Envelope, Letter}; use crate::system::AddressBook; use crate::{Actor, Assistant, Handle}; use async_std::{ sync::{channel, Receiver, Sender}, task::spawn, }; use std::fmt::Debug; #[derive(Debug)] enum ActorProxyCommand<A: Actor> { Dispatch(...
use ::errors::*; use ::ir::{Type, TypeVariant, TypeData, TypeContainer, FieldPropertyReference}; use ::ir::variant::{Variant, SimpleScalarVariant, ContainerVariant, ContainerField, ContainerFieldType, ArrayVariant, UnionVariant}; use super::*; use super::utils::*; pub fn find_field_index(variant: &ContainerVariant, pr...
// material.rs // // Copyright (c) 2019, Univerisity of Minnesota // // Author: Bridger Herman (herma582@umn.edu) //! Data container for material information use std::str::FromStr; use glam::{Vec3, Vec4}; use wasm_bindgen::prelude::*; use crate::texture::TextureId; #[wasm_bindgen] #[derive(Debug, Clone, Copy)] pub...
#![allow(missing_docs)] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] pub enum Key { Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key0, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16,...
use std::str::FromStr; struct Length { length: usize }; use std::iter::FromIterator; impl<A> FromIterator<A> for Length { fn from_iter<S>(src: S) -> Self where S: IntoIterator<Item = A>, { let mut length: usize = 0; for _ in src { length += 1; } Length{l...
use crate::utils; fn read_problem_data() -> Vec<String> { let path = "data/day18.txt"; let mut result = Vec::new(); if let Ok(lines) = utils::read_lines(path) { for line in lines { if let Ok(s) = line { result.push(s); } } } result } fn tok...
use std::ops::{Mul, MulAssign}; use std::str::FromStr; use serde::Deserialize; use tiny_fail::Fail; #[derive(Debug, Clone, Copy, PartialEq, Deserialize)] pub struct Coords { pub x: f32, pub y: f32, pub z: f32, } impl Coords { pub const fn new(x: f32, y: f32, z: f32) -> Coords { Coords { x, y...
use super::mocks::*; use super::{db_path, pause}; use crate::adapters::twitter::{ReceivedMessageContext, TwitterId}; use crate::connector::{AckResponse, EventType, JudgementRequest, Message}; use crate::primitives::{unix_time, Account, AccountType, NetAccount}; use crate::{test_run, Database}; use std::sync::Arc; use t...
/// This file contains the CPU logic. /// Used http://nesdev.com/6502_cpu.txt as a reference. /// /// The NMOS 65xx processors have 256 bytes of stack memory ranging from $0100 to $01FF. use log::info; use std::convert::From; use crate::opcode::{self, *}; const MEMORY_SIZE_MAX: usize = 0xffff + 1; pub type AddressSpa...
#![no_main] #![feature(start)] extern crate olin; use log::{error, info, warn}; use olin::entrypoint; entrypoint!(); fn main() -> Result<(), std::io::Error> { let string = "hi"; error!("{}", string); warn!("{}", string); info!("{}", string); Ok(()) }
/*------------------------------- args.rs 起動引数を取得して、 場合に応じたオプションをつける * print_usage() : ヘルプ表示用の関数 * print_version(): version表示用の関数 * impl Args * new() : 外部から呼び出す関数。内部でargs_check()を呼ぶ。 * args_check() : env::args()の値を見て、適切なモードを指定する * set_to_env_var(): デバッグモードかどうかを、環境変...
use std::collections::HashMap; use std::str::FromStr; #[derive(Debug, PartialEq)] pub struct ParseError; #[derive(Debug, PartialEq)] pub struct PositionSpec { pos_a : (i64, i64), pos_b : (i64, i64), } impl FromStr for PositionSpec { type Err = ParseError; fn from_str(s: &str) -> Result<Self, Self::E...
use std::{collections::HashMap, hash::Hash}; use chrono::{DateTime, Local}; use egui::{ emath::align, util::History, Color32, FontData, FontDefinitions, FontFamily, TextFormat, }; use env_logger::fmt::Color; use rfd; use serde_json; use zhouyi::show_text_divinate; use egui_extras::{Size,StripBuilder}; /// We der...
fn main() { let input = std::fs::read_to_string("input.txt").unwrap(); let lines: Vec<&str> = input.split("\n").collect(); let drawings: Vec<u32> = to_ints(lines[0], ","); // create list of boards for part 1 & part 2 let size = 5; let mut boards1: Vec<Board> = Vec::new(); let mut boards2: V...
#[macro_use] extern crate derive_builder; #[derive(Clone, Debug)] struct Resolution { width: u32, height: u32, } impl Default for Resolution { fn default() -> Resolution { Resolution { width: 1920, height: 1080, } } } #[derive(Debug, Default, Builder)] #[builde...
#![allow(unused_unsafe)] use libc; use raw_window_handle::*; use std::ffi::OsStr; use std::os::windows::ffi::OsStrExt; use winapi::_core::ptr; use winapi::shared::minwindef::{BOOL, FALSE, TRUE, UINT}; use winapi::shared::windef::HWND; #[allow(non_snake_case)] #[inline] pub fn BOOL(flag: bool) -> BOOL { match flag ...
use embedded_graphics::{ mono_font::{ascii::FONT_6X10, MonoFont}, pixelcolor::BinaryColor, }; use crate::themes::default::toggle_button::{ ButtonStateColors, ToggleButtonStyle as ToggleButtonStyleTrait, }; pub struct ToggleButtonInactive; pub struct ToggleButtonIdle; pub struct ToggleButtonHovered; pub st...
// This file is part of NAME. 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/NAME/master/COPYRIGHT. No part of NAME, including this file, may be copied, modified, propagated, or distributed except accordin...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use std::convert::TryInto; use std::sync::Arc; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::Term; use crate::erlang::start_timer; use crate::runtime::timer::Format; use crate::timer; ...
use std::ops::Neg; use std::collections::HashSet; fn part1(data : &str) -> i32 { data.lines().fold(0, |acc, line| { acc + parse_line(line) }) } fn parse_line(s : &str) -> i32 { let out = s.get(0..1).and_then(|sign| { s.get(1..).and_then(|rest| { rest.parse::<i32>().ok().map(|i|...
use std::sync::Arc; use self::{ changed_files_filter::ChangedFilesFilter, commit::CommitToScheduler, compaction_job_done_sink::CompactionJobDoneSink, compaction_job_stream::CompactionJobStream, df_plan_exec::DataFusionPlanExec, df_planner::DataFusionPlanner, divide_initial::DivideInitial, file_classifi...
//! File holding the OneOrMany type and associated tests //! //! Author: [Boris](mailto:boris@humanenginuity.com) //! Version: 1.0 //! //! ## Release notes //! - v1.0 : creation // ======================================================================= // LIBRARY IMPORTS // ============================================...
use hashbrown::HashSet; use utils::VectorN; // #[test] pub fn run() { let input = read_input(include_str!("input/day17.txt")); println!("{}", exercise_1(&input, 160)); // let input = read_input_hack(include_str!("input/day17.txt")); println!("{}", exercise_2(&input, 160)); } type Vector = VectorN<4>; ...
fn main() { let mut fred = Person { first_name: "Fred".to_string(), last_name: "Sanford".to_string(), birth_year: 1908, }; fred.set_age(109); println!("{}", fred); print_name(&fred); let fido = Dog {name: "Fido".to_string()}; print_name(&fido); let snoopy = Do...
mod ckb; use structopt::StructOpt; #[derive(StructOpt)] #[structopt( name = "nodebridge", about = "Bridge between the mining pool and the blockchain node", rename_all = "snake_case" )] enum Opt { #[structopt(name = "ckb", about = "Node bridge for CKB network")] Ckb { /// RPC address in <ho...
use ggez::{ Context, GameResult, nalgebra::Point2 }; use ggez::graphics; /// A menu with equally-sized, vertically-stacked menu items. pub struct Menu<T> { bounds: graphics::Rect, items: Vec<MenuItem<T>>, item_width: f32, item_height: f32, } struct MenuItem<T> { ident: T, bounds: graphics::Re...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use serde_derive::{Deserialize, Serialize}; /// Enums and structs for wlan client status. /// These definitions come from fuchsia.wlan.policy/client_provi...
// Copyright 2017 Dasein Phaos aka. Luxko // // 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. This file may not be copied, modified, or distributed // except a...
use game; use game_item; use hero; use low_level; use map; use monster; use texts; pub fn HeroShot(app: &mut ::cursive::Cursive, direction: map::Direction) { use map::Direction::*; let curhero = get_mut_ref_curhero!(); if let Some(item) = curhero.Slots[hero::slotHands] { if item.IType != game_item:...
use crate::function::LoxFunction; use crate::class::{LoxObject, LoxClass}; use crate::state::State; use crate::value::{Value, ValueError, LoxTrait, LoxArray}; use parser::types::{Expression, ExpressionType, FunctionHeader, ProgramError, SourceCodeLocation, Statement, StatementType, TokenType, Type}; use std::cell::{Cel...
#![deny(warnings)] pub mod led;
//! Account module types. use std::collections::BTreeMap; use num_traits::identities::Zero; use crate::types::{address::Address, token}; /// Transfer call. #[derive(Clone, Debug, cbor::Encode, cbor::Decode)] pub struct Transfer { pub to: Address, pub amount: token::BaseUnits, } /// Account metadata. #[deriv...
use blake2::Blake2s as b2s; use digest::Digest; use super::PRF; use crate::CryptoError; #[derive(Clone)] pub struct Blake2s; impl PRF for Blake2s { type Input = [u8; 32]; type Output = [u8; 32]; type Seed = [u8; 32]; fn evaluate(seed: &Self::Seed, input: &Self::Input) -> Result<Self::Output, CryptoE...
#[macro_export] macro_rules! debug { ($format: literal, $( $args:expr ), * ) => { if crate::CONFIG.debug { println!($format, $( $args ), *); } } }
use std::{ future::Future, marker::PhantomData, ops::{Deref, DerefMut}, pin::Pin, task::{Context, Poll}, time::Duration, }; pub use map::Map; use pin_project_lite::pin_project; pub use then::Then; pub use timeout::Timeout; use crate::actor::Actor; mod either; mod map; pub mod result; mod then...
use juniper::{GraphQLInputObject, GraphQLObject}; // if you need to pass this struct as parameter // in GraphQL mutations it needs to derive GraphQLInputObject #[derive(GraphQLObject, Debug, Clone)] #[graphql(description = "Todo List. Represents group of todo items with same goal.")] pub struct TodoList { pub id: i3...
//***************************************************************************** // // The following are defines for the Univeral Serial Bus register offsets. // //***************************************************************************** pub const O_FADDR: uint = 0x00000000; // USB Device Functional Address pub con...
{{#each arguments~}} {{#if ../arg_names}}{{lookup ../arg_names @index}}{{else}}{{this.[0]}}{{/if}}, {{~/each}}
use std::env; use std::fs::File; use std::io::{self, BufRead, BufReader}; fn main() -> Result<(), io::Error> { let args: Vec<String> = env::args().collect(); let reader = BufReader::new(File::open(&args[1]).expect("File::open failed")); let list = reader .lines() .map(|x| { x.ex...
use super::PyMethod; use crate::{ builtins::{pystr::AsPyStr, PyBaseExceptionRef, PyList, PyStrInterned}, function::IntoFuncArgs, identifier, object::{AsObject, PyObject, PyObjectRef, PyResult}, vm::VirtualMachine, }; /// PyObject support impl VirtualMachine { #[track_caller] #[cold] fn ...
use chip::rom::getfun; //***************************************************************************** // // The following are values that can be passed to the // SysCtlPeripheralPresent(), SysCtlPeripheralEnable(), // SysCtlPeripheralDisable(), and SysCtlPeripheralReset() APIs as the // ui32Peripheral parameter. The...
/// Builds a static hashmap macro_rules! map( { $($key:expr => $value:expr),+ } => { { let mut m = ::std::collections::HashMap::new(); $( m.insert($key, $value); )+ m } }; ); /// Converts a rust variable type to the NodeValueTy...
#[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::SCGCI2C { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
use chrono::NaiveDateTime; use crate::schema::ciclos_letivos; #[derive(Serialize, Deserialize, Queryable)] pub struct CicloLetivos { pub id: i32, pub ano: Option<i32>, pub semestre: Option<i32>, pub nivel_ensino_id: Option<i32>, pub created_at: NaiveDateTime, pub updated_at: NaiveDateTime, } ...
mod flag; pub mod node; pub mod node_chain; pub mod tree;
use super::calibration::Calibration; use super::capture::Capture; use super::error::{k4a_result, k4a_wait_result, Error, WaitError}; use super::frame::Frame; use super::tracker_configuration::TrackerConfiguration; pub struct Tracker { tracker_handle: libk4a_sys::k4abt_tracker_t, } impl Tracker { pub fn create...
use std::io::{ErrorKind, Read}; use structopt::StructOpt; use crate::advents::AdventYear; #[macro_use] mod helper; mod advent_2020; mod advent_adapters; mod advents; #[derive(StructOpt, Debug)] struct Cli { year: Option<u16>, advent: Option<u8>, } impl Cli { pub fn from_user(advent_years: &[AdventYear...
//! https://github.com/lumen/otp/tree/lumen/lib/megaco/src #[path = "megaco/app.rs"] mod app; #[path = "megaco/binary.rs"] mod binary; #[path = "megaco/engine.rs"] mod engine; #[path = "megaco/flex.rs"] mod flex; #[path = "megaco/tcp.rs"] mod tcp; #[path = "megaco/text.rs"] mod text; #[path = "megaco/udp.rs"] mod udp;...
use crate::board::Board; use crate::icons::octocat::OctoCat; use crate::icons::rust::Rust; use crate::icons::yewstack::Yew; use crate::utils::calculate_winner; use yew::prelude::*; #[derive(Copy, Clone)] struct History { squares: [&'static str; 9], } pub struct Game { link: ComponentLink<Self>, history: V...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. mod integration_tests; use failure::{format_err, Error, ResultExt}; use fidl::endpoints::DiscoverableService; use fidl_fuchsia_net::{IpAddress, Subnet}; u...
use std::fmt::Debug; pub trait Convex<K>: Ord + Copy + Debug where K: PartialOrd, { fn get_angle(a: &Self, b: &Self) -> K; fn get_turn(a: &Self, b: &Self, c: &Self) -> Turn; } #[derive(PartialEq, PartialOrd)] pub enum Turn { Clockwise, CounterClockwise, } // Convex hull // Take array points. Outpu...
use super::CompilePass; use super::Result; use ::{Type, TypeContainer}; use std::rc::{Rc, Weak}; use std::cell::RefCell; pub struct AssignParentPass; impl CompilePass for AssignParentPass { fn run(typ: &mut TypeContainer) -> Result<()> { do_run(typ, None) } } fn do_run(typ: &mut TypeContainer, pare...
use yew::{prelude::*, Children}; #[derive(Properties, Clone, PartialEq)] pub struct Props { pub title: String, #[prop_or_default] pub children: Children, } pub struct FormContainer { props: Props, } impl Component for FormContainer { type Message = (); type Properties = Props; fn create(...
use std::ops::{Deref, DerefMut}; use libc::c_int; use curses; use {Error, Result, Window}; pub struct Panel<'a> { ptr: *mut curses::PANEL, window: Window<'a>, } impl<'a> Panel<'a> { #[inline] pub unsafe fn wrap<'b>(ptr: *mut curses::PANEL) -> Panel<'b> { Panel { ptr: ptr, window: Window::wrap(curses::panel_...
use std::fmt; use num; use approx; use super::traits::ColorChannel; use super::scalar::{PosNormalChannelScalar, NormalChannelScalar}; use channel::ChannelCast; use channel::cast::ChannelFormatCast; use ::color; pub struct PosNormalChannelTag; pub struct NormalChannelTag; #[derive(Copy, Clone, Debug, PartialEq, Eq, Pa...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qstyleditemdelegate.h // dst-file: /src/widgets/qstyleditemdelegate.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end ...
pub mod compiler; pub mod descriptor_pb;
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[doc(hidden)] pub struct IOcrEngine(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IOcrEngine { type Vtable = IOcrEngine_abi; con...
fn divide(x: f64, y: f64) -> Result<f64, ()> { if y == 0.0 { Ok(0.0) }else { Ok(x/y) } } fn main() { let x = match divide(3.0, 1.0) { Ok(val) => val, Err(_) => 0.0, }; println!("nilai x: {}", x); }
use std::error::Error; use std::fmt::{self, Display}; use std::str::FromStr; #[derive(Debug)] pub struct Wallet { amount: f64, address: String, } #[derive(Debug)] pub struct ParseWalletFromString { error: String, } impl Display for ParseWalletFromString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt:...
#[doc = "Reader of register APB2RSTR"] pub type R = crate::R<u32, super::APB2RSTR>; #[doc = "Writer for register APB2RSTR"] pub type W = crate::W<u32, super::APB2RSTR>; #[doc = "Register APB2RSTR `reset()`'s with value 0"] impl crate::ResetValue for super::APB2RSTR { type Type = u32; #[inline(always)] fn re...
//! Shared configuration and tests for accepting ingester addresses as arguments. use http::uri::{InvalidUri, InvalidUriParts, Uri}; use snafu::Snafu; use std::{fmt::Display, str::FromStr}; /// An address to an ingester's gRPC API. Create by using `IngesterAddress::from_str`. #[derive(Debug, Clone, PartialEq, Eq)] pu...
use super::*; use js_sys::{Reflect, Symbol}; use wasm_bindgen::JsCast; use web_sys::WebSocket; use liblumen_alloc::erts::fragment::HeapFragment; use liblumen_web::web_socket; #[wasm_bindgen_test] async fn with_valid_url_returns_ok_tuple() { start_once(); let (url, url_non_null_heap_fragment) = He...
//给定一个整数数组 nums,求出数组从索引 i 到 j (i ≤ j) 范围内元素的总和,包含 i, j 两点。 // // update(i, val) 函数可以通过将下标为 i 的数值更新为 val,从而对数列进行修改。 // // 示例: // // Given nums = [1, 3, 5] // //sumRange(0, 2) -> 9 //update(1, 2) //sumRange(0, 2) -> 8 // // // 说明: // // // 数组仅可以在 update 函数下进行修改。 // 你可以假设 update 函数与 sumRange 函数的调用次数是均匀分布的。 // // Related T...
use crate::{ conditions::{Condition, ConditionConfig}, event::{Event, Value}, topology::config::{ TestCondition, TestDefinition, TestInput, TestInputValue, TransformContext, }, transforms::Transform, }; use indexmap::IndexMap; use std::collections::HashMap; //-------------------------------...
use rand::random; use ray::Ray; use std::f64::consts::PI; use vec3::{cross, dot, unit_vector, Vec3}; pub fn random_in_unit_disk() -> Vec3 { let mut p = Vec3 { e: [1.0, 1.0, 1.0] }; while dot(&p, &p) >= 1.0 { p = Vec3 { e: [random::<f32>(), random::<f32>(), 0.0], } * 2.0 ...
//! Serial use crate::ccu::{Ccu, Clocks}; use crate::gpio::{ Alternate, AF0, AF1, AF2, PB0, PB1, PB2, PB3, PB8, PB9, PD0, PD1, PD2, PD3, PD4, PD5, }; use crate::hal::serial; use crate::pac::ccu::{BusClockGating3, BusSoftReset4}; use crate::pac::uart_common::{ DivisorLatchHigh, DivisorLatchLow, FifoControl, Int...
use actix_web::{HttpRequest, HttpResponse, Result}; use actix_web::middleware::{Middleware, Response, Started}; use base64::decode; use http::{header, StatusCode}; use std::str; use std::str::FromStr; use api::error::APIError; use api::State; use api::state::UserStore; use user::User; #[derive(Debug)] pub struct Bas...
//============================================================================== // Notes //============================================================================== // mcu::adc.rs //============================================================================== // Crates and Mods //===============================...
use yew::{html, Component, ComponentLink, Html, ShouldRender}; use crate::components::Header; use crate::components::Test; pub struct App; impl Component for App { type Message = (); type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { App {} } fn updat...
extern crate actix_web; extern crate futures; extern crate juniper; use std::env; use std::io; use std::sync::Arc; use actix_web::{web, App, Error, HttpResponse, HttpServer}; use futures::future::Future; use juniper::http::graphiql::graphiql_source; use juniper::http::GraphQLRequest; mod graphql_schema; use crate::...
//! Border thickness and color use crate::{ data::WidgetData, geometry::{measurement::MeasureSpec, BoundingBox, MeasuredSize, Position}, state::WidgetState, widgets::{ utils::{ decorator::WidgetDecorator, wrapper::{Wrapper, WrapperBindable}, }, Widget, ...
use super::stat_expr_types::DataType; use std::collections::BTreeMap; use std::convert::From; use std::rc::Rc; use std::string::ToString; #[derive(Debug, PartialEq, Clone, Eq, Hash)] pub struct FunctionType<'a> { pub signature: (Vec<(&'a str, SyntaxType<'a>)>, SyntaxType<'a>), } impl<'a> FunctionType<'a> { pu...
#[macro_use] extern crate inherit; pub mod expression; pub mod module; pub mod node; pub mod statement; use expression::{Expression, Identifier, Literal, PropertyKind}; use module::ModuleDeclaration; use node::{Node, NodeKind, SourceLocation}; use statement::{FunctionBody, Statement}; #[inherit(Node)] #[derive(Debug...
use std::rc::Rc; use std::str::FromStr; use crate::expr::Expr; use crate::lexer::Lexer; use crate::lexer::Lexem; use crate::field::Field; use crate::function::Function; use crate::operators::ArithmeticOp; use crate::operators::LogicalOp; use crate::operators::Op; use crate::query::OutputFormat; use crate::query::Query...
use crate::camera::Camera; use crate::mesh::{Mesh, Vertex}; use crate::shader::Shader; use crate::texture::Texture; use cgmath::prelude::*; use cgmath::{vec3, Matrix4, Quaternion, Vector2, Vector3}; use gltf::buffer::Data; use gltf::image::Source; use gltf::Mesh as GLTFMesh; use gltf::{scene::Node, Document, Scene}; us...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use super::pseudo_directory_impl; use {indoc::indoc, proc_macro2::TokenStream, std::str::FromStr}; // rustfmt is aligning all the strings, making them ev...
// coefficient trait trait Coef: Copy + std::ops::Add<Output = Self> + std::ops::Sub<Output = Self> + std::ops::Mul<Output = Self> + std::ops::Div<Output = Self> + std::ops::AddAssign + std::ops::SubAssign + std::ops::MulAssign + std::ops::DivAssign + std::default::Default ...
// 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 super::VarResult; use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType}; use crate::helper::err_msgs::*; use crate::helper::str_replace; use crate::helper::{ move_element, pine_ref_to_bool, pine_ref_to_color, pine_ref_to_f64, pine_ref_to_i64, pine_ref_to_string, }; use cra...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from ../gir-files // DO NOT EDIT use crate::AddressFamily; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use std::boxed::Box as Box_; use...
// 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::prelude::*; use std::os::raw::c_void; pub type PFN_vkAllocationFunction = extern "system" fn(*mut c_void, usize, usize, VkSystemAllocationScope) -> *mut c_void; pub type PFN_vkReallocationFunction = extern "system" fn( *mut c_void, *mut c_void, usize, usize, VkSystemAllocationScope...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[doc(hidden)] pub struct IXboxLiveDeviceAddress(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IXboxLiveDeviceAddress { type Vtable =...
// 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::error::{ErrorManager, Level}; use crate::span::Index; use crate::span::Span; #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub enum Keyword { And, Break, Do, Else, ElseIf, End, False, For, Function, Goto, If, In, Local, Nil, Not, Or, R...
//! Wrapper the CUDA API. #![allow(dead_code)] mod array; mod counter; mod error; mod executor; mod jit_daemon; mod module; mod wrapper; pub use self::array::Array; pub use self::counter::{PerfCounter, PerfCounterSet}; pub use self::error::*; pub use self::executor::*; pub use self::jit_daemon::JITDaemon; pub use self...
//! Response body types. // TODO: support for streaming response bodies use prelude::*; /// Response body #[derive(Debug)] pub struct Body(pub(super) Vec<u8>); impl Body { /// Buffer the response body into a `Vec<u8>` and return it pub fn into_vec(self) -> Vec<u8> { self.0 } }