-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add dev docs snippets and cheat sheet for storage client (#389)
* chore: add dev docs snippets for storage client * show example of getting value using match vs try_into * add storage client cheat sheet
- Loading branch information
Showing
3 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
example/rust/src/docs_examples/cheat_sheet_storage_client.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use momento::{ | ||
storage, CredentialProvider, MomentoResult, PreviewStorageClient, | ||
}; | ||
|
||
#[tokio::main] | ||
async fn main() -> MomentoResult<()> { | ||
let storage_client = PreviewStorageClient::builder() | ||
.configuration(storage::configurations::Laptop::latest()) | ||
.credential_provider( | ||
CredentialProvider::from_env_var("MOMENTO_API_KEY".to_string()) | ||
.expect("API key should be valid"), | ||
) | ||
.build()?; | ||
|
||
// ... | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.