pub enum Value {
Bool(bool),
Int(i64),
UInt(u64),
F32(u32),
F64(u64),
Str(RawStr),
Bytes(Bytes),
Prims(PrimArray),
List(Vec<Value>),
Tuple(Box<[Value]>),
Dict(Map),
}Expand description
A value read through a typetree. Not Clone (module docs).
Variants§
Bool(bool)
bool (any non-zero byte is true).
Int(i64)
Every integer that fits i64.
UInt(u64)
A UInt64/FileSize value above i64::MAX.
F32(u32)
A float node’s bits, after crate::walk::FloatMode.
F64(u64)
A double node’s bits, every bit kept.
Str(RawStr)
A string: raw bytes, valid UTF-8 or not.
Bytes(Bytes)
TypelessData.
Prims(PrimArray)
A primitive array read as one run.
List(Vec<Value>)
Any other array.
Tuple(Box<[Value]>)
A pair (two items), or an aligned primitive array on the pure-Python path.
Dict(Map)
A class, PPtr, registry or ReferencedObject.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
The integer, if this is one (not a bool, as UnityPy’s dict keeps them apart).
Sourcepub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_bytes(&self) -> Option<&[u8]>
Raw bytes: a string’s, TypelessData’s, or a vector<UInt8>’s.
The zero-copy buffer of TypelessData or a vector<UInt8>, for a
hand-off to another stage without copying.
Trait Implementations§
Source§impl Drop for Value
Dropped without recursion and without allocating, each value looked at
once, so in time linear in the values held at any depth. The values
waiting are a stack of piles, each a value’s own vector of items: the
innermost is taken from the end one value at a time, and a value with
items of its own has them taken out (its vector moves) to become the
innermost pile, the rest of the one it came from saved in a value of
its own, along with the pile above that (pushed into the slot the value
left free). A pile done, the one saved above it resumes. A value of any
depth takes the same stack, so a read (and a failed read’s partial
values) may drop on a thread of any stack size, and the heap never goes
above what the values held.
impl Drop for Value
Dropped without recursion and without allocating, each value looked at once, so in time linear in the values held at any depth. The values waiting are a stack of piles, each a value’s own vector of items: the innermost is taken from the end one value at a time, and a value with items of its own has them taken out (its vector moves) to become the innermost pile, the rest of the one it came from saved in a value of its own, along with the pile above that (pushed into the slot the value left free). A pile done, the one saved above it resumes. A value of any depth takes the same stack, so a read (and a failed read’s partial values) may drop on a thread of any stack size, and the heap never goes above what the values held.