pub struct BorrowedStr<'a> {
pub ptr: *const u8,
pub len: usize,
/* private fields */
}Expand description
A borrowed UTF-8 string with a lifetime tied to the producer’s storage.
Use this for 'static strings baked into a plug-in’s manifest (type names,
version strings). The host reads through the pointer while the producing
library is loaded; in v1 that is the process lifetime, since plug-ins are
not unloaded.
Fields§
§ptr: *const u8§len: usizeImplementations§
Trait Implementations§
Source§impl<'a> Clone for BorrowedStr<'a>
impl<'a> Clone for BorrowedStr<'a>
Source§fn clone(&self) -> BorrowedStr<'a>
fn clone(&self) -> BorrowedStr<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for BorrowedStr<'a>
Source§impl Debug for BorrowedStr<'_>
impl Debug for BorrowedStr<'_>
impl Send for BorrowedStr<'_>
SAFETY: BorrowedStr is just a pointer + length; sending it across threads
is sound as long as the underlying storage outlives the use. In v1 the
storage is process-lifetime static memory in the producing library.
impl Sync for BorrowedStr<'_>
SAFETY: see Send impl.
Auto Trait Implementations§
impl<'a> Freeze for BorrowedStr<'a>
impl<'a> RefUnwindSafe for BorrowedStr<'a>
impl<'a> Unpin for BorrowedStr<'a>
impl<'a> UnsafeUnpin for BorrowedStr<'a>
impl<'a> UnwindSafe for BorrowedStr<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more