Split word search into its own file too.
This commit is contained in:
parent
93576a3e34
commit
5501c621c9
4 changed files with 322 additions and 310 deletions
33
src/aux.rs
Normal file
33
src/aux.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use crate::Value;
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct Options {
|
||||
pub limit: usize,
|
||||
pub query: String,
|
||||
pub interactive: bool,
|
||||
}
|
||||
|
||||
//
|
||||
// --- Value helper
|
||||
//
|
||||
|
||||
pub fn value_to_bool(value: &Value) -> bool {
|
||||
match value {
|
||||
Value::Bool(b) => *b,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn value_to_str(value: &Value) -> &str {
|
||||
match value {
|
||||
Value::String(s) => s,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn value_to_arr(value: &Value) -> &Vec<Value> {
|
||||
match value {
|
||||
Value::Array(a) => a,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue