diff --git a/libosdp/src/pdinfo.rs b/libosdp/src/pdinfo.rs index a734d6a..ae778bc 100644 --- a/libosdp/src/pdinfo.rs +++ b/libosdp/src/pdinfo.rs @@ -81,8 +81,8 @@ impl PdInfoBuilder { /// Set PD ID; Static information that the PD reports to the CP when it /// received a `CMD_ID`. For CP mode, this field is ignored, but PD mode /// must set - pub fn id(mut self, id: PdId) -> PdInfoBuilder { - self.id = id; + pub fn id(mut self, id: &PdId) -> PdInfoBuilder { + self.id = id.clone(); self } @@ -92,6 +92,16 @@ impl PdInfoBuilder { self } + /// Set multiple capabilities at once + pub fn capabilities<'a, I>(mut self, caps: I) -> PdInfoBuilder + where I: IntoIterator, + { + for cap in caps { + self.cap.push(cap.clone().into()); + } + self + } + /// Set Osdp communication channel pub fn channel(mut self, channel: Box) -> PdInfoBuilder { self.channel = Some(channel);