Skip to content

Commit a48e225

Browse files
ErikDeSmedtcdecker
authored andcommitted
Implement is_some for cln_rpc::options::Value
Can be used to check if a configuration is set
1 parent c404ebe commit a48e225

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugins/src/options.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ impl Value {
6363
_ => None,
6464
}
6565
}
66+
67+
/// Return `true` if the option is not None and `false` otherwise.
68+
pub fn is_some(&self) -> bool {
69+
match self {
70+
Value::String(_) => false,
71+
Value::Integer(_) => false,
72+
Value::Boolean(_) => false,
73+
Value::OptString => true,
74+
Value::OptInteger => true,
75+
Value::OptBoolean => true,
76+
}
77+
}
6678
}
6779

6880
/// An stringly typed option that is passed to

0 commit comments

Comments
 (0)