Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion committed Sep 2, 2024
1 parent 5b67a8a commit c42892f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hex = "0.4.3"
indexmap = { version = "2", features = ["std"] }
itoa = "1.0.6"
itoap = { version = "1", features = ["simd"] }
kstring = { version = "2.0.2", features = ["arc", "max_inline", "serde"] }
kstring = { version = "2.0.2", features = ["serde"] }
libc = "0.2"
memchr = "2.6"
memmap = { package = "memmap2", version = "0.7" }
Expand Down
16 changes: 8 additions & 8 deletions crates/polars-utils/src/pl_str.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use kstring::KString;

#[macro_export]
macro_rules! format_pl_smallstr {
($($arg:tt)*) => {{
Expand All @@ -11,29 +9,31 @@ macro_rules! format_pl_smallstr {
}}
}

type Inner = kstring::KStringBase<kstring::backend::ArcStr>;

/// String type that interns small strings and has O(1) clone.
#[derive(Clone, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PlSmallStr(kstring::KStringBase<kstring::backend::ArcStr>);
pub struct PlSmallStr(Inner);

impl PlSmallStr {
pub const EMPTY: Self = Self(KString::EMPTY);
pub const EMPTY_REF: &'static Self = &Self(KString::EMPTY);
pub const EMPTY: Self = Self(Inner::EMPTY);
pub const EMPTY_REF: &'static Self = &Self(Inner::EMPTY);

#[inline(always)]
pub const fn from_static(s: &'static str) -> Self {
Self(KString::from_static(s))
Self(Inner::from_static(s))
}

#[inline(always)]
#[allow(clippy::should_implement_trait)]
pub fn from_str(s: &str) -> Self {
Self(KString::from_ref(s))
Self(Inner::from_ref(s))
}

#[inline(always)]
pub fn from_string(s: String) -> Self {
Self(KString::from_string(s))
Self(Inner::from_string(s))
}

#[inline(always)]
Expand Down

0 comments on commit c42892f

Please sign in to comment.