Function mentat_db::internal_types::replace_lookup_ref [] [src]

pub fn replace_lookup_ref<T, U>(
    lookup_map: &AVMap,
    desired_or: Either<T, LookupRefOrTempId>,
    lift: U
) -> Result<Either<T, TempIdHandle>> where
    U: FnOnce(Entid) -> T, 

Given a KnownEntidOr or a TypedValueOr, replace any internal LookupRef with the entid from the given map. Fail if any LookupRef cannot be replaced.

lift allows to specify how the entid found is mapped into the output type. (This could also be an Into or From requirement.)

The reason for this awkward expression is that we're parameterizing over the type constructor (EntidOr or TypedValueOr), which is not trivial to express in Rust. This only works because they're both the same Result<...> type with different parameterizations.