Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build without any features #5

Merged
merged 2 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
toolchain: stable
override: true

- name: Run cargo check no-feature
uses: actions-rs/cargo@v1
with:
command: check

- name: Run cargo check isahc
uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "roctogen"
version = "0.2.1"
version = "0.2.2"
authors = [ "Roctogen contributors" ]
description = "Github API and models generated from the official swagger OpenAPI specification"
license = "Apache-2.0"
Expand Down
20 changes: 17 additions & 3 deletions src/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,21 @@ pub(crate) async fn fetch_async(
not(feature = "ureq"),
not(target_arch = "wasm32")
))]
pub(crate) type FromJsonType = Vec<u8>;
pub(crate) fn to_json<E: for<'de> Deserialize<'de>>(
_res: http::Response<Vec<u8>>,
) -> Result<E, AdapterError> {
unimplemented!("Use a client adapter feature, or target wasm");
}

#[cfg(all(
not(feature = "isahc"),
not(feature = "reqwest"),
not(feature = "ureq"),
not(target_arch = "wasm32")
))]
pub(crate) async fn to_json_async<E: for<'de> Deserialize<'de>>(_res: http::Response<Vec<u8>>) -> Result<E, AdapterError> {
unimplemented!("Use a client adapter feature, or target wasm");
}

#[cfg(all(
not(feature = "isahc"),
Expand All @@ -108,8 +122,8 @@ impl GitHubResponseExt for http::Response<Vec<u8>> {
not(feature = "ureq"),
not(target_arch = "wasm32")
))]
impl<T> GitHubRequestBuilder<T> for http::Request<Vec<u8>> {
fn build(_req: GitHubRequest<T>, _auth: &Auth) -> Result<Self, AdapterError> {
impl GitHubRequestBuilder<Vec<u8>> for http::Request<Vec<u8>> {
fn build(_req: GitHubRequest<Vec<u8>>, _auth: &Auth) -> Result<Self, AdapterError> {
unimplemented!("Use a client adapter feature, or target wasm");
}
}
Expand Down