Skip to content

Commit f674d8a

Browse files
committed
Add reborrowing PixmapMut::as_mut
Also add PixmapRef::as_ref for parity
1 parent 68b198a commit f674d8a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/pixmap.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ impl<'a> PixmapRef<'a> {
316316
}
317317
}
318318

319+
/// Reborrows the current container
320+
pub fn as_ref(&self) -> Self {
321+
*self
322+
}
323+
319324
/// Returns pixmap's width.
320325
#[inline]
321326
pub fn width(&self) -> u32 {
@@ -483,6 +488,14 @@ impl<'a> PixmapMut<'a> {
483488
}
484489
}
485490

491+
/// Reborrows the current container
492+
pub fn as_mut<'b: 'a>(&'b mut self) -> PixmapMut<'b> {
493+
Self {
494+
data: self.data,
495+
size: self.size,
496+
}
497+
}
498+
486499
/// Returns pixmap's width.
487500
#[inline]
488501
pub fn width(&self) -> u32 {

0 commit comments

Comments
 (0)