pub struct Access {
pub declared: Capabilities,
pub granted: Option<Capabilities>,
}Expand description
What an app may do: its declaration and the embedder’s grant (when the embedder limits it); an action must be allowed by both.
Fields§
§declared: CapabilitiesWhat the app declared (everything without a declaration).
granted: Option<Capabilities>What the embedding app grants it at most (None: what it declared).
Implementations§
Source§impl Access
impl Access
Sourcepub fn is_unrestricted(&self) -> bool
pub fn is_unrestricted(&self) -> bool
True when nothing is restricted (no check needed, redirects may be followed by the platform).
Sourcepub fn allows_process(&self, command: &str) -> bool
pub fn allows_process(&self, command: &str) -> bool
Whether an exact command is declared and granted. These capabilities always require explicit opt-in, including for legacy standalone apps.
Sourcepub fn allows_exit(&self) -> bool
pub fn allows_exit(&self) -> bool
Whether the app may request an exit from its host. This never exits the embedding process by itself; the host supplies the meaning of the request.
Sourcepub fn allows_env(&self, name: &str) -> bool
pub fn allows_env(&self, name: &str) -> bool
Whether an environment variable is visible. The built-in metadata names are always visible; other names require both app and host permission.
Resolve a filesystem path within both the declaration and host grant.
data_dir is an app-specific directory supplied only by the host.
Authorize a file with trusted host source and home directory anchors.
Sourcepub fn allows_socket(&self, host: &str, port: u16) -> bool
pub fn allows_socket(&self, host: &str, port: u16) -> bool
Whether a raw TCP connection to host:port may be opened: only an
exact network.sockets grant allows it, never hosts or http
grants, and Capabilities::all grants none.
Sourcepub fn allows_websocket(&self, url: &str) -> bool
pub fn allows_websocket(&self, url: &str) -> bool
Whether a WebSocket to url (ws: / wss:) may connect. The
handshake is an HTTP GET, so it is checked as a GET of the same URL
over http: / https:; legacy rules may also list ws / wss.
Sourcepub fn allows_http(&self, method: &str, url: &str) -> bool
pub fn allows_http(&self, method: &str, url: &str) -> bool
Whether fetch(url, { method }) may go out. asset: URIs are always
allowed.
Sourcepub fn allows_media(&self, uri: &str) -> bool
pub fn allows_media(&self, uri: &str) -> bool
Whether a media URL (image, video, canvas image) may be loaded.
Relative and asset: URIs are the app’s own files; data: URIs and
blob: URLs (URL.createObjectURL) are bytes the app already has.
Sourcepub fn media_redirect(
&self,
base: &str,
location: &str,
) -> Result<String, String>
pub fn media_redirect( &self, base: &str, location: &str, ) -> Result<String, String>
The next URL of a media load that was redirected from base to
location, if the app may load it: the redirect must stay on
http(s) and pass the same check as a first request, so loaders
follow redirects themselves, one hop at a time, and never contact
a target the app is not granted.
Sourcepub fn allows_webviews(&self) -> bool
pub fn allows_webviews(&self) -> bool
Whether web views are granted at all (inline HTML needs only this).
Sourcepub fn allows_webview(&self, url: &str) -> bool
pub fn allows_webview(&self, url: &str) -> bool
Whether a web view may show (or navigate to) url; about:blank
whenever web views are granted.
Sourcepub fn allows_web_input(&self) -> bool
pub fn allows_web_input(&self) -> bool
Whether a web view’s ref may give its page trusted input
(sendInput): declared and granted, never by default.
Sourcepub fn allows_status_bar(&self) -> bool
pub fn allows_status_bar(&self) -> bool
Whether the app may set the status bar.
Sourcepub fn allows_clipboard(&self) -> bool
pub fn allows_clipboard(&self) -> bool
Whether the app may read and write the system clipboard.
Sourcepub fn allows_picker(&self) -> bool
pub fn allows_picker(&self) -> bool
Whether the app may show the system’s picker (nsh/picker).
Sourcepub fn allows_speech(&self) -> bool
pub fn allows_speech(&self) -> bool
Whether the app may recognize the user’s speech (Speech of nsh).
Sourcepub fn allows_host(&self, name: &str) -> bool
pub fn allows_host(&self, name: &str) -> bool
Whether nsh/host may call the embedding app’s function name.
Sourcepub fn allows_open_url(&self, url: &str) -> bool
pub fn allows_open_url(&self, url: &str) -> bool
Whether the app may open url outside it (openUrl of
nsh/device): its scheme is granted.
Trait Implementations§
impl Eq for Access
impl StructuralPartialEq for Access
Auto Trait Implementations§
impl Freeze for Access
impl RefUnwindSafe for Access
impl Send for Access
impl Sync for Access
impl Unpin for Access
impl UnsafeUnpin for Access
impl UnwindSafe for Access
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.