Conveniences for TextReader matching those existing for PackedReader

This commit is contained in:
Tony Garnock-Jones 2021-08-04 15:41:23 +02:00
parent d28901446d
commit 3078396487
1 changed files with 16 additions and 1 deletions

View File

@ -4,14 +4,16 @@ use std::borrow::Cow;
use std::io;
use std::marker::PhantomData;
use super::CompoundClass;
use super::DomainDecode;
use super::DomainParse;
use super::Double;
use super::Embeddable;
use super::Float;
use super::IOValue;
use super::IOValueDomainCodec;
use super::NestedValue;
use super::CompoundClass;
use super::ViaCodec;
use super::boundary as B;
use super::signed_integer::SignedInteger;
@ -243,6 +245,19 @@ pub trait BinarySource<'de>: Sized {
{
self.packed(IOValueDomainCodec)
}
fn text<D: Embeddable, N: NestedValue<D>, Dec: DomainParse<D>>(
&mut self,
decode_embedded: Dec,
) -> super::TextReader<'de, '_, D, Dec, Self> {
super::TextReader::new(self, decode_embedded)
}
fn text_iovalues(&mut self) ->
super::TextReader<'de, '_, IOValue, ViaCodec<IOValueDomainCodec>, Self>
{
self.text::<_, IOValue, _>(ViaCodec::new(IOValueDomainCodec))
}
}
pub struct IOBinarySource<'a, R: io::Read + io::Seek> {