pub struct FoldRegistry { /* private fields */ }Expand description
D.3.f.0: per-Editor fold-provider registry.
One primary per FoldMethod (built-ins registered at
construction); overlays added/removed by their owning
subsystems (DiffSubsystem for hunk folds, multibuffer
subsystem for excerpt / file-boundary folds in M.7 / M.8).
Implementations§
Source§impl FoldRegistry
impl FoldRegistry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
Construct with the five built-in primary providers already registered. Caller adds overlays as their subsystems come online.
Sourcepub fn primary(&self, method: FoldMethod) -> Option<&Arc<dyn FoldProvider>>
pub fn primary(&self, method: FoldMethod) -> Option<&Arc<dyn FoldProvider>>
Look up the primary provider for method. Always
returns Some for the five built-in methods; future
plugin-registered methods would populate this map
too.
Sourcepub fn add_overlay(&mut self, provider: Arc<dyn FoldProvider>) -> ProviderId
pub fn add_overlay(&mut self, provider: Arc<dyn FoldProvider>) -> ProviderId
Register an overlay provider. Called by the
FoldOverlayService when a mode activates (e.g.
diff-mode::on_activate registers a HunkFoldSource,
MultibufferMode its excerpt sources). Returns the
provider’s ProviderId so the caller can later
remove it.
Sourcepub fn remove_overlay(&mut self, id: ProviderId)
pub fn remove_overlay(&mut self, id: ProviderId)
Remove the overlay with the given id. No-op if not registered.
Sourcepub fn overlays(&self) -> impl Iterator<Item = &Arc<dyn FoldProvider>>
pub fn overlays(&self) -> impl Iterator<Item = &Arc<dyn FoldProvider>>
Iterate registered overlays in registration order.
Trait Implementations§
Source§impl Debug for FoldRegistry
impl Debug for FoldRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for FoldRegistry
impl !UnwindSafe for FoldRegistry
impl Freeze for FoldRegistry
impl Send for FoldRegistry
impl Sync for FoldRegistry
impl Unpin for FoldRegistry
impl UnsafeUnpin for FoldRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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> ⓘ
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> ⓘ
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