Common/LanguageFeature/
UnregisterProvider.rs

1//! # UnregisterProvider Effect
2//!
3//! Defines the `ActionEffect` for unregistering a language feature provider.
4
5use std::sync::Arc;
6
7use super::LanguageFeatureProviderRegistry::LanguageFeatureProviderRegistry;
8use crate::{Effect::ActionEffect::ActionEffect, Error::CommonError::CommonError};
9
10/// Creates an effect that, when executed, will unregister a language feature
11/// provider from the host's central registry using its unique handle.
12///
13/// It uses the `LanguageFeatureProviderRegistry` capability from the
14/// environment.
15///
16/// # Parameters
17/// * `Handle`: The `u32` handle that was returned when the provider was
18///   registered.
19///
20/// # Returns
21/// An `ActionEffect` that resolves to `()` on success.
22pub fn UnregisterProvider(Handle:u32) -> ActionEffect<Arc<dyn LanguageFeatureProviderRegistry>, CommonError, ()> {
23	ActionEffect::New(Arc::new(move |Registry:Arc<dyn LanguageFeatureProviderRegistry>| {
24		Box::pin(async move { Registry.UnregisterProvider(Handle).await })
25	}))
26}