Properly gate functionality on http
in bevy_remote
(#18478)
# Objective Noticed that `bevy_remote` fails to compile without default features. ## Solution Adjusted offending method to avoid reliance on `http` module when it is disabled. ## Testing - CI - `cargo clippy -p bevy_remote --no-default-features`
This commit is contained in:
parent
c87eeed6d8
commit
4127ac1662
@ -19,19 +19,18 @@ use bevy_reflect::{
|
|||||||
serde::{ReflectSerializer, TypedReflectDeserializer},
|
serde::{ReflectSerializer, TypedReflectDeserializer},
|
||||||
GetPath, PartialReflect, TypeRegistration, TypeRegistry,
|
GetPath, PartialReflect, TypeRegistration, TypeRegistry,
|
||||||
};
|
};
|
||||||
use bevy_utils::default;
|
|
||||||
use serde::{de::DeserializeSeed as _, Deserialize, Serialize};
|
use serde::{de::DeserializeSeed as _, Deserialize, Serialize};
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error_codes,
|
error_codes,
|
||||||
schemas::{
|
schemas::{json_schema::JsonSchemaBevyType, open_rpc::OpenRpcDocument},
|
||||||
json_schema::JsonSchemaBevyType,
|
|
||||||
open_rpc::{OpenRpcDocument, ServerObject},
|
|
||||||
},
|
|
||||||
BrpError, BrpResult,
|
BrpError, BrpResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "http")]
|
||||||
|
use {crate::schemas::open_rpc::ServerObject, bevy_utils::default};
|
||||||
|
|
||||||
/// The method path for a `bevy/get` request.
|
/// The method path for a `bevy/get` request.
|
||||||
pub const BRP_GET_METHOD: &str = "bevy/get";
|
pub const BRP_GET_METHOD: &str = "bevy/get";
|
||||||
|
|
||||||
@ -821,6 +820,8 @@ pub fn process_remote_list_methods_request(
|
|||||||
world: &mut World,
|
world: &mut World,
|
||||||
) -> BrpResult {
|
) -> BrpResult {
|
||||||
let remote_methods = world.resource::<crate::RemoteMethods>();
|
let remote_methods = world.resource::<crate::RemoteMethods>();
|
||||||
|
|
||||||
|
#[cfg(feature = "http")]
|
||||||
let servers = match (
|
let servers = match (
|
||||||
world.get_resource::<crate::http::HostAddress>(),
|
world.get_resource::<crate::http::HostAddress>(),
|
||||||
world.get_resource::<crate::http::HostPort>(),
|
world.get_resource::<crate::http::HostPort>(),
|
||||||
@ -837,6 +838,10 @@ pub fn process_remote_list_methods_request(
|
|||||||
}]),
|
}]),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "http"))]
|
||||||
|
let servers = None;
|
||||||
|
|
||||||
let doc = OpenRpcDocument {
|
let doc = OpenRpcDocument {
|
||||||
info: Default::default(),
|
info: Default::default(),
|
||||||
methods: remote_methods.into(),
|
methods: remote_methods.into(),
|
||||||
|
Loading…
Reference in New Issue
Block a user