ratatui_toolkit/widgets/markdown_widget/state/source_state/methods/source_path.rs
1//! Source path method for SourceState.
2
3use std::path::Path;
4
5use crate::widgets::markdown_widget::state::source_state::SourceState;
6
7impl SourceState {
8 /// Get the file path if this is a file-based source.
9 ///
10 /// # Returns
11 ///
12 /// The file path, or `None` if this is a string source or no source is set.
13 pub fn source_path(&self) -> Option<&Path> {
14 self.source.as_ref().and_then(|s| s.path())
15 }
16}