pub struct StabilityPolicy {
pub allow: Vec<String>,
pub experimental: Vec<String>,
}Expand description
A project’s stability policy: what is experimental, and what it allows.
Fields§
§allow: Vec<String>The [unstable] allow entries, in manifest order.
experimental: Vec<String>The experimental item paths; an item under one is experimental too.
firstparty::experimental_items unless a test supplies its own.
Implementations§
Source§impl StabilityPolicy
impl StabilityPolicy
Sourcepub fn for_project(
project_root: Option<&Path>,
overlay: &HashMap<PathBuf, String>,
) -> Self
pub fn for_project( project_root: Option<&Path>, overlay: &HashMap<PathBuf, String>, ) -> Self
The policy for the project at project_root, reading [unstable] from
the overlay’s bynk.toml or the one on disk. No project root (a
single-file or in-memory build) allows nothing.
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
A policy under which nothing is experimental: for a first-party unit’s own bodies, whose dependencies are the library’s business.
Sourcepub fn is_experimental(&self, path: &str) -> bool
pub fn is_experimental(&self, path: &str) -> bool
Whether path is experimental.
Sourcepub fn blocks(&self, path: &str) -> bool
pub fn blocks(&self, path: &str) -> bool
Whether using path here is refused: it is experimental and no allow
entry covers it.
Sourcepub fn check(&self, path: &str, span: Span) -> Option<CompileError>
pub fn check(&self, path: &str, span: Span) -> Option<CompileError>
The error for a use of path at span, when Self::blocks refuses it.
Sourcepub fn manifest_diagnostics(&self) -> Vec<CompileError>
pub fn manifest_diagnostics(&self) -> Vec<CompileError>
The diagnostics for the [unstable] allow entries themselves, which
callers attribute to the project’s bynk.toml (MANIFEST): an error
for one that names no first-party
item, and a warning for one that reaches nothing experimental (stable
now, so it can go; never an error, so stabilising an item breaks no
build).
Sourcepub fn blocked_imports(
&self,
imported_from: &HashMap<String, String>,
) -> HashMap<String, String>
pub fn blocked_imports( &self, imported_from: &HashMap<String, String>, ) -> HashMap<String, String>
The names a unit imports that are experimental and not allowed, mapped
to their item paths: imported_from is name → providing unit, so the
path is unit.name. Decided once per unit, where provenance is known,
and carried to every check built from it.
Trait Implementations§
Source§impl Clone for StabilityPolicy
impl Clone for StabilityPolicy
Source§fn clone(&self) -> StabilityPolicy
fn clone(&self) -> StabilityPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StabilityPolicy
impl Debug for StabilityPolicy
Source§impl Default for StabilityPolicy
impl Default for StabilityPolicy
Source§fn default() -> Self
fn default() -> Self
Blocks nothing. A check input built without
crate::resolver::ResolvedCommons::with_stability (a suite case body,
resolve_recovering) is under neither rule, so the default must fail
open: a default that knew the experimental items but no allow would
refuse them while ignoring the project’s opt-in. The real policy is
built only by StabilityPolicy::for_project.
Source§impl PartialEq for StabilityPolicy
impl PartialEq for StabilityPolicy
impl Eq for StabilityPolicy
impl StructuralPartialEq for StabilityPolicy
Auto Trait Implementations§
impl Freeze for StabilityPolicy
impl RefUnwindSafe for StabilityPolicy
impl Send for StabilityPolicy
impl Sync for StabilityPolicy
impl Unpin for StabilityPolicy
impl UnsafeUnpin for StabilityPolicy
impl UnwindSafe for StabilityPolicy
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);