HashMap, aka associative array / key-value store / map use std::collections::{HashMap}; let mut m = HashMap<char,i32>::new(); m.insert('a', 1); // key is 'a', value is 1 let b = m[&'a']; // [] lookup, this crashes at runtime if 'a' is not in map let c =...
// The capacity is implicit and passed with all accessors. v: AtomicPtr<u8>, _phantom: PhantomData<[T; 1]>, } impl<T> Slab<T> { const fn new() -> Slab<T> { Slab { v: AtomicPtr::new(std::ptr::null_mut()), _phantom: PhantomData } } fn initialize(&self, cap: usize) ...
/// use std::collections::HashMap; /// /// use std::sync::LazyLock; @@ -61,8 +59,6 @@ union Data<T, F> { /// ``` /// Initialize fields with `LazyLock`. /// ``` /// #![feature(lazy_cell)] /// /// use std::sync::LazyLock; /// /// #[derive(Debug)] @...
fn from(parsed_entity: ParsedEntity) -> Self { let data = parsed_entity.data.clone().unwrap().as_hashmap().unwrap_or_default(); let title = data.get("title").unwrap_or(&Pod::String("".to_string())).as_string().unwrap_or_default(); let slug = data.get("slug").unwrap_or(...
visited: FxHashMap<BasicBlock, Rc<RefCell<ChunkedBitSet<MovePathIndex>>>, collected_drops: &'a mut MixedBitSet<MovePathIndex>, visited: FxHashMap<BasicBlock, Rc<RefCell<MixedBitSet<MovePathIndex>>>, } impl<'a, 'mir, 'tcx> DropsReachable<'a, 'mir, 'tcx> { fn visit(&mut self, block...
indexed_directly: FxHashMap<Name, (Option<region::Scope>, Ty<'tcx>)>, indexed_directly: FxHashMap<Symbol, (Option<region::Scope>, Ty<'tcx>)>, /// Any names that are used outside an index operation. /// Used to detect things like `&mut vec` used together with `vec[i]` referen...
(); let mut hasher = hash_map::DefaultHasher::new(); hasher.write(dirname.to_string().as_bytes()); dst.join(format!("{:016x}-{}", hasher.finish(), basename)) .with_extension("o") } else { dst.join(file).with_extension("o") }; let obj = if !obj.starts_with(&dst) {...
// (i.e. in `HashMap` in the `std::collections::HashMap` path). // For the same reasons, avoids searching for any path imports for inputs with their length less than 2 symbols // (but shows all associated items for any input length). // // .Import configuration // ### Import...
use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; Expand Down Expand Up @@ -63,7 +65,7 @@ enum FnKind { } fn fn_kind<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> FnKind { debug_assert!(matches!(tc...
Available add-ons Advanced Security Enterprise-grade security features GitHub Copilot Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Provide feedback We read ...