Addings lints to the codebase

Original commit: cf45cd64ac
This commit is contained in:
Danilo Guanabara 2020-01-28 23:25:22 -03:00 committed by GitHub
parent d068dfb829
commit ebfc075938
63 changed files with 221 additions and 83 deletions

View File

@ -4,7 +4,9 @@
#![feature(specialization)] #![feature(specialization)]
#![allow(missing_docs)] #![allow(missing_docs)]
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
use basegl_prelude::*; use basegl_prelude::*;
use std::fmt::Write; use std::fmt::Write;

View File

@ -1,4 +1,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
use basegl_prelude::*; use basegl_prelude::*;
use basegl_prelude::fmt::{Formatter, Error}; use basegl_prelude::fmt::{Formatter, Error};

View File

@ -48,6 +48,7 @@ impl EmscriptenRepresentation for f64 {
// ======================= // =======================
/// View of array in `msdfgen` library memory /// View of array in `msdfgen` library memory
#[derive(Debug)]
pub struct ArrayMemoryView<F : EmscriptenRepresentation> { pub struct ArrayMemoryView<F : EmscriptenRepresentation> {
begin_address : usize, begin_address : usize,
end_address : usize, end_address : usize,
@ -58,6 +59,7 @@ pub struct ArrayMemoryView<F : EmscriptenRepresentation> {
/// ///
/// It cannot outlives view from which was created, because one might expect, that data may be freed /// It cannot outlives view from which was created, because one might expect, that data may be freed
/// by library once view is destroyed /// by library once view is destroyed
#[derive(Clone,Copy,Debug)]
pub struct ArrayMemoryViewIterator<'a, F : EmscriptenRepresentation> { pub struct ArrayMemoryViewIterator<'a, F : EmscriptenRepresentation> {
next_read_address : usize, next_read_address : usize,
end_address : usize, end_address : usize,

View File

@ -1,3 +1,5 @@
#![allow(unsafe_code)]
use wasm_bindgen::prelude::wasm_bindgen; use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::JsValue; use wasm_bindgen::JsValue;

View File

@ -1,4 +1,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
mod internal; mod internal;
pub mod emscripten_data; pub mod emscripten_data;
@ -87,6 +90,7 @@ impl Drop for Font {
/// ///
/// The structure gathering MSDF generation parameters meant to be same for all /// The structure gathering MSDF generation parameters meant to be same for all
/// rendered glyphs /// rendered glyphs
#[derive(Clone,Copy,Debug)]
pub struct MsdfParameters { pub struct MsdfParameters {
pub width : usize, pub width : usize,
pub height : usize, pub height : usize,
@ -97,6 +101,7 @@ pub struct MsdfParameters {
pub overlap_support : bool pub overlap_support : bool
} }
#[derive(Debug)]
pub struct MultichannelSignedDistanceField { pub struct MultichannelSignedDistanceField {
handle : JsValue, handle : JsValue,
pub advance : f64, pub advance : f64,

View File

@ -4,6 +4,7 @@ use std::future::Future;
use crate::{ is_emscripten_runtime_initialized, run_once_initialized }; use crate::{ is_emscripten_runtime_initialized, run_once_initialized };
/// The future for running test after initialization /// The future for running test after initialization
#[derive(Debug)]
pub struct TestAfterInit<F:Fn()> { pub struct TestAfterInit<F:Fn()> {
test : F test : F
} }

View File

@ -43,6 +43,7 @@ impl AnimatorData {
/// This struct which runs a callback once per frame with a time difference from the last frame /// This struct which runs a callback once per frame with a time difference from the last frame
/// as its input. /// as its input.
#[derive(Debug)]
pub struct Animator { pub struct Animator {
_continuous_animator: ContinuousAnimator _continuous_animator: ContinuousAnimator
} }

View File

@ -1,6 +1,8 @@
//! This module implements `ContinuousAnimator`, an object used to run a callback with a continuous //! This module implements `ContinuousAnimator`, an object used to run a callback with a continuous
//! time in milliseconds as its input. It can be used to implement a playback mechanism. //! time in milliseconds as its input. It can be used to implement a playback mechanism.
use crate::prelude::*;
use crate::control::EventLoop; use crate::control::EventLoop;
use crate::control::callback::CallbackHandle; use crate::control::callback::CallbackHandle;
use super::AnimationCallback; use super::AnimationCallback;
@ -13,7 +15,10 @@ use std::cell::RefCell;
// === ContinuousTimeAnimatorProperties === // === ContinuousTimeAnimatorProperties ===
// ======================================== // ========================================
#[derive(Derivative)]
#[derivative(Debug)]
struct ContinuousTimeAnimatorProperties { struct ContinuousTimeAnimatorProperties {
#[derivative(Debug="ignore")]
callback : Box<dyn AnimationCallback>, callback : Box<dyn AnimationCallback>,
relative_start_ms : f64, relative_start_ms : f64,
absolute_start_ms : Option<f64>, absolute_start_ms : Option<f64>,
@ -26,6 +31,7 @@ struct ContinuousTimeAnimatorProperties {
// === ContinuousTimeAnimatorData === // === ContinuousTimeAnimatorData ===
// ================================== // ==================================
#[derive(Debug)]
struct ContinuousAnimatorData { struct ContinuousAnimatorData {
properties : RefCell<ContinuousTimeAnimatorProperties> properties : RefCell<ContinuousTimeAnimatorProperties>
} }
@ -96,6 +102,7 @@ impl ContinuousAnimatorData {
/// `ContinuousAnimator` calls `AnimationCallback` with the playback time in millisecond as its /// `ContinuousAnimator` calls `AnimationCallback` with the playback time in millisecond as its
/// input once per frame. /// input once per frame.
#[derive(Debug)]
pub struct ContinuousAnimator { pub struct ContinuousAnimator {
data : Rc<ContinuousAnimatorData>, data : Rc<ContinuousAnimatorData>,
event_loop : EventLoop event_loop : EventLoop

View File

@ -25,10 +25,11 @@ pub trait EasingAnimationCallback<T> = FnMut(T) + 'static;
// === EasingAnimatorData === // === EasingAnimatorData ===
// ========================== // ==========================
#[derive(Debug)]
struct EasingAnimatorData<T:Interpolable<T>> { struct EasingAnimatorData<T:Interpolable<T>> {
initial_value : T, initial_value : T,
final_value : T, final_value : T,
duration_ms: f64, duration_ms : f64,
continuous_animator : Option<ContinuousAnimator> continuous_animator : Option<ContinuousAnimator>
} }
@ -42,6 +43,7 @@ struct EasingAnimatorData<T:Interpolable<T>> {
pub trait InterpolableArgument<T:Copy> = Interpolable<T> + 'static; pub trait InterpolableArgument<T:Copy> = Interpolable<T> + 'static;
/// This struct animates from `origin_position` to `target_position` using easing functions. /// This struct animates from `origin_position` to `target_position` using easing functions.
#[derive(Debug)]
pub struct EasingAnimator<T:Interpolable<T>> { pub struct EasingAnimator<T:Interpolable<T>> {
data : Rc<RefCell<EasingAnimatorData<T>>> data : Rc<RefCell<EasingAnimatorData<T>>>
} }

View File

@ -14,7 +14,7 @@ use nalgebra::zero;
// ======================= // =======================
/// This struct counts the intervals in a time period. /// This struct counts the intervals in a time period.
#[derive(Debug)] #[derive(Clone,Copy,Debug)]
pub struct IntervalCounter { pub struct IntervalCounter {
/// Interval duration. /// Interval duration.
pub interval_duration : f64, pub interval_duration : f64,
@ -72,6 +72,7 @@ impl FixedStepAnimatorData {
/// (AnimationCallback(delta_ms)) will be 1000ms. But keep in mind that if the actual frame /// (AnimationCallback(delta_ms)) will be 1000ms. But keep in mind that if the actual frame
/// takes longer, say 2000ms, AnimationCallback will be called twice in the same moment, but /// takes longer, say 2000ms, AnimationCallback will be called twice in the same moment, but
/// its delta_ms parameter will always be fixed to 1 second. /// its delta_ms parameter will always be fixed to 1 second.
#[derive(Debug)]
pub struct FixedStepAnimator { pub struct FixedStepAnimator {
_animator: Animator _animator: Animator
} }

View File

@ -30,7 +30,7 @@ pub trait PhysicsForce {
// ====================== // ======================
/// This structure contains air dragging properties. /// This structure contains air dragging properties.
#[derive(Default, Clone, Copy)] #[derive(Default,Clone,Copy,Debug)]
pub struct DragProperties { pub struct DragProperties {
/// Drag`s coefficient. /// Drag`s coefficient.
pub coefficient: f32 pub coefficient: f32
@ -175,6 +175,7 @@ impl KinematicsProperties {
// === PhysicsPropertiesData === // === PhysicsPropertiesData ===
// ============================= // =============================
#[derive(Debug)]
struct PhysicsPropertiesData { struct PhysicsPropertiesData {
kinematics : KinematicsProperties, kinematics : KinematicsProperties,
spring : SpringProperties, spring : SpringProperties,
@ -195,7 +196,7 @@ impl PhysicsPropertiesData {
// ========================= // =========================
/// A structure including kinematics, drag and spring properties. /// A structure including kinematics, drag and spring properties.
#[derive(Clone)] #[derive(Clone,Debug)]
pub struct PhysicsProperties { pub struct PhysicsProperties {
data : Rc<RefCell<PhysicsPropertiesData>> data : Rc<RefCell<PhysicsPropertiesData>>
} }
@ -272,6 +273,7 @@ impl PhysicsProperties {
pub trait PhysicsCallback = FnMut(Vector3<f32>) + 'static; pub trait PhysicsCallback = FnMut(Vector3<f32>) + 'static;
/// A fixed step physics simulator used to simulate `PhysicsProperties`. /// A fixed step physics simulator used to simulate `PhysicsProperties`.
#[derive(Debug)]
pub struct PhysicsSimulator { pub struct PhysicsSimulator {
_animator : Animator _animator : Animator
} }

View File

@ -48,8 +48,7 @@ pub type XCallbackMut1<T> = Box<dyn XCallbackMut1Fn<T>>;
// ====================== // ======================
/// Handle to a callback. When the handle is dropped, the callback is removed. /// Handle to a callback. When the handle is dropped, the callback is removed.
#[derive(Derivative)] #[derive(Debug,Default)]
#[derivative(Debug, Default)]
pub struct CallbackHandle { pub struct CallbackHandle {
rc: Rc<()> rc: Rc<()>
} }
@ -75,6 +74,7 @@ impl CallbackHandle {
} }
/// CallbackHandle's guard. Used to check if the handle is still valid. /// CallbackHandle's guard. Used to check if the handle is still valid.
#[derive(Debug)]
pub struct Guard { pub struct Guard {
weak: Weak<()> weak: Weak<()>
} }

View File

@ -34,8 +34,7 @@ pub trait EventLoopCallback = FnMut(f64) + 'static;
/// removed as soon as the handle is dropped. You can also use the `forget` /// removed as soon as the handle is dropped. You can also use the `forget`
/// method on the handle to make the callback registered forever, but beware /// method on the handle to make the callback registered forever, but beware
/// that it can easily lead to memory leaks. /// that it can easily lead to memory leaks.
#[derive(Derivative)] #[derive(Debug,Default,Clone)]
#[derivative(Debug, Default, Clone)]
pub struct EventLoop { pub struct EventLoop {
rc: Rc<RefCell<EventLoopData>>, rc: Rc<RefCell<EventLoopData>>,
} }

View File

@ -1,6 +1,8 @@
//! This module contains the `MouseManager` implementation, its associated structs such as //! This module contains the `MouseManager` implementation, its associated structs such as
//! `MousePositionEvent`, `MouseClickEvent` and `MouseWheelEvent`. //! `MousePositionEvent`, `MouseClickEvent` and `MouseWheelEvent`.
use crate::prelude::*;
pub mod event; pub mod event;
pub mod button; pub mod button;
@ -28,6 +30,7 @@ use std::cell::RefCell;
// ===================== // =====================
/// This struct keeps the register of the event listener and unregisters it when it's dropped. /// This struct keeps the register of the event listener and unregisters it when it's dropped.
#[derive(Debug)]
pub struct EventListener<T:?Sized> { pub struct EventListener<T:?Sized> {
target : EventTarget, target : EventTarget,
name : String, name : String,
@ -69,19 +72,9 @@ pub type WheelEventListener = EventListener<dyn FnMut(WheelEvent)>;
// FIXME: this does not handle all buttons (js defines 5 buttons) and assumes mouses for // FIXME: this does not handle all buttons (js defines 5 buttons) and assumes mouses for
// FIXME: right hand people. // FIXME: right hand people.
/// An enumeration representing the mouse buttons. /// An enumeration representing the mouse buttons.
pub enum MouseButton { #[derive(Clone,Copy,Debug)]
/// Left mouse button. #[allow(missing_docs)]
LEFT, pub enum MouseButton {LEFT,MIDDLE,RIGHT,UNKNOWN}
/// Middle mouse button.
MIDDLE,
/// Right mouse button.
RIGHT,
/// For unknown mouse buttons IDs.
UNKNOWN
}
@ -94,6 +87,7 @@ pub trait MouseClickCallback = FnMut(MouseClickEvent) + 'static;
// FIXME: "click" means mouse down and then up. This is misleading. // FIXME: "click" means mouse down and then up. This is misleading.
/// A struct storing information about mouse down and mouse up events. /// A struct storing information about mouse down and mouse up events.
#[derive(Clone,Copy,Debug)]
pub struct MouseClickEvent { pub struct MouseClickEvent {
/// The position where the MouseClickEvent occurred. /// The position where the MouseClickEvent occurred.
pub position : Vector2<f32>, pub position : Vector2<f32>,
@ -131,6 +125,7 @@ impl MouseClickEvent {
pub trait MousePositionCallback = FnMut(MousePositionEvent) + 'static; pub trait MousePositionCallback = FnMut(MousePositionEvent) + 'static;
/// A struct storing information about mouse move, mouse enter and mouse leave events. /// A struct storing information about mouse move, mouse enter and mouse leave events.
#[derive(Clone,Copy,Debug)]
pub struct MousePositionEvent { pub struct MousePositionEvent {
/// The previous position where the mouse was. /// The previous position where the mouse was.
pub previous_position : Vector2<f32>, pub previous_position : Vector2<f32>,
@ -163,6 +158,7 @@ impl MousePositionEvent {
pub trait MouseWheelCallback = FnMut(MouseWheelEvent) + 'static; pub trait MouseWheelCallback = FnMut(MouseWheelEvent) + 'static;
/// A struct storing information about mouse wheel events. /// A struct storing information about mouse wheel events.
#[derive(Clone,Copy,Debug)]
pub struct MouseWheelEvent { pub struct MouseWheelEvent {
/// A boolean indicating if the keyboard ctrl button is pressed. /// A boolean indicating if the keyboard ctrl button is pressed.
pub is_ctrl_pressed : bool, pub is_ctrl_pressed : bool,
@ -193,10 +189,13 @@ impl MouseWheelEvent {
// === MouseManagerProperties === // === MouseManagerProperties ===
// ============================== // ==============================
#[derive(Derivative)]
#[derivative(Debug)]
struct MouseManagerProperties { struct MouseManagerProperties {
dom : DomContainer, dom : DomContainer,
mouse_position : Option<Vector2<f32>>, mouse_position : Option<Vector2<f32>>,
target : EventTarget, target : EventTarget,
#[derivative(Debug="ignore")]
stop_tracking_listener : Option<MouseEventListener> stop_tracking_listener : Option<MouseEventListener>
} }
@ -207,8 +206,8 @@ struct MouseManagerProperties {
// ======================== // ========================
/// A struct used for storing shared MouseManager's mutable data. /// A struct used for storing shared MouseManager's mutable data.
#[derive(Debug)]
struct MouseManagerData { struct MouseManagerData {
// FIXME: naked refcell
properties : RefCell<MouseManagerProperties> properties : RefCell<MouseManagerProperties>
} }
@ -299,6 +298,7 @@ macro_rules! add_callback {
// ==================== // ====================
/// This structs manages mouse events in a specified DOM object. /// This structs manages mouse events in a specified DOM object.
#[derive(Debug)]
pub struct MouseManager { pub struct MouseManager {
data : Rc<MouseManagerData> data : Rc<MouseManagerData>
} }

View File

@ -25,6 +25,7 @@ pub trait AddMut<T> {
/// The item type is `(Option<T>, T)` where the second tuple element is /// The item type is `(Option<T>, T)` where the second tuple element is
/// a current value and first element is a previous one `None` on the first /// a current value and first element is a previous one `None` on the first
/// iteration. /// iteration.
#[derive(Debug)]
pub struct CachingIterator<T:Clone, It:Iterator<Item=T>> { pub struct CachingIterator<T:Clone, It:Iterator<Item=T>> {
last : Option<T>, last : Option<T>,
iter : It iter : It

View File

@ -311,7 +311,7 @@ pub type Bool <OnMut=()> = DirtyFlag <BoolData,OnMut>;
pub type SharedBool <OnMut=()> = SharedDirtyFlag <BoolData,OnMut>; pub type SharedBool <OnMut=()> = SharedDirtyFlag <BoolData,OnMut>;
pub trait BoolCtx <OnMut> = where OnMut:Function0; pub trait BoolCtx <OnMut> = where OnMut:Function0;
#[derive(Debug,Display,Default)] #[derive(Clone,Copy,Debug,Display,Default)]
pub struct BoolData { is_dirty: bool } pub struct BoolData { is_dirty: bool }
impl HasCheckAll for BoolData { fn check_all (&self) -> bool { self.is_dirty } } impl HasCheckAll for BoolData { fn check_all (&self) -> bool { self.is_dirty } }
impl HasUnsetAll for BoolData { fn unset_all (&mut self) { self.is_dirty = false } } impl HasUnsetAll for BoolData { fn unset_all (&mut self) { self.is_dirty = false } }

View File

@ -43,7 +43,7 @@ fn performance() -> Performance {
// ============== // ==============
/// Look and feel configuration for the performance monitor. /// Look and feel configuration for the performance monitor.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub struct ConfigTemplate<Str,Num> { pub struct ConfigTemplate<Str,Num> {
pub background_color : Str, pub background_color : Str,
@ -585,7 +585,7 @@ impl PanelData {
// ================= // =================
/// Sampler measuring the time for a given operation. /// Sampler measuring the time for a given operation.
#[derive(Debug,Default)] #[derive(Clone,Copy,Debug,Default)]
pub struct FrameTime { pub struct FrameTime {
begin_time : f64, begin_time : f64,
value : f64, value : f64,
@ -620,7 +620,7 @@ impl Sampler for FrameTime {
// =========== // ===========
/// Sampler measuring the frames per second count for a given operation. /// Sampler measuring the frames per second count for a given operation.
#[derive(Debug,Default)] #[derive(Clone,Copy,Debug,Default)]
pub struct Fps { pub struct Fps {
begin_time : f64, begin_time : f64,
value : f64, value : f64,
@ -657,7 +657,7 @@ impl Sampler for Fps {
// ================== // ==================
/// Sampler measuring the memory usage of the WebAssembly part of the program. /// Sampler measuring the memory usage of the WebAssembly part of the program.
#[derive(Debug,Default)] #[derive(Clone,Copy,Debug,Default)]
pub struct WasmMemory { pub struct WasmMemory {
value : f64, value : f64,
value_check : ValueCheck, value_check : ValueCheck,

View File

@ -14,7 +14,7 @@ use crate::data::dirty::traits::*;
// ================= // =================
/// Camera alignment. It describes where the origin of the camera should be aligned to. /// Camera alignment. It describes where the origin of the camera should be aligned to.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub struct Alignment { pub struct Alignment {
/// Horizontal alignment. /// Horizontal alignment.
pub horizontal : HorizontalAlignment, pub horizontal : HorizontalAlignment,
@ -24,12 +24,12 @@ pub struct Alignment {
} }
/// Horizontal alignments. /// Horizontal alignments.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum HorizontalAlignment {Left,Center,Right} pub enum HorizontalAlignment {Left,Center,Right}
/// Vertical alignments. /// Vertical alignments.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum VerticalAlignment {Top,Center,Bottom} pub enum VerticalAlignment {Top,Center,Bottom}
@ -50,7 +50,7 @@ impl Default for Alignment {
// ============== // ==============
/// Camera's frustum screen dimensions. /// Camera's frustum screen dimensions.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub struct Screen { pub struct Screen {
/// Screen's width. /// Screen's width.
pub width : f32, pub width : f32,
@ -66,7 +66,7 @@ impl Screen {
} }
/// Gets Screen's aspect ratio. /// Gets Screen's aspect ratio.
pub fn aspect(&self) -> f32 { pub fn aspect(self) -> f32 {
self.width / self.height self.width / self.height
} }
} }
@ -78,7 +78,7 @@ impl Screen {
// ================== // ==================
/// Camera's projection type. /// Camera's projection type.
#[derive(Clone,Debug,Copy)] #[derive(Clone,Copy,Debug)]
pub enum Projection { pub enum Projection {
/// Perspective projection. /// Perspective projection.
Perspective { Perspective {
@ -103,7 +103,7 @@ impl Default for Projection {
// ================ // ================
/// Camera's frustum clipping range. /// Camera's frustum clipping range.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub struct Clipping { pub struct Clipping {
/// Near clipping limit. /// Near clipping limit.
pub near : f32, pub near : f32,
@ -373,12 +373,12 @@ impl Camera2d {
impl Camera2d { impl Camera2d {
/// Gets `Clipping`. /// Gets `Clipping`.
pub fn clipping(&self) -> Clipping { pub fn clipping(&self) -> Clipping {
self.rc.borrow().clipping.clone() self.rc.borrow().clipping
} }
/// Gets `Screen`. /// Gets `Screen`.
pub fn screen(&self) -> Screen { pub fn screen(&self) -> Screen {
self.rc.borrow().screen.clone() self.rc.borrow().screen
} }
/// Gets zoom. /// Gets zoom.

View File

@ -24,6 +24,7 @@ use nalgebra::clamp;
// ================= // =================
/// Navigator enables camera navigation with mouse interactions. /// Navigator enables camera navigation with mouse interactions.
#[derive(Debug)]
pub struct Navigator { pub struct Navigator {
_events : NavigatorEvents, _events : NavigatorEvents,
_simulator : PhysicsSimulator, _simulator : PhysicsSimulator,

View File

@ -1,3 +1,5 @@
use crate::prelude::*;
use crate::control::io::mouse::MouseManager; use crate::control::io::mouse::MouseManager;
use crate::control::io::mouse::MouseClickEvent; use crate::control::io::mouse::MouseClickEvent;
use crate::control::io::mouse::MouseWheelEvent; use crate::control::io::mouse::MouseWheelEvent;
@ -78,7 +80,7 @@ impl PanEvent {
// === MovementType === // === MovementType ===
// ==================== // ====================
#[derive(PartialEq, Clone, Copy)] #[derive(PartialEq,Clone,Copy,Debug)]
enum MovementType { enum MovementType {
Pan, Pan,
Zoom { focus : Vector2<f32> } Zoom { focus : Vector2<f32> }
@ -90,10 +92,14 @@ enum MovementType {
// === NavigatorEventsProperties === // === NavigatorEventsProperties ===
// ================================= // =================================
#[derive(Derivative)]
#[derivative(Debug)]
struct NavigatorEventsProperties { struct NavigatorEventsProperties {
movement_type : Option<MovementType>, movement_type : Option<MovementType>,
mouse_position : Vector2<f32>, mouse_position : Vector2<f32>,
#[derivative(Debug="ignore")]
pan_callback : Box<dyn FnPanEvent>, pan_callback : Box<dyn FnPanEvent>,
#[derivative(Debug="ignore")]
zoom_callback : Box<dyn FnZoomEvent>, zoom_callback : Box<dyn FnZoomEvent>,
zoom_speed : f32 zoom_speed : f32
} }
@ -104,6 +110,7 @@ struct NavigatorEventsProperties {
// === NavigatorEventsData === // === NavigatorEventsData ===
// =========================== // ===========================
#[derive(Debug)]
struct NavigatorEventsData { struct NavigatorEventsData {
properties : RefCell<NavigatorEventsProperties> properties : RefCell<NavigatorEventsProperties>
} }
@ -171,14 +178,22 @@ impl NavigatorEventsData {
// ======================= // =======================
/// Struct used to handle pan and zoom events from mouse interactions. /// Struct used to handle pan and zoom events from mouse interactions.
#[derive(Derivative)]
#[derivative(Debug)]
pub struct NavigatorEvents { pub struct NavigatorEvents {
data : Rc<NavigatorEventsData>, data : Rc<NavigatorEventsData>,
mouse_manager : MouseManager, mouse_manager : MouseManager,
#[derivative(Debug="ignore")]
mouse_down : Option<MouseEventListener>, mouse_down : Option<MouseEventListener>,
#[derivative(Debug="ignore")]
mouse_move : Option<MouseEventListener>, mouse_move : Option<MouseEventListener>,
#[derivative(Debug="ignore")]
mouse_up : Option<MouseEventListener>, mouse_up : Option<MouseEventListener>,
#[derivative(Debug="ignore")]
mouse_leave : Option<MouseEventListener>, mouse_leave : Option<MouseEventListener>,
#[derivative(Debug="ignore")]
disable_context_menu : Option<MouseEventListener>, disable_context_menu : Option<MouseEventListener>,
#[derivative(Debug="ignore")]
wheel_zoom : Option<WheelEventListener> wheel_zoom : Option<WheelEventListener>
} }

View File

@ -19,7 +19,7 @@ use crate::data::dirty::traits::*;
/// Defines the order in which particular axis coordinates are processed. Used for example to define /// Defines the order in which particular axis coordinates are processed. Used for example to define
/// the rotation order in `DisplayObject`. /// the rotation order in `DisplayObject`.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub enum AxisOrder {XYZ,XZY,YXZ,YZX,ZXY,ZYX} pub enum AxisOrder {XYZ,XZY,YXZ,YZX,ZXY,ZYX}
impl Default for AxisOrder { impl Default for AxisOrder {
@ -34,7 +34,7 @@ impl Default for AxisOrder {
/// Defines the order in which transformations (scale, rotate, translate) are applied to a /// Defines the order in which transformations (scale, rotate, translate) are applied to a
/// particular object. /// particular object.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub enum TransformOrder { pub enum TransformOrder {
ScaleRotateTranslate, ScaleRotateTranslate,
ScaleTranslateRotate, ScaleTranslateRotate,
@ -58,7 +58,7 @@ impl Default for TransformOrder {
/// You can use methods like `matrix` to get a combined transformation matrix. Bear in mind that /// You can use methods like `matrix` to get a combined transformation matrix. Bear in mind that
/// the matrix will always be recomputed from scratch. This structure does not contain any caching /// the matrix will always be recomputed from scratch. This structure does not contain any caching
/// mechanisms. /// mechanisms.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub struct Transform { pub struct Transform {
pub position : Vector3<f32>, pub position : Vector3<f32>,
pub scale : Vector3<f32>, pub scale : Vector3<f32>,

View File

@ -48,6 +48,7 @@ impl<Pass:RenderPass> Add<Pass> for RenderPipeline {
/// An output definition of a render pass. The output describes a format of framebuffer attachment, /// An output definition of a render pass. The output describes a format of framebuffer attachment,
/// which will be the result of running the current pass. /// which will be the result of running the current pass.
#[derive(Debug)]
pub struct RenderPassOutput { pub struct RenderPassOutput {
/// Name of the pass. /// Name of the pass.
pub name : String, pub name : String,

View File

@ -73,7 +73,7 @@ impl Shape {
pub fn screen_shape(&self) -> ShapeData { pub fn screen_shape(&self) -> ShapeData {
self.rc.borrow().clone() *self.rc.borrow()
} }
pub fn canvas_shape(&self) -> ShapeData { pub fn canvas_shape(&self) -> ShapeData {
@ -97,7 +97,7 @@ impl CloneRef for Shape {}
// === ShapeData === // === ShapeData ===
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub struct ShapeData { pub struct ShapeData {
pub width : f32, pub width : f32,
pub height : f32, pub height : f32,

View File

@ -79,6 +79,7 @@ macro_rules! _define_compound_shape_data {
/// Shape type definition. /// Shape type definition.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Debug)]
pub struct $name<$($shape_field),*> { pub struct $name<$($shape_field),*> {
$(pub $shape_field : $shape_field),*, $(pub $shape_field : $shape_field),*,
$(pub $field : Glsl),* $(pub $field : Glsl),*

View File

@ -27,6 +27,7 @@ const FRAGMENT_RUNNER :&str = include_str!("../glsl/fragment_runner.glsl");
// TODO: Consider removing this struct and moving the utils to functions. // TODO: Consider removing this struct and moving the utils to functions.
/// GLSL code builder. /// GLSL code builder.
#[derive(Clone,Copy,Debug)]
pub struct Builder {} pub struct Builder {}
impl Builder { impl Builder {

View File

@ -8,8 +8,10 @@ use wasm_bindgen::prelude::*;
extern "C" { extern "C" {
/// Returns GLSL code which redirects mangled function names to their original primitive /// Returns GLSL code which redirects mangled function names to their original primitive
/// definitions. /// definitions.
#[allow(unsafe_code)]
pub fn builtin_redirections() -> String; pub fn builtin_redirections() -> String;
/// Mangles the provided GLSL code to allow primitive definitions overloading. /// Mangles the provided GLSL code to allow primitive definitions overloading.
#[allow(unsafe_code)]
pub fn allow_overloading(s:&str) -> String; pub fn allow_overloading(s:&str) -> String;
} }

View File

@ -139,7 +139,7 @@ impl TextComponent {
pub fn navigate_cursors(&mut self, step:Step, selecting:bool, fonts:&mut Fonts) { pub fn navigate_cursors(&mut self, step:Step, selecting:bool, fonts:&mut Fonts) {
let content = &mut self.content; let content = &mut self.content;
let mut navigation = CursorNavigation {content,fonts,selecting}; let mut navigation = CursorNavigation {content,fonts,selecting};
self.cursors.navigate_all_cursors(&mut navigation,&step); self.cursors.navigate_all_cursors(&mut navigation,step);
} }
fn refresh_content_buffers(&mut self, fonts:&mut Fonts) { fn refresh_content_buffers(&mut self, fonts:&mut Fonts) {
@ -248,6 +248,7 @@ impl TextComponent {
// ============================ // ============================
/// Text component builder /// Text component builder
#[derive(Debug)]
pub struct TextComponentBuilder<'a, 'b, Str:AsRef<str>> { pub struct TextComponentBuilder<'a, 'b, Str:AsRef<str>> {
pub scene : &'a Scene, pub scene : &'a Scene,
pub fonts : &'b mut Fonts, pub fonts : &'b mut Fonts,

View File

@ -92,6 +92,7 @@ impl RenderedFragment {
/// Builder of buffer data of some consecutive buffer fragments /// Builder of buffer data of some consecutive buffer fragments
/// ///
/// The result is stored in `vertex_position_data` and `texture_coords_data` fields. /// The result is stored in `vertex_position_data` and `texture_coords_data` fields.
#[derive(Debug)]
pub struct FragmentsDataBuilder<'a> { pub struct FragmentsDataBuilder<'a> {
pub vertex_position_data : Vec<f32>, pub vertex_position_data : Vec<f32>,
pub texture_coords_data : Vec<f32>, pub texture_coords_data : Vec<f32>,
@ -176,7 +177,7 @@ impl<'a> FragmentsDataBuilder<'a> {
/// During x scrolling we don't immediately refresh all the lines, but pick only one which is /// During x scrolling we don't immediately refresh all the lines, but pick only one which is
/// "centered" on current scroll - the rest of lines should still have data in buffers for /// "centered" on current scroll - the rest of lines should still have data in buffers for
/// shown glyphs. /// shown glyphs.
#[derive(Debug)] #[derive(Clone,Copy,Debug)]
pub struct NextFragmentToRefreshAfterXScrolling { pub struct NextFragmentToRefreshAfterXScrolling {
pub fragments_count : usize, pub fragments_count : usize,
pub next_fragment : usize pub next_fragment : usize

View File

@ -43,8 +43,7 @@ pub fn point_to_iterable<T:Scalar>(p:Point2<T>) -> SmallVec<[T;2]> {
/// The pen is a font-specific term (see /// The pen is a font-specific term (see
/// [freetype documentation](https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html#section-1) /// [freetype documentation](https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html#section-1)
/// for details). The structure keeps pen position _before_ rendering the `current_char`. /// for details). The structure keeps pen position _before_ rendering the `current_char`.
#[derive(Clone)] #[derive(Clone,Copy,Debug)]
#[derive(Debug)]
pub struct Pen { pub struct Pen {
pub position : Point2<f64>, pub position : Point2<f64>,
pub current_char : Option<char>, pub current_char : Option<char>,
@ -126,6 +125,7 @@ pub trait GlyphAttributeBuilder {
/// Builder for glyph square vertex positions /// Builder for glyph square vertex positions
/// ///
/// `pen` field points to the position of last built glyph. /// `pen` field points to the position of last built glyph.
#[derive(Debug)]
pub struct GlyphVertexPositionBuilder<'a,'b> { pub struct GlyphVertexPositionBuilder<'a,'b> {
pub font : &'a mut FontRenderInfo, pub font : &'a mut FontRenderInfo,
pub pen : &'b mut Pen, pub pen : &'b mut Pen,
@ -173,6 +173,7 @@ impl<'a,'b> GlyphAttributeBuilder for GlyphVertexPositionBuilder<'a,'b> {
// ====================================== // ======================================
/// Builder for glyph MSDF texture coordinates /// Builder for glyph MSDF texture coordinates
#[derive(Debug)]
pub struct GlyphTextureCoordsBuilder<'a> { pub struct GlyphTextureCoordsBuilder<'a> {
pub font : &'a mut FontRenderInfo pub font : &'a mut FontRenderInfo
} }

View File

@ -17,6 +17,7 @@ use crate::display::shape::text::buffer::glyph_square::GlyphTextureCoordsBuilder
/// texture coordinates) for one line. If line is longer than `max_line_size`, it is /// texture coordinates) for one line. If line is longer than `max_line_size`, it is
/// cut. When line is shorter, the buffer is padded with empty values (obtained from /// cut. When line is shorter, the buffer is padded with empty values (obtained from
/// `GlyphAttributeBuilder::empty()`). /// `GlyphAttributeBuilder::empty()`).
#[derive(Debug)]
pub struct LineAttributeBuilder<'a,GlyphBuilder:GlyphAttributeBuilder> { pub struct LineAttributeBuilder<'a,GlyphBuilder:GlyphAttributeBuilder> {
max_line_size : usize, max_line_size : usize,
squares_produced : usize, squares_produced : usize,

View File

@ -76,11 +76,13 @@ impl DirtyLines {
/// ///
/// A change is simple if it's replace a fragment of one line with text without new lines. Otherwise /// A change is simple if it's replace a fragment of one line with text without new lines. Otherwise
/// its a multiline change. /// its a multiline change.
#[derive(Clone,Copy,Debug)]
pub enum ChangeType { pub enum ChangeType {
Simple, Multiline Simple, Multiline
} }
/// A structure describing a text operation in one place. /// A structure describing a text operation in one place.
#[derive(Debug)]
pub struct TextChange { pub struct TextChange {
replaced : Range<TextLocation>, replaced : Range<TextLocation>,
lines : Vec<Vec<char>>, lines : Vec<Vec<char>>,
@ -175,6 +177,7 @@ pub struct TextComponentContent {
} }
/// References to all needed stuff for generating buffer's data. /// References to all needed stuff for generating buffer's data.
#[derive(Debug)]
pub struct RefreshInfo<'a, 'b> { pub struct RefreshInfo<'a, 'b> {
pub lines : &'a mut [Line], pub lines : &'a mut [Line],
pub dirty_lines : DirtyLines, pub dirty_lines : DirtyLines,

View File

@ -14,8 +14,7 @@ use std::ops::Range;
/// position of the char in a _text space_ (where value of 1.0 is equal to lines height). The cache /// position of the char in a _text space_ (where value of 1.0 is equal to lines height). The cache
/// is initially empty and is load on demand - so the `char_x_position` vector will be often shorter /// is initially empty and is load on demand - so the `char_x_position` vector will be often shorter
/// than number of characters in line. /// than number of characters in line.
#[derive(Debug)] #[derive(Clone,Debug)]
#[derive(Clone)]
pub struct Line { pub struct Line {
chars : Vec<char>, chars : Vec<char>,
char_x_positions : Vec<f32>, char_x_positions : Vec<f32>,
@ -143,7 +142,7 @@ impl Line {
} }
/// A line reference with it's index. /// A line reference with it's index.
#[derive(Shrinkwrap)] #[derive(Shrinkwrap,Debug)]
#[shrinkwrap(mutable)] #[shrinkwrap(mutable)]
pub struct LineRef<'a> { pub struct LineRef<'a> {
#[shrinkwrap(main_field)] #[shrinkwrap(main_field)]

View File

@ -23,7 +23,7 @@ use web_sys::WebGlBuffer;
// ============== // ==============
/// Cursor in TextComponent with its selection /// Cursor in TextComponent with its selection
#[derive(Clone,Debug,Eq,PartialEq)] #[derive(Clone,Copy,Debug,Eq,PartialEq)]
pub struct Cursor { pub struct Cursor {
pub position : TextLocation, pub position : TextLocation,
pub selected_to : TextLocation, pub selected_to : TextLocation,
@ -102,10 +102,11 @@ impl Cursor {
/// An enum representing cursor moving step. The steps are based of possible keystrokes (arrows, /// An enum representing cursor moving step. The steps are based of possible keystrokes (arrows,
/// Home, End, Ctrl+Home, etc.) /// Home, End, Ctrl+Home, etc.)
#[derive(Debug,Eq,Hash,PartialEq)] #[derive(Clone,Copy,Debug,Eq,Hash,PartialEq)]
pub enum Step {Left,Right,Up,Down,LineBegin,LineEnd,DocBegin,DocEnd} pub enum Step {Left,Right,Up,Down,LineBegin,LineEnd,DocBegin,DocEnd}
/// A struct for cursor navigation process /// A struct for cursor navigation process
#[derive(Debug)]
pub struct CursorNavigation<'a,'b> { pub struct CursorNavigation<'a,'b> {
pub content : &'a mut TextComponentContent, pub content : &'a mut TextComponentContent,
pub fonts : &'b mut Fonts, pub fonts : &'b mut Fonts,
@ -122,8 +123,8 @@ impl<'a,'b> CursorNavigation<'a,'b> {
} }
/// Move cursor by given step. /// Move cursor by given step.
pub fn move_cursor(&mut self, cursor:&mut Cursor, step:&Step) { pub fn move_cursor(&mut self, cursor:&mut Cursor, step:Step) {
let new_position = self.new_position(cursor.position,&step); let new_position = self.new_position(cursor.position,step);
self.move_cursor_to_position(cursor,new_position); self.move_cursor_to_position(cursor,new_position);
} }
@ -183,7 +184,7 @@ impl<'a,'b> CursorNavigation<'a,'b> {
} }
/// New position of cursor at `position` after applying `step`. /// New position of cursor at `position` after applying `step`.
fn new_position(&mut self, position: TextLocation, step:&Step) -> TextLocation { fn new_position(&mut self, position: TextLocation, step:Step) -> TextLocation {
match step { match step {
Step::Left => self.prev_char_position(&position).unwrap_or(position), Step::Left => self.prev_char_position(&position).unwrap_or(position),
Step::Right => self.next_char_position(&position).unwrap_or(position), Step::Right => self.next_char_position(&position).unwrap_or(position),
@ -291,8 +292,8 @@ impl Cursors {
/// ///
/// If after this operation some of the cursors occupies the same position, or their selected /// If after this operation some of the cursors occupies the same position, or their selected
/// area overlap, they are irreversibly merged. /// area overlap, they are irreversibly merged.
pub fn navigate_all_cursors(&mut self, navigaton:&mut CursorNavigation, step:&Step) { pub fn navigate_all_cursors(&mut self, navigaton:&mut CursorNavigation, step:Step) {
self.cursors.iter_mut().for_each(|cursor| navigaton.move_cursor(cursor,&step)); self.cursors.iter_mut().for_each(|cursor| navigaton.move_cursor(cursor,step));
self.merge_overlapping_cursors(); self.merge_overlapping_cursors();
self.dirty = true; self.dirty = true;
} }
@ -411,7 +412,7 @@ mod test {
for step in &[Left,Right,Up,Down,LineBegin,LineEnd,DocBegin,DocEnd] { for step in &[Left,Right,Up,Down,LineBegin,LineEnd,DocBegin,DocEnd] {
let mut cursors = Cursors::mock(initial_cursors.clone()); let mut cursors = Cursors::mock(initial_cursors.clone());
cursors.navigate_all_cursors(&mut navigation,step); cursors.navigate_all_cursors(&mut navigation,*step);
let expected = expected_positions.get(step).unwrap(); let expected = expected_positions.get(step).unwrap();
let current = cursors.cursors.iter().map(|c| (c.position.line, c.position.column)); let current = cursors.cursors.iter().map(|c| (c.position.line, c.position.column));
assert_eq!(expected,&current.collect_vec(), "Error for step {:?}", step); assert_eq!(expected,&current.collect_vec(), "Error for step {:?}", step);
@ -439,7 +440,7 @@ mod test {
selecting: false selecting: false
}; };
let mut cursors = Cursors::mock(initial_cursors.clone()); let mut cursors = Cursors::mock(initial_cursors.clone());
cursors.navigate_all_cursors(&mut navigation,&LineEnd); cursors.navigate_all_cursors(&mut navigation,LineEnd);
assert_eq!(new_position, cursors.cursors.first().unwrap().position); assert_eq!(new_position, cursors.cursors.first().unwrap().position);
assert_eq!(new_position, cursors.cursors.first().unwrap().selected_to); assert_eq!(new_position, cursors.cursors.first().unwrap().selected_to);
}) })
@ -462,7 +463,7 @@ mod test {
selecting: true selecting: true
}; };
let mut cursors = Cursors::mock(initial_cursors.clone()); let mut cursors = Cursors::mock(initial_cursors.clone());
cursors.navigate_all_cursors(&mut navigation,&LineEnd); cursors.navigate_all_cursors(&mut navigation,LineEnd);
assert_eq!(new_loc , cursors.cursors.first().unwrap().position); assert_eq!(new_loc , cursors.cursors.first().unwrap().position);
assert_eq!(initial_loc, cursors.cursors.first().unwrap().selected_to); assert_eq!(initial_loc, cursors.cursors.first().unwrap().selected_to);
}) })

View File

@ -108,11 +108,11 @@ pub struct AttributeQualifier {
impl AttributeQualifier { impl AttributeQualifier {
pub fn to_input_var<Name:Into<glsl::Identifier>> pub fn to_input_var<Name:Into<glsl::Identifier>>
(&self, name:Name) -> glsl::GlobalVar { (&self, name:Name) -> glsl::GlobalVar {
let storage = self.storage.clone(); let storage = self.storage;
glsl::GlobalVar { glsl::GlobalVar {
layout : None, layout : None,
storage : Some(glsl::GlobalVarStorage::InStorage(storage)), storage : Some(glsl::GlobalVarStorage::InStorage(storage)),
prec : self.prec.clone(), prec : self.prec,
typ : self.typ.clone(), typ : self.typ.clone(),
ident : name.into() ident : name.into()
} }
@ -120,11 +120,11 @@ impl AttributeQualifier {
pub fn to_output_var<Name:Into<glsl::Identifier>> pub fn to_output_var<Name:Into<glsl::Identifier>>
(&self, name:Name) -> glsl::GlobalVar { (&self, name:Name) -> glsl::GlobalVar {
let storage = self.storage.clone(); let storage = self.storage;
glsl::GlobalVar { glsl::GlobalVar {
layout : None, layout : None,
storage : Some(glsl::GlobalVarStorage::OutStorage(storage)), storage : Some(glsl::GlobalVarStorage::OutStorage(storage)),
prec : self.prec.clone(), prec : self.prec,
typ : self.typ.clone(), typ : self.typ.clone(),
ident : name.into() ident : name.into()
} }
@ -175,7 +175,7 @@ impl UniformQualifier {
glsl::GlobalVar{ glsl::GlobalVar{
layout : None, layout : None,
storage : Some(glsl::GlobalVarStorage::UniformStorage), storage : Some(glsl::GlobalVarStorage::UniformStorage),
prec : self.prec.clone(), prec : self.prec,
typ : self.typ.clone(), typ : self.typ.clone(),
ident : name.into() ident : name.into()
} }

View File

@ -51,6 +51,7 @@ pub use stats::*;
static mut SCENE: Option<Scene> = None; static mut SCENE: Option<Scene> = None;
/// Very unsafe function. Do not use. See documentation of `WORLD` to learn more. /// Very unsafe function. Do not use. See documentation of `WORLD` to learn more.
#[allow(unsafe_code)]
pub(crate) fn get_scene() -> Scene { pub(crate) fn get_scene() -> Scene {
unsafe { unsafe {
SCENE.as_ref().unwrap_or_else(|| panic!("World not initialized.")).clone_ref() SCENE.as_ref().unwrap_or_else(|| panic!("World not initialized.")).clone_ref()
@ -58,6 +59,7 @@ pub(crate) fn get_scene() -> Scene {
} }
/// Very unsafe function. Do not use. See documentation of `WORLD` to learn more. /// Very unsafe function. Do not use. See documentation of `WORLD` to learn more.
#[allow(unsafe_code)]
fn init_global_variables(world:&World) { fn init_global_variables(world:&World) {
unsafe { unsafe {
SCENE = Some(world.rc.borrow().scene.clone_ref()); SCENE = Some(world.rc.borrow().scene.clone_ref());

View File

@ -23,14 +23,14 @@ use js_sys::Math;
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;
#[derive(Clone)] #[derive(Clone,Debug)]
/// A simplified Canvas object used in the EasingAnimator example. /// A simplified Canvas object used in the EasingAnimator example.
pub struct Canvas { pub struct Canvas {
canvas : HtmlCanvasElement, canvas : HtmlCanvasElement,
context : CanvasRenderingContext2d context : CanvasRenderingContext2d
} }
#[derive(Clone, Copy)] #[derive(Clone,Copy,Debug)]
/// Interpolable properties for our example code. /// Interpolable properties for our example code.
pub struct Properties { pub struct Properties {
/// Position property. /// Position property.

View File

@ -4,6 +4,9 @@
#![allow(dead_code)] #![allow(dead_code)]
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)] #![warn(missing_docs)]
#![warn(trivial_casts)] #![warn(trivial_casts)]
#![warn(trivial_numeric_casts)] #![warn(trivial_numeric_casts)]

View File

@ -231,6 +231,7 @@ impl<T: BufferItem> BufferData<T> {
} }
/// Replaces the whole GPU buffer by the local data. /// Replaces the whole GPU buffer by the local data.
#[allow(unsafe_code)]
fn replace_gpu_buffer(&mut self) { fn replace_gpu_buffer(&mut self) {
let data = self.as_slice(); let data = self.as_slice();
let gl_enum = self.usage.into_gl_enum().into(); let gl_enum = self.usage.into_gl_enum().into();
@ -251,6 +252,7 @@ impl<T: BufferItem> BufferData<T> {
} }
/// Updates the GPU sub-buffer data by the provided index range. /// Updates the GPU sub-buffer data by the provided index range.
#[allow(unsafe_code)]
fn update_gpu_sub_buffer(&mut self, range:&RangeInclusive<usize>) { fn update_gpu_sub_buffer(&mut self, range:&RangeInclusive<usize>) {
let data = self.as_slice(); let data = self.as_slice();
let item_byte_size = T::item_gpu_byte_size() as u32; let item_byte_size = T::item_gpu_byte_size() as u32;
@ -323,7 +325,7 @@ use crate::system::gpu::data::AttributeInstanceIndex;
// === Macros === // === Macros ===
/// Variant mismatch error type. /// Variant mismatch error type.
#[derive(Debug)] #[derive(Clone,Copy,Debug)]
pub struct BadVariant; pub struct BadVariant;
macro_rules! define_any_buffer { macro_rules! define_any_buffer {

View File

@ -177,6 +177,7 @@ impl<T:BufferItem<Item=T>,R,C> BufferItem for MatrixMN<T,R,C>
type Rows = R; type Rows = R;
type Cols = C; type Cols = C;
#[allow(unsafe_code)]
fn slice_from_items(buffer: &[Self::Item]) -> &[Self] { fn slice_from_items(buffer: &[Self::Item]) -> &[Self] {
// This code casts slice to matrix. This is safe because `MatrixMN` // This code casts slice to matrix. This is safe because `MatrixMN`
// uses `nalgebra::Owned` allocator, which resolves to array defined as // uses `nalgebra::Owned` allocator, which resolves to array defined as
@ -185,6 +186,7 @@ impl<T:BufferItem<Item=T>,R,C> BufferItem for MatrixMN<T,R,C>
unsafe { std::slice::from_raw_parts(buffer.as_ptr().cast(), len) } unsafe { std::slice::from_raw_parts(buffer.as_ptr().cast(), len) }
} }
#[allow(unsafe_code)]
fn slice_from_items_mut(buffer: &mut [Self::Item]) -> &mut [Self] { fn slice_from_items_mut(buffer: &mut [Self::Item]) -> &mut [Self] {
// This code casts slice to matrix. This is safe because `MatrixMN` // This code casts slice to matrix. This is safe because `MatrixMN`
// uses `nalgebra::Owned` allocator, which resolves to array defined as // uses `nalgebra::Owned` allocator, which resolves to array defined as
@ -193,6 +195,7 @@ impl<T:BufferItem<Item=T>,R,C> BufferItem for MatrixMN<T,R,C>
unsafe { std::slice::from_raw_parts_mut(buffer.as_mut_ptr().cast(), len) } unsafe { std::slice::from_raw_parts_mut(buffer.as_mut_ptr().cast(), len) }
} }
#[allow(unsafe_code)]
fn slice_to_items(buffer: &[Self]) -> &[Self::Item] { fn slice_to_items(buffer: &[Self]) -> &[Self::Item] {
// This code casts slice to matrix. This is safe because `MatrixMN` // This code casts slice to matrix. This is safe because `MatrixMN`
// uses `nalgebra::Owned` allocator, which resolves to array defined as // uses `nalgebra::Owned` allocator, which resolves to array defined as
@ -201,6 +204,7 @@ impl<T:BufferItem<Item=T>,R,C> BufferItem for MatrixMN<T,R,C>
unsafe { std::slice::from_raw_parts(buffer.as_ptr().cast(), len) } unsafe { std::slice::from_raw_parts(buffer.as_ptr().cast(), len) }
} }
#[allow(unsafe_code)]
fn slice_to_items_mut(buffer: &mut [Self]) -> &mut [Self::Item] { fn slice_to_items_mut(buffer: &mut [Self]) -> &mut [Self::Item] {
// This code casts slice to matrix. This is safe because `MatrixMN` // This code casts slice to matrix. This is safe because `MatrixMN`
// uses `nalgebra::Owned` allocator, which resolves to array defined as // uses `nalgebra::Owned` allocator, which resolves to array defined as
@ -217,6 +221,7 @@ impl<T:BufferItem<Item=T>,R,C> BufferItem for MatrixMN<T,R,C>
// ==================== // ====================
/// Extension method for viewing into wasm's linear memory. /// Extension method for viewing into wasm's linear memory.
#[allow(unsafe_code)]
pub trait JsBufferView { pub trait JsBufferView {
/// Creates a JS typed array which is a view into wasm's linear memory at the slice specified. /// Creates a JS typed array which is a view into wasm's linear memory at the slice specified.
/// ///
@ -240,6 +245,7 @@ pub trait JsBufferView {
// === Instances === // === Instances ===
#[allow(unsafe_code)]
impl JsBufferView for [bool] { impl JsBufferView for [bool] {
unsafe fn js_buffer_view(&self) -> js_sys::Object { unsafe fn js_buffer_view(&self) -> js_sys::Object {
let i32arr = self.iter().cloned().map(|t| if t {1} else {0}).collect::<Vec<i32>>(); let i32arr = self.iter().cloned().map(|t| if t {1} else {0}).collect::<Vec<i32>>();
@ -247,30 +253,35 @@ impl JsBufferView for [bool] {
} }
} }
#[allow(unsafe_code)]
impl JsBufferView for [i32] { impl JsBufferView for [i32] {
unsafe fn js_buffer_view(&self) -> js_sys::Object { unsafe fn js_buffer_view(&self) -> js_sys::Object {
js_sys::Int32Array::view(self).into() js_sys::Int32Array::view(self).into()
} }
} }
#[allow(unsafe_code)]
impl JsBufferView for [u32] { impl JsBufferView for [u32] {
unsafe fn js_buffer_view(&self) -> js_sys::Object { unsafe fn js_buffer_view(&self) -> js_sys::Object {
js_sys::Uint32Array::view(self).into() js_sys::Uint32Array::view(self).into()
} }
} }
#[allow(unsafe_code)]
impl JsBufferView for [f32] { impl JsBufferView for [f32] {
unsafe fn js_buffer_view(&self) -> js_sys::Object { unsafe fn js_buffer_view(&self) -> js_sys::Object {
js_sys::Float32Array::view(self).into() js_sys::Float32Array::view(self).into()
} }
} }
#[allow(unsafe_code)]
impl JsBufferView for [u8] { impl JsBufferView for [u8] {
unsafe fn js_buffer_view(&self) -> js_sys::Object { unsafe fn js_buffer_view(&self) -> js_sys::Object {
js_sys::Uint8Array::view(self).into() js_sys::Uint8Array::view(self).into()
} }
} }
#[allow(unsafe_code)]
impl<T: BufferItem<Item=T>,R,C> JsBufferView for [MatrixMN<T,R,C>] impl<T: BufferItem<Item=T>,R,C> JsBufferView for [MatrixMN<T,R,C>]
where Self : MatrixCtx<T,R,C>, where Self : MatrixCtx<T,R,C>,
T : ItemBounds, T : ItemBounds,
@ -281,6 +292,7 @@ impl<T: BufferItem<Item=T>,R,C> JsBufferView for [MatrixMN<T,R,C>]
} }
} }
#[allow(unsafe_code)]
impl<T: BufferItem<Item=T>,R,C> JsBufferView for MatrixMN<T,R,C> impl<T: BufferItem<Item=T>,R,C> JsBufferView for MatrixMN<T,R,C>
where Self:MatrixCtx<T,R,C>, T:ItemBounds { where Self:MatrixCtx<T,R,C>, T:ItemBounds {
unsafe fn js_buffer_view(&self) -> js_sys::Object { unsafe fn js_buffer_view(&self) -> js_sys::Object {

View File

@ -27,6 +27,7 @@ pub struct TextureUnit(u32);
// ======================== // ========================
/// Guard which unbinds texture in specific texture unit on drop. /// Guard which unbinds texture in specific texture unit on drop.
#[derive(Debug)]
pub struct TextureBindGuard { pub struct TextureBindGuard {
context : Context, context : Context,
target : u32, target : u32,

View File

@ -15,7 +15,7 @@ use crate::system::gpu::data::texture::types::*;
// =============== // ===============
/// Sized, uninitialized texture. /// Sized, uninitialized texture.
#[derive(Debug)] #[derive(Clone,Copy,Debug)]
pub struct GpuOnlyData { pub struct GpuOnlyData {
/// Texture width. /// Texture width.
pub width : i32, pub width : i32,

View File

@ -43,6 +43,7 @@ impl<T> OwnedData<T> {
impl<I:InternalFormat,T:ItemType+JsBufferViewArr> impl<I:InternalFormat,T:ItemType+JsBufferViewArr>
TextureReload for Texture<Owned,I,T> { TextureReload for Texture<Owned,I,T> {
#[allow(unsafe_code)]
fn reload(&self) { fn reload(&self) {
let width = self.storage().width; let width = self.storage().width;
let height = self.storage().height; let height = self.storage().height;

View File

@ -249,6 +249,7 @@ impl<T> WithContent for Uniform<T> {
// === AnyPrimUniform === // === AnyPrimUniform ===
// ====================== // ======================
#[derive(Clone,Copy,Debug)]
pub struct TypeMismatch; pub struct TypeMismatch;
macro_rules! define_any_prim_uniform { macro_rules! define_any_prim_uniform {

View File

@ -172,6 +172,7 @@ pub fn set_buffer_data(gl_context:&Context, buffer:&WebGlBuffer, data:&[f32]) {
/// until it is destroyed. This way of creating buffers were taken from /// until it is destroyed. This way of creating buffers were taken from
/// wasm-bindgen examples /// wasm-bindgen examples
/// (https://rustwasm.github.io/wasm-bindgen/examples/webgl.html) /// (https://rustwasm.github.io/wasm-bindgen/examples/webgl.html)
#[allow(unsafe_code)]
fn set_bound_buffer_data(gl_context:&Context, target:u32, data:&[f32]) { fn set_bound_buffer_data(gl_context:&Context, target:u32, data:&[f32]) {
let usage = Context::STATIC_DRAW; let usage = Context::STATIC_DRAW;
unsafe { unsafe {
@ -194,6 +195,7 @@ pub fn set_buffer_subdata(gl_context:&Context, buffer:&WebGlBuffer, offset:usize
/// until it is destroyed. This way of creating buffers were taken from /// until it is destroyed. This way of creating buffers were taken from
/// wasm-bindgen examples /// wasm-bindgen examples
/// (https://rustwasm.github.io/wasm-bindgen/examples/webgl.html) /// (https://rustwasm.github.io/wasm-bindgen/examples/webgl.html)
#[allow(unsafe_code)]
fn set_bound_buffer_subdata(gl_context:&Context, target:u32, offset:i32, data:&[f32]) { fn set_bound_buffer_subdata(gl_context:&Context, target:u32, offset:i32, data:&[f32]) {
unsafe { unsafe {
let float_array = Float32Array::view(&data); let float_array = Float32Array::view(&data);

View File

@ -113,6 +113,7 @@ where Self:MatrixCtx<T,R,C>, PhantomData<MatrixMN<T,R,C>>:Into<PrimType> {
// === Wrong Conversions === // === Wrong Conversions ===
/// Error indicating that a value cannot be converted to Glsl. /// Error indicating that a value cannot be converted to Glsl.
#[derive(Clone,Copy,Debug)]
pub struct NotGlslError; pub struct NotGlslError;
@ -539,13 +540,13 @@ pub struct GlobalVar {
} }
/// Global variable layout definition. /// Global variable layout definition.
#[derive(Clone,Debug,Default)] #[derive(Clone,Copy,Debug,Default)]
pub struct Layout { pub struct Layout {
pub location: usize, pub location: usize,
} }
/// Global variable storage definition. /// Global variable storage definition.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub enum GlobalVarStorage { pub enum GlobalVarStorage {
ConstStorage, ConstStorage,
InStorage(LinkageStorage), InStorage(LinkageStorage),
@ -554,14 +555,14 @@ pub enum GlobalVarStorage {
} }
/// Storage definition for in- and out- attributes. /// Storage definition for in- and out- attributes.
#[derive(Clone,Debug,Default)] #[derive(Clone,Copy,Debug,Default)]
pub struct LinkageStorage { pub struct LinkageStorage {
pub centroid : bool, pub centroid : bool,
pub interpolation : Option<InterpolationStorage>, pub interpolation : Option<InterpolationStorage>,
} }
/// Interpolation storage type for attributes. /// Interpolation storage type for attributes.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub enum InterpolationStorage {Smooth, Flat} pub enum InterpolationStorage {Smooth, Flat}
@ -638,7 +639,7 @@ impl HasCodeRepr for LocalVar {
// ================= // =================
/// Type precision definition. /// Type precision definition.
#[derive(Clone,Debug)] #[derive(Clone,Copy,Debug)]
pub enum Precision { Low, Medium, High } pub enum Precision { Low, Medium, High }
impl Display for Precision { impl Display for Precision {
@ -665,7 +666,7 @@ impl HasCodeRepr for Precision {
impl From<&Precision> for Precision { impl From<&Precision> for Precision {
fn from(t: &Precision) -> Self { fn from(t: &Precision) -> Self {
t.clone() *t
} }
} }

View File

@ -31,9 +31,16 @@ mod js {
use super::*; use super::*;
#[wasm_bindgen(module = "/src/system/web/dom/html/snippets.js")] #[wasm_bindgen(module = "/src/system/web/dom/html/snippets.js")]
extern "C" { extern "C" {
#[allow(unsafe_code)]
pub fn set_object_transform(dom:&JsValue, matrix_array:&Object); pub fn set_object_transform(dom:&JsValue, matrix_array:&Object);
#[allow(unsafe_code)]
pub fn setup_perspective(dom: &JsValue, znear: &JsValue); pub fn setup_perspective(dom: &JsValue, znear: &JsValue);
#[allow(unsafe_code)]
pub fn setup_camera_orthographic(dom:&JsValue, matrix_array:&JsValue); pub fn setup_camera_orthographic(dom:&JsValue, matrix_array:&JsValue);
#[allow(unsafe_code)]
pub fn setup_camera_perspective pub fn setup_camera_perspective
( dom : &JsValue ( dom : &JsValue
, near : &JsValue , near : &JsValue
@ -55,6 +62,7 @@ pub fn invert_y(mut m: Matrix4<f32>) -> Matrix4<f32> {
m m
} }
#[allow(unsafe_code)]
fn set_object_transform(dom: &JsValue, matrix: &Matrix4<f32>) { fn set_object_transform(dom: &JsValue, matrix: &Matrix4<f32>) {
// Views to WASM memory are only valid as long the backing buffer isn't // Views to WASM memory are only valid as long the backing buffer isn't
// resized. Check documentation of IntoFloat32ArrayView trait for more // resized. Check documentation of IntoFloat32ArrayView trait for more
@ -65,6 +73,7 @@ fn set_object_transform(dom: &JsValue, matrix: &Matrix4<f32>) {
} }
} }
#[allow(unsafe_code)]
fn setup_camera_perspective fn setup_camera_perspective
(dom:&JsValue, near:f32, matrix:&Matrix4<f32>) { // Views to WASM memory are only valid as long the backing buffer isn't (dom:&JsValue, near:f32, matrix:&Matrix4<f32>) { // Views to WASM memory are only valid as long the backing buffer isn't
// resized. Check documentation of IntoFloat32ArrayView trait for more // resized. Check documentation of IntoFloat32ArrayView trait for more
@ -79,6 +88,7 @@ fn setup_camera_perspective
} }
} }
#[allow(unsafe_code)]
fn setup_camera_orthographic(dom:&JsValue, matrix:&Matrix4<f32>) { fn setup_camera_orthographic(dom:&JsValue, matrix:&Matrix4<f32>) {
// Views to WASM memory are only valid as long the backing buffer isn't // Views to WASM memory are only valid as long the backing buffer isn't
// resized. Check documentation of IntoFloat32ArrayView trait for more // resized. Check documentation of IntoFloat32ArrayView trait for more

View File

@ -13,6 +13,7 @@ use data::opt_vec::*;
// ================= // =================
/// A collection for holding 3D `Object`s. /// A collection for holding 3D `Object`s.
#[derive(Debug)]
pub struct HtmlScene { pub struct HtmlScene {
display_object : DisplayObjectData, display_object : DisplayObjectData,
objects : OptVec<HtmlObject> objects : OptVec<HtmlObject>

View File

@ -1,3 +1,7 @@
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
pub mod opt_vec; pub mod opt_vec;
pub use basegl_prelude as prelude; pub use basegl_prelude as prelude;

View File

@ -27,6 +27,10 @@
//! evaluated. This is just because the implementation is not finished and //! evaluated. This is just because the implementation is not finished and
//! there are comments in code where it should be added. //! there are comments in code where it should be added.
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
// ============ // ============
// === Eval === // === Eval ===
// ============ // ============

View File

@ -1,5 +1,8 @@
#![feature(trait_alias)] #![feature(trait_alias)]
#![feature(set_stdio)] #![feature(set_stdio)]
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
use std::fmt::Debug; use std::fmt::Debug;
use wasm_bindgen::JsValue; use wasm_bindgen::JsValue;

View File

@ -1,3 +1,6 @@
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(dead_code)] #![allow(dead_code)]

View File

@ -3,6 +3,9 @@
//! defines several aliases and utils which may find their place in new //! defines several aliases and utils which may find their place in new
//! libraries in the future. //! libraries in the future.
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![feature(specialization)] #![feature(specialization)]
#![feature(trait_alias)] #![feature(trait_alias)]
@ -443,9 +446,11 @@ pub trait Value {
// ======================= // =======================
/// Type level `true` value. /// Type level `true` value.
#[derive(Clone,Copy,Debug)]
pub struct True {} pub struct True {}
/// Type level `false` value. /// Type level `false` value.
#[derive(Clone,Copy,Debug)]
pub struct False {} pub struct False {}
impl Value for True { impl Value for True {

View File

@ -5,6 +5,9 @@
// This library is in a very early stage. It will be refactored and improved // This library is in a very early stage. It will be refactored and improved
// soon. It should not be reviewed now. // soon. It should not be reviewed now.
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![feature(generators, generator_trait)] #![feature(generators, generator_trait)]
#![feature(specialization)] #![feature(specialization)]
#![feature(overlapping_marker_traits)] #![feature(overlapping_marker_traits)]
@ -85,6 +88,7 @@ macro_rules! derive_clone_plus {
// === IterForGenerator === // === IterForGenerator ===
// ======================== // ========================
#[derive(Debug)]
pub struct IterForGenerator<G: Generator>(pub G); pub struct IterForGenerator<G: Generator>(pub G);
impl<G> Iterator for IterForGenerator<G> impl<G> Iterator for IterForGenerator<G>
@ -104,7 +108,7 @@ where G: Generator<Return = ()> + Unpin {
// ====================== // ======================
#[derive(Derivative)] #[derive(Derivative)]
#[derivative(Default(bound=""))] #[derivative(Debug,Default(bound=""))]
pub struct EmptyGenerator<T>(PhantomData<T>); pub struct EmptyGenerator<T>(PhantomData<T>);
impl<T> EmptyGenerator<T> { impl<T> EmptyGenerator<T> {

View File

@ -20,7 +20,7 @@
/// ```compile_fail /// ```compile_fail
/// shared! { Uniform /// shared! { Uniform
/// ///
/// #[derive(Clone,Debug)] /// #[derive(Clone,Copy,Debug)]
/// pub struct UniformData<Value> { /// pub struct UniformData<Value> {
/// value: Value, /// value: Value,
/// dirty: bool, /// dirty: bool,
@ -49,7 +49,7 @@
/// The following output will be generated: /// The following output will be generated:
/// ///
/// ```compile_fail /// ```compile_fail
/// #[derive(Clone,Debug)] /// #[derive(Clone,Copy,Debug)]
/// pub struct UniformData<Value> { /// pub struct UniformData<Value> {
/// value: Value, /// value: Value,
/// dirty: bool, /// dirty: bool,
@ -74,7 +74,7 @@
/// } /// }
/// } /// }
/// ///
/// #[derive(Clone,Debug)] /// #[derive(Clone,Copy,Debug)]
/// pub struct Uniform<Value> { /// pub struct Uniform<Value> {
/// rc: Rc<RefCell<UniformData<Value>>> /// rc: Rc<RefCell<UniformData<Value>>>
/// } /// }

View File

@ -1,3 +1,7 @@
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
extern crate proc_macro; extern crate proc_macro;
use basegl_prelude::*; use basegl_prelude::*;
@ -7,7 +11,6 @@ use proc_macro2::{TokenStream, Ident, Span};
use quote::quote; use quote::quote;
use syn; use syn;
//////////////////////////////////////////////// ////////////////////////////////////////////////
/// In order to make the definition easier to read, an example expansion of the /// In order to make the definition easier to read, an example expansion of the

View File

@ -1,3 +1,6 @@
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![feature(trait_alias)] #![feature(trait_alias)]
#![feature(set_stdio)] #![feature(set_stdio)]
@ -241,6 +244,7 @@ impl NodeRemover for Node {
#[wasm_bindgen(inline_js = "export function request_animation_frame2(f) { requestAnimationFrame(f) }")] #[wasm_bindgen(inline_js = "export function request_animation_frame2(f) { requestAnimationFrame(f) }")]
extern "C" { extern "C" {
#[allow(unsafe_code)]
pub fn request_animation_frame2(closure: &Closure<dyn FnMut()>) -> i32; pub fn request_animation_frame2(closure: &Closure<dyn FnMut()>) -> i32;
} }
@ -324,6 +328,7 @@ export function set_stack_trace_limit() {
} }
")] ")]
extern "C" { extern "C" {
#[allow(unsafe_code)]
pub fn set_stack_trace_limit(); pub fn set_stack_trace_limit();
} }

View File

@ -14,7 +14,10 @@ pub type Listener = Closure<dyn FnMut(f64,f64)>;
#[wasm_bindgen(module = "/js/resize_observer.js")] #[wasm_bindgen(module = "/js/resize_observer.js")]
extern "C" { extern "C" {
#[allow(unsafe_code)]
fn resize_observe(target: &JsValue, closure: &Listener) -> usize; fn resize_observe(target: &JsValue, closure: &Listener) -> usize;
#[allow(unsafe_code)]
fn resize_unobserve(id: usize); fn resize_unobserve(id: usize);
} }

View File

@ -1,3 +1,7 @@
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
extern crate proc_macro; extern crate proc_macro;
use proc_macro::TokenStream; use proc_macro::TokenStream;

View File

@ -14,7 +14,7 @@ use web_sys::HtmlElement;
// ====================== // ======================
/// Html container displaying benchmark results. /// Html container displaying benchmark results.
#[derive(Shrinkwrap)] #[derive(Shrinkwrap,Debug)]
pub struct BenchContainer { pub struct BenchContainer {
#[shrinkwrap(main_field)] #[shrinkwrap(main_field)]
container : Container, container : Container,

View File

@ -16,7 +16,10 @@ use std::cell::RefCell;
// ========================= // =========================
/// Cell, used to hold Bencher's data /// Cell, used to hold Bencher's data
#[derive(Derivative)]
#[derivative(Debug)]
pub struct BencherProperties { pub struct BencherProperties {
#[derivative(Debug="ignore")]
callback : Box<dyn FnMut()>, callback : Box<dyn FnMut()>,
container : BenchContainer, container : BenchContainer,
iterations : usize, iterations : usize,
@ -54,7 +57,7 @@ impl BencherProperties {
// === BencherData === // === BencherData ===
// =================== // ===================
#[derive(Shrinkwrap)] #[derive(Shrinkwrap,Debug)]
pub struct BencherData { pub struct BencherData {
properties: RefCell<BencherProperties> properties: RefCell<BencherProperties>
} }
@ -119,7 +122,7 @@ impl BencherData {
// =============== // ===============
/// The Bencher struct with an API compatible to Rust's test Bencher. /// The Bencher struct with an API compatible to Rust's test Bencher.
#[derive(Clone)] #[derive(Clone,Debug)]
pub struct Bencher { pub struct Bencher {
data : Rc<BencherData> data : Rc<BencherData>
} }

View File

@ -13,6 +13,7 @@ use web_sys::HtmlElement;
// ================= // =================
/// A container to hold tests in `wasm-pack test`. /// A container to hold tests in `wasm-pack test`.
#[derive(Clone,Debug)]
pub struct Container { pub struct Container {
pub div : HtmlElement, pub div : HtmlElement,
pub header : HtmlElement, pub header : HtmlElement,

View File

@ -14,6 +14,7 @@ use web_sys::HtmlElement;
// ============= // =============
/// Helper to group test containers /// Helper to group test containers
#[derive(Clone,Debug)]
pub struct Group { pub struct Group {
pub div : HtmlElement, pub div : HtmlElement,
} }

View File

@ -1,4 +1,7 @@
#![feature(arbitrary_self_types)] #![feature(arbitrary_self_types)]
#![warn(unsafe_code)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
mod system { mod system {
pub use basegl_system_web as web; pub use basegl_system_web as web;