cardano_sdk/cardano/address/
kind.rs

1//  This Source Code Form is subject to the terms of the Mozilla Public
2//  License, v. 2.0. If a copy of the MPL was not distributed with this
3//  file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5//! Type-level utilities for guiding the construction & inspection of [`Address`](super::Address).
6
7/// Restricts the inhabitants that a generic parameter can take. This is used in the context of
8/// [`Address`](super::Address) to carry certain predicates at the type-level and enable
9/// infaillible methods on addresses.
10///
11/// See also: [`Address::as_shelley`](super::Address::as_shelley) and/or
12/// [`Address::as_byron`](super::Address::as_byron).
13pub trait IsAddressKind: crate::non_extensible::NonExtensible {}
14
15/// Indicates that the underlying [`Address`](super::Address) is one of any kind. Many methods are
16/// available on _any_ addresses.
17///
18/// Note that there's no ways to construct this struct; its only role is to live at the type-level.
19#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
20pub struct Any;
21impl crate::non_extensible::NonExtensible for Any {}
22impl IsAddressKind for Any {}
23
24/// Indicates that the underlying [`Address`](super::Address) is a Byron (a.k.a Bootstrap) address.
25/// Specific methods may be available only to Byron addresses.
26///
27/// Note that there's no ways to construct this struct; its only role is to live at the type-level.
28#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
29pub struct Byron;
30impl crate::non_extensible::NonExtensible for Byron {}
31impl IsAddressKind for Byron {}
32
33/// Indicates that the underlying [`Address`](super::Address) is a Shelley address. Specific
34/// methods may be available only to Shelley addresses.
35///
36/// Note that there's no ways to construct this struct; its only role is to live at the type-level.
37#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
38pub struct Shelley;
39impl crate::non_extensible::NonExtensible for Shelley {}
40impl IsAddressKind for Shelley {}