You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace Model trait with Format trait (applied to Response instead) (#2559)
* start building Format/DeserializeWith trait
* remove Model and replace with Format type parameter
* fix issues in azure_core, azure_identity, and azure_data_cosmos
* fix tests in hand-written crates
* updates to generated crates
* make send_format more clearly a short-cut method
* fix async_trait on wasm32
* fix tyop
* initial pr feedback
* rename DefaultFormat to JsonFormat
* paramerize pipeline on format
* undo all generated code changes
* revert keyvault generated changes
* some updates to copilot instructions
* split Response into Response and RawResponse
* remove extraneous helpers, let's focus on simple APIs and be ok with boilerplate
* api doc updates
* remove some extraneous copilot instructions
* refactor cosmos for new Response types
* fix typespec client examples
* fix issues in non-generated clients
* fix issues in generated clients
* a few other hand-written client fixes
* update changelog
* pr feedback
* refmt
* fix doctest
* fix more doctests
* add `F` parameter to `Pager`
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,9 @@ Use these instructions for test generation as well.
16
16
- Field and function names are snake_case.
17
17
- Parameter names are snake_case.
18
18
- Crate and module names are snake_case.
19
+
- Keep `use` directives at the top of the module in which they are used, and avoid placing them inside functions or blocks unless absolutely necessary.
20
+
- Prefer using `crate` in `use` directives to refer to types anywhere in the current crate instead of using it's name, or relative paths like `super` or `self`.
21
+
- Prefer merging new `use` directives into existing ones rather than creating new `use` blocks.
19
22
- Prioritize safety, efficiency, and correctness.
20
23
- Respect Rust's ownership and borrowing rules.
21
24
- Use short, descriptive names for fields, functions, parameters, and variables.
@@ -29,6 +32,7 @@ Use these instructions for test generation as well.
29
32
- Use `clippy` to validate that generated code does not contain lint errors.
30
33
- If you have trouble generating safe, efficient, maintainable, and lint-free code, insert a `TODO` comment describing what should happen.
31
34
- All imported types, constants, functions, modules, and macros should be imported explicitly. Never import `*`.
35
+
- Do not modify generated code, found in `generated` subdirectories. These files are generated by external tools and should not be edited manually.
32
36
33
37
## Test Generation
34
38
@@ -38,3 +42,4 @@ Use these instructions for test generation as well.
38
42
- The `tests` module should be conditioned on `#[cfg(test)]`.
39
43
- The `tests` module should always import APIs from `super`.
40
44
- Do not begin test function names with "test" unless necessary to disambiguate from the function being tested.
Copy file name to clipboardExpand all lines: sdk/core/azure_core/src/http/pager.rs
+21-18Lines changed: 21 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ use crate::http::{headers::HeaderName, response::Response};
5
5
use futures::{stream::unfold,Stream};
6
6
use std::{future::Future, pin::Pin};
7
7
use typespec::Error;
8
+
use typespec_client_core::http::JsonFormat;
8
9
9
10
/// The result of fetching a single page from a [`Pager`], whether the `Pager` should continue or is complete.
10
11
#[derive(Debug)]
@@ -15,12 +16,12 @@ pub enum PagerResult<T, C> {
15
16
Complete{response:T},
16
17
}
17
18
18
-
impl<T>PagerResult<Response<T>,String>{
19
+
impl<T,F>PagerResult<Response<T,F>,String>{
19
20
/// Creates a [`PagerResult<T, C>`] from the provided response, extracting the continuation value from the provided header.
20
21
///
21
22
/// If the provided response has a header with the matching name, this returns [`PagerResult::Continue`], using the value from the header as the continuation.
22
23
/// If the provided response does not have a header with the matching name, this returns [`PagerResult::Complete`].
0 commit comments