pub struct DocExamples { /* private fields */ }Expand description
The synthetic files for a project’s doc examples, and the means to report their diagnostics at the fences.
Implementations§
Source§impl DocExamples
impl DocExamples
Sourcepub fn collect(sources: &HashMap<PathBuf, String>) -> Self
pub fn collect(sources: &HashMap<PathBuf, String>) -> Self
Scan every unit in sources for checked doc examples.
pub fn is_empty(&self) -> bool
Sourcepub fn has_base(&self) -> bool
pub fn has_base(&self) -> bool
Whether any file besides the context copies is added to a check.
Sourcepub fn layer_count(&self) -> usize
pub fn layer_count(&self) -> usize
The number of extra project checks the context copies need.
Sourcepub fn layer_overlay(
&self,
layer: usize,
sources: &HashMap<PathBuf, String>,
) -> HashMap<PathBuf, String>
pub fn layer_overlay( &self, layer: usize, sources: &HashMap<PathBuf, String>, ) -> HashMap<PathBuf, String>
sources with the context copies of layer in place of the contexts.
Sourcepub fn remap_layer(
&self,
layer: usize,
errors: Vec<AttributedError>,
) -> Vec<AttributedError>
pub fn remap_layer( &self, layer: usize, errors: Vec<AttributedError>, ) -> Vec<AttributedError>
The errors a context copy’s fence caused, in the real file. Only those inside the fence count: one the replaced declaration caused elsewhere is not the example’s to answer for.
Sourcepub fn example_count(&self) -> usize
pub fn example_count(&self) -> usize
The number of examples that will be checked.
Sourcepub fn has_runnable(&self) -> bool
pub fn has_runnable(&self) -> bool
Whether any example is marked bynk test.
Sourcepub fn check_overlay(
&self,
sources: &HashMap<PathBuf, String>,
) -> HashMap<PathBuf, String>
pub fn check_overlay( &self, sources: &HashMap<PathBuf, String>, ) -> HashMap<PathBuf, String>
sources plus every synthetic file, for the check.
Sourcepub fn run_overlay(
&self,
sources: &HashMap<PathBuf, String>,
) -> HashMap<PathBuf, String>
pub fn run_overlay( &self, sources: &HashMap<PathBuf, String>, ) -> HashMap<PathBuf, String>
sources plus the suites of the examples marked bynk test.
Sourcepub fn run_aliases(&self) -> Vec<(String, String)>
pub fn run_aliases(&self) -> Vec<(String, String)>
For each runnable suite, the synthetic file name and the real file name
to show in its place in the run’s output (calc.doc-examples.bynk ->
calc.bynk). The line and column are already the real file’s.
Sourcepub fn remap(&self, errors: Vec<AttributedError>) -> Vec<AttributedError>
pub fn remap(&self, errors: Vec<AttributedError>) -> Vec<AttributedError>
The errors the examples caused, in the real file. One a synthetic file produced is mapped to its fence. One attributed to a real file, such as a duplicate declaration reported at the original, is kept as it is with a note that the examples brought it about: the project compiled clean without them, so it is theirs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DocExamples
impl RefUnwindSafe for DocExamples
impl Send for DocExamples
impl Sync for DocExamples
impl Unpin for DocExamples
impl UnsafeUnpin for DocExamples
impl UnwindSafe for DocExamples
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();Source§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>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§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);