text
stringlengths
8
4.13M
use libc::open; use libc::dup2; use libc::{O_RDONLY, O_WRONLY, O_CREAT, O_TRUNC}; use libc::{STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO}; use libc::exit; use libc::EXIT_FAILURE; use std::io::{Error, Result, Write}; use std::os::unix::io::{AsRawFd, RawFd, FromRawFd}; use std::os::unix::fs::{MetadataExt}; use std::fs::...
#[derive(Debug)] pub enum DesktopMode { Tile, } pub struct Desktop { pub mode: DesktopMode, } impl Desktop { pub fn new(mode: DesktopMode) -> Self { Self { mode } } }
use std::default::Default; use std::io::Result; use std::process::exit; mod lib; use lib::Bot; use lib::CONFIG_PATH; extern crate irc; use irc::client::prelude::Config; fn main() { if let Ok(config) = handle_config() { let bot = Bot::new(config); if let Ok(bot) = bot { bot.run() } else if let Err(err) = ...
use std::collections::{HashMap, HashSet}; use std::env; use std::error::Error; use std::fs; use std::str; use bioinformatics_algorithms::{neighbors, revc}; pub fn frequent_words_with_mismatches_and_rc(text: &[u8], k: usize, d: usize) -> HashSet<String> { let mut kmers = HashMap::new(); let mut frequent = Hash...
#[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::HB16CFG4 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R,...
pub use crate::{ api::HltvApi, https_client::{impls::attohttpc_impl::AttoHttpcImpl, HttpsClient}, }; mod api; mod https_client; /// Default HLTV URL. pub const HLTV_URL: &'static str = "https://www.hltv.org"; pub type Result<T> = std::result::Result<T, Error>; /// General error type for this crate. #[derive...
#[doc = "Reader of register SR"] pub type R = crate::R<u32, super::SR>; #[doc = "Reader of field `ALRAF`"] pub type ALRAF_R = crate::R<bool, bool>; #[doc = "Reader of field `ALRBF`"] pub type ALRBF_R = crate::R<bool, bool>; #[doc = "Reader of field `WUTF`"] pub type WUTF_R = crate::R<bool, bool>; #[doc = "Reader of fie...
#![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 AddAtomA(lpstring: super::super::Foundation::PSTR) -> u16; #[cfg(feature = "Win32_Foundation")] pub f...
use std::io::{self, BufReader}; use proconio::{input, source::line::LineSource}; fn main() { let stdin = io::stdin(); let mut stdin = LineSource::new(BufReader::new(stdin)); input! { from &mut stdin, n: usize, }; let (mut l, mut r) = (0, n); for _ in 0..20 { let m ...
// Ubah data dari tipe string ke integer // fn main() { let x = "10".to_string(); let y: i32 = x.parse().unwrap(); let z = x.parse::<i32>().unwrap(); println!("y= {:?}", y); println!("z= {:?}", z); let a: i32 = 10; let b: i64 = a as i64; println!("b= {:?}", b); }
use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Default, Debug)] pub struct Config { workers: u16, }
// #![cfg_attr(feature = "dev", allow(unstable_features))] // #![cfg_attr(feature = "dev", feature(plugin))] // #![cfg_attr(feature = "dev", plugin(clippy))] // #![deny(missing_docs, // missing_debug_implementations, missing_copy_implementations, // trivial_casts, trivial_numeric_casts, // unsa...
#[macro_export] macro_rules! morgan_stake_controller { () => { ("morgan_stake_controller".to_string(), morgan_stake_api::id()) }; } use morgan_stake_api::stake_instruction::process_instruction; morgan_interface::morgan_entrypoint!(process_instruction);
use crate::flags::Flags; pub struct Registers { pub a: u8, pub b: u8, pub c: u8, pub d: u8, pub e: u8, pub f: Flags, pub h: u8, pub l: u8, } impl Registers { pub fn new() -> Registers { Registers { a: 0, b: 0, c: 0, d: 0, ...
/*! A message-only window enables you to send and receive messages. It is not visible, has no z-order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages. A MessageWindow do not have any builder parameter, but still provides the API for the derive macro. ...
//! Provides error types for the installer tools. use notion_fail::{ExitCode, NotionFail}; use failure; #[derive(Debug, Fail, NotionFail)] #[fail(display = "Failed to download version {}\n{}", version, error)] #[notion_fail(code = "NetworkError")] pub(crate) struct DownloadError { version: String, error: Str...
use super::node::{ExternTensorGraphCondition, NodeEntry}; use crate::ast; use crate::error::{GraphCallError, Result}; use crate::externs::{ExternIR, ExternIRShapes}; use crate::graph::Graph; use crate::tensor::IRData; use crate::variable::{assert_equal, BuildValue, Link}; #[allow(non_upper_case_globals)] pub mod built...
use super::{Block, Statement, Value, Ident, Item, ItemArg}; pub fn print(block: &Block) -> String { let mut out = String::new(); print_block(block, &mut out, 0); out } fn pad_level(string: &mut String, level: u64) { for _ in 0..level { string.push_str(" "); } } fn print_block(block: ...
// This file is part of syslog2. 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/syslog2/master/COPYRIGHT. No part of syslog2, including this file, may be copied, modified, propagated, or distributed except...
use input_i_scanner::InputIScanner; use join::Join; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; ...
/// Every data packet transmitted has data specific to either the Event or /// Actor managers. This value is written to differentiate those parts of the /// payload. #[derive(Copy, Clone, Debug, PartialEq)] #[repr(u8)] pub enum ManagerType { /// An EventManager Event = 1, /// An ActorManager Actor = 2, ...
//! A windowing shell for Iced, on top of [`winit`]. //! //! ![`iced_winit` crate graph](https://github.com/hecrj/iced/blob/cae26cb7bc627f4a5b3bcf1cd023a0c552e8c65e/docs/graphs/winit.png?raw=true) //! //! `iced_winit` offers some convenient abstractions on top of [`iced_native`] //! to quickstart development when using...
use ::cpu::exits::VcpuExit; use ::memory::MmapMemorySlot; pub trait Accelerator { fn init_vcpu(&mut self); fn memory_region_add(&self, mem: &MmapMemorySlot); fn vcpu_run(&mut self, vcpu_index: usize) -> VcpuExit; }
use assert_cmd::prelude::*; use predicates::prelude::*; use std::process::Command; #[test] fn run_with_defaults() -> Result<(), Box<dyn std::error::Error>> { Command::cargo_bin("lokisay") .expect("binary exists") .assert() .success() .stdout(predicate::str::contains("Meow!")); O...
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
// 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. //! This module contains methods for creating OpenID requests and interpreting //! responses. use crate::constants::USER_INFO_URI; use crate::error::{Auth...
#![feature(allocator_api)] // CHIP-8 EMU use crate::vm::Vm; use std::env; use minifb::{Window, WindowOptions}; mod vm; mod instruction; mod stack; mod opcode; mod register; mod display; mod keymap; fn main() { let args: Vec<String> = env::args().collect(); if args.len() <= 1 { panic!("Please pass a f...
// 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...
#![allow(dead_code)] use crate::base::dff::ClockState::{Tick, Tock}; use crate::base::logic::Word; use crate::base::{dff::Clock, logic::mux}; use crate::base::{dff::Dff, logic::bit}; #[derive(Debug, Copy, Clone)] pub struct Bit { dff: Dff, } impl Bit { pub fn new() -> Self { Self { dff: Dff::new() } ...
extern crate jpeg_decoder as jpeg; use jpeg::PixelFormat; use std::io::{BufReader, Read}; pub enum Error { Jpeg(jpeg::Error), FormatMismatch, MetricMismatch, } pub fn fuzz(data: impl Read) -> Result<f64, Error> { let required_width = 32; let required_height = 32; let mut decoder = jpeg::Decoder::new(Buf...
#![recursion_limit = "128"] use lazy_static::lazy_static; use regex::{Captures, Regex}; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{BufRead, BufReader, BufWriter, Write}; use std::str::FromStr; mod mapper; mod scanner; mod mod_line_scanner; use mod_line_scanner::*; mod mod_definition;...
use cpal::EventLoop; use cpal::{StreamData, UnknownTypeOutputBuffer}; fn main() { println!("Hello, world!"); let event_loop = EventLoop::new(); let device = cpal::default_output_device().expect("No output device available"); let mut supported_formats_range = device .supported_output_formats() ...
#![allow(dead_code)] use std::io; use std::io::prelude::*; mod evaluator; mod object; mod reader; fn main() -> io::Result<()> { const PROMPT: &str = "> "; loop { print!("{}", PROMPT); io::stdout().flush()?; let mut input = String::new(); io::stdin().read_line(&mut input)?; ...
// cargo run --bin zmq_reply #[macro_use] extern crate json; fn main() { let context = zmq::Context::new(); let responder = context.socket(zmq::REP).unwrap(); assert!(responder.bind("tcp://*:5555").is_ok()); let mut msg = zmq::Message::new(); loop { responder.recv(&mut msg, 0).unwrap(); ...
use crate::Error; pub fn register_app(app: super::Application) -> Result<(), Error> { use super::LaunchCommand; fn inner(app: super::Application) -> anyhow::Result<()> { use anyhow::Context as _; use winreg::{enums::HKEY_CURRENT_USER, RegKey}; let hkcu = RegKey::predef(HKEY_CURRENT_US...
use async_trait::async_trait; use rbatis::core::db::DBExecResult; use rbatis::core::Result; use rbatis::crud::{CRUD, CRUDTable}; use rbatis::plugin::page::{IPageRequest, Page}; use rbatis::rbatis::Rbatis; use rbatis::wrapper::Wrapper; use serde::{de, Deserialize, Deserializer, Serializer}; use serde::de::Unexpected; p...
pub mod graphics; pub mod printer; mod scripting; pub use scripting::*;
use std::io::{Read, Result as IOResult}; use crate::PrimitiveRead; #[derive(Clone)] pub struct BoneWeight { pub weight: [f32; 3], pub bone: [i8; 3], pub bones_count: u8, } impl BoneWeight { pub fn read(read: &mut dyn Read) -> IOResult<Self> { let weight = [ read.read_f32()?, read.read_f32()?, read.read_f...
#[doc = "Reader of register DSI_VMCCR"] pub type R = crate::R<u32, super::DSI_VMCCR>; #[doc = "Reader of field `VMT`"] pub type VMT_R = crate::R<u8, u8>; #[doc = "Reader of field `LPVSAE`"] pub type LPVSAE_R = crate::R<bool, bool>; #[doc = "Reader of field `LPVBPE`"] pub type LPVBPE_R = crate::R<bool, bool>; #[doc = "R...
// #![feature(existential_type)] // #![feature(impl_trait_in_bindings)] //! A toolkit for the construction and use of hexagonal maps, //! e.g. in the context of game programming. pub mod geo; pub mod grid; pub mod ui; pub mod search;
use std::io::{stdin}; use num_derive::{FromPrimitive, ToPrimitive}; use num_traits::{FromPrimitive}; #[derive(FromPrimitive, ToPrimitive, Debug)] enum ParameterMode { Position = 0, Immediate = 1, } #[derive(FromPrimitive, Debug)] enum Opcode { Add = 1, Multiply = 2, Input = 3, Output = 4,...
use super::{PyDict, PyDictRef, PyList, PyStr, PyStrRef, PyType, PyTypeRef}; use crate::common::hash::PyHash; use crate::{ class::PyClassImpl, function::{Either, FuncArgs, PyArithmeticValue, PyComparisonValue, PySetterValue}, types::{Constructor, PyComparisonOp}, AsObject, Context, Py, PyObject, PyObject...
pub use super::client::*; pub use super::from_db::*; pub use super::operations::utils::{gen_cuid, KeyId, KeyKind}; pub use super::operations::*; pub use super::to_db::*; pub use googapis::google::datastore::v1::{Entity, Key};
#[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::CFG { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut W...
use std::borrow::Borrow; use std::fmt::Display; use std::ops::Deref; use ordered_float::OrderedFloat; use graph_lib::algo::trees::Trees; use mymcts::MyMcts; use policy::policy::Policy; use policy::score::Score; use policy::win_score::ExploreScore; use rust_tools::screen::layout::layout::L; use sim_result::SimResult; ...
use crate::image::Image; pub use crate::prelude::*; use crate::widget::Widget; use fltk_sys::table::*; use std::{ ffi::{CStr, CString}, mem, os::raw, }; /// Creates a table #[derive(WidgetExt, GroupExt, TableExt, Debug)] pub struct Table { _inner: *mut Fl_Table, _tracker: *mut fltk_sys::fl::Fl_Widg...
use eosio::{AccountName, ActionName, PermissionName}; use structopt::StructOpt; /// Set or update blockchain state #[derive(StructOpt, Debug)] pub enum Set { /// Create or update the code on an account Code(SetCode), /// Create or update the abi on an account Abi(SetAbi), /// Create or update the c...
use crate::db::{add_task, query_tasks, update_task, Pool}; use actix_web::{get, patch, post, web, HttpResponse, Responder}; use raskd::models::{Incoming, Outgoing, QueryParams}; #[post("/task")] async fn post_tasks(db: web::Data<Pool>, data: web::Json<Incoming>) -> impl Responder { let conn = db.clone().get().unwr...
// Copyright 2020. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
use anyhow::{anyhow, bail, ensure, Result}; use std::str::from_utf8; use std::str::FromStr; const MAX_CHARSTRING_LEN: usize = 255; pub struct StringBuffer<'a> { raw: &'a [u8], pos: usize, } impl<'a> StringBuffer<'a> { pub fn new(raw: &'a str) -> Self { debug_assert!(!raw.is_empty()); Str...
// 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...
use std::collections::HashMap; use {Capacity, Curviness, RoomNumber, Room, SquareFeet, View}; lazy_static! { static ref BOSTON_SIDE_ROOMS: Vec<RoomNumber<'static>> = vec![ r!(244, "C"), r!(244, "B"), r!(252), r!(321), r!(341), r!(344), r!(345), r!(371), r!(372), r!(373), r!(374), r!(375),...
use std::env; use serenity::{ async_trait, model::{channel::Message, gateway::Ready}, prelude::*, }; use tokio::signal::unix::{signal, SignalKind}; struct Handler; #[async_trait] impl EventHandler for Handler { async fn message(&self, ctx: Context, msg: Message) { if msg.content == "!ping" {...
mod buildings; mod bus_stops; mod half_map; mod initial; mod parking_blackholes; mod remove_disconnected; mod sidewalk_finder; mod turns; pub use self::buildings::make_all_buildings; pub use self::bus_stops::{make_bus_stops, verify_bus_routes}; pub use self::half_map::make_half_map; pub use self::initial::lane_specs::...
import driver.session; import front.ast; import std.map.hashmap; import std.option; import std.option.some; import std.option.none; import std._int; import util.common; type fn_id_of_local = std.map.hashmap[ast.def_id, ast.def_id]; type env = rec(option.t[ast.def_id] current_context, // fn or obj fn_id_...
use crate::cli; use crate::fs; #[cfg(test)] mod test; static DECK_SIZE: i64 = 119315717514047; #[allow(dead_code)] static ITR_COUNT: i64 = 101741582076661; pub fn run() { let ops = parse(); let rev_ops = invert_ops(&ops, 10007); let it = slam_shuffle(&ops, 10007, 2019); println!("{}", it); let i...
use std::fmt::Display; type NodeRef<T> = Option<Box<Node<T>>>; #[derive(Debug, Default)] struct Node<T> { value: T, left: NodeRef<T>, right: NodeRef<T>, } fn generate_tree(level: usize, counter: &mut i32) -> NodeRef<i32> { if level == 0 { return None } else { let mut node = Node ...
//! Tests on the command API use std::collections::HashMap; use commands::{self, ComMap}; // Commands for the commands tests pub fn command_map() -> ComMap { let mut map: ComMap = HashMap::new(); map.insert("command".to_string(), command); map.insert("panic_command".to_string(), panic_command); map }...
use std::net::{IpAddr, SocketAddr}; use std::ops::{Deref, DerefMut}; use ctrlc::set_handler; pub use simple_socket::PostServing; use n3_machine::HostMachine; use n3_net_protocol::{Request, Response, PORT}; pub type SocketServer = simple_socket::SocketServer<Request, Response>; pub(crate) trait Handle<H> where H...
pub mod columns; pub mod input; pub use columns::AddColumns; pub use input::InputStream; type Row = csv::StringRecord;
#[doc = "Reader of register OPTR"] pub type R = crate::R<u32, super::OPTR>; #[doc = "Writer for register OPTR"] pub type W = crate::W<u32, super::OPTR>; #[doc = "Register OPTR `reset()`'s with value 0xf000_0000"] impl crate::ResetValue for super::OPTR { type Type = u32; #[inline(always)] fn reset_value() ->...
mod day1; mod day2; mod day3; mod day4; mod day5; mod day6; mod day7; mod day8; mod day12; mod day16; mod day22; mod day24; mod utils; mod cartesian; mod math; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
// 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::convert::AsRef; use std::ffi::CString; use std::fs; use std::io; use std::os; use std::path::{Path, PathBuf}; use cfg_if::cfg_if; cfg_if! { if #[cfg(windows)] { use std::os::windows::io::AsRawHandle; } else { use std::os::unix::io::AsRawFd; } } pub use glob::{GlobError, Pattern, ...
/* I guess this problem was removed? */ pub fn bloom(data: &Vec<&str>, hashes: [fn(&[u8]) -> u64; 3], value: &str) -> bool { let mut bloom = [false; 20]; let mut val; for item in data.iter() { for hash in hashes.iter() { val = hash(item.as_bytes()) % 20; if val <= 20...
extern crate mio; pub mod impl_thread; pub mod impl_mio;
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn rint(x: f64) -> f64 { let one_over_e = 1.0 / f64::EPSILON; let as_u64: u64 = x.to_bits(); let exponent: u64 = as_u64 >> 52 & 0x7ff; let is_positive = (as_u64 >> 63) == 0; if exponent >= 0x3ff + 52 { x } else { let...
use proconio::input; fn solve(n: usize, takahashi: bool, a: &[usize], memo: &mut Vec<Vec<Option<usize>>>) -> usize { if n == 0 { return 0; } if let Some(ans) = memo[n][takahashi as usize] { return ans; } let mut result = 0; for &x in a { if x <= n { let s = s...
//! A simple gossip & broadcast primitive for best-effort metadata distribution //! between IOx nodes. //! //! # Peers //! //! Peers are uniquely identified by their self-reported "identity" UUID. A //! unique UUID is generated for each gossip instance, ensuring the identity //! changes across restarts of the underlyin...
use crate::actor::telegram_sender::{PushEventMsg, TbSenderActor}; use crate::model::PushEvent; use actix::Addr; use actix_web::{web, Error, HttpResponse}; use futures::Future; pub fn register_push_event( push_event: web::Json<PushEvent>, tb: web::Data<Addr<TbSenderActor>>, ) -> impl Future<Item = HttpResponse...
use super::*; #[test] fn without_found_errors_badarg() { with_process_arc(|arc_process| { let element = Atom::str_to_term("not_found"); let not_element = Atom::str_to_term("not_element"); let slice = &[not_element]; let tail = Atom::str_to_term("tail"); let list = arc_proces...
use crate::action::{Action, ActionHandled}; use crate::game_event::{GameEvent, GameEventType}; use crate::room::{closed_message, enter_room, RoomType}; use crate::sound::{AudioEvent, Effect}; use crate::timer::TimerType; use crate::App; use crate::room; // Handle game actions here (Timers). pub fn handle_action(mut ap...
#![allow(unused_imports)] #![allow(dead_code)] use gtk; use gtk::{BuilderExt, EventBoxExt, ImageExt}; use model::Model; /* * Room row widget for the room sidebar. * Shows the avatar, title and the number of unread messages. * +-----+----------------------+-----+ * |Image| Room Title | 3 | * +-----+------...
use crate::{error, types}; use faccess::{AccessMode, PathExt}; use snafu::ResultExt; use std::path::{Path, PathBuf}; pub fn check_working_dir(config: &types::Config) -> error::Result<()> { let path = Path::new(&config.working_dir); check_writeable(&path)?; Ok(()) } pub fn check_pid_file(config: &types::Co...
use crate::error::ApiError; use actix_web::{get, web, HttpResponse}; mod auth; mod middleware; #[macro_export] macro_rules! dump { ($e:expr) => { if cfg!(debug_assertions) { dbg!($e) } else { $e } }; } #[get("/ping")] async fn hello() -> Result<HttpResponse, Api...
// Copyright 2021 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
use serde::{Deserialize, Serialize}; use std::fmt::Debug; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Position { pub x: f32, pub y: f32, pub z: f32, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct DroneDefinedEvent { pub id: String, pub ssid: String, pub ip: String,...
#![allow(clippy::all)] fn parse_command(command: &str) -> (&str, i64) { let mut c = command.split_whitespace(); let c_name = c .next() .unwrap_or_else(|| panic!("Command missing first part: {}", command)); let c_value = c .next() .unwrap_or_else(|| panic!("Command missing se...
#[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::LDODPCTL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R,...
// // line_shape2.rs // Copyright (C) 2019 Malcolm Ramsay <malramsay64@gmail.com> // Distributed under terms of the MIT license. // use std::f64::consts::PI; use std::fmt; use std::slice; use std::vec; use anyhow::{bail, Error}; use itertools::{iproduct, Itertools}; use nalgebra::{distance, Point2}; use serde::{Deser...
pub mod app; pub mod camera; pub mod ecs; pub mod input; pub mod pass; pub mod pipeline; pub mod tech;
use crate::bssrdf::BSSRDF; use crate::geometry::vector::cross; use crate::geometry::vector::dot; use crate::geometry::vector::face_forward; use crate::geometry::vector::Cross; use crate::medium::Medium; use crate::medium::MediumInterface; use crate::primitive::Primitive; use crate::ray::offset_ray_origin; use crate::ra...
use std::prelude::v1::*; use std::fmt; use std::path::{Path, PathBuf}; use {trace, resolve, SymbolName}; use types::c_void; /// Representation of an owned and self-contained backtrace. /// /// This structure can be used to capture a backtrace at various points in a /// program and later used to inspect what the backt...
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
// 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...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - EXTI rising trigger selection register"] pub rtsr1: RTSR1, #[doc = "0x04 - EXTI falling trigger selection register"] pub ftsr1: FTSR1, #[doc = "0x08 - EXTI software interrupt event register"] pub swier1: SWIER1, ...
use std::env; use std::error::Error; use std::fs; use std::str; pub fn pattern_matches(text: &[u8], pattern: &str) -> Vec<usize> { text.windows(pattern.len()) .enumerate() .filter_map(|(i, x)| { if str::from_utf8(x).unwrap() == pattern { Some(i) } else { ...
use crate::utils; use std::io::{Read, Result, Write}; pub trait Stream: Read + Write {} impl<T> Stream for T where T: Read + Write {} struct StreamParser<'a, T: Read> { stream: &'a mut T, buffer: Vec<u8>, } struct StreamWriter<'a, T: Write> { stream: &'a mut T, } const CRLF: &[u8] = b"\r\n"; impl<'a, T...
use std::{sync::RwLock, collections::HashMap}; use crossbeam_channel::Sender; use smallvec::SmallVec; pub struct Command { cmd: String, args: SmallVec::<[String; 4]> } pub struct Console { msgs: RwLock<HashMap<String, Sender<Command>>> } impl Console { pub fn new() -> Self { Self { msgs: RwLock::new(Has...
use std::borrow::Cow; use indexmap::IndexMap; use serde::de::DeserializeOwned; use crate::{Error, Name, Result, Value}; /// A value accessor pub struct ValueAccessor<'a>(&'a Value); impl<'a> ValueAccessor<'a> { /// Returns `true` if the value is null, otherwise returns `false` #[inline] pub fn is_null(&...
// 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::account::Account; use crate::pubkey::Pubkey; const NATIVE_LOADER_PROGRAM_ID: [u8; 32] = [ 5, 135, 132, 191, 20, 139, 164, 40, 47, 176, 18, 87, 72, 136, 169, 241, 83, 160, 125, 173, 247, 101, 192, 69, 92, 154, 151, 3, 128, 0, 0, 0, ]; pub fn id() -> Pubkey { Pubkey::new(&NATIVE_LOADER_PROGRAM_ID...
mod api; use crate::lttp::AppState; use axum::{ extract::Path, http::{ header::{ HeaderValue, CONTENT_LENGTH, CONTENT_TYPE, }, status::StatusCode, HeaderMap, }, response::{ IntoResponse, Redirect, Response, ...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate argparse; extern crate js; extern crate libc; extern crate linenoise; use std::cell::RefCell; use st...
#![allow(warnings)] use rand::prelude::StdRng; use rand::SeedableRng; use spacegame::core::noise::perlin::{make_permutation, perlin2d, Perlin}; fn main() { let imgx = 2048; let imgy = 2048; let nb_blocks = [64, 64]; let block_size = [32u32; 32]; let image_size = [block_size[0] * nb_blocks[0], block...
#![forbid(unsafe_code)] use actix_web::{middleware, post, web, App, HttpRequest, HttpResponse, HttpServer}; use env_logger::Env; use log::warn; use serde::{Deserialize, Serialize}; use structopt::StructOpt; use pop::notification::Notification; #[derive(StructOpt)] #[structopt(about, author)] struct Opts { /// Pu...
use super::interface::DisplayInterface; const REMAP_BASE: u8 = 0b00100100; pub enum Command { /// Column address Column(u8,u8), /// Row address Row(u8,u8), /// CommandLock CommandLock(u8), /// DisplayOn DisplayOn(bool), /// WriteRam WriteRam, /// ClockDiv ClockDiv(u8), ...