#[non_exhaustive]pub enum Reason {
GrantedByInvocation,
GrantedByUserLayer,
SandboxByDefault,
SandboxByInvocation,
SandboxByUserLayer,
SandboxByProjectDenial,
}Expand description
Which layer decided, and therefore what the person should be told.
Every variant carries one sentence of explanation, because a decision the
person did not make is one they have to be able to account for — most of all
when it overrules something they did say. --allow-unsandboxed in a
repository that denies host execution runs sandboxed, and that has to be a
sentence rather than a silence.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
GrantedByInvocation
Host execution was granted by --allow-unsandboxed on this run.
GrantedByUserLayer
Host execution was granted by the user’s own config, with no flag needed.
SandboxByDefault
Nobody asked for anything — the default, and the common case.
SandboxByInvocation
--sandboxed was passed.
SandboxByUserLayer
The user’s own config says false, so the host is off the table.
SandboxByProjectDenial
This repository’s roteiro.toml denied host execution. Nothing
overrides this, including --allow-unsandboxed.
Implementations§
Source§impl Reason
impl Reason
Sourcepub fn explanation(self) -> &'static str
pub fn explanation(self) -> &'static str
One sentence naming which layer decided, for the line printed before the run.
Phrased to complete “running clippy …”, so the two backends’ disclosures read alike and a person can tell at a glance which one they got.
Sourcepub fn host_escape(self) -> Option<Guidance>
pub fn host_escape(self) -> Option<Guidance>
How this person could run on the host instead, if the sandbox cannot be
had — or None when they could not.
Consulted only by a refusal, and it exists so that a refusal names a way
forward that would actually work for this reason. Telling someone in
a repository that denies host execution to pass --allow-unsandboxed
would waste their time, and telling someone who is already on the host
how to get there would be nonsense. Both were live bugs in the shape this
replaces (#426’s refusals rule).
A Guidance rather than a &'static str, because this text is
multi-line and carries commands people paste. Written as one wrapped
literal it leaked its own source indentation into shipped output; written
as lines and fragments it cannot.
Trait Implementations§
impl Copy for Reason
impl Eq for Reason
impl StructuralPartialEq for Reason
Auto Trait Implementations§
impl Freeze for Reason
impl RefUnwindSafe for Reason
impl Send for Reason
impl Sync for Reason
impl Unpin for Reason
impl UnsafeUnpin for Reason
impl UnwindSafe for Reason
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,
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.