Trait StrIO

Source
pub trait StrIO {
    // Required methods
    fn to_str(&self) -> String;
    fn from_str(s: &str) -> Self;
}
Expand description

将数据从原来的形式与字符串形式之间进行转换

对基础的数字类型、String进行了实现

对于其他自定义类型,需要手动实现该trait

Required Methods§

Source

fn to_str(&self) -> String

Source

fn from_str(s: &str) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl StrIO for f32

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for f64

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for i8

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for i16

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for i32

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for i64

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for i128

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for isize

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for u8

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for u16

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for u32

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for u64

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for u128

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for usize

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Source§

impl StrIO for String

Source§

fn to_str(&self) -> String

Source§

fn from_str(s: &str) -> Self

Implementors§