pub trait AttrValue:
Named
+ Sized
+ Serialize
+ DeserializeOwned
+ Send
+ Sync
+ Clone
+ 'static {
// Required methods
fn display(&self) -> String;
fn parse(value: &str) -> Result<Self, Error>;
}Expand description
This trait must be implemented by all attribute values. In addition to enforcing
the supertrait Named + Sized + Serialize + DeserializeOwned + Send + Sync + Clone,
AttrValue requires that the type be representable in “display” format.
AttrValue includes its own display and parse so that behavior can be tailored
for attribute purposes specifically, allowing common types like Duration to be used
without modification.
This crate includes a derive macro for AttrValue, which uses the type’s
std::string::ToString for display, and std::str::FromStr for parsing.
Required Methods§
Sourcefn display(&self) -> String
fn display(&self) -> String
Display the value, typically using std::fmt::Display.
This is called to show the output in human-readable form.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.