Skip to main content

Module interop

Module interop 

Source
Expand description

Type interop for Hopper-owned address values.

Hopper keeps its own Address and AccountView types because they carry segment metadata, layout fingerprints, and borrow-tracking that external types lack. This module provides From/Into conversions so Hopper code can interoperate with the wider Solana ecosystem without loss of type safety.

§Layout-compatible reference casts

Hopper’s Address is #[repr(transparent)] over [u8; 32]. This means reference casts to other transparent 32-byte address wrappers are valid when the caller opts into the marker trait:

ⓘ
let hopper_addr: &Address = Address::from_ref(upstream_addr);
let upstream_ref: &[u8; 32] = hopper_addr.as_array();

§By-value conversions

Hopper’s runtime uses its own canonical Address. By-value conversions to Hopper Native’s address live in the direct runtime bridge.

§Backend-agnostic conversions

Hopper Address always converts to/from [u8; 32], making it trivially interoperable with any type that also wraps 32 bytes.

Traits§

TransparentAddress
Marker trait for types that are #[repr(transparent)] over [u8; 32].