maudit_rolldown_ecmascript_utils 0.1.0

Fork of Rolldown for the Maudit project until Rolldown is published on crates.io
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use oxc::allocator::Allocator;

use crate::TakeIn;

pub trait AllocatorExt<'alloc> {
  fn take<T: TakeIn<'alloc>>(&'alloc self, dest: &mut T) -> T;
}

impl<'alloc> AllocatorExt<'alloc> for Allocator {
  fn take<T: TakeIn<'alloc>>(&'alloc self, dest: &mut T) -> T {
    std::mem::replace(dest, T::dummy(self))
  }
}