pub enum Value {
None(Type),
Primitive(PrimitiveValue),
Compound(CompoundValue),
Task(TaskValue),
Hints(HintsValue),
Input(InputValue),
Output(OutputValue),
Call(CallValue),
}
Expand description
Represents a WDL runtime value.
Values are cheap to clone.
Variants§
None(Type)
The value is a literal None
value.
The contained type is expected to be an optional type.
Primitive(PrimitiveValue)
The value is a primitive value.
Compound(CompoundValue)
The value is a compound value.
Task(TaskValue)
The value is a task variable.
This value occurs only during command and output section evaluation in WDL 1.2 tasks.
Hints(HintsValue)
The value is a hints value.
Hints values only appear in a task hints section in WDL 1.2.
Input(InputValue)
The value is an input value.
Input values only appear in a task hints section in WDL 1.2.
Output(OutputValue)
The value is an output value.
Output values only appear in a task hints section in WDL 1.2.
Call(CallValue)
The value is the outputs of a call.
Implementations§
Source§impl Value
impl Value
Sourcepub fn from_v1_metadata<N: TreeNode>(value: &MetadataValue<N>) -> Self
pub fn from_v1_metadata<N: TreeNode>(value: &MetadataValue<N>) -> Self
Creates an object from an iterator of V1 AST metadata items.
§Panics
Panics if the metadata value contains an invalid numeric value.
Sourcepub fn new_none(ty: Type) -> Self
pub fn new_none(ty: Type) -> Self
Constructs a new None
value with the given type.
§Panics
Panics if the provided type is not optional.
Sourcepub fn as_primitive(&self) -> Option<&PrimitiveValue>
pub fn as_primitive(&self) -> Option<&PrimitiveValue>
Gets the value as a primitive value.
Returns None
if the value is not a primitive value.
Sourcepub fn as_compound(&self) -> Option<&CompoundValue>
pub fn as_compound(&self) -> Option<&CompoundValue>
Gets the value as a compound value.
Returns None
if the value is not a compound value.
Sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Gets the value as a Boolean
.
Returns None
if the value is not a Boolean
.
Sourcepub fn unwrap_boolean(self) -> bool
pub fn unwrap_boolean(self) -> bool
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Gets the value as an Int
.
Returns None
if the value is not an Int
.
Sourcepub fn unwrap_integer(self) -> i64
pub fn unwrap_integer(self) -> i64
Sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
Gets the value as a Float
.
Returns None
if the value is not a Float
.
Sourcepub fn unwrap_float(self) -> f64
pub fn unwrap_float(self) -> f64
Sourcepub fn as_string(&self) -> Option<&Arc<String>>
pub fn as_string(&self) -> Option<&Arc<String>>
Gets the value as a String
.
Returns None
if the value is not a String
.
Sourcepub fn unwrap_string(self) -> Arc<String>
pub fn unwrap_string(self) -> Arc<String>
Sourcepub fn as_file(&self) -> Option<&HostPath>
pub fn as_file(&self) -> Option<&HostPath>
Gets the value as a File
.
Returns None
if the value is not a File
.
Sourcepub fn unwrap_file(self) -> HostPath
pub fn unwrap_file(self) -> HostPath
Sourcepub fn as_directory(&self) -> Option<&HostPath>
pub fn as_directory(&self) -> Option<&HostPath>
Gets the value as a Directory
.
Returns None
if the value is not a Directory
.
Sourcepub fn unwrap_directory(self) -> HostPath
pub fn unwrap_directory(self) -> HostPath
Sourcepub fn as_pair(&self) -> Option<&Pair>
pub fn as_pair(&self) -> Option<&Pair>
Gets the value as a Pair
.
Returns None
if the value is not a Pair
.
Sourcepub fn unwrap_pair(self) -> Pair
pub fn unwrap_pair(self) -> Pair
Sourcepub fn as_array(&self) -> Option<&Array>
pub fn as_array(&self) -> Option<&Array>
Gets the value as an Array
.
Returns None
if the value is not an Array
.
Sourcepub fn unwrap_array(self) -> Array
pub fn unwrap_array(self) -> Array
Sourcepub fn as_map(&self) -> Option<&Map>
pub fn as_map(&self) -> Option<&Map>
Gets the value as a Map
.
Returns None
if the value is not a Map
.
Sourcepub fn unwrap_map(self) -> Map
pub fn unwrap_map(self) -> Map
Sourcepub fn as_object(&self) -> Option<&Object>
pub fn as_object(&self) -> Option<&Object>
Gets the value as an Object
.
Returns None
if the value is not an Object
.
Sourcepub fn unwrap_object(self) -> Object
pub fn unwrap_object(self) -> Object
Sourcepub fn as_struct(&self) -> Option<&Struct>
pub fn as_struct(&self) -> Option<&Struct>
Gets the value as a Struct
.
Returns None
if the value is not a Struct
.
Sourcepub fn unwrap_struct(self) -> Struct
pub fn unwrap_struct(self) -> Struct
Sourcepub fn as_task(&self) -> Option<&TaskValue>
pub fn as_task(&self) -> Option<&TaskValue>
Gets the value as a task.
Returns None
if the value is not a task.
Sourcepub fn unwrap_task(self) -> TaskValue
pub fn unwrap_task(self) -> TaskValue
Sourcepub fn as_hints(&self) -> Option<&HintsValue>
pub fn as_hints(&self) -> Option<&HintsValue>
Gets the value as a hints value.
Returns None
if the value is not a hints value.
Sourcepub fn unwrap_hints(self) -> HintsValue
pub fn unwrap_hints(self) -> HintsValue
Sourcepub fn as_call(&self) -> Option<&CallValue>
pub fn as_call(&self) -> Option<&CallValue>
Gets the value as a call value.
Returns None
if the value is not a call value.
Sourcepub fn unwrap_call(self) -> CallValue
pub fn unwrap_call(self) -> CallValue
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl From<CompoundValue> for Value
impl From<CompoundValue> for Value
Source§fn from(value: CompoundValue) -> Self
fn from(value: CompoundValue) -> Self
Source§impl From<HintsValue> for Value
impl From<HintsValue> for Value
Source§fn from(value: HintsValue) -> Self
fn from(value: HintsValue) -> Self
Source§impl From<Option<PrimitiveValue>> for Value
impl From<Option<PrimitiveValue>> for Value
Source§fn from(value: Option<PrimitiveValue>) -> Self
fn from(value: Option<PrimitiveValue>) -> Self
Source§impl From<PrimitiveValue> for Value
impl From<PrimitiveValue> for Value
Source§fn from(value: PrimitiveValue) -> Self
fn from(value: PrimitiveValue) -> Self
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.