pub struct LinkStr<'link, T: LinkStrType + ?Sized = str> { /* private fields */ }
Expand description
String borrowed from a Link
.
LinkStr
is returned from:
When LinkStr
is dropped, the string is deallocated by the Link
.
Example
use wstp::{Link, LinkStr};
let mut link = Link::new_loopback().unwrap();
link.put_str("hello world").unwrap();
// Read a string from the link
let string: LinkStr = link.get_string_ref().unwrap();
// Get a `&str` from the `LinkStr`
assert_eq!(string.as_str(), "hello world");
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'link, T: ?Sized> RefUnwindSafe for LinkStr<'link, T>where
<T as LinkStrType>::Element: RefUnwindSafe,
impl<'link, T = str> !Send for LinkStr<'link, T>
impl<'link, T = str> !Sync for LinkStr<'link, T>
impl<'link, T: ?Sized> Unpin for LinkStr<'link, T>
impl<'link, T: ?Sized> UnwindSafe for LinkStr<'link, T>where
<T as LinkStrType>::Element: RefUnwindSafe,
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