$ logos
v0.16.0MAJOR UPDATECreate ridiculously fast Lexers
Latest Update Summary
Crate
Name: logos New version: 0.16.0 Release date: 2025-12-07T09:59:40.615393Z
Crate readme
Short description Create ridiculously fast Lexers.
Long description Logos makes it easy to create a Lexer focused on complex problems while generating a faster Lexer than manual implementation. It combines token definitions into a single deterministic state machine and optimizes branches using lookup or jump tables, preventing backtracking inside token definitions and minimizing bounds checking at compile time.
Features • deterministic state machine • lookup tables • jump tables • no backtracking • loop unrolling • batch reads
Code Examples Basic usage
use logos::Logos;
#[derive(Logos, Debug, PartialEq)]
#[logos(skip r"[ \t\n\f]+")]
enum Token {
#[token("fast")]
Fast,
#[token(".")]
Period,
#[regex("[a-zA-Z]+")]
Text,
}
fn main() {
let mut lex = Token::lexer("Create ridiculously fast Lexers.");
assert_eq!(lex.next(), Some(Ok(Token::Text)));
assert_eq!(lex.span(), 0..6);
assert_eq!(lex.slice(), "Create");
assert_eq!(lex.next(), Some(Ok(Token::Text)));
assert_eq!(lex.span(), 7..19);
assert_eq!(lex.slice(), "ridiculously");
assert_eq!(lex.next(), Some(Ok(Token::Fast)));
assert_eq!(lex.span(), 20..24);
assert_eq!(lex.slice(), "fast");
assert_eq!(lex.next(), Some(Ok(Token::Text)));
assert_eq!(lex.slice(), "Lexers");
assert_eq!(lex.span(), 25..31);
assert_eq!(lex.next(), Some(Ok(Token::Period)));
assert_eq!(lex.span(), 31..32);
assert_eq!(lex.slice(), ".");
assert_eq!(lex.next(), None);
}
Links • https://logos.maciej.codes/ • https://crates.io/crates/logos • https://docs.rs/logos • https://maciejhirsz.github.io/logos/
https://api.github.com/repos/maciejhirsz/logos/releases/268090488
Release info
Release version:
Release description
Code Examples
Minor update: 0.15.1 → 0.16.0
$ DOWNLOADS TREND
$ VERSION HISTORY
$ LINKS
$ INSTALL
cargo add logosOr add to Cargo.toml: logos = "0.16.0"