pub struct AllocDict<D>(pub D);
Expand description
Utility to allocate a dict from iterator.
Iterator must be a list of pairs (key, value). Duplicate keys are allowed, last key wins.
§Panics
Panics if a key is not hashable.
§Example
use starlark::values::dict::AllocDict;
let l = heap.alloc(AllocDict([("a", 1), ("b", 2), ("c", 3)]));
let ls = frozen_heap.alloc(AllocDict([("a", 1), ("b", 2), ("c", 3)]));
Tuple Fields§
§0: D
Implementations§
source§impl AllocDict<Empty<(FrozenValue, FrozenValue)>>
impl AllocDict<Empty<(FrozenValue, FrozenValue)>>
sourcepub const EMPTY: AllocDict<Empty<(FrozenValue, FrozenValue)>> = _
pub const EMPTY: AllocDict<Empty<(FrozenValue, FrozenValue)>> = _
Allocate an empty dict.
Trait Implementations§
source§impl<D, K, V> AllocFrozenValue for AllocDict<D>
impl<D, K, V> AllocFrozenValue for AllocDict<D>
source§fn alloc_frozen_value(self, heap: &FrozenHeap) -> FrozenValue
fn alloc_frozen_value(self, heap: &FrozenHeap) -> FrozenValue
Allocate a value in the frozen heap and return a reference to the allocated value.
source§impl<'v, D, K, V> AllocValue<'v> for AllocDict<D>
impl<'v, D, K, V> AllocValue<'v> for AllocDict<D>
source§impl<D, K, V> StarlarkTypeRepr for AllocDict<D>
impl<D, K, V> StarlarkTypeRepr for AllocDict<D>
source§fn starlark_type_repr() -> Ty
fn starlark_type_repr() -> Ty
The representation of a type that a user would use verbatim in starlark type annotations
Auto Trait Implementations§
impl<D> RefUnwindSafe for AllocDict<D>where
D: RefUnwindSafe,
impl<D> Send for AllocDict<D>where
D: Send,
impl<D> Sync for AllocDict<D>where
D: Sync,
impl<D> Unpin for AllocDict<D>where
D: Unpin,
impl<D> UnwindSafe for AllocDict<D>where
D: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more