pub enum Type {
Primitive(PrimitiveType, bool),
Compound(CompoundType, bool),
Object,
OptionalObject,
Union,
None,
Task,
Hints,
Input,
Output,
Call(CallType),
}
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
.
Task
A special hidden type for task
that is available in command and task
output sections in WDL 1.2.
Hints
A special hidden type for hints
that is available in task hints
sections.
Input
A special hidden type for input
that is available in task hints
sections.
Output
A special hidden type for output
that is available in task hints
sections.
Call(CallType)
The type is a call output.
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_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(&self, kind: PromotionKind) -> Self
pub fn promote(&self, kind: PromotionKind) -> Self
Promotes the type from one scope to another.
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.
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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.