Common/Output/
DisposeOutputChannel.rs

1//! # DisposeOutputChannel Effect
2//!
3//! Defines the `ActionEffect` for permanently disposing of an output channel.
4
5use std::sync::Arc;
6
7use super::OutputChannelManager::OutputChannelManager;
8use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
9
10/// Creates an effect that, when executed, will dispose of the specified output
11/// channel, removing it and its content permanently from the application.
12///
13/// It uses the `OutputChannelManager` capability from the environment.
14///
15/// # Parameters
16/// * `ChannelIdentifier`: The unique ID of the target channel.
17///
18/// # Returns
19/// An `ActionEffect` that resolves to `()` on success.
20pub fn DisposeOutputChannel(ChannelIdentifier:String) -> ActionEffect<Arc<dyn OutputChannelManager>, CommonError, ()> {
21	ActionEffect::New(Arc::new(move |Manager:Arc<dyn OutputChannelManager>| {
22		let IdentifierClone = ChannelIdentifier.clone();
23
24		Box::pin(async move { Manager.Dispose(IdentifierClone).await })
25	}))
26}