1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use azure_core::{
    headers::{self, Header},
    Etag,
};
use headers::IF_MATCH;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum IfMatchCondition {
    Etag(Etag),
    Any,
}

impl From<Etag> for IfMatchCondition {
    fn from(etag: Etag) -> Self {
        Self::Etag(etag)
    }
}

impl Header for IfMatchCondition {
    fn name(&self) -> headers::HeaderName {
        IF_MATCH
    }

    fn value(&self) -> headers::HeaderValue {
        match self {
            IfMatchCondition::Etag(etag) => etag.to_string(),
            IfMatchCondition::Any => "*".to_owned(),
        }
        .into()
    }
}