Skip to main content

GlobalEnv

Struct GlobalEnv 

Source
pub struct GlobalEnv {
Show 20 fields pub namespaces: RwLock<HashMap<Arc<str>, GcPtr<Namespace>>>, pub source_paths: RwLock<Vec<PathBuf>>, pub loaded: Mutex<HashSet<Arc<str>>>, pub loading: Mutex<HashMap<Arc<str>, ThreadId>>, pub loading_done: Condvar, pub builtin_sources: RwLock<HashMap<Arc<str>, &'static str>>, pub gc_config: RwLock<Option<Arc<GcConfig>>>, pub async_rt: RwLock<Option<Arc<dyn AsyncRuntime>>>, pub version_cache: Mutex<HashMap<Arc<str>, Value>>, pub deps_config: RwLock<Option<Arc<DepsConfig>>>, pub verify_commit_signatures: AtomicBool, pub sig_verify_cache: Mutex<HashSet<(Arc<str>, Arc<str>)>>, pub versioned_sources: RwLock<HashMap<Arc<str>, Arc<str>>>, pub versioned_offline: AtomicBool, pub native_provenance: RwLock<HashMap<Arc<str>, Arc<str>>>, pub enforce_native_versions: AtomicBool, pub provenance_warned: Mutex<HashSet<Arc<str>>>, pub pinned_native_loader: RwLock<Option<PinnedNativeLoader>>, pub native_require_loader: RwLock<Option<NativeRequireLoader>>, pub compiled_ns_loaders: RwLock<HashMap<Arc<str>, CompiledNsLoader>>, /* private fields */
}
Expand description

The global mutable store of all namespaces.

Fields§

§namespaces: RwLock<HashMap<Arc<str>, GcPtr<Namespace>>>§source_paths: RwLock<Vec<PathBuf>>

Directories to search when resolving namespace names to files.

§loaded: Mutex<HashSet<Arc<str>>>

Namespaces that have been fully loaded from a file (idempotent guard).

§loading: Mutex<HashMap<Arc<str>, ThreadId>>

Namespaces currently being loaded, mapped to the thread loading them. Used to detect true circular requires (same thread) vs concurrent loads (different thread — those wait on loading_done instead of erroring).

§loading_done: Condvar

Signalled whenever a namespace finishes loading (or fails).

§builtin_sources: RwLock<HashMap<Arc<str>, &'static str>>

Built-in namespace sources embedded in the binary. Checked by load_ns before falling back to source-path search.

§gc_config: RwLock<Option<Arc<GcConfig>>>

GC configuration for automatic collection based on memory pressure.

§async_rt: RwLock<Option<Arc<dyn AsyncRuntime>>>

Optional async runtime registered by cljrs-async. None when the library is not linked; Some after cljrs_async::init.

§version_cache: Mutex<HashMap<Arc<str>, Value>>

Cache of values resolved at a specific commit. Key format: "<ns>/<name>@<commit>" for individual vars, or "<ns>@<commit>" for whole versioned namespaces.

§deps_config: RwLock<Option<Arc<DepsConfig>>>

Parsed cljrs.edn config, loaded once at startup.

§verify_commit_signatures: AtomicBool

When true, every versioned-symbol or versioned-namespace resolution must carry a valid commit signature (verified natively against trusted_keys) before the historical code is executed. Off by default; enabled via --verify-commit-signatures CLI flag or :verify-commit-signatures true in cljrs.edn.

§sig_verify_cache: Mutex<HashSet<(Arc<str>, Arc<str>)>>

Session-scoped cache of commits that have already passed signature verification this run, keyed by (repo_root, commit_hash).

§versioned_sources: RwLock<HashMap<Arc<str>, Arc<str>>>

Pinned source texts fetched from git this session, keyed by "<ns>@<commit>". The AOT compiler embeds these in the produced binary so versioned namespaces resolve without git at runtime.

§versioned_offline: AtomicBool

When true (set by AOT harness main), versioned namespaces resolve only from embedded builtin sources — never from git. A versioned namespace that was not embedded at compile time fails with a clear error instead of attempting a fetch.

§native_provenance: RwLock<HashMap<Arc<str>, Arc<str>>>

Provenance of native (Rust-backed) packages recorded at registration: namespace → the git commit the package was built from. Consulted by the versioned resolver’s native HEAD fallback to detect pinned-commit mismatches.

§enforce_native_versions: AtomicBool

When true, a pinned lookup of a native function whose recorded provenance does not match the requested commit is an error instead of a once-per-pin warning. CLI: --enforce-native-versions; cljrs.edn: :enforce-native-versions true.

§provenance_warned: Mutex<HashSet<Arc<str>>>

Pinned-native mismatches already warned about this session (key: "<ns>@<commit>"), so each pin warns at most once.

§pinned_native_loader: RwLock<Option<PinnedNativeLoader>>

Optional loader for pinned native packages (:rust/load :dylib), installed by the CLI. Called by the versioned resolver with (globals, base_ns, commit) before falling back to the HEAD native binding; returns Ok(true) when it registered the package’s pinned implementations into the "<base_ns>@<commit>" namespace.

§native_require_loader: RwLock<Option<NativeRequireLoader>>

Optional loader for native dependencies on the plain require path (:rust/load :dylib), installed by the CLI. Called by the unversioned namespace loader with (globals, ns) when a required namespace has no Clojure source on the source path; returns Ok(true) when it built the dep’s crate at the pinned :git/sha and registered the package’s exports into the unversioned namespace, so a plain (require '[my.native.lib :as lib]) brings the native code in.

§compiled_ns_loaders: RwLock<HashMap<Arc<str>, CompiledNsLoader>>

Loaders for AOT-compiled namespaces, installed by the binary produced by cljrs compile. Keyed by namespace name. When a plain require resolves a namespace that has a registered loader, load_ns invokes the loader instead of interpreting Clojure source: the loader evaluates the namespace’s small interpreted preamble (its ns/require and macro definitions) and then calls the namespace’s natively compiled initializer, so the bulk of the namespace runs as machine code rather than being tree-walked at startup.

Implementations§

Source§

impl GlobalEnv

Source

pub fn new(execution_mode: ExecutionMode) -> Arc<Self>

Create an empty global environment for the given execution mode.

This is the raw constructor: no builtins, no bootstrap, no source paths. Use crate::Runtime::builder unless you are the builder.

Source

pub fn set_source_paths(&self, paths: Vec<PathBuf>)

Replace the source path list.

Source

pub fn register_builtin_source(&self, ns: &str, src: &'static str)

Register an embedded namespace source (called by cljrs-stdlib at startup).

Source

pub fn builtin_source(&self, ns: &str) -> Option<&'static str>

Look up an embedded source for a namespace, if one has been registered.

Source

pub fn register_compiled_ns_loader(&self, ns: &str, loader: CompiledNsLoader)

Register a loader for an AOT-compiled namespace (called by the harness main of a binary produced by cljrs compile).

Source

pub fn compiled_ns_loader(&self, ns: &str) -> Option<CompiledNsLoader>

Look up the loader for an AOT-compiled namespace, if one is registered.

Source

pub fn mark_loaded(&self, ns: &str)

Mark a namespace as fully loaded from a file.

Source

pub fn is_loaded(&self, ns: &str) -> bool

True if the namespace has already been loaded from a file.

Source

pub fn set_gc_config(&self, config: Arc<GcConfig>)

Set the GC configuration for automatic memory pressure management.

Source

pub fn gc_config(&self) -> Option<Arc<GcConfig>>

Get the GC configuration, if one has been set.

Source

pub fn resolve_alias(&self, current_ns: &str, alias: &str) -> Option<Arc<str>>

Resolve a short alias to a full namespace name in current_ns.

Source

pub fn resolve_auto_keyword( &self, current_ns: &str, name: &str, ) -> Result<String, String>

Resolve an auto-resolved keyword name (the text after ::) to its fully-qualified ns/name form.

::kw qualifies with current_ns directly; ::alias/kw looks alias up in current_ns’s alias table (populated by (require '[... :as alias])) and qualifies with the resolved namespace.

Source

pub fn get_or_create_ns(&self, name: &str) -> GcPtr<Namespace>

Return the namespace with this name, creating it if it doesn’t exist.

Source

pub fn intern(&self, ns_name: &str, name: Arc<str>, val: Value) -> GcPtr<Var>

Intern name with val in the given namespace, returning the Var.

Source

pub fn lookup_var(&self, ns_name: &str, sym_name: &str) -> Option<GcPtr<Var>>

Look up a Var in the named namespace (interns only).

Source

pub fn lookup_in_ns(&self, ns_name: &str, sym_name: &str) -> Option<Value>

Look up a value in ns_name: checks interns then refers. Routes through the dynamic binding stack so binding overrides work.

Source

pub fn lookup_var_in_ns( &self, ns_name: &str, sym_name: &str, ) -> Option<GcPtr<Var>>

Look up the raw Var (not its value) in ns_name: interns then refers.

Source

pub fn refer_all(&self, dst_ns: &str, src_ns: &str)

Copy all interns from src_ns into dst_ns as refers.

Source

pub fn refer_named(&self, dst_ns: &str, src_ns: &str, names: &[Arc<str>])

Copy selected interns from src_ns into dst_ns as refers.

Source

pub fn add_alias(&self, current_ns: &str, alias: &str, full_ns: &str)

Register aliasfull_ns in current_ns’s alias table.

Source

pub fn id(&self) -> u64

Process-unique identity of this runtime instance.

Source

pub fn tiers(&self) -> &Arc<Tiers>

This runtime’s Tier-1/Tier-2 state.

Source

pub fn ir_cache(&self) -> &IrCache

This runtime’s cache of lowered IR.

Source

pub fn jit(&self) -> &JitState

This runtime’s JIT counters, profiles, and native-code tables.

Source

pub fn jit_backend(&self) -> Option<Arc<dyn JitBackend>>

The JIT compiler attached to this runtime, if any.

None when no JIT is linked or installed; callers then keep to the interpreter tiers. Installed by cljrs_compiler::jit::install.

Source

pub fn execution_mode(&self) -> ExecutionMode

How this runtime executes function calls.

Source

pub fn tier_state(&self) -> TierState

Which tiers are live right now.

Source

pub fn set_tier_state(&self, tier: TierState)

Raise the live tier state. Called once by the runtime builder after the bootstrap completes; lowering the tier is not supported, so a request below the current state is ignored.

Source

pub fn ir_enabled(&self) -> bool

True when IR may be lowered, cached, and interpreted. This is the gate the old compiler_ready flag served.

Source

pub fn eval(&self, form: &Form, env: &mut Env) -> EvalResult

Evaluate form in env.

Source

pub fn call_cljrs_fn( &self, func: &CljxFn, args: &[Value], env: &mut Env, ) -> EvalResult

Call a Clojure function, taking the path this runtime’s ExecutionMode selects.

This is the single function-call dispatch point: tree walk, tier-1 IR, and JIT-native execution are all reached from here.

Source

pub fn on_fn_defined(&self, f: &CljxFn, env: &mut Env)

Notify the active tier that a new fn* was defined.

In a tiered runtime with IR enabled this eagerly lowers the function (when eager lowering is on); in every other mode it does nothing.

Source

pub fn set_async_runtime(&self, rt: Arc<dyn AsyncRuntime>)

Install an async runtime. Called once by cljrs_async::init. Subsequent calls are silently ignored (first writer wins).

Source

pub fn async_runtime(&self) -> Option<Arc<dyn AsyncRuntime>>

Return the async runtime, if one has been registered.

Source

pub fn get_ns_git_context(&self, ns_name: &str) -> Option<(Arc<str>, Arc<str>)>

Return (source_file, git_repo_root) for the named namespace, if both have been populated by the loader.

Source

pub fn cache_versioned(&self, ns: &str, name: &str, commit: &str, val: Value)

Store a resolved versioned value in the cache. Key: "<ns>/<name>@<commit>".

Source

pub fn get_cached_versioned( &self, ns: &str, name: &str, commit: &str, ) -> Option<Value>

Retrieve a previously resolved versioned value, if cached.

Source

pub fn cache_versioned_ns(&self, ns: &str, commit: &str)

Mark namespace name@commit as loaded in the standard loaded set.

Source

pub fn record_versioned_source(&self, versioned_ns: &str, src: &str)

Record the source text of a versioned namespace fetched from git. Key: "<ns>@<commit>". Consumed by the AOT compiler for embedding.

Source

pub fn versioned_sources_snapshot(&self) -> Vec<(Arc<str>, Arc<str>)>

Snapshot of all versioned sources fetched this session, sorted by key.

Source

pub fn set_versioned_offline(&self, offline: bool)

Restrict versioned-namespace resolution to embedded builtin sources (no git). Called by AOT harness binaries, which embed every pinned source discovered at compile time.

Source

pub fn versioned_offline(&self) -> bool

True when versioned namespaces may only come from embedded sources.

Source

pub fn set_native_provenance(&self, ns: &str, commit: &str)

Record the git commit a native (Rust-backed) package was built from. Called at registration time (Registry::set_provenance or the register_provenance! inventory entry in cljrs-interop).

Source

pub fn native_provenance_for(&self, ns: &str) -> Option<Arc<str>>

The recorded provenance commit for a native package’s namespace.

Source

pub fn set_enforce_native_versions(&self, enforce: bool)

Make pinned-native provenance mismatches hard errors.

Source

pub fn enforce_native_versions(&self) -> bool

True when pinned-native provenance mismatches are errors.

Source

pub fn set_pinned_native_loader(&self, loader: PinnedNativeLoader)

Install the pinned-native package loader (called once by cljrs::native::pinned::install; first writer wins).

Source

pub fn set_native_require_loader(&self, loader: NativeRequireLoader)

Install the native-dependency require loader (called once by cljrs::native::pinned::install; first writer wins).

Source

pub fn vcs(&self) -> Option<Arc<dyn VcsProvider>>

The installed VCS backend, or None when this build has none (see crate::env::vcs). Callers must degrade gracefully: “no provider” means “this source file is not in a git repository”.

Source

pub fn set_vcs_provider(&self, provider: Option<Arc<dyn VcsProvider>>)

Replace the VCS backend. Lets an embedder that built without the deps feature supply its own git implementation, or a sandboxed host remove the default one (None) so no versioned resolution can reach the filesystem’s git history.

Drops every cached signature verdict: those were reached by the outgoing provider, against its trust set and its view of the repository, and say nothing about what the incoming one would decide for the same (repo, commit). Keeping them would let a permissive provider launder an approval for source a later provider serves.

Source

pub fn invalidate_signature_cache(&self)

Forget every cached signature verdict, so the next check_commit_signature re-asks the current provider. Called whenever the thing that produced those verdicts changes: the provider itself, or its trusted-key set.

Source

pub fn check_commit_signature( &self, repo_root: &str, commit: &str, ) -> EvalResult<()>

If :verify-commit-signatures is enabled, verify that commit inside repo_root carries a valid GPG or SSH signature.

Returns Ok(()) immediately when the feature is off. On the happy path the result is cached per (repo_root, commit) so each commit is only verified once per session. On failure returns EvalError::CommitSignatureVerificationFailed.

If verification is demanded but this build has no VCS provider, the check fails: silently accepting an unverifiable commit would defeat the flag the user explicitly turned on.

Source

pub fn load_trusted_signers(&self, config: &DepsConfig) -> usize

Build the trusted-signer key set from a parsed cljrs.edn config and install it, so subsequent check_commit_signature calls verify against it. Inline keys are parsed directly; File entries are read from disk. Returns the number of keys loaded; warns (to stderr) on any key that fails to load rather than aborting. Returns 0 when this build has no VCS provider, since there is nothing that could consume the keys.

Replacing the trust set invalidates the signature cache for the same reason replacing the provider does: a verdict reached under the old keys is not a verdict under the new ones. (In the normal flow this runs at session start, before anything has been verified.)

Trait Implementations§

Source§

impl Debug for GlobalEnv

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more