Quarantine every record of a decoded pack, enforcing the object-count budget before decoding anything. The pack indexes changes by their decoded **identity** hash (see [`quarantine_change_record`]).
(
records: &[ObjectRecord],
limits: &BindingPackLimits,
)
| 377 | /// budget before decoding anything. The pack indexes changes by their |
| 378 | /// decoded **identity** hash (see [`quarantine_change_record`]). |
| 379 | pub fn from_records( |
| 380 | records: &[ObjectRecord], |
| 381 | limits: &BindingPackLimits, |
| 382 | ) -> Result<Self, BindingPackError> { |
| 383 | if records.len() > limits.max_objects { |
| 384 | return Err(BindingPackError::TooManyObjects { |
| 385 | limit: limits.max_objects, |
| 386 | found: records.len(), |
| 387 | }); |
| 388 | } |
| 389 | let mut changes = HashMap::with_capacity(records.len()); |
| 390 | for record in records { |
| 391 | let (identity, change) = quarantine_change_record(record)?; |
| 392 | changes.insert(identity, change); |
| 393 | } |
| 394 | Ok(QuarantinedPack { changes }) |
| 395 | } |
| 396 | |
| 397 | /// The quarantined change for `hash`, if the pack carries it. |
| 398 | pub fn get(&self, hash: &Hash) -> Option<&Change> { |
nothing calls this directly
no test coverage detected