Struct Context

Source
pub struct Context<'src> {
    pub components: Vec<Expr<'src>>,
    /* private fields */
}
Expand description

Represents a context in a GitHub Actions expression.

These typically look something like github.actor or inputs.foo, although they can also be a “call” context like fromJSON(...).foo.bar, i.e. where the head of the context is a function call rather than an identifier.

Fields§

§components: Vec<Expr<'src>>

The inner components of the context.

Implementations§

Source§

impl<'src> Context<'src>

Source

pub fn as_str(&self) -> &str

Return the underlying raw context string.

Source

pub fn child_of(&self, parent: impl TryInto<Context<'src>>) -> bool

Returns whether this context is a child of the given parent context.

This considers a context its own child, i.e. foo.bar is a child of foo.bar, not just foo.

Source

pub fn pop_if(&self, head: &str) -> Option<&str>

Returns the tail of the context if the head matches the given string.

Trait Implementations§

Source§

impl<'src> Debug for Context<'src>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq<str> for Context<'_>

Source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Context<'_>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> TryFrom<&'a str> for Context<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(val: &'a str) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<'src> Freeze for Context<'src>

§

impl<'src> RefUnwindSafe for Context<'src>

§

impl<'src> Send for Context<'src>

§

impl<'src> Sync for Context<'src>

§

impl<'src> Unpin for Context<'src>

§

impl<'src> UnwindSafe for Context<'src>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.