use super::expose::TagExposeContract;
use crate::{LocalExchange, TagDescriptor, TagObserveContract};
#[must_use = "Call .expose() or .observe() at the end of the build chain."]
pub struct TagContractBuilder {
local_exchange: LocalExchange,
descriptor: TagDescriptor,
}
impl TagContractBuilder {
pub(crate) fn new(local_exchange: LocalExchange, descriptor: TagDescriptor) -> TagContractBuilder {
TagContractBuilder { local_exchange, descriptor }
}
pub fn observe(self) -> TagObserveContract {
let tag_core = self.local_exchange.shared.tag_acquire(&self.descriptor);
TagObserveContract::new(self.local_exchange, tag_core)
}
pub fn expose(self) -> TagExposeContract {
let tag_core = self.local_exchange.shared.tag_acquire(&self.descriptor);
TagExposeContract::new(self.local_exchange, tag_core, 1000)
}
}