Trait attribute_derive::ConvertParsed
source · [−]pub trait ConvertParsed where
Self: Sized,
Self::Type: Error, {
type Type;
fn convert(value: Self::Type) -> Result<Self>;
fn default_by_default() -> bool { ... }
fn default() -> Self { ... }
fn as_flag() -> Option<Self::Type> { ... }
}
Expand description
Helper trait to convert syn types implementing Parse
like LitStr
to rust
types like String
You probably don’t need to implement this trait, as most syn types like LitStr
and Type
or that have a direct equivalent in those like String
, char
or f32
are
already implemented. A special treatment have Vecs
which are parsed
using the helper Array
with the syntax [a, b, c]
and Options
that will be
None
if not specified and Some
when the value is specified via the attribute. It is not
specified via Some(value)
but as just value
.
Associated Types
Required methods
Provided methods
fn default_by_default() -> bool
fn default_by_default() -> bool
Should values of this type return their default when they are not specified even when the
default
flag is not specified (only returns true
for Option
currently)
The default value, this is necessary to implement the implicit default behavior of
Option