Skip to content

Commit

Permalink
fix: Hide DefaultStr
Browse files Browse the repository at this point in the history
This reduces the chance of errors from users using it directly and
assuming the type.
  • Loading branch information
epage committed Mar 29, 2022
1 parent 408af37 commit cbae527
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ fn main() {
.unwrap();
#[allow(clippy::redundant_closure)] // Needed for consistent type
let method = match method.as_str() {
"from_ref" => |s| kstring::KString::<kstring::backend::DefaultStr>::from_ref(s),
"from_ref" => |s| kstring::KString::<kstring::backend::BoxedStr>::from_ref(s),
"from_string" => {
|s| kstring::KString::<kstring::backend::DefaultStr>::from_string(String::from(s))
|s| kstring::KString::<kstring::backend::BoxedStr>::from_string(String::from(s))
}
_ => panic!("{:?} unsupported, try `from_ref`, `from_string`", method),
};
Expand Down
4 changes: 2 additions & 2 deletions src/backend.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(feature = "arc")]
pub type DefaultStr = crate::backend::ArcStr;
pub(crate) type DefaultStr = crate::backend::ArcStr;
#[cfg(not(feature = "arc"))]
pub type DefaultStr = crate::backend::BoxedStr;
pub(crate) type DefaultStr = crate::backend::BoxedStr;

pub type BoxedStr = Box<str>;
static_assertions::assert_eq_size!(DefaultStr, BoxedStr);
Expand Down

0 comments on commit cbae527

Please sign in to comment.