pub struct IndexUpdater<'a, Http: HttpClient> {
pub client: &'a Client<Http>,
pub uid: String,
pub new_uid: Option<String>,
pub primary_key: Option<String>,
}Expand description
An IndexUpdater used to update the specifics of an index.
§Example
let task = IndexUpdater::new("index_updater", &client)
.with_primary_key("special_id")
.execute()
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
let index = client.get_index("index_updater").await.unwrap();
assert_eq!(index.primary_key, Some("special_id".to_string()));Fields§
§client: &'a Client<Http>§uid: String§new_uid: Option<String>New uid to rename the index to
primary_key: Option<String>Implementations§
Source§impl<'a, Http: HttpClient> IndexUpdater<'a, Http>
impl<'a, Http: HttpClient> IndexUpdater<'a, Http>
pub fn new( uid: impl AsRef<str>, client: &Client<Http>, ) -> IndexUpdater<'_, Http>
Sourcepub fn with_primary_key(
&mut self,
primary_key: impl AsRef<str>,
) -> &mut IndexUpdater<'a, Http>
pub fn with_primary_key( &mut self, primary_key: impl AsRef<str>, ) -> &mut IndexUpdater<'a, Http>
Define the new primary_key to set on the Index.
§Example
let task = IndexUpdater::new("index_updater_with_primary_key", &client)
.with_primary_key("special_id")
.execute()
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
let index = client.get_index("index_updater_with_primary_key").await.unwrap();
assert_eq!(index.primary_key, Some("special_id".to_string()));Sourcepub fn with_uid(
&mut self,
new_uid: impl AsRef<str>,
) -> &mut IndexUpdater<'a, Http>
pub fn with_uid( &mut self, new_uid: impl AsRef<str>, ) -> &mut IndexUpdater<'a, Http>
Define a new uid to rename the index.
Sourcepub fn with_new_uid(
&mut self,
new_uid: impl AsRef<str>,
) -> &mut IndexUpdater<'a, Http>
pub fn with_new_uid( &mut self, new_uid: impl AsRef<str>, ) -> &mut IndexUpdater<'a, Http>
Alias for with_uid with clearer intent.
Sourcepub async fn execute(&'a self) -> Result<TaskInfo, Error>
pub async fn execute(&'a self) -> Result<TaskInfo, Error>
Execute the update of an Index using the IndexUpdater.
§Example
let task = IndexUpdater::new("index_updater_execute", &client)
.with_primary_key("special_id")
.execute()
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
let index = client.get_index("index_updater_execute").await.unwrap();
assert_eq!(index.primary_key, Some("special_id".to_string()));Trait Implementations§
Source§impl<'a, Http: HttpClient> AsRef<IndexUpdater<'a, Http>> for IndexUpdater<'a, Http>
impl<'a, Http: HttpClient> AsRef<IndexUpdater<'a, Http>> for IndexUpdater<'a, Http>
Source§fn as_ref(&self) -> &IndexUpdater<'a, Http>
fn as_ref(&self) -> &IndexUpdater<'a, Http>
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<Http: HttpClient> AsRef<str> for IndexUpdater<'_, Http>
impl<Http: HttpClient> AsRef<str> for IndexUpdater<'_, Http>
Source§impl<'a, Http: Clone + HttpClient> Clone for IndexUpdater<'a, Http>
impl<'a, Http: Clone + HttpClient> Clone for IndexUpdater<'a, Http>
Source§fn clone(&self) -> IndexUpdater<'a, Http>
fn clone(&self) -> IndexUpdater<'a, Http>
Returns a duplicate 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<'a, Http: Debug + HttpClient> Debug for IndexUpdater<'a, Http>
impl<'a, Http: Debug + HttpClient> Debug for IndexUpdater<'a, Http>
Source§impl<'a, Http: HttpClient> Serialize for IndexUpdater<'a, Http>
impl<'a, Http: HttpClient> Serialize for IndexUpdater<'a, Http>
Auto Trait Implementations§
impl<'a, Http> Freeze for IndexUpdater<'a, Http>
impl<'a, Http> RefUnwindSafe for IndexUpdater<'a, Http>where
Http: RefUnwindSafe,
impl<'a, Http> Send for IndexUpdater<'a, Http>
impl<'a, Http> Sync for IndexUpdater<'a, Http>
impl<'a, Http> Unpin for IndexUpdater<'a, Http>
impl<'a, Http> UnwindSafe for IndexUpdater<'a, Http>where
Http: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more