pub struct Address { /* private fields */ }Expand description
A structure representing the internals of an address in a Ton network.
Regardless of the address type, its workchain and hash_part
always remain the same.
Implementations§
Source§impl Address
impl Address
Sourcepub fn new(workchain: Workchain, hash_part: &HashPart) -> Self
pub fn new(workchain: Workchain, hash_part: &HashPart) -> Self
Creates a new Address structure from workchain and hash_part.
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Creates a new Address structure using the null values of workchain
and hash_part.
Sourcepub fn get_workchain(&self) -> i32
pub fn get_workchain(&self) -> i32
Returns the number of the workchain.
Sourcepub fn get_hash_part(&self) -> &HashPart
pub fn get_hash_part(&self) -> &HashPart
Returns a reference to the hash part.
Sourcepub fn from_raw_address<S>(raw: S) -> Result<Self, ParseError>
pub fn from_raw_address<S>(raw: S) -> Result<Self, ParseError>
Attempt to create an Address structure from the
string representation of the raw address.
Sourcepub fn from_base64<S>(
address: S,
encoder: Option<Base64Decoder>,
) -> Result<EncoderResult, ParseError>
pub fn from_base64<S>( address: S, encoder: Option<Base64Decoder>, ) -> Result<EncoderResult, ParseError>
Decodes the base64 address of the Ton network into an Address structure.
If the encoder argument is specified, the method decodes the address “strictly”
according to the specified algorithm.
Otherwise, the address algorithm will be guessed by the presence of base64 control
characters.
Sourcepub fn to_raw_address(&self) -> String
pub fn to_raw_address(&self) -> String
Converts the current structure to a string of the form “0:fa16bc…” also known as the “raw address”.
Sourcepub fn to_base64(&self, encoder: Base64Encoder) -> String
pub fn to_base64(&self, encoder: Base64Encoder) -> String
Converts the current structure to a Base64 string according to
the specified preferences in the encoder argument.
Use the BASE64_STD_DEFAULT and BASE64_URL_DEFAULT constants for fast conversion.