File tree Expand file tree Collapse file tree 4 files changed +67
-6
lines changed
Expand file tree Collapse file tree 4 files changed +67
-6
lines changed Original file line number Diff line number Diff line change 1+ version : 2
2+ updates :
3+ - package-ecosystem : cargo
4+ directory : " /"
5+ schedule :
6+ interval : daily
7+ open-pull-requests-limit : 10
8+ ignore :
9+ - dependency-name : opentelemetry-jaeger
10+ versions :
11+ - 0.12.0
12+ - dependency-name : opentelemetry
13+ versions :
14+ - 0.13.0
15+ - dependency-name : tokio-test
16+ versions :
17+ - 0.4.0
18+ - dependency-name : matchers
19+ versions :
20+ - 0.1.0
21+ - dependency-name : hyper
22+ versions :
23+ - 0.14.2
24+ - dependency-name : tower
25+ versions :
26+ - 0.4.1
27+ - dependency-name : bytes
28+ versions :
29+ - 1.0.0
Original file line number Diff line number Diff line change @@ -428,6 +428,19 @@ where
428428 }
429429}
430430
431+ impl < ' a , T : ?Sized > crate :: sealed:: Sealed for & ' a mut T where T : Value + crate :: sealed:: Sealed + ' a { }
432+
433+ impl < ' a , T : ?Sized > Value for & ' a mut T
434+ where
435+ T : Value + ' a ,
436+ {
437+ fn record ( & self , key : & Field , visitor : & mut dyn Visit ) {
438+ // Don't use `(*self).record(key, visitor)`, otherwise would
439+ // cause stack overflow due to `unconditional_recursion`.
440+ T :: record ( self , key, visitor)
441+ }
442+ }
443+
431444impl < ' a > crate :: sealed:: Sealed for fmt:: Arguments < ' a > { }
432445
433446impl < ' a > Value for fmt:: Arguments < ' a > {
Original file line number Diff line number Diff line change @@ -1268,14 +1268,14 @@ pub(crate) mod tests {
12681268 . and_then ( StringSubscriber2 ( "subscriber_2" . into ( ) ) )
12691269 . and_then ( StringSubscriber3 ( "subscriber_3" . into ( ) ) )
12701270 . with_collector ( NopCollector ) ;
1271- let subscriber =
1272- Collect :: downcast_ref :: < StringSubscriber > ( & s ) . expect ( "subscriber 2 should downcast" ) ;
1271+ let subscriber = < dyn Collect > :: downcast_ref :: < StringSubscriber > ( & s )
1272+ . expect ( "subscriber 2 should downcast" ) ;
12731273 assert_eq ! ( & subscriber. 0 , "subscriber_1" ) ;
1274- let subscriber =
1275- Collect :: downcast_ref :: < StringSubscriber2 > ( & s ) . expect ( "subscriber 2 should downcast" ) ;
1274+ let subscriber = < dyn Collect > :: downcast_ref :: < StringSubscriber2 > ( & s )
1275+ . expect ( "subscriber 2 should downcast" ) ;
12761276 assert_eq ! ( & subscriber. 0 , "subscriber_2" ) ;
1277- let subscriber =
1278- Collect :: downcast_ref :: < StringSubscriber3 > ( & s ) . expect ( "subscriber 3 should downcast" ) ;
1277+ let subscriber = < dyn Collect > :: downcast_ref :: < StringSubscriber3 > ( & s )
1278+ . expect ( "subscriber 3 should downcast" ) ;
12791279 assert_eq ! ( & subscriber. 0 , "subscriber_3" ) ;
12801280 }
12811281}
Original file line number Diff line number Diff line change 174174//! # fn main() {}
175175//! ```
176176//!
177+ //! For functions which don't have built-in tracing support and can't have
178+ //! the `#[instrument]` attribute applied (such as from an external crate,
179+ //! the [`Span` struct][`Span`] has a [`in_scope()` method][`in_scope`]
180+ //! which can be used to easily wrap synchonous code in a span.
181+ //!
182+ //! For example:
183+ //! ```rust
184+ //! use tracing::info_span;
185+ //!
186+ //! # fn doc() -> Result<(), ()> {
187+ //! # mod serde_json {
188+ //! # pub(crate) fn from_slice(buf: &[u8]) -> Result<(), ()> { Ok(()) }
189+ //! # }
190+ //! # let buf: [u8; 0] = [];
191+ //! let json = info_span!("json.parse").in_scope(|| serde_json::from_slice(&buf))?;
192+ //! # let _ = json; // suppress unused variable warning
193+ //! # Ok(())
194+ //! # }
195+ //! ```
177196//!
178197//! You can find more examples showing how to use this crate [here][examples].
179198//!
You can’t perform that action at this time.
0 commit comments