pub struct ResourceViewSpec {
pub id: String,
pub label: String,
pub description: Option<String>,
pub open_action: String,
pub primary: bool,
pub mount: Option<ResourceViewMountSpec>,
pub range: Option<ResourceViewRangeSpec>,
pub desktop: bool,
pub place: bool,
}Expand description
An explicit presentation of a resource, separate from the actions used to open or mount it.
id is the stable view identity. open_action and the optional mount
action are execution bindings and may change without turning every local
OperationKind::View action into an advertised resource view.
Fields§
§id: String§label: String§description: Option<String>§open_action: String§primary: bool§mount: Option<ResourceViewMountSpec>§range: Option<ResourceViewRangeSpec>§desktop: boolThe view opens on the whole desktop, not in its app alone full tab: what it shows comes from the desktop’s session (a workspace’s history, say), which a page showing one app does not run. A link to it opens the desktop at this view.
place: boolWhat a place of the resource shows when it stands as content on its own (a place on the canvas, an answer’s view) rather than as its app’s window: the view the words naming the resource, not its app, place it through. At most one view of a resource is so.
Implementations§
Source§impl ResourceViewSpec
impl ResourceViewSpec
pub fn new( id: impl Into<String>, label: impl Into<String>, open_action: impl Into<String>, ) -> Self
Sourcepub fn on_desktop(self) -> Self
pub fn on_desktop(self) -> Self
Open it on the whole desktop (Self::desktop).
pub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_primary(self, primary: bool) -> Self
Sourcepub fn with_place(self, place: bool) -> Self
pub fn with_place(self, place: bool) -> Self
Make it what a place of the resource shows on its own (Self::place).
pub fn with_mount(self, mount: ResourceViewMountSpec) -> Self
pub fn with_range(self, range: ResourceViewRangeSpec) -> Self
Sourcepub fn validate(&self, resource: &ResourceSpec) -> Vec<String>
pub fn validate(&self, resource: &ResourceSpec) -> Vec<String>
Validate this declaration against the actions exported by resource.
Cross-view invariants such as unique open actions and a single primary
view are checked by crate::validate_surface_contracts.
Trait Implementations§
Source§impl Clone for ResourceViewSpec
impl Clone for ResourceViewSpec
Source§impl Debug for ResourceViewSpec
impl Debug for ResourceViewSpec
Source§impl<'de> Deserialize<'de> for ResourceViewSpec
impl<'de> Deserialize<'de> for ResourceViewSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ResourceViewSpec
Source§impl PartialEq for ResourceViewSpec
impl PartialEq for ResourceViewSpec
Source§impl Serialize for ResourceViewSpec
impl Serialize for ResourceViewSpec
impl StructuralPartialEq for ResourceViewSpec
Auto Trait Implementations§
impl Forget for ResourceViewSpec
impl Freeze for ResourceViewSpec
impl Move for ResourceViewSpec
impl RefUnwindSafe for ResourceViewSpec
impl Send for ResourceViewSpec
impl Sync for ResourceViewSpec
impl Unpin for ResourceViewSpec
impl UnsafeUnpin for ResourceViewSpec
impl UnwindSafe for ResourceViewSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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