pgn_reader/
comment.rs

1use std::fmt;
2
3/// A comment, excluding the braces.
4#[derive(Copy, Clone, Eq, PartialEq, Hash)]
5pub struct RawComment<'a>(pub &'a [u8]);
6
7impl<'a> RawComment<'a> {
8    /// Returns the raw byte representation of the comment.
9    pub fn as_bytes(&self) -> &[u8] {
10        self.0
11    }
12}
13
14impl<'a> fmt::Debug for RawComment<'a> {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        write!(f, "{:?}", String::from_utf8_lossy(self.as_bytes()).as_ref())
17    }
18}
19
20#[cfg(test)]
21mod tests {}