@@ -136,22 +136,22 @@ impl DevicePathNode {
136136 }
137137
138138 /// Type of device
139- pub fn device_type ( & self ) -> DeviceType {
139+ pub const fn device_type ( & self ) -> DeviceType {
140140 self . header . device_type
141141 }
142142
143143 /// Sub type of device
144- pub fn sub_type ( & self ) -> DeviceSubType {
144+ pub const fn sub_type ( & self ) -> DeviceSubType {
145145 self . header . sub_type
146146 }
147147
148148 /// Tuple of the node's type and subtype.
149- pub fn full_type ( & self ) -> ( DeviceType , DeviceSubType ) {
149+ pub const fn full_type ( & self ) -> ( DeviceType , DeviceSubType ) {
150150 ( self . header . device_type , self . header . sub_type )
151151 }
152152
153153 /// Size (in bytes) of the full [`DevicePathNode`], including the header.
154- pub fn length ( & self ) -> u16 {
154+ pub const fn length ( & self ) -> u16 {
155155 self . header . length
156156 }
157157
@@ -281,7 +281,7 @@ impl DevicePath {
281281 }
282282
283283 /// Cast to a [`FfiDevicePath`] pointer.
284- pub fn as_ffi_ptr ( & self ) -> * const FfiDevicePath {
284+ pub const fn as_ffi_ptr ( & self ) -> * const FfiDevicePath {
285285 let p = self as * const Self ;
286286 p. cast ( )
287287 }
@@ -615,22 +615,22 @@ const HARD_DRIVE_MEDIA_DEVICE_PATH_LENGTH: u16 = 42;
615615
616616impl HardDriveMediaDevicePath {
617617 /// Returns the format of the partition (MBR, GPT, or unknown).
618- pub fn partition_format ( & self ) -> PartitionFormat {
618+ pub const fn partition_format ( & self ) -> PartitionFormat {
619619 self . partition_format
620620 }
621621
622622 /// Returns the 1-based index of the partition.
623- pub fn partition_number ( & self ) -> u32 {
623+ pub const fn partition_number ( & self ) -> u32 {
624624 self . partition_number
625625 }
626626
627627 /// Returns the partition size in logical blocks.
628- pub fn partition_size ( & self ) -> u64 {
628+ pub const fn partition_size ( & self ) -> u64 {
629629 self . partition_size
630630 }
631631
632632 /// Returns the starting LBA of the partition.
633- pub fn partition_start ( & self ) -> u64 {
633+ pub const fn partition_start ( & self ) -> u64 {
634634 self . partition_start
635635 }
636636
@@ -729,7 +729,7 @@ mod tests {
729729 raw_data
730730 }
731731
732- /// Check that `node` has the expected content.
732+ /// Check that `node` has the expected content.
733733 fn check_node ( node : & DevicePathNode , device_type : u8 , sub_type : u8 , node_data : & [ u8 ] ) {
734734 assert_eq ! ( node. device_type( ) . 0 , device_type) ;
735735 assert_eq ! ( node. sub_type( ) . 0 , sub_type) ;
0 commit comments