Skip to main content

hydrus_api/wrapper/builders/
or_chain_builder.rs

1use crate::wrapper::or_chain::OrChain;
2use crate::wrapper::tag::Tag;
3
4#[derive(Debug)]
5pub struct OrChainBuilder {
6    tags: Vec<Tag>,
7}
8
9impl OrChainBuilder {
10    pub fn new() -> Self {
11        Self { tags: Vec::new() }
12    }
13
14    /// Adds a tag to the or expression
15    pub fn add_tag(mut self, tag: Tag) -> Self {
16        self.tags.push(tag);
17        self
18    }
19
20    /// Adds multiple tags to the or expression
21    pub fn add_tags(mut self, mut tags: Vec<Tag>) -> Self {
22        self.tags.append(&mut tags);
23        self
24    }
25
26    /// Builds the or chain
27    pub fn build(self) -> OrChain {
28        OrChain::new(self.tags)
29    }
30}