import { Result, type ConstEnum } from "./enum" import { type Entry } from "./main" type WrapResultEntry = WrapResult type WrapBSearch = WrapResult type WrapResultNone = WrapResult interface WrapResult { /** The resulting value if `U` is a success */ readonly result: T, /** Represents some arbitrary extra value, usually a success status */ readonly some: U } function wrap(result: T, some: U): WrapResult { return { result: result, some: some } } function wrap_bsearch(index: number, result: T): WrapBSearch { return wrap(result, index) } function wrap_entry(status: T, result?: U): WrapResultEntry { return wrap(result, status) } function wrap_none(status: T): WrapResultNone { return wrap(Result.None, status) } export default wrap export { wrap_bsearch, wrap_entry, wrap_none, type WrapResultEntry, type WrapResultNone, type WrapBSearch, type WrapResult, }