Trait ParseOptional

Source
pub trait ParseOptional: AsRef<str> {
    // Provided method
    fn parse_optional<T: FromStr>(&self) -> Result<Option<T>, T::Err> { ... }
}
Expand description

Extension traits for optionally parsing non-empty strings.

This is a common pattern in Cosmos SDK protobufs.

Provided Methods§

Source

fn parse_optional<T: FromStr>(&self) -> Result<Option<T>, T::Err>

Parse optional field.

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.

Implementations on Foreign Types§

Source§

impl ParseOptional for str

Source§

impl ParseOptional for String

Implementors§