Enum brush_parser::word::ParameterExpr

source ·
pub enum ParameterExpr {
Show 19 variants Parameter { parameter: Parameter, indirect: bool, }, UseDefaultValues { parameter: Parameter, indirect: bool, test_type: ParameterTestType, default_value: Option<String>, }, AssignDefaultValues { parameter: Parameter, indirect: bool, test_type: ParameterTestType, default_value: Option<String>, }, IndicateErrorIfNullOrUnset { parameter: Parameter, indirect: bool, test_type: ParameterTestType, error_message: Option<String>, }, UseAlternativeValue { parameter: Parameter, indirect: bool, test_type: ParameterTestType, alternative_value: Option<String>, }, ParameterLength { parameter: Parameter, indirect: bool, }, RemoveSmallestSuffixPattern { parameter: Parameter, indirect: bool, pattern: Option<String>, }, RemoveLargestSuffixPattern { parameter: Parameter, indirect: bool, pattern: Option<String>, }, RemoveSmallestPrefixPattern { parameter: Parameter, indirect: bool, pattern: Option<String>, }, RemoveLargestPrefixPattern { parameter: Parameter, indirect: bool, pattern: Option<String>, }, Substring { parameter: Parameter, indirect: bool, offset: UnexpandedArithmeticExpr, length: Option<UnexpandedArithmeticExpr>, }, Transform { parameter: Parameter, indirect: bool, op: ParameterTransformOp, }, UppercaseFirstChar { parameter: Parameter, indirect: bool, pattern: Option<String>, }, UppercasePattern { parameter: Parameter, indirect: bool, pattern: Option<String>, }, LowercaseFirstChar { parameter: Parameter, indirect: bool, pattern: Option<String>, }, LowercasePattern { parameter: Parameter, indirect: bool, pattern: Option<String>, }, ReplaceSubstring { parameter: Parameter, indirect: bool, pattern: String, replacement: String, match_kind: SubstringMatchKind, }, VariableNames { prefix: String, concatenate: bool, }, MemberKeys { variable_name: String, concatenate: bool, },
}
Expand description

A parameter expression, used in a parameter expansion.

Variants§

§

Parameter

A parameter, with optional indirection.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§

UseDefaultValues

Conditionally use default values.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§test_type: ParameterTestType

The type of test to perform.

§default_value: Option<String>

Default value to conditionally use.

§

AssignDefaultValues

Conditionally assign default values.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§test_type: ParameterTestType

The type of test to perform.

§default_value: Option<String>

Default value to conditionally assign.

§

IndicateErrorIfNullOrUnset

Indicate error if null or unset.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§test_type: ParameterTestType

The type of test to perform.

§error_message: Option<String>

Error message to conditionally yield.

§

UseAlternativeValue

Conditionally use an alternative value.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§test_type: ParameterTestType

The type of test to perform.

§alternative_value: Option<String>

Alternative value to conditionally use.

§

ParameterLength

Compute the length of the given parameter.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§

RemoveSmallestSuffixPattern

Remove the smallest suffix from the given string matching the given pattern.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

RemoveLargestSuffixPattern

Remove the largest suffix from the given string matching the given pattern.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

RemoveSmallestPrefixPattern

Remove the smallest prefix from the given string matching the given pattern.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

RemoveLargestPrefixPattern

Remove the largest prefix from the given string matching the given pattern.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

Substring

Extract a substring from the given parameter.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§offset: UnexpandedArithmeticExpr

Arithmetic expression that will be expanded to compute the offset at which the substring should be extracted.

§length: Option<UnexpandedArithmeticExpr>

Optionally provides an arithmetic expression that will be expanded to compute the length of substring to be extracted; if left unspecified, the remainder of the string will be extracted.

§

Transform

Transform the given parameter.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§op: ParameterTransformOp

Type of transformation to apply.

§

UppercaseFirstChar

Uppercase the first character of the given parameter.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

UppercasePattern

Uppercase the portion of the given parameter matching the given pattern.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

LowercaseFirstChar

Lowercase the first character of the given parameter.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

LowercasePattern

Lowercase the portion of the given parameter matching the given pattern.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: Option<String>

Optionally provides a pattern to match.

§

ReplaceSubstring

Replace occurrences of the given pattern in the given parameter.

Fields

§parameter: Parameter

The parameter.

§indirect: bool

Whether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.

§pattern: String

Pattern to match.

§replacement: String

Replacement string.

§match_kind: SubstringMatchKind

Kind of match to perform.

§

VariableNames

Select variable names from the environment with a given prefix.

Fields

§prefix: String

The prefix to match.

§concatenate: bool

Whether to concatenate the results.

§

MemberKeys

Select member keys from the named array.

Fields

§variable_name: String

Name of the array variable.

§concatenate: bool

Whether to concatenate the results.

Trait Implementations§

source§

impl Debug for ParameterExpr

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more