From 12bfe806b72fabce145b545559d37f2bb3483739 Mon Sep 17 00:00:00 2001 From: Andrey Penechko Date: Mon, 13 Oct 2014 14:15:37 +0300 Subject: [PATCH] Update docs. --- cbor.d | 7 ++++++- dub.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cbor.d b/cbor.d index 5eff28d..19c0fa9 100644 --- a/cbor.d +++ b/cbor.d @@ -844,6 +844,7 @@ size_t encodeCborAggregate(Flag!"WithFieldName" withFieldName, R, A)(auto ref R /// Decodes single value and returns it as CborValue tagged union type. /// Throws CborException if data is not well-formed. /// Note, that ubyte[] and string types are slices of input range if ubyte[] was provided. +/// Will modify input range, popping all the bytes of the first item. CborValue decodeCbor(R)(auto ref R input) if(isInputRange!R && is(ElementType!R == ubyte)) { @@ -976,6 +977,7 @@ CborValue decodeCbor(R)(auto ref R input) /// Decodes single cbor value and tries to convert it to requested type. /// If types doesn't match CborException is thrown. /// Note, that ubyte[] and string types are slices of input range if ubyte[] was provided. +/// Will modify input range, popping all the elements of T. T decodeCborSingle(T, R)(auto ref R input) if(isInputRange!R && is(ElementType!R == ubyte)) { @@ -986,6 +988,7 @@ T decodeCborSingle(T, R)(auto ref R input) /// Decodes single cbor value and tries to convert it to requested type. /// If types doesn't match CborException is thrown. /// Note, that this version will dup all arrays for you. +/// Will modify input range, popping all the elements of T. T decodeCborSingleDup(T, R)(auto ref R input) if(isInputRange!R && is(ElementType!R == ubyte)) { @@ -1596,7 +1599,9 @@ unittest // decoding exact testClass.inner = null; size = encodeCborArray(buf1[], testClass); - Test2 resultClass = decodeCborSingle!Test2(buf1[0..size]); + ubyte[] encodedBuf = buf1[0..size]; + Test2 resultClass = decodeCborSingle!Test2(encodedBuf); + assert(encodedBuf.length == 0); foreach(i, m; resultClass.tupleof) assert(testClass.tupleof[i] == m); diff --git a/dub.json b/dub.json index 943c102..87dcd2d 100644 --- a/dub.json +++ b/dub.json @@ -6,7 +6,7 @@ "importPaths" : [ "./" ], "sourceFiles": ["cbor.d"], - + "buildRequirements" : ["disallowDeprecations"], "license": "BSL-1.0", "targetType" : "library"