pub struct FoldRegion {
pub id: u64,
pub start_line: usize,
pub end_line: usize,
pub kind: FoldKind,
pub preview: Option<String>,
pub is_folded: bool,
}Available on crate features
editor and folding only.Expand description
A foldable region in the document.
Fields§
§id: u64Unique identifier for this region
start_line: usizeStart line (0-indexed)
end_line: usizeEnd line (0-indexed, inclusive)
kind: FoldKindKind of fold region
preview: Option<String>Preview text to show when folded
is_folded: boolWhether this region is currently folded
Implementations§
Source§impl FoldRegion
impl FoldRegion
Sourcepub fn new(id: u64, start_line: usize, end_line: usize, kind: FoldKind) -> Self
pub fn new(id: u64, start_line: usize, end_line: usize, kind: FoldKind) -> Self
Create a new fold region.
Sourcepub fn with_preview(
id: u64,
start_line: usize,
end_line: usize,
kind: FoldKind,
preview: impl Into<String>,
) -> Self
pub fn with_preview( id: u64, start_line: usize, end_line: usize, kind: FoldKind, preview: impl Into<String>, ) -> Self
Create a fold region with preview text.
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Get the number of lines in this region.
Sourcepub fn contains_line(&self, line: usize) -> bool
pub fn contains_line(&self, line: usize) -> bool
Check if a line is within this region (excluding the start line).
Trait Implementations§
Source§impl Clone for FoldRegion
impl Clone for FoldRegion
Source§fn clone(&self) -> FoldRegion
fn clone(&self) -> FoldRegion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FoldRegion
impl Debug for FoldRegion
Source§impl<'de> Deserialize<'de> for FoldRegion
impl<'de> Deserialize<'de> for FoldRegion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FoldRegion
impl RefUnwindSafe for FoldRegion
impl Send for FoldRegion
impl Sync for FoldRegion
impl Unpin for FoldRegion
impl UnwindSafe for FoldRegion
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> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
Source§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
Tries to deserialize the data, given only the
submit event.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.