Skip to content

Rust: Match lex return type with other signatures#783

Merged
marcoroth merged 1 commit intomainfrom
rust-lex-return-type
Nov 5, 2025
Merged

Rust: Match lex return type with other signatures#783
marcoroth merged 1 commit intomainfrom
rust-lex-return-type

Conversation

@marcoroth
Copy link
Owner

@marcoroth marcoroth commented Nov 5, 2025

This pull request refactors the lex return type in the public Rust API. Additionally, the LexResult and ParseResult types now implement Display for easier printing.

use herb::{lex, parse};

fn main() {
  let template = "<h1><%= title %></h1>";

  match lex(template) {
    Ok(result) => { println!("{}", result); }
    Err(error) => { eprintln!("Lex error: {}", error); }
  }

  match parse(template) {
    Ok(result) => { println!("{}", result); }
    Err(error) => { eprintln!("Parse error: {}", error); }
  }
}

@github-actions github-actions bot added documentation Improvements or additions to documentation rust labels Nov 5, 2025
@marcoroth marcoroth force-pushed the rust-lex-return-type branch from 47570ab to 5ca502b Compare November 5, 2025 20:33
@marcoroth marcoroth marked this pull request as ready for review November 5, 2025 20:35
@marcoroth marcoroth merged commit 5a4ffda into main Nov 5, 2025
12 checks passed
@marcoroth marcoroth deleted the rust-lex-return-type branch November 5, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant