Skip to content

Commit

Permalink
Implement is_some for cln_rpc::options::Value
Browse files Browse the repository at this point in the history
Can be used to check if a configuration is set
  • Loading branch information
ErikDeSmedt committed Nov 24, 2023
1 parent 194dd2b commit 594cc47
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 594cc47

Please sign in to comment.