pub enum Value {
Void,
Entity(EntityRef),
Function(Arc<dyn ErasedFunction>),
Float(f32),
Vector(Vec3),
String(Arc<CStr>),
}Expand description
The type of individual values passed in and out of the QuakeC runtime.
Note that, in most cases, Void will be converted to the default value
for the type.
Variants§
Void
Corresponds to QuakeC’s void. Should rarely be used, and is mostly
for the return value of functions that do not return any sensible value.
Entity(EntityRef)
An entity reference. See documentation for EntityRef for more details.
Function(Arc<dyn ErasedFunction>)
A function pointer. This requires some context to call, see userdata::Function.
Float(f32)
A single scalar float.
Vector(Vec3)
An {x, y, z} vector value.
String(Arc<CStr>)
A refcounted string pointer. Quake strings are not strictly ascii, but cannot have internal
NUL, so CStr is used.
Implementations§
Source§impl Value
impl Value
Sourcepub fn field(&self, field: VectorField) -> Result<Value, TryScalarError>
pub fn field(&self, field: VectorField) -> Result<Value, TryScalarError>
Get a field of a value.
Sourcepub fn set(
&mut self,
field: VectorField,
value: Value,
) -> Result<(), SetValueError>
pub fn set( &mut self, field: VectorField, value: Value, ) -> Result<(), SetValueError>
Clone the source value to this value, with an optional field reference. Useful to implement
userdata::EntityHandle::set, as sometimes QuakeC only wants to set a single field of a
vector.
Trait Implementations§
Source§impl From<Arc<dyn ErasedFunction>> for Value
impl From<Arc<dyn ErasedFunction>> for Value
Source§fn from(value: Arc<dyn ErasedFunction>) -> Self
fn from(value: Arc<dyn ErasedFunction>) -> Self
Source§impl From<NonZero<u64>> for Value
impl From<NonZero<u64>> for Value
Source§fn from(value: ErasedEntityHandle) -> Self
fn from(value: ErasedEntityHandle) -> Self
Source§impl TryFrom<Value> for ErasedEntityHandle
impl TryFrom<Value> for ErasedEntityHandle
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more