File tree 10 files changed +11
-11
lines changed
10 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ impl AlignedBuffer {
47
47
48
48
/// Get a mutable pointer to the aligned memory region managed by this instance.
49
49
#[ must_use]
50
- pub fn ptr_mut ( & mut self ) -> * mut u8 {
50
+ pub const fn ptr_mut ( & mut self ) -> * mut u8 {
51
51
self . ptr . as_ptr ( )
52
52
}
53
53
Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ impl MemoryMapBackingMemory {
335
335
336
336
/// Returns a mutable slice to the underlying memory.
337
337
#[ must_use]
338
- pub fn as_mut_slice ( & mut self ) -> & mut [ u8 ] {
338
+ pub const fn as_mut_slice ( & mut self ) -> & mut [ u8 ] {
339
339
unsafe { self . 0 . as_mut ( ) }
340
340
}
341
341
}
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ pub struct AtaDevice<'a> {
105
105
}
106
106
107
107
impl AtaDevice < ' _ > {
108
- fn proto_mut ( & mut self ) -> * mut AtaPassThruProtocol {
108
+ const fn proto_mut ( & mut self ) -> * mut AtaPassThruProtocol {
109
109
ptr:: from_ref ( self . proto ) . cast_mut ( )
110
110
}
111
111
Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ impl FrameBuffer<'_> {
569
569
///
570
570
/// On some implementations this framebuffer pointer can be used after
571
571
/// exiting boot services, but that is not guaranteed by the UEFI Specification.
572
- pub fn as_mut_ptr ( & mut self ) -> * mut u8 {
572
+ pub const fn as_mut_ptr ( & mut self ) -> * mut u8 {
573
573
self . base
574
574
}
575
575
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ impl Output {
72
72
73
73
/// Returns an iterator of all supported text modes.
74
74
// TODO: Bring back impl Trait once the story around bounds improves
75
- pub fn modes ( & mut self ) -> OutputModeIter < ' _ > {
75
+ pub const fn modes ( & mut self ) -> OutputModeIter < ' _ > {
76
76
let max = self . data ( ) . max_mode as usize ;
77
77
OutputModeIter {
78
78
output : self ,
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ pub struct DevicePathBuilder<'a> {
79
79
80
80
impl < ' a > DevicePathBuilder < ' a > {
81
81
/// Create a builder backed by a statically-sized buffer.
82
- pub fn with_buf ( buf : & ' a mut [ MaybeUninit < u8 > ] ) -> Self {
82
+ pub const fn with_buf ( buf : & ' a mut [ MaybeUninit < u8 > ] ) -> Self {
83
83
Self {
84
84
storage : BuilderStorage :: Buf { buf, offset : 0 } ,
85
85
}
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ impl LoadedImage {
131
131
/// long enough.
132
132
///
133
133
/// [shim]: https://github.com/rhboot/shim/blob/4d64389c6c941d21548b06423b8131c872e3c3c7/pe.c#L1143
134
- pub unsafe fn set_image ( & mut self , data : * const c_void , size : u64 ) {
134
+ pub const unsafe fn set_image ( & mut self , data : * const c_void , size : u64 ) {
135
135
self . 0 . image_base = data;
136
136
self . 0 . image_size = size;
137
137
}
@@ -167,7 +167,7 @@ impl LoadedImage {
167
167
/// must ensure that the memory lives long enough.
168
168
///
169
169
/// [`boot::start_image`]: crate::boot::start_image
170
- pub unsafe fn set_load_options ( & mut self , options : * const u8 , size : u32 ) {
170
+ pub const unsafe fn set_load_options ( & mut self , options : * const u8 , size : u32 ) {
171
171
self . 0 . load_options = options. cast ( ) ;
172
172
self . 0 . load_options_size = size;
173
173
}
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ impl IpAddress {
58
58
}
59
59
60
60
#[ must_use]
61
- fn as_raw_ptr_mut ( & mut self ) -> * mut uefi_raw:: IpAddress {
61
+ const fn as_raw_ptr_mut ( & mut self ) -> * mut uefi_raw:: IpAddress {
62
62
// The uefi-raw type is defined differently, but the layout is
63
63
// compatible.
64
64
self . 0 . as_mut_ptr ( ) . cast ( )
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ pub struct NvmeNamespace<'a> {
119
119
}
120
120
121
121
impl NvmeNamespace < ' _ > {
122
- fn proto_mut ( & mut self ) -> * mut NvmExpressPassThruProtocol {
122
+ const fn proto_mut ( & mut self ) -> * mut NvmExpressPassThruProtocol {
123
123
ptr:: from_ref ( self . proto ) . cast_mut ( )
124
124
}
125
125
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ pub struct ScsiDevice<'a> {
130
130
target_lun : ScsiTargetLun ,
131
131
}
132
132
impl ScsiDevice < ' _ > {
133
- fn proto_mut ( & mut self ) -> * mut ExtScsiPassThruProtocol {
133
+ const fn proto_mut ( & mut self ) -> * mut ExtScsiPassThruProtocol {
134
134
ptr:: from_ref ( self . proto ) . cast_mut ( )
135
135
}
136
136
You can’t perform that action at this time.
0 commit comments