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 KeyUpdater
pub fn with_description(&mut self, desc: impl AsRef<str>) -> &mut KeyUpdater
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();
assert_eq!(key_update.description, Some(description));sourcepub fn with_name(&mut self, desc: impl AsRef<str>) -> &mut KeyUpdater
pub fn with_name(&mut self, desc: impl AsRef<str>) -> &mut KeyUpdater
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 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
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§
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
Mutably borrows from an owned value. Read more