pub enum Evaluation {
String(String),
Number(f64),
Boolean(bool),
Null,
Array(Vec<Evaluation>),
Object(HashMap<String, Evaluation>),
}
Expand description
The result of evaluating a GitHub Actions expression.
This type represents the possible values that can result from evaluating GitHub Actions expressions.
Variants§
String(String)
A string value (includes both string literals and stringified other types).
Number(f64)
A numeric value.
Boolean(bool)
A boolean value.
Null
The null value.
Array(Vec<Evaluation>)
An array value. Array evaluations can only be realized through fromJSON
.
Object(HashMap<String, Evaluation>)
An object value. Object evaluations can only be realized through fromJSON
.
Implementations§
Source§impl Evaluation
impl Evaluation
Sourcepub fn as_boolean(&self) -> bool
pub fn as_boolean(&self) -> bool
Convert to a boolean following GitHub Actions truthiness rules.
GitHub Actions truthiness:
- false and null are falsy
- Numbers: 0 is falsy, everything else is truthy
- Strings: empty string is falsy, everything else is truthy
- Arrays and dictionaries are always truthy (non-empty objects)
Sourcepub fn as_number(&self) -> f64
pub fn as_number(&self) -> f64
Convert to a number following GitHub Actions conversion rules.
See: https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#operators
Sourcepub fn sema(&self) -> EvaluationSema<'_>
pub fn sema(&self) -> EvaluationSema<'_>
Returns a wrapper around this evaluation that implements GitHub Actions evaluation semantics.
Trait Implementations§
Source§impl Clone for Evaluation
impl Clone for Evaluation
Source§fn clone(&self) -> Evaluation
fn clone(&self) -> Evaluation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Evaluation
impl Debug for Evaluation
Source§impl PartialEq for Evaluation
impl PartialEq for Evaluation
Source§impl TryFrom<Value> for Evaluation
impl TryFrom<Value> for Evaluation
Source§impl TryInto<Value> for Evaluation
impl TryInto<Value> for Evaluation
impl StructuralPartialEq for Evaluation
Auto Trait Implementations§
impl Freeze for Evaluation
impl RefUnwindSafe for Evaluation
impl Send for Evaluation
impl Sync for Evaluation
impl Unpin for Evaluation
impl UnwindSafe for Evaluation
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> 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