Skip to main content

ReflectService

Struct ReflectService 

Source
pub struct ReflectService { /* private fields */ }
Expand description

Reflection and service-resolution API bound to a context.

Implementations§

Source§

impl ReflectService

Source

pub fn get<T>(&self, name: &str, strict: bool) -> Result<Option<Arc<T>>>
where T: Send + Sync + 'static,

Read and downcast a service.

Source

pub fn get_value(&self, name: &str, strict: bool) -> Result<Option<Value>>

Read a type-erased service or accessor result.

Source

pub fn require<T>(&self, name: &str) -> Result<Arc<T>>
where T: Send + Sync + 'static,

Require and downcast an active service.

Source

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.

Source

pub fn provide_checked<T, F>( &self, name: impl Into<String>, value: T, check: F, ) -> Result<EffectHandle>
where T: Send + Sync + 'static, F: Fn(&T) -> bool + Send + Sync + 'static,

Register a service with an availability predicate.

Source

pub fn set_value(&self, name: &str, value: Value) -> Result<()>

Replace a service or computed property value.

Source

pub fn accessor(&self, name: String, accessor: Accessor) -> Result<EffectHandle>

Define a dynamic computed context property.

Source

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.

Source

pub fn notify<I, S>(&self, names: I) -> Vec<Fiber>
where I: IntoIterator<Item = S>, S: AsRef<str>,

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.

Source

pub fn properties(&self) -> HashMap<String, Property>

List reflected property declarations.

Source

pub fn services(&self) -> Vec<ServiceInfo>

List concrete service implementations in all isolation scopes.

Trait Implementations§

Source§

impl Clone for ReflectService

Source§

fn clone(&self) -> ReflectService

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReflectService

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.