Skip to content

Commit

Permalink
feature flag it
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Feb 29, 2024
1 parent c4f35d5 commit 8a2a4cc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions crates/re_sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ all-features = true
[features]
default = []

## Support for using Rerun's data-loaders directly from the SDK.
##
## See our `log_file` example and <https://www.rerun.io/docs/howto/open-any-file>
## for more information.
data_loaders = ["dep:re_data_source", "dep:re_smart_channel"]

## Support serving a web viewer over HTTP.
##
## Enabling this inflates the binary size quite a bit, since it embeds the viewer wasm.
Expand All @@ -31,6 +37,7 @@ default = []
## However, when building from source in the repository, this feature adds quite a bit
## to the compile time since it requires compiling and bundling the viewer as wasm.
web_viewer = [
"dep:re_smart_channel",
"dep:re_web_viewer_server",
"dep:re_ws_comms",
"dep:anyhow",
Expand All @@ -41,13 +48,11 @@ web_viewer = [

[dependencies]
re_build_info.workspace = true
re_data_source.workspace = true
re_log_encoding = { workspace = true, features = ["encoder"] }
re_log_types.workspace = true
re_log.workspace = true
re_memory.workspace = true
re_sdk_comms = { workspace = true, features = ["client"] }
re_smart_channel.workspace = true
re_types_core.workspace = true

ahash.workspace = true
Expand All @@ -59,6 +64,8 @@ thiserror.workspace = true

# Optional dependencies

re_data_source = { workspace = true, optional = true }
re_smart_channel = { workspace = true, optional = true }
re_ws_comms = { workspace = true, optional = true }
re_web_viewer_server = { workspace = true, optional = true }

Expand Down
6 changes: 5 additions & 1 deletion crates/re_sdk/src/recording_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ pub enum RecordingStreamError {
#[error(transparent)]
DataReadError(#[from] re_log_types::DataReadError),

/// An error occurred when attempting to used a [`re_data_source::DataLoader`].
/// An error occurred while attempting to use a [`re_data_source::DataLoader`].
#[cfg(feature = "data_loaders")]
#[error(transparent)]
DataLoaderError(#[from] re_data_source::DataLoaderError),
}
Expand Down Expand Up @@ -1023,6 +1024,7 @@ impl RecordingStream {
/// streaming data in or all of them fail.
///
/// See <https://www.rerun.io/docs/howto/open-any-file> for more information.
#[cfg(feature = "data_loaders")]
pub fn log_file_from_path(
&self,
filepath: impl AsRef<std::path::Path>,
Expand All @@ -1038,6 +1040,7 @@ impl RecordingStream {
/// streaming data in or all of them fail.
///
/// See <https://www.rerun.io/docs/howto/open-any-file> for more information.
#[cfg(feature = "data_loaders")]
pub fn log_file_from_contents(
&self,
filepath: impl AsRef<std::path::Path>,
Expand All @@ -1046,6 +1049,7 @@ impl RecordingStream {
self.log_file(filepath, Some(contents))
}

#[cfg(feature = "data_loaders")]
fn log_file(
&self,
filepath: impl AsRef<std::path::Path>,
Expand Down
8 changes: 7 additions & 1 deletion crates/rerun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]


[features]
default = ["analytics", "demo", "glam", "image", "log", "sdk", "server"]
default = ["analytics", "data_loaders", "demo", "glam", "image", "log", "sdk", "server"]

## Enable telemetry using our analytics SDK.
analytics = [
Expand All @@ -33,6 +33,12 @@ analytics = [
## Integration with `clap`.
clap = ["dep:clap", "dep:tokio"]

## Support for using Rerun's data-loaders directly from the SDK.
##
## See our `log_file` example and <https://www.rerun.io/docs/howto/open-any-file>
## for more information.
data_loaders = ["re_sdk?/data_loaders"]

## Demo helpers for examples.
demo = []

Expand Down

0 comments on commit 8a2a4cc

Please sign in to comment.