Struct KanziStr

pub struct KanziStr(/* private fields */);

Implementations§

§

impl KanziStr

pub const fn from_slice(slice: &[i8]) -> &KanziStr

pub const fn from_bytes(bytes: &[u8]) -> &KanziStr

pub const fn from_utf8(utf8: &str) -> &KanziStr

pub unsafe fn from_string_view<'a>(ptr: *const u8, len: u64) -> &'a KanziStr

§Safety

ptr and len must originate from a valid C++ std::string_view. Unlike std::str::from_raw_parts, this function permits a null pointer to be passed in.

This accommodates the C++ behavior where an empty std::string_view may contain a nullptr, whereas Rust requires all slices to have non-null pointers, even when empty.

pub const fn as_ptr(&self) -> *const i8

pub const fn as_slice(&self) -> &[i8]

pub fn as_bytes(&self) -> &[u8]

pub fn as_utf8(&self) -> Result<&str, Utf8Error>

pub fn to_utf8_lossy(&self) -> String

pub fn to_cstring(&self) -> Option<CString>

pub fn to_kanzi_string(&self) -> KanziString

pub const fn empty() -> &'static KanziStr

pub const fn is_empty(&self) -> bool

pub const fn len(&self) -> usize

Trait Implementations§

§

impl AsRef<KanziStr> for [i8]

§

fn as_ref(&self) -> &KanziStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<KanziStr> for [u8]

§

fn as_ref(&self) -> &KanziStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<KanziStr> for KanziStr

§

fn as_ref(&self) -> &KanziStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<KanziStr> for Path

§

fn as_ref(&self) -> &KanziStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<KanziStr> for str

§

fn as_ref(&self) -> &KanziStr

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Debug for KanziStr

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Display for KanziStr

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'a> From<&'a str> for &'a KanziStr

§

fn from(value: &'a str) -> &'a KanziStr

Converts to this type from the input type.
§

impl<'a> PartialEq<&'a KanziStr> for KanziString

§

fn eq(&self, rhs: &&'a KanziStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<'a> PartialEq<&'a str> for KanziStr

§

fn eq(&self, rhs: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<KanziStr> for KanziString

§

fn eq(&self, rhs: &KanziStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<str> for KanziStr

§

fn eq(&self, rhs: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for KanziStr

§

fn eq(&self, other: &KanziStr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for KanziStr

§

impl StructuralPartialEq for KanziStr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more