UCP API
ucp-api provides a high-level API for working with UCP, combining all core crates into a convenient interface for application development.
Overview
The UCP API is the recommended entry point for most applications. It provides:
- UcpClient - Main client for document manipulation
- Unified interface - Access to all UCP functionality
- UCL integration - Execute UCL commands directly
- Convenience methods - Common operations simplified
Installation
[]
= "0.1"
Quick Start
use UcpClient;
UcpClient
The main entry point for UCP operations.
Creating a Client
use UcpClient;
// Default client
let client = new;
Document Operations
// Create new document
let mut doc = client.create_document;
// Get document info
println!;
println!;
println!;
Adding Content
let root = doc.root.clone;
// Add text block
let text_id = client.add_text.unwrap;
// Add code block
let code_id = client.add_code.unwrap;
Executing UCL
// Parse UCL (without executing)
let commands = client.parse_ucl.unwrap;
println!;
// Execute UCL commands
let results = client.execute_ucl.unwrap;
for result in &results
Serialization
// Serialize document to JSON
let json = client.to_json.unwrap;
println!;
// Pretty-print if needed
let pretty: Value = from_str.unwrap;
println!;
Public API
pub use UcpClient;
pub use ;
Integration with Other Crates
UCP API re-exports types from underlying crates:
use UcpClient;
// From ucm-core
use ;
use ;
// From ucm-engine
use ;
// From ucl-parser
use ;
See Also
- Quick Start Guide - Getting started with UCP
- UCL Commands - UCL command reference
- UCM Core - Core types documentation
- UCM Engine - Engine documentation