Skip to main content

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 diagnostics;
25pub mod enums;
26pub mod error;
27pub mod ids;
28pub mod index;
29mod macros;
30pub mod units;
31
32pub use color::Color;
33pub use diagnostics::{OpsCode, UnknownOpsCode, WarningInfo};
34pub use enums::{
35    Alignment, ApplyPageType, ArcType, ArrowSize, ArrowType, BookmarkType, BorderLineType,
36    BreakType, CurveSegmentType, DropCapStyle, EmbossType, EmphasisType, EngraveType, FieldType,
37    FillBrushType, Flip, GradientType, GutterType, HeadingType, ImageFillMode, Language,
38    LineSpacingType, NumberFormatType, OutlineType, PageNumberPosition, PatternType,
39    RefContentType, RefType, RestartType, ShadowType, ShowMode, StrikeoutShape, TabAlign,
40    TabLeader, TextBorderType, TextDirection, UnderlineShape, UnderlineType, VerticalAlign,
41    VerticalPosition, WordBreakType,
42};
43pub use error::{ErrorCode, ErrorCodeExt, FoundationError, FoundationResult};
44pub use ids::{FontId, StyleName, TemplateName};
45pub use index::{
46    BorderFillIndex, BulletIndex, CharShapeIndex, FontIndex, Index, NumberingIndex, ParaShapeIndex,
47    StyleIndex, TabIndex,
48};
49pub use units::{HwpUnit, Insets, Point, Rect, Size};