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

Get the string contained by this LinkStr.

Get the UTF-8 string data.

👎Deprecated: Use LinkStr::as_str() instead

Get the UTF-8 string data.

Trait Implementations

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.