code: function (trail, options) {
    this.trail = trail;
    this.options = options || {};
  
    this.cursor = lib.tdb_cursor_new(this.trail.tdb._db);
    /*\
    |*| Filter logic
    \*/
    if (typeof this.options.filter != 'undefined') {
      const err = lib.tdb_cursor_set_event_filter(this.cursor, this.options.filter);
      if (err) {
        throw new TrailDBError('Unable to set event filter: ' + this.trail.id);
      }
    }
    const r = lib.tdb_get_trail(this.cursor, this.trail.id);
    if (r) {
      throw new TrailDBError('Failed to open trail cursor: ' + this.trail.id);
    }
    return this;
  }
docs: Initialize a new EventsIterator. Iterate over all events in a trail..
  @param {TrailDB} tdb - TrailDB object.
  @param {Boolean,Object}
  options.toMap - Whether the iterator should return a map for each event,
  grabbing the appropriate key names. Defaults to a list with
  just values.
  options.filter - T_TDB_FILTER event filter struct (optional)
  @return {EventsIterator} iterator.