pub struct InMemoryMultibufferRegistry { /* private fields */ }Expand description
Default in-memory MultibufferRegistry implementation. One
RwLock<HashMap> indexed by view BufferId. Lookups take the
read lock (no contention with parallel readers); insert /
remove take the write lock (rare paths — view creation + view
close).
Implementations§
Source§impl InMemoryMultibufferRegistry
impl InMemoryMultibufferRegistry
pub fn new() -> Self
Sourcepub fn handle() -> MultibufferRegistryHandle
pub fn handle() -> MultibufferRegistryHandle
Construct the registry as a service handle (cheap-clone
Arc’d trait object) ready for ServiceRegistry::register.
Trait Implementations§
Source§impl Debug for InMemoryMultibufferRegistry
impl Debug for InMemoryMultibufferRegistry
Source§impl Default for InMemoryMultibufferRegistry
impl Default for InMemoryMultibufferRegistry
Source§fn default() -> InMemoryMultibufferRegistry
fn default() -> InMemoryMultibufferRegistry
Returns the “default value” for a type. Read more
Source§impl MultibufferRegistry for InMemoryMultibufferRegistry
impl MultibufferRegistry for InMemoryMultibufferRegistry
Source§fn handle(&self, view: BufferId) -> Option<Arc<MultibufferDocumentHandle>>
fn handle(&self, view: BufferId) -> Option<Arc<MultibufferDocumentHandle>>
Return the typed handle for
view if registered, else
None. Cheap-clone: Arc::clone.Source§fn insert(&self, view: BufferId, handle: Arc<MultibufferDocumentHandle>)
fn insert(&self, view: BufferId, handle: Arc<MultibufferDocumentHandle>)
Register
handle against view. Called by
create_multibuffer_view after the handle is built.
Overwrites if the view id already had a handle (last-write-
wins; production code allocates fresh ids per view so a
collision is a developer bug, not a hot-swap).Source§fn remove(&self, view: BufferId)
fn remove(&self, view: BufferId)
Remove the entry for
view. Idempotent: removing a
non-existent entry is a no-op.Source§fn remove_by_document_id(&self, document_id: DocumentId) -> bool
fn remove_by_document_id(&self, document_id: DocumentId) -> bool
Remove the entry whose handle reports
document_id as
its MultibufferDocumentHandle::document_id. Called by
the DocumentClosed subscriber (the event payload carries
DocumentId, not BufferId). Returns true if an entry
was removed. O(n) over active views; multibuffer counts
are small so the walk is fine.Auto Trait Implementations§
impl !Freeze for InMemoryMultibufferRegistry
impl RefUnwindSafe for InMemoryMultibufferRegistry
impl Send for InMemoryMultibufferRegistry
impl Sync for InMemoryMultibufferRegistry
impl Unpin for InMemoryMultibufferRegistry
impl UnsafeUnpin for InMemoryMultibufferRegistry
impl UnwindSafe for InMemoryMultibufferRegistry
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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