ratatui_toolkit/widgets/markdown_widget/foundation/source/methods/path.rs
1//! Method to get the file path of a `MarkdownSource`.
2
3use std::path::Path;
4
5use super::super::MarkdownSource;
6
7impl MarkdownSource {
8 /// Get the file path if this is a file-based source.
9 ///
10 /// Returns `None` for string sources.
11 pub fn path(&self) -> Option<&Path> {
12 match self {
13 Self::String(_) => None,
14 Self::File { path, .. } => Some(path),
15 }
16 }
17}