pub struct ConfigService;Implementations§
Source§impl ConfigService
impl ConfigService
Sourcepub fn find_config() -> Result<PathBuf, Error>
pub fn find_config() -> Result<PathBuf, Error>
Find mecha10.json in the current directory or any parent directory
Searches upward from the current working directory until it finds a mecha10.json file or reaches the root directory.
§Returns
Returns the path to the found configuration file.
§Errors
Returns an error if no mecha10.json file is found in the current directory or any parent directory.
Sourcepub fn is_initialized(dir: &Path) -> bool
pub fn is_initialized(dir: &Path) -> bool
Sourcepub fn is_initialized_here() -> bool
pub fn is_initialized_here() -> bool
Check if a project is initialized in the current directory
Sourcepub fn resolve_and_validate(path: Option<&Path>) -> Result<PathBuf, Error>
pub fn resolve_and_validate(path: Option<&Path>) -> Result<PathBuf, Error>
Resolve the config file to validate and validate it – the single
implementation shared by mecha10 config validate and the config-validation
step in mecha10 lint, so neither re-implements this logic locally.
pathisNone(the default): finds the project’smecha10.jsonviaSelf::find_configand validates it plus every node config it references (viamecha10_core::schema_validation::validate_project_config).pathisSome: validates exactly that one file, auto-detecting whether it’s a project config or a node config (viamecha10_core::schema_validation::validate_config_file) – no recursion into other files. This is the mode a git hook uses to check only the files staged in a commit.
Every referenced node config, built-in or custom, resolves its declared schema via a
<name>.schema.json file shipped alongside it (LAB-4388/LAB-4390) – a node with no
declared schema hard-errors naming it (LAB-4066; there is no generic envelope to fall
back to).
§Returns
The path that was validated, so callers can report it.
§Errors
Returns an error with the underlying schema-validation failure details if the target file doesn’t exist or fails validation.
Auto Trait Implementations§
impl Freeze for ConfigService
impl RefUnwindSafe for ConfigService
impl Send for ConfigService
impl Sync for ConfigService
impl Unpin for ConfigService
impl UnsafeUnpin for ConfigService
impl UnwindSafe for ConfigService
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> 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