pub struct PortalAddress { /* private fields */ }Expand description
A 12-glyph portal address encoding a galactic location.
Each glyph is a nibble (0-15), and the 12 glyphs form a 48-bit packed
value in the same layout as GalacticAddress: P-SSS-YY-ZZZ-XXX.
Implementations§
Source§impl PortalAddress
impl PortalAddress
Sourcepub fn to_hex_string(&self) -> String
pub fn to_hex_string(&self) -> String
Format as 12 hex digits (uppercase): e.g., 01717D8A4EA2.
Sourcepub fn to_emoji_string(&self) -> String
pub fn to_emoji_string(&self) -> String
Format as emoji string.
Sourcepub fn parse_mixed(s: &str) -> Result<Self, PortalParseError>
pub fn parse_mixed(s: &str) -> Result<Self, PortalParseError>
Parse a mixed-format string containing 12 glyphs.
Accepts any combination of hex digits, emoji, and glyph names.
Sourcepub fn to_galactic_address(&self) -> GalacticAddress
pub fn to_galactic_address(&self) -> GalacticAddress
Convert to GalacticAddress (reality_index = 0).
Sourcepub fn from_galactic_address(addr: &GalacticAddress) -> Self
pub fn from_galactic_address(addr: &GalacticAddress) -> Self
Create from a GalacticAddress.
Sourcepub fn from_signal_booster(
s: &str,
planet_index: u8,
reality_index: u8,
) -> Result<Self, AddressParseError>
pub fn from_signal_booster( s: &str, planet_index: u8, reality_index: u8, ) -> Result<Self, AddressParseError>
Create from a signal booster string by first parsing to GalacticAddress.
Trait Implementations§
Source§impl Clone for PortalAddress
impl Clone for PortalAddress
Source§fn clone(&self) -> PortalAddress
fn clone(&self) -> PortalAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PortalAddress
impl Debug for PortalAddress
Source§impl<'de> Deserialize<'de> for PortalAddress
impl<'de> Deserialize<'de> for PortalAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for PortalAddress
Default display is hex.
impl Display for PortalAddress
Default display is hex.
Source§impl From<GalacticAddress> for PortalAddress
impl From<GalacticAddress> for PortalAddress
Source§fn from(addr: GalacticAddress) -> Self
fn from(addr: GalacticAddress) -> Self
Convert galactic address to portal address.
Extracts each nibble from the packed 48-bit value.
Source§impl From<PortalAddress> for GalacticAddress
impl From<PortalAddress> for GalacticAddress
Source§fn from(pa: PortalAddress) -> Self
fn from(pa: PortalAddress) -> Self
Convert portal address to galactic address.
Portal glyph layout: P-SSS-YY-ZZZ-XXX
(glyph positions 0-indexed: [0]=P, [1-3]=SSS, [4-5]=YY, [6-8]=ZZZ, [9-11]=XXX).
Reality index defaults to 0.
Source§impl FromStr for PortalAddress
Parse from any supported format (hex, emoji, mixed).
impl FromStr for PortalAddress
Parse from any supported format (hex, emoji, mixed).