pub struct FilterValue { /* private fields */ }Expand description
What a request carries for one filter: the values its f.<name> parameter repeats, in the
order the request carries them, and the parts its f.<name>.<part> parameters name.
A blank value is no value, and a value or part the filter holds already is not added again. Nor is one past what the URL codec carries — 64 values and parts, each part and value at most 256 bytes — which would spell a link the next request drops and flags.
use tablo_core::{FilterValue, TableState};
let state = TableState::from_query("f.status=draft&f.status=review&f.created.from=2024-01-01");
assert_eq!(state.filters["status"].values(), ["draft", "review"]);
assert_eq!(state.filters["status"].single(), None);
assert_eq!(state.filters["created"].part("from"), Some("2024-01-01"));
assert_eq!(FilterValue::from("draft").single(), Some("draft"));Implementations§
Source§impl FilterValue
impl FilterValue
Sourcepub fn new() -> FilterValue
pub fn new() -> FilterValue
No value.
Sourcepub fn with(self, value: impl Into<String>) -> FilterValue
pub fn with(self, value: impl Into<String>) -> FilterValue
This value with value, trimmed, after the values it holds; one past the caps adds
nothing.
Sourcepub fn with_part(
self,
part: impl Into<String>,
value: impl Into<String>,
) -> FilterValue
pub fn with_part( self, part: impl Into<String>, value: impl Into<String>, ) -> FilterValue
This value with part holding value, trimmed, unless it holds part already; one past
the caps adds nothing.
Trait Implementations§
Source§impl Clone for FilterValue
impl Clone for FilterValue
Source§fn clone(&self) -> FilterValue
fn clone(&self) -> FilterValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FilterValue
impl Debug for FilterValue
Source§impl Default for FilterValue
impl Default for FilterValue
Source§fn default() -> FilterValue
fn default() -> FilterValue
Returns the “default value” for a type. Read more
impl Eq for FilterValue
Source§impl From<&str> for FilterValue
impl From<&str> for FilterValue
Source§fn from(value: &str) -> FilterValue
fn from(value: &str) -> FilterValue
Converts to this type from the input type.
Source§impl From<String> for FilterValue
impl From<String> for FilterValue
Source§fn from(value: String) -> FilterValue
fn from(value: String) -> FilterValue
Converts to this type from the input type.
Source§impl PartialEq for FilterValue
impl PartialEq for FilterValue
impl StructuralPartialEq for FilterValue
Auto Trait Implementations§
impl Freeze for FilterValue
impl RefUnwindSafe for FilterValue
impl Send for FilterValue
impl Sync for FilterValue
impl Unpin for FilterValue
impl UnsafeUnpin for FilterValue
impl UnwindSafe for FilterValue
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.