Struct ApplicationDefinition
pub struct ApplicationDefinition {
pub app_id: &'static str,
pub title: &'static str,
pub icon: IconDescriptor,
pub record_kind: RecordKind,
pub required: Vec<PermissionScope>,
pub optional: Vec<PermissionScope>,
pub opens: &'static [&'static str],
pub room_record: bool,
pub create: fn(HostContext, LaunchTarget, RestoreInput) -> Result<AppComponent, LaunchError>,
}Fields§
§app_id: &'static str§title: &'static str§icon: IconDescriptor§record_kind: RecordKind§required: Vec<PermissionScope>§optional: Vec<PermissionScope>§opens: &'static [&'static str]Media types (type/subtype, lowercase) the component opens when a host
hands it a file (HostContext::take_open_file); ANY_MEDIA_TYPE
for a component that opens every file (a hex editor).
room_record: boolThe app keeps one record per room, the room’s own (a conversation everyone in the room shares), rather than a record per window: every window of the app in the room opens it, and the first creates it.
create: fn(HostContext, LaunchTarget, RestoreInput) -> Result<AppComponent, LaunchError>Implementations§
§impl ApplicationDefinition
impl ApplicationDefinition
pub fn keeps_room_record(&self) -> bool
pub fn keeps_room_record(&self) -> bool
Whether the app keeps one record per room, its package primary,
rather than a record per window (Self::room_record).
pub fn unsaved_target(
&self,
records: &RecordStore,
) -> Result<LaunchTarget, RecordOpenError>
pub fn unsaved_target( &self, records: &RecordStore, ) -> Result<LaunchTarget, RecordOpenError>
pub fn opens_media_type(&self, media_type: &str) -> bool
pub fn opens_media_type(&self, media_type: &str) -> bool
Whether the component opens files of media_type (parameters and case ignored).
ANY_MEDIA_TYPE among Self::opens opens every file.
pub fn instantiate(
&self,
context: HostContext,
target: LaunchTarget,
restore: RestoreInput,
) -> Result<AppComponent, LaunchError>
pub fn instantiate( &self, context: HostContext, target: LaunchTarget, restore: RestoreInput, ) -> Result<AppComponent, LaunchError>
Validate, invoke the one factory under its lifetime, then restore presentation only.
The factory projects through HostContext::read_record; no mutable Widget::sync
or second history/autosave initialization follows its View restoration.
§Errors
Ready records survive any checked validation or setup failure through
ComponentSetup’s strong owner; Reserved failures cancel without publication.
Auto Trait Implementations§
impl Freeze for ApplicationDefinition
impl RefUnwindSafe for ApplicationDefinition
impl Send for ApplicationDefinition
impl Sync for ApplicationDefinition
impl Unpin for ApplicationDefinition
impl UnsafeUnpin for ApplicationDefinition
impl UnwindSafe for ApplicationDefinition
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more