pub struct PluginFileSet {
pub files: BTreeMap<String, Vec<u8>>,
pub dir_name: String,
}Expand description
In-memory representation of a loaded plugin directory.
Relative path → raw bytes for every file within the plugin directory.
The map is a BTreeMap so iteration order is deterministic (useful for
tests and for reproducing compilation results across runs).
Fields§
§files: BTreeMap<String, Vec<u8>>All files, keyed by relative path (forward-slash separated, no leading slash).
dir_name: StringThe directory name (used for manifest synthesis when no manifest is found).
Implementations§
Source§impl PluginFileSet
impl PluginFileSet
Sourcepub fn from_map(
dir_name: impl Into<String>,
files: BTreeMap<String, Vec<u8>>,
) -> Result<Self, String>
pub fn from_map( dir_name: impl Into<String>, files: BTreeMap<String, Vec<u8>>, ) -> Result<Self, String>
Build a PluginFileSet from an in-memory map of relative path → bytes.
Applies the same per-file, total-size, and count limits as from_dir.
Rejects any path that contains .. components or an absolute leading /.
This is the seam for tarball extraction and tests — no disk access required.
Sourcepub fn from_dir(path: &Path) -> Result<Self, String>
pub fn from_dir(path: &Path) -> Result<Self, String>
Load a plugin directory from disk.
- Rejects
..components and all symlinks (cycle/escape defense). - Skips files larger than
MAX_PLUGIN_FILE_BYTES. - Fails if more than
MAX_PLUGIN_FILESfiles are found. - Fails if total bytes exceed
MAX_PLUGIN_TOTAL_BYTES.
Sourcepub fn manifest(&self) -> Result<(PluginManifest, Vec<String>), String>
pub fn manifest(&self) -> Result<(PluginManifest, Vec<String>), String>
Resolve the plugin manifest.
Discovery order: .claude-plugin/plugin.json, then .codex-plugin/plugin.json,
then .cursor-plugin/plugin.json. If none is found, a minimal manifest
is synthesized from the directory name (Claude Code parity).
Sourcepub fn text_file(&self, path: &str) -> Option<String>
pub fn text_file(&self, path: &str) -> Option<String>
Retrieve a file’s content as a UTF-8 string, or None if not found or binary.
Sourcepub fn list_dir<'a>(&'a self, dir_prefix: &str) -> Vec<(&'a str, &'a str)>
pub fn list_dir<'a>(&'a self, dir_prefix: &str) -> Vec<(&'a str, &'a str)>
List relative paths that are direct children of dir_prefix/.
Returns (relative_within_dir, full_relative_path).
Sourcepub fn list_dir_recursive<'a>(&'a self, dir_prefix: &str) -> Vec<&'a str>
pub fn list_dir_recursive<'a>(&'a self, dir_prefix: &str) -> Vec<&'a str>
List relative paths for all files under dir_prefix/ (recursively).
Trait Implementations§
Source§impl Clone for PluginFileSet
impl Clone for PluginFileSet
Source§fn clone(&self) -> PluginFileSet
fn clone(&self) -> PluginFileSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PluginFileSet
impl RefUnwindSafe for PluginFileSet
impl Send for PluginFileSet
impl Sync for PluginFileSet
impl Unpin for PluginFileSet
impl UnsafeUnpin for PluginFileSet
impl UnwindSafe for PluginFileSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request