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

Refactor: re_sdk no longer depends on re_viewer #1507

Merged
merged 30 commits into from
Mar 6, 2023
Merged

Conversation

emilk
Copy link
Member

@emilk emilk commented Mar 4, 2023

All dependencies on re_viewer have been moved from re_sdk to the rerun crate.

This means we could start using re_sdk from re_viewer, i.e. have rerun bite its own tail.

Breaking changes

  • session.spawn(…) -> rerun::native_viewer::spawn(session, …)
  • session.show() -> rerun::native_viewer::show(session)
  • session.serve(…) -> rerun::serve_web_viewer(session, …);
  • rerun::global_session is now hidden behind the global_session feature flag

Refactor

Session now pipes the log stream to a Box<dyn LogSink>. This means we give the user full control of the Session backend with Session::set_sink.

.connect(), .save() and .serve() are just convenience methods for installing a new sink.

Other

The serve_web_viewer() method needs a tokio runtime in order to spawn the servers. This tokio runtime is still stored in the Session, but it is a bit weird. I would like to split up serve_web_viewer() anyhow, since it currently does two things (serve the web viewer, and host a websocket server). Anyways, I did the minimally intrusive thing here for now.

Checklist

@emilk emilk added 🦀 Rust API Rust logging API dogfooding 📺 re_viewer affects re_viewer itself labels Mar 4, 2023
@emilk emilk marked this pull request as ready for review March 4, 2023 23:01
@teh-cmc teh-cmc self-requested a review March 6, 2023 08:11
crates/re_sdk/Cargo.toml Outdated Show resolved Hide resolved
crates/rerun/src/web_viewer.rs Outdated Show resolved Hide resolved
@emilk emilk merged commit 51cdb49 into main Mar 6, 2023
@emilk emilk deleted the emilk/rust-sdk-refactor branch March 6, 2023 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dogfooding 📺 re_viewer affects re_viewer itself 🦀 Rust API Rust logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants