Use PackedOption<Ebb> to represent jump tables.

Avoid NO_EBB.
This commit is contained in:
Jakob Stoklund Olesen
2017-01-19 13:41:56 -08:00
parent 7b8239d076
commit 2f6a33f16d
3 changed files with 33 additions and 33 deletions

View File

@@ -25,6 +25,11 @@ impl<T: ReservedValue> PackedOption<T> {
self.0 == T::reserved_value()
}
/// Returns `true` if the packed option is a `Some` value.
pub fn is_some(&self) -> bool {
!self.is_none()
}
/// Expand the packed option into a normal `Option`.
pub fn expand(self) -> Option<T> {
if self.is_none() { None } else { Some(self.0) }