Crate puz_parse

Crate puz_parse 

Source
Expand description

A library for parsing .puz crossword puzzle files.

This library provides functionality to parse the binary .puz file format used by crossword puzzle applications in the early-mid 2000s, like AcrossLite. It supports all standard puzzle features including rebus squares, circled squares, and various puzzle extensions.

§Quick Start

use puz_parse::parse_file;

let puzzle = parse_file("puzzle.puz")?;
println!("Title: {}", puzzle.info.title);
println!("Size: {}x{}", puzzle.info.width, puzzle.info.height);

§Advanced Usage

For more control over parsing and error handling:

use std::fs::File;
use puz_parse::parse;

let file = File::open("puzzle.puz")?;
let result = parse(file)?;
let puzzle = result.result;

// Handle any warnings that occurred during parsing
for warning in &result.warnings {
    eprintln!("Warning: {}", warning);
}

§Features

  • Complete .puz parsing: Supports all standard puzzle features
  • Error recovery: Continues parsing with warnings for non-critical issues
  • Memory efficient: Zero-copy parsing where possible
  • Extensible: Handles rebus squares, circles, and other puzzle extensions
  • JSON support: Optional serde support via the json feature

§Optional Features

  • json: Enables JSON serialization support via serde

Structs§

Clues
Clues organized by direction and number.
Extensions
Optional puzzle extensions for advanced features.
Grid
The puzzle grid containing both solution and blank layouts.
ParseResult
Result type for parsing that includes warnings.
Puzzle
A complete crossword puzzle parsed from a .puz file.
PuzzleInfo
Basic information about the puzzle.
Rebus
Rebus information for squares containing multiple letters.

Enums§

PuzError
Errors that can occur when parsing a .puz file.
PuzWarning
Warnings that can occur during parsing but don’t prevent puzzle creation.

Functions§

parse
Parse a .puz file from any source that implements Read.
parse_bytes
Parse a .puz file from a byte slice.
parse_file
Parse a .puz file from a file path.