in tools/hakari/src/cli_ops/workspace_ops.rs [216:267]
fn get_workspace_members_array<'doc>(
root_toml_path: &Utf8Path,
doc: &'doc mut Document,
) -> Result<&'doc mut Array, ApplyError> {
let doc_table = doc.as_table_mut();
let workspace_table = match doc_table.get_mut("workspace") {
Some(Item::Table(workspace_table)) => workspace_table,
Some(other) => {
return Err(ApplyError::misc(
format!(
"expected [workspace] to be a table, found {}",
other.type_name()
),
root_toml_path,
))
}
None => {
return Err(ApplyError::misc(
"[workspace] section not found",
root_toml_path,
))
}
};
let members = match workspace_table.get_mut("members") {
Some(Item::Value(ref mut members)) => match members.as_array_mut() {
Some(members) => members,
None => {
return Err(ApplyError::misc(
"workspace.members is not an array",
root_toml_path,
))
}
},
Some(other) => {
return Err(ApplyError::misc(
format!(
"expected workspace.members to be an array, found {}",
other.type_name()
),
root_toml_path,
))
}
None => {
return Err(ApplyError::misc(
"workspace.members not found",
root_toml_path,
))
}
};
Ok(members)
}