pub struct Declaration { /* private fields */ }Implementations§
Source§impl Declaration
impl Declaration
Sourcepub fn state<T: Serialize + 'static>(
&self,
initial: T,
version: u32,
validate: impl Fn(&T) -> Result<()> + 'static,
) -> Result<State<T>>
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.
Sourcepub fn validate_on_reload(
&self,
check: impl Fn() -> Result<()> + 'static,
) -> Result<()>
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.
Sourcepub 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>>
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.
Sourcepub 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>>
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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Declaration
impl !Send for Declaration
impl !Sync for Declaration
impl !UnwindSafe for Declaration
impl Forget for Declaration
impl Freeze for Declarationwhere
*const RcInner<Inner> is !null: Freeze,
PhantomData<RcInner<Inner>>: Freeze,
*const RcInner<Draft> is !null: Freeze,
PhantomData<RcInner<Draft>>: Freeze,
impl Move for Declaration
impl Unpin for Declaration
impl UnsafeUnpin for Declarationwhere
*const RcInner<Inner> is !null: UnsafeUnpin,
PhantomData<RcInner<Inner>>: UnsafeUnpin,
*const RcInner<Draft> is !null: UnsafeUnpin,
PhantomData<RcInner<Draft>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more