You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0282]: type annotations needed
--> data\src\update.rs:153:47
|
153 | ... if node.node_type.into() == NodeTypeDiscriminants::Control {
| ^^^^
|
help: try using a fully qualified path to specify the expected types
|
153 | if <NodeType as Into<T>>::into(node.node_type) == NodeTypeDiscriminants::Control {
| ++++++++++++++++++++++++++++ ~
For more information about this error, try `rustc --explain E0282`.
So, why not make an helper function, like node_type.to_discriminant() ?
This will be a little more descriptive than into(), and will provide a similar alternative to into() in case of compiler problems.
The text was updated successfully, but these errors were encountered:
Hey @wiiznokes, naming things is hard so I try to avoid inherent methods on types. There's an infinite number of valid/useful names, I try to use the built-in traits from the standard library and then allow people to add their own inherent methods on top of it if they want to. It's not ideal, but it's the best compromise I can find between flexibility and causing a combinatorial explosion in the api surface of this crate.
I don't understand why I can't convert my enum into a discriminant. Here is the code:
So, why not make an helper function, like
node_type.to_discriminant()
?This will be a little more descriptive than
into()
, and will provide a similar alternative tointo()
in case of compiler problems.The text was updated successfully, but these errors were encountered: