1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! 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:
//!
//! ```ignore
//! 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.
use crateAddress;
// ── Zero-cost reference conversions ──────────────────────────────────
/// Marker trait for types that are `#[repr(transparent)]` over `[u8; 32]`.
///
/// # Safety
///
/// Implementors must be `#[repr(transparent)]` wrappers around `[u8; 32]`
/// with no additional invariants. This enables zero-cost reference casts.
pub unsafe
// Hopper's own Address is trivially transparent.
unsafe
unsafe