| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#, fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#}; |
| 2 | |
| 3 | use humantimerust-analyzer cargo humantime 2.3.0 crate/::parse_durationrust-analyzer cargo humantime 2.3.0 duration/parse_duration().; |
| 4 | |
| 5 | use craterust-analyzer cargo bottom 0.14.9 crate/::{ |
| 6 | collectionrust-analyzer cargo bottom 0.14.9 collection/::processesrust-analyzer cargo bottom 0.14.9 collection/processes/::ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#, |
| 7 | utilsrust-analyzer cargo bottom 0.14.9 utils/::data_unitsrust-analyzer cargo bottom 0.14.9 utils/data_units/::*, |
| 8 | widgetsrust-analyzer cargo bottom 0.14.9 widgets/::queryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/::{ |
| 9 | Andrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And#, NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#, Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#, PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#, ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#, QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#, QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#, |
| 10 | QueryProcessorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryProcessor#, QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#, TimeQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery#, |
| 11 | attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/::{new_numerical_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_numerical_attribute()., new_string_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_string_attribute()., new_time_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_time_attribute().}, |
| 12 | errorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/::QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#, |
| 13 | }, |
| 14 | }; |
| 15 | |
| 16 | #[inline] |
| 17 | fn process_prefix_unitsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/process_prefix_units().(query: &mut VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, value: &mut f64) { |
| 18 | // If no unit, assume base. |
| 19 | // |
| 20 | // Furthermore, base must be PEEKED at initially, and will |
| 21 | // require (likely) prefix_type specific checks |
| 22 | // Lastly, if it *is* a unit, remember to POP! |
| 23 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(potential_unit) = query.frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]front().() { |
| 24 | if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("tb") { |
| 25 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().TERA_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/TERA_LIMIT_F64.; |
| 26 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 27 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("tib") { |
| 28 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().TEBI_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/TEBI_LIMIT_F64.; |
| 29 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 30 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("gb") { |
| 31 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().GIGA_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/GIGA_LIMIT_F64.; |
| 32 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 33 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("gib") { |
| 34 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().GIBI_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/GIBI_LIMIT_F64.; |
| 35 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 36 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("mb") { |
| 37 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().MEGA_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/MEGA_LIMIT_F64.; |
| 38 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 39 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("mib") { |
| 40 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().MEBI_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/MEBI_LIMIT_F64.; |
| 41 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 42 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("kb") { |
| 43 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().KILO_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/KILO_LIMIT_F64.; |
| 44 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 45 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("kib") { |
| 46 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().*=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`MulAssign<Self>`]mul_assign().KIBI_LIMIT_F64rust-analyzer cargo bottom 0.14.9 utils/data_units/KIBI_LIMIT_F64.; |
| 47 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 48 | } else if potential_unit.eq_ignore_ascii_caserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]eq_ignore_ascii_case().("b") { |
| 49 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// Either contains a further `Or` recursively, or an attribute that can be |
| 55 | /// queried, possibly as part of a larger query. |
| 56 | /// |
| 57 | /// In theory, this can be made generic to work on all table types, though for |
| 58 | /// now, it's hardcoded for processes. |
| 59 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 60 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) enum Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix# { |
| 61 | /// True if the inner OR is true (allowing a recursive tree). |
| 62 | Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Or#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#>), |
| 63 | /// A leaf node. |
| 64 | Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#), |
| 65 | /// Invert the match result of the inner prefix. |
| 66 | /// |
| 67 | /// TODO: Also support reading with "not". |
| 68 | Negaterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Negate#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#>), |
| 69 | } |
| 70 | |
| 71 | impl Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix# { |
| 72 | pub(superrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/) fn checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix]check().(&self, process: &ProcessHarvestrust-analyzer cargo bottom 0.14.9 collection/processes/ProcessHarvest#, is_using_command: bool) -> bool { |
| 73 | match self { |
| 74 | Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Or#(or) => or.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/impl#[Or]check().(process, is_using_command), |
| 75 | Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(attribute) => attribute.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/impl#[ProcessAttribute]check().(process, is_using_command), |
| 76 | Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Negaterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Negate#(inner) => !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().inner.checkrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix]check().(process, is_using_command), |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | fn process_in_quotesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix]process_in_quotes().( |
| 81 | query: &mut VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, options: &QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#, |
| 82 | ) -> QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#<Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix]> { |
| 83 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_top) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 84 | if queue_top rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."\"" { |
| 85 | // This means we hit something like "". Return an empty prefix, and to deal |
| 86 | // with the close quote checker, add one to the top of the |
| 87 | // stack. Ugly fix but whatever. |
| 88 | query.push_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]push_front().("\"".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 89 | |
| 90 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(ProcessAttributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#::Emptyrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/ProcessAttribute#Empty#)) |
| 91 | } else { |
| 92 | let mut intern_string = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![queue_top]; |
| 93 | |
| 94 | // TODO: I think this should consume the quote...? Might need to check the other |
| 95 | // spot we process quotes. |
| 96 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_str) = query.frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]front().() { |
| 97 | if next_str rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."\"" { |
| 98 | break; |
| 99 | } else { |
| 100 | intern_string.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().().expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("we just peeked at the front")); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | let quoted_string = intern_string.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(" "); |
| 105 | |
| 106 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(new_string_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_string_attribute().( |
| 107 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Name#, |
| 108 | "ed_string, |
| 109 | options, |
| 110 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 111 | } |
| 112 | } else { |
| 113 | // Uh oh, there's nothing left in the stack, but we're inside quotes! |
| 114 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing closing quotation")) |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | impl QueryProcessorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryProcessor# for Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix# { |
| 120 | fn processrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix][QueryProcessor]process().(query: &mut VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, options: &QueryOptionsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryOptions#) -> QueryResultrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryResult#<Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix][QueryProcessor]> |
| 121 | where |
| 122 | Selfrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix][QueryProcessor]: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 123 | { |
| 124 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(curr) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 125 | if curr rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."(" { |
| 126 | if query.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]is_empty().() { |
| 127 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing closing parentheses")); |
| 128 | } |
| 129 | |
| 130 | let mut list_of_ors = VecDequerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/VecDeque#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T>`]new().(); |
| 131 | |
| 132 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(in_paren_query_top) = query.frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]front().() { |
| 133 | if in_paren_query_top rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().")" { |
| 134 | list_of_ors.push_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]push_back().(Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#::processrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/impl#[Or][QueryProcessor]process().(query, options)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 135 | } else { |
| 136 | break; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(front) = list_of_ors.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() else { |
| 141 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("No values within parentheses group")); |
| 142 | }; |
| 143 | |
| 144 | // Now convert this back to a OR... |
| 145 | // TODO: is there a better way to do this than converting it? |
| 146 | let initial_or = Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or# { |
| 147 | lhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#lhs.: Andrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And# { |
| 148 | lhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And#lhs.: Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Or#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(front)), |
| 149 | rhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And#rhs.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 150 | }, |
| 151 | rhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#rhs.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 152 | }; |
| 153 | let returned_or = list_of_ors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`][IntoIterator]into_iter().().foldrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/into_iter/impl#[`IntoIter<T, A>`][Iterator]fold().(initial_or, |lhs, rhs| Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or# { |
| 154 | lhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#lhs.: Andrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And# { |
| 155 | lhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And#lhs.: Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Or#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(lhs)), |
| 156 | rhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/and/And#rhs.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Or#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(rhs)))), |
| 157 | }, |
| 158 | rhsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/or/Or#rhs.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 159 | }); |
| 160 | |
| 161 | return if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(close_paren) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 162 | if close_paren rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().")" { |
| 163 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Orrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Or#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(returned_or))) |
| 164 | } else { |
| 165 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing closing parentheses")) |
| 166 | } |
| 167 | } else { |
| 168 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing closing parentheses")) |
| 169 | }; |
| 170 | } else if curr rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().")" { |
| 171 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing opening parentheses")); |
| 172 | } else if curr rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."!" { |
| 173 | // Negation prefix: `!<expr>` inverts the match of the following |
| 174 | // expression. Handles: |
| 175 | // - Groups (`!(a or b)`) |
| 176 | // - Quoted names (`!"foo"`) |
| 177 | // - Bare names (`!foo`) |
| 178 | // - Stacked `!` (`!!foo`). |
| 179 | match query.frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]front().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| s.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) { |
| 180 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("=") | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(">") | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("<") | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(")") => { |
| 181 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().( |
| 182 | "`!` must be followed by an expression; use `\"!\"` to match a literal `!`", |
| 183 | )); |
| 184 | } |
| 185 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next) if next rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."(" && next rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."\"" && next rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."!" => { |
| 186 | let next: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#, QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#> = next.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().(); |
| 187 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(next, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Name#)) { |
| 188 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().( |
| 189 | "`!` cannot be applied to a prefix keyword; use `!=`, `<=`, `>=` or group with `!(...)` instead", |
| 190 | )); |
| 191 | } |
| 192 | } |
| 193 | _ => {} |
| 194 | } |
| 195 | let inner = Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::processrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix][QueryProcessor]process().(query, options)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 196 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Negaterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Negate#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(inner))); |
| 197 | } else if curr rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."\"" { |
| 198 | // Similar to parentheses, trap and check for missing closing quotes. Note, |
| 199 | // however, that we will DIRECTLY call another process_prefix |
| 200 | // call... |
| 201 | |
| 202 | let prefix = Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::process_in_quotesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/impl#[Prefix]process_in_quotes().(query, options)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 203 | return if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(close_quote) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 204 | if close_quote rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."\"" { |
| 205 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(prefix) |
| 206 | } else { |
| 207 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing closing quotation")) |
| 208 | } |
| 209 | } else { |
| 210 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing closing quotation")) |
| 211 | }; |
| 212 | } else { |
| 213 | // Get prefix type. |
| 214 | let prefix_type = curr.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 215 | |
| 216 | // TODO: Separate these cases here and below. |
| 217 | let content = if let PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Name# = prefix_type { |
| 218 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(curr) |
| 219 | } else { |
| 220 | query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() |
| 221 | }; |
| 222 | |
| 223 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(content) = content { |
| 224 | match &prefix_type { |
| 225 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Namerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Name# => { |
| 226 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(new_string_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_string_attribute().( |
| 227 | prefix_type, |
| 228 | &content, |
| 229 | options, |
| 230 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)); |
| 231 | } |
| 232 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Pidrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Pid# | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Staterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#State# | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Userrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#User# => { |
| 233 | // We have to check if someone put an (in)equality check... |
| 234 | if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."=" || content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."!=" { |
| 235 | let negate = content.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('!'); |
| 236 | |
| 237 | // Check next string if possible |
| 238 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(string_value) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 239 | if string_value rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."!" { |
| 240 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().( |
| 241 | "`!` is reserved; use `\"!\"` to match the literal character", |
| 242 | )); |
| 243 | } |
| 244 | // TODO: [Query] Need to consider the following cases: |
| 245 | // - (test) |
| 246 | // - (test |
| 247 | // - test) |
| 248 | // These are split into 2 to 3 different strings due to |
| 249 | // parentheses being |
| 250 | // delimiters in our query system. |
| 251 | // |
| 252 | // Do we want these to be valid? They should, as a string, |
| 253 | // right? |
| 254 | |
| 255 | // We also must check if this value is wrapped in quotes! |
| 256 | let final_value = if string_value rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."\"" { |
| 257 | let mut intern_string = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 258 | |
| 259 | // Keep parsing until we either hit another quotation or we |
| 260 | // error. |
| 261 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_string) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 262 | if next_string rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."\"" { |
| 263 | break; |
| 264 | } |
| 265 | |
| 266 | intern_string.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(next_string); |
| 267 | } |
| 268 | |
| 269 | intern_string.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(" ") |
| 270 | } else { |
| 271 | string_value |
| 272 | }; |
| 273 | |
| 274 | let inner_attribute = Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(new_string_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_string_attribute().( |
| 275 | prefix_type, |
| 276 | &final_value, |
| 277 | options, |
| 278 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 279 | |
| 280 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(if negate { |
| 281 | Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Negaterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Negate#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(inner_attribute)) |
| 282 | } else { |
| 283 | inner_attribute |
| 284 | }); |
| 285 | } |
| 286 | } else if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."!" { |
| 287 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().( |
| 288 | "`!` is reserved; use `\"!\"` to match the literal character", |
| 289 | )); |
| 290 | } else { |
| 291 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(new_string_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_string_attribute().( |
| 292 | prefix_type, |
| 293 | &content, |
| 294 | options, |
| 295 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)); |
| 296 | } |
| 297 | } |
| 298 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::Timerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#Time# => { |
| 299 | let mut condition: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 300 | let mut duration_string: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 301 | |
| 302 | if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."=" { |
| 303 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::Equalrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#Equal#); |
| 304 | duration_string = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 305 | } else if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."!=" { |
| 306 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::NotEqualrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#NotEqual#); |
| 307 | duration_string = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 308 | } else if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().">" || content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."<" { |
| 309 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_next) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 310 | if queue_next rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."=" { |
| 311 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().">" { |
| 312 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::GreaterOrEqualrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#GreaterOrEqual# |
| 313 | } else { |
| 314 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::LessOrEqualrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#LessOrEqual# |
| 315 | }); |
| 316 | duration_string = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 317 | } else { |
| 318 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().">" { |
| 319 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::Greaterrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#Greater# |
| 320 | } else { |
| 321 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::Lessrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#Less# |
| 322 | }); |
| 323 | duration_string = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_next); |
| 324 | } |
| 325 | } else { |
| 326 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::missing_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]missing_value().()); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(condition) = condition { |
| 331 | let duration = parse_durationrust-analyzer cargo humantime 2.3.0 duration/parse_duration().( |
| 332 | &duration_string.ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::missing_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]missing_value().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 333 | ) |
| 334 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().(err.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 335 | |
| 336 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(new_time_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_time_attribute().( |
| 337 | prefix_type, |
| 338 | TimeQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery# { |
| 339 | conditionrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery#condition., |
| 340 | durationrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/TimeQuery#duration., |
| 341 | }, |
| 342 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)); |
| 343 | } |
| 344 | } |
| 345 | _ => { |
| 346 | // Assume it's some numerical value. Now we gotta parse the content... yay. |
| 347 | // Note that for numerical parsing, we handle unit parsing later, not here. |
| 348 | |
| 349 | let mut condition: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 350 | let mut value: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<f64> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 351 | |
| 352 | // TODO: Jeez, what the heck did I write here... add some tests and |
| 353 | // clean this up in the future. |
| 354 | if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."=" { |
| 355 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::Equalrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#Equal#); |
| 356 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_next) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 357 | value = queue_next.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<f64>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 358 | } else { |
| 359 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::missing_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]missing_value().()); |
| 360 | } |
| 361 | } else if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."!=" { |
| 362 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::NotEqualrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#NotEqual#); |
| 363 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_next) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 364 | value = queue_next.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<f64>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 365 | } else { |
| 366 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::missing_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]missing_value().()); |
| 367 | } |
| 368 | } else if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().">" || content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."<" { |
| 369 | // We also have to check if the next string is an "="... |
| 370 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_next) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 371 | if queue_next rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."=" { |
| 372 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().">" { |
| 373 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::GreaterOrEqualrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#GreaterOrEqual# |
| 374 | } else { |
| 375 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::LessOrEqualrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#LessOrEqual# |
| 376 | }); |
| 377 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(queue_next_next) = query.pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().() { |
| 378 | value = queue_next_next.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<f64>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 379 | } else { |
| 380 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::missing_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]missing_value().()); |
| 381 | } |
| 382 | } else { |
| 383 | condition = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(if content rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().">" { |
| 384 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::Greaterrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#Greater# |
| 385 | } else { |
| 386 | QueryComparisonrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#::Lessrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/QueryComparison#Less# |
| 387 | }); |
| 388 | value = queue_next.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<f64>().okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 389 | } |
| 390 | } else { |
| 391 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::missing_valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]missing_value().()); |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(condition) = condition |
| 396 | && let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(read_value) = value |
| 397 | { |
| 398 | // Note that the values *might* have a unit or need to be parsed |
| 399 | // differently based on the |
| 400 | // prefix type! |
| 401 | |
| 402 | // TODO: Support this without spaces? |
| 403 | |
| 404 | let mut value = read_value; |
| 405 | |
| 406 | match prefix_type { |
| 407 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::MemBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#MemBytes# |
| 408 | | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::ReadPerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#ReadPerSecond# |
| 409 | | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::WritePerSecondrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#WritePerSecond# |
| 410 | | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::TotalReadrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#TotalRead# |
| 411 | | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::TotalWriterust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#TotalWrite# => { |
| 412 | process_prefix_unitsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/process_prefix_units().(query, &mut value); |
| 413 | } |
| 414 | #[cfg(feature = "gpu")] |
| 415 | PrefixTyperust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#::GpuMemoryBytesrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/PrefixType#GpuMemoryBytes# => { |
| 416 | process_prefix_unitsrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/process_prefix_units().(query, &mut value); |
| 417 | } |
| 418 | _ => {} |
| 419 | } |
| 420 | |
| 421 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#::Attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/prefix/Prefix#Attribute#(new_numerical_attributerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/attribute/new_numerical_attribute().( |
| 422 | prefix_type, |
| 423 | NumericalQueryrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery# { conditionrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#condition., valuerust-analyzer cargo bottom 0.14.9 widgets/process_table/query/NumericalQuery#value. }, |
| 424 | )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)); |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | } else { |
| 429 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Missing argument for search prefix")); |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | // TODO: Give more information here (e.g. closest query?), though this is moreso |
| 435 | // meant as a fallback. |
| 436 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(QueryErrorrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/QueryError#::newrust-analyzer cargo bottom 0.14.9 widgets/process_table/query/error/impl#[QueryError]new().("Invalid query")) |
| 437 | } |
| 438 | } |