| 63 | } |
| 64 | |
| 65 | unsafe fn wrap_raw<'b>(raw: &'b Self::Raw, context: &'b Self::Context) -> Self::Wrapped<'b> { |
| 66 | let edge_target = Guard::new( |
| 67 | BasicBlock::from_raw(raw.target, context.orig_block.context.clone()), |
| 68 | raw, |
| 69 | ); |
| 70 | let orig_block = Guard::new( |
| 71 | BasicBlock::from_raw( |
| 72 | context.orig_block.handle, |
| 73 | context.orig_block.context.clone(), |
| 74 | ), |
| 75 | raw, |
| 76 | ); |
| 77 | |
| 78 | let (source, target) = match context.dir { |
| 79 | EdgeDirection::Incoming => (edge_target, orig_block), |
| 80 | EdgeDirection::Outgoing => (orig_block, edge_target), |
| 81 | }; |
| 82 | |
| 83 | Edge { |
| 84 | branch: raw.type_, |
| 85 | back_edge: raw.backEdge, |
| 86 | source, |
| 87 | target, |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | pub trait BlockContext: Clone + Sync + Send + Sized { |