pub struct Parsed {
pub bytes_read: i64,
/* private fields */
}Expand description
One object’s value, the node lists that name its keys, the reader that built it, and the charge for the value’s memory and the lists’ table (module docs).
Fields§
§bytes_read: i64Where the read ended, from the object’s start (the trailing alignment
included); compared with byte_size by check_read. Signed: the
pure-Python reader’s position can end before its start (a negative
TypelessData length moves it back; UnityPy then reports, say,
“only read -96 bytes”). UnityPyBoost’s is never negative.
Implementations§
Source§impl Parsed
impl Parsed
Sourcepub fn replace_scalar(
&mut self,
path: &[&[u8]],
value: Value,
) -> Result<bool, ChargeError>
pub fn replace_scalar( &mut self, path: &[&[u8]], value: Value, ) -> Result<bool, ChargeError>
Replace an existing field without allocating. Strings and bytes must
own charged storage, as for ValueBuilder::scalar. Heap containers
are refused; their charges cannot be transferred through this API.
Missing paths and containers return false, leaving the value intact.
Source§impl Parsed
impl Parsed
Sourcepub fn value(&self) -> &Value
pub fn value(&self) -> &Value
The value. By reference only: the value lives as long as its charge.
Sourcepub fn lists(&self) -> &[SharedNodes]
pub fn lists(&self) -> &[SharedNodes]
The node lists; [0] is the tree the object was read with.
Sourcepub fn key_name(&self, map: &Map, key: NodeId) -> &[u8] ⓘ
pub fn key_name(&self, map: &Map, key: NodeId) -> &[u8] ⓘ
The name of key in map (empty if the map’s list is unknown).
Sourcepub fn entries<'a>(
&'a self,
map: &'a Map,
) -> impl ExactSizeIterator<Item = (&'a [u8], &'a Value)> + 'a
pub fn entries<'a>( &'a self, map: &'a Map, ) -> impl ExactSizeIterator<Item = (&'a [u8], &'a Value)> + 'a
A map’s entries with their names.
Sourcepub fn field<'a>(&'a self, map: &'a Map, name: &[u8]) -> Option<&'a Value>
pub fn field<'a>(&'a self, map: &'a Map, name: &[u8]) -> Option<&'a Value>
The value under name in map.
Sourcepub fn attr<'a>(&'a self, map: &'a Map, name: &[u8]) -> Option<&'a Value>
pub fn attr<'a>(&'a self, map: &'a Map, name: &[u8]) -> Option<&'a Value>
The value UnityPy’s object mode gives the attribute name of map’s
class (parse_class, UnityPyBoost/TypeTreeHelper.cpp:458-583): its
keys are the children’s cleaned names
(cleans_to), set in node order, so
of the children that clean to name the last wins. A dict merges a
repeated raw name into its first entry, which keeps the last value, so
the winner is found among the node’s children and its value under its
raw name; a map whose node is not known (one a caller built) takes the
last entry that cleans to name.