Function show_notes::e021::takes_a_str

source ยท
pub fn takes_a_str(_some_str: &str)
Expand description

A function which takes a string, to use with Deref and EmailStruct.

E.g. you can do this:

let email_struct = EmailStruct("hello@newrustacean.com".into());
takes_a_str(&email_struct);

And likewise, with the enum variant:

let email_enum = EmailEnum::Address("hello@newrustacean.com".into());
takes_a_str(&email_enum)

Note, however, that the Deref implementation is much more complicated for the enum variant, as everything is in general.