Skip to content

Commit 3aafb30

Browse files
committed
Add method to get immutable slice of framebuffer bytes
1 parent 44c7616 commit 3aafb30

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/boot_info.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,13 @@ pub struct FrameBuffer {
112112
}
113113

114114
impl FrameBuffer {
115-
/// Returns the raw bytes of the framebuffer.
116-
pub fn buffer(&mut self) -> &mut [u8] {
115+
/// Returns the raw bytes of the framebuffer as slice.
116+
pub fn buffer(&self) -> &[u8] {
117+
unsafe { self.create_buffer() }
118+
}
119+
120+
/// Returns the raw bytes of the framebuffer as mutable slice.
121+
pub fn buffer_mut(&mut self) -> &mut [u8] {
117122
unsafe { self.create_buffer() }
118123
}
119124

0 commit comments

Comments
 (0)