#![doc = document_features::document_features!()]
#![allow(clippy::unwrap_used)]
#![warn(missing_docs)] mod binary_stream_sink;
mod global;
mod log_sink;
mod recording_stream;
mod spawn;
pub use spawn::{spawn, SpawnError, SpawnOptions};
pub use self::recording_stream::{
forced_sink_path, RecordingStream, RecordingStreamBuilder, RecordingStreamError,
RecordingStreamResult,
};
pub const DEFAULT_SERVER_PORT: u16 = re_uri::DEFAULT_PROXY_PORT;
pub const DEFAULT_CONNECT_URL: &str =
const_format::concatcp!("rerun+http://127.0.0.1:", DEFAULT_SERVER_PORT, "/proxy");
#[deprecated(since = "0.22.0", note = "migrate to connect_grpc")]
pub fn default_server_addr() -> std::net::SocketAddr {
std::net::SocketAddr::from(([127, 0, 0, 1], DEFAULT_SERVER_PORT))
}
#[allow(clippy::unnecessary_wraps)]
pub fn default_flush_timeout() -> Option<std::time::Duration> {
Some(std::time::Duration::from_secs(2))
}
pub use re_log_types::{
entity_path, ApplicationId, EntityPath, EntityPathPart, Instance, StoreId, StoreKind,
};
pub use re_memory::MemoryLimit;
pub use re_types::archetypes::RecordingProperties;
pub use global::cleanup_if_forked_child;
#[cfg(not(target_arch = "wasm32"))]
impl crate::sink::LogSink for re_log_encoding::FileSink {
fn send(&self, msg: re_log_types::LogMsg) {
Self::send(self, msg);
}
#[inline]
fn flush_blocking(&self) {
Self::flush_blocking(self);
}
}
pub mod sink {
pub use crate::binary_stream_sink::{BinaryStreamSink, BinaryStreamStorage};
pub use crate::log_sink::{BufferedSink, CallbackSink, LogSink, MemorySink, MemorySinkStorage};
pub use crate::log_sink::GrpcSink;
#[cfg(not(target_arch = "wasm32"))]
pub use re_log_encoding::{FileSink, FileSinkError};
}
pub mod log {
pub use re_chunk::{
Chunk, ChunkBatcher, ChunkBatcherConfig, ChunkBatcherError, ChunkBatcherResult,
ChunkComponents, ChunkError, ChunkId, ChunkResult, PendingRow, RowId, TimeColumn,
};
pub use re_log_types::LogMsg;
}
pub mod time {
pub use re_log_types::{Duration, TimeCell, TimeInt, TimePoint, TimeType, Timeline, Timestamp};
}
pub use time::{TimeCell, TimePoint, Timeline};
pub use re_types::{
Archetype, ArchetypeName, AsComponents, Component, ComponentBatch, ComponentDescriptor,
ComponentName, DatatypeName, DeserializationError, DeserializationResult,
GenericIndicatorComponent, Loggable, LoggableBatch, NamedIndicatorComponent,
SerializationError, SerializationResult, SerializedComponentBatch, SerializedComponentColumn,
};
pub use re_byte_size::SizeBytes;
#[cfg(feature = "data_loaders")]
pub use re_data_loader::{DataLoader, DataLoaderError, DataLoaderSettings, LoadedData};
#[cfg(feature = "web_viewer")]
pub mod web_viewer;
#[cfg(feature = "server")]
pub mod grpc_server;
pub mod external {
pub use re_grpc_client;
pub use re_grpc_server;
pub use re_log;
pub use re_log_encoding;
pub use re_log_types;
pub use re_chunk::external::*;
pub use re_log::external::*;
pub use re_log_types::external::*;
#[cfg(feature = "data_loaders")]
pub use re_data_loader;
}
#[cfg(feature = "web_viewer")]
pub use web_viewer::serve_web_viewer;
pub fn build_info() -> re_build_info::BuildInfo {
re_build_info::build_info!()
}
const RERUN_ENV_VAR: &str = "RERUN";
fn get_rerun_env() -> Option<bool> {
std::env::var(RERUN_ENV_VAR)
.ok()
.and_then(|s| match s.to_lowercase().as_str() {
"0" | "false" | "off" => Some(false),
"1" | "true" | "on" => Some(true),
_ => {
re_log::warn!(
"Invalid value for environment variable {RERUN_ENV_VAR}={s:?}. Expected 'on' or 'off'. It will be ignored"
);
None
}
})
}
pub fn decide_logging_enabled(default_enabled: bool) -> bool {
match get_rerun_env() {
Some(true) => {
re_log::info_once!(
"Rerun Logging is enabled by the '{RERUN_ENV_VAR}' environment variable."
);
true
}
Some(false) => {
re_log::info_once!(
"Rerun Logging is disabled by the '{RERUN_ENV_VAR}' environment variable."
);
false
}
None => {
if !default_enabled {
re_log::info_once!(
"Rerun Logging has been disabled. Turn it on with the '{RERUN_ENV_VAR}' environment variable."
);
}
default_enabled
}
}
}
#[track_caller] pub fn new_store_info(
application_id: impl Into<re_log_types::ApplicationId>,
) -> re_log_types::StoreInfo {
re_log_types::StoreInfo {
application_id: application_id.into(),
store_id: StoreId::random(StoreKind::Recording),
cloned_from: None,
store_source: re_log_types::StoreSource::RustSdk {
rustc_version: env!("RE_BUILD_RUSTC_VERSION").into(),
llvm_version: env!("RE_BUILD_LLVM_VERSION").into(),
},
store_version: Some(re_build_info::CrateVersion::LOCAL),
}
}