Parses an example group from its directory. The group name is derived from the directory name, and example entries are extracted from `main.rs`.
(dir: &Path, category: Category)
| 53 | /// The group name is derived from the directory name, and example |
| 54 | /// entries are extracted from `main.rs`. |
| 55 | pub fn from_dir(dir: &Path, category: Category) -> Result<Self> { |
| 56 | let raw_name = dir |
| 57 | .file_name() |
| 58 | .and_then(|s| s.to_str()) |
| 59 | .ok_or_else(|| { |
| 60 | DataFusionError::Execution("Invalid example group dir".to_string()) |
| 61 | })? |
| 62 | .to_string(); |
| 63 | |
| 64 | let name = GroupName::from_dir_name(raw_name); |
| 65 | let main_rs = dir.join("main.rs"); |
| 66 | let examples = parse_main_rs_docs(&main_rs)?; |
| 67 | |
| 68 | Ok(Self { |
| 69 | name, |
| 70 | examples, |
| 71 | category, |
| 72 | }) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /// Represents an example group name in both raw and human-readable forms. |
nothing calls this directly
no test coverage detected