Trait Stringify

Source
pub trait Stringify {
    // Required method
    fn to_bytes(&self) -> Vec<u8> ;

    // Provided method
    fn stringify(&self) -> String { ... }
}
Expand description

A specializable version of std::string::ToString.

Required Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Returns the string representation of the give value as a byte vector.

§Example
use json_api::value::Stringify;
assert_eq!(25.to_bytes(), vec![50, 53]);

Provided Methods§

Source

fn stringify(&self) -> String

Returns the string representation of the given value.

§Example
use json_api::value::Stringify;
assert_eq!(25.stringify(), "25");

Implementations on Foreign Types§

Source§

impl Stringify for f32

Source§

impl Stringify for f64

Source§

impl Stringify for i8

Source§

impl Stringify for i16

Source§

impl Stringify for i32

Source§

impl Stringify for i64

Source§

impl Stringify for str

Source§

impl Stringify for u8

Source§

impl Stringify for u16

Source§

impl Stringify for u32

Source§

impl Stringify for u64

Source§

impl Stringify for String

Source§

impl<'a> Stringify for Cow<'a, str>

Implementors§