pub struct ModuleMetadata { /* private fields */ }Expand description
Metadata for a module within a LIB archive.
This includes the module name (up to 8 characters), creation timestamp, and a list of exported symbols.
§Structure on Disk
| Offset | Type | Description |
|---|---|---|
| 0 | [u8; 8] | Module name in ASCII. Padded to 8-bytes with spaces. |
| 8 | u32 | A creation timestamp for the module. The format is described in FromPSYQTimestamp. |
| 12 | u32 | An offset to the end of the module metadata. |
| 16 | u32 | The size of the serialized OBJ structure. |
| 20 | [Export] | An array of Export structs which declare any exported symbols. |
The list of Exports is terminated with a zero-length entry (a single byte with the value zero).
With the exception of the exports and offset, all other fields are derived from file system metadata. Including the exports at this level allows a linker to bypass the OBJ if it doesn’t contain any relevant symbols. The exports can be retrieved by querying the OBJ directly using OBJ::exports.
Implementations§
Source§impl ModuleMetadata
impl ModuleMetadata
pub fn new( name: String, created: SystemTime, size: u32, exports: Vec<Export>, ) -> Self
pub fn new_from_path(path: &Path, obj: &OBJ) -> Result<Self>
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Returns the module name, with trailing whitespace removed.
Names will be at most 8-ASCII characters long (or 8 UTF-8 bytes).
Sourcepub fn exports(&self) -> Vec<String>
pub fn exports(&self) -> Vec<String>
Returns a list of symbol names exported by this module.
Empty exports (the terminator entry) are filtered out.
Sourcepub fn created(&self) -> String
pub fn created(&self) -> String
Returns the creation timestamp as a formatted string.
Format: DD-MM-YY HH:MM:SS
§Example
15-05-96 16:09:38Sourcepub fn created_datetime(&self) -> Option<NaiveDateTime>
pub fn created_datetime(&self) -> Option<NaiveDateTime>
Returns the creation timestamp as a NaiveDateTime.
Returns None if the timestamp is invalid.
Sourcepub fn created_at(&self) -> Option<SystemTime>
pub fn created_at(&self) -> Option<SystemTime>
Returns the creation timestamp as a SystemTime.
Returns None if the timestamp is invalid.
Note: The original timestamp has no timezone information, so it’s treated as UTC for conversion purposes.
Trait Implementations§
Source§impl BinRead for ModuleMetadata
impl BinRead for ModuleMetadata
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
T from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for ModuleMetadata
impl BinWrite for ModuleMetadata
Source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()>
Source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>
fn write<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer using default arguments. Read moreSource§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming little-endian byte order. Read moreSource§fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming native-endian byte order. Read moreSource§fn write_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Self to the writer using the given arguments. Read moreSource§fn write_be_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_be_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Self to the writer, assuming big-endian byte order, using the
given arguments. Read moreSource§impl Clone for ModuleMetadata
impl Clone for ModuleMetadata
Source§fn clone(&self) -> ModuleMetadata
fn clone(&self) -> ModuleMetadata
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl PartialEq for ModuleMetadata
impl PartialEq for ModuleMetadata
Source§impl ReadEndian for ModuleMetadata
impl ReadEndian for ModuleMetadata
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
Source§impl WriteEndian for ModuleMetadata
impl WriteEndian for ModuleMetadata
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
impl StructuralPartialEq for ModuleMetadata
Auto Trait Implementations§
impl Freeze for ModuleMetadata
impl RefUnwindSafe for ModuleMetadata
impl Send for ModuleMetadata
impl Sync for ModuleMetadata
impl Unpin for ModuleMetadata
impl UnwindSafe for ModuleMetadata
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)