Struct noosphere_cli::render::ChangeBuffer
source · pub struct ChangeBuffer<T> { /* private fields */ }Expand description
A ChangeBuffer enables order-sensitive buffering of changes, and is meant to be used when traversing incremental revisions of a sphere. If changes are buffered in history order, they can be flushed and the flusher will be able to work with a flattened representation of all those changes.
Implementations§
source§impl<T> ChangeBuffer<T>
impl<T> ChangeBuffer<T>
sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Initialize a ChangeBuffer with the given capacity. When the capacity is reached, the ChangeBuffer must be flushed before additional changes are buffered.
sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Returns true if the ChangeBuffer is full
source§impl<R> ChangeBuffer<SphereFile<R>>where
R: AsyncFileBody + 'static,
impl<R> ChangeBuffer<SphereFile<R>>where R: AsyncFileBody + 'static,
sourcepub async fn flush_to_writer(&mut self, writer: &SphereWriter) -> Result<()>
pub async fn flush_to_writer(&mut self, writer: &SphereWriter) -> Result<()>
Flush the ChangeBuffer to a SphereWriter for the case where we are dealing in sphere content
source§impl ChangeBuffer<(Did, Cid)>
impl ChangeBuffer<(Did, Cid)>
sourcepub async fn flush_to_writer(&mut self, writer: &SphereWriter) -> Result<()>
pub async fn flush_to_writer(&mut self, writer: &SphereWriter) -> Result<()>
Flush the ChangeBuffer to a SphereWriter for the case where we are dealing with peer references
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for ChangeBuffer<T>where T: RefUnwindSafe,
impl<T> Send for ChangeBuffer<T>where T: Send,
impl<T> Sync for ChangeBuffer<T>where T: Sync,
impl<T> Unpin for ChangeBuffer<T>
impl<T> UnwindSafe for ChangeBuffer<T>where T: RefUnwindSafe,
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