Skip to content

Commit

Permalink
Static seacow
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Oct 26, 2023
1 parent 6e98057 commit ec05500
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/seacow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ unsafe impl<T: Send + Sync> Sync for Pointer<T> {}
unsafe impl<T: Send + Sync> Send for PointerMut<T> {}
unsafe impl<T: Send + Sync> Sync for PointerMut<T> {}

impl<'a, T> SeaCow<'a, T> {
impl<T> SeaCow<'static, T> {
#[inline]
#[must_use]
pub fn borrowed(data: &'a [T]) -> Self {
pub fn boxed(data: Box<[T]>) -> Self {
Self {
inner: SeaCowInner::Borrowed(data),
inner: SeaCowInner::Boxed(data),
}
}
}

impl<'a, T> SeaCow<'a, T> {
#[inline]
#[must_use]
pub fn boxed(data: Box<[T]>) -> Self {
pub fn borrowed(data: &'a [T]) -> Self {
Self {
inner: SeaCowInner::Boxed(data),
inner: SeaCowInner::Borrowed(data),
}
}

Expand Down

0 comments on commit ec05500

Please sign in to comment.