Crate r4d

Source
Expand description

§R4d(rad)

R4d is a text oriented macro processor that tries to solve inconveniences of well-known m4 macro processor.

R4d is provided as both binary and library. Binary includes all features of optional dependencies. Library doesn’t provide any features by default so you can set them manually.

§Features

- evalexpr  : eval related macros
- chrono    : time related macros
- textwrap  : "wrap" macro
- cindex    : Query related macros
- full      : all features above

- debug     : Enable debug method
- color     : Enable color prompt
- hook      : Enable hook macro
- signature : Enable signature option

§Simple usage

Binary

# Read from file and print to stdout
rad input_file.txt
# Read from standard input and print to file
printf '...text...' | rad -o out_file.txt

Library

use r4d::{Processor, RadResult};
use std::path::Path;

let mut processor = Processor::new()
    .purge(true)
    .write_to_file(Path::new("cache.txt"))
    .expect("Failed to open a file");

processor.process_file(Path::new("input.txt"))
    .expect("Failed to process file");
processor.print_result().expect("Failed to print result");

Detailed r4d usage is illustrated in github page or in Processor

Macros§

trim
Trim macro to trim a text

Structs§

ExtMacroBuilder
Builder struct for extension macros
Processor
Central macro logic processor

Enums§

AuthType
Authorization type
CommentType
Comment type
DiffOption
Diffing behaviour
Hygiene
Hygiene variant
MacroType
Types of a macros
RadError
R4d’s error type
StorageOutput
Output that storage creates
WarningType
Type variant or warning
WriteOption
State enum value about direction of processed text

Traits§

RadStorage
Triat for storage interaction

Type Aliases§

RadResult
Genenric result type for every rad operations
StorageResult
Result alias for storage operation