pub enum Value {
Nil,
Bool(bool),
Number(Number),
String(OcString),
Array(Vec<Value>),
Map(Vec<(Value, Value)>),
Handle(Handle),
}Expand description
Any value a component takes or returns.
Variants§
Nil
Bool(bool)
Number(Number)
String(OcString)
Array(Vec<Value>)
Map(Vec<(Value, Value)>)
A Lua table with non-sequence keys, in the order OpenComputers sent them.
Handle(Handle)
Implementations§
Source§impl Value
impl Value
Sourcepub fn text(bytes: &[u8]) -> Value
pub fn text(bytes: &[u8]) -> Value
A string argument: sent as text when it is UTF-8, as bytes otherwise.
pub fn is_nil(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn as_number(&self) -> Option<Number>
pub fn as_i64(&self) -> Option<i64>
pub fn as_str(&self) -> Option<&str>
pub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_handle(&self) -> Option<Handle>
Sourcepub fn as_array(&self) -> Option<Vec<&Value>>
pub fn as_array(&self) -> Option<Vec<&Value>>
Elements of a sequence. OpenComputers sends some sequences as maps keyed 1..n; those are returned in key order.
pub fn as_map(&self) -> Option<&[(Value, Value)]>
Sourcepub fn to_string_map(&self) -> BTreeMap<String, Value>
pub fn to_string_map(&self) -> BTreeMap<String, Value>
The map as a BTreeMap with string keys; other keys are dropped.
pub fn encode(&self) -> Vec<u8> ⓘ
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Forget for Value
impl Freeze for Value
impl Move for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more