Skip to content

Commit 2f8ac11

Browse files
committed
Code review feedback.
1 parent a059231 commit 2f8ac11

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

crates/wac-graph/src/graph.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,11 @@ impl CompositionGraph {
871871
///
872872
/// If an edge already exists between the argument and the instantiation node, this method
873873
/// returns `Ok(_)`.
874-
pub fn connect_argument(
874+
pub fn set_instantiation_argument(
875875
&mut self,
876-
argument: NodeId,
877876
instantiation: NodeId,
878877
argument_name: &str,
878+
argument: NodeId,
879879
) -> GraphResult<()> {
880880
fn add_edge(
881881
graph: &mut CompositionGraph,
@@ -1007,11 +1007,11 @@ impl CompositionGraph {
10071007
///
10081008
/// If the argument is not connected to the instantiation node, then this
10091009
/// function will be a no-op.
1010-
pub fn disconnect_argument(
1010+
pub fn unset_instantiation_argument(
10111011
&mut self,
1012-
argument: NodeId,
10131012
instantiation: NodeId,
10141013
argument_name: &str,
1014+
argument: NodeId,
10151015
) -> GraphResult<()> {
10161016
// Ensure the target is an instantiation node
10171017
let instantiation_data = self

crates/wac-graph/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
//! // Instantiate package `my:package2`
2828
//! let instantiation2 = graph.instantiate(package2)?;
2929
//!
30-
//! // Connect `a` to the argument `b` of the instantiation
31-
//! graph.connect_argument(a, instantiation2, "b")?;
30+
//! // Set argument `b` of the instantiation of `my:package2` to `a`
31+
//! graph.set_instantiation_argument(instantiation2, "b", a)?;
3232
//!
3333
//! // Finally, encode the graph into a new component
3434
//! let bytes = graph.encode(EncodeOptions::default())?;

crates/wac-graph/tests/encoding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl GraphFile {
209209
format!("invalid target node index {target} referenced in argument {index} for test case `{test_case}`", target = argument.target)
210210
}).copied()?;
211211

212-
graph.connect_argument(source, target, &argument.name).with_context(|| {
212+
graph.set_instantiation_argument(target, &argument.name, source).with_context(|| {
213213
format!("failed to add argument edge from source node {source} to target node {target} referenced in argument {index} for test case `{test_case}`", source = argument.source, target = argument.target)
214214
})?;
215215
}

crates/wac-types/src/core.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use std::fmt;
2-
31
use indexmap::IndexMap;
2+
use std::fmt;
43

54
/// Represents a core module type.
65
#[derive(Debug, Clone, Default)]

0 commit comments

Comments
 (0)