IfBuilder
if_
¶
Select this value for a comparison
Parameters:
-
*target
(Retriever | int | Get
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
if_not
¶
Select this value for a comparison with the result inverted
Parameters:
-
*target
(Retriever | int | Get
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
if_len
¶
Select this value and use its length for a comparison
Parameters:
-
*target
(Retriever | int | Get
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
if_ver
¶
Checks if the current struct version is between the specified min/max. Either min/max may be omitted to leave that check unbounded
Parameters:
-
min
(Version
, default:Version(-1)
) –The minimum required version
-
max
(Version
, default:Version(10000)
) –The maximum required version
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
if_key
¶
if_key(key: str) -> IfBuilder
Select this context key for a comparison
Parameters:
-
key
(str
) –The context key to compare
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
if_not_key
¶
if_not_key(key: str) -> IfBuilder
Select this context key for a comparison with the result inverted
Parameters:
-
key
(str
) –The context key to compare
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
if_else
¶
if_else(*coms: Combinator) -> Combinator
Creates an if-else-if like chain using the provided if_
combinators, such that at most only one of them will run
their innermost combinator. if multiple if_
s are nested in one combinator, it is treated as a single if block,
if condition1 and condition2
unless a break_()
combinator is passed.
If a combinator other than if_
is passed, it is treated like a default case (order matters!)
Parameters:
-
*coms
(Combinator
, default:()
) –The nested combinators to chain.
Returns:
-
Combinator
–A combinator that encodes the conditional logic defined by the
IfBuilder
chain
break_
¶
break_() -> Combinator
Break from an if_else combinator chain unconditionally.
Returns:
-
Combinator
–A combinator that encodes the conditional logic defined by the
IfBuilder
chain
IfBuilder
¶
Constructs combinators that may execute conditionally during parsing, depending on the values of their retriever inputs
eq
¶
Checks if the previously selected value is equal to this value
Parameters:
-
*source
(Retriever | int | Get
, default:()
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
ge
¶
Checks if the previously selected value is greater than or equal to this value
Parameters:
-
*source
(Retriever | int | Get
, default:()
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
gt
¶
Checks if the previously selected value is greater than this value
Parameters:
-
*source
(Retriever | int | Get
, default:()
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
is_none
¶
is_none() -> IfBuilder
Checks if the previously selected value is none
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
le
¶
Checks if the previously selected value is lesser than or equal to this value
Parameters:
-
*source
(Retriever | int | Get
, default:()
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
lt
¶
Checks if the previously selected value is lesser than this value
Parameters:
-
*source
(Retriever | int | Get
, default:()
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
ne
¶
Checks if the previously selected value is not equal to this value
Parameters:
-
*source
(Retriever | int | Get
, default:()
) –The retriever path to fetch the value from. This can be a sequence of retrievers/list indices starting in the current struct
Returns:
-
IfBuilder
–An
IfBuilder
instance to continue defining additional combinator properties
then
¶
then(*coms: Combinator) -> Combinator
Finishes the if-combinator construction by defining a nested combinator, should be called last on an
IfBuilder
Parameters:
-
*coms
(Combinator
, default:()
) –The nested combinators to run if the conditions for this if combinator are met
Returns:
-
Combinator
–A combinator that encodes the conditional logic defined by the
IfBuilder
chain