element to get
returned buffer
length of buffer
ErrorCode
auto sub_hibon = new HiBON; sub_hibon["i32"] = "hello"; auto sub_doc = Document(sub_hibon); string key_doc = "doc"; auto h = new HiBON; h[key_doc] = sub_doc; const doc = Document(h); Document.Element elm_doc; int rt = tagion_document_element_by_key(&doc.data[0], doc.data.length, &key_doc[0], key_doc.length, &elm_doc); assert(rt == ErrorCode.none, "Get document element string returned error"); uint8_t* buf; size_t buf_len; rt = tagion_document_get_document(&elm_doc, &buf, &buf_len); assert(rt == ErrorCode.none, "Get subdoc returned error"); auto read_data = cast(immutable) buf[0..buf_len]; assert(sub_doc == Document(read_data), "read doc was not the same");
Get an sub doc from a document