pub struct SourceState {
pub line_count: usize,
/* private fields */
}Expand description
Source state for markdown content management.
Manages the markdown source (string or file) and tracks line count.
Fields§
§line_count: usizeSource file line count (for accurate status bar display).
Implementations§
Source§impl SourceState
impl SourceState
Source§impl SourceState
impl SourceState
Source§impl SourceState
impl SourceState
Sourcepub fn is_file_source(&self) -> bool
pub fn is_file_source(&self) -> bool
Check if the source is file-based.
§Returns
true if the source is loaded from a file, false otherwise.
Source§impl SourceState
impl SourceState
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Source§impl SourceState
impl SourceState
Sourcepub fn reload_source(&mut self) -> Result<bool>
pub fn reload_source(&mut self) -> Result<bool>
Reload the source content from disk (for file-based sources).
This re-reads the file. The caller should check the return value and invalidate caches if content changed.
For string-based sources, this is a no-op.
§Returns
Ok(true)- Content changed, caller should invalidate caches.Ok(false)- Content unchanged or source is string-based.
§Errors
Returns an error if the file cannot be read.
Source§impl SourceState
impl SourceState
Sourcepub fn set_source_file(&mut self, path: impl AsRef<Path>) -> Result<()>
pub fn set_source_file(&mut self, path: impl AsRef<Path>) -> Result<()>
Set a file-based markdown source.
This loads the file content and enables auto-reload support.
Use reload_source() to check for and apply file changes.
Note: Caller should invalidate any caches after calling this.
§Arguments
path- Path to the markdown file.
§Errors
Returns an error if the file cannot be read.
Source§impl SourceState
impl SourceState
Sourcepub fn set_source_string(&mut self, content: impl Into<String>)
pub fn set_source_string(&mut self, content: impl Into<String>)
Set a string-based markdown source.
Note: Caller should invalidate any caches after calling this.
§Arguments
content- The markdown content string.
Source§impl SourceState
impl SourceState
Sourcepub fn source_path(&self) -> Option<&Path>
pub fn source_path(&self) -> Option<&Path>
Get the file path if this is a file-based source.
§Returns
The file path, or None if this is a string source or no source is set.
Trait Implementations§
Source§impl Clone for SourceState
impl Clone for SourceState
Source§fn clone(&self) -> SourceState
fn clone(&self) -> SourceState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceState
impl Debug for SourceState
Auto Trait Implementations§
impl Freeze for SourceState
impl RefUnwindSafe for SourceState
impl Send for SourceState
impl Sync for SourceState
impl Unpin for SourceState
impl UnwindSafe for SourceState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().