From 3c88b11e5df33116580ac008e36092775df66135 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 13 Mar 2026 12:24:18 -0700 Subject: [WARP] Improved UX and API - Exposes WARP type objects directly - Adds processor API (for generating warp files directly) - Adds file and chunk API - Misc cleanup - Simplified the amount of commands - Replaced the "Create" commands with a purpose built processor dialog - Added a native QT viewer for WARP files - Simplified committing to a remote with a purpose built commit dialog --- plugins/warp/src/container.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'plugins/warp/src/container.rs') diff --git a/plugins/warp/src/container.rs b/plugins/warp/src/container.rs index 4feed24c..bb5d7fd4 100644 --- a/plugins/warp/src/container.rs +++ b/plugins/warp/src/container.rs @@ -7,12 +7,14 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use thiserror::Error; use uuid::Uuid; +use warp::chunk::{Chunk, ChunkKind}; use warp::r#type::guid::TypeGUID; use warp::r#type::{ComputedType, Type}; use warp::signature::constraint::ConstraintGUID; use warp::signature::function::{Function, FunctionGUID}; use warp::symbol::Symbol; use warp::target::Target; +use warp::WarpFile; pub mod disk; pub mod memory; @@ -291,6 +293,28 @@ pub trait Container: Send + Sync + Display + Debug { functions: &[Function], ) -> ContainerResult<()>; + /// Add the `chunk`s data to the provided `source` if it exists and is writable. + fn add_chunk(&mut self, source: &SourceId, chunk: &Chunk) -> ContainerResult<()> { + match &chunk.kind { + ChunkKind::Signature(sc) => { + let functions: Vec<_> = sc.functions().collect(); + self.add_functions(&chunk.header.target, source, &functions) + } + ChunkKind::Type(tc) => { + let types: Vec<_> = tc.types().collect(); + self.add_computed_types(source, &types) + } + } + } + + /// Add the `file` data to the provided `source` if it exists and is writable. + fn add_file(&mut self, source: &SourceId, file: &WarpFile) -> ContainerResult<()> { + for chunk in &file.chunks { + self.add_chunk(source, chunk)?; + } + Ok(()) + } + /// Fetches WARP information for the associated functions. /// /// Typically, a container that resides only in memory has nothing to fetch, so the default implementation -- cgit v1.3.1