tree: fa7d4e4dcfa90fc92aa3a6caa9d045f8a738fd8c [search]
  1. internal/
  2. BUILD
  3. BUILD.gn
  4. char.cc
  5. char.h
  6. char_test.cc
  7. CMakeLists.txt
  8. crubit_stdlib_cc_test.bzl
  9. dyn_callable.h
  10. dyn_callable.rs
  11. dyn_callable_test.cc
  12. dyn_erased_future.h
  13. dyn_erased_future.rs
  14. enum.h
  15. enum_storage_test.cc
  16. enum_tag_encoding_test.cc
  17. enum_test.cc
  18. enum_test_option_i32.h
  19. erased_future.rs
  20. erased_future_test.rs
  21. fn.h
  22. fn_ref.h
  23. fn_ref_test.cc
  24. fn_test.cc
  25. int.h
  26. int_test.cc
  27. iterator_adapter.h
  28. iterator_adapter_test.cc
  29. lossy_formatter.rs
  30. lossy_formatter_for_bindings.h
  31. lossy_formatter_for_bindings.rs
  32. option.h
  33. README.md
  34. result.h
  35. slice_ref.h
  36. slice_ref_test.cc
  37. str_ref.h
  38. str_ref_test.cc
  39. traits.h
  40. tuple.h
  41. unit.h
  42. unit_test.cc
  43. vec.h
  44. waker.cc
  45. waker.h
support/rs_std/README.md

Crubit rs_std library

This directory contains the rs_std C++ library that provides the following APIs: - Manually authored APIs that help work with Rust builtin types. For example, rs_std::char represents Rust's char type (a separate type from C++'s char32_t is needed to detect certain invalid bit patterns that result in Undefined Behavior in Rust; additionally char32_t takes at least 32 bits, rather than exactly 32 bits). - (Not yet implemented) Automatically generated C++ bindings for Rust standard library.

Versioning

Changes to this directory take effect instantly. To make version-dependent changes, pair them with a feature flag in crubit/support/internal/cpp_config.h, and guard with an #ifdef.

For example, consider char: a new pending release might, say, change it to be 64 bits wide. This can be released as so:

// rs_std/char.h
#include "crubit/support/internal/cpp_config.h"
#ifdef CRUBIT_INTERNAL_VERY_WIDE_CHAR
std::uint64_t value_ = '\0';
#else
std::uint32_t value_ = '\0';
#endif
// cpp_config.h
...
#define CRUBIT_INTERNAL_VERY_WIDE_CHAR
...

The old release, which has the old copy of cpp_config.h, will not define CRUBIT_INTERNAL_VERY_WIDE_CHAR, and will use the previous layout.

Crubit when built at head, and for the next release, will use the new copy of cpp_config.h, which defines the macro, and obtains the new struct definition.

Even though the source code is live-at-head, changes like this will be release-gated through the crate features, which are not.