async_pop/response/types/mod.rs
1pub mod message;
2pub mod number;
3
4use std::{borrow::Cow, fmt::Display};
5
6use crate::error::Result;
7
8pub trait DataType<T>: Display + TryInto<T> {
9 /// Get the actual value that the inner byte slice is representing.
10 fn value(&self) -> Result<T>;
11
12 /// Get the value as a raw string, before actual parsing.
13 fn as_str(&self) -> Result<&str>;
14 /// Get the value as a raw string in lossless fashion, before actual parsing.
15 fn as_str_lossy(&self) -> Cow<'_, str>;
16
17 /// The raw slice that represents the data.
18 fn raw(&self) -> &[u8];
19}