text2ion

Convert an Ion Text value to a Ion Value Stream.

This function is the @nogc version of text2ion.

  1. immutable(ubyte)[] text2ion(const(char)[] text)
  2. void text2ion(const(char)[] text, Appender appender)
    @trusted
    void
    text2ion
    (
    Appender
    )
    (
    scope const(char)[] text
    ,
    scope ref Appender appender
    )

Parameters

text const(char)[]

The text to convert

appender Appender

A buffer that will receive the Ion binary data

Examples

import mir.appender : scopedBuffer;
static immutable data = [0xe0, 0x01, 0x00, 0xea, 0xe9, 0x81, 0x83, 0xd6, 0x87, 0xb4, 0x81, 0x61, 0x81, 0x62, 0xd6, 0x8a, 0x21, 0x01, 0x8b, 0x21, 0x02];
auto buf = scopedBuffer!ubyte;
text2ion("{\n\ta: 1,\n\tb: 2\n}", buf);
assert(buf.data == data);

Meta