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 Jan 29, 2024
1 parent baeba47 commit a5b4ce1
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 @@ -648,6 +648,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 a5b4ce1

Please sign in to comment.