pub struct UnityVersion { /* private fields */ }Expand description
A parsed Unity version: the raw bytes and UnityPy’s packed integer.
Implementations§
Source§impl UnityVersion
impl UnityVersion
Sourcepub fn parse(raw: &RawStr) -> Result<Self, VersionError>
pub fn parse(raw: &RawStr) -> Result<Self, VersionError>
UnityVersion.from_str on the raw bytes. The pattern is applied to the
surrogate-escaped string Python sees, so invalid UTF-8 bytes match .
and never \d; a group of more than PY_INT_MAX_STR_DIGITS digits
is VersionError::NoMatch (module docs). The version, or the
NoMatch, keeps a clone of raw (no copy: module docs). Its work is
counted nowhere: this is for a caller’s own string; an input’s are
parsed by the chains, which count it (module docs, “Work”).
Sourcepub fn from_packed(packed: u64) -> Self
pub fn from_packed(packed: u64) -> Self
UnityVersion(int): a version from a packed integer, as a TPK stores
its versions (helpers/Tpk.py:464). It has no raw string (raw() is
empty). Implemented by the scaffold, so unityrs-tpk (package A) can
pick a TPK entry by core’s ordering before package C lands.
Sourcepub fn heap_bytes(&self) -> usize
pub fn heap_bytes(&self) -> usize
The heap this version owns: a packed integer of 2^128 or more’s
limbs. The raw string is a shared slice and owns none. Implemented
by the scaffold; the chains charge it, at heap_cost, to the
handle of the file that keeps it.
Sourcepub fn packed_u64(&self) -> Option<u64>
pub fn packed_u64(&self) -> Option<u64>
The packed value when it fits u64 (TPK lookups compare these).
Implemented by the scaffold.
Trait Implementations§
Source§impl Clone for UnityVersion
impl Clone for UnityVersion
Source§impl Debug for UnityVersion
impl Debug for UnityVersion
impl Eq for UnityVersion
Source§impl Hash for UnityVersion
impl Hash for UnityVersion
Source§impl Ord for UnityVersion
impl Ord for UnityVersion
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
As Python compares the ints (Tpk.py:472-481’s exactVersion >= version).