[WIP] Add r_set_cardinality()

This will add `r_set_cardinality` functionality with tests for each layer.
We already discussed that this is not advisable and might even result in crashes.
Keep the `if`.