2 ms·
Rust has no notion of purity. This would require something like an effect system. const functions can't directly do any IO or even allocation - at the moment.
by the_duke 6y ago
Rust has no notion of purity. This would require something like an effect system.
const functions can't directly do any IO or even allocation - at the moment.
But this can be easily circumvented, eg by using a proc macro that does IO.
Sidenote: even in Haskell the function signature doesn't guarantee purity, due to unsafePerformIO.