fn new(bytes: B) -> Result<Self, std::str::Utf8Error> {
        // NB: map doesn't work here because of lifetimes.
        match std::str::from_utf8(bytes.as_ref()) {
            Ok(_) => Ok(Self(bytes)),
            Err(e) => Err(e),
        }
    }
/// Attempts to create a new `ValidStr` that wraps all the contents of
/// `bytes`.
Attempts to create a new `ValidStr` that wraps all the contents of
`bytes`.
Attempts to create a new ` ValidStr ` that wraps all the contents of ` bytes ` .
fn new(bytes: B) -> Result<Self, std::str::Utf8Error> {
        // NB: map doesn't work here because of lifetimes.
        match std::str::from_utf8(bytes.as_ref()) {
            Ok(_) => Ok(Self(bytes)),
            Err(e) => Err(e),
        }
    }
fn new ( bytes : B ) -> Result < Self , std :: str :: Utf8Error > { // NB: map doesn't work here because of lifetimes. match std :: str :: from_utf8 ( bytes . as_ref ( ) ) { Ok ( _ ) => Ok ( Self ( bytes ) ) , Err ( e ) => Err ( e ) , } }
Attempts to create a new `ValidStr` that wraps all the contents of
`bytes`.
Attempts to create a new ` ValidStr ` that wraps all the contents of ` bytes ` .
bytes
B
bytes
B