Skip to main content

Declaration

Struct Declaration 

Source
pub struct Declaration { /* private fields */ }

Implementations§

Source§

impl Declaration

Source

pub fn address(&self) -> Result<Address>

Read the native object’s canonical service address.

Source

pub fn state<T: Serialize + 'static>( &self, initial: T, version: u32, validate: impl Fn(&T) -> Result<()> + 'static, ) -> Result<State<T>>

Declare one typed object state owned by this scope.

Source

pub fn validate_on_reload( &self, check: impl Fn() -> Result<()> + 'static, ) -> Result<()>

Add an adapter-owned check of retained state during the kernel’s replacement program.

Source

pub fn resource<T: 'static>( &self, name: &str, version: u32, open: impl FnOnce() -> Result<T> + 'static, close: impl FnOnce(Rc<T>, Context) -> LocalBoxFuture<'static, Result<()>> + 'static, ) -> Result<Resource<T>>

Declares a synchronous opener. The kernel runs it after the factory returns.

Source

pub fn resource_async<T: 'static>( &self, name: &str, version: u32, dependencies: &[ResourceKey], open: impl FnOnce(Context) -> LocalBoxFuture<'static, Result<T>> + 'static, close: impl FnOnce(Rc<T>, Context) -> LocalBoxFuture<'static, Result<()>> + 'static, ) -> Result<Resource<T>>

Declares an asynchronous resource whose dependencies must physically open first. The opener and the closer each get a context of the resource’s owner, outside any call: its log is attributed to the owning Orb, its address is the owning object’s, for a resource of an object, and the opener’s signal is the resource’s own, which a cancelled opening fires; its principal is host, as a cleanup’s.

Source§

impl Declaration

Source

pub fn orb<T: 'static>(&self) -> Result<Rc<T>>

Access the shared environment created once by this orb’s factory.

Source

pub fn host_resource<T: 'static>(&self, name: &str) -> Result<Resource<T>>

Resolve a host resource by its declaration name.

Source

pub fn get(&self, service: &str, key: Vec<String>) -> Result<Rc<Reference>>

Acquire a required service with this scope’s ownership and readiness edges. Factories receive the handle immediately; activation waits for its dependency.

Source§

impl Declaration

Source

pub fn task( &self, start: impl FnOnce(TaskScope) -> LocalBoxFuture<'static, Result<()>> + 'static, ) -> Result<()>

Declare background work to start after this scope is activated.

Trait Implementations§

Source§

impl Clone for Declaration

Source§

fn clone(&self) -> Self

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.