bump_scope/traits/
bump_allocator_core_scope.rs1use crate::{
2 BaseAllocator, Bump, BumpScope, WithoutDealloc, WithoutShrink,
3 settings::BumpAllocatorSettings,
4 traits::{BumpAllocatorCore, assert_dyn_compatible, assert_implements},
5};
6
7pub unsafe trait BumpAllocatorCoreScope<'a>: BumpAllocatorCore {}
29
30assert_dyn_compatible!(BumpAllocatorCoreScope<'_>);
31
32assert_implements! {
33 [BumpAllocatorCoreScope<'a> + ?Sized]
34
35 BumpScope
36
37 &Bump
38 &BumpScope
39
40 &mut Bump
41 &mut BumpScope
42
43 dyn BumpAllocatorCoreScope
44 &dyn BumpAllocatorCoreScope
45 &mut dyn BumpAllocatorCoreScope
46
47 dyn MutBumpAllocatorCoreScope
48 &dyn MutBumpAllocatorCoreScope
49 &mut dyn MutBumpAllocatorCoreScope
50}
51
52unsafe impl<'a, B: BumpAllocatorCoreScope<'a> + ?Sized> BumpAllocatorCoreScope<'a> for &B {}
53unsafe impl<'a, B: BumpAllocatorCoreScope<'a> + ?Sized> BumpAllocatorCoreScope<'a> for &mut B {}
54
55unsafe impl<'a, B: BumpAllocatorCoreScope<'a>> BumpAllocatorCoreScope<'a> for WithoutDealloc<B> {}
56unsafe impl<'a, B: BumpAllocatorCoreScope<'a>> BumpAllocatorCoreScope<'a> for WithoutShrink<B> {}
57
58unsafe impl<'a, A, S> BumpAllocatorCoreScope<'a> for BumpScope<'a, A, S>
59where
60 A: BaseAllocator<S::GuaranteedAllocated>,
61 S: BumpAllocatorSettings,
62{
63}
64
65unsafe impl<'a, A, S> BumpAllocatorCoreScope<'a> for &'a Bump<A, S>
66where
67 A: BaseAllocator<S::GuaranteedAllocated>,
68 S: BumpAllocatorSettings,
69{
70}
71
72unsafe impl<'a, A, S> BumpAllocatorCoreScope<'a> for &'a mut Bump<A, S>
73where
74 A: BaseAllocator<S::GuaranteedAllocated>,
75 S: BumpAllocatorSettings,
76{
77}