Skip to main content

DynBuffer

Struct DynBuffer 

Source
pub struct DynBuffer { /* private fields */ }
Expand description

A “dynamic” Handle wrapper for Buffers.

This Handle wrapper will always point to the presently active Buffer. It can also detect when that Buffer has been changed or when another Buffer becomes the active Buffer.

Implementations§

Source§

impl DynBuffer

Source

pub fn has_changed(&self, pa: &Pass) -> bool

Wether the Buffer pointed to has changed or swapped with another.

Source

pub fn swap_to_current(&mut self)

Swaps the DynBuffer to the currently active Buffer.

Source

pub fn read<'a>(&'a mut self, pa: &'a Pass) -> &'a Buffer

Reads the presently active Buffer.

Source

pub fn handle(&self) -> &Handle

The Handle<Buffer> currently being pointed to.

Source

pub fn declare_as_read(&self)

Simulates a read without actually reading.

This is useful if you want to tell Duat that you don’t want has_changed to return true, but you don’t have a Pass available to read the value.

This assumes that you don’t care about the active Buffer possibly being swapped.

Source

pub fn write<'a>(&'a self, pa: &'a mut Pass) -> &'a mut Buffer

Reads the presently active Buffer.

Source

pub fn write_with_area<'a>( &'a self, pa: &'a mut Pass, ) -> (&'a mut Buffer, &'a mut Area)

Writes to the Buffer and Area, making use of a Pass.

Source

pub fn declare_written(&self)

Simulates a write without actually writing.

This is useful if you want to tell Duat that you want has_changed to return true, but you don’t have a Pass available to write the value with.

Trait Implementations§

Source§

impl Clone for DynBuffer

Source§

fn clone(&self) -> Self

Returns a deep cloned duplicate of the value.

In this case, what this means is that the clone and self will have different internal pointers for the current Buffer. So if, for example, you call DynBuffer::swap_to_current on self, that will switch self to point to the current Buffer, but the same will not be done in the clone.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
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.