#[non_exhaustive]pub struct Hakari<'g> {
pub output_map: OutputMap<'g>,
pub computed_map: ComputedMap<'g>,
/* private fields */
}Expand description
The result of a Hakari computation.
This contains all the data required to generate a workspace package.
Produced by HakariBuilder::compute.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.output_map: OutputMap<'g>The map built by Hakari of dependencies that need to be unified.
This map is used to construct the TOML output. Public access is provided in case some post-processing needs to be done.
computed_map: ComputedMap<'g>The complete map of dependency build results built by Hakari.
The map does not include workspace packages or the packages reported by
structural_excludes.
This map is not used to generate the TOML output.
Implementations§
Source§impl<'g> Hakari<'g>
impl<'g> Hakari<'g>
Sourcepub fn builder(&self) -> &HakariBuilder<'g>
pub fn builder(&self) -> &HakariBuilder<'g>
Returns the HakariBuilder used to create this instance.
Sourcepub fn structural_excludes(&self) -> impl Iterator<Item = &'g PackageId> + '_
pub fn structural_excludes(&self) -> impl Iterator<Item = &'g PackageId> + '_
Returns the structural excludes: third-party packages that depend on the Hakari package, or on a workspace member that Hakari manages, directly or transitively through normal or build dependencies.
Unlike traversal and final excludes, which come from configuration, structural excludes are determined by the shape of the dependency graph and can’t be configured away.
These packages are never added to the Hakari package, because doing so
would form a dependency cycle (assuming the manage-deps command says
the workspace is up-to-date). This typically happens when a workspace
member is also published on a registry such as crates.io, and a
[patch] directive redirects the published version’s Hakari dependency
back into the workspace.
- Dev-only dependencies are not followed, because Cargo permits cycles through them.
- Target-specific dependencies are followed, no matter which platforms this builder is configured with, because Cargo rejects these cycles even on platforms where the dependency isn’t enabled.
Unlike traversal_excludes, these packages
are still considered while simulating builds, so their own dependencies
are unified as usual.
Returns an empty iterator if the builder had no Hakari package specified.
Sourcepub fn is_structural_excluded(
&self,
package_id: &PackageId,
) -> Result<bool, Error>
pub fn is_structural_excluded( &self, package_id: &PackageId, ) -> Result<bool, Error>
Returns true if package_id is one of the
structural_excludes.
Note that this returns Ok(false) for workspace members, even though
those are structurally excluded as well.
Returns an error if this package ID isn’t known to the underlying graph.
Sourcepub fn read_toml(&self) -> Option<Result<HakariCargoToml, CargoTomlError>>
pub fn read_toml(&self) -> Option<Result<HakariCargoToml, CargoTomlError>>
Reads the existing TOML file for the Hakari package from disk, returning a
HakariCargoToml.
This can be used with to_toml_string to manage the contents of
the given TOML file on disk.
Returns an error if there was an issue reading the TOML file from disk, or None if
the builder’s hakari_package is None.
Sourcepub fn write_toml(
&self,
options: &HakariOutputOptions,
out: impl Write,
) -> Result<(), TomlOutError>
pub fn write_toml( &self, options: &HakariOutputOptions, out: impl Write, ) -> Result<(), TomlOutError>
Writes [dependencies] and other Cargo.toml lines to the given fmt::Write instance.
&mut String and fmt::Formatter both implement fmt::Write.
Sourcepub fn toml_name_map(&self) -> AHashMap<Cow<'g, str>, PackageMetadata<'g>>
pub fn toml_name_map(&self) -> AHashMap<Cow<'g, str>, PackageMetadata<'g>>
Returns a map of dependency names as present in the workspace-hack’s Cargo.toml to their
corresponding [PackageMetadata].
Packages which have one version are present as their original names, while packages with more than one version have a hash appended to them.
Sourcepub fn explain(
&self,
package_id: &'g PackageId,
) -> Result<HakariExplain<'g, '_>, Error>
pub fn explain( &self, package_id: &'g PackageId, ) -> Result<HakariExplain<'g, '_>, Error>
Returns a HakariExplain, which can be used to print out why a specific package is
in the workspace-hack’s Cargo.toml.
Returns an error if the package ID was not found in the output.
Sourcepub fn to_toml_string(
&self,
options: &HakariOutputOptions,
) -> Result<String, TomlOutError>
pub fn to_toml_string( &self, options: &HakariOutputOptions, ) -> Result<String, TomlOutError>
A convenience method around write_toml that returns a new string with Cargo.toml lines.
The returned string is guaranteed to be valid TOML, and can be provided to
a HakariCargoToml obtained from read_toml.
Trait Implementations§
Auto Trait Implementations§
impl<'g> Freeze for Hakari<'g>
impl<'g> RefUnwindSafe for Hakari<'g>
impl<'g> Send for Hakari<'g>
impl<'g> Sync for Hakari<'g>
impl<'g> Unpin for Hakari<'g>
impl<'g> UnsafeUnpin for Hakari<'g>
impl<'g> UnwindSafe for Hakari<'g>
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<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<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