Skip to main content

Access

Struct Access 

Source
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: Capabilities

What 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

Source

pub fn all() -> Access

Everything allowed.

Source

pub fn is_unrestricted(&self) -> bool

True when nothing is restricted (no check needed, redirects may be followed by the platform).

Source

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.

Source

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.

Source

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.

Source

pub fn authorize_file( &self, path: &Path, data_dir: &Path, write: bool, ) -> Result<PathBuf, FileRefusal>

Resolve a filesystem path within both the declaration and host grant. data_dir is an app-specific directory supplied only by the host.

Source

pub fn authorize_file_with_paths( &self, path: &Path, data_dir: &Path, paths: &TrustedPaths, write: bool, ) -> Result<PathBuf, FileRefusal>

Authorize a file with trusted host source and home directory anchors.

Source

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.

Source

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.

Source

pub fn allows_http(&self, method: &str, url: &str) -> bool

Whether fetch(url, { method }) may go out. asset: URIs are always allowed.

Source

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.

Source

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.

Source

pub fn allows_webviews(&self) -> bool

Whether web views are granted at all (inline HTML needs only this).

Source

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.

Source

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.

Source

pub fn allows_status_bar(&self) -> bool

Whether the app may set the status bar.

Source

pub fn allows_clipboard(&self) -> bool

Whether the app may read and write the system clipboard.

Source

pub fn allows_picker(&self) -> bool

Whether the app may show the system’s picker (nsh/picker).

Source

pub fn allows_speech(&self) -> bool

Whether the app may recognize the user’s speech (Speech of nsh).

Source

pub fn allows_host(&self, name: &str) -> bool

Whether nsh/host may call the embedding app’s function name.

Source

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§

Source§

impl Clone for Access

Source§

fn clone(&self) -> Access

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
Source§

impl Debug for Access

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Access

Source§

fn default() -> Access

Returns the “default value” for a type. Read more
Source§

impl Eq for Access

Source§

impl PartialEq for Access

Source§

fn eq(&self, other: &Access) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Access

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ParallelSend for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more