Skip to main content

WorldSnapshotError

Enum WorldSnapshotError 

Source
#[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

inputerror
fewer than 24 bytes, a version 4 blob of fewer than 88 bytes, or shorter than the declared payloadSelf::Truncated
wrong magicSelf::BadMagic
version 0 or above PhysicsWorld::WORLD_SNAPSHOT_VERSIONSelf::UnsupportedVersion
reserved bytes not 0Self::ReservedNotZero
longer than the declared payloadSelf::TrailingBytes
checksum differsSelf::ChecksumMismatch
version 4 header semantics_id differs from this binary’s crate::PHYSICS_SEMANTICS_IDSelf::SemanticsMismatch
version 4 header law_id differs from the one passed to PhysicsWorld::restore_world_checkedSelf::LawIdMismatch
unknown enum tag / non-boolean byte / unrepresentable value inside the payloadSelf::InvalidValue
material table with 0 or more than 65,536 materials, or a material whose id is not its indexSelf::InvalidValue (section: "material_table")
a joint / constraint / contact / SDF collider / batch / proxy index past its targetSelf::DanglingIndex
target world holds a different number of SDF fieldsSelf::SdfFieldCountMismatch
target world holds a different number of hooks / modifiers / bridgesSelf::CallbackCountMismatch
target world holds other participants (count, kinds, order)Self::ParticipantMismatch
a participant of the target world refuses its payloadSelf::ParticipantState
the target world declares other shared fieldsSelf::FieldState
unknown fault code / participant fault tag, field mode or layout tagSelf::InvalidValue

On every error the target world is left untouched.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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).

Fields

§found: u16

Version stored in the blob.

§supported: u16

Version this build reads.

§

ReservedNotZero

The reserved header bytes are not 0.

§

TrailingBytes

Bytes remain after the checksum, or after the last payload section.

Fields

§extra: usize

Number of unread bytes.

§

ChecksumMismatch

The stored checksum differs from the one computed over the blob.

Fields

§stored: u64

Checksum stored in the blob.

§computed: u64

Checksum of the bytes as received.

§

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).

Fields

§section: &'static str

Section the value was read in.

§

DanglingIndex

An index refers past the end of what it indexes (for example a joint naming a body the snapshot does not hold).

Fields

§section: &'static str

Section holding the index.

§index: usize

The index.

§len: usize

Length of what it indexes.

§

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

§snapshot: usize

SDF colliders in the snapshot.

§world: usize

SDF colliders in the target world.

§

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

§section: &'static str

"pre_solve_hooks", "contact_modifiers" or "gpu_solver_bridge".

§snapshot: usize

Count in the snapshot.

§world: usize

Count in the target world.

§

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.

Fields

§index: usize

Registration index of the participant.

§error: StateError

Why it refused.

§

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

§stored: [u8; 32]

semantics_id stored in the blob’s header.

§expected: [u8; 32]
§

LawIdMismatch

The version 4 blob’s header law_id differs from the identifier passed to PhysicsWorld::restore_world_checked.

Fields

§stored: [u8; 32]

law_id stored in the blob’s header.

§expected: [u8; 32]

The identifier the caller expected.

Trait Implementations§

Source§

impl Clone for WorldSnapshotError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WorldSnapshotError

Source§

impl Debug for WorldSnapshotError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for WorldSnapshotError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for WorldSnapshotError

Source§

impl Error for WorldSnapshotError

Available on crate feature std only.
1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for WorldSnapshotError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WorldSnapshotError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.