Struct chalk_solve::display::WriterState
source · pub struct WriterState<I, DB, P = DB>{
pub(super) db: P,
id_aliases: Arc<Mutex<IdAliases<I>>>,
_phantom: PhantomData<DB>,
}
Expand description
Writer state which persists across multiple writes.
Currently, this means keeping track of what IDs have been given what names, including deduplication information.
This data is stored using interior mutability - clones will point to the same underlying data.
Uses a separate type, P
, for the database stored inside to account for
Arc
or wrapping other storage mediums.
Fields§
§db: P
§id_aliases: Arc<Mutex<IdAliases<I>>>
§_phantom: PhantomData<DB>
Implementations§
source§impl<I, DB, P> WriterState<I, DB, P>
impl<I, DB, P> WriterState<I, DB, P>
pub fn new(db: P) -> Self
sourcepub(super) fn wrap_db_ref<'a, DB2, P2, F>(
&'a self,
f: F,
) -> WriterState<I, DB2, P2>
pub(super) fn wrap_db_ref<'a, DB2, P2, F>( &'a self, f: F, ) -> WriterState<I, DB2, P2>
Returns a new version of self containing a wrapped database which references the outer data.
f
will be run on the internal database, and the returned result will
wrap the result from f
. For consistency, f
should always contain the
given database, and must keep the same ID<->item relationships.
pub(crate) fn db(&self) -> &DB
Trait Implementations§
source§impl<I, DB, P> Clone for WriterState<I, DB, P>
impl<I, DB, P> Clone for WriterState<I, DB, P>
Auto Trait Implementations§
impl<I, DB, P> Freeze for WriterState<I, DB, P>
impl<I, DB, P> RefUnwindSafe for WriterState<I, DB, P>
impl<I, DB, P> Send for WriterState<I, DB, P>
impl<I, DB, P> Sync for WriterState<I, DB, P>
impl<I, DB, P> Unpin for WriterState<I, DB, P>
impl<I, DB, P> UnwindSafe for WriterState<I, DB, P>
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> Cast for T
impl<T> Cast for T
source§fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> Uwhere
Self: CastTo<U>,
U: HasInterner,
Cast a value to type
U
using CastTo
.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)