Skip to content

Commit f9f1c7e

Browse files
committed
Make as_any() required method for trait objects
1 parent 3e09af7 commit f9f1c7e

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

aws/rust-runtime/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-runtime/aws-smithy-observability-otel/src/meter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ impl ProvideMeter for OtelMeterProvider {
286286
fn get_meter(&self, scope: &'static str, _attributes: Option<&Attributes>) -> Meter {
287287
Meter::new(Arc::new(MeterWrap(self.meter_provider.meter(scope))))
288288
}
289+
290+
fn as_any(&self) -> &dyn std::any::Any {
291+
self
292+
}
289293
}
290294

291295
#[cfg(test)]

rust-runtime/aws-smithy-observability/src/meter.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ pub trait ProvideMeter: Send + Sync + Debug {
1919
fn get_meter(&self, scope: &'static str, attributes: Option<&Attributes>) -> Meter;
2020

2121
/// Returns a reference to `self` as `&dyn Any` for downcasting.
22-
fn as_any(&self) -> &dyn std::any::Any {
23-
self
24-
}
22+
fn as_any(&self) -> &dyn std::any::Any;
2523
}
2624

2725
/// The entry point to creating instruments. A grouping of related metrics.

rust-runtime/aws-smithy-observability/src/noop.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ impl ProvideMeter for NoopMeterProvider {
2424
fn get_meter(&self, _scope: &'static str, _attributes: Option<&Attributes>) -> Meter {
2525
Meter::new(Arc::new(NoopMeter))
2626
}
27+
28+
fn as_any(&self) -> &dyn std::any::Any {
29+
self
30+
}
2731
}
2832

2933
#[derive(Debug)]

0 commit comments

Comments
 (0)