Skip to content

Commit

Permalink
subscriber: rename trait CollectorExt to CollectExt
Browse files Browse the repository at this point in the history
The trait being augmented is the 'Collect' trait, so name the trait
that extends it 'CollectExt'.

This is in keeping with the extension trait naming conventions
documented in Rust RFC-445, and also with the spirit of the
discussion in tokio-rs/tracing PR tokio-rs#1015.
  • Loading branch information
salewski committed Nov 20, 2020
1 parent 1f3e095 commit 1ea6d5c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/examples/opentelemetry-remote-context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use opentelemetry::{global, Context};
use std::collections::HashMap;
use tracing::span;
use tracing_opentelemetry::OpenTelemetrySpanExt;
use tracing_subscriber::subscribe::CollectorExt;
use tracing_subscriber::subscribe::CollectExt;
use tracing_subscriber::Registry;

fn make_request(_cx: Context) {
Expand Down
6 changes: 3 additions & 3 deletions tracing-opentelemetry/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ where
/// # Examples
///
/// ```rust,no_run
/// use tracing_subscriber::subscribe::CollectorExt;
/// use tracing_subscriber::subscribe::CollectExt;
/// use tracing_subscriber::Registry;
///
/// // Use the tracing subscriber `Registry`, or any other subscriber
Expand Down Expand Up @@ -249,7 +249,7 @@ where
///
/// ```no_run
/// use tracing_opentelemetry::OpenTelemetryLayer;
/// use tracing_subscriber::subscribe::CollectorExt;
/// use tracing_subscriber::subscribe::CollectExt;
/// use tracing_subscriber::Registry;
///
/// // Create a jaeger exporter pipeline for a `trace_demo` service.
Expand Down Expand Up @@ -283,7 +283,7 @@ where
/// # Examples
///
/// ```no_run
/// use tracing_subscriber::subscribe::CollectorExt;
/// use tracing_subscriber::subscribe::CollectExt;
/// use tracing_subscriber::Registry;
///
/// // Create a jaeger exporter pipeline for a `trace_demo` service.
Expand Down
2 changes: 1 addition & 1 deletion tracing-opentelemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
//! ```
//! use opentelemetry::exporter::trace::stdout;
//! use tracing::{error, span};
//! use tracing_subscriber::subscribe::CollectorExt;
//! use tracing_subscriber::subscribe::CollectExt;
//! use tracing_subscriber::Registry;
//!
//! // Create a new OpenTelemetry pipeline
Expand Down
2 changes: 1 addition & 1 deletion tracing-subscriber/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use crate::field::{
RecordFields as __tracing_subscriber_field_RecordFields,
};
pub use crate::subscribe::{
CollectorExt as __tracing_subscriber_SubscriberExt, Subscribe as __tracing_subscriber_Layer,
CollectExt as __tracing_subscriber_SubscriberExt, Subscribe as __tracing_subscriber_Layer,
};

pub use crate::util::SubscriberInitExt as _;
14 changes: 7 additions & 7 deletions tracing-subscriber/src/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use std::{any::TypeId, marker::PhantomData};
/// particular `Collect` implementation, or additional trait bounds may be
/// added to constrain what types implementing `Collect` a subscriber can wrap.
///
/// Subscribers may be added to a `Collect` by using the [`CollectorExt::with`]
/// Subscribers may be added to a `Collect` by using the [`CollectExt::with`]
/// method, which is provided by `tracing-subscriber`'s [prelude]. This method
/// returns a [`Layered`] struct that implements `Collect` by composing the
/// subscriber with the collector.
Expand Down Expand Up @@ -143,8 +143,8 @@ use std::{any::TypeId, marker::PhantomData};
///
/// The [`Subscribe::with_collector` method][with-col] constructs the `Layered`
/// type from a `Subscribe` and `Collect`, and is called by
/// [`CollectorExt::with`]. In general, it is more idiomatic to use
/// `CollectorExt::with`, and treat `Subscribe::with_collector` as an
/// [`CollectExt::with`]. In general, it is more idiomatic to use
/// `CollectExt::with`, and treat `Subscribe::with_collector` as an
/// implementation detail, as `with_collector` calls must be nested, leading to
/// less clear code for the reader. However, subscribers which wish to perform
/// additional behavior when composed with a subscriber may provide their own
Expand Down Expand Up @@ -501,8 +501,8 @@ where
}
}

/// Extension trait adding a `with(Subscriber)` combinator to `Collector`s.
pub trait CollectorExt: Collect + crate::sealed::Sealed {
/// Extension trait adding a `with(Subscriber)` combinator to `Collect`.
pub trait CollectExt: Collect + crate::sealed::Sealed {
/// Wraps `self` with the provided `layer`.
fn with<S>(self, subscriber: S) -> Layered<S, Self>
where
Expand Down Expand Up @@ -921,10 +921,10 @@ where
// }
// }

// === impl CollectorExt ===
// === impl CollectExt ===

impl<C: Collect> crate::sealed::Sealed for C {}
impl<C: Collect> CollectorExt for C {}
impl<C: Collect> CollectExt for C {}

// === impl Context ===

Expand Down

0 comments on commit 1ea6d5c

Please sign in to comment.