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