#[non_exhaustive]pub struct CompletionRequest {
pub target: CompletionTarget,
pub argument: String,
pub value: String,
pub resolved: BTreeMap<String, String>,
}Expand description
A request to suggest values for an argument a user is part-way through.
Completion is what makes a resource template usable: without it a client can
only show note/{path} and hope the user types a real path. It is called
while the user types, so answer from state already in memory rather than
scanning the vault on each keystroke.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.target: CompletionTargetThe prompt or resource template being filled in.
argument: StringName of the argument or template expression being completed.
value: StringWhat the user has typed so far. Often empty on the first request.
resolved: BTreeMap<String, String>Arguments of the same target the client has already resolved.
A template with more than one expression can use these to narrow later suggestions to what is reachable given the earlier choices.
Implementations§
Source§impl CompletionRequest
impl CompletionRequest
Sourcepub fn new(
target: CompletionTarget,
argument: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn new( target: CompletionTarget, argument: impl Into<String>, value: impl Into<String>, ) -> Self
Construct a request for argument with the partial input value.
Sourcepub fn with_resolved(self, resolved: BTreeMap<String, String>) -> Self
pub fn with_resolved(self, resolved: BTreeMap<String, String>) -> Self
Attach the arguments the client has already resolved.
Trait Implementations§
Source§impl Clone for CompletionRequest
impl Clone for CompletionRequest
Source§fn clone(&self) -> CompletionRequest
fn clone(&self) -> CompletionRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompletionRequest
impl Debug for CompletionRequest
impl Eq for CompletionRequest
Source§impl PartialEq for CompletionRequest
impl PartialEq for CompletionRequest
impl StructuralPartialEq for CompletionRequest
Auto Trait Implementations§
impl Freeze for CompletionRequest
impl RefUnwindSafe for CompletionRequest
impl Send for CompletionRequest
impl Sync for CompletionRequest
impl Unpin for CompletionRequest
impl UnsafeUnpin for CompletionRequest
impl UnwindSafe for CompletionRequest
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
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§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
key and return true if they are equal.