Adds a way to verify/exposes Entities ids (#7221)

This commit is contained in:
mustiikhalil
2022-04-06 22:54:01 +02:00
committed by GitHub
parent 832c618f5f
commit 2049e52101
9 changed files with 98 additions and 14 deletions

View File

@@ -200,4 +200,14 @@ public struct Verifier {
internal mutating func finish() {
_depth -= 1
}
mutating func verify(id: String) throws {
let size = MemoryLayout<Int32>.size
let str = _buffer.readString(at: size, count: size)
if id == str {
return
}
throw FlatbuffersErrors.bufferIdDidntMatchPassedId
}
}