Struct meilisearch_sdk::task_info::TaskInfo
source · pub struct TaskInfo {
pub enqueued_at: OffsetDateTime,
pub index_uid: Option<String>,
pub status: String,
pub update_type: TaskType,
pub task_uid: u32,
}Fields§
§enqueued_at: OffsetDateTime§index_uid: Option<String>§status: String§update_type: TaskType§task_uid: u32Implementations§
source§impl TaskInfo
impl TaskInfo
pub fn get_task_uid(&self) -> u32
sourcepub async fn wait_for_completion(
self,
client: &Client,
interval: Option<Duration>,
timeout: Option<Duration>
) -> Result<Task, Error>
pub async fn wait_for_completion(
self,
client: &Client,
interval: Option<Duration>,
timeout: Option<Duration>
) -> Result<Task, Error>
Wait until Meilisearch processes a task provided by TaskInfo, and get its status.
interval = The frequency at which the server should be polled. Default = 50ms
timeout = The maximum time to wait for processing to complete. Default = 5000ms
If the waited time exceeds timeout then an Error::Timeout will be returned.
See also [Client::wait_for_task, Index::wait_for_task].
Example
let client = Client::new("http://localhost:7700", "masterKey");
let movies = client.index("movies_wait_for_completion");
let status = movies.add_documents(&[
Document { id: 0, kind: "title".into(), value: "The Social Network".to_string() },
Document { id: 1, kind: "title".into(), value: "Harry Potter and the Sorcerer's Stone".to_string() },
], None)
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
assert!(matches!(status, Task::Succeeded { .. }));Trait Implementations§
source§impl<'de> Deserialize<'de> for TaskInfo
impl<'de> Deserialize<'de> for TaskInfo
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