diff --git a/src/interface/iface.rs b/src/interface/iface.rs index 684cfc1c..84dfec26 100644 --- a/src/interface/iface.rs +++ b/src/interface/iface.rs @@ -208,25 +208,58 @@ pub struct AssignIface { } impl AssignIface { - pub fn public(state_ty: Option, attach: Option, req: Req) -> Self { + pub fn optional() -> Self { AssignIface { - state_ty, - attach, - public: true, - required: req.is_required(), - multiple: req.is_multiple(), + state_ty: None, + attach: None, + public: false, + required: false, + multiple: false, } } - - pub fn private(state_ty: Option, attach: Option, req: Req) -> Self { + pub fn required() -> Self { AssignIface { - state_ty, - attach, + state_ty: None, + attach: None, public: false, - required: req.is_required(), - multiple: req.is_multiple(), + required: true, + multiple: false, + } + } + pub fn none_or_many() -> Self { + AssignIface { + state_ty: None, + attach: None, + public: false, + required: false, + multiple: true, } } + pub fn one_or_many() -> Self { + AssignIface { + state_ty: None, + attach: None, + public: false, + required: true, + multiple: true, + } + } + pub fn public(mut self) -> Self { + self.public = true; + self + } + pub fn rights(mut self) -> Self { + self.state_ty = Some(SemId::default()); + self + } + pub fn typed(mut self, sem_id: SemId) -> Self { + self.state_ty = Some(sem_id); + self + } + pub fn attachments(mut self, require: bool) -> Self { + self.attach = Some(require); + self + } } pub type ArgMap = TinyOrdMap;