add FixedRulePayload::inputs_count()

main
Goldstein 2 years ago
parent f2e86bef62
commit 07af70899c
No known key found for this signature in database
GPG Key ID: DE6031ABA0BB269A

@ -302,6 +302,9 @@ impl MagicFixedRuleApply {
); );
Ok(rel) Ok(rel)
} }
pub(crate) fn relations_count(&self) -> usize {
self.rule_args.len()
}
pub(crate) fn relation(&self, idx: usize) -> Result<&MagicFixedRuleRuleArg> { pub(crate) fn relation(&self, idx: usize) -> Result<&MagicFixedRuleRuleArg> {
#[derive(Error, Diagnostic, Debug)] #[derive(Error, Diagnostic, Debug)]
#[error("Cannot find a required positional argument at index {idx} for '{rule_name}'")] #[error("Cannot find a required positional argument at index {idx} for '{rule_name}'")]

@ -329,6 +329,10 @@ impl<'a, 'b> FixedRuleInputRelation<'a, 'b> {
} }
impl<'a, 'b> FixedRulePayload<'a, 'b> { impl<'a, 'b> FixedRulePayload<'a, 'b> {
/// Get the total number of input relations.
pub fn inputs_count(&self) -> usize {
self.manifest.relations_count()
}
/// Get the input relation at `idx`. /// Get the input relation at `idx`.
pub fn get_input(&self, idx: usize) -> Result<FixedRuleInputRelation<'a, 'b>> { pub fn get_input(&self, idx: usize) -> Result<FixedRuleInputRelation<'a, 'b>> {
let arg_manifest = self.manifest.relation(idx)?; let arg_manifest = self.manifest.relation(idx)?;

Loading…
Cancel
Save