Skip to content

Commit 221fd4a

Browse files
committed
Move GeneralDnsNameRef definition to the top
1 parent d8c05e1 commit 221fd4a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/subject_name/dns_name.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@ use core::fmt::Write;
1818

1919
use crate::Error;
2020

21+
/// A DNS name that may be either a DNS name identifier presented by a server (which may include
22+
/// wildcards), or a DNS name identifier referenced by a client for matching purposes (wildcards
23+
/// not permitted).
24+
pub enum GeneralDnsNameRef<'name> {
25+
/// a reference to a DNS name that may be used for matching purposes.
26+
DnsName(DnsNameRef<'name>),
27+
/// a reference to a presented DNS name that may include a wildcard.
28+
Wildcard(WildcardDnsNameRef<'name>),
29+
}
30+
31+
impl<'a> From<GeneralDnsNameRef<'a>> for &'a str {
32+
fn from(d: GeneralDnsNameRef<'a>) -> Self {
33+
match d {
34+
GeneralDnsNameRef::DnsName(name) => name.into(),
35+
GeneralDnsNameRef::Wildcard(name) => name.into(),
36+
}
37+
}
38+
}
39+
2140
/// A DNS Name suitable for use in the TLS Server Name Indication (SNI)
2241
/// extension and/or for use as the reference hostname for which to verify a
2342
/// certificate.
@@ -126,25 +145,6 @@ impl<'a> From<DnsNameRef<'a>> for &'a str {
126145
}
127146
}
128147

129-
/// A DNS name that may be either a DNS name identifier presented by a server (which may include
130-
/// wildcards), or a DNS name identifier referenced by a client for matching purposes (wildcards
131-
/// not permitted).
132-
pub enum GeneralDnsNameRef<'name> {
133-
/// a reference to a DNS name that may be used for matching purposes.
134-
DnsName(DnsNameRef<'name>),
135-
/// a reference to a presented DNS name that may include a wildcard.
136-
Wildcard(WildcardDnsNameRef<'name>),
137-
}
138-
139-
impl<'a> From<GeneralDnsNameRef<'a>> for &'a str {
140-
fn from(d: GeneralDnsNameRef<'a>) -> Self {
141-
match d {
142-
GeneralDnsNameRef::DnsName(name) => name.into(),
143-
GeneralDnsNameRef::Wildcard(name) => name.into(),
144-
}
145-
}
146-
}
147-
148148
/// A reference to a DNS Name presented by a server that may include a wildcard.
149149
///
150150
/// A `WildcardDnsNameRef` is guaranteed to be syntactically valid. The validity rules

0 commit comments

Comments
 (0)