[librsvg: 3/4] Store the T in ImageSurface<T> as PhantomData
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/4] Store the T in ImageSurface<T> as PhantomData
- Date: Mon, 6 Dec 2021 23:02:26 +0000 (UTC)
commit c831aec1801ebed235ffe8bb51cb1f4bf5e045fc
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Dec 6 16:43:46 2021 -0600
Store the T in ImageSurface<T> as PhantomData
It seems Rust 1.57 is stricter about unused fields, and the status
field was never used - it is what stores the Shared or Exclusive markers.
src/surface_utils/shared_surface.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/surface_utils/shared_surface.rs b/src/surface_utils/shared_surface.rs
index fa095806..adbf8e1f 100644
--- a/src/surface_utils/shared_surface.rs
+++ b/src/surface_utils/shared_surface.rs
@@ -88,8 +88,6 @@ pub enum Operator {
/// it is in the `Exclusive` state, while in the `Shared` state it only allows read-only access.
#[derive(Debug, Clone)]
pub struct ImageSurface<T> {
- state: T,
-
surface: cairo::ImageSurface,
data_ptr: NonNull<u8>, // *const.
@@ -98,6 +96,8 @@ pub struct ImageSurface<T> {
stride: isize,
surface_type: SurfaceType,
+
+ _state: PhantomData<T>,
}
#[derive(Debug, Clone)]
@@ -225,13 +225,13 @@ impl ImageSurface<Shared> {
let stride = surface.stride() as isize;
Ok(SharedImageSurface {
- state: Shared,
surface,
data_ptr,
width,
height,
stride,
surface_type,
+ _state: PhantomData,
})
}
@@ -1317,13 +1317,13 @@ impl ImageSurface<Exclusive> {
let stride = surface.stride() as isize;
Ok(ExclusiveImageSurface {
- state: Exclusive,
surface,
data_ptr,
width,
height,
stride,
surface_type,
+ _state: PhantomData,
})
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]