Expand description
§🛠️ Developer Guide
This directory contains the core logic implementation of the project. Below are instructions for a quick start.
§🚦 Quick Start
§Core API Usage
// Example: Basic calling workflow
fn main() {
// 1. Initialization
// 2. Execute core logic
// 3. Handle returned results
}§🔍 Module Description
- lib.rs: Exports public interfaces and core traits.
- parser/ (if exists): Implements specific syntax parsing logic.
- ast/ (if exists): Defines the syntax tree structure.
§🏗️ Architecture Design
The project follows the general architectural specifications of the Oak ecosystem, emphasizing:
- Immutability: Uses the Green/Red Tree structure to ensure efficient sharing of syntax trees.
- Fault Tolerance: Core logic is highly inclusive of erroneous input.
- Scalability: Convenient for downstream tools to perform secondary development.
Re-exports§
pub extern crate alloc;pub use crate::comment::Comment;pub use crate::comment::CommentCollector;pub use crate::comment::CommentKind;pub use crate::comment::CommentProcessor;pub use crate::document::Document;pub use crate::document::IndentStyle;pub use crate::document::LineEnding;pub use crate::document::Printer;pub use crate::document::PrinterConfig;pub use crate::errors::FormatResult;pub use crate::state::DefaultFormatState;pub use crate::to_doc::AsDocument;pub use crate::to_doc::ToDocument;pub use crate::whitespace::WhitespaceProcessor;
Modules§
- comment
- Comment handling and processing
- document
- Document abstraction and printer
- errors
- Error types for formatting
- state
- Formatting state
- to_doc
- Traits for converting types to documents
- whitespace
- Whitespace handling and processing
Macros§
- define_
rules - Macro for defining language rules.
- doc
- Macro for generating documentation from templates.
Constants§
- HARD_
LINE - Force a line break and propagate it to parent groups
- LINE
- Force a line break
- NIL
- Empty document
- SOFT_
LINE - Soft line break: a line break if the group breaks, otherwise empty
- SOFT_
LINE_ SPACE - Soft line break with space: a line break if the group breaks, otherwise a space
Traits§
- Language
- Language definition trait that coordinates all language-related types and behaviors.
Functions§
Type Aliases§
- Doc
- Type alias for Document
Derive Macros§
- AsDocument
- Derives the
AsDocumenttrait. - Format
Rule - Derives the
FormatRuletrait.