Minor reorganization

This commit is contained in:
Simon Ask Ulsnes 2024-02-04 09:01:56 +01:00
parent 6f7b184678
commit 2bff17e0b8
3 changed files with 19 additions and 15 deletions

View file

@ -1,4 +1,20 @@
use crate::Mark;
/// The pointer position.
#[derive(Copy, Clone, Default, Debug)]
#[non_exhaustive]
pub struct Mark {
/// The position index.
pub index: u64,
/// The position line.
pub line: u64,
/// The position column.
pub column: u64,
}
impl std::fmt::Display for Mark {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "line {} column {}", self.line, self.column)
}
}
#[derive(Debug, thiserror::Error)]
pub enum EmitterError {

View file

@ -64,7 +64,7 @@ pub use crate::scanner::yaml_parser_scan;
pub use crate::writer::yaml_emitter_flush;
pub use crate::yaml::{
AliasData, Break, Document, Emitter, EmitterState, Encoding, Event, EventData, MappingStyle,
Mark, Node, NodeItem, NodePair, Parser, ParserState, ScalarStyle, SequenceStyle, SimpleKey,
Node, NodeItem, NodePair, Parser, ParserState, ScalarStyle, SequenceStyle, SimpleKey,
TagDirective, Token, TokenData, VersionDirective,
};
#[doc(hidden)]

View file

@ -2,7 +2,7 @@ use alloc::collections::VecDeque;
use alloc::string::String;
use alloc::vec::Vec;
use crate::{api::yaml_parser_new, yaml_emitter_new};
use crate::{api::yaml_parser_new, yaml_emitter_new, Mark};
pub use self::Encoding::*;
@ -81,18 +81,6 @@ pub enum Break {
CrLn = 3,
}
/// The pointer position.
#[derive(Copy, Clone, Default, Debug)]
#[non_exhaustive]
pub struct Mark {
/// The position index.
pub index: u64,
/// The position line.
pub line: u64,
/// The position column.
pub column: u64,
}
/// Scalar styles.
#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[non_exhaustive]