From be471eb87f0987ab8794dab2aa96794481e2f2f7 Mon Sep 17 00:00:00 2001 From: Philipp Benner Date: Wed, 30 Oct 2024 19:58:40 +0100 Subject: [PATCH] 2024/10/30-19:58:40 (Linux VDI0092.zit.bam.de x86_64) --- src/range.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/range.rs b/src/range.rs index 0a0046c..69eb4e7 100644 --- a/src/range.rs +++ b/src/range.rs @@ -138,6 +138,18 @@ impl PartialEq for Range { /* -------------------------------------------------------------------------- */ impl fmt::Display for Range { + /// Formats the `Range` as a string for display. + /// + /// The format used is `[from, to)`, where `from` is inclusive and `to` is exclusive. + /// + /// # Examples + /// + /// ``` + /// use rustynetics::range::Range; + /// + /// let range = Range::new(5, 10); + /// println!("{}", range); // Output: [5, 10) + /// ``` fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad(&format!("[{}, {})", self.from, self.to)) }