#[non_exhaustive]pub struct PermissionsPolicy { /* private fields */ }Expand description
Features an app allows on top of the Permissions-Policy, from
App::permissions_policy.
The default policy switches off the browser features a typical app never
uses (camera, microphone, geolocation, payment, usb…); each
allow turns one back on, for the site itself,
for another origin or for everyone.
App::new().permissions_policy(|p| {
p.allow("geolocation", "self")
.allow("payment", "https://pay.example.com");
})Implementations§
Source§impl PermissionsPolicy
impl PermissionsPolicy
Sourcepub fn allow(&mut self, feature: &str, origin: &str) -> &mut Self
pub fn allow(&mut self, feature: &str, origin: &str) -> &mut Self
Allows feature (e.g. geolocation, camera) for origin: self
(this site), * (everyone) or an origin such as
https://pay.example.com. Calling it again adds more origins. A name
or origin the header cannot carry makes the app fail at boot.
p.allow("camera", "self").allow("camera", "https://scan.example.com");Trait Implementations§
Source§impl Clone for PermissionsPolicy
impl Clone for PermissionsPolicy
Source§impl Debug for PermissionsPolicy
impl Debug for PermissionsPolicy
Auto Trait Implementations§
impl Freeze for PermissionsPolicy
impl RefUnwindSafe for PermissionsPolicy
impl Send for PermissionsPolicy
impl Sync for PermissionsPolicy
impl Unpin for PermissionsPolicy
impl UnsafeUnpin for PermissionsPolicy
impl UnwindSafe for PermissionsPolicy
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
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,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
Converts
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> ⓘ
Converts
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