Skip to main content

RawFile

Struct RawFile 

Source
pub struct RawFile {
    pub name: RawStr,
    pub data: Bytes,
    /* private fields */
}
Expand description

A file UnityPy keeps as a reader.

Fields§

§name: RawStr

The name it was loaded under.

§data: Bytes

Its bytes (a slice of the parent’s buffer for an entry).

Implementations§

Source§

impl RawFile

Source

pub fn new( name: RawStr, data: Bytes, ty: FileType, meter: &Arc<Meter>, ) -> Result<Arc<Self>, ChargeError>

A raw file of data under name, which check_file_type called ty, its allocation charged to meter first (data is a slice of a buffer already charged, or the caller’s). A memory reader, as UnityPy keeps bytes and every entry of a container.

Source

pub fn with_reader( name: RawStr, data: Bytes, ty: FileType, meter: &Arc<Meter>, reader: ReaderKind, ) -> Result<Arc<Self>, ChargeError>

Self::new as the reader reader (ReaderKind::Stream for a top-level file loaded from a path).

Source

pub fn reader_kind(&self) -> ReaderKind

The reader UnityPy keeps it as, whose rules a resource read from it follows (ResourceReader._get_resource_data).

Source

pub fn meter(&self) -> &Arc<Meter> ⓘ

The meter of the input it belongs to.

Source

pub fn file_type(&self) -> FileType

What check_file_type called its bytes.

Trait Implementations§

Source§

impl Debug for RawFile

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.