mem
Library for doing raw memory accesses and other low-level operations.
Types
std::mem::AlignTo
std::mem::AlignToAligns the cursor to the given alignment
<alignment>: The alignment to align to
struct AlignTo<auto Alignment> { ... } [[hidden, sealed]];std::mem::Bytes
std::mem::BytesA type representing a sequence of bytes without any specific meaning
<Size>: The size of the sequence
struct Bytes<auto Size> { ... } [[sealed, format]];std::mem::Endian
std::mem::EndianThe endianness of a value
enum Endian : {
Big,
Little,
Native
};std::mem::MagicSearch
std::mem::MagicSearchSearches for a sequence of bytes and places the given type at that address
<Magic>: The magic sequence to search for<T>: The type to place at the address
std::mem::Reinterpreter
std::mem::ReinterpreterReinterprets a value as a different one
<From>: The type to reinterpret from<To>: The type to reinterpret to
std::mem::Section
std::mem::SectionA Handle for a custom Section
Functions
std::mem::eof
std::mem::eofFunction that returns true if the cursor position is at the end of the memory This is usually used in while-sized arrays in the form of u8 array[while(!std::mem::eof())]
return: True if the cursor is at the end of the memory
std::mem::reached
std::mem::reachedFunction that returns true if the cursor position is at or beyond the given address
address: The address to compare againstreturn: True if the cursor is at or beyond the given address
std::mem::align_to
std::mem::align_toAligns the given value to the given alignment
alignment: The alignment to align tovalue: The value to alignreturn: The aligned value
std::mem::base_address
std::mem::base_addressGets the base address of the data
return: The base address of the memory
std::mem::size
std::mem::sizeGets the size of the data
return: The size of the memory
std::mem::find_sequence
std::mem::find_sequenceFinds a sequence of bytes in the data
occurrence_index: The index of the occurrence to findbytes: The bytes to findreturn: The address of the sequence
std::mem::find_sequence_in_range
std::mem::find_sequence_in_rangeFinds a sequence of bytes in a specific region of the data
occurrence_index: The index of the occurrence to findoffsetFrom: The offset from which to start searchingoffsetTo: The offset to which to searchbytes: The bytes to findreturn: The address of the sequence
std::mem::find_string
std::mem::find_stringFinds a string in the data
occurrence_index: The index of the occurrence to findstring: The string to findreturn: The address of the sequence
std::mem::find_string_in_range
std::mem::find_string_in_rangeFinds a string in a specific region of the data
occurrence_index: The index of the occurrence to findoffsetFrom: The offset from which to start searchingoffsetTo: The offset to which to searchstring: The string to findreturn: The address of the sequence
std::mem::read_unsigned
std::mem::read_unsignedReads a unsigned value from the memory
address: The address to read fromsize: The size of the value to read[endian]: The endianness of the value to read. Defaults to nativereturn: The value read
std::mem::read_signed
std::mem::read_signedReads a signed value from the memory
address: The address to read fromsize: The size of the value to read[endian]: The endianness of the value to read. Defaults to nativereturn: The value read
std::mem::read_string
std::mem::read_stringReads a string value from the memory
address: The address to read fromsize: The size of the value to readreturn: The value read
std::mem::read_bits
std::mem::read_bitsReads a number of bits from the specified bit offset within the specified byte
byteOffset: The byte offset within the databitOffset: The bit offset to start the read at within the current bytebitSize: The total number of bits to readreturn: A u128 containing the value read
std::mem::create_section
std::mem::create_sectionCreates a new custom section with the given name
name: The name of the sectionreturn: The handle to the section
std::mem::delete_section
std::mem::delete_sectionDeletes a custom section
section: The handle to the section
std::mem::get_section_size
std::mem::get_section_sizeGets the size of a custom section
section: The handle to the sectionreturn: The size of the section
std::mem::set_section_size
std::mem::set_section_sizeChanges the size of a custom section
section: The handle to the sectionsize: The new size of the section
std::mem::copy_section_to_section
std::mem::copy_section_to_sectionCopies a range of bytes from one section into another
from_section: The section to copy fromfrom_address: The address to copy fromto_section: The section to copy toto_address: The address to copy tosize: The size of the range to copy
std::mem::copy_value_to_section
std::mem::copy_value_to_sectionCopies a range of bytes from the main section into a custom section
value: The pattern whose bytes should be copiedto_section: The section to copy toto_address: The address to copy to
std::mem::current_bit_offset
std::mem::current_bit_offsetReturns the current bit offset when inside of a bitfield.
return: The current bit offset between 0 and 7
Last updated
Was this helpful?