pub trait Adapter:
Send
+ Sync
+ Debug {
Show 27 methods
// Required methods
fn kind(&self) -> FormatKind;
fn detect(&self, start: &Path) -> Option<PathBuf>;
fn inspect(
&self,
start: &Path,
feature: Option<&str>,
) -> Option<ProjectSnapshot>;
fn parse_tasks(
&self,
path: &str,
text: &str,
) -> (ParsedTasks, Vec<Diagnostic>);
fn rules(&self) -> &'static Rules;
fn wording(&self) -> &'static Wording;
fn messages(&self) -> &'static Messages;
fn planning(&self) -> &'static Planning;
fn bundle(
&self,
snapshot: &ProjectSnapshot,
task: &str,
) -> Result<Bundle, BundleError>;
fn scenarios(
&self,
snapshot: &ProjectSnapshot,
task: &str,
) -> Vec<ScenarioRef>;
fn acceptance_testable(&self, bundle: &Bundle) -> bool;
fn is_convergence(&self, phase: &str) -> bool;
fn convergence_texts(&self, root: &Path, unit_dir: &Path) -> [String; 4];
fn checklists(&self, root: &Path, unit_dir: &str) -> Vec<ChecklistStatus>;
fn tick(
&self,
tasks_file: &Path,
task: &str,
line_hash: &str,
) -> Result<(), String>;
fn append(
&self,
tasks_file: &Path,
file_hash: &str,
items: &[String],
) -> Result<Vec<String>, String>;
fn commit_precondition(
&self,
root: &Path,
join: &dyn Fn(&str) -> String,
unit_dir: &str,
) -> CommitPrecondition;
// Provided methods
fn open(
&self,
start: &Path,
feature: Option<&str>,
) -> Option<ProjectSnapshot> { ... }
fn blocking<'s>(
&self,
_snapshot: &'s ProjectSnapshot,
) -> Vec<&'s Diagnostic> { ... }
fn crosscheck(
&self,
_snapshot: &ProjectSnapshot,
_runner: &dyn CommandRunner,
) -> Vec<Diagnostic> { ... }
fn tool(&self) -> Option<(&'static str, &'static str)> { ... }
fn requirements_file(&self) -> Option<&'static str> { ... }
fn requirements_in(&self, _text: &str) -> Vec<(String, String)> { ... }
fn record_change(
&self,
_root: &Path,
_request: &str,
_checks: &[String],
) -> Result<Recorded, String> { ... }
fn requirement_ids(
&self,
root: &Path,
unit_dir: &str,
) -> Vec<(String, String)> { ... }
fn current_pointer(&self) -> Option<&'static str> { ... }
fn set_current(
&self,
_root: &Path,
_unit_dir: Option<&str>,
) -> Result<String, String> { ... }
}Expand description
One spec format the runtime can run.
Required Methods§
Sourcefn kind(&self) -> FormatKind
fn kind(&self) -> FormatKind
Which format.
Sourcefn detect(&self, start: &Path) -> Option<PathBuf>
fn detect(&self, start: &Path) -> Option<PathBuf>
The project root containing start, by the format’s marker.
Sourcefn inspect(
&self,
start: &Path,
feature: Option<&str>,
) -> Option<ProjectSnapshot>
fn inspect( &self, start: &Path, feature: Option<&str>, ) -> Option<ProjectSnapshot>
Discovers the project containing start and selects feature.
Read-only.
Sourcefn parse_tasks(&self, path: &str, text: &str) -> (ParsedTasks, Vec<Diagnostic>)
fn parse_tasks(&self, path: &str, text: &str) -> (ParsedTasks, Vec<Diagnostic>)
Parses a task list.
Sourcefn bundle(
&self,
snapshot: &ProjectSnapshot,
task: &str,
) -> Result<Bundle, BundleError>
fn bundle( &self, snapshot: &ProjectSnapshot, task: &str, ) -> Result<Bundle, BundleError>
The context bundle for task of the selected unit.
Sourcefn scenarios(&self, snapshot: &ProjectSnapshot, task: &str) -> Vec<ScenarioRef>
fn scenarios(&self, snapshot: &ProjectSnapshot, task: &str) -> Vec<ScenarioRef>
The scenarios task’s acceptance tests cite, with the spec’s words
(judge-side: the implementer sees the spec text, not this list).
Sourcefn acceptance_testable(&self, bundle: &Bundle) -> bool
fn acceptance_testable(&self, bundle: &Bundle) -> bool
Whether the bundle states acceptance examples to derive tests from.
Sourcefn is_convergence(&self, phase: &str) -> bool
fn is_convergence(&self, phase: &str) -> bool
Whether a task closes a gap found after implementation (its phase).
Sourcefn convergence_texts(&self, root: &Path, unit_dir: &Path) -> [String; 4]
fn convergence_texts(&self, root: &Path, unit_dir: &Path) -> [String; 4]
What the convergence assessment reads, in order: the project’s rules, the spec, the plan, the task list (each may be empty).
Sourcefn checklists(&self, root: &Path, unit_dir: &str) -> Vec<ChecklistStatus>
fn checklists(&self, root: &Path, unit_dir: &str) -> Vec<ChecklistStatus>
The unit’s unfinished-checklist state.
Sourcefn tick(
&self,
tasks_file: &Path,
task: &str,
line_hash: &str,
) -> Result<(), String>
fn tick( &self, tasks_file: &Path, task: &str, line_hash: &str, ) -> Result<(), String>
Ticks task (one byte, under the line-hash guard).
Sourcefn append(
&self,
tasks_file: &Path,
file_hash: &str,
items: &[String],
) -> Result<Vec<String>, String>
fn append( &self, tasks_file: &Path, file_hash: &str, items: &[String], ) -> Result<Vec<String>, String>
Appends convergence tasks (prefix-guarded); returns their IDs.
Sourcefn commit_precondition(
&self,
root: &Path,
join: &dyn Fn(&str) -> String,
unit_dir: &str,
) -> CommitPrecondition
fn commit_precondition( &self, root: &Path, join: &dyn Fn(&str) -> String, unit_dir: &str, ) -> CommitPrecondition
What must be committed before a worktree is made; paths are
repository-relative, join maps a project-relative path to one.
Provided Methods§
Sourcefn open(&self, start: &Path, feature: Option<&str>) -> Option<ProjectSnapshot>
fn open(&self, start: &Path, feature: Option<&str>) -> Option<ProjectSnapshot>
Adapter::inspect for a command a person ran: the format’s own
selection settings (its environment variables) apply.
Sourcefn blocking<'s>(&self, _snapshot: &'s ProjectSnapshot) -> Vec<&'s Diagnostic>
fn blocking<'s>(&self, _snapshot: &'s ProjectSnapshot) -> Vec<&'s Diagnostic>
Diagnostics that stop a run of the selected unit before any model call (the format’s preflight).
Sourcefn crosscheck(
&self,
_snapshot: &ProjectSnapshot,
_runner: &dyn CommandRunner,
) -> Vec<Diagnostic>
fn crosscheck( &self, _snapshot: &ProjectSnapshot, _runner: &dyn CommandRunner, ) -> Vec<Diagnostic>
The format’s own tools’ opinion of the selected unit, when they are
installed (read-only commands through runner).
Sourcefn tool(&self) -> Option<(&'static str, &'static str)>
fn tool(&self) -> Option<(&'static str, &'static str)>
The format’s own command-line tool and how to install it, for
doctor (None: the format has none).
Sourcefn requirements_file(&self) -> Option<&'static str>
fn requirements_file(&self) -> Option<&'static str>
The unit’s document that defines its requirements (spec.md in
Spec Kit), relative to the unit’s directory; None when the format
has no requirement identifiers.
Sourcefn requirements_in(&self, _text: &str) -> Vec<(String, String)>
fn requirements_in(&self, _text: &str) -> Vec<(String, String)>
The requirements text (the requirements file) defines, each with
the line that defines it, in the document’s order.
Sourcefn record_change(
&self,
_root: &Path,
_request: &str,
_checks: &[String],
) -> Result<Recorded, String>
fn record_change( &self, _root: &Path, _request: &str, _checks: &[String], ) -> Result<Recorded, String>
Records a quick change: request (with acceptance checks)
becomes a story, a requirement and a task in the format’s standing
unit for such changes. Err: the format has none.
Sourcefn requirement_ids(&self, root: &Path, unit_dir: &str) -> Vec<(String, String)>
fn requirement_ids(&self, root: &Path, unit_dir: &str) -> Vec<(String, String)>
The unit’s requirement identifiers, each with the hash of the line
that defines it (FR-001, SC-002 in Spec Kit): the rows of the
trace matrix. None when the format has no such identifiers.
Sourcefn current_pointer(&self) -> Option<&'static str>
fn current_pointer(&self) -> Option<&'static str>
The format’s per-checkout pointer to the current unit (repository-relative), if it has one.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".