pub struct Component {
pub id: String,
pub name: String,
pub description: String,
pub component_type: ComponentType,
pub version: String,
pub category: String,
pub tags: Vec<String>,
pub cargo_dependencies: Vec<CargoDependency>,
pub files: Vec<FileTemplate>,
pub mecha10_config: Mecha10Config,
}Expand description
A component that can be added to a project
Fields§
§id: String§name: String§description: String§component_type: ComponentType§version: String§category: String§cargo_dependencies: Vec<CargoDependency>Cargo dependencies to add
files: Vec<FileTemplate>Files to generate
mecha10_config: Mecha10ConfigConfiguration to add to mecha10.json
Implementations§
Source§impl Component
impl Component
Sourcepub fn relevant_lifecycle_modes(&self) -> Vec<&'static str>
pub fn relevant_lifecycle_modes(&self) -> Vec<&'static str>
Infer which targets entries this component is relevant to, so newly added/selected
nodes (via mecha10 init or mecha10 add) can be appended to the matching target’s
nodes list and actually get spawned by CliLifecycleManager::nodes_for_current_mode.
- AI/perception components (tagged with any of [
AI_PERCEPTION_TAGS]) are relevant tosimulation(they consume the simulator’s synthetic camera feed). - Everything else - including hardware-backed components (drivers, or package nodes
whose
run_targetis"robot") - has no inferredsimulationmembership. Real-hardware placement is fully described bytargets.robot/targets.remote(Self::relevant_target) - there’s no separate"hardware"target to add these to any more (removed: it was a redundant subset oftargets.robot, and a real robot/remote deployment always runs its full configured target list unfiltered).
Sourcepub fn relevant_target(&self) -> Option<&'static str>
pub fn relevant_target(&self) -> Option<&'static str>
Infer which targets entry (see
mecha10_cli_core::types::project::targets::TargetsConfig) this component should be
dispatched to, so mecha10 add/mecha10 init can keep targets.robot/targets.remote
in sync with the node’s own run_target, the same way Self::relevant_lifecycle_modes
keeps targets.simulation.nodes in sync.
Falls back to None for anything without a driver/custom_node run_target of
exactly "robot" or "remote" (e.g. run_target: "dev", or components with neither
config block) - those aren’t meaningfully “targeted” and stay under manual control.
Sourcepub fn relevant_target_keys(&self) -> Vec<&'static str>
pub fn relevant_target_keys(&self) -> Vec<&'static str>
The full, deduplicated set of targets keys this component should be registered under -
Self::relevant_lifecycle_modes and Self::relevant_target combined into the single
list callers actually need to loop over when keeping nodes/lifecycle/targets in sync
(LAB-2155: the one piece of “which sections does this node belong in” completeness logic
shared by both the mecha10 add and mecha10 init code paths for writing a node into
mecha10.json).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Component
impl<'de> Deserialize<'de> for Component
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Component
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnsafeUnpin for Component
impl UnwindSafe for Component
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more