[][src]Enum show_notes::e021::EmailEnum

pub enum EmailEnum {

A "newtype" built by wrapping a String in a single-variant enum.

It's simple to use to create a wrapped variant, and then because it is a single-variant enum, we can also destructure it:

let email = EmailEnum::Address("[email protected]".into());
let EmailEnum::Address(just_the_string) = email;

Note, however, that it is much more verbose.



Methods from Deref<Target = String>

pub fn as_str(&self) -> &str1.7.0[src]

Extracts a string slice containing the entire String.


Basic usage:

let s = String::from("foo");

assert_eq!("foo", s.as_str());

pub fn capacity(&self) -> usize1.0.0[src]

Returns this String's capacity, in bytes.


Basic usage:

let s = String::with_capacity(10);

assert!(s.capacity() >= 10);

pub fn as_bytes(&self) -> &[u8]1.0.0[src]

Returns a byte slice of this String's contents.

The inverse of this method is from_utf8.


Basic usage:

let s = String::from("hello");

assert_eq!(&[104, 101, 108, 108, 111], s.as_bytes());

pub fn len(&self) -> usize1.0.0[src]

Returns the length of this String, in bytes.


Basic usage:

let a = String::from("foo");

assert_eq!(a.len(), 3);

pub fn is_empty(&self) -> bool1.0.0[src]

Returns true if this String has a length of zero, and false otherwise.


Basic usage:

let mut v = String::new();


Trait Implementations

impl Deref for EmailEnum[src]

type Target = String

The resulting type after dereferencing.

Auto Trait Implementations

impl Send for EmailEnum

impl Unpin for EmailEnum

impl Sync for EmailEnum

impl RefUnwindSafe for EmailEnum

impl UnwindSafe for EmailEnum

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized