Skip to content

Commit

Permalink
api: Re-add new_inline() and from_static_str() as deprecated (#383)
Browse files Browse the repository at this point in the history
* start

* update deprecation warning

* cargo fmt
  • Loading branch information
ParkMyCar authored Jun 10, 2024
1 parent 8bee76b commit 9d78de5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions compact_str/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@ impl CompactString {
CompactString(Repr::const_new(text))
}

/// Creates a new inline [`CompactString`] at compile time.
#[deprecated(
since = "0.8.0",
note = "replaced by CompactString::const_new, will be removed in 0.9.0"
)]
#[inline]
pub const fn new_inline(text: &'static str) -> Self {
CompactString::const_new(text)
}

/// Creates a new inline [`CompactString`] from `&'static str` at compile time.
#[deprecated(
since = "0.8.0",
note = "replaced by CompactString::const_new, will be removed in 0.9.0"
)]
#[inline]
pub const fn from_static_str(text: &'static str) -> Self {
CompactString::const_new(text)
}

/// Get back the `&'static str` constructed by [`CompactString::const_new`].
///
/// If the string was short enough that it could be inlined, then it was inline, and
Expand Down

0 comments on commit 9d78de5

Please sign in to comment.