1pub(crate) fn empty_or_none<T>(input: &[T]) -> Option<&[T]> {
2 if input.is_empty() {
3 None
4 } else {
5 Some(input)
6 }
7}
8
9#[inline]
10pub(crate) fn copy_on_push_vec<T>(input: &[T], el: T) -> Vec<T>
11where
12 T: Clone,
13{
14 let mut new_vec: Vec = Vec::with_capacity(input.len() + 1);
15 new_vec.extend_from_slice(input);
16 new_vec.push(el);
17 new_vec
18}
19
20#[inline]
21pub(crate) fn extend(base: &mut Vec<String>, slice: &[String]) {
22 for i: &String in slice {
23 base.push(i.to_owned());
24 }
25}
26