Derive Macro enumscribe::TryScribeString
source · #[derive(TryScribeString)]
{
// Attributes available to this derive:
#[enumscribe]
}
Expand description
Derives enumscribe::TryScribeString
for an enum. This allows the enum to be converted to
a Option<String>
using the try_scribe()
method.
This behaves almost identically to TryScribeCowStr
, except the
return type is Option<String>
instead of Option<Cow<'static, str>>
.
Since a String
is returned, an allocation must always be performed, which is wasteful.
TryScribeCowStr
should be preferred because it avoids
unnecessary allocations.