3 ms·
println() is not Iron request handler, you gave wrong example. Signature matters. I don't see how you can declare field if structure to have default value 6553
by EugeneOZ 11y ago
println() is not Iron request handler, you gave wrong example. Signature matters.
I don't see how you can declare field if structure to have default value 65535, even with Default trait.
I posted opinion not to argue and really frustrating to see downvotes for opinion. Make discussion more constructive.
- masklinn 11y ago> println() is not Iron request handler, you gave wrong example. Signature matters. println is not relevant here it only shows the result of the call, the point is that you can use a method as a function, I expect the issue is elsewhere (but not having used Iron, I wouldn't know where). > I don't see how you can declare field if structure to have default value 65535, even with Default trait. Implement Default then call it when instantiating struct: http://is.gd/2YSoKd http://is.gd/2YSoKd > I posted opinion not to argue and really frustrating to see downvotes for opinion. Make discussion more constructive. Er… I didn't downvote you? I just replied to some of your objections which I assume is what you expected?
- EugeneOZ 11y ago> the point is that you can use a method as a function And still: no. When signature is declared strictly (and in reality it's all cases except println and format), you can pass only function with matching signature. self/&self changes signature.
- EugeneOZ 11y ago> Implement Default then call it It's far from "default values in struct declaration". I mean this: struct X { i:u32 = 5, j:u64 }