pub struct VariantOffset { /* private fields */ }
Expand description
Represents an offset that varies depending on the runtime environment.
This struct holds three possible offset values, each corresponding to a
different runtime: Special Edition (se_offset
), Anniversary Edition (ae_offset
),
and Virtual Reality (vr_offset
).
The appropriate offset is selected based on the current runtime.
§Example
use commonlibsse_ng::rel::offset::VariantOffset;
use commonlibsse_ng::rel::ResolvableAddress as _;
let variant_offset = VariantOffset::new(0x1000, 0x2000, 0x3000);
// let offset = variant_offset.offset().unwrap();
Implementations§
Trait Implementations§
Source§impl Clone for VariantOffset
impl Clone for VariantOffset
Source§fn clone(&self) -> VariantOffset
fn clone(&self) -> VariantOffset
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VariantOffset
impl Debug for VariantOffset
Source§impl Hash for VariantOffset
impl Hash for VariantOffset
Source§impl Ord for VariantOffset
impl Ord for VariantOffset
Source§fn cmp(&self, other: &VariantOffset) -> Ordering
fn cmp(&self, other: &VariantOffset) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for VariantOffset
impl PartialEq for VariantOffset
Source§impl PartialOrd for VariantOffset
impl PartialOrd for VariantOffset
Source§impl ResolvableAddress for VariantOffset
impl ResolvableAddress for VariantOffset
Source§fn offset(&self) -> Result<NonZeroUsize, DataBaseError>
fn offset(&self) -> Result<NonZeroUsize, DataBaseError>
Get the offset based on the current runtime.
§Errors
- Returns an error if the module state is invalid or the runtime is unknown.
- Returns an error if the offset is 0.
Source§impl TryFrom<VariantOffset> for Relocation
impl TryFrom<VariantOffset> for Relocation
Source§type Error = DataBaseError
type Error = DataBaseError
The type returned in the event of a conversion error.
impl Eq for VariantOffset
impl StructuralPartialEq for VariantOffset
Auto Trait Implementations§
impl Freeze for VariantOffset
impl RefUnwindSafe for VariantOffset
impl Send for VariantOffset
impl Sync for VariantOffset
impl Unpin for VariantOffset
impl UnwindSafe for VariantOffset
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more