pub struct NodeSpec {
pub name: String,
pub identifier: String,
pub source: NodeSource,
}Expand description
Parsed node specification from namespaced string format
Node identifiers follow this format:
@mecha10/listener- Framework node (bundled in CLI)my-custom- Project node (built from local workspace, no prefix needed)@someorg/cool-node- Registry node (future, from npm-like registry)
The legacy @local/* prefix is no longer supported; use the plain unprefixed name instead.
Config paths follow the identifier:
configs/nodes/@mecha10/listener/config.jsonconfigs/nodes/my-custom/config.json
Fields§
§name: StringNode name (derived from identifier, used in lifecycle modes)
identifier: StringFull namespaced identifier
source: NodeSourceNode source type
Implementations§
Source§impl NodeSpec
impl NodeSpec
Sourcepub fn parse(identifier: &str) -> Result<NodeSpec, Error>
pub fn parse(identifier: &str) -> Result<NodeSpec, Error>
Parse a node identifier string into a NodeSpec
§Examples
use mecha10_cli_core::types::{NodeSource, NodeSpec};
let spec = NodeSpec::parse("@mecha10/listener").unwrap();
assert_eq!(spec.name, "listener");
assert_eq!(spec.source, NodeSource::Framework);
let spec = NodeSpec::parse("my-custom").unwrap();
assert_eq!(spec.name, "my-custom");
assert_eq!(spec.source, NodeSource::Project);
// The legacy `@local/*` prefix is no longer supported.
assert!(NodeSpec::parse("@local/my-custom").is_err());Sourcepub fn is_framework(&self) -> bool
pub fn is_framework(&self) -> bool
Check if this is a framework node
Sourcepub fn is_project(&self) -> bool
pub fn is_project(&self) -> bool
Check if this is a project node
Sourcepub fn package_path(&self) -> String
pub fn package_path(&self) -> String
Get the package/crate path for this node
- Framework: mecha10-nodes-{name}
- Project: nodes/{name}
- Registry: node_modules/@{org}/{name} (future)
Sourcepub fn config_dir(&self) -> String
pub fn config_dir(&self) -> String
Get the config directory path for this node (relative to project root)
Config path follows the identifier structure:
@mecha10/listener→configs/nodes/@mecha10/listener/my-custom→configs/nodes/my-custom/@someorg/node→configs/nodes/@someorg/node/
Delegates to crate::paths::config::framework_node_dir/project_node (the canonical
2-tier node-config path helpers) rather than hand-rolling the configs/nodes/...
literal, so this can’t silently drift from the canonical resolution order the way
mecha10_core::Context::load_node_config once did (LAB-2011).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeSpec
impl RefUnwindSafe for NodeSpec
impl Send for NodeSpec
impl Sync for NodeSpec
impl Unpin for NodeSpec
impl UnsafeUnpin for NodeSpec
impl UnwindSafe for NodeSpec
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,
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