perspective_viewer

Module utils

source
Expand description

A catch all for project-wide macros and general-purpose functions that are not directly related to Perspective.

Modules below crate::utils strive to be single-responsibility, but some reference other crate::utils modules when it helps reduce boiler-plate.

Structs§

  • A pub/sub struct which allows many listeners to subscribe to many publishers, without leaking callbacks as listeners are dropped.
  • Like a PubSub without PubSub::emit; the reciprocal of PubSub::callback. Subscriber does not keep the parent PubSub alive.
  • Manages the lifetime of a listener registered to a PubSub<T> by deregistering the associated listener when dropped.
  • A mutable reference for capturing the Scope<_> props arguments, a useful function for tests.

Traits§

  • Utilities for caret position. DOM elements have different APIs for this but Deref makes them fall through, so it is important that this method be called on the correct struct type!
  • Blur the current active elemnt, triggering any blur handlers in the application (e.g. modals). This is often necessary when a DOM update will invalidate something that has a "blur" event handler.
  • Trait for polymorphic return value via turbofish-const-generic syntax.

Functions§