Skip to main content

WorkspaceContent

Trait WorkspaceContent 

Source
pub trait WorkspaceContent {
    // Required methods
    fn tracked_paths(&mut self) -> Result<Vec<TrackedPath>, ContentUnavailable>;
    fn candidate_bytes(
        &mut self,
        path: &[u8],
    ) -> Result<Vec<u8>, ContentUnavailable>;
    fn base_bytes(
        &mut self,
        path: &[u8],
    ) -> Result<Option<Vec<u8>>, ContentUnavailable>;
}
Expand description

What: The repository facts the planner reads. A trait is a named set of methods a type promises to provide, like a TS interface; &mut self lends the provider for writing, because it may remember what it read; &[u8] borrows a path. Why: The planner asks only for what it needs: every manifest at both states, the registry configuration once a version was raised, and source files of the dependents whose bundled imports decide an edge.

In TS you’d write (pseudocode):

interface WorkspaceContent { trackedPaths(): TrackedPath[]; candidateBytes(path: Uint8Array): Uint8Array; baseBytes(path: Uint8Array): Uint8Array | undefined }

Required Methods§

Source

fn tracked_paths(&mut self) -> Result<Vec<TrackedPath>, ContentUnavailable>

Every tracked path in the candidate state, in the provider’s order (Git’s index order in the wrapper).

Source

fn candidate_bytes( &mut self, path: &[u8], ) -> Result<Vec<u8>, ContentUnavailable>

The bytes of a tracked path in the candidate state.

Source

fn base_bytes( &mut self, path: &[u8], ) -> Result<Option<Vec<u8>>, ContentUnavailable>

The bytes of a path at the comparison base (HEAD for the policy), or nothing when the base lacks it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl WorkspaceContent for LifecycleWorkspace<'_>

What: impl WorkspaceContent for LifecycleWorkspace<'_> is the planner’s content seam. Why: The planner stays free of Git; this is the only place it meets the store.

In TS you’d write (pseudocode):

class LifecycleWorkspace implements WorkspaceContent {}