pub struct FoldState { /* private fields */ }Available on crate features
editor and folding only.Expand description
State for managing fold regions in a document.
Implementations§
Source§impl FoldState
impl FoldState
Sourcepub fn add_region(
&mut self,
start_line: usize,
end_line: usize,
kind: FoldKind,
) -> u64
pub fn add_region( &mut self, start_line: usize, end_line: usize, kind: FoldKind, ) -> u64
Add a new fold region.
Sourcepub fn add_region_with_preview(
&mut self,
start_line: usize,
end_line: usize,
kind: FoldKind,
preview: impl Into<String>,
) -> u64
pub fn add_region_with_preview( &mut self, start_line: usize, end_line: usize, kind: FoldKind, preview: impl Into<String>, ) -> u64
Add a region with preview text.
Sourcepub fn get_region(&self, id: u64) -> Option<&FoldRegion>
pub fn get_region(&self, id: u64) -> Option<&FoldRegion>
Get a region by ID.
Sourcepub fn get_region_mut(&mut self, id: u64) -> Option<&mut FoldRegion>
pub fn get_region_mut(&mut self, id: u64) -> Option<&mut FoldRegion>
Get a mutable reference to a region.
Sourcepub fn region_at_line(&self, line: usize) -> Option<&FoldRegion>
pub fn region_at_line(&self, line: usize) -> Option<&FoldRegion>
Get the region that starts at a specific line.
Sourcepub fn toggle_at_line(&mut self, line: usize) -> bool
pub fn toggle_at_line(&mut self, line: usize) -> bool
Toggle fold at a specific line.
Returns true if a fold was toggled.
Check if a line is hidden due to folding.
Sourcepub fn fold_indicators(&self) -> Vec<(usize, bool)>
pub fn fold_indicators(&self) -> Vec<(usize, bool)>
Get all fold indicator positions (line, is_folded).
Sourcepub fn unfold_all(&mut self)
pub fn unfold_all(&mut self)
Unfold all regions.
Sourcepub fn unfold_kind(&mut self, kind: FoldKind)
pub fn unfold_kind(&mut self, kind: FoldKind)
Unfold all regions of a specific kind.
Sourcepub fn mark_clean(&mut self)
pub fn mark_clean(&mut self)
Mark the fold state as clean.
Sourcepub fn mark_dirty(&mut self)
pub fn mark_dirty(&mut self)
Mark the fold state as dirty (needs recalculation).
Sourcepub fn region_count(&self) -> usize
pub fn region_count(&self) -> usize
Get the number of fold regions.
Sourcepub fn iter(&self) -> impl Iterator<Item = &FoldRegion>
pub fn iter(&self) -> impl Iterator<Item = &FoldRegion>
Iterate over all regions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FoldState
impl RefUnwindSafe for FoldState
impl Send for FoldState
impl Sync for FoldState
impl Unpin for FoldState
impl UnwindSafe for FoldState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.