Find the crate containing the named example. Args: example: The name of the example to find. Raises: ValueError: The named example did not exist in exactly one crate in the Cargo workspace.
(self, example: str)
| 199 | return out |
| 200 | |
| 201 | def crate_for_example(self, example: str) -> Crate: |
| 202 | """Find the crate containing the named example. |
| 203 | |
| 204 | Args: |
| 205 | example: The name of the example to find. |
| 206 | |
| 207 | Raises: |
| 208 | ValueError: The named example did not exist in exactly one crate in |
| 209 | the Cargo workspace. |
| 210 | """ |
| 211 | out = None |
| 212 | for crate in self.crates.values(): |
| 213 | for e in crate.examples: |
| 214 | if e == example: |
| 215 | if out is not None: |
| 216 | raise ValueError( |
| 217 | f"example {example} appears more than once in cargo workspace" |
| 218 | ) |
| 219 | out = crate |
| 220 | if out is None: |
| 221 | raise ValueError(f"example {example} does not exist in cargo workspace") |
| 222 | return out |
| 223 | |
| 224 | def transitive_path_dependencies( |
| 225 | self, crate: Crate, dev: bool = False |
no test coverage detected