dmolokanov/appinsights-rs

Consider exporting a non-generic `TelemetryClient`

ranweiler opened this issue · 0 comments

TelemetryClient is actually generic in an (unconstrained) type C. All of the practically interesting impl's of TelemetryClient bound C: TelemetryChannel. Furthermore, the only ctors for TelemetryClient assume that C = InMemoryChannel, specifically.

For ergonomic reasons, consider hiding this abstraction from users, exposing the abstracted version separately.

One easy mechanism could be via exporting a type alias for TelemetryClient<InMemoryChannel>. But, thanks to the recent export of InMemoryChannel, users can do this themselves. My guess is that in practice, users will always want to use the default client that uses InMemoryChannel, and it would be fine to just assume this for the top-level export, letting exceptional users opt in to a more parameterized ("Ex") version.

Another way you could remove the generic parameter: enclose the channel in a Box<dyn TelemetryChannel>, at the cost of some indirection.