pub enum Type {
Primitive(PrimitiveType, bool),
Compound(CompoundType, bool),
Object,
OptionalObject,
Union,
None,
Hidden(HiddenType),
Call(CallType),
TypeNameRef(CustomType),
}Expand description
Represents a WDL type.
Variants§
Primitive(PrimitiveType, bool)
The type is a primitive type.
The second field is whether or not the primitive type is optional.
Compound(CompoundType, bool)
The type is a compound type.
The second field is whether or not the compound type is optional.
Object
The type is Object.
OptionalObject
The type is Object?.
Union
A special hidden type for a value that may have any one of several concrete types.
This variant is also used to convey an “indeterminate” type; an indeterminate type may result from a previous type error.
None
A special type that behaves like an optional Union.
Hidden(HiddenType)
A special hidden type that is not directly expressible in WDL source.
Hidden types are used for type checking special values like task,
task.previous, hints, input, and output.
Call(CallType)
The type is a call output.
TypeNameRef(CustomType)
A reference to a custom type name (struct or enum).
Implementations§
Source§impl Type
impl Type
Sourcepub fn as_primitive(&self) -> Option<PrimitiveType>
pub fn as_primitive(&self) -> Option<PrimitiveType>
Casts the type to a primitive type.
Returns None if the type is not primitive.
Sourcepub fn as_compound(&self) -> Option<&CompoundType>
pub fn as_compound(&self) -> Option<&CompoundType>
Casts the type to a compound type.
Returns None if the type is not a compound type.
Sourcepub fn as_array(&self) -> Option<&ArrayType>
pub fn as_array(&self) -> Option<&ArrayType>
Converts the type to an array type.
Returns None if the type is not an array type.
Sourcepub fn as_pair(&self) -> Option<&PairType>
pub fn as_pair(&self) -> Option<&PairType>
Converts the type to a pair type.
Returns None if the type is not a pair type.
Sourcepub fn as_map(&self) -> Option<&MapType>
pub fn as_map(&self) -> Option<&MapType>
Converts the type to a map type.
Returns None if the type is not a map type.
Sourcepub fn as_struct(&self) -> Option<&StructType>
pub fn as_struct(&self) -> Option<&StructType>
Converts the type to a struct type.
Returns None if the type is not a struct type.
Sourcepub fn as_enum(&self) -> Option<&EnumType>
pub fn as_enum(&self) -> Option<&EnumType>
Converts the type to an enum type.
Returns None if the type is not an enum type.
Sourcepub fn as_custom(&self) -> Option<&CustomType>
pub fn as_custom(&self) -> Option<&CustomType>
Converts the type to a custom type.
Returns None if the type is not a custom type.
Sourcepub fn as_type_name_ref(&self) -> Option<&CustomType>
pub fn as_type_name_ref(&self) -> Option<&CustomType>
Converts the type to a type name reference.
Returns None if the type is not a type name reference.
Sourcepub fn as_call(&self) -> Option<&CallType>
pub fn as_call(&self) -> Option<&CallType>
Converts the type to a call type
Returns None if the type if not a call type.
Sourcepub fn promote_scatter(&self) -> Self
pub fn promote_scatter(&self) -> Self
Promotes a type from a scatter statement into the parent scope.
For most types, this wraps them in an array. For call types, this promotes each output type into an array.
Sourcepub fn common_type(&self, other: &Type) -> Option<Type>
pub fn common_type(&self, other: &Type) -> Option<Type>
Calculates a common type between this type and the given type.
Returns None if the types have no common type.
Sourcepub fn type_name_ref(&self) -> Option<Type>
pub fn type_name_ref(&self) -> Option<Type>
Attempts to transform the type into the analogous type name reference.
This is only supported for custom types (structs and enums).
Trait Implementations§
Source§impl Coercible for Type
impl Coercible for Type
Source§fn is_coercible_to(&self, target: &Self) -> bool
fn is_coercible_to(&self, target: &Self) -> bool
Source§impl From<CompoundType> for Type
impl From<CompoundType> for Type
Source§fn from(value: CompoundType) -> Self
fn from(value: CompoundType) -> Self
Source§impl From<PrimitiveType> for Type
impl From<PrimitiveType> for Type
Source§fn from(value: PrimitiveType) -> Self
fn from(value: PrimitiveType) -> Self
Source§impl From<StructType> for Type
impl From<StructType> for Type
Source§fn from(value: StructType) -> Self
fn from(value: StructType) -> Self
Source§impl From<Type> for FunctionalType
impl From<Type> for FunctionalType
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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.