CommonLibrary/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}