pub struct ShellServer { /* private fields */ }Expand description
A bound-but-not-yet-serving shell server.
Implementations§
Source§impl ShellServer
impl ShellServer
Sourcepub async fn bind(config: ShellConfig) -> Result<Self, HostError>
pub async fn bind(config: ShellConfig) -> Result<Self, HostError>
Validates the asset root and the served config contract, then binds the listener.
§Errors
Refuses an unreadable or non-directory asset root, a root without
index.html, a config the shell’s contract would refuse (empty
busEndpoint, empty provided channel), and any bind failure —
all typed. Serving a config the shell will refuse at parse time is a
composition error the host catches here, not in the browser.
Sourcepub fn adopt(
listener: TcpListener,
config: ShellConfig,
) -> Result<Self, HostError>
pub fn adopt( listener: TcpListener, config: ShellConfig, ) -> Result<Self, HostError>
Adopts an ALREADY-BOUND listener (from crate::page::PageServer)
instead of binding its own, then validates the served config contract
exactly as Self::bind does.
The page-server port is resolved and BOUND up front (prefer-and-walk, or
stated-and-exact) before the embedded bus boots, so its real address can
seed the bus’s derived origin allow-list. Handing the held listener
straight here — rather than probing a port, dropping it, and re-binding
— is what makes that resolution race-free: no other process can claim
the port in between. config.bind is ignored (the listener is already
bound); the real bound address is read from the listener itself.
§Errors
Refuses the same config-contract and asset-root violations as
Self::bind, and any failure converting the adopted std listener to a
non-blocking async listener.
Sourcepub const fn local_addr(&self) -> SocketAddr
pub const fn local_addr(&self) -> SocketAddr
The address actually bound (resolves an ephemeral port request).
Auto Trait Implementations§
impl !Freeze for ShellServer
impl !RefUnwindSafe for ShellServer
impl !UnwindSafe for ShellServer
impl Send for ShellServer
impl Sync for ShellServer
impl Unpin for ShellServer
impl UnsafeUnpin for ShellServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request