Debian Codegraph @

src/engine/candidate.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#;
3
4 use claprust-analyzer cargo clap 4.6.6 crate/::builderrust-analyzer cargo clap_builder 4.6.6 builder/::StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#;
5
6 /// A shell-agnostic completion candidate
7 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)]
8 pub struct CompletionCandidaterust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate# {
9 valuerust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#value.: OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#,
10 helprust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#help.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#>,
11 idrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#id.: 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#>,
12 tagrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#tag.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#>,
13 display_orderrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#display_order.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>,
14 hiddenrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#hidden.: bool,
15 }
16
17 impl CompletionCandidaterust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate# {
18 /// Create a new completion candidate
19 pub fn newrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]new().(value: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
20 let value = value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
21 Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
22 valuerust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#value.,
23 ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate][Default]default().()
24 }
25 }
26
27 /// Set the help message of the completion candidate
28 pub fn helprust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]help().(mut self, help: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#>) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
29 self.helprust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#help. = help;
30 self
31 }
32
33 /// Only first for a given Id is shown
34 ///
35 /// To reduce the risk of conflicts, this should likely contain a namespace.
36 pub fn idrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]id().(mut self, id: 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#>) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
37 self.idrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#id. = id;
38 self
39 }
40
41 /// Group candidates by tag
42 ///
43 /// Future: these may become user-visible
44 pub fn tagrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]tag().(mut self, tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#>) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
45 self.tagrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#tag. = tag;
46 self
47 }
48
49 /// Sort weight within a [`CompletionCandidate::tag`]
50 pub fn display_orderrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]display_order().(mut self, order: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
51 self.display_orderrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#display_order. = order;
52 self
53 }
54
55 /// Set the visibility of the completion candidate
56 ///
57 /// Only shown when there is no visible candidate for completing the current argument.
58 pub fn hiderust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]hide().(mut self, hidden: bool) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
59 self.hiddenrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#hidden. = hidden;
60 self
61 }
62
63 /// Add a prefix to the value of completion candidate
64 ///
65 /// This is generally used for post-process by [`complete`][crate::engine::complete()] for
66 /// things like prepending flags, merging delimiter-separated values, etc.
67 pub fn add_prefixrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]add_prefix().(mut self, prefix: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate] {
68 let suffix = self.valuerust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#value.;
69 let mut value = prefix.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
70 value.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]push().(&suffix);
71 self.valuerust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#value. = value;
72 self
73 }
74 }
75
76 /// Reflection API
77 impl CompletionCandidaterust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate# {
78 /// Get the literal value being proposed for completion
79 pub fn get_valuerust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]get_value().(&self) -> &OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr# {
80 &self.valuerust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#value.
81 }
82
83 /// Get the help message of the completion candidate
84 pub fn get_helprust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]get_help().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#> {
85 self.helprust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#help..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
86 }
87
88 /// Get the id used for de-duplicating
89 pub fn get_idrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]get_id().(&self) -> 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#> {
90 self.idrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#id..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
91 }
92
93 /// Get the grouping tag
94 pub fn get_tagrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]get_tag().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&StyledStrrust-analyzer cargo clap_builder 4.6.6 builder/styled_str/StyledStr#> {
95 self.tagrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#tag..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()
96 }
97
98 /// Get the grouping tag
99 pub fn get_display_orderrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]get_display_order().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize> {
100 self.display_orderrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#display_order.
101 }
102
103 /// Get the visibility of the completion candidate
104 pub fn is_hide_setrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]is_hide_set().(&self) -> bool {
105 self.hiddenrust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#hidden.
106 }
107 }
108
109 impl<S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<S> for CompletionCandidaterust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate# {
110 fn fromrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate][`From<S>`]from().(s: S) -> Selfrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate][`From<S>`] {
111 CompletionCandidaterust-analyzer cargo clap_complete 4.6.8 engine/candidate/CompletionCandidate#::newrust-analyzer cargo clap_complete 4.6.8 engine/candidate/impl#[CompletionCandidate]new().(s.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())
112 }
113 }