#[non_exhaustive]pub enum WorldSnapshotError {
Show 15 variants
Truncated,
BadMagic,
UnsupportedVersion {
found: u16,
supported: u16,
},
ReservedNotZero,
TrailingBytes {
extra: usize,
},
ChecksumMismatch {
stored: u64,
computed: u64,
},
InvalidValue {
section: &'static str,
},
DanglingIndex {
section: &'static str,
index: usize,
len: usize,
},
SdfFieldCountMismatch {
snapshot: usize,
world: usize,
},
CallbackCountMismatch {
section: &'static str,
snapshot: usize,
world: usize,
},
ParticipantMismatch(ParticipantMismatch),
ParticipantState {
index: usize,
error: StateError,
},
FieldState(StateError),
SemanticsMismatch {
stored: [u8; 32],
expected: [u8; 32],
},
LawIdMismatch {
stored: [u8; 32],
expected: [u8; 32],
},
}Expand description
Why PhysicsWorld::restore_world / PhysicsWorld::from_world_snapshot
rejected a blob. The target world is unchanged in every case.
§Which input gives which error
| input | error |
|---|---|
| fewer than 24 bytes, a version 4 blob of fewer than 88 bytes, or shorter than the declared payload | Self::Truncated |
| wrong magic | Self::BadMagic |
version 0 or above PhysicsWorld::WORLD_SNAPSHOT_VERSION | Self::UnsupportedVersion |
| reserved bytes not 0 | Self::ReservedNotZero |
| longer than the declared payload | Self::TrailingBytes |
| checksum differs | Self::ChecksumMismatch |
version 4 header semantics_id differs from this binary’s crate::PHYSICS_SEMANTICS_ID | Self::SemanticsMismatch |
version 4 header law_id differs from the one passed to PhysicsWorld::restore_world_checked | Self::LawIdMismatch |
| unknown enum tag / non-boolean byte / unrepresentable value inside the payload | Self::InvalidValue |
| material table with 0 or more than 65,536 materials, or a material whose id is not its index | Self::InvalidValue (section: "material_table") |
| a joint / constraint / contact / SDF collider / batch / proxy index past its target | Self::DanglingIndex |
| target world holds a different number of SDF fields | Self::SdfFieldCountMismatch |
| target world holds a different number of hooks / modifiers / bridges | Self::CallbackCountMismatch |
| target world holds other participants (count, kinds, order) | Self::ParticipantMismatch |
| a participant of the target world refuses its payload | Self::ParticipantState |
| the target world declares other shared fields | Self::FieldState |
| unknown fault code / participant fault tag, field mode or layout tag | Self::InvalidValue |
On every error the target world is left untouched.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated
The blob ends before the header or the declared payload does.
BadMagic
The first 4 bytes are not PhysicsWorld::WORLD_SNAPSHOT_MAGIC.
UnsupportedVersion
The version is not one this build reads (1 to
PhysicsWorld::WORLD_SNAPSHOT_VERSION).
ReservedNotZero
The reserved header bytes are not 0.
TrailingBytes
Bytes remain after the checksum, or after the last payload section.
ChecksumMismatch
The stored checksum differs from the one computed over the blob.
InvalidValue
A value inside the payload is not valid for its field (unknown enum
tag, a boolean byte other than 0 / 1, a count that does not fit
usize, invalid metric weights, a material table holding 0 or more
than 65,536 materials or a material whose id is not its index).
DanglingIndex
An index refers past the end of what it indexes (for example a joint naming a body the snapshot does not hold).
Fields
SdfFieldCountMismatch
The snapshot holds a different number of SDF colliders than the target world holds SDF fields (fields are code and are not in the blob).
Fields
CallbackCountMismatch
The snapshot was taken with a different number of pre-solve hooks, contact modifiers or installed GPU bridges than the target world has.
Fields
ParticipantMismatch(ParticipantMismatch)
The target world’s participants differ from the snapshot’s in number, kinds or order (participants are code and are not in the blob; the target world must already hold the same ones).
ParticipantState
Participant index of the target world refused its payload
(crate::world_participant::Participant::check_state). Every
payload is checked before any is read.
FieldState(StateError)
The snapshot’s shared fields do not match the target world’s
declared fields (ids, modes, layouts;
crate::world_participant::FieldBoard::check_values).
SemanticsMismatch
A version 4 blob was written under other stepping semantics: its
header semantics_id is not this binary’s
crate::PHYSICS_SEMANTICS_ID, so a restored world would not step
the way the writer’s did. Checked after the checksum.
Fields
expected: [u8; 32]crate::PHYSICS_SEMANTICS_ID of this binary.
LawIdMismatch
The version 4 blob’s header law_id differs from the identifier
passed to PhysicsWorld::restore_world_checked.
Trait Implementations§
Source§impl Clone for WorldSnapshotError
impl Clone for WorldSnapshotError
impl Copy for WorldSnapshotError
Source§impl Debug for WorldSnapshotError
impl Debug for WorldSnapshotError
Source§impl Display for WorldSnapshotError
impl Display for WorldSnapshotError
impl Eq for WorldSnapshotError
Source§impl Error for WorldSnapshotError
Available on crate feature std only.
impl Error for WorldSnapshotError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for WorldSnapshotError
impl PartialEq for WorldSnapshotError
impl StructuralPartialEq for WorldSnapshotError
Auto Trait Implementations§
impl Freeze for WorldSnapshotError
impl RefUnwindSafe for WorldSnapshotError
impl Send for WorldSnapshotError
impl Sync for WorldSnapshotError
impl Unpin for WorldSnapshotError
impl UnsafeUnpin for WorldSnapshotError
impl UnwindSafe for WorldSnapshotError
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
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