Yield Strings from TextWriter::encode*
This commit is contained in:
parent
87946abb63
commit
661d96780d
|
@ -37,13 +37,13 @@ impl TextWriter<&mut Vec<u8>> {
|
|||
pub fn encode<D: Embeddable, N: NestedValue<D>, Enc: DomainEncode<D>>(
|
||||
enc: &mut Enc,
|
||||
v: &N,
|
||||
) -> io::Result<Vec<u8>> {
|
||||
) -> io::Result<String> {
|
||||
let mut buf: Vec<u8> = Vec::new();
|
||||
TextWriter::new(&mut buf).write(enc, v)?;
|
||||
Ok(buf)
|
||||
Ok(String::from_utf8(buf).expect("valid UTF-8 from TextWriter"))
|
||||
}
|
||||
|
||||
pub fn encode_iovalue(v: &IOValue) -> io::Result<Vec<u8>> {
|
||||
pub fn encode_iovalue(v: &IOValue) -> io::Result<String> {
|
||||
Self::encode(&mut IOValueDomainCodec, v)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue