imdl 0.1.16

📦 A 40' shipping container for the internet
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::common::*;

pub(crate) fn xor_args<T: Clone>(
  a_name: &str,
  a: Option<&T>,
  b_name: &str,
  b: Option<&T>,
) -> Result<T> {
  let target = a.xor(b).ok_or_else(|| {
    Error::internal(format!(
      "Expected exactly one of the arguments `{a_name}` or `{b_name}` to be set",
    ))
  })?;

  Ok(target.clone())
}