Skip to main content

Crate egui_pop_hooks

Crate egui_pop_hooks 

Source
Expand description

§egui-pop-hooks

egui-pop’s hook kernel, now bus-kernel: this crate re-exports it, so egui_pop_hooks::Kernel and every other path of 0.2 still name the same items.

bus-kernel is an implementation of bus-contract: typed hook points, listeners with ids ordered by after/before and priority, alter and collect emits, a per-listener error boundary with panics caught and deadlines, local listeners, deferred requests, timings, and a host journal and relay. It needs no GUI toolkit, and ships a conformance suite (its conformance feature) any other implementation can run.

New code may depend on bus-kernel directly. egui-pop’s application uses this kernel by default (AppBuilder::bus supplies another).

License: MIT OR Apache-2.0.

Experimental: may change in any release (docs/stability.md).

Re-exports§

pub use bus_kernel;

Modules§

bus_contract
bus-contract
bus_contract_crossing
bus-contract-crossing
bus_contract_defer
bus-contract-defer
bus_contract_journal
bus-contract-journal
bus_contract_timings
bus-contract-timings
trace
The trace tap: each emit, each listener heard, each ask and its drain, reported as it happens to the sinks that observe the kernel.

Structs§

Altered
The result of an alter emit.
Codec
How a relayable point’s input is written and read (Relayed), and a relayable request’s value (RelayedRequest), its types erased, for a contract table (relayable). Two codecs are equal when they are for the same point.
Collected
The result of a collect emit.
Contract
A capability contract a bus may offer: its name, its version line and the trait object type a bus answers for in Bus::capability. Each contract crate exports one as CONTRACT (bus_contract_journal::CONTRACT); a point names those it needs in its table (PointDecl::needs) and declare_all refuses it on a bus without them.
Crossing
What an authority of a bus is shown of something crossing in (Relay::add_authority), before anything is decoded or recorded.
Cursor
Where a reader of a relay stands: the journal run it read and the last number it took.
Facet
What a point’s declaration says for one capability contract: the contract, and data only that contract’s crate reads (a journaled mark, a codec). Made by the contract crate, in a const (bus_contract_journal::JOURNALED, bus_contract_crossing::relayable(&CODEC)), and carried by PointDecl::facets and PointSpec::facets. A point with a facet needs its contract.
Failure
One listener’s failure: its contribution was dropped (except for a FailureKind::MissingTarget); the other listeners ran, unless the point is fail-closed (PointSpec::fail_closed).
JournalEntry
One event of a journal: what happened, its number, what caused it.
Kernel
The hook kernel: hook points, their listeners, emits and introspection. Send + Sync: share it in an Arc. Listeners run with no lock held, so a listener may emit or listen itself.
ListenOpts
How a listener is placed and limited.
ListenerId
A listener’s id, checked when made against the naming rule (check_id): <crate>.<what> (docs.autosave), so the order dump of a point shows who each listener belongs to.
ListenerInfo
A listener as introspection shows it.
ListenerTimings
One listener’s time on a point (PointTimings::listeners).
Observing
Keeps a sink observing a bus (Trace::add_trace_sink); dropping it removes the sink.
Origin
Who sent what crosses a process boundary: the far side of a link, as the receiving side knows it.
OverBudget
A pass of a point’s listeners that went over its budget (PointSpec::budget): reported to the budget sinks (Timings::add_budget_sink). The pass’s results were kept: a budget is not a deadline.
PendingRun
What listeners run later did: one emit’s local listeners queued for their thread (Bus::run_pending), or one deferred request (the defer contract’s drain).
PointDecl
One line of a library’s contract table: a point it declares, built from the point’s type in a const (PointDecl::of::<DocClose>(…)), so the application can read what a library will host before building anything. declare_all declares a table on a bus.
PointId
A point’s id (Point::ID), checked when made against the naming rule (check_id): <crate>.<subject>.<moment>.
PointInfo
A point as introspection shows it.
PointSpec
A point’s declaration: its description and limits, for introspection.
PointTimings
A point’s time (Timings::points): its passes, its listeners, its budget and how often a pass went over.
Refusal
A request stopped by one of its listeners: the listener refused it (HookError::Refuse), or failed on a fail-closed point (PointSpec::fail_closed). The listeners after it did not run.
RelayedAnswer
The answer to one ask (Relay::answer), naming it.
RelayedAsk
A request asked of another process (Relay::answer): its input and the value so far, as text, with the time the asker waits.
RelayedEntry
An event as it crosses a process (Relay): its input as text.
Resumed
What a relay read found (Relay::resume).
Since
What a read of a journal after a number found (Journal::since).
TimingStats
How long something took over a window of runs (Timings): a listener’s runs, or a point’s passes. The quantiles may be approximate (an implementation may read them from a histogram); the count, total and max are exact.
TraceEvent
One thing the bus did, as a sink receives it.

Enums§

Answer
How an ask was answered (RelayedAnswer::answer).
FailureKind
What went wrong with one listener during an emit.
HookError
What a listener returns instead of Ok(()): it failed, or it refuses the request.
IdError
Why an id was refused (check_id).
IngestError
Why an entry relayed in was not taken (Relay::ingest).
Lost
Why a reader of a relay missed entries (Resumed::lost).
Outcome
What a listener answered (Traced::Heard), before the point’s rules judge it: a refusal on a point that is not a request counts as a failure there.
PointKind
What a point is for, declared for introspection and review. A request is an alter emit over the request’s input; only a request can be refused by a listener (HookError::Refuse) or declared fail-closed (PointSpec::fail_closed).
Refused
Why a declaration or a listener was refused. Nothing was changed.
Traced
What a TraceEvent reports.

Constants§

DEFAULT_DEADLINE
The deadline of an in-process listener when neither the listener nor its point sets one.
FAILED_FACT
The name a host gives the fact it publishes for each Failure its sinks receive (Bus::add_failure_sink).
JOURNALED
The facet of a journaled event point: its events go through the bus’s journal, published with a number and delivered to the listeners in journal order after the publisher has moved on (PointDecl::of::<P>(…).facets(&[JOURNALED]), or PointSpec::new(…).facet(JOURNALED)). Only an event point is journaled (check).
LAST
The after target that places a listener after every other listener of its point (ListenOpts::last): one per point, a second is refused as a Refused::Cycle (each would run after the other).
OVER_BUDGET_FACT
The name a host gives the fact it publishes for each OverBudget its budget sinks receive (Timings::add_budget_sink).
PLUGIN_DEADLINE
The deadline meant for listeners that answer from another process (a plugin over RPC): give it with ListenOpts::deadline or PointSpec::deadline.

Traits§

BusCrossing
Reaches the Relay capability of any bus: bus.relay().
BusDefer
Reaches the Defer capability of any bus: bus.defer().
BusJournal
Reaches the Journal capability of any bus: bus.journal().
BusTimings
Reaches the Timings capability of any bus: bus.timings().
BusTrace
The trace of a bus, found through its capability lookup.
Defer
A capability of a bus (BusDefer::defer): a request asked now, whose listeners run at the bus’s next drain on the same thread.
Journal
A capability of a bus (BusJournal::journal): events kept in order with a number, read again from a number, and delivered to their point’s listeners after the publisher has moved on.
Point
A hook point: one type per point, so its input and value are checked at compile time. Declared by the crate that owns the result.
Relay
A capability of a bus (BusCrossing::relay), on top of its Journal: what crosses a process boundary. The events of relayable points served to another process from a cursor and taken in from one as if published here; the asks of relayable request points answered here for another process.
RelayHost
What a host keeps for the kernel’s Relay (Kernel::with_relay): its journal’s entries read from a cursor and taken in from another process. The kernel answers asks and checks authorities and versions itself; the host only reads and records.
Relayed
An event point whose input can cross a process: written as text by one bus, read back by another (Relay).
RelayedRequest
A request point that can be answered by another process (Relay::answer): its value, as well as its input, written as text and read back.
Timings
A capability of a bus (BusTimings::timings): how long listeners take, per point and per listener, and the passes over a point’s budget (PointSpec::budget) reported as they happen.
Trace
A capability of a bus (BusTrace::trace): every emit, listener run, ask and drain reported to the sinks observing it, as it happens.

Functions§

ask_run
This process’s run, for the asks it sends (RelayedAsk::run): fixed while the process runs, another one after a restart.
check_id
Checks id against the naming rule of point and listener ids, <crate>.<subject>.<moment> (the README’s “Naming points”):
declare_all
Declares every point of a library’s contract table on bus; the refusals, in table order, each point refused left undeclared:
far_listener
The listener that stands, on the asking side, for the far side of a relayable request point: register it on the point here (with the point’s deadline and threaded, so the emit stops waiting at the deadline), and the far side’s listeners take their turn in this side’s order, at its place.
kind_matches
Whether the event kind kind matches pattern: the same id, or a prefix ending in .* (vault.* matches vault.changed), or * for every kind. Every implementation reads patterns this way.
missing_targets
The ordering constraints of points that name a listener not there: point: listener -> target. A test ends with none.
offers
Whether bus offers contract: it answers the lookup for the contract’s type (Bus::capability), and offers every contract it requires.
order_dump
The order the listeners of points run in, one point after the other, each listener with its owner and what it declares: “who runs when”, read rather than remembered.

Type Aliases§

Authority
Decides whether what crosses in may be taken (Relay::add_authority): Err(reason) refuses it.
TraceSink
Receives each TraceEvent, on the thread that made it.