ndb: add subscript and count for TagsSequence

These are helpful
This commit is contained in:
William Casarin
2023-07-22 16:58:17 -07:00
parent 1854e10486
commit c72666b352
2 changed files with 23 additions and 0 deletions

View File

@@ -40,6 +40,14 @@ struct TagIterator: IteratorProtocol {
return el
}
subscript(index: Int) -> NdbTagElem? {
if index >= tag.pointee.count {
return nil
}
return NdbTagElem(note: note, tag: tag, index: Int32(index))
}
var index: Int32
let note: NdbNote
var tag: UnsafeMutablePointer<ndb_tag>