There are new_unchecked
functions in that expect some form of invariant to be upheld by the caller. I think it is a good idea to mark them as unsafe to make it explicit at the call site (see: *_unchecked in std).
Example
Currently the following code is not marked as unsafe and results in undefined behavior:
let dir = h3o::direction::Direction::new_unchecked(7);
Locations
BaseCell, CellIndex, Direction, DirectedEdgeIndex, Face, LatLng, LocalIJ, Resolution, Vertex and VertexIndex
See locations
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/base_cell.rs#L27-L30
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/index/cell.rs#L1228-L1231
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/direction.rs#L111-L115
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/index/edge.rs#L39-L42
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/face.rs#L24-L27
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/coord/latlng.rs#L367-L371
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/coord/localij.rs#L254-L258
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/resolution.rs#L333-L337
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/index/vertex.rs#L43-L46
https://github.com/HydroniumLabs/h3o/blob/129e80b1b33e4c3847a1a5dd65dadad11e00803f/src/index/vertex.rs#L185-L190