Skip to content

Commit 395b684

Browse files
committed
tracing: add index API for Field
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent bac2508 commit 395b684

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tracing-core/src/field.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,11 @@ impl Field {
648648
pub fn name(&self) -> &'static str {
649649
self.fields.names[self.i]
650650
}
651+
652+
/// Returns the index of this field in its [`FieldSet`].
653+
pub fn index(&self) -> usize {
654+
self.i
655+
}
651656
}
652657

653658
impl fmt::Display for Field {

0 commit comments

Comments
 (0)