|
1 | 1 | use std::ops::Deref; |
2 | 2 |
|
3 | | -use crate::{Decoder, Encoder, Env, Error, NifResult, Term}; |
| 3 | +use crate::{Decoder, Encoder, Env, Error, NifResult, Term, TermType}; |
4 | 4 |
|
5 | 5 | use crate::sys::enif_make_ref; |
6 | 6 |
|
7 | | -/// Wrapper for BEAM reference terms. |
8 | | -#[derive(PartialEq, Eq, Clone, Copy)] |
9 | | -pub struct Reference<'a>(Term<'a>); |
| 7 | +wrapper!(Reference, TermType::Ref); |
10 | 8 |
|
11 | | -impl<'a> Reference<'a> { |
12 | | - /// Returns a representation of self in the given Env. |
13 | | - /// |
14 | | - /// If the term is already is in the provided env, it will be directly returned. Otherwise |
15 | | - /// the term will be copied over. |
16 | | - pub fn in_env<'b>(&self, env: Env<'b>) -> Reference<'b> { |
17 | | - Reference(self.0.in_env(env)) |
18 | | - } |
19 | | -} |
| 9 | +/// Wrapper for BEAM reference terms. |
| 10 | +// #[derive(PartialEq, Eq, Clone, Copy)] |
| 11 | +// pub struct Reference<'a>(Term<'a>); |
| 12 | +// |
| 13 | +// impl<'a> Reference<'a> { |
| 14 | +// /// Returns a representation of self in the given Env. |
| 15 | +// /// |
| 16 | +// /// If the term is already is in the provided env, it will be directly returned. Otherwise |
| 17 | +// /// the term will be copied over. |
| 18 | +// pub fn in_env<'b>(&self, env: Env<'b>) -> Reference<'b> { |
| 19 | +// Reference(self.0.in_env(env)) |
| 20 | +// } |
| 21 | +// } |
20 | 22 |
|
21 | 23 | impl<'a> Deref for Reference<'a> { |
22 | 24 | type Target = Term<'a>; |
|
0 commit comments