From 8abe8b7ebf667175bf1ba4f399a9a163de5b2e60 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 29 Aug 2022 05:05:04 -0700 Subject: [PATCH] rename `path` to `trace` --- valence_nbt/src/error.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/valence_nbt/src/error.rs b/valence_nbt/src/error.rs index 0f79d19..1927a30 100644 --- a/valence_nbt/src/error.rs +++ b/valence_nbt/src/error.rs @@ -14,7 +14,7 @@ pub struct Error { #[derive(Debug)] struct ErrorInner { - path: Vec, + trace: Vec, cause: Cause, } @@ -30,7 +30,7 @@ impl Error { pub(crate) fn new_owned(msg: impl Into>) -> Self { Self { inner: Box::new(ErrorInner { - path: Vec::new(), + trace: Vec::new(), cause: Cause::Owned(msg.into()), }), } @@ -39,32 +39,32 @@ impl Error { pub(crate) fn new_static(msg: &'static str) -> Self { Self { inner: Box::new(ErrorInner { - path: Vec::new(), + trace: Vec::new(), cause: Cause::Static(msg), }), } } pub(crate) fn field(mut self, ctx: impl Into) -> Self { - self.inner.path.push(ctx.into()); + self.inner.trace.push(ctx.into()); self } - pub fn path( + pub fn trace( &self, ) -> impl DoubleEndedIterator + ExactSizeIterator + FusedIterator + Clone + '_ { - self.inner.path.iter().rev().map(|s| s.as_str()) + self.inner.trace.iter().rev().map(|s| s.as_str()) } } impl Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let len = self.inner.path.len(); + let len = self.inner.trace.len(); if len > 0 { write!(f, "(")?; - for (i, ctx) in self.path().enumerate() { + for (i, ctx) in self.trace().enumerate() { write!(f, "{ctx}")?; if i != len - 1 { @@ -114,7 +114,7 @@ impl From for Error { fn from(e: io::Error) -> Self { Self { inner: Box::new(ErrorInner { - path: Vec::new(), + trace: Vec::new(), cause: Cause::Io(e), }), }