INNER CODE UNIT · Rust
toml_key
killercup/cargo-edit · src/dependency.rs:288
pub fn toml_key(&self) -> &str {
self.rename().unwrap_or(&self.name)
}
/// Convert dependency to TOML
///
/// Returns a tuple with the dependency's name and either the version as a `String`
/// or the path/git repository as an `InlineTable`.
/// (If the dependency is set as `optional` or `default-features` is set to `false`,
/// an `InlineTable` is returned in any case.)
///
/// # Panic
///
/// Panics if the path is relative
pub fn to_toml(&self, crate_root: &Path) -> toml_edit::Item {
assert!(
crate_root.is_absolute(),
"Absolute path needed, got: {}",