             (->Match data (assoc params param path)))))
       (get-segment [this]
         segment)
+      (set-data [this data]
+        (wild-node segment param children data))
       (add-child [this key child]
         (wild-node segment param (assoc children key child) data))
       (insert-child [this key path-spec o]

  old contents of node and the new item as children.
  lcs is the index of the longest common string in path-spec and the
  segment of node."
  [node path-spec o lcs]
  (let [segment (get-segment node)
        common (subs path-spec 0 lcs)
        parent (new-node common nil)]
    (if (= common path-spec)
      (-> parent
          (add-child (char-key segment lcs) (update-segment node subs lcs)))
      (-> parent
          (add-child (char-key segment lcs) (update-segment node subs lcs))
          (insert-child (char-key path-spec lcs) (subs path-spec lcs) o)))))

(defn insert
  "Given a tree node, a path-spec and a payload object, return a new
  tree with payload inserted."
  [node path-spec o]
  (let [segment (get-segment node)]
    (cond (nil? node)
          (new-node path-spec o)

          (= segment path-spec)
          node

          ;; handle case where path-spec is a wildcard param
          (wild-param? path-spec)

  ;; 1.3ms (reified protocols)
  ;; 0.8ms (flattened matching)
  ;; 0.8ms (return route-data)
  ;; 0.8ms (fix payloads)
  (cc/quick-bench (dotimes [_ 1000] (lookup tree-new "/v1/orgs/1/topics" {}))))
