forked from 1b-agent/opencadstudio-upstream
- lib.rs: export all 14 facade handles (add ArcCurve/Ellipse/Spline/Ray/XLine/Text/ MText/Dimension + Circle) — public surface matches collection return types. - build.rs: fix step-1 comment (enums are hand-maintained, not 'regenerated'); generic_reference_md: Clone (not Copy) + full 14-handle list (was stale 6). - ops.rs/query.rs: correct 'hand-maintained' module doc comments (were 'GENERATED'). - layouts.json: extend to all 22 Operation + 12 Query variants (was stale phase-1). - binding_schema.json regenerated (complete layouts + derived handles). - generate.py: inject 'id': self.id for SetTextContent/SetAttribute/SetViewportView/ Transform/Delete/AddVertex (was malformed id-less payloads); _apply_op/_apply_query accept want=None; extend PY_TYPES (String/&str/Vec returns/new handles). - README.md: Clone (not Copy) + full scope (2D curves, annotations, containers, viewports, media) replacing stale 'Not yet' list. - Plan (.kilo): mark implemented & published; pointer to live crate docs.
68 lines
2.4 KiB
Rust
68 lines
2.4 KiB
Rust
//! `ocs_doc_api` — Object-oriented, transport-agnostic CAD entity API for
|
|
//! OpenCADStudio plugins and hosts (v2).
|
|
//!
|
|
//! Core vocabulary: **Entity**, **ObjectId** (u64), **Operation** (typed write),
|
|
//! **Query** (typed read), **Transport** (the only plugin↔host boundary).
|
|
//! Every write op is one atomic host call = one undo step (no multi-op write
|
|
//! transactions — removed after the security/integrity review; see the plan §13).
|
|
//!
|
|
//! The facade is object-centric: [`DocApi`] (root) → [`Document`] → collections
|
|
//! ([`SolidCollection`], [`CurveCollection`], [`EntityCollection`]) → typed
|
|
//! handles ([`Solid`], [`Line`], …) carrying geometric methods. The same typed
|
|
//! requests run in-process and over IPC; only the [`Transport`] differs.
|
|
|
|
pub mod error;
|
|
pub mod id;
|
|
pub mod revision;
|
|
|
|
#[cfg(feature = "host")]
|
|
pub mod backend;
|
|
#[cfg(feature = "host")]
|
|
pub mod executor;
|
|
#[cfg(feature = "host")]
|
|
pub mod geom;
|
|
|
|
pub mod envelope;
|
|
pub mod facade;
|
|
pub mod ops;
|
|
pub mod query;
|
|
pub mod transport;
|
|
|
|
// Generated (build.rs) — committed snapshots under src/gen/; do NOT edit by hand.
|
|
pub mod gen {
|
|
pub mod ops {
|
|
include!("gen/ops_gen.rs");
|
|
}
|
|
pub mod query {
|
|
include!("gen/query_gen.rs");
|
|
}
|
|
pub use ops::Operation;
|
|
pub use query::Query;
|
|
}
|
|
|
|
pub use error::{ApiError, ApiResult, GeometryErrorKind};
|
|
pub use id::ObjectId;
|
|
pub use revision::GeometryRevision;
|
|
|
|
pub use envelope::{DocApiEnvelope, EnvelopeBody, OpOutcome, Receipt};
|
|
pub use facade::{
|
|
ArcCurve, Circle, CurveCollection, Dimension, DocApi, Document, Ellipse, Entity,
|
|
EntityCollection, HasId, Line, MText, OpGroup, Point, Polyline, QueryBatch, QueryResults, Ray,
|
|
Solid, SolidCollection, Spline, Text, XLine,
|
|
};
|
|
pub use ops::{BoolOp, Curve2Spec, EntitySpec, Operation, PlacementSpec, SolidPrimitive};
|
|
pub use query::{Aabb, EntityView, Query, QueryResult};
|
|
pub use transport::Transport;
|
|
|
|
/// The crate's own wire-envelope protocol version (`DocApiEnvelope::version`).
|
|
/// Bump when the envelope layout or `Operation`/`Query` discriminants change.
|
|
/// Bridges must check this before speaking (see `bindings/README.md`).
|
|
pub const ENVELOPE_VERSION: u16 = 1;
|
|
|
|
/// The generated binding handover schema (plan §10.2): object model + method
|
|
/// signatures + op/query mapping with traced wire layouts inlined. Single,
|
|
/// self-contained, versioned with [`ENVELOPE_VERSION`].
|
|
pub fn binding_schema_json() -> &'static str {
|
|
include_str!("gen/binding_schema.json")
|
|
}
|