hwpforge_foundation/
lib.rs

1//! HwpForge Foundation: primitive types for the HwpForge ecosystem.
2//!
3//! This crate sits at the bottom of the dependency graph. It provides
4//! raw-material value types used by every other HwpForge crate:
5//!
6//! - [`HwpUnit`] -- the universal measurement unit (1/100 pt)
7//! - [`Color`] -- BGR color matching the HWP specification
8//! - [`FontId`], [`TemplateName`], [`StyleName`] -- string-based identifiers
9//! - [`Index<T>`] -- branded numeric indices with phantom-type safety
10//! - [`Alignment`], [`LineSpacingType`], [`BreakType`], [`Language`], [`WordBreakType`] -- core enums
11//! - [`FoundationError`], [`ErrorCode`] -- structured error handling
12//!
13//! # Design Principles
14//!
15//! - **Zero-cost newtypes**: `repr(transparent)` on value wrappers
16//! - **Type safety**: phantom-branded indices prevent mixing
17//! - **Compile-time guarantees**: `const` size assertions
18//! - **No unsafe code**: `#![deny(unsafe_code)]`
19
20#![deny(missing_docs)]
21#![deny(unsafe_code)]
22
23pub mod color;
24pub mod enums;
25pub mod error;
26pub mod ids;
27pub mod index;
28mod macros;
29pub mod units;
30
31pub use color::Color;
32pub use enums::{
33    Alignment, ApplyPageType, ArcType, ArrowSize, ArrowType, BookmarkType, BorderLineType,
34    BreakType, CurveSegmentType, DropCapStyle, EmbossType, EmphasisType, EngraveType, FieldType,
35    FillBrushType, Flip, GradientType, GutterType, HeadingType, ImageFillMode, Language,
36    LineSpacingType, NumberFormatType, OutlineType, PageNumberPosition, PatternType,
37    RefContentType, RefType, RestartType, ShadowType, ShowMode, StrikeoutShape, TextBorderType,
38    TextDirection, UnderlineType, VerticalPosition, WordBreakType,
39};
40pub use error::{ErrorCode, ErrorCodeExt, FoundationError, FoundationResult};
41pub use ids::{FontId, StyleName, TemplateName};
42pub use index::{
43    BorderFillIndex, CharShapeIndex, FontIndex, Index, NumberingIndex, ParaShapeIndex, StyleIndex,
44    TabIndex,
45};
46pub use units::{HwpUnit, Insets, Point, Rect, Size};