pub trait TargetAdapter:
Debug
+ Send
+ Sync {
// Required methods
fn name(&self) -> &str;
fn skill_variant_key(&self) -> Option<&str>;
fn default_dest_path(&self, kind: ItemKind, name: &str) -> Option<DestPath>;
// Provided methods
fn write_config_entries(
&self,
_entries: &[ConfigEntry],
_target_dir: &Path,
) -> Result<Vec<PathBuf>, MarsError> { ... }
fn emit_pre_write_diagnostics(
&self,
_entries: &[ConfigEntry],
_diag: &mut DiagnosticCollector,
) { ... }
fn remove_config_entries(
&self,
_entry_keys: &[String],
_target_dir: &Path,
) -> Result<(), MarsError> { ... }
}Expand description
Per-target compilation adapter.
Implementations encapsulate all per-target knowledge:
- Which item kinds this target accepts
- Default destination path layout
- Config-entry format (future: MCP, hooks, model aliases)
The trait is split into file-output surfaces and config-entry surfaces so parallel pipeline lanes can own disjoint write responsibilities without interfering with each other.
§Object safety
All methods take &self and return concrete types to ensure the trait can
be used as dyn TargetAdapter.
Required Methods§
Sourcefn skill_variant_key(&self) -> Option<&str>
fn skill_variant_key(&self) -> Option<&str>
Skill variant harness key used when projecting skills to this target.
Native harness targets return the variants/<key>/ directory name they
consume. Full-fidelity targets that should not select skill variants
return None.
Provided Methods§
Sourcefn write_config_entries(
&self,
_entries: &[ConfigEntry],
_target_dir: &Path,
) -> Result<Vec<PathBuf>, MarsError>
fn write_config_entries( &self, _entries: &[ConfigEntry], _target_dir: &Path, ) -> Result<Vec<PathBuf>, MarsError>
Write config entries (MCP servers, hooks) to this target’s config file.
Returns the paths of files written, for lock tracking. Default: no-op — targets that don’t use a config file leave this as-is.
Sourcefn emit_pre_write_diagnostics(
&self,
_entries: &[ConfigEntry],
_diag: &mut DiagnosticCollector,
)
fn emit_pre_write_diagnostics( &self, _entries: &[ConfigEntry], _diag: &mut DiagnosticCollector, )
Emit target-specific pre-write diagnostics (e.g., lossiness warnings).
Called unconditionally before write_config_entries, even on dry runs.
Default: no-op — most targets have no pre-write diagnostics.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".