File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 5
5
- Added ` PciRootBridgeIoProtocol ` .
6
6
- Added ` ConfigKeywordHandlerProtocol ` .
7
7
- Added ` HiiConfigAccessProtocol ` .
8
+ - Added ` ::octets() ` for ` Ipv4Address ` , ` Ipv6Address ` , and
9
+ ` MacAddress ` to streamline the API with ` core::net ` .
8
10
9
11
## Changed
10
12
- The documentation for UEFI protocols has been streamlined and improved.
Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ use core::fmt::{Debug, Formatter};
16
16
#[ repr( transparent) ]
17
17
pub struct Ipv4Address ( pub [ u8 ; 4 ] ) ;
18
18
19
+ impl Ipv4Address {
20
+ /// Returns the octets of the IP address.
21
+ #[ must_use]
22
+ pub const fn octets ( self ) -> [ u8 ; 4 ] {
23
+ self . 0
24
+ }
25
+ }
26
+
19
27
impl From < core:: net:: Ipv4Addr > for Ipv4Address {
20
28
fn from ( ip : core:: net:: Ipv4Addr ) -> Self {
21
29
Self ( ip. octets ( ) )
@@ -33,6 +41,14 @@ impl From<Ipv4Address> for core::net::Ipv4Addr {
33
41
#[ repr( transparent) ]
34
42
pub struct Ipv6Address ( pub [ u8 ; 16 ] ) ;
35
43
44
+ impl Ipv6Address {
45
+ /// Returns the octets of the IP address.
46
+ #[ must_use]
47
+ pub const fn octets ( self ) -> [ u8 ; 16 ] {
48
+ self . 0
49
+ }
50
+ }
51
+
36
52
impl From < core:: net:: Ipv6Addr > for Ipv6Address {
37
53
fn from ( ip : core:: net:: Ipv6Addr ) -> Self {
38
54
Self ( ip. octets ( ) )
@@ -125,6 +141,15 @@ impl From<core::net::IpAddr> for IpAddress {
125
141
#[ repr( transparent) ]
126
142
pub struct MacAddress ( pub [ u8 ; 32 ] ) ;
127
143
144
+ impl MacAddress {
145
+ /// Returns the octets of the MAC address.
146
+ #[ must_use]
147
+ pub const fn octets ( self ) -> [ u8 ; 32 ] {
148
+ self . 0
149
+ }
150
+ }
151
+
152
+ // Normal/typical MAC addresses, such as in Ethernet.
128
153
impl From < [ u8 ; 6 ] > for MacAddress {
129
154
fn from ( octets : [ u8 ; 6 ] ) -> Self {
130
155
let mut buffer = [ 0 ; 32 ] ;
You can’t perform that action at this time.
0 commit comments