pub struct CachedPocketIcBaseline<T> { /* private fields */ }Expand description
One owned PocketIC instance/server record with snapshots and caller metadata.
The value contains no synchronization. A super::PocketIcBaselineRecipe
can own it as its fixture in a super::CachedPocketIcBaselinePool.
Implementations§
Source§impl<T> CachedPocketIcBaseline<T>
impl<T> CachedPocketIcBaseline<T>
Sourcepub fn capture<I>(
instance: PocketIcInstance<PocketIc>,
targets: I,
metadata: T,
) -> Result<Self, ControllerSnapshotError>where
I: IntoIterator<Item = CanisterSnapshotTarget>,
pub fn capture<I>(
instance: PocketIcInstance<PocketIc>,
targets: I,
metadata: T,
) -> Result<Self, ControllerSnapshotError>where
I: IntoIterator<Item = CanisterSnapshotTarget>,
Capture a cached baseline with an explicit sender for every canister.
Capture is ordered and transactional as documented by
PocketIcSnapshotExt::capture_snapshots. No sender fallback is performed.
Sourcepub fn restore(
&self,
funding: SnapshotRestoreFunding,
) -> Result<(), ControllerSnapshotError>
pub fn restore( &self, funding: SnapshotRestoreFunding, ) -> Result<(), ControllerSnapshotError>
Restore with exactly the captured senders and selected cycle funding.
Sourcepub const fn pocket_ic(&self) -> &PocketIc
pub const fn pocket_ic(&self) -> &PocketIc
Borrow the owned PocketIC instance behind this cached baseline.
Sourcepub fn snapshot_count(&self) -> usize
pub fn snapshot_count(&self) -> usize
Return the number of canisters captured by this baseline.
Sourcepub fn snapshot_canister_ids(&self) -> impl Iterator<Item = Principal> + '_
pub fn snapshot_canister_ids(&self) -> impl Iterator<Item = Principal> + '_
Iterate over captured canister ids in deterministic principal order.
Sourcepub const fn metadata(&self) -> &T
pub const fn metadata(&self) -> &T
Borrow the captured metadata associated with this cached baseline.
Sourcepub const fn metadata_mut(&mut self) -> &mut T
pub const fn metadata_mut(&mut self) -> &mut T
Mutably borrow the captured metadata associated with this cached baseline.