Skip to main content

BandMut

Struct BandMut 

Source
pub struct BandMut<'a> { /* private fields */ }
Expand description

Disjoint mutable handle to one horizontal band inside BandedBuf, passed to the closure in BandedBuf::with_bands_mut.

BandMut is Send, so &mut [BandMut<'_>] can be mutated in parallel across worker threads (e.g. via rayon::par_iter_mut) with zero locks or atomic metadata contention. Each band starts with its previous SampleClaims available via starting_claims; call commit_claims (or keep_starting_claims) to record the band’s post-mutation claims. Any band that is not explicitly committed (or that panics mid-mutation) remains conservatively at SampleClaims::NONE.

Implementations§

Source§

impl<'a> BandMut<'a>

Source

pub const fn index(&self) -> usize

Zero-based index of this band inside the parent BandedBuf.

Source

pub const fn start_y(&self) -> u32

Global starting row coordinate (y) of this band inside the parent BandedBuf.

Source

pub const fn starting_claims(&self) -> SampleClaims

Attached SampleClaims that held on this band before BandedBuf::with_bands_mut began.

Source

pub fn as_view(&self) -> PixelView<'_>

Borrow this band immutably as a PixelView (zero Arc refcount bump).

Source

pub fn view_mut(&mut self) -> &mut PixelViewMut<'a>

Mutable PixelViewMut over this band’s pixels.

Source

pub fn commit_claims(&mut self, claims: SampleClaims)

Commit post-mutation SampleClaims for this band.

When BandedBuf::with_bands_mut returns, whole-image BandedBuf::attached_claims is automatically recomputed as the disjoint-region union across all bands.

Source

pub fn keep_starting_claims(&mut self)

Preserve starting_claims for a band whose pixels were left unchanged.

Trait Implementations§

Source§

impl<'a> Debug for BandMut<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for BandMut<'a>

§

impl<'a> Freeze for BandMut<'a>

§

impl<'a> RefUnwindSafe for BandMut<'a>

§

impl<'a> Send for BandMut<'a>

§

impl<'a> Sync for BandMut<'a>

§

impl<'a> Unpin for BandMut<'a>

§

impl<'a> UnsafeUnpin for BandMut<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.