mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
trace-core: Add 'static bound to Subscriber (#953)
This commit is contained in:
committed by
Carl Lerche
parent
9be5f3f9ff
commit
6fbef0a528
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user