pub struct CompileOptions {Show 21 fields
pub out_dir: Option<PathBuf>,
pub target: BuildTarget,
pub platform: Platform,
pub roots: Roots,
pub import_ext: ImportExt,
pub contracts: bool,
pub trace_requests: bool,
pub inspect_agents: bool,
pub tests: bool,
pub sources: Option<HashMap<PathBuf, String>>,
pub schema_registry: SchemaLock,
pub contracts_lock: Option<String>,
pub compatibility_flags: Vec<String>,
pub workers_dev: Option<bool>,
pub asset_files: Option<AssetFolder>,
pub embed_files: Option<EmbedFolder>,
pub fixture_files: Option<FixtureFolder>,
pub migration_files: Option<AssetFolder>,
pub snapshot_files: Option<BTreeMap<String, String>>,
pub progress: Option<ProgressSink>,
pub remote_tests: Option<RemoteTests>,
}Expand description
Options for compile_project. Construct with CompileOptions::single or
CompileOptions::split, then chain .target(…) / .platform(…) /
.import_ext(…) to override the bundle/default-platform/.js defaults.
Fields§
§out_dir: Option<PathBuf>#3477: the directory the build will be written to, when the caller knows
it (bynk build and bynk compile), so a container’s build paths can be
written from the Worker’s output directory back to the project. None
uses the project’s [build] out.
target: BuildTarget§platform: Platform§roots: Roots§import_ext: ImportExtThe import-specifier extension (slice 2). Js (default) for normal builds;
Ts for the bynk test --inspect debug build.
contracts: boolv0.115 (testing track slice 3, DECISION J): the build profile for function
contracts. true (dev/test) emits the call-site guard around a contracted
fn; false (release/deploy) strips it entirely for zero runtime cost.
bynk test and --inspect set it on; bynk compile leaves it off.
trace_requests: bool#3580 (the dev request-traces track): emit the per-request trace recording
(__bynk_runtime/trace) into a Workers build, for bynk dev --trace-events. false for every other build, so a deploy build’s
output is byte-identical. Dev-only by construction: only bynk dev sets it.
inspect_agents: bool#3581 (the dev agent-inspection track): emit the dev-only agent registry,
the /_bynk/inspect routes and the instance recording into a Workers
build, for bynk dev. false for every other build, so a deploy build’s
output is byte-identical. Dev-only by construction: only bynk dev sets it.
tests: bool#1821 (ADR 0147 D3): whether suites are type-checked and emitted (the
tests/ modules and tests/main.ts). On by default; bynk compile
and the driver’s dev/deploy build turn it off, so a suite never reaches
the deployable. bynk test leaves it on. Off strips suites after
parsing: a file that does not parse still fails the build, since it
cannot be told apart from production source.
sources: Option<HashMap<PathBuf, String>>#57 (testing track): when Some, every file roots would otherwise
discover on disk is instead read from here — keyed the same way
discovery::read_source’s overlay is (a canonicalised absolute path,
falling back to the literal path when the file has no on-disk
counterpart to canonicalise). Filesystem discovery is skipped entirely;
roots still supplies src_root/tests_root and their prefixes, so a
Roots::Split project can drive both trees in-memory.
#1077/#1081: bynk-driver’s project_options/try_project_options
do set this now — the real CLI entry points walk and read every
project file themselves and hand the result here, so bynk-emit
itself no longer discovers or reads anything on disk for the CLI
path. bynk/the LSP still don’t: bynk routes through
bynk-driver, and the LSP (bynk_check::analysis::analyse_project
since P4.2) never goes through CompileOptions at all — it has its
own, separate discovery path (#1079). bynk-emit’s own tests also
set this, to exercise the full
project pipeline (cross-context uses, multi-file layouts,
workers-mode emission, …) without an on-disk fixture tree.
schema_registry: SchemaLockEvents track, slice 3c (#980): reconcile against bynk.schema.lock.
Off by default — bynk compile’s directory branch and bynk’s
deploy/dev build turn it on and write the reconciled lock back;
check’s and test’s directory paths (#2078) turn it on read-only,
so a non-additive change fails them too, and never write it. Every
library/test caller (in-memory builds, bynk-tests/tests/e2e.rs’s
in-place fixture compiles, bynk-emit’s own sources-driven tests,
the LSP) leaves it off, so a compile never mutates a project tree it
wasn’t asked to.
#1078: this carries the lock’s pre-read content, not just an on/off
switch — bynk-emit reads and writes no disk for this file (the same
move #1077/#1081 already made for .bynk source content). See
SchemaLock’s own doc for the read side; the reconciled content
comes back out on ProjectOutput::schema_lock for the caller to
persist.
contracts_lock: Option<String>#2554: bynk.contracts.lock’s pre-read content: the older contracts
each callee also accepts. None (every library, test and LSP caller,
and a project without the file) accepts none, so a callee answers only
the contract it has. bynk-driver’s try_project_options reads it, as
it reads the manifest, so every CLI build honours it; a build only ever
reads it, and the driver writes it.
compatibility_flags: Vec<String>#1890: the project’s extra Cloudflare compatibility flags, from
bynk.toml’s [workers] compatibility_flags, in manifest order.
A Workers build writes them into every wrangler.toml after
bynk_emit::DEFAULT_COMPATIBILITY_FLAGS; a duplicate is dropped with a
bynk.project.duplicate_compatibility_flag warning. Empty by default:
bynk-driver’s project_options/try_project_options read the
manifest and set it, as does bynk-tests/tests/e2e.rs for a fixture.
workers_dev: Option<bool>bynk.toml’s [workers] workers_dev: written into every
wrangler.toml when set, left out when None.
asset_files: Option<AssetFolder>#1883, slice 1b: the project’s assets/ folder — its files, keyed by
normalised project-relative path (assets/board.css), listed by the
caller, and a reader for their bytes
(assets::AssetFolder, usually AssetFolder::on_disk). The build
reads only the files an asset declaration names, once each, through
that reader, so bynk-emit never touches the disk and a large file
nothing declares is never read. bynk-driver’s
project_options/try_project_options and bynk-testkit’s
compile_options_* set it.
None means no filesystem was consulted (compile_in_memory, the
playground). A check then skips the existence check; a build treats it
as an empty folder, so an asset there is bynk.asset.missing_file
rather than a URL made up for a file nobody read.
embed_files: Option<EmbedFolder>#2387, slice 2: the project’s embeds/ folder, listed by the caller
with a reader for the bytes of only the files an embed declaration
names (assets::AssetFolder::embeds_on_disk), exactly as
CompileOptions::asset_files does for assets/. None means no
filesystem was consulted: a check then skips the existence check, and a
build treats it as an empty folder, so an embed there is
bynk.embed.missing_file rather than text made up for a file nobody
read.
fixture_files: Option<FixtureFolder>#2841: the project’s fixtures/ folder, listed by the caller with a
reader for the bytes of only the files a suite’s fixture declaration
names (assets::AssetFolder::fixtures_on_disk), exactly as
CompileOptions::embed_files does for embeds/. Fixtures are test
input: nothing in a deployable reads them. None means no filesystem
was consulted.
migration_files: Option<AssetFolder>P4b (#2608): the project’s migrations/ folder, listed by the caller
(assets::AssetFolder::migrations_on_disk). Every file in a declared
D1 database’s directory is read, checked, copied beside the Worker’s
wrangler.toml and run on each test database. None means no
filesystem was consulted.
snapshot_files: Option<BTreeMap<String, String>>#2842: the project’s snapshots/ folder, read by the caller
(bynk_project::snapshots::read_snapshot_files): each file’s text by its
project-relative path. A test module inlines the file for its own suite
file, so the harness reads nothing at test time. None (and an empty map)
means no snapshot is recorded, so every matches snapshot claim is missing.
progress: Option<ProgressSink>#3100: where compile_project reports each context as it compiles.
None (the default, and every library, test and LSP caller) reports
nothing, so a build behaves exactly as it did before.
remote_tests: Option<RemoteTests>#2138 (end-to-end testing track §3.5, §3.7): Some when bynk test --against runs the system suites against a real runtime. The build
then emits only the system suites, routes their drivers to the
target’s URLs (BYNK_TEST_TARGETS) instead of the in-process harness,
and refuses (or, under --skip-unsupported, skips) a case that uses
what a remote run can’t honour. None for every other build.
Implementations§
Source§impl CompileOptions
impl CompileOptions
Sourcepub fn single(root: impl Into<PathBuf>) -> Self
pub fn single(root: impl Into<PathBuf>) -> Self
Single-root project (src == tests), bundle target, default platform.
Sourcepub fn split(project_root: impl Into<PathBuf>, paths: ProjectPaths) -> Self
pub fn split(project_root: impl Into<PathBuf>, paths: ProjectPaths) -> Self
v0.9.1 split layout (source and test units in separate subdirectories
under project_root), bundle target, default platform. Use this from
bynk test so its rooting matches bynk compile’s.
Sourcepub fn out_dir(self, out: Option<PathBuf>) -> Self
pub fn out_dir(self, out: Option<PathBuf>) -> Self
#3477: the directory the build is written to (CompileOptions::out_dir).
Sourcepub fn progress(self, sink: Option<ProgressSink>) -> Self
pub fn progress(self, sink: Option<ProgressSink>) -> Self
#3100: report each context as it compiles (CompileOptions::progress).
Sourcepub fn remote_tests(self, remote: Option<RemoteTests>) -> Self
pub fn remote_tests(self, remote: Option<RemoteTests>) -> Self
#2138: a remote test build (CompileOptions::remote_tests).
Sourcepub fn target(self, target: BuildTarget) -> Self
pub fn target(self, target: BuildTarget) -> Self
Select the build target. Bundle (default) is the v0.6+ single-bundle
layout; Workers (v0.8) emits per-context Cloudflare Workers.
Sourcepub fn import_ext(self, ext: ImportExt) -> Self
pub fn import_ext(self, ext: ImportExt) -> Self
Slice 2: select the import-specifier extension. Ts is the debug build
for bynk test --inspect (run the .ts directly under Node strip-only).
Sourcepub fn contracts(self, on: bool) -> Self
pub fn contracts(self, on: bool) -> Self
v0.115: enable the function-contract call-site guard (dev/test profile).
bynk test and --inspect call this; the deploy build leaves it off so
contract checks never reach production (DECISION J).
Sourcepub fn trace_requests(self, on: bool) -> Self
pub fn trace_requests(self, on: bool) -> Self
#3580: record per-request traces in a Workers build (bynk dev --trace-events). Off by default, and never set by bynk compile or
bynk deploy.
Sourcepub fn inspect_agents(self, on: bool) -> Self
pub fn inspect_agents(self, on: bool) -> Self
#3581: emit the dev-only agent inspection into a Workers build (bynk dev). Off by default, and never set by bynk compile or bynk deploy.
Sourcepub fn tests(self, on: bool) -> Self
pub fn tests(self, on: bool) -> Self
#1821 (ADR 0147 D3): whether to type-check and emit suites. A build
that produces a deployable (bynk compile, bynk dev/deploy) turns
it off; a suite is test-only.
Sourcepub fn platform(self, platform: Platform) -> Self
pub fn platform(self, platform: Platform) -> Self
v0.17: select the deploy Platform (selects the bynk surface
binding). The MVP ships cloudflare only.
Sourcepub fn sources(self, sources: HashMap<PathBuf, String>) -> Self
pub fn sources(self, sources: HashMap<PathBuf, String>) -> Self
#57 (testing track): supply every file in-memory instead of walking
roots on disk — keyed the same way discovery::read_source’s
overlay is (see the sources field’s own doc).
Sourcepub fn schema_registry(self, mode: SchemaLock) -> Self
pub fn schema_registry(self, mode: SchemaLock) -> Self
Events track, slice 3c (#980): turn on bynk.schema.lock
reconciliation for this build, with its pre-read content (or
verified-absent None, for a fresh project). See SchemaLock and
the field’s own doc for who calls this and why everyone else leaves
it off.
Sourcepub fn contracts_lock(self, content: Option<String>) -> Self
pub fn contracts_lock(self, content: Option<String>) -> Self
#2554: the contracts lock’s pre-read content. See the field’s own doc.
Sourcepub fn compatibility_flags(self, flags: Vec<String>) -> Self
pub fn compatibility_flags(self, flags: Vec<String>) -> Self
#1890: the project’s extra Cloudflare compatibility flags, from
bynk.toml’s [workers] table. See the field’s own doc.
Sourcepub fn workers_dev(self, workers_dev: Option<bool>) -> Self
pub fn workers_dev(self, workers_dev: Option<bool>) -> Self
The project’s [workers] workers_dev. See the field’s own doc.
Sourcepub fn asset_files(self, folder: AssetFolder) -> Self
pub fn asset_files(self, folder: AssetFolder) -> Self
#1883, slice 1b: the listed assets/ folder. See the field’s own doc.
Sourcepub fn embed_files(self, folder: EmbedFolder) -> Self
pub fn embed_files(self, folder: EmbedFolder) -> Self
#2387, slice 2: the listed embeds/ folder. See the field’s own doc.
Sourcepub fn fixture_files(self, folder: FixtureFolder) -> Self
pub fn fixture_files(self, folder: FixtureFolder) -> Self
#2841: the listed fixtures/ folder. See the field’s own doc.
Sourcepub fn snapshot_files(self, files: BTreeMap<String, String>) -> Self
pub fn snapshot_files(self, files: BTreeMap<String, String>) -> Self
#2842: the project’s snapshots/ files. See the field’s own doc.
Sourcepub fn migration_files(self, folder: AssetFolder) -> Self
pub fn migration_files(self, folder: AssetFolder) -> Self
P4b (#2608): the listed migrations/ folder. See the field’s own doc.
Trait Implementations§
Source§impl Clone for CompileOptions
impl Clone for CompileOptions
Source§fn clone(&self) -> CompileOptions
fn clone(&self) -> CompileOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompileOptions
impl !RefUnwindSafe for CompileOptions
impl Send for CompileOptions
impl Sync for CompileOptions
impl Unpin for CompileOptions
impl UnsafeUnpin for CompileOptions
impl !UnwindSafe for CompileOptions
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<'a, T> FromIn<'a, T> for T
impl<'a, T> FromIn<'a, T> for T
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>
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>
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§impl<'a, T, U> IntoIn<'a, U> for Twhere
U: FromIn<'a, T>,
impl<'a, T, U> IntoIn<'a, U> for Twhere
U: FromIn<'a, T>,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§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);