pub struct DocumentStatus { /* private fields */ }Expand description
Snapshot of the current document state for frontend polling.
Implementations§
Source§impl DocumentStatus
impl DocumentStatus
Sourcepub fn new(
path: Option<PathBuf>,
dirty: bool,
file_len: usize,
line_count: LineCount,
line_ending: LineEnding,
encoding: DocumentEncoding,
preserve_save_error: Option<DocumentEncodingErrorKind>,
encoding_origin: DocumentEncodingOrigin,
decoding_had_errors: bool,
indexing: Option<ByteProgress>,
backing: DocumentBacking,
) -> Self
pub fn new( path: Option<PathBuf>, dirty: bool, file_len: usize, line_count: LineCount, line_ending: LineEnding, encoding: DocumentEncoding, preserve_save_error: Option<DocumentEncodingErrorKind>, encoding_origin: DocumentEncodingOrigin, decoding_had_errors: bool, indexing: Option<ByteProgress>, backing: DocumentBacking, ) -> Self
Creates a document status snapshot.
Sourcepub fn line_count(&self) -> LineCount
pub fn line_count(&self) -> LineCount
Returns the current document line count.
Sourcepub fn exact_line_count(&self) -> Option<usize>
pub fn exact_line_count(&self) -> Option<usize>
Returns the exact line count when it is known.
Sourcepub fn display_line_count(&self) -> usize
pub fn display_line_count(&self) -> usize
Returns the best-effort line count for viewport sizing and scrolling.
Sourcepub fn is_line_count_exact(&self) -> bool
pub fn is_line_count_exact(&self) -> bool
Returns true when the current line count is exact.
Sourcepub fn line_ending(&self) -> LineEnding
pub fn line_ending(&self) -> LineEnding
Returns the currently detected line ending style.
Sourcepub fn encoding(&self) -> DocumentEncoding
pub fn encoding(&self) -> DocumentEncoding
Returns the current document encoding contract.
Sourcepub fn preserve_save_error(&self) -> Option<DocumentEncodingErrorKind>
pub fn preserve_save_error(&self) -> Option<DocumentEncodingErrorKind>
Returns the typed reason why preserve-save would currently fail, if any.
Sourcepub fn can_preserve_save(&self) -> bool
pub fn can_preserve_save(&self) -> bool
Returns true when preserve-save is currently allowed for this document snapshot.
Sourcepub fn encoding_origin(&self) -> DocumentEncodingOrigin
pub fn encoding_origin(&self) -> DocumentEncodingOrigin
Returns how the current encoding contract was chosen.
Sourcepub fn decoding_had_errors(&self) -> bool
pub fn decoding_had_errors(&self) -> bool
Returns true when opening the source required lossy decode replacement.
Sourcepub fn indexing_state(&self) -> Option<ByteProgress>
pub fn indexing_state(&self) -> Option<ByteProgress>
Returns typed indexing progress while background indexing is active.
Sourcepub fn is_indexing(&self) -> bool
pub fn is_indexing(&self) -> bool
Returns true when document-local indexing is still running.
Sourcepub fn backing(&self) -> DocumentBacking
pub fn backing(&self) -> DocumentBacking
Returns the current document backing mode.
Sourcepub fn has_edit_buffer(&self) -> bool
pub fn has_edit_buffer(&self) -> bool
Returns true when the document currently uses any edit buffer.
Sourcepub fn has_piece_table(&self) -> bool
pub fn has_piece_table(&self) -> bool
Returns true when the document is currently backed by a piece table.
Trait Implementations§
Source§impl Clone for DocumentStatus
impl Clone for DocumentStatus
Source§fn clone(&self) -> DocumentStatus
fn clone(&self) -> DocumentStatus
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more