diff options
| author | Rubens Brandao <git@rubens.io> | 2024-05-03 13:28:53 -0300 |
|---|---|---|
| committer | Kyle Martin <krm504@nyu.edu> | 2024-05-10 12:00:27 -0400 |
| commit | ea7a22b16fc56c23af397dd690c6c839dfb3a8f1 (patch) | |
| tree | 45f3ba19172017694388ab6f7266e23df76bb670 /rust/src/basicblock.rs | |
| parent | 015314d34d073a8ebbd958edf8150a81381f12c2 (diff) | |
hide array implementation details
Diffstat (limited to 'rust/src/basicblock.rs')
| -rw-r--r-- | rust/src/basicblock.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/rust/src/basicblock.rs b/rust/src/basicblock.rs index f28e596f..a6ac8f74 100644 --- a/rust/src/basicblock.rs +++ b/rust/src/basicblock.rs @@ -68,17 +68,13 @@ pub struct EdgeContext<'a, C: 'a + BlockContext> { impl<'a, C: 'a + BlockContext> CoreArrayProvider for Edge<'a, C> { type Raw = BNBasicBlockEdge; type Context = EdgeContext<'a, C>; + type Wrapped<'b> = Edge<'b, C> where 'a: 'b; } -unsafe impl<'a, C: 'a + BlockContext> CoreOwnedArrayProvider for Edge<'a, C> { +unsafe impl<'a, C: 'a + BlockContext> CoreArrayProviderInner for Edge<'a, C> { unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { BNFreeBasicBlockEdgeList(raw, count); } -} - -unsafe impl<'a, C: BlockContext> CoreArrayWrapper for Edge<'a, C> { - type Wrapped<'b> = Edge<'b, C> where 'a: 'b; - unsafe fn wrap_raw<'b>(raw: &'b Self::Raw, context: &'b Self::Context) -> Self::Wrapped<'b> { let edge_target = Guard::new( BasicBlock::from_raw(raw.target, context.orig_block.context.clone()), @@ -301,17 +297,13 @@ unsafe impl<C: BlockContext> RefCountable for BasicBlock<C> { impl<C: BlockContext> CoreArrayProvider for BasicBlock<C> { type Raw = *mut BNBasicBlock; type Context = C; + type Wrapped<'a> = Guard<'a, BasicBlock<C>> where C: 'a; } -unsafe impl<C: BlockContext> CoreOwnedArrayProvider for BasicBlock<C> { +unsafe impl<C: BlockContext> CoreArrayProviderInner for BasicBlock<C> { unsafe fn free(raw: *mut Self::Raw, count: usize, _context: &Self::Context) { BNFreeBasicBlockList(raw, count); } -} - -unsafe impl<C: BlockContext> CoreArrayWrapper for BasicBlock<C> { - type Wrapped<'a> = Guard<'a, BasicBlock<C>> where C: 'a; - unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, context: &'a Self::Context) -> Self::Wrapped<'a> { Guard::new(BasicBlock::from_raw(*raw, context.clone()), context) } |
