Skip to content

Commit

Permalink
Fix change to public fields
Browse files Browse the repository at this point in the history
This reverts commit 4fcfab2.
  • Loading branch information
kornelski committed May 22, 2023
1 parent 9179e79 commit 563f975
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xml-rs"
version = "0.8.12"
version = "0.8.13"
authors = ["Vladimir Matveev <vmatveev@citrine.cc>"]
license = "MIT"
description = "An XML library in pure Rust"
Expand Down
10 changes: 4 additions & 6 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

use std::fmt;

pub(crate) type PosUInt = u32;

/// Represents a position inside some textual document.
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct TextPosition {
/// Row, counting from 0
pub row: PosUInt,
pub row: u64,
/// Column, counting from 0
pub column: PosUInt,
pub column: u64,
}

impl TextPosition {
Expand All @@ -24,13 +22,13 @@ impl TextPosition {
/// Advances the position in a line
#[inline]
pub fn advance(&mut self, count: u8) {
self.column += PosUInt::from(count);
self.column += u64::from(count);
}

/// Advances the position in a line to the next tab position
#[inline]
pub fn advance_to_tab(&mut self, width: u8) {
let width = PosUInt::from(width);
let width = u64::from(width);
self.column += width - self.column % width;
}

Expand Down
5 changes: 2 additions & 3 deletions src/reader/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ impl Lexer {

#[cfg(test)]
mod tests {
use crate::common::PosUInt;
use crate::common::Position;
use std::io::{BufReader, Cursor};

Expand All @@ -668,8 +667,8 @@ mod tests {
let err = $lex.next_token(&mut $buf);
assert!(err.is_err());
let err = err.unwrap_err();
assert_eq!($r as PosUInt, err.position().row);
assert_eq!($c as PosUInt, err.position().column);
assert_eq!($r as u64, err.position().row);
assert_eq!($c as u64, err.position().column);
})
);

Expand Down

0 comments on commit 563f975

Please sign in to comment.