Improve the docs on as_unchecked function
The `as_unchecked` method is never dangerous to call because an `Address<UncheckedNetwork>` provides a subset of functionality that is always ok to use. It is only dangerous to go the other way unchecked to checked.
This commit is contained in:
parent
8315760403
commit
769809f1f2
|
@ -353,8 +353,7 @@ impl<N: NetworkValidation> serde::Serialize for Address<N> {
|
|||
/// Methods on [`Address`] that can be called on both `Address<NetworkChecked>` and
|
||||
/// `Address<NetworkUnchecked>`.
|
||||
impl<V: NetworkValidation> Address<V> {
|
||||
/// Returns a reference to the unchecked address, which is dangerous to use if the address
|
||||
/// is invalid in the context of `NetworkUnchecked`.
|
||||
/// Returns a reference to the address as if it was unchecked.
|
||||
pub fn as_unchecked(&self) -> &Address<NetworkUnchecked> {
|
||||
unsafe { &*(self as *const Address<V> as *const Address<NetworkUnchecked>) }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue