pub struct Candidate<'a> {
pub value: String,
pub kind: CandidateKind,
pub display: Option<Cow<'a, str>>,
pub description: Option<Cow<'a, str>>,
}Expand description
Something a shell could offer at the cursor.
value is what the shell inserts. display may replace it in shells whose completion API
separates presentation from insertion, and description is the help shown beside it.
Fields§
§value: String§kind: CandidateKind§display: Option<Cow<'a, str>>A presentation-only label. Zsh and PowerShell support this distinction; other shells
display Self::value because their native candidate format couples the two.
description: Option<Cow<'a, str>>Borrowed from the spec where it is already there, owned where a callback made it.
Implementations§
Source§impl Candidate<'_>
impl Candidate<'_>
Sourcepub fn new(value: impl Into<String>) -> Candidate<'_>
pub fn new(value: impl Into<String>) -> Candidate<'_>
A candidate with nothing to say about itself.
Sourcepub fn described(
value: impl Into<String>,
description: impl Into<String>,
) -> Candidate<'_>
pub fn described( value: impl Into<String>, description: impl Into<String>, ) -> Candidate<'_>
A candidate and the line a shell shows beside it.
Sourcepub fn displayed(self, display: impl Into<String>) -> Candidate<'_>
pub fn displayed(self, display: impl Into<String>) -> Candidate<'_>
Use a different label in shells that can display one value while inserting another.
Sourcepub fn with_kind(self, kind: CandidateKind) -> Candidate<'_>
pub fn with_kind(self, kind: CandidateKind) -> Candidate<'_>
Classify the candidate for shells that present semantic result types.
Trait Implementations§
impl<'a> Eq for Candidate<'a>
Source§impl<'a> Ord for Candidate<'a>
impl<'a> Ord for Candidate<'a>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialOrd for Candidate<'a>
impl<'a> PartialOrd for Candidate<'a>
impl<'a> StructuralPartialEq for Candidate<'a>
Auto Trait Implementations§
impl<'a> Freeze for Candidate<'a>
impl<'a> RefUnwindSafe for Candidate<'a>
impl<'a> Send for Candidate<'a>
impl<'a> Sync for Candidate<'a>
impl<'a> Unpin for Candidate<'a>
impl<'a> UnsafeUnpin for Candidate<'a>
impl<'a> UnwindSafe for Candidate<'a>
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