Unable to specify a type has to be const #6897
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
I mainly run into this when using a function to create a struct. A simple example would be a custom slice (currently my case is for a 2d view on memory).
Sometimes I want to have a slice which can be used to edit the data that it points to, sometimes I want it to point to read only data, which shouldn't/can't be modified. I would like to be able to do something like:
but the read_only line will fail to compile. I don't see any way to get a
const
type currently.The text was updated successfully, but these errors were encountered: