Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nelson committed Dec 3, 2024
1 parent 06b19ee commit c178ce7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions native/wasmex/src/component_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn term_to_val(param_term: &Term, param_type: &Type) -> Result<Val, Error> {
let decoded_map = param_term.decode::<HashMap<Term, Term>>()?;
let terms = decoded_map
.iter()
.map(|(key_term, val)| (key_from_term(key_term), val))
.map(|(key_term, val)| (term_to_field_name(key_term), val))
.collect::<Vec<(String, &Term)>>();
for field in record.fields() {
let field_term_option = terms.iter().find(|(k, _)| k == field.name);
Expand Down Expand Up @@ -148,7 +148,7 @@ fn term_to_val(param_term: &Term, param_type: &Type) -> Result<Val, Error> {
}
}

fn key_from_term(key_term: &Term) -> String {
fn term_to_field_name(key_term: &Term) -> String {
match key_term.get_type() {
TermType::Atom => key_term.atom_to_string().unwrap(),
_ => key_term.decode::<String>().unwrap(),
Expand Down

0 comments on commit c178ce7

Please sign in to comment.