doc.rust-lang.org
pub fn as_ptr(&self) -> *const T
Returns a raw pointer to the object T pointed to by this Weak<T>.
method
alloc
Stable since 1.45.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_raw(ptr: *const T) -> Self
Converts a raw pointer previously created by into_raw back into Weak<T>.
associated_function
alloc
Stable since 1.45.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_raw(self) -> *const T
Consumes the Weak<T> and turns it into a raw pointer.
method
alloc
Stable since 1.45.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> Weak<T>
Constructs a new Weak<T>, without allocating any memory. Calling upgrade on the return value always gives None.
associated_function
alloc
Stable since 1.10.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn ptr_eq(&self, other: &Self) -> bool
Returns true if the two Weaks point to the same allocation similar to ptr::eq, or if both don't point to any allocation (because they were created with Weak::new()). However, this function ignores the metadata of dyn Trait pointers.
method
alloc
Stable since 1.39.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn strong_count(&self) -> usize
Gets the number of strong (Rc) pointers pointing to this allocation.
method
alloc
Stable since 1.41.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn upgrade(&self) -> Option<Rc<T, A>>
Attempts to upgrade the Weak pointer to an Rc, delaying dropping of the inner value if successful.
method
alloc
Stable since 1.4.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn weak_count(&self) -> usize
Gets the number of Weak pointers pointing to this allocation.
method
alloc
Stable since 1.41.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod slice
Utilities for the slice primitive type.
module
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod str
Utilities for the str primitive type.
module
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub unsafe fn from_boxed_utf8_unchecked(v: crate::boxed::Box<[u8]>) -> crate::boxed::Box<str>
Converts a boxed slice of bytes to a boxed string slice without checking that the string contains valid UTF-8.
function
alloc
Stable since 1.20.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod string
A UTF-8–encoded, growable string.
module
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Drain<'a>
A draining iterator for String.
struct
alloc
Stable since 1.6.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_str(&self) -> &str
Returns the remaining (sub)string of this iterator as a slice.
method
alloc
Stable since 1.55.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct FromUtf16Error
A possible error value when converting a String from a UTF-16 byte slice.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct FromUtf8Error
A possible error value when converting a String from a UTF-8 byte vector.
struct
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_bytes(&self) -> &[u8]
Returns a slice of u8s bytes that were attempted to convert to a String.
method
alloc
Stable since 1.26.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_bytes(self) -> Vec<u8>
Returns the bytes that were attempted to convert to a String.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_utf8_lossy(self) -> String
Converts the bytes into a String lossily, substituting invalid UTF-8 sequences with replacement characters.
method
alloc
Stable since 1.100.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn utf8_error(&self) -> Utf8Error
Fetch a Utf8Error to get more details about the conversion failure.
method
alloc
Stable since 1.0.0
Version 1.100.0-nightly