Add Marker::default and pub to new.

This commit is contained in:
Ethiraric 2024-06-13 22:05:54 +02:00
parent c3d83fbfe1
commit f8f6281e41

View file

@ -42,7 +42,7 @@ pub enum TScalarStyle {
} }
/// A location in a yaml document. /// A location in a yaml document.
#[derive(Clone, Copy, PartialEq, Debug, Eq)] #[derive(Clone, Copy, PartialEq, Debug, Eq, Default)]
pub struct Marker { pub struct Marker {
/// The index (in chars) in the input string. /// The index (in chars) in the input string.
index: usize, index: usize,
@ -53,7 +53,9 @@ pub struct Marker {
} }
impl Marker { impl Marker {
fn new(index: usize, line: usize, col: usize) -> Marker { /// Create a new [`Marker`] at the given position.
#[must_use]
pub fn new(index: usize, line: usize, col: usize) -> Marker {
Marker { index, line, col } Marker { index, line, col }
} }