pub struct Package {
pub name: PackageId,
pub version: Version,
pub description: Option<String>,
pub kind: TargetType,
pub manifest: PackageManifest,
pub sections: Vec<Section>,
/* private fields */
}Expand description
A package is a assembled artifact containing:
- Basic metadata like name, description, and semantic version
- The type of target the package represents, e.g. a library or executable
- A manifest describing the contents of the package, see PackageManifest for more details.
- A MastForest corresponding to the assembled target
- One or more custom sections containing metadata produced by the assembler or other tools which is relevant to the package, e.g. debug symbols.
Custom sections which are of particular interest:
- For account components, the package will contain a section that provides component metadata
- For executable packages which link against a kernel, the package will embed the kernel package in a custom section, so that executables are “self-contained”.
- When assembled with debug information, various types of debug info are emitted to custom sections for use by debuggers and other introspection tooling.
See SectionId for the set of well-known sections, and what they are used for.
Fields§
§name: PackageIdName of the package
version: VersionAn optional semantic version for the package
description: Option<String>An optional description of the package
kind: TargetTypeThe project target type which produced this package
manifest: PackageManifestThe package manifest, containing the set of exported procedures and their signatures, if known.
sections: Vec<Section>The set of custom sections included with the package, e.g. debug information, account metadata, etc.
Implementations§
Source§impl Package
impl Package
Sourcepub fn read_from_unchecked<R>(
source: &mut R,
) -> Result<Package, DeserializationError>where
R: ByteReader,
pub fn read_from_unchecked<R>(
source: &mut R,
) -> Result<Package, DeserializationError>where
R: ByteReader,
Reads a trusted package from source without validating the embedded MAST forest.
§Trust boundary
This skips embedded MAST validation and trusts serialized node digests. Use it only for bytes that were already validated before being persisted by the same trusted system.
Do not use this for user-controlled packages, network input, registry artifacts, or any
other package that crosses a trust boundary. Use Package::read_from for those
inputs.
Sourcepub fn read_from_bytes_unchecked(
bytes: &[u8],
) -> Result<Package, DeserializationError>
pub fn read_from_bytes_unchecked( bytes: &[u8], ) -> Result<Package, DeserializationError>
Reads trusted package bytes without validating the embedded MAST forest.
§Trust boundary
This skips embedded MAST validation and trusts serialized node digests. Use it only for bytes that were already validated before being persisted by the same trusted system.
Do not use this for user-controlled packages, network input, registry artifacts, or any
other package that crosses a trust boundary. Use Package::read_from_bytes for those
inputs.
Sourcepub fn read_from_trusted<R>(
source: &mut R,
) -> Result<Package, DeserializationError>where
R: ByteReader,
pub fn read_from_trusted<R>(
source: &mut R,
) -> Result<Package, DeserializationError>where
R: ByteReader,
Reads a trusted local package while validating the embedded MAST forest.
This keeps the same structural validation as Package::read_from, but allows
package-owned debug sections to be decoded as trusted metadata. Use this only for local
files or cache artifacts controlled by this process or build system. Do not use this for
inbound artifacts from an untrusted channel; use Package::read_from instead so debug
sections are discarded before the package is exposed to callers.
Sourcepub fn read_from_bytes_trusted(
bytes: &[u8],
) -> Result<Package, DeserializationError>
pub fn read_from_bytes_trusted( bytes: &[u8], ) -> Result<Package, DeserializationError>
Reads trusted local package bytes while validating the embedded MAST forest.
Source§impl Package
Construction
impl Package
Construction
Sourcepub fn create(
name: PackageId,
version: Version,
kind: TargetType,
mast: Arc<MastForest>,
exports: impl IntoIterator<Item = PackageExport>,
dependencies: impl IntoIterator<Item = Dependency>,
) -> Result<Package, ManifestValidationError>
pub fn create( name: PackageId, version: Version, kind: TargetType, mast: Arc<MastForest>, exports: impl IntoIterator<Item = PackageExport>, dependencies: impl IntoIterator<Item = Dependency>, ) -> Result<Package, ManifestValidationError>
Construct a Package from its essential component parts
Sourcepub fn create_with_modules(
name: PackageId,
version: Version,
kind: TargetType,
mast: Arc<MastForest>,
exports: impl IntoIterator<Item = PackageExport>,
modules: impl IntoIterator<Item = PackageModule>,
dependencies: impl IntoIterator<Item = Dependency>,
) -> Result<Package, ManifestValidationError>
pub fn create_with_modules( name: PackageId, version: Version, kind: TargetType, mast: Arc<MastForest>, exports: impl IntoIterator<Item = PackageExport>, modules: impl IntoIterator<Item = PackageModule>, dependencies: impl IntoIterator<Item = Dependency>, ) -> Result<Package, ManifestValidationError>
Construct a Package from its essential component parts and module surface metadata.
Sourcepub fn with_advice_map(self, advice_map: AdviceMap) -> Package
pub fn with_advice_map(self, advice_map: AdviceMap) -> Package
Produces a new library with the existing MastForest and where all key/values in the
provided advice map are added to the internal advice map.
Sourcepub fn extend_advice_map(&mut self, advice_map: AdviceMap)
pub fn extend_advice_map(&mut self, advice_map: AdviceMap)
Extends the advice map of this library
Sourcepub fn strip_debug_info(&mut self) -> Result<(), PackageStripError>
pub fn strip_debug_info(&mut self) -> Result<(), PackageStripError>
Removes all package-owned debug information from this package.
This removes well-known package debug sections and recursively strips an embedded kernel package if one is present.
Sourcepub fn without_debug_info(self) -> Result<Package, PackageStripError>
pub fn without_debug_info(self) -> Result<Package, PackageStripError>
Returns this package with package-owned debug information removed.
Source§impl Package
Accessors
impl Package
Accessors
Sourcepub fn mast_forest(&self) -> &Arc<MastForest>
pub fn mast_forest(&self) -> &Arc<MastForest>
Returns a reference to the MAST contained in this package
Sourcepub fn interface_digest(&self) -> Result<Word, ManifestValidationError>
pub fn interface_digest(&self) -> Result<Word, ManifestValidationError>
Returns the digest of the exported procedure roots used by the linker.
Sourcepub fn content_digest(&self) -> Word
pub fn content_digest(&self) -> Word
Returns a digest of the package content relevant to assembly and dependency resolution.
This is distinct from Self::digest, which is only the digest of the underlying MAST
artifact. The content digest currently binds the MAST digest, package name, semantic
version, package kind, manifest, and any semantic package sections. Package descriptions
and opaque custom sections are intentionally excluded for now; kernel-section binding is
added separately.
Sourcepub fn is_program(&self) -> bool
pub fn is_program(&self) -> bool
Returns true if this package was produced for an executable target
Sourcepub fn is_library(&self) -> bool
pub fn is_library(&self) -> bool
Returns true if this package was produced for a library or kernel target
Sourcepub fn is_kernel(&self) -> bool
pub fn is_kernel(&self) -> bool
Returns true if this package was produced specifically for a kernel target
Sourcepub fn entrypoint(&self) -> Option<Arc<Path>>
pub fn entrypoint(&self) -> Option<Arc<Path>>
Returns the absolute path of the entrypoint procedure for this package, if it is executable
Sourcepub fn entrypoint_source_node(&self) -> Option<DebugSourceNodeId>
pub fn entrypoint_source_node(&self) -> Option<DebugSourceNodeId>
Returns the source/debug occurrence for the executable entrypoint, if recorded.
Sourcepub fn kernel_module_info(&self) -> Result<ModuleInfo, Report>
pub fn kernel_module_info(&self) -> Result<ModuleInfo, Report>
Get the ModuleInfo corresponding to the kernel module, if this package contains the kernel
Sourcepub fn kernel_runtime_dependency(&self) -> Result<Option<&Dependency>, Report>
pub fn kernel_runtime_dependency(&self) -> Result<Option<&Dependency>, Report>
If this package depends on a kernel, this method extracts the Dependency corresponding to it.
Returns Err if the dependency metadata for this package contains multiple kernels.
Sourcepub fn debug_info(
&self,
) -> Result<Option<PackageDebugInfo>, PackageDebugInfoError>
pub fn debug_info( &self, ) -> Result<Option<PackageDebugInfo>, PackageDebugInfoError>
Decodes trusted package-owned debug sections, if any are present.
Package debug sections are trusted only for packages constructed in-process or read via the
trusted same-domain readers such as Self::read_from_trusted,
Self::read_from_bytes_trusted, Self::read_from_unchecked, and
Self::read_from_bytes_unchecked. Normal untrusted readers discard debug sections before
returning the package.
This does not read legacy debug metadata from the embedded MastForest.
Sourcepub fn get_export_node_id(&self, path: impl AsRef<Path>) -> MastNodeId
pub fn get_export_node_id(&self, path: impl AsRef<Path>) -> MastNodeId
Returns a MAST node ID associated with the specified exported procedure.
§Panics
Panics if the specified procedure is not exported from this package.
Sourcepub fn is_reexport(&self, path: impl AsRef<Path>) -> bool
pub fn is_reexport(&self, path: impl AsRef<Path>) -> bool
Returns true if the specified exported procedure is re-exported from a dependency.
Sourcepub fn get_procedure_root_by_path(&self, path: impl AsRef<Path>) -> Option<Word>
pub fn get_procedure_root_by_path(&self, path: impl AsRef<Path>) -> Option<Word>
Returns the digest of the procedure with the specified name, or None if it was not found
in the library or its library path is malformed.
Sourcepub fn get_procedure_node_by_path(
&self,
path: impl AsRef<Path>,
) -> Option<MastNodeId>
pub fn get_procedure_node_by_path( &self, path: impl AsRef<Path>, ) -> Option<MastNodeId>
Returns the exact procedure node for the specified path, if it is present.
Sourcepub fn module_infos(&self) -> impl Iterator<Item = ModuleInfo>
pub fn module_infos(&self) -> impl Iterator<Item = ModuleInfo>
Returns an iterator over the module infos of the library.
Sourcepub fn try_module_infos(
&self,
) -> Result<Vec<ModuleInfo>, ManifestValidationError>
pub fn try_module_infos( &self, ) -> Result<Vec<ModuleInfo>, ManifestValidationError>
Returns module infos after validating that manifest module-surface metadata is complete.
Unlike Self::module_infos, this method does not synthesize missing module surfaces from
item export paths. Link-time resolution relies on explicit module metadata so that modules
remain distinct from exported items.
Source§impl Package
Conversions
impl Package
Conversions
Sourcepub fn to_kernel(&self) -> Result<Kernel, Report>
pub fn to_kernel(&self) -> Result<Kernel, Report>
Get a Kernel from this package, if this package contains one.
Sourcepub fn try_embedded_kernel_package(
&self,
) -> Result<Option<Box<Package>>, Report>
pub fn try_embedded_kernel_package( &self, ) -> Result<Option<Box<Package>>, Report>
Extract the embedded kernel package from this package.
Returns Ok(None) if the kernel custom section is not present.
Returns an error if:
- The embedded package is not a kernel
- The package manifest of
selfdoes not declare a kernel dependency - The embedded kernel does not match the declared kernel dependency
Sourcepub fn to_dependency(&self) -> Dependency
pub fn to_dependency(&self) -> Dependency
Get a Dependency that represents this package
Sourcepub fn make_executable(
&self,
entrypoint: &QualifiedProcedureName,
) -> Result<Package, Report>
pub fn make_executable( &self, entrypoint: &QualifiedProcedureName, ) -> Result<Package, Report>
Derive a new executable package from this one by specifying the entrypoint to use.
To succeed, the following must be true:
- This package was produced from a library target
- The
entrypointprocedure is exported from this package according to the manifest - The
entrypointprocedure can be resolved to a node in the MAST of this package
The resulting package has a target type and manifest reflecting what would have been used if the package was originally assembled as an executable, however the underlying miden_core::mast::MastForest is left untouched, so the resulting package may still contain nodes in the forest which are now unused.
Source§impl Package
Serialization
impl Package
Serialization
Sourcepub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
pub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Write this package to path
Sourcepub fn write_masp_file(&self, dir: impl AsRef<Path>) -> Result<(), Error>
pub fn write_masp_file(&self, dir: impl AsRef<Path>) -> Result<(), Error>
Write this package to a file in dir named $name.masp, where $name is the package name.
Sourcepub fn deserialize_from_file(
path: impl AsRef<Path>,
) -> Result<Package, DeserializationError>
pub fn deserialize_from_file( path: impl AsRef<Path>, ) -> Result<Package, DeserializationError>
Reads a package file from an untrusted path.
This validates the embedded MAST forest and discards package-owned debug sections before returning the package. Use this for user-provided paths or bytes received across a trust boundary.
Sourcepub fn deserialize_from_file_trusted(
path: impl AsRef<Path>,
) -> Result<Package, DeserializationError>
pub fn deserialize_from_file_trusted( path: impl AsRef<Path>, ) -> Result<Package, DeserializationError>
Reads a trusted local package file.
This preserves package-owned debug sections and should be used only for files/cache entries
controlled by the same trusted build or execution system. Use Self::read_from_bytes for
bytes received across a trust boundary.
Trait Implementations§
Source§impl AsRef<Package> for AccountComponentCode
impl AsRef<Package> for AccountComponentCode
Source§impl CodeBuilderLibrary for Package
impl CodeBuilderLibrary for Package
fn as_code_builder_library(&self) -> &Package
Source§impl CodeBuilderLibrary for Box<Package>
impl CodeBuilderLibrary for Box<Package>
fn as_code_builder_library(&self) -> &Package
Source§impl Deserializable for Package
impl Deserializable for Package
Source§fn read_from<R>(source: &mut R) -> Result<Package, DeserializationError>where
R: ByteReader,
fn read_from<R>(source: &mut R) -> Result<Package, DeserializationError>where
R: ByteReader,
source, attempts to deserialize these bytes
into Self, and returns the result. Read moreSource§fn read_from_bytes(bytes: &[u8]) -> Result<Package, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Package, DeserializationError>
Source§fn min_serialized_size() -> usize
fn min_serialized_size() -> usize
Source§fn read_from_bytes_with_budget(
bytes: &[u8],
budget: usize,
) -> Result<Self, DeserializationError>
fn read_from_bytes_with_budget( bytes: &[u8], budget: usize, ) -> Result<Self, DeserializationError>
Self from bytes with a byte budget limit. Read moreimpl Eq for Package
Source§impl From<AccountComponentCode> for Package
impl From<AccountComponentCode> for Package
Source§fn from(value: AccountComponentCode) -> Package
fn from(value: AccountComponentCode) -> Package
Source§impl From<Package> for AccountComponentCode
impl From<Package> for AccountComponentCode
Source§fn from(value: Package) -> AccountComponentCode
fn from(value: Package) -> AccountComponentCode
Source§impl From<ProtocolLib> for Package
impl From<ProtocolLib> for Package
Source§fn from(value: ProtocolLib) -> Package
fn from(value: ProtocolLib) -> Package
Source§impl From<StandardsLib> for Package
impl From<StandardsLib> for Package
Source§fn from(value: StandardsLib) -> Package
fn from(value: StandardsLib) -> Package
Source§impl Serializable for Package
impl Serializable for Package
Source§fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W)where
W: ByteWriter,
self into bytes and writes these bytes into the target.Source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
impl StructuralPartialEq for Package
Source§impl TryFrom<&Package> for AccountComponentMetadata
impl TryFrom<&Package> for AccountComponentMetadata
Source§type Error = AccountError
type Error = AccountError
Source§fn try_from(
package: &Package,
) -> Result<AccountComponentMetadata, <AccountComponentMetadata as TryFrom<&Package>>::Error>
fn try_from( package: &Package, ) -> Result<AccountComponentMetadata, <AccountComponentMetadata as TryFrom<&Package>>::Error>
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnsafeUnpin for Package
impl UnwindSafe for Package
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§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 moreSource§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 moreSource§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>
Source§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>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§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>
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);