Skip to main content

Parsed

Struct Parsed 

Source
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: i64

Where 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

Source

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

Source

pub fn read_by(&self) -> ReadBy

The reader that built the value (ReadBy).

Source

pub fn value(&self) -> &Value

The value. By reference only: the value lives as long as its charge.

Source

pub fn charge(&self) -> &Charge

The charge for the value’s memory and the lists’ table.

Source

pub fn lists(&self) -> &[SharedNodes]

The node lists; [0] is the tree the object was read with.

Source

pub fn key_name(&self, map: &Map, key: NodeId) -> &[u8] ⓘ

The name of key in map (empty if the map’s list is unknown).

Source

pub fn entries<'a>( &'a self, map: &'a Map, ) -> impl ExactSizeIterator<Item = (&'a [u8], &'a Value)> + 'a

A map’s entries with their names.

Source

pub fn field<'a>(&'a self, map: &'a Map, name: &[u8]) -> Option<&'a Value>

The value under name in map.

Source

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.

Source

pub fn get(&self, path: &[&[u8]]) -> Option<&Value>

Follows dict fields from the root value: get(&[b"m_Name"]).

Trait Implementations§

Source§

impl Debug for Parsed

Source§

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

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

impl Eq for Parsed

Source§

impl PartialEq for Parsed

Source§

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

The value, the lists, bytes_read and the reader; the charge is bookkeeping.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !Freeze for Parsed

§

impl !RefUnwindSafe for Parsed

§

impl !UnwindSafe for Parsed

§

impl Forget for Parsed

§

impl Move for Parsed

§

impl Send for Parsed

§

impl Sync for Parsed

§

impl Unpin for Parsed

§

impl UnsafeUnpin for Parsed

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.