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)@local/my-custom- Project node (built from local workspace)@someorg/cool-node- Registry node (future, from npm-like registry)
Config paths follow the identifier:
configs/nodes/@mecha10/listener/config.jsonconfigs/nodes/@local/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<Self>
pub fn parse(identifier: &str) -> Result<Self>
Parse a node identifier string into a NodeSpec
§Examples
let spec = NodeSpec::parse("@mecha10/listener").unwrap();
assert_eq!(spec.name, "listener");
assert_eq!(spec.source, NodeSource::Framework);
let spec = NodeSpec::parse("@local/my-custom").unwrap();
assert_eq!(spec.name, "my-custom");
assert_eq!(spec.source, NodeSource::Project);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/@local/my-custom→configs/nodes/@local/my-custom/@someorg/node→configs/nodes/@someorg/node/
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 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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