You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move RuntimeChannel type arg T to associated types (#1314)
RuntimeChannel::batch_message_channel needs to be generic over the
message type. The type used to be declared on the RuntimeChannel<T>
trait. This means a RuntimeChannel can only be used with one particular
message type, which feels unfortunate.
fn install<R: RuntimeChannel<??::BatchMessage>>(runtime: R) {
// Can't use the same runtime here. :-(
TracerProvider::builder().with_batch_exporter(e, runtime);
LoggerProvider::builder().with_batch_exporter(e, runtime);
}
This change moves the type argument to the batch_message_channel<T>
function and the associated types Receiver<T> and Sender<T>. Channels
are still specific to a message type, but a RuntimeChannel can be used
with any number of message types.
fn install<R: RuntimeChannel>(runtime: R) {
// It works. :-)
TracerProvider::builder().with_batch_exporter(e, runtime);
LoggerProvider::builder().with_batch_exporter(e, runtime);
}
This also means the BatchMessage types no longer need to be public.
0 commit comments