pub struct ReflectService { /* private fields */ }Expand description
Reflection and service-resolution API bound to a context.
Implementations§
Source§impl ReflectService
impl ReflectService
Sourcepub fn get<T>(&self, name: &str, strict: bool) -> Result<Option<Arc<T>>>
pub fn get<T>(&self, name: &str, strict: bool) -> Result<Option<Arc<T>>>
Read and downcast a service.
Sourcepub fn get_value(&self, name: &str, strict: bool) -> Result<Option<Value>>
pub fn get_value(&self, name: &str, strict: bool) -> Result<Option<Value>>
Read a type-erased service or accessor result.
Sourcepub fn provide_value(
&self,
name: String,
value: Value,
check: Option<Arc<dyn Fn(&Value) -> bool + Send + Sync + 'static>>,
) -> Result<EffectHandle>
pub fn provide_value( &self, name: String, value: Value, check: Option<Arc<dyn Fn(&Value) -> bool + Send + Sync + 'static>>, ) -> Result<EffectHandle>
Register a type-erased service and optional availability predicate.
Sourcepub fn provide_checked<T, F>(
&self,
name: impl Into<String>,
value: T,
check: F,
) -> Result<EffectHandle>
pub fn provide_checked<T, F>( &self, name: impl Into<String>, value: T, check: F, ) -> Result<EffectHandle>
Register a service with an availability predicate.
Sourcepub fn set_value(&self, name: &str, value: Value) -> Result<()>
pub fn set_value(&self, name: &str, value: Value) -> Result<()>
Replace a service or computed property value.
Sourcepub fn accessor(&self, name: String, accessor: Accessor) -> Result<EffectHandle>
pub fn accessor(&self, name: String, accessor: Accessor) -> Result<EffectHandle>
Define a dynamic computed context property.
Sourcepub fn alias(
&self,
alias: impl Into<String>,
target: impl Into<String>,
) -> Result<EffectHandle>
pub fn alias( &self, alias: impl Into<String>, target: impl Into<String>, ) -> Result<EffectHandle>
Alias one reflected service name to another. This is the explicit Rust
counterpart of the original dynamic mixin() forwarding.
Sourcepub fn notify<I, S>(&self, names: I) -> Vec<Fiber>
pub fn notify<I, S>(&self, names: I) -> Vec<Fiber>
Re-evaluate fibers that inject any of the named services.
This is useful after an availability predicate registered with
provide_checked changes without replacing
the service value. The returned fibers were in a matching isolation
scope and were asked to reconcile.
Sourcepub fn properties(&self) -> HashMap<String, Property>
pub fn properties(&self) -> HashMap<String, Property>
List reflected property declarations.
Sourcepub fn services(&self) -> Vec<ServiceInfo>
pub fn services(&self) -> Vec<ServiceInfo>
List concrete service implementations in all isolation scopes.
Trait Implementations§
Source§impl Clone for ReflectService
impl Clone for ReflectService
Source§fn clone(&self) -> ReflectService
fn clone(&self) -> ReflectService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more