pub struct ProjectService { /* private fields */ }Expand description
Project service for project management operations
§Examples
use mecha10_cli::services::ProjectService;
use std::path::Path;
// Detect project from current directory
let project = ProjectService::detect(Path::new("."))?;
println!("Project: {}", project.name()?);
// Validate project structure
project.validate()?;
// List all nodes
let nodes = project.list_nodes()?;Implementations§
Source§impl ProjectService
impl ProjectService
Sourcepub fn new(path: PathBuf) -> Self
pub fn new(path: PathBuf) -> Self
Create a new project at the given path
This does not generate the project structure, it just creates a ProjectService instance for a path where a project will be created. Use the init handler to actually create project files.
§Arguments
path- Path where the project will be created
Sourcepub fn config_path(&self) -> PathBuf
pub fn config_path(&self) -> PathBuf
Get the path to mecha10.json
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if a mecha10.json exists at the project root
Sourcepub fn name(&self) -> Result<String>
pub fn name(&self) -> Result<String>
Get project name from metadata
Tries mecha10.json first, then falls back to Cargo.toml
Sourcepub fn version(&self) -> Result<String>
pub fn version(&self) -> Result<String>
Get project version from metadata
Tries mecha10.json first, then falls back to Cargo.toml
Sourcepub fn load_metadata(&self) -> Result<(String, String)>
pub fn load_metadata(&self) -> Result<(String, String)>
Load project metadata (name and version)
Tries mecha10.json first, then falls back to Cargo.toml
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate project structure
Checks that required directories and files exist.
Sourcepub fn list_nodes(&self) -> Result<Vec<String>>
pub fn list_nodes(&self) -> Result<Vec<String>>
List all nodes in the project
Returns a list of node names found in the nodes/ directory.
Sourcepub fn list_drivers(&self) -> Result<Vec<String>>
pub fn list_drivers(&self) -> Result<Vec<String>>
List all drivers in the project
Returns a list of driver names found in the drivers/ directory.
Sourcepub fn list_types(&self) -> Result<Vec<String>>
pub fn list_types(&self) -> Result<Vec<String>>
List all custom types in the project
Returns a list of type names found in the types/ directory.
Sourcepub async fn list_enabled_nodes(&self) -> Result<Vec<String>>
pub async fn list_enabled_nodes(&self) -> Result<Vec<String>>
List all enabled nodes from configuration
Loads the project config and returns enabled nodes.
Auto Trait Implementations§
impl Freeze for ProjectService
impl RefUnwindSafe for ProjectService
impl Send for ProjectService
impl Sync for ProjectService
impl Unpin for ProjectService
impl UnwindSafe for ProjectService
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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