Find the crate containing the named binary. Args: bin: The name of the binary to find. Raises: ValueError: The named binary did not exist in exactly one crate in the Cargo workspace.
(self, bin: str)
| 176 | pass |
| 177 | |
| 178 | def crate_for_bin(self, bin: str) -> Crate: |
| 179 | """Find the crate containing the named binary. |
| 180 | |
| 181 | Args: |
| 182 | bin: The name of the binary to find. |
| 183 | |
| 184 | Raises: |
| 185 | ValueError: The named binary did not exist in exactly one crate in |
| 186 | the Cargo workspace. |
| 187 | """ |
| 188 | out = None |
| 189 | for crate in self.crates.values(): |
| 190 | for b in crate.bins: |
| 191 | if b == bin: |
| 192 | if out is not None: |
| 193 | raise ValueError( |
| 194 | f"bin {bin} appears more than once in cargo workspace" |
| 195 | ) |
| 196 | out = crate |
| 197 | if out is None: |
| 198 | raise ValueError(f"bin {bin} does not exist in cargo workspace") |
| 199 | return out |
| 200 | |
| 201 | def crate_for_example(self, example: str) -> Crate: |
| 202 | """Find the crate containing the named example. |
no test coverage detected