https://github.com/heaths/azure-sdk-for-rust-proto
https://github.com/heaths/azure-sdk-for-rust-proto
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/heaths/azure-sdk-for-rust-proto
- Owner: heaths
- License: mit
- Created: 2024-02-29T17:41:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T20:40:08.000Z (almost 2 years ago)
- Last Synced: 2025-05-13T22:23:24.239Z (about 1 year ago)
- Language: Rust
- Size: 107 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Azure/azure-sdk-for-net prototypes
[](https://github.com/heaths/azure-sdk-for-rust-proto/actions/workflows/ci.yml)
This repo is a prototype for [Azure/azure-sdk-for-rust] to help create our [guidelines].
We have chosen the options builder pattern after a lot of consideration and research, but will make adjustments based on
feedback as we progress.
## Example
An example of the options builder pattern we have chosen:
```rust
let endpoint = env::var("AZURE_KEYVAULT_URL")?;
let credential = Arc::new(DefaultAzureCredential::default());
let options = SecretClientOptions::builder()
.with_api_version("7.4")
.with_retry(RetryOptions::exponential(ExponentialRetryOptions::default()))
.build();
let client = SecretClient::new(endpoint, credential, Some(options))?;
// Simple client method call.
let response = client
.set_secret("secret-name", "secret-value", None)
.await?;
let secret: Secret = response.json().await?;
println!("set {} version {}", secret.name, secret.version);
```
## Conventions
* Builder fields should be private.
* Builder setters should be declared as `with_field_name(&mut self, value: impl Into) -> &mut Self`.
* Client fields should be private.
* ClientOptions should be public.
* Model fields should be public.
* Parameter types that do not require concrete types should use `impl Into` for owned values
or `impl AsRef` if not owned.
* Private field getters should be declared as `field_name(&self) -> &field_type`.
* Private field setters should be declared as `set_field_name(&mut self, value: impl Into)`.
* Type construction should use `new(...)` or `with_more_details(...)`. Consider implementing `Default` as appropriate.
Read our [guidelines] for more information,
and for additional naming guidelines.
## License
Licensed under the [MIT](LICENSE.txt) license.
[Azure/azure-sdk-for-rust]: https://github.com/Azure/azure-sdk-for-rust
[guidelines]: https://azure.github.io/azure-sdk/rust_introduction.html
[typestate builder pattern]: https://gist.github.com/heaths/1eb608df947de5d5b47da0ee6a5a5c6d