Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use core::marker::PhantomData;
use core::mem::{self, ManuallyDrop};
use core::ptr::{self, addr_of_mut};

use crate::OffsetArc;

use super::{Arc, ArcInner};

/// Structure to allow Arc-managing some fixed-sized data and a variably-sized
Expand Down Expand Up @@ -202,6 +204,18 @@ impl From<String> for Arc<str> {
}
}

impl From<&str> for OffsetArc<str> {
fn from(s: &str) -> Self {
Arc::into_raw_offset(Arc::from(s))
}
}

impl From<String> for OffsetArc<str> {
fn from(s: String) -> Self {
Self::from(&s[..])
}
}

// FIXME: once `pointer::with_metadata_of` is stable or
// implementable on stable without assuming ptr layout
// this will be able to accept `T: ?Sized`.
Expand Down
Loading