pub enum PrimitiveValue {
Boolean(bool),
Integer(i64),
Float(OrderedFloat<f64>),
String(Arc<String>),
File(HostPath),
Directory(HostPath),
}
Expand description
Represents a primitive WDL value.
Primitive values are cheap to clone.
Variants§
Boolean(bool)
The value is a Boolean
.
Integer(i64)
The value is an Int
.
Float(OrderedFloat<f64>)
The value is a Float
.
String(Arc<String>)
The value is a String
.
File(HostPath)
The value is a File
.
Directory(HostPath)
The value is a Directory
.
Implementations§
Source§impl PrimitiveValue
impl PrimitiveValue
Sourcepub fn new_string(s: impl Into<String>) -> Self
pub fn new_string(s: impl Into<String>) -> Self
Creates a new String
value.
Sourcepub fn new_directory(path: impl Into<String>) -> Self
pub fn new_directory(path: impl Into<String>) -> Self
Creates a new Directory
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 compare(left: &Self, right: &Self) -> Option<Ordering>
pub fn compare(left: &Self, right: &Self) -> Option<Ordering>
Compares two values for an ordering according to the WDL specification.
Unlike a PartialOrd
implementation, this takes into account automatic
coercions.
Returns None
if the values cannot be compared based on their types.
Sourcepub fn raw<'a>(
&'a self,
context: Option<&'a dyn EvaluationContext>,
) -> impl Display + use<'a>
pub fn raw<'a>( &'a self, context: Option<&'a dyn EvaluationContext>, ) -> impl Display + use<'a>
Gets a raw display of the value.
This differs from the Display implementation in that strings, files, and directories are not quoted and not escaped.
The provided coercion context is used to translate host paths to guest
paths; if None
, File
and Directory
values are displayed as-is.
Trait Implementations§
Source§impl Clone for PrimitiveValue
impl Clone for PrimitiveValue
Source§fn clone(&self) -> PrimitiveValue
fn clone(&self) -> PrimitiveValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Coercible for PrimitiveValue
impl Coercible for PrimitiveValue
Source§impl Debug for PrimitiveValue
impl Debug for PrimitiveValue
Source§impl Display for PrimitiveValue
impl Display for PrimitiveValue
Source§impl From<PrimitiveValue> for Value
impl From<PrimitiveValue> for Value
Source§fn from(value: PrimitiveValue) -> Self
fn from(value: PrimitiveValue) -> Self
Source§impl From<String> for PrimitiveValue
impl From<String> for PrimitiveValue
Source§impl From<bool> for PrimitiveValue
impl From<bool> for PrimitiveValue
Source§impl From<f64> for PrimitiveValue
impl From<f64> for PrimitiveValue
Source§impl From<i64> for PrimitiveValue
impl From<i64> for PrimitiveValue
Source§impl Hash for PrimitiveValue
impl Hash for PrimitiveValue
Source§impl PartialEq for PrimitiveValue
impl PartialEq for PrimitiveValue
Source§impl Serialize for PrimitiveValue
impl Serialize for PrimitiveValue
impl Eq for PrimitiveValue
Auto Trait Implementations§
impl Freeze for PrimitiveValue
impl RefUnwindSafe for PrimitiveValue
impl Send for PrimitiveValue
impl Sync for PrimitiveValue
impl Unpin for PrimitiveValue
impl UnwindSafe for PrimitiveValue
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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.