pub struct Core { /* private fields */ }
Expand description
Core is the base metrics struct. It manages the mapping between the metrics name and the actual metrics. It also carries a single prometheus registry to be used by all metrics.
Implementations§
Source§impl Core
impl Core
Sourcepub fn init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>(f: F)
pub fn init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>(f: F)
Must only be called once to init metrics.
Panics if called a second time.
Sourcepub fn try_init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>(
f: F,
) -> Result<()>
pub fn try_init<F: FnOnce(&mut Registry, &mut ErasedSyncSet)>( f: F, ) -> Result<()>
Trieds to init the metrics.
Sourcepub fn get_collector<T: Metric>(&self) -> Option<&T>
pub fn get_collector<T: Metric>(&self) -> Option<&T>
Returns a reference to the mapped metrics instance.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Core
impl !RefUnwindSafe for Core
impl Send for Core
impl Sync for Core
impl Unpin for Core
impl !UnwindSafe for Core
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