gsk4/parse_location.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use std::fmt;
4
5glib::wrapper! {
6 #[doc(alias = "GskParseLocation")]
7 pub struct ParseLocation(BoxedInline<crate::ffi::GskParseLocation>);
8}
9
10impl ParseLocation {
11 #[inline]
12 pub fn bytes(&self) -> usize {
13 self.inner.bytes
14 }
15
16 #[inline]
17 pub fn chars(&self) -> usize {
18 self.inner.chars
19 }
20
21 #[inline]
22 pub fn lines(&self) -> usize {
23 self.inner.lines
24 }
25
26 #[inline]
27 pub fn line_bytes(&self) -> usize {
28 self.inner.line_bytes
29 }
30
31 #[inline]
32 pub fn line_chars(&self) -> usize {
33 self.inner.line_chars
34 }
35}
36
37impl fmt::Debug for ParseLocation {
38 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
39 f.debug_struct("ParseLocation")
40 .field("bytes", &self.bytes())
41 .field("chars", &self.chars())
42 .field("lines", &self.lines())
43 .field("line_bytes", &self.line_bytes())
44 .field("line_chars", &self.line_chars())
45 .finish()
46 }
47}