Common/WorkSpace/
GetWorkSpaceName.rs

1//! # GetWorkSpaceName Effect
2//!
3//! Defines the `ActionEffect` for retrieving the name of the current
4//! workspace.
5
6use std::sync::Arc;
7
8use super::WorkSpaceProvider::WorkSpaceProvider;
9use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
10
11/// Creates an effect that, when executed, will retrieve the display name of the
12/// current workspace.
13///
14/// It uses the `WorkSpaceProvider` capability from the environment to perform
15/// the operation.
16///
17/// # Returns
18/// An `ActionEffect` that resolves with an `Option<String>` containing the
19/// workspace name.
20pub fn GetWorkSpaceName() -> ActionEffect<Arc<dyn WorkSpaceProvider>, CommonError, Option<String>> {
21	ActionEffect::New(Arc::new(move |Provider:Arc<dyn WorkSpaceProvider>| {
22		Box::pin(async move { Provider.GetWorkSpaceName().await })
23	}))
24}