pub struct ExistsCommandController { /* private fields */ }Expand description
Presentation layer controller for exists command workflow
Checks whether an environment exists and outputs a boolean result. This is a read-only command that checks local data only.
§Responsibilities
- Validate environment name format
- Delegate to application layer for existence check
- Output
trueorfalseto stdout
§Output Contract
- stdout:
trueorfalse(bare value, valid JSON) - exit code 0: Command completed successfully (result is on stdout)
- exit code 1: An error occurred (e.g., repository failure)
§Architecture
This controller intentionally does NOT use ProgressReporter because
the exists check is a sub-millisecond operation. Progress reporting
would add noise without value.
Implementations§
Source§impl ExistsCommandController
impl ExistsCommandController
Sourcepub fn new(
repository: Arc<dyn EnvironmentRepository + Send + Sync>,
user_output: Arc<ReentrantMutex<RefCell<UserOutput>>>,
) -> Self
pub fn new( repository: Arc<dyn EnvironmentRepository + Send + Sync>, user_output: Arc<ReentrantMutex<RefCell<UserOutput>>>, ) -> Self
Create a new ExistsCommandController with dependencies
§Arguments
repository- Environment repository for checking existenceuser_output- Shared output service for result display
Sourcepub fn execute(
&self,
environment_name: &str,
output_format: OutputFormat,
) -> Result<(), ExistsSubcommandError>
pub fn execute( &self, environment_name: &str, output_format: OutputFormat, ) -> Result<(), ExistsSubcommandError>
Execute the exists command workflow
This method orchestrates a simple workflow:
- Validate environment name
- Check existence via application layer
- Output boolean result to stdout
§Arguments
environment_name- Name of the environment to checkoutput_format- Output format (Text or Json)
§Errors
Returns ExistsSubcommandError if any step fails
Auto Trait Implementations§
impl Freeze for ExistsCommandController
impl !RefUnwindSafe for ExistsCommandController
impl !Send for ExistsCommandController
impl !Sync for ExistsCommandController
impl Unpin for ExistsCommandController
impl UnsafeUnpin for ExistsCommandController
impl !UnwindSafe for ExistsCommandController
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request