pub struct EmbeddedServer { /* private fields */ }Expand description
A bound loopback listener, not yet serving anything.
Implementations§
Source§impl EmbeddedServer
impl EmbeddedServer
Sourcepub async fn bind() -> Result<Self, NativeError>
pub async fn bind() -> Result<Self, NativeError>
Bind 127.0.0.1 on a port the operating system chooses.
There is deliberately no bind_to(host, port). Every reason to want
one — a fixed port for a bookmark, a LAN address for a second device —
is a reason a packaged application should not have.
Sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
The address that actually bound, port included.
Sourcepub fn base_url(&self) -> String
pub fn base_url(&self) -> String
Where to point the WebView.
127.0.0.1 rather than localhost: the name resolves to both stacks
and a WebView that tried ::1 first would spend a timeout on every
launch reaching a server that is not there. It is also the origin the
document will be on, and an origin that is decided by a resolver is one
that CSRF and the socket handshake’s origin check cannot rely on.
Auto Trait Implementations§
impl !Freeze for EmbeddedServer
impl RefUnwindSafe for EmbeddedServer
impl Send for EmbeddedServer
impl Sync for EmbeddedServer
impl Unpin for EmbeddedServer
impl UnsafeUnpin for EmbeddedServer
impl UnwindSafe for EmbeddedServer
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
Mutably borrows from an owned value. Read more