34 lines
956 B
Rust
34 lines
956 B
Rust
pub mod reader;
|
|
pub mod writer;
|
|
|
|
pub use reader::TextReader;
|
|
pub use writer::TextWriter;
|
|
|
|
use crate::value::source::BytesBinarySource;
|
|
|
|
use std::io;
|
|
|
|
use super::{IOValue, IOValueDomainCodec, NestedValue, Reader, DomainDecode};
|
|
|
|
pub fn from_str<'de, N: NestedValue, Dec: DomainDecode<N::Embedded>>(
|
|
s: &'de str,
|
|
decode_embedded: &mut Dec,
|
|
) -> io::Result<N> {
|
|
TextReader::new(&mut BytesBinarySource::new(s.as_bytes())).demand_next_domain(false, decode_embedded)
|
|
}
|
|
|
|
pub fn iovalue_from_str(s: &str) -> io::Result<IOValue> {
|
|
from_str(s, &mut IOValueDomainCodec)
|
|
}
|
|
|
|
pub fn annotated_from_str<'de, N: NestedValue, Dec: DomainDecode<N::Embedded>>(
|
|
s: &'de str,
|
|
decode_embedded: &mut Dec,
|
|
) -> io::Result<N> {
|
|
TextReader::new(&mut BytesBinarySource::new(s.as_bytes())).demand_next_domain(true, decode_embedded)
|
|
}
|
|
|
|
pub fn annotated_iovalue_from_str(s: &str) -> io::Result<IOValue> {
|
|
annotated_from_str(s, &mut IOValueDomainCodec)
|
|
}
|