Struct merino_suggest_traits::SuggestionResponse
source · [−]pub struct SuggestionResponse {
pub cache_status: CacheStatus,
pub cache_ttl: Option<Duration>,
pub suggestions: Vec<Suggestion>,
}
Expand description
A response of suggestions, along with related metadata.
Fields
cache_status: CacheStatus
The relation of this response to the cache it came from, if any.
cache_ttl: Option<Duration>
The remaining time the response is valid, if applicable. If None
, their
is no recommended TTL value. Caching layers may provide one if
appropriate. No value should be cached forever.
suggestions: Vec<Suggestion>
The suggestions to provide to the user.
Implementations
sourceimpl SuggestionResponse
impl SuggestionResponse
sourcepub fn new(suggestions: Vec<Suggestion>) -> Self
pub fn new(suggestions: Vec<Suggestion>) -> Self
Create a new suggestion response containing the given suggestions and cache status.
The json
field will be None
.
sourcepub fn with_cache_status(self, cache_status: CacheStatus) -> Self
pub fn with_cache_status(self, cache_status: CacheStatus) -> Self
Change the cache status of this response.
sourcepub fn with_cache_ttl(self, cache_ttl: Duration) -> Self
pub fn with_cache_ttl(self, cache_ttl: Duration) -> Self
Change the cache TTL of this response.
Trait Implementations
sourceimpl Clone for SuggestionResponse
impl Clone for SuggestionResponse
sourcefn clone(&self) -> SuggestionResponse
fn clone(&self) -> SuggestionResponse
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SuggestionResponse
impl Debug for SuggestionResponse
Auto Trait Implementations
impl RefUnwindSafe for SuggestionResponse
impl Send for SuggestionResponse
impl Sync for SuggestionResponse
impl Unpin for SuggestionResponse
impl UnwindSafe for SuggestionResponse
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more