Skip to content

Commit b239b71

Browse files
committed
feat: impl<T: Collector> Collector for std::sync::Arc<T>
Signed-off-by: hanabi1224 <harlowmoo@gmail.com>
1 parent adc7c4e commit b239b71

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/collector.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ pub trait Collector: std::fmt::Debug + Send + Sync + 'static {
3939
/// Once the [`Collector`] is registered, this method is called on each scrape.
4040
fn encode(&self, encoder: DescriptorEncoder) -> Result<(), std::fmt::Error>;
4141
}
42+
43+
impl<T: Collector> Collector for std::sync::Arc<T> {
44+
fn encode(&self, encoder: DescriptorEncoder) -> Result<(), std::fmt::Error> {
45+
self.as_ref().encode(encoder)
46+
}
47+
}

0 commit comments

Comments
 (0)