We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33517ab commit 3feaa5cCopy full SHA for 3feaa5c
src/inline_string.rs
@@ -39,6 +39,7 @@ use std::convert::{Infallible, TryFrom};
39
use std::fmt::{self, Display};
40
use std::hash;
41
use std::io::Write;
42
+use std::mem;
43
use std::ops::{self, RangeBounds};
44
use std::ptr;
45
use std::str;
@@ -49,14 +50,8 @@ use std::str;
49
50
/// Sometime in the future, when Rust's generics support specializing with
51
/// compile-time static integers, this number should become configurable.
52
pub const INLINE_STRING_CAPACITY: usize = {
- #[cfg(target_pointer_width = "64")]
53
- {
54
- 30
55
- }
56
- #[cfg(target_pointer_width = "32")]
57
58
- 14
59
+ use mem::size_of;
+ size_of::<String>() + size_of::<usize>() - 2
60
};
61
62
/// A short UTF-8 string that uses inline storage and does no heap allocation.
0 commit comments