Skip to content

Commit

Permalink
fix serde not compiling for struct with lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
b1ek committed Nov 16, 2024
1 parent 35a65e6 commit 1f93984
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/compiling/lexing/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pub struct Lexer {
}

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
struct LexState<'a> {
struct LexState {
word: String,
is_indenting: bool,
is_escaped: bool,
token_start_index: usize,
position: (usize, usize),
reader: Reader<'a>,
reader: Reader,
lexem: Vec<Token>,
region_handler: RegionHandler,
compound_handler: CompoundHandler,
Expand Down
12 changes: 6 additions & 6 deletions src/compiling/lexing/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ pub enum ReadMode {
}

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Reader<'a> {
pub code: &'a String,
pub struct Reader {
pub code: String,
pub row: usize,
pub col: usize,
pub index: usize,
pub new_line: bool
}

impl<'a> Reader<'a> {
pub fn new(code: &'a String) -> Self {
impl Reader {
pub fn new(code: &String) -> Self {
Reader {
code,
code: code.clone(),
row: BEGINNING.0,
col: BEGINNING.1,
index: 0,
Expand Down Expand Up @@ -116,7 +116,7 @@ impl<'a> Reader<'a> {
}
}

impl<'a> Iterator for Reader<'a> {
impl Iterator for Reader {
type Item = char;

fn next(&mut self) -> Option<Self::Item> {
Expand Down

0 comments on commit 1f93984

Please sign in to comment.