ag_psd/lib.rs
1/*
2File: crates/ag-psd/src/lib.rs
3
4Purpose:
5Корень крейта `ag-psd` (Rust-порт одноимённой TS-библиотеки). Зеркалирует
6`index.ts`: объявляет все модули и собирает публичные re-export'ы.
7
8Main responsibilities:
9- объявить `pub mod ...;` для каждого порта upstream-файла (разбиение 1:1);
10- свести будущий публичный API крейта в одну точку входа (как `index.ts`);
11- быть единственным местом, где задаётся видимость модулей наружу.
12
13Source compatibility:
14- зеркало `test/ag-psd/src/index.ts`.
15
16PORT STATUS: stub — модули объявлены, логика ещё не портирована.
17*/
18
19//! # ag-psd
20//!
21//! Read and write Adobe Photoshop (`.psd` / `.psb`) files in pure Rust.
22//!
23//! This crate is a from-scratch Rust port of the
24//! [`ag-psd`](https://github.com/Agamnentzar/ag-psd) TypeScript library. The
25//! data model mirrors the upstream structures, so anyone familiar with the JS
26//! API will recognize [`psd::Psd`], [`psd::Layer`], [`psd::ReadOptions`] and
27//! [`psd::WriteOptions`].
28//!
29//! ## Quick start
30//!
31//! ```no_run
32//! use ag_psd::{read_psd, write_psd};
33//! use ag_psd::psd::{ReadOptions, WriteOptions};
34//!
35//! // Read
36//! let bytes = std::fs::read("input.psd").unwrap();
37//! let psd = read_psd(&bytes, &ReadOptions::default()).unwrap();
38//! println!("{}x{}, {} top-level layers", psd.width, psd.height,
39//! psd.children.as_ref().map_or(0, |c| c.len()));
40//!
41//! // Write
42//! let out = write_psd(&psd, &WriteOptions::default());
43//! std::fs::write("output.psd", out).unwrap();
44//! ```
45//!
46//! The most important entry points are [`read_psd`] and [`write_psd`]; the
47//! document/layer types live in the [`psd`] module. See the `README.md` and
48//! `docs/usage.md` in the repository for a detailed guide.
49//!
50//! ## Vibe-coded port
51//!
52//! This port was written almost entirely by **Claude** (Anthropic), using the
53//! upstream TypeScript source as the specification and its test fixtures as the
54//! oracle. See the README for the full status and known limitations.
55
56// dead_code is expected: not every ported symbol is wired into the public API.
57#![allow(dead_code)]
58
59pub mod abr;
60pub mod additional_info;
61pub mod ase;
62pub mod csh;
63pub mod descriptor;
64pub mod effects_helpers;
65pub mod engine_data;
66pub mod engine_data2;
67pub mod helpers;
68pub mod image_resources;
69pub mod initialize_canvas;
70pub mod jpeg;
71pub mod psd;
72pub mod reader;
73pub mod text;
74pub mod utf8;
75pub mod writer;
76
77// Публичные re-export'ы (зеркало index.ts) добавляются по мере портирования,
78// например `pub use psd::*;`, `pub use abr::*;`, `pub use csh::*;`.
79pub use engine_data::{
80 parse_engine_data, serialize_engine_data, EngineDataError, EngineValue,
81};
82pub use engine_data2::decode_engine_data2;
83pub use abr::{read_abr, Abr, Brush, BrushShape, ReadAbrOptions, SampleInfo};
84pub use ase::{read_ase, write_ase, Ase, AseColor, AseColorValue, AseEntry, AseGroup};
85pub use csh::{read_csh, write_csh, Csh, CshShape};
86pub use reader::read_psd;
87pub use writer::{write_psd, write_psd_to_writer};