WireframeServer::new clones the application factory per worker, defaults the
worker count to the host CPU total (never below one), supports a readiness
signal, and normalizes accept-loop backoff settings through
accept_backoff.[^15][^16] Servers start in an unbound state; call bind or
bind_existing_listener to transition into the Bound typestate, inspect the
bound address, or rebind later.[^17]
run awaits Ctrl+C, while run_with_shutdown cancels all worker tasks when
the supplied future resolves.[^18] Each worker runs accept_loop, which clones
the factory, rewinds leftover preamble bytes, and hands the stream to the
application. Transient accept failures trigger exponential backoff capped by
the configured maximum delay.[^18][^19] Preamble hooks support asynchronous
success handlers and asynchronous failure callbacks that receive the stream,
enabling replies or decode-error logging before the application runs. An
optional preamble_timeout caps how long read_preamble waits; timeouts use
the failure callback path.[^20]
spawn_connection_task wraps each accepted stream in read_preamble and
RewindStream, records connection panics, and logs failures without crashing
worker tasks.[^20][^37][^38] ServerError surfaces bind and accept failures as
typed errors so callers can react appropriately.[^21]