use allocator_api2::alloc::{Allocator, Global};
use crate::arena_str_macros::{impl_utf16_str_accessors, impl_utf16_str_handle_core, impl_utf16_str_read_traits};
use crate::internal::in_chunk::InLocalChunk;
use crate::internal::local_chunk::LocalChunk;
pub struct RcUtf16Str<A: Allocator + Clone = Global> {
data: InLocalChunk<u16, A>,
_phantom: core::marker::PhantomData<A>,
}
impl_utf16_str_handle_core!(RcUtf16Str, Local);
impl_utf16_str_accessors!([<A: Allocator + Clone>], RcUtf16Str<A>);
impl_utf16_str_read_traits!([<A: Allocator + Clone>], RcUtf16Str<A>);
impl<A: Allocator + Clone> Drop for RcUtf16Str<A> {
#[inline]
fn drop(&mut self) {
let chunk = self.data.chunk_ptr();
unsafe { LocalChunk::dec_ref(chunk) };
}
}
impl<'a, A: Allocator + Clone> ::core::convert::From<crate::strings::Utf16String<'a, A>> for RcUtf16Str<A> {
#[inline]
fn from(s: crate::strings::Utf16String<'a, A>) -> Self {
s.into_arena_utf16_str()
}
}
crate::arena_str_macros::impl_from_str_for_slice_handle!(RcUtf16Str, Rc, u16);