Trait FromCStr

Source
pub trait FromCStr {
    type Err: Sized;

    // Required method
    fn from_cstr(s: &CStr) -> Result<Self, Self::Err>
       where Self: Sized;
}
Expand description

Conversion from a C-style string

This trait should be used the same way as std::str::FromStr, although a separate .parse() implementation is not provided &str

Required Associated Types§

Source

type Err: Sized

The error type returned if parsing fails.

If using the derive macro, this will be &'static str.

Required Methods§

Source

fn from_cstr(s: &CStr) -> Result<Self, Self::Err>
where Self: Sized,

Parse the &CStr for an instance of Self.

If using the derive macro, this will be a match statement over &'static [u8].

Implementors§