public static void TryAddAndThrowOnFail <TKey, TValue>(this NativeHashMap <TKey, TValue> .Concurrent nativeHashMap,
                                                               TKey key, TValue item)
            where TKey : struct, IEquatable <TKey>
            where TValue : struct
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            var state = nativeHashMap.TryAdd(key, item);
            HashMapHelpers.ThrowOnFailedKey(state, key);
#else
            nativeHashMap.TryAdd(key, item);
#endif
        }
예제 #2
0
        public static void TryGetFirstValueAndThrowOnFail <TKey, TValue>(
            this NativeMultiHashMap <TKey, TValue> nativeMultiHashMap, TKey key, out TValue item,
            out NativeMultiHashMapIterator <TKey> it)
            where TKey : struct, IEquatable <TKey>
            where TValue : struct
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            var state = nativeMultiHashMap.TryGetFirstValue(key, out item, out it);
            HashMapHelpers.ThrowOnFailedKey(state, key);
#else
            nativeMultiHashMap.TryGetFirstValue(key, out item, out it);
#endif
        }