mirror of
https://github.com/Noratrieb/terustform.git
synced 2026-01-15 00:45:11 +01:00
start parsing values correctly
This commit is contained in:
parent
a7822229f3
commit
43747f9cda
5 changed files with 31 additions and 25 deletions
|
|
@ -61,17 +61,20 @@ impl DataSource for ExampleDataSource {
|
|||
}
|
||||
|
||||
fn read(&self, config: Value) -> DResult<Value> {
|
||||
let name = match config {
|
||||
Value::Known(ValueKind::Object(mut obj)) => obj.remove("name").unwrap(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let name_str = match &name {
|
||||
Value::Known(ValueKind::String(s)) => s.clone(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
Ok(Value::Known(ValueKind::Object(BTreeMap::from([
|
||||
(
|
||||
"name".to_owned(),
|
||||
match config {
|
||||
Value::Known(ValueKind::Object(mut obj)) => obj.remove("name").unwrap(),
|
||||
_ => unreachable!(),
|
||||
},
|
||||
),
|
||||
("name".to_owned(), name),
|
||||
(
|
||||
"meow".to_owned(),
|
||||
Value::Known(ValueKind::String("mrrrrr".to_owned())),
|
||||
Value::Known(ValueKind::String(format!("mrrrrr i am {name_str}"))),
|
||||
),
|
||||
(
|
||||
"id".to_owned(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue