Implement is_some for cln_rpc::options::Value

Can be used to check if a configuration is set
This commit is contained in:
Erik De Smedt 2023-11-24 14:21:53 +01:00 committed by Christian Decker
parent c404ebedcc
commit a48e2258c7

View file

@ -63,6 +63,18 @@ impl Value {
_ => None,
}
}
/// Return `true` if the option is not None and `false` otherwise.
pub fn is_some(&self) -> bool {
match self {
Value::String(_) => false,
Value::Integer(_) => false,
Value::Boolean(_) => false,
Value::OptString => true,
Value::OptInteger => true,
Value::OptBoolean => true,
}
}
}
/// An stringly typed option that is passed to