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§
source§impl 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_URL, 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§
source§impl AsRef<KeyUpdater> for KeyUpdater
impl AsRef<KeyUpdater> for KeyUpdater
source§fn as_ref(&self) -> &KeyUpdater
fn as_ref(&self) -> &KeyUpdater
Converts this type into a shared reference of the (usually inferred) input type.
source§impl AsRef<str> for KeyUpdater
impl AsRef<str> for KeyUpdater
source§impl Clone for KeyUpdater
impl Clone for KeyUpdater
source§fn clone(&self) -> KeyUpdater
fn clone(&self) -> KeyUpdater
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for KeyUpdater
impl Debug for KeyUpdater
source§impl<'de> Deserialize<'de> for KeyUpdater
impl<'de> Deserialize<'de> for KeyUpdater
source§fn 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