pub enum MarkdownSource {
String(String),
File {
path: PathBuf,
content: String,
},
}markdown-preview only.Expand description
Represents the source of markdown content.
This enum provides a unified interface for working with markdown content that can come from either a static string or a file on disk.
Variants§
String(String)
Static string content (no auto-reload support).
File
File-based content with auto-reload support.
Implementations§
Source§impl MarkdownSource
Constructor for creating a MarkdownSource from a string.
impl MarkdownSource
Constructor for creating a MarkdownSource from a string.
Sourcepub fn from_string(s: impl Into<String>) -> MarkdownSource
pub fn from_string(s: impl Into<String>) -> MarkdownSource
Source§impl MarkdownSource
Method to get the content of a MarkdownSource.
impl MarkdownSource
Method to get the content of a MarkdownSource.
Source§impl MarkdownSource
Method to check if a MarkdownSource is file-based.
impl MarkdownSource
Method to check if a MarkdownSource is file-based.
Source§impl MarkdownSource
Method to check if a MarkdownSource is string-based.
impl MarkdownSource
Method to check if a MarkdownSource is string-based.
Source§impl MarkdownSource
Method to get the file path of a MarkdownSource.
impl MarkdownSource
Method to get the file path of a MarkdownSource.
Source§impl MarkdownSource
Method to reload content from a file.
impl MarkdownSource
Method to reload content from a file.
Source§impl MarkdownSource
Method to set content directly on a MarkdownSource.
impl MarkdownSource
Method to set content directly on a MarkdownSource.
Sourcepub fn set_content(&mut self, new_content: impl Into<String>) -> bool
pub fn set_content(&mut self, new_content: impl Into<String>) -> bool
Set the content directly (for string sources).
This is useful for updating string-based sources programmatically. For file sources, this updates the cached content but does not write to disk.
Returns true if the content was changed.
Trait Implementations§
Source§impl Clone for MarkdownSource
impl Clone for MarkdownSource
Source§fn clone(&self) -> MarkdownSource
fn clone(&self) -> MarkdownSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MarkdownSource
impl Debug for MarkdownSource
Source§impl Default for MarkdownSource
Default trait implementation for MarkdownSource.
impl Default for MarkdownSource
Default trait implementation for MarkdownSource.
Source§fn default() -> MarkdownSource
fn default() -> MarkdownSource
Source§impl From<&str> for MarkdownSource
From<&str> trait implementation for MarkdownSource.
impl From<&str> for MarkdownSource
From<&str> trait implementation for MarkdownSource.
Source§fn from(s: &str) -> MarkdownSource
fn from(s: &str) -> MarkdownSource
Source§impl From<String> for MarkdownSource
From trait implementation for MarkdownSource.
impl From<String> for MarkdownSource
FromMarkdownSource.
Source§fn from(s: String) -> MarkdownSource
fn from(s: String) -> MarkdownSource
Auto Trait Implementations§
impl Freeze for MarkdownSource
impl RefUnwindSafe for MarkdownSource
impl Send for MarkdownSource
impl Sync for MarkdownSource
impl Unpin for MarkdownSource
impl UnsafeUnpin for MarkdownSource
impl UnwindSafe for MarkdownSource
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> 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 more