@@ -109,6 +109,7 @@ impl<'boot> GraphicsOutput<'boot> {
109
109
}
110
110
111
111
/// Returns information about all available graphics modes.
112
+ #[ must_use]
112
113
pub fn modes ( & ' _ self ) -> impl ExactSizeIterator < Item = Mode > + ' _ {
113
114
ModeIter {
114
115
gop : self ,
@@ -294,6 +295,7 @@ impl<'boot> GraphicsOutput<'boot> {
294
295
}
295
296
296
297
/// Returns the frame buffer information for the current mode.
298
+ #[ must_use]
297
299
pub const fn current_mode_info ( & self ) -> ModeInfo {
298
300
* self . mode . info
299
301
}
@@ -377,11 +379,13 @@ impl Mode {
377
379
/// The size of the info structure in bytes.
378
380
///
379
381
/// Newer versions of the spec might add extra information, in a backwards compatible way.
382
+ #[ must_use]
380
383
pub const fn info_size ( & self ) -> usize {
381
384
self . info_sz
382
385
}
383
386
384
387
/// Returns a reference to the mode info structure.
388
+ #[ must_use]
385
389
pub const fn info ( & self ) -> & ModeInfo {
386
390
& self . info
387
391
}
@@ -404,16 +408,19 @@ impl ModeInfo {
404
408
/// Returns the (horizontal, vertical) resolution.
405
409
///
406
410
/// On desktop monitors, this usually means (width, height).
411
+ #[ must_use]
407
412
pub const fn resolution ( & self ) -> ( usize , usize ) {
408
413
( self . hor_res as usize , self . ver_res as usize )
409
414
}
410
415
411
416
/// Returns the format of the frame buffer.
417
+ #[ must_use]
412
418
pub const fn pixel_format ( & self ) -> PixelFormat {
413
419
self . format
414
420
}
415
421
416
422
/// Returns the bitmask of the custom pixel format, if available.
423
+ #[ must_use]
417
424
pub const fn pixel_bitmask ( & self ) -> Option < PixelBitmask > {
418
425
match self . format {
419
426
PixelFormat :: Bitmask => Some ( self . mask ) ,
@@ -425,6 +432,7 @@ impl ModeInfo {
425
432
///
426
433
/// Due to performance reasons, the stride might not be equal to the width,
427
434
/// instead the stride might be bigger for better alignment.
435
+ #[ must_use]
428
436
pub const fn stride ( & self ) -> usize {
429
437
self . stride as usize
430
438
}
@@ -475,6 +483,7 @@ pub struct BltPixel {
475
483
476
484
impl BltPixel {
477
485
/// Create a new pixel from RGB values.
486
+ #[ must_use]
478
487
pub const fn new ( red : u8 , green : u8 , blue : u8 ) -> Self {
479
488
Self {
480
489
red,
@@ -582,6 +591,7 @@ impl<'gop> FrameBuffer<'gop> {
582
591
}
583
592
584
593
/// Query the framebuffer size in bytes
594
+ #[ must_use]
585
595
pub const fn size ( & self ) -> usize {
586
596
self . size
587
597
}
@@ -607,6 +617,7 @@ impl<'gop> FrameBuffer<'gop> {
607
617
/// - You must honor the pixel format and stride specified by the mode info
608
618
/// - There is no bound checking on memory accesses in release mode
609
619
#[ inline]
620
+ #[ must_use]
610
621
pub unsafe fn read_byte ( & self , index : usize ) -> u8 {
611
622
debug_assert ! ( index < self . size, "Frame buffer accessed out of bounds" ) ;
612
623
self . base . add ( index) . read_volatile ( )
@@ -647,6 +658,7 @@ impl<'gop> FrameBuffer<'gop> {
647
658
/// - You must honor the pixel format and stride specified by the mode info
648
659
/// - There is no bound checking on memory accesses in release mode
649
660
#[ inline]
661
+ #[ must_use]
650
662
pub unsafe fn read_value < T > ( & self , index : usize ) -> T {
651
663
debug_assert ! (
652
664
index. saturating_add( mem:: size_of:: <T >( ) ) <= self . size,
0 commit comments