Struct meilisearch_sdk::key::KeyUpdater
source · [−]pub struct KeyUpdater {
pub description: Option<String>,
pub name: Option<String>,
pub key: String,
}Fields
description: Option<String>name: Option<String>key: StringImplementations
sourceimpl KeyUpdater
impl KeyUpdater
pub fn new(key_or_uid: impl AsRef<str>) -> KeyUpdater
sourcepub fn with_description(&mut self, desc: impl AsRef<str>) -> &mut Self
pub fn with_description(&mut self, desc: impl AsRef<str>) -> &mut Self
Update the description of the key.
Example
let mut new_key = KeyBuilder::new()
.execute(&client)
.await
.unwrap();
let description = "My not so little lovely test key".to_string();
let mut key_update = KeyUpdater::new(new_key)
.with_description(&description)
.execute(&client)
.await
.unwrap();
sourcepub fn with_name(&mut self, desc: impl AsRef<str>) -> &mut Self
pub fn with_name(&mut self, desc: impl AsRef<str>) -> &mut Self
Update the name of the key.
Example
let mut new_key = KeyBuilder::new()
.execute(&client)
.await
.unwrap();
let name = "lovely key".to_string();
let mut key_update = KeyUpdater::new(new_key)
.with_name(&name)
.execute(&client)
.await
.unwrap();
sourcepub async fn execute(&self, client: &Client) -> Result<Key, Error>
pub async fn execute(&self, client: &Client) -> Result<Key, Error>
Update a Key using the KeyUpdater.
Example
let client = Client::new(MEILISEARCH_HOST, MEILISEARCH_API_KEY);
let description = "My little lovely test key".to_string();
let key = KeyBuilder::new()
.execute(&client).await.unwrap();
let mut key_update = KeyUpdater::new(&key.key);
key_update.with_description(&description).execute(&client).await;
assert_eq!(key_update.description, Some(description));Trait Implementations
sourceimpl AsRef<KeyUpdater> for KeyUpdater
impl AsRef<KeyUpdater> for KeyUpdater
sourcefn as_ref(&self) -> &KeyUpdater
fn as_ref(&self) -> &KeyUpdater
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl AsRef<str> for KeyUpdater
impl AsRef<str> for KeyUpdater
sourceimpl Clone for KeyUpdater
impl Clone for KeyUpdater
sourcefn clone(&self) -> KeyUpdater
fn clone(&self) -> KeyUpdater
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 KeyUpdater
impl Debug for KeyUpdater
sourceimpl<'de> Deserialize<'de> for KeyUpdater
impl<'de> Deserialize<'de> for KeyUpdater
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for KeyUpdater
impl Serialize for KeyUpdater
Auto Trait Implementations
impl RefUnwindSafe for KeyUpdater
impl Send for KeyUpdater
impl Sync for KeyUpdater
impl Unpin for KeyUpdater
impl UnwindSafe for KeyUpdater
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>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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
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