Skip to main content

Crate anyrepair

Crate anyrepair 

Source
Expand description

§AnyRepair

A Rust crate for repairing malformed structured data including JSON, YAML, XML, TOML, CSV, INI, Markdown, and Diff with format auto-detection.

Re-exports§

pub use audio::Mp3Repairer;
pub use audio::WavRepairer;
pub use binary_detection::detect_binary_format;
pub use binary_detection::is_binary_format;
pub use binary_detection::BinaryDetectionResult;
pub use binary_traits::BinaryRepair;
pub use binary_traits::BinaryValidator;
pub use diff::DiffRepairer;
pub use error::RepairError;
pub use error::Result;
pub use image::JpegRepairer;
pub use image::PngRepairer;
pub use json::JsonRepairer;
pub use key_value::EnvRepairer;
pub use key_value::IniRepairer;
pub use key_value::PropertiesRepairer;
pub use mcp_server::AnyrepairMcpServer;
pub use streaming::StreamingRepair;
pub use traits::Repair;
pub use video::MovRepairer;
pub use video::Mp4Repairer;
pub use format_detection::DetectionResult;

Modules§

audio
Audio file repair — WAV and MP3.
binary_detection
Binary format detection using magic bytes.
binary_traits
Core traits for binary (media) file repair.
csv
CSV repair module
diff
Diff/Unified diff repair module
error
Error types for the anyrepair crate
format_detection
Format detection heuristics
image
Image file repair — PNG and JPEG.
json
JSON repair module
json_util
Minimal JSON helpers (validation, escaping, MCP payloads) without serde.
key_value
Key-value format repair module (INI, .env, .properties)
markdown
Markdown repair module
mcp_server
MCP (Model Context Protocol) server for anyrepair
repairer_base
Generic repair loop: validator gate + ordered RepairStrategy pipeline.
streaming
Streaming repair for large files with minimal memory overhead
toml
TOML repair module
traits
Core traits for repair functionality
video
Video file repair — MP4 and MOV.
xml
XML repair module
yaml
YAML repair functionality

Constants§

BINARY_FORMATS
All binary (media) format identifiers supported by anyrepair.
SUPPORTED_FORMATS
All text format identifiers supported by anyrepair. Used by create_repairer, create_validator, and repair_with_format.

Functions§

create_binary_repairer
Create a boxed BinaryRepair instance for the given media format. Accepts canonical names and aliases (e.g. jpgjpeg). Returns RepairError::FormatDetection if the format is unknown.
create_binary_validator
Create a boxed BinaryValidator for the given media format.
create_repairer
Create a boxed Repair instance for the given format. Accepts canonical names and aliases (e.g. yml, md). Returns RepairError::FormatDetection if the format is unknown.
create_validator
Create a boxed Validator for the given format. Accepts canonical names and aliases (e.g. yml, md). Returns RepairError::FormatDetection if the format is unknown.
detect_format
Detect the format of the given content. Returns None if no known format matches. See format_detection for the heuristic order.
detect_format_with_confidence
Detect format with a confidence score (0.0..=1.0).
jsonrepair
Repair a JSON string (Python-compatible convenience function). Equivalent to create_repairer("json")?.repair(json_str).
normalize_format
Normalize a format alias to its canonical name. Accepts case-insensitive matches and common aliases (ymlyaml, mdmarkdown, jpgjpeg). Returns the original string unchanged if no match is found.
repair
Repair content with automatic format detection. Falls back to the Markdown repairer if no format is detected.
repair_binary
Repair binary content with automatic format detection. Falls back to returning the original data if no format is detected.
repair_binary_with_format
Repair binary content using an explicit format.
repair_with_explanations
Repair content with a specific format and return the list of strategies that changed it. Returns (repaired_content, applied_strategy_names).
repair_with_format
Repair content using an explicit format. Convenience wrapper around create_repairer + Repair::repair.