pub struct Service { /* private fields */ }
Implementations§
Source§impl Service
impl Service
pub fn counter<L: Clone + Debug + EncodeLabelSet + Eq + Hash + Send + Sync + 'static>( self, name: impl AsRef<str>, description: impl AsRef<str>, ) -> Self
pub fn gauge<L: Clone + Debug + EncodeLabelSet + Eq + Hash + Send + Sync + 'static>( self, name: impl AsRef<str>, description: impl AsRef<str>, ) -> Self
pub fn histogram<L: Clone + Debug + EncodeLabelSet + Eq + Hash + Send + Sync + 'static>( self, name: impl AsRef<str>, description: impl AsRef<str>, buckets: &[f64], ) -> Self
Sourcepub fn run<CFG>(self, svc: impl FnOnce(CFG) + Clone + UnwindSafe) -> !
pub fn run<CFG>(self, svc: impl FnOnce(CFG) + Clone + UnwindSafe) -> !
Run the service under suitable supervision.
The name
given influences the names of metrics and the environment variables that will be
examined to determine the service configuration, while the svc
function is what you provide
as the entrypoint to the service to be run. If that function exits (which it shouldn’t), or
panics (which it definitely shouldn’t, but might), it will be restarted.
§Panics
As this function doesn’t normally exit, it will panic if any fatal error occurs, such as if the logger cannot be started, or if the service configuration cannot be correctly extracted from the environment.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
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