Based on written notes, I think this is the only remaining storage client change in the Rust SDK.
This PR replaces struct GetResponse with enum GetResponse with cases Found (contains a StorageValue) and NotFound (no StorageValue).
// quick conversion
let resp = storage_client.get(store_name, key).await?;
let found_value: String = resp.try_into()?;
// full switch statement
match storage_client.get(store_name, key).await? {
GetResponse::Found { value } => {
let found_value: f64 = value.try_into()?;
// wrong type try_into shows "Error: MomentoError { message: "item is not an f64", error_code: TypeError, inner_error: None, details: None }"
}
GetResponse::NotFound => println!("Key {key} not found in {store_name}"),
}
Closes https://github.com/momentohq/dev-eco-issue-tracker/issues/936
Based on written notes, I think this is the only remaining storage client change in the Rust SDK.
This PR replaces
struct GetResponse
withenum GetResponse
with casesFound
(contains aStorageValue
) andNotFound
(noStorageValue
).