mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-14 16:08:02 -05:00
Move Vallish into file
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user