trace-core: Add 'static bound to Subscriber (#953)

This commit is contained in:
Eliza Weisman
2019-03-07 11:54:21 -08:00
committed by Carl Lerche
parent 9be5f3f9ff
commit 6fbef0a528
2 changed files with 10 additions and 4 deletions
+9 -3
View File
@@ -57,7 +57,10 @@ pub fn mock() -> MockSubscriber<fn(&Metadata) -> bool> {
}
}
impl<F: Fn(&Metadata) -> bool> MockSubscriber<F> {
impl<F> MockSubscriber<F>
where
F: Fn(&Metadata) -> bool + 'static,
{
pub fn enter(mut self, span: MockSpan) -> Self {
self.expected.push_back(Expect::Enter(span));
self
@@ -106,7 +109,7 @@ impl<F: Fn(&Metadata) -> bool> MockSubscriber<F> {
pub fn with_filter<G>(self, filter: G) -> MockSubscriber<G>
where
G: Fn(&Metadata) -> bool,
G: Fn(&Metadata) -> bool + 'static,
{
MockSubscriber {
filter,
@@ -133,7 +136,10 @@ impl<F: Fn(&Metadata) -> bool> MockSubscriber<F> {
}
}
impl<F: Fn(&Metadata) -> bool> Subscriber for Running<F> {
impl<F> Subscriber for Running<F>
where
F: Fn(&Metadata) -> bool + 'static,
{
fn enabled(&self, meta: &Metadata) -> bool {
(self.filter)(meta)
}
@@ -33,7 +33,7 @@ use {field, span, Event, Metadata};
///
/// [ID]: ::span::Span
/// [`new_span`]: ::Span::new_span
pub trait Subscriber {
pub trait Subscriber: 'static {
// === Span registry methods ==============================================
/// Registers a new callsite with this subscriber, returning whether or not