Move Vallish into file

This commit is contained in:
Andrew Morris
2023-06-20 13:52:20 +10:00
parent 6340db8794
commit 0b98f41658
8 changed files with 30 additions and 27 deletions

View File

@@ -13,6 +13,7 @@ use crate::vs_object::VsObject;
use crate::vs_symbol::VsSymbol;
use crate::vs_value::ToVal;
use crate::vs_value::Val;
use crate::Vallish;
#[derive(Clone)]
pub struct BytecodeDecoder {
@@ -308,24 +309,3 @@ impl BytecodeDecoder {
return InstructionByte::from_byte(self.decode_byte());
}
}
pub enum Vallish<'a> {
Own(Val),
Ref(&'a Val),
}
impl<'a> Vallish<'a> {
pub fn get_own(self) -> Val {
match self {
Vallish::Own(val) => val,
Vallish::Ref(val) => val.clone(),
}
}
pub fn get_ref(&self) -> &Val {
match self {
Vallish::Own(val) => val,
Vallish::Ref(val) => val,
}
}
}