pub struct SelectionRequest {
pub source: SelectionSource,
pub selectors: Vec<String>,
pub query: Option<String>,
pub scope: SelectionScope,
}Expand description
The selection the user asked for, and which grammar they used.
Three separate flags rather than one --select whose value might be a filter:
the contract’s --select <selectors|filter|search> is ambiguous about which
grammar a value belongs to, and a bulk operation that guesses wrong edits a
different set of issues than the user read on screen. One flag per grammar, exactly
one required.
Fields§
§source: SelectionSource§selectors: Vec<String>Comma-separated selectors, already split and trimmed.
query: Option<String>The query, for Filter and Search.
scope: SelectionScopeImplementations§
Source§impl SelectionRequest
impl SelectionRequest
Sourcepub fn new(
selectors: &[String],
filter: Option<&str>,
search: Option<&str>,
scope: SelectionScope,
) -> Result<Self>
pub fn new( selectors: &[String], filter: Option<&str>, search: Option<&str>, scope: SelectionScope, ) -> Result<Self>
Build a request, refusing anything that is not exactly one grammar.
Zero grammars and two grammars are the same error, because both mean the command line does not say which set of issues to act on. The message names all three so a user does not have to guess what else to try.
Trait Implementations§
Source§impl Clone for SelectionRequest
impl Clone for SelectionRequest
Source§impl Debug for SelectionRequest
impl Debug for SelectionRequest
impl Eq for SelectionRequest
Source§impl PartialEq for SelectionRequest
impl PartialEq for SelectionRequest
impl StructuralPartialEq for SelectionRequest
Auto Trait Implementations§
impl Freeze for SelectionRequest
impl RefUnwindSafe for SelectionRequest
impl Send for SelectionRequest
impl Sync for SelectionRequest
impl Unpin for SelectionRequest
impl UnsafeUnpin for SelectionRequest
impl UnwindSafe for SelectionRequest
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more