Skip to content

Consider adding documentation about smartstring being arch-dependent #22

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

Merged
merged 2 commits into from
Feb 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ when not inlined it's pointer compatible with `String`, meaning that you can saf
if it had never been a `SmartString`. (But please don't do that, there's an `Into<String>`
implementation that's much safer.)

## Supported architectures
`smartstring` currently doesn't run on 32-bit big endian architectures like `powerpc`, so its use
in any crates that intend to run on those architectures should ideally be gated behind a
[platform specific dependency](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies)
in your `Cargo.toml`, like so:
```toml
[target.'cfg(not(all(target_endian = "big", target_pointer_width = "32")))'.dependencies]
smartstring = "0.2"
```

This will ensure that `cargo` does not try to build `smartstring` on these unsupported
architectures, which will otherwise [always fail](https://github.com/bodil/smartstring/blob/v0.2.9/src/config.rs#L91-L93).

## Caveat

The way `smartstring` gets by without a discriminant is dependent on the memory layout of the
Expand Down