Skip to content

Commit

Permalink
tracing: add index API for Field
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed May 7, 2024
1 parent 690a9a6 commit 1360686
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tracing-core/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,11 @@ impl Field {
pub fn name(&self) -> &'static str {
self.fields.names[self.i]
}

/// Returns the index of this field in its [`FieldSet`].
pub fn index(&self) -> usize {
self.i
}
}

impl fmt::Display for Field {
Expand Down

0 comments on commit 1360686

Please sign in to comment.