pub struct ServiceConfigBuilder { /* private fields */ }Expand description
Fluent builder for ServiceConfig.
Implementations§
Source§impl ServiceConfigBuilder
impl ServiceConfigBuilder
Sourcepub fn nacos_addr(self, addr: impl Into<String>) -> Self
pub fn nacos_addr(self, addr: impl Into<String>) -> Self
Set the Nacos server address (host:port).
Sourcepub fn service_name(self, name: impl Into<String>) -> Self
pub fn service_name(self, name: impl Into<String>) -> Self
Set the service name.
Sourcepub fn group(self, group: impl Into<String>) -> Self
pub fn group(self, group: impl Into<String>) -> Self
Set the service group (defaults to DEFAULT_GROUP).
Sourcepub fn service_host(self, host: impl Into<String>) -> Self
pub fn service_host(self, host: impl Into<String>) -> Self
Set the advertised host registered to Nacos (defaults to the local IP).
Sourcepub fn service_port(self, port: u16) -> Self
pub fn service_port(self, port: u16) -> Self
Set the advertised port registered to Nacos.
Sourcepub fn bind_addr(self, addr: impl AsRef<str>) -> Result<Self>
pub fn bind_addr(self, addr: impl AsRef<str>) -> Result<Self>
Parse the port out of a host:port string; the host portion is not used (the
advertised host comes from service_host or the local IP).
Provided for compatibility with the SERVICE_ADDR environment variable convention.
Sourcepub fn ephemeral(self, ephemeral: bool) -> Self
pub fn ephemeral(self, ephemeral: bool) -> Self
Set whether the instance is ephemeral (defaults to true).
Sourcepub fn auth(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Set the auth credentials.
Sourcepub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self
Insert a single metadata entry.
Sourcepub fn metadata_all<I, K, V>(self, entries: I) -> Self
pub fn metadata_all<I, K, V>(self, entries: I) -> Self
Insert multiple metadata entries at once.
Sourcepub fn build(self) -> Result<ServiceConfig>
pub fn build(self) -> Result<ServiceConfig>
Validate and build the ServiceConfig.
Trait Implementations§
Source§impl Clone for ServiceConfigBuilder
impl Clone for ServiceConfigBuilder
Source§fn clone(&self) -> ServiceConfigBuilder
fn clone(&self) -> ServiceConfigBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServiceConfigBuilder
impl Debug for ServiceConfigBuilder
Source§impl Default for ServiceConfigBuilder
impl Default for ServiceConfigBuilder
Source§fn default() -> ServiceConfigBuilder
fn default() -> ServiceConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ServiceConfigBuilder
impl RefUnwindSafe for ServiceConfigBuilder
impl Send for ServiceConfigBuilder
impl Sync for ServiceConfigBuilder
impl Unpin for ServiceConfigBuilder
impl UnsafeUnpin for ServiceConfigBuilder
impl UnwindSafe for ServiceConfigBuilder
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,
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>
Wrap the input message
T in a tonic::Request