BCowConvert

Trait BCowConvert 

Source
pub trait BCowConvert<'a> {
    // Required method
    fn convert(self) -> Cow<'a, [u8]>;
}
Expand description

Trait for macros to convert owned/borrowed types to Cow.

This is needed because &str and String do not have From implements into Cow<_, [u8]>. One solution is to just call AsRef<[u8]> before converting. However, then when a user specifies an owned type, we will implicitly borrow that; this trait prevents that so that macro behavior is intuitive, so that owned types stay owned.

Required Methods§

Source

fn convert(self) -> Cow<'a, [u8]>

Implementations on Foreign Types§

Source§

impl BCowConvert<'static> for String

Source§

fn convert(self) -> Cow<'static, [u8]>

Source§

impl BCowConvert<'static> for Vec<u8>

Source§

fn convert(self) -> Cow<'static, [u8]>

Source§

impl<'a> BCowConvert<'a> for &'a str

Source§

fn convert(self) -> Cow<'a, [u8]>

Source§

impl<'a> BCowConvert<'a> for &'a [u8]

Source§

fn convert(self) -> Cow<'a, [u8]>

Implementors§