pub struct PlaneRegionMut<'a, T: Pixel> {
data: *mut T,
pub plane_cfg: &'a PlaneConfig,
rect: Rect,
phantom: PhantomData<&'a mut T>,
}Expand description
Mutable bounded region of a plane
This allows to give mutable access to a rectangular area of the plane without giving access to the whole plane.
Fields§
§data: *mut T§plane_cfg: &'a PlaneConfig§rect: Rect§phantom: PhantomData<&'a mut T>Implementations§
Source§impl<'a, T: Pixel> PlaneRegionMut<'a, T>
impl<'a, T: Pixel> PlaneRegionMut<'a, T>
pub fn empty(plane_cfg: &'a PlaneConfig) -> Self
Sourcepub fn from_slice(data: &'a mut [T], cfg: &'a PlaneConfig, rect: Rect) -> Self
pub fn from_slice(data: &'a mut [T], cfg: &'a PlaneConfig, rect: Rect) -> Self
§Panics
- If the configured dimensions are invalid
unsafe fn from_slice_unsafe( data: &'a mut [T], cfg: &'a PlaneConfig, rect: Rect, ) -> Self
pub fn new(plane: &'a mut Plane<T>, rect: Rect) -> Self
pub fn new_from_plane(plane: &'a mut Plane<T>) -> Self
pub fn data_ptr(&self) -> *const T
pub fn rect(&self) -> &Rect
pub fn rows_iter(&self) -> PlaneRegionRowsIter<'_, T> ⓘ
pub fn vert_windows(&self, h: usize) -> VertWindows<'_, T> ⓘ
pub fn horz_windows(&self, w: usize) -> HorzWindows<'_, T> ⓘ
Sourcepub fn subregion(&self, area: Area) -> PlaneRegion<'_, T>
pub fn subregion(&self, area: Area) -> PlaneRegion<'_, T>
Return a view to a subregion of the plane
The subregion must be included in (i.e. must not exceed) this region.
It is described by an Area, relative to this region.
§Panics
- If the requested dimensions are larger than the plane region size
§Example
ⓘ
// a subregion from (10, 8) to the end of the region
let subregion = region.subregion(Area::StartingAt { x: 10, y: 8 });ⓘ
// a subregion from the top-left of block (2, 3) having size (64, 64)
let bo = BlockOffset { x: 2, y: 3 };
let subregion = region.subregion(Area::BlockRect { bo, width: 64, height: 64 });Source§impl<T: Pixel> PlaneRegionMut<'_, T>
impl<T: Pixel> PlaneRegionMut<'_, T>
pub fn data_ptr_mut(&mut self) -> *mut T
pub fn rows_iter_mut(&mut self) -> PlaneRegionRowsIterMut<'_, T> ⓘ
pub fn as_const(&self) -> PlaneRegion<'_, T>
Trait Implementations§
impl<T: Pixel> Send for PlaneRegionMut<'_, T>
impl<T: Pixel> Sync for PlaneRegionMut<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for PlaneRegionMut<'a, T>
impl<'a, T> RefUnwindSafe for PlaneRegionMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Unpin for PlaneRegionMut<'a, T>
impl<'a, T> UnsafeUnpin for PlaneRegionMut<'a, T>
impl<'a, T> !UnwindSafe for PlaneRegionMut<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more