Refine posistion display.

This commit is contained in:
Stephen Chung
2021-04-23 14:24:53 +08:00
parent 1fbbb2a40d
commit fc782c5563
5 changed files with 79 additions and 115 deletions

View File

@@ -185,6 +185,16 @@ impl Position {
#[cfg(feature = "no_position")]
return true;
}
/// Print this [`Position`] for debug purposes.
#[inline(always)]
pub(crate) fn debug_print(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[cfg(not(feature = "no_position"))]
if !self.is_none() {
write!(f, " @ {:?}", self)?;
}
Ok(())
}
}
impl Default for Position {