pub struct ServiceConfig {
pub name: String,
pub port: u16,
pub enabled: bool,
}Expand description
Configuration for a managed service.
All services bind to 127.0.0.1 only. The bind address is always
constructed from LOCALHOST — callers cannot override it to
0.0.0.0 or any external interface.
Fields§
§name: StringHuman-readable service name.
port: u16Port number for the service.
enabled: boolWhether the service is enabled.
Implementations§
Source§impl ServiceConfig
impl ServiceConfig
Sourcepub fn new(name: impl Into<String>, port: u16) -> Self
pub fn new(name: impl Into<String>, port: u16) -> Self
Create a new service config bound to localhost on the given port.
The bind address is always 127.0.0.1:<port>.
Sourcepub fn socket_addr(&self) -> SocketAddr
pub fn socket_addr(&self) -> SocketAddr
Get the socket address for this service.
Always returns 127.0.0.1:<port>.
Sourcepub fn health_url(&self) -> String
pub fn health_url(&self) -> String
Get the health check URL for this service.
Returns http://127.0.0.1:<port>/health.
Sourcepub fn is_local_only(&self) -> bool
pub fn is_local_only(&self) -> bool
Validate that this config never binds to a non-local address.
Always returns true since the address is always constructed
from LOCALHOST.
Trait Implementations§
Source§impl Clone for ServiceConfig
impl Clone for ServiceConfig
Source§impl Debug for ServiceConfig
impl Debug for ServiceConfig
Source§impl<'de> Deserialize<'de> for ServiceConfig
impl<'de> Deserialize<'de> for ServiceConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ServiceConfig
impl PartialEq for ServiceConfig
Source§impl Serialize for ServiceConfig
impl Serialize for ServiceConfig
impl StructuralPartialEq for ServiceConfig
Auto Trait Implementations§
impl Freeze for ServiceConfig
impl RefUnwindSafe for ServiceConfig
impl Send for ServiceConfig
impl Sync for ServiceConfig
impl Unpin for ServiceConfig
impl UnsafeUnpin for ServiceConfig
impl UnwindSafe for ServiceConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more