Range interface for std.serialization

Jacob Carlborg doob at me.com
Thu Aug 22 09:03:56 PDT 2013


On 2013-08-22 16:16, Tyler Jameson Little wrote:

> Right, but it doesn't need to keep the serialized data in memory.

No, exactly.

> Can't you just keep a counter? When you enter anything that would
> increase the indentation level, increment the indentation level. When
> leaving, decrement. At each level, insert whitespace equal to
> indentationLevel * whitespacePerLevel. This seems pretty trivial, unless
> I'm missing something.

That sounds like it will require quite some work. Currently I'm using 
std.xml.Document.toString.

> Also, I didn't check, but it turns off pretty-printing be default, right?

No, not currently, see above.

> How about passing it in with a function? Each range passed this way
> would represent a single object, so the current
> deserialize!Foo(InputRange) would work the same way it does now.

The archive needs to store it somehow, so pass it in the constructor?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list