Build deterministic refusal details, removing empty and duplicate paths.
(
reason: impl Into<String>,
paths: impl IntoIterator<Item = String>,
recovery_ref: impl Into<String>,
origin: SessionIncompleteOrigin,
)
| 101 | impl IncompleteSession { |
| 102 | /// Build deterministic refusal details, removing empty and duplicate paths. |
| 103 | pub fn new( |
| 104 | reason: impl Into<String>, |
| 105 | paths: impl IntoIterator<Item = String>, |
| 106 | recovery_ref: impl Into<String>, |
| 107 | origin: SessionIncompleteOrigin, |
| 108 | ) -> Self { |
| 109 | let mut paths: Vec<String> = paths.into_iter().filter(|path| !path.is_empty()).collect(); |
| 110 | paths.sort(); |
| 111 | paths.dedup(); |
| 112 | Self { |
| 113 | reason: reason.into(), |
| 114 | paths, |
| 115 | recovery_ref: recovery_ref.into(), |
| 116 | origin, |
| 117 | unbound_commits: Vec::new(), |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | /// Attach observed-but-unbound commit identifiers to these refusal details. |
| 122 | /// |