| 1 | //! rs_tracing is a crate that outputs trace events to a file in the [trace event format]. |
| 2 | //! |
| 3 | //! This format is used by chrome://tracing the output can also be converted to html |
| 4 | //! with [trace2html]. |
| 5 | //! |
| 6 | //! If the feature rs_tracing is not set in the toml file the macros expand to nothing, |
| 7 | //! with the exception of trace_expr that will still execute the expression, |
| 8 | //! also all crate dependencies of rs_tracing will be removed. |
| 9 | //! |
| 10 | //! [trace2html]: https://github.com/catapult-project/catapult/blob/master/tracing/README.md |
| 11 | //! [trace event format]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview# |
| 12 | //! |
| 13 | |
| 14 | #[cfg(feature = "rs_tracing")] |
| 15 | extern crate serderust-analyzer cargo rs_tracing 1.1.0 serde/; |
| 16 | #[cfg(feature = "rs_tracing")] |
| 17 | extern crate serde_jsonrust-analyzer cargo rs_tracing 1.1.0 serde_json/; |
| 18 | #[doc(hidden)] |
| 19 | #[cfg(feature = "rs_tracing")] |
| 20 | pub use serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::{jsonrust-analyzer cargo serde_json 1.0.151 macros/json!, json_internalrust-analyzer cargo serde_json 1.0.151 macros/json_internal!}; |
| 21 | |
| 22 | #[doc(hidden)] |
| 23 | pub use internalrust-analyzer cargo rs_tracing 1.1.0 internal/::*; |
| 24 | |
| 25 | /// Activate tracing |
| 26 | /// |
| 27 | /// # Examples |
| 28 | /// |
| 29 | /// ``` |
| 30 | /// # #[macro_use] extern crate rs_tracing; |
| 31 | /// # fn main() { |
| 32 | /// { |
| 33 | /// trace_activate!(); |
| 34 | /// } |
| 35 | /// # } |
| 36 | /// ``` |
| 37 | #[macro_export] |
| 38 | macro_rules! trace_activaterust-analyzer cargo rs_tracing 1.1.0 trace_activate! { |
| 39 | () => { |
| 40 | trace_state_change!(&$crate::TraceState::Active) |
| 41 | }; |
| 42 | } |
| 43 | |
| 44 | /// Deactivate tracing |
| 45 | /// |
| 46 | /// # Examples |
| 47 | /// |
| 48 | /// ``` |
| 49 | /// # #[macro_use] extern crate rs_tracing; |
| 50 | /// # fn main() { |
| 51 | /// { |
| 52 | /// trace_deactivate!(); |
| 53 | /// } |
| 54 | /// # } |
| 55 | /// ``` |
| 56 | #[macro_export] |
| 57 | macro_rules! trace_deactivaterust-analyzer cargo rs_tracing 1.1.0 trace_deactivate! { |
| 58 | () => { |
| 59 | trace_state_change!(&$crate::TraceState::InActive) |
| 60 | }; |
| 61 | } |
| 62 | |
| 63 | /// Activates trace and opens a new trace file with the name \<pid\>.trace in the dir specified. |
| 64 | /// |
| 65 | /// # Examples |
| 66 | /// |
| 67 | /// ``` |
| 68 | /// # #[macro_use] extern crate rs_tracing; |
| 69 | /// # fn main() { |
| 70 | /// { |
| 71 | /// open_trace_file!("/tmp").unwrap(); |
| 72 | /// { |
| 73 | /// trace_scoped!("event name"); |
| 74 | /// println!("this is timed"); |
| 75 | /// } |
| 76 | /// close_trace_file!(); |
| 77 | /// } |
| 78 | /// # } |
| 79 | /// ``` |
| 80 | #[macro_export] |
| 81 | macro_rules! open_trace_filerust-analyzer cargo rs_tracing 1.1.0 open_trace_file! { |
| 82 | ($dir:expr) => { |
| 83 | trace_to_file_internal!($dir) |
| 84 | }; |
| 85 | } |
| 86 | |
| 87 | /// closes trace file |
| 88 | /// |
| 89 | /// note will not trace the trace_scoped end trace if called from the same scope. |
| 90 | #[macro_export] |
| 91 | macro_rules! close_trace_filerust-analyzer cargo rs_tracing 1.1.0 close_trace_file! { |
| 92 | () => { |
| 93 | close_trace_file_internal!() |
| 94 | }; |
| 95 | } |
| 96 | |
| 97 | /// Trace time used from invocation until end of current scope. |
| 98 | /// |
| 99 | /// The event type is [Complete Event (X)] with start time and duration. |
| 100 | /// |
| 101 | /// $name: name of the trace event. |
| 102 | /// |
| 103 | /// $json: optional custom data formated as serdes [json] macro. |
| 104 | /// |
| 105 | /// [Complete Event (X)]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.lpfof2aylapb |
| 106 | /// [json]: https://docs.serde.rs/serde_json/macro.json.html |
| 107 | /// # Examples |
| 108 | /// |
| 109 | /// ``` |
| 110 | /// # #[macro_use] extern crate rs_tracing; |
| 111 | /// # fn main() { |
| 112 | /// { |
| 113 | /// trace_scoped!("event name"); |
| 114 | /// println!("this is timed"); |
| 115 | /// } |
| 116 | /// # } |
| 117 | /// ``` |
| 118 | /// ``` |
| 119 | /// # #[macro_use] extern crate rs_tracing; |
| 120 | /// # fn main() { |
| 121 | /// { |
| 122 | /// trace_scoped!("event name","custom":"data","u32":4); |
| 123 | /// println!("this is timed"); |
| 124 | /// } |
| 125 | /// # } |
| 126 | /// ``` |
| 127 | #[macro_export] |
| 128 | macro_rules! trace_scopedrust-analyzer cargo rs_tracing 1.1.0 trace_scoped! { |
| 129 | ($name: expr) => { |
| 130 | trace_scoped_internal!($name) |
| 131 | }; |
| 132 | ($name: expr, $($json:tt)+) =>{ |
| 133 | trace_scoped_internal!($name, $($json)+) |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | /// trace time used for expression to finish. |
| 138 | /// |
| 139 | /// The event type is [Complete Event (X)] with start time and duration. |
| 140 | /// |
| 141 | /// $name: name of the trace event. |
| 142 | /// |
| 143 | /// $expr: expression to trace. |
| 144 | /// |
| 145 | /// $json: optional custom data formated as serdes [json] macro. |
| 146 | /// |
| 147 | /// [Complete Event (X)]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.lpfof2aylapb |
| 148 | /// [json]: https://docs.serde.rs/serde_json/macro.json.html |
| 149 | /// # Examples |
| 150 | /// |
| 151 | /// ``` |
| 152 | /// # #[macro_use] extern crate rs_tracing; |
| 153 | /// # fn main() { |
| 154 | /// let result = trace_expr!("event name", { println!("this is timed"); true}); |
| 155 | /// assert!(result, "result wasn't true!"); |
| 156 | /// # } |
| 157 | /// ``` |
| 158 | /// ``` |
| 159 | /// # #[macro_use] extern crate rs_tracing; |
| 160 | /// # fn main() { |
| 161 | /// let result = trace_expr!("event name",{ println!("this is timed"); true},"custom":"data","u32":4); |
| 162 | /// assert!(result, "result wasn't true!"); |
| 163 | /// # } |
| 164 | /// ``` |
| 165 | #[macro_export] |
| 166 | macro_rules! trace_exprrust-analyzer cargo rs_tracing 1.1.0 trace_expr! { |
| 167 | ($name: expr, $expr: expr) => { |
| 168 | trace_expr_internal!($name, $expr) |
| 169 | }; |
| 170 | ($name: expr, $expr: expr, $($json:tt)+) =>{ |
| 171 | trace_expr_internal!($name, $expr, $($json)+) |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | /// Mark beginning of event, needs to be followed by corresponding trace_end. |
| 176 | /// |
| 177 | /// The event type is [Duration Event (B)] with an instant time. |
| 178 | /// Start and end of the event must be on the same thread. |
| 179 | /// If you provide custom data to both the trace_begin and trace_end then |
| 180 | /// the arguments will be merged. |
| 181 | /// |
| 182 | /// $name: name of the trace event. |
| 183 | /// |
| 184 | /// $json: optional custom data formated as serdes [json] macro. |
| 185 | /// |
| 186 | /// [Duration Event (B)]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.nso4gcezn7n1 |
| 187 | /// [json]: https://docs.serde.rs/serde_json/macro.json.html |
| 188 | /// # Examples |
| 189 | /// |
| 190 | /// ``` |
| 191 | /// # #[macro_use] extern crate rs_tracing; |
| 192 | /// # fn main() { |
| 193 | /// trace_begin!("event name"); |
| 194 | /// println!("this is timed"); |
| 195 | /// trace_end!("event name"); |
| 196 | /// # } |
| 197 | /// ``` |
| 198 | /// ``` |
| 199 | /// # #[macro_use] extern crate rs_tracing; |
| 200 | /// # fn main() { |
| 201 | /// trace_begin!("event name","custom":"data"); |
| 202 | /// println!("this is timed"); |
| 203 | /// trace_end!("event name","u32":4); |
| 204 | /// # } |
| 205 | /// ``` |
| 206 | #[macro_export] |
| 207 | macro_rules! trace_beginrust-analyzer cargo rs_tracing 1.1.0 trace_begin! { |
| 208 | ($name: expr) => { |
| 209 | trace_duration_internal!($name, $crate::EventType::DurationBegin) |
| 210 | }; |
| 211 | ($name: expr, $($json:tt)+) =>{ |
| 212 | trace_duration_internal!($name, $crate::EventType::DurationBegin, $($json)+) |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | /// Mark end of event, needs to be proceeded by corresponding trace_begin. |
| 217 | /// |
| 218 | /// The event type is [Duration Event (E)] with an instant time. |
| 219 | /// Start and end of the event must be on the same thread. |
| 220 | /// If you provide custom data to both the trace_begin and trace_end then |
| 221 | /// the arguments will be merged. |
| 222 | /// |
| 223 | /// $name: name of the trace event. |
| 224 | /// |
| 225 | /// $json: optional custom data formated as serdes [json] macro. |
| 226 | /// |
| 227 | /// [Duration Event (E)]: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.nso4gcezn7n1 |
| 228 | /// [json]: https://docs.serde.rs/serde_json/macro.json.html |
| 229 | /// # Examples |
| 230 | /// |
| 231 | /// ``` |
| 232 | /// # #[macro_use] extern crate rs_tracing; |
| 233 | /// # fn main() { |
| 234 | /// trace_begin!("event name"); |
| 235 | /// println!("this is timed"); |
| 236 | /// trace_end!("event name"); |
| 237 | /// # } |
| 238 | /// ``` |
| 239 | /// ``` |
| 240 | /// # #[macro_use] extern crate rs_tracing; |
| 241 | /// # fn main() { |
| 242 | /// trace_begin!("event name","custom":"data"); |
| 243 | /// println!("this is timed"); |
| 244 | /// trace_end!("event name","u32":4); |
| 245 | /// # } |
| 246 | /// ``` |
| 247 | #[macro_export] |
| 248 | macro_rules! trace_endrust-analyzer cargo rs_tracing 1.1.0 trace_end! { |
| 249 | ($name: expr) => { |
| 250 | trace_duration_internal!($name, $crate::EventType::DurationEnd) |
| 251 | }; |
| 252 | ($name: expr, $($json:tt)+) =>{ |
| 253 | trace_duration_internal!($name, $crate::EventType::DurationEnd, $($json)+) |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | #[cfg(feature = "rs_tracing")] |
| 258 | mod internalrust-analyzer cargo rs_tracing 1.1.0 internal/ { |
| 259 | |
| 260 | use serderust-analyzer cargo serde 1.0.229 crate/::serrust-analyzer cargo serde_core 1.0.229 ser/::{Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize#, SerializeStructrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#, Serializerrust-analyzer cargo serde_core 1.0.229 ser/Serializer#}; |
| 261 | use serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/; |
| 262 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::{DirBuilderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/DirBuilder#, Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#}; |
| 263 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, BufWriterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/BufWriter#, Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#}; |
| 264 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().; |
| 265 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 266 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/; |
| 267 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::atomicrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/::{AtomicBoolrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicBool#, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#}; |
| 268 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#; |
| 269 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::threadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/, ThreadIdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/id/ThreadId#}; |
| 270 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#; |
| 271 | |
| 272 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 273 | pub enum TraceStaterust-analyzer cargo rs_tracing 1.1.0 internal/TraceState# { |
| 274 | InActiverust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#InActive#, |
| 275 | Activerust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#Active#, |
| 276 | } |
| 277 | |
| 278 | static mut TRACERrust-analyzer cargo rs_tracing 1.1.0 internal/TRACER.: Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<BufWriterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/BufWriter#<Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#>>> = Mutexrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/Mutex#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]new().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 279 | static mut TRACE_ACTIVErust-analyzer cargo rs_tracing 1.1.0 internal/TRACE_ACTIVE.: AtomicBoolrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicBool# = AtomicBoolrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicBool#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicBool]new().(false); |
| 280 | |
| 281 | pub fn tracerust-analyzer cargo rs_tracing 1.1.0 internal/trace().(event: &TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#) { |
| 282 | unsafe { |
| 283 | let mut tracer = TRACERrust-analyzer cargo rs_tracing 1.1.0 internal/TRACER..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 284 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref mut file) = *rust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`MutexGuard<'_, T>`][DerefMut]deref_mut().tracer { |
| 285 | serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::to_writerrust-analyzer cargo serde_json 1.0.151 ser/to_writer().(&mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().file, event).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 286 | file.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/impl#[`BufWriter<W>`][Write]write_all().(b",\n").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | pub fn set_trace_staterust-analyzer cargo rs_tracing 1.1.0 internal/set_trace_state().(state: &'static TraceStaterust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#) { |
| 292 | unsafe { |
| 293 | TRACE_ACTIVErust-analyzer cargo rs_tracing 1.1.0 internal/TRACE_ACTIVE..storerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicBool]store().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().state rust-analyzer cargo rs_tracing 1.1.0 internal/impl#[TraceState][`PartialEq<Self>`]eq().==rust-analyzer cargo rs_tracing 1.1.0 internal/impl#[TraceState][`PartialEq<Self>`]eq(). rust-analyzer cargo rs_tracing 1.1.0 internal/impl#[TraceState][`PartialEq<Self>`]eq().TraceStaterust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#::Activerust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#Active#, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::SeqCstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#SeqCst#); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | pub fn is_trace_activerust-analyzer cargo rs_tracing 1.1.0 internal/is_trace_active().() -> bool { |
| 298 | unsafe { TRACE_ACTIVErust-analyzer cargo rs_tracing 1.1.0 internal/TRACE_ACTIVE..loadrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicBool]load().(Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::SeqCstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#SeqCst#) } |
| 299 | } |
| 300 | |
| 301 | #[doc(hidden)] |
| 302 | pub enum EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType# { |
| 303 | DurationBeginrust-analyzer cargo rs_tracing 1.1.0 internal/EventType#DurationBegin#, |
| 304 | DurationEndrust-analyzer cargo rs_tracing 1.1.0 internal/EventType#DurationEnd#, |
| 305 | Completerust-analyzer cargo rs_tracing 1.1.0 internal/EventType#Complete#, |
| 306 | } |
| 307 | |
| 308 | impl Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# for EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType# { |
| 309 | #[doc(hidden)] |
| 310 | fn serializerust-analyzer cargo rs_tracing 1.1.0 internal/impl#[EventType][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> |
| 311 | where |
| 312 | S: Serializerrust-analyzer cargo serde_core 1.0.229 ser/Serializer#, |
| 313 | { |
| 314 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 315 | EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType#::DurationBeginrust-analyzer cargo rs_tracing 1.1.0 internal/EventType#DurationBegin# => serializer.serialize_unit_variantrust-analyzer cargo serde_core 1.0.229 ser/Serializer#serialize_unit_variant().("EventType", 0, "B"), |
| 316 | EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType#::DurationEndrust-analyzer cargo rs_tracing 1.1.0 internal/EventType#DurationEnd# => serializer.serialize_unit_variantrust-analyzer cargo serde_core 1.0.229 ser/Serializer#serialize_unit_variant().("EventType", 1, "E"), |
| 317 | EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType#::Completerust-analyzer cargo rs_tracing 1.1.0 internal/EventType#Complete# => serializer.serialize_unit_variantrust-analyzer cargo serde_core 1.0.229 ser/Serializer#serialize_unit_variant().("EventType", 2, "X"), |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | #[doc(hidden)] |
| 323 | pub struct TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#<'a> { |
| 324 | namerust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#name.: &'a str, |
| 325 | phrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ph.: EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType#, |
| 326 | pub tsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ts.: u128, |
| 327 | pidrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#pid.: u32, |
| 328 | tidrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#tid.: u64, |
| 329 | pub durrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#dur.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u128>, |
| 330 | argsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#args.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::Valuerust-analyzer cargo serde_json 1.0.151 value/Value#>, |
| 331 | } |
| 332 | |
| 333 | impl<'a> Serializerust-analyzer cargo serde_core 1.0.229 ser/Serialize# for TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#<'a> { |
| 334 | #[doc(hidden)] |
| 335 | fn serializerust-analyzer cargo rs_tracing 1.1.0 internal/impl#[`TraceEvent<'a>`][Serialize]serialize().<S>(&self, serializer: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.229 ser/Serializer#Error#> |
| 336 | where |
| 337 | S: Serializerrust-analyzer cargo serde_core 1.0.229 ser/Serializer#, |
| 338 | { |
| 339 | let mut event = serializer.serialize_structrust-analyzer cargo serde_core 1.0.229 ser/Serializer#serialize_struct().("TraceEvent", 7)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 340 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("name", &self.namerust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#name.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 341 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("ph", &self.phrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ph.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 342 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("ts", &self.tsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ts.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 343 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("pid", &self.pidrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#pid.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 344 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("tid", &self.tidrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#tid.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 345 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref dur) = self.durrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#dur. { |
| 346 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("dur", &dur)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 347 | } |
| 348 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref args) = self.argsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#args. { |
| 349 | event.serialize_fieldrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#serialize_field().("args", &args)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 350 | } |
| 351 | event.endrust-analyzer cargo serde_core 1.0.229 ser/SerializeStruct#end().() |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | impl<'a> TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#<'a> { |
| 356 | #[doc(hidden)] |
| 357 | pub fn newrust-analyzer cargo rs_tracing 1.1.0 internal/impl#[`TraceEvent<'a>`]new().(name: &'a str, event_type: EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType#, args: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::Valuerust-analyzer cargo serde_json 1.0.151 value/Value#>) -> Selfrust-analyzer cargo rs_tracing 1.1.0 internal/impl#[`TraceEvent<'a>`] { |
| 358 | TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent# { |
| 359 | namerust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#name., |
| 360 | phrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ph.: event_type, |
| 361 | tsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ts.: precise_time_microsecrust-analyzer cargo rs_tracing 1.1.0 internal/precise_time_microsec().(), |
| 362 | pidrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#pid.: processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::idrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/id().(), |
| 363 | tidrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#tid.: unsafe { |
| 364 | // only want an unique identifier per thread think this is ok. |
| 365 | transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().::<ThreadIdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/id/ThreadId#, u64>(threadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/::currentrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/current/current().().idrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/thread/impl#[Thread]id().()) |
| 366 | }, |
| 367 | durrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#dur.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 368 | argsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#args., |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | #[doc(hidden)] |
| 374 | pub struct EventGuardrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#<'a> { |
| 375 | eventrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#event.: TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#<'a>, |
| 376 | } |
| 377 | |
| 378 | impl<'a> EventGuardrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#<'a> { |
| 379 | #[doc(hidden)] |
| 380 | pub fn newrust-analyzer cargo rs_tracing 1.1.0 internal/impl#[`EventGuard<'a>`]new().(name: &'a str, args: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<serde_jsonrust-analyzer cargo serde_json 1.0.151 crate/::Valuerust-analyzer cargo serde_json 1.0.151 value/Value#>) -> EventGuardrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#<'a> { |
| 381 | EventGuardrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard# { |
| 382 | eventrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#event.: TraceEventrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#::newrust-analyzer cargo rs_tracing 1.1.0 internal/impl#[`TraceEvent<'a>`]new().(name, EventTyperust-analyzer cargo rs_tracing 1.1.0 internal/EventType#::Completerust-analyzer cargo rs_tracing 1.1.0 internal/EventType#Complete#, args), |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | impl<'a> Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for EventGuardrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#<'a> { |
| 388 | #[doc(hidden)] |
| 389 | fn droprust-analyzer cargo rs_tracing 1.1.0 internal/impl#[`EventGuard<'a>`][Drop]drop().(&mut self) { |
| 390 | self.eventrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#event..durrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#dur. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(precise_time_microsecrust-analyzer cargo rs_tracing 1.1.0 internal/precise_time_microsec().().saturating_subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u128]saturating_sub().(self.eventrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#event..tsrust-analyzer cargo rs_tracing 1.1.0 internal/TraceEvent#ts.)); |
| 391 | tracerust-analyzer cargo rs_tracing 1.1.0 internal/trace().(&self.eventrust-analyzer cargo rs_tracing 1.1.0 internal/EventGuard#event.); |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | pub fn init_trace_to_filerust-analyzer cargo rs_tracing 1.1.0 internal/init_trace_to_file().<P: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(dir: P) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 396 | let mut tracer = unsafe { TRACERrust-analyzer cargo rs_tracing 1.1.0 internal/TRACER..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() }; |
| 397 | let mut dir_path = PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]new().(); |
| 398 | dir_path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(dir); |
| 399 | let mut file_path = dir_path.clonerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][Clone]clone().(); |
| 400 | file_path.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::idrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/id().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 401 | file_path.set_extensionrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]set_extension().("trace"); |
| 402 | let file = DirBuilderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/DirBuilder#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirBuilder]new().() |
| 403 | .recursiverust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirBuilder]recursive().(true) |
| 404 | .createrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirBuilder]create().(dir_path) |
| 405 | .andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and().(Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::createrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]create().(file_path))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 406 | let mut writer = BufWriterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/BufWriter#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/impl#[`BufWriter<W>`]new().(file); |
| 407 | writer.write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/impl#[`BufWriter<W>`][Write]write_all().(b"[")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 408 | *rust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`MutexGuard<'_, T>`][DerefMut]deref_mut().tracer = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(writer); |
| 409 | set_trace_staterust-analyzer cargo rs_tracing 1.1.0 internal/set_trace_state().(&TraceStaterust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#::Activerust-analyzer cargo rs_tracing 1.1.0 internal/TraceState#Active#); |
| 410 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 411 | } |
| 412 | |
| 413 | pub fn close_trace_file_fnrust-analyzer cargo rs_tracing 1.1.0 internal/close_trace_file_fn().() { |
| 414 | let mut tracer = unsafe { TRACERrust-analyzer cargo rs_tracing 1.1.0 internal/TRACER..lockrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`Mutex<T>`]lock().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() }; |
| 415 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref mut file) = *rust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`MutexGuard<'_, T>`][DerefMut]deref_mut().tracer { |
| 416 | (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().file).flushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/impl#[`BufWriter<W>`][Write]flush().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 417 | } |
| 418 | *rust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/poison/mutex/impl#[`MutexGuard<'_, T>`][DerefMut]deref_mut().tracer = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 419 | } |
| 420 | |
| 421 | #[doc(hidden)] |
| 422 | pub fn precise_time_microsecrust-analyzer cargo rs_tracing 1.1.0 internal/precise_time_microsec().() -> u128 { |
| 423 | SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]now().() |
| 424 | .duration_sincerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]duration_since().(SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#::UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]UNIX_EPOCH.) |
| 425 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("SystemTime is before UNIX EPOCH") |
| 426 | .as_microsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]as_micros().() |
| 427 | } |
| 428 | |
| 429 | #[doc(hidden)] |
| 430 | #[macro_export] |
| 431 | macro_rules! trace_state_changerust-analyzer cargo rs_tracing 1.1.0 internal/trace_state_change! { |
| 432 | ($state:expr) => { |
| 433 | $crate::set_trace_state($state) |
| 434 | }; |
| 435 | } |
| 436 | |
| 437 | #[doc(hidden)] |
| 438 | #[macro_export] |
| 439 | macro_rules! trace_to_file_internalrust-analyzer cargo rs_tracing 1.1.0 internal/trace_to_file_internal! { |
| 440 | ($dir:expr) => { |
| 441 | $crate::init_trace_to_file($dir) |
| 442 | }; |
| 443 | } |
| 444 | |
| 445 | #[doc(hidden)] |
| 446 | #[macro_export] |
| 447 | macro_rules! close_trace_file_internalrust-analyzer cargo rs_tracing 1.1.0 internal/close_trace_file_internal! { |
| 448 | () => { |
| 449 | $crate::close_trace_file_fn(); |
| 450 | }; |
| 451 | } |
| 452 | |
| 453 | #[doc(hidden)] |
| 454 | #[macro_export] |
| 455 | macro_rules! trace_scoped_internalrust-analyzer cargo rs_tracing 1.1.0 internal/trace_scoped_internal! { |
| 456 | ($name: expr) => { |
| 457 | let _guard = if $crate::is_trace_active() { |
| 458 | Some($crate::EventGuard::new($name, None)) |
| 459 | }else{ |
| 460 | None |
| 461 | }; |
| 462 | }; |
| 463 | ($name: expr, $($json:tt)+) =>{ |
| 464 | let _guard = if $crate::is_trace_active() { |
| 465 | Some($crate::EventGuard::new($name, Some(json!({$($json)+})))) |
| 466 | }else{ |
| 467 | None |
| 468 | }; |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | #[doc(hidden)] |
| 473 | #[macro_export] |
| 474 | macro_rules! trace_expr_internalrust-analyzer cargo rs_tracing 1.1.0 internal/trace_expr_internal! { |
| 475 | ($name: expr, $expr: expr) => { |
| 476 | if $crate::is_trace_active() { |
| 477 | let mut event = $crate::TraceEvent::new($name, $crate::EventType::Complete, None); |
| 478 | let result = $expr; |
| 479 | event.dur = Some($crate::precise_time_microsec() - event.ts); |
| 480 | $crate::trace(&event); |
| 481 | result |
| 482 | }else{ |
| 483 | $expr |
| 484 | } |
| 485 | }; |
| 486 | ($name: expr, $expr: expr, $($json:tt)+) =>{ |
| 487 | if $crate::is_trace_active() { |
| 488 | let mut event = $crate::TraceEvent::new($name, $crate::EventType::Complete, Some(json!({$($json)+}))); |
| 489 | let result = $expr; |
| 490 | event.dur = Some($crate::precise_time_microsec() - event.ts); |
| 491 | $crate::trace(&event); |
| 492 | result |
| 493 | }else{ |
| 494 | $expr |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | #[doc(hidden)] |
| 500 | #[macro_export] |
| 501 | macro_rules! trace_duration_internalrust-analyzer cargo rs_tracing 1.1.0 internal/trace_duration_internal! { |
| 502 | ($name: expr, $event_type: expr) => { |
| 503 | if $crate::is_trace_active() { |
| 504 | let event = $crate::TraceEvent::new($name, $event_type, None); |
| 505 | $crate::trace(&event); |
| 506 | } |
| 507 | }; |
| 508 | ($name: expr, $event_type: expr, $($json:tt)+) =>{ |
| 509 | if $crate::is_trace_active() { |
| 510 | let event = $crate::TraceEvent::new($name, $event_type, Some(json!({$($json)+}))); |
| 511 | $crate::trace(&event); |
| 512 | } |
| 513 | } |
| 514 | } |
| 515 | } // mod internal |
| 516 | |
| 517 | #[cfg(not(feature = "rs_tracing"))] |
| 518 | mod internalrust-analyzer cargo rs_tracing 1.1.0 internal/ { |
| 519 | #[doc(hidden)] |
| 520 | #[macro_export] |
| 521 | macro_rules! trace_state_change { |
| 522 | ($state:expr) => {}; |
| 523 | } |
| 524 | |
| 525 | #[doc(hidden)] |
| 526 | #[macro_export] |
| 527 | macro_rules! trace_to_file_internal { |
| 528 | ($dir:expr) => {{ |
| 529 | let result: std::io::Result<()> = Ok(()); |
| 530 | result |
| 531 | }}; |
| 532 | } |
| 533 | |
| 534 | #[doc(hidden)] |
| 535 | #[macro_export] |
| 536 | macro_rules! close_trace_file_internal { |
| 537 | () => {}; |
| 538 | } |
| 539 | |
| 540 | #[doc(hidden)] |
| 541 | #[macro_export] |
| 542 | macro_rules! trace_scoped_internal { |
| 543 | ($($some:tt)+) => {}; |
| 544 | } |
| 545 | |
| 546 | #[doc(hidden)] |
| 547 | #[macro_export] |
| 548 | macro_rules! trace_expr_internal { |
| 549 | ($name:expr, $expr:expr) => { |
| 550 | $expr |
| 551 | }; |
| 552 | ($name:expr, $expr:expr, $($json:tt)+) => { |
| 553 | $expr |
| 554 | }; |
| 555 | } |
| 556 | |
| 557 | #[doc(hidden)] |
| 558 | #[macro_export] |
| 559 | macro_rules! trace_duration_internal { |
| 560 | ($($some:tt)+) => {}; |
| 561 | } |
| 562 | } // mod internal |