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 55- Added ` PciRootBridgeIoProtocol ` .
66- Added ` ConfigKeywordHandlerProtocol ` .
77- Added ` HiiConfigAccessProtocol ` .
8+ - Added ` ::octets() ` for ` Ipv4Address ` , ` Ipv6Address ` , and
9+ ` MacAddress ` to streamline the API with ` core::net ` .
810
911## Changed
1012- 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};
1616#[ repr( transparent) ]
1717pub struct Ipv4Address ( pub [ u8 ; 4 ] ) ;
1818
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+
1927impl From < core:: net:: Ipv4Addr > for Ipv4Address {
2028 fn from ( ip : core:: net:: Ipv4Addr ) -> Self {
2129 Self ( ip. octets ( ) )
@@ -33,6 +41,14 @@ impl From<Ipv4Address> for core::net::Ipv4Addr {
3341#[ repr( transparent) ]
3442pub struct Ipv6Address ( pub [ u8 ; 16 ] ) ;
3543
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+
3652impl From < core:: net:: Ipv6Addr > for Ipv6Address {
3753 fn from ( ip : core:: net:: Ipv6Addr ) -> Self {
3854 Self ( ip. octets ( ) )
@@ -125,6 +141,15 @@ impl From<core::net::IpAddr> for IpAddress {
125141#[ repr( transparent) ]
126142pub struct MacAddress ( pub [ u8 ; 32 ] ) ;
127143
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.
128153impl From < [ u8 ; 6 ] > for MacAddress {
129154 fn from ( octets : [ u8 ; 6 ] ) -> Self {
130155 let mut buffer = [ 0 ; 32 ] ;
You can’t perform that action at this time.
0 commit comments