Skip to main content

GeneratorProvider

Struct GeneratorProvider 

Source
pub struct GeneratorProvider<G> { /* private fields */ }
Expand description

UnityPy’s get_nodes_up lookup/cache wrapper, usable in a provider chain. Its entry bound only limits retention; it never changes an answer.

Implementations§

Source§

impl<G: ScriptGenerator> GeneratorProvider<G>

Source

pub fn new( generator: G, meter: &Arc<Meter>, max_entries: usize, refusal_detail: Arc<str>, ) -> Self

Create an empty, fallibly grown cache on meter.

Source

pub fn cached(&self) -> usize

Answers retained under the original assembly/fullname pair.

Source

pub fn get_nodes_up( &self, assembly: &RawStr, fullname: &RawStr, ) -> Result<Option<Arc<Tree>>, ProviderError>

Case-sensitive suffix normalization and cache keys as UnityPy supplies them (helpers/TypeTreeGenerator.py:50-75). The original assembly name is the key: Assembly and Assembly.dll remain distinct entries.

Trait Implementations§

Source§

impl<G: Debug> Debug for GeneratorProvider<G>

Source§

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

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

impl<G: ScriptGenerator> TypeTreeProvider for GeneratorProvider<G>

Source§

fn name(&self) -> &'static str

A short name; the dump’s l2.source is "tpk" for the TPK provider.
Source§

fn accepts_scripts(&self) -> bool

Whether this provider answers script requests (TreeRequest::script): UnityPy’s env.typetree_generator. Only then does the Environment dereference a MonoBehaviour’s m_Script (P3; the TPK provider does not).
Source§

fn tree( &self, req: &TreeRequest<'_>, ) -> Result<Option<Arc<Tree>>, ProviderError>

The tree for req, or Ok(None) wherever UnityPy builds no node list, which the caller turns into no_typetree. For a TPK that is four cases: a class the TPK does not hold (KeyError); a version below the class’s first entry, and a picked entry that is None (the class removed at that version), both ValueError (helpers/Tpk.py:472-481); and a picked entry with no release root (AssertionError, Tpk.py:64), which Self::why_none tells apart. The pick is UnityPy’s floor over every entry in its stored order, None and release-less entries included: a provider never steps back past one of them to an earlier entry that has a tree. Every request that maps to one tree of the provider’s data gets the same Arc (UnityPy’s NODES_CACHE, Tpk.py:58-88, which shares one tree among the TPK class entries of one class record; the TPK provider shares one among the entries of one release root), so the trees a chain caches are bounded by the provider’s data, not by the versions an input names.
Source§

fn why_none( &self, class_id: i32, version: Option<&UnityVersion>, ) -> Option<NoTree>

Why the class tree of class_id at version is none (NoTree), where Self::tree answers Ok(None); version is None for a file below format 7, which Self::tree is never asked about. None where the provider has the tree, or does not say (the default).
Source§

fn common_strings(&self) -> Option<&CommonStrings>

The common strings blob typetrees index (UnityPy’s get_common_strings(), its TPK’s table), when this provider has them: a TPK provider does.

Auto Trait Implementations§

§

impl<G> !Freeze for GeneratorProvider<G>

§

impl<G> !RefUnwindSafe for GeneratorProvider<G>

§

impl<G> !UnwindSafe for GeneratorProvider<G>

§

impl<G> Forget for GeneratorProvider<G>

§

impl<G> Move for GeneratorProvider<G>

§

impl<G> Send for GeneratorProvider<G>
where G: Send,

§

impl<G> Sync for GeneratorProvider<G>
where G: Sync,

§

impl<G> Unpin for GeneratorProvider<G>
where G: Unpin,

§

impl<G> UnsafeUnpin for GeneratorProvider<G>
where G: UnsafeUnpin,

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.