Right now, the only option for censoring is to replace every char with a single given char. There is plenty of room for expansion there. Right now, CensorMode is an enum allowing for further fields to allow more methods of customizing.
However, it may work better to define a Censor trait instead, and let users define the censor functionality themselves. A default Censor implementation could be provided as well, for users who still want to censor by replacing characters.
Right now, the only option for censoring is to replace every
char
with a single givenchar
. There is plenty of room for expansion there. Right now,CensorMode
is an enum allowing for further fields to allow more methods of customizing.However, it may work better to define a
Censor
trait instead, and let users define the censor functionality themselves. A defaultCensor
implementation could be provided as well, for users who still want to censor by replacing characters.Definition could be something like:
An alternative to a trait could be passing a closure. This could be preferable, since a struct wouldn't likely hold any state anyway.