@@ -33,6 +33,7 @@ use pathfinding::{
3333 kuhn_munkres,
3434 matrix:: Matrix ,
3535} ;
36+ #[ cfg( feature = "json" ) ] use serde:: Serialize ;
3637use size:: Size ;
3738use unicode_width:: UnicodeWidthStr as _;
3839use yansi:: {
@@ -53,7 +54,7 @@ use crate::{
5354 } ,
5455} ;
5556
56- fn create_backend < ' a > (
57+ pub ( crate ) fn create_backend < ' a > (
5758 force_correctness : bool ,
5859) -> store:: CombinedStoreBackend < ' a > {
5960 if force_correctness {
@@ -64,6 +65,7 @@ fn create_backend<'a>(
6465}
6566
6667#[ derive( Debug , Eq , PartialEq ) ]
68+ #[ cfg_attr( feature = "json" , derive( Serialize ) ) ]
6769pub struct Diff < T = Vec < Version > > {
6870 pub name : String ,
6971 pub old : T ,
@@ -90,13 +92,15 @@ where
9092}
9193
9294#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
95+ #[ cfg_attr( feature = "json" , derive( Serialize ) ) ]
9396pub enum Change {
9497 UpgradeDowngrade ,
9598 Upgraded ,
9699 Downgraded ,
97100}
98101
99102#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
103+ #[ cfg_attr( feature = "json" , derive( Serialize ) ) ]
100104pub enum DiffStatus {
101105 Changed ( Change ) ,
102106 Added ,
@@ -146,6 +150,7 @@ impl cmp::Ord for DiffStatus {
146150/// Documents if the derivation is a system package and if
147151/// it was added / removed as such.
148152#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
153+ #[ cfg_attr( feature = "json" , derive( Serialize ) ) ]
149154pub enum DerivationSelectionStatus {
150155 /// The derivation is a system package, status unchanged.
151156 Selected ,
@@ -522,7 +527,7 @@ pub fn write_packages_diffln(
522527///
523528/// Takes an iterator of store paths and extracts the package names,
524529/// filtering out any that cannot be parsed. Logs warnings for parse failures.
525- fn collect_system_names (
530+ pub ( crate ) fn collect_system_names (
526531 paths : impl Iterator < Item = StorePath > ,
527532 context : & str ,
528533) -> HashSet < String > {
@@ -544,7 +549,7 @@ fn collect_system_names(
544549/// Creates a mapping from package names to their versions in old and new paths.
545550/// For each package, stores a tuple of (`old_versions`, `new_versions`).
546551/// Handles parsing errors by logging warnings and skipping problematic entries.
547- fn collect_path_versions (
552+ pub ( crate ) fn collect_path_versions (
548553 old : impl Iterator < Item = StorePath > ,
549554 new : impl Iterator < Item = StorePath > ,
550555) -> HashMap < String , ( Vec < Version > , Vec < Version > ) > {
0 commit comments