def reserve_room_owned

bend-collections@1.0.0.0 · src/containers/dynamic_array.bend:632

import bend-collections@1.0.0.0/src/containers/dynamic_array.bend as DynamicArray
import Base
import bend-collections@1.0.0.0/src/containers/types/dynamic_array.bend as E

632def reserve_room_owned(~T: Type, +limit: Nat, +depth: Nat, cap: Nat, len: Nat, arr: Array<Maybe<&1, T>>, +n: Nat, feasible: Bool) -> DynArray<&1, T> & Result<&2, &2, E.Error, Unit>:
633  match feasible:
634    case False{}:
635      (DA{limit, depth, cap, len, arr}, Fail{E.CapacityExceeded{}})
636    case True{}:
637      (grow_until_owned(~T, Nat.sub(limit, depth), n, DA{limit, depth, cap, len, arr}), Done{Unit{}})

Uses (12)

Used by (1)