Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Issue was that VSCodes Intellisense does not recognize e.g. .vertex_count() if you use it directly on e.g.
SwEnsemble.vertex_count()
but only shows the function if you use it like thisSwEnsemble.graph().vertex_count()
, although both work and give the same output.So I think the issue is, that when you use
SwEnsemble.vertex_count()
it uses the function fromnet_ensemble\traits\graph_trait -> trait MeasurableGraphQuantities
. And in the end of thegraph_trait
file those Quantities gets implemented for all Ensembles like thisimpl<T, A, E> MeasurableGraphQuantities<GenericGraph<T, A>> for E
But it does not get directly implemented for SwEnsemble, but only on a "passive" way for all
E
. So the only solution is to implementMeasurableGraphQuantities
in thenet_ensemble\sw.rs
file and for SwEnsemble directly. Then VSCode can look first for all the implemented traits onSwEnsemble
insw.rs
and finds the.vertex_count
defintion.I did this implementation for all the Ensembles. You do not have to merge this, but I wanted to show you my results when I dug into the code.
Maybe it is a good way to impl it directly in these files so everyone can see that SwEnsemble has these methods. But on the otherhand it is duplicated code because we get the same result with a
.graph().vertex_count()
call already and both function calls lead to the exact same underlying structure. The.graph().vertex_count()
call refers to the GenericGraph struct and that struct already implements all the functions thetrait MeasurableGraphQuantities
does too.Just wanted to share this :D
Here some code to try the IntelliSense out.