rstd 0.1.0
Loading...
Searching...
No Matches
rstd::ref< ffi::OsStr > Struct Reference
module rstd

A borrowed reference to a platform-native string. More...

Inheritance diagram for rstd::ref< ffi::OsStr >:
rstd::ref_base< ref< ffi::OsStr >, u8[], false >

Public Member Functions

constexpr ref (ref< str > s) noexcept
 Construct from a ref<str> (UTF-8 is always valid OS bytes).
 
constexpr ref (const char *c_str) noexcept
 Construct from a null-terminated C string.
 
constexpr auto as_encoded_bytes () const noexcept -> slice< u8 >
 Returns the encoded bytes of this OS string.
 
constexpr auto to_str () const noexcept -> Option< ref< str > >
 Attempts to convert to a UTF-8 string slice.
 
auto to_string_lossy () const -> String
 Converts to a String, replacing invalid UTF-8 with U+FFFD.
 
- Public Member Functions inherited from rstd::ref_base< ref< ffi::OsStr >, u8[], false >

Additional Inherited Members

- Public Types inherited from rstd::ref_base< ref< ffi::OsStr >, u8[], false >
using value_type
 we only process T[] for value_type
 
- Static Public Member Functions inherited from rstd::ref_base< ref< ffi::OsStr >, u8[], false >

Detailed Description

A borrowed reference to a platform-native string.

Member Function Documentation

◆ to_str()

auto rstd::ref< ffi::OsStr >::to_str ( ) const -> Option<ref<str>>
inlineconstexprnoexcept

Attempts to convert to a UTF-8 string slice.

Returns None if the bytes are not valid UTF-8.


The documentation for this struct was generated from the following file: