Struct imgui::ImStr

source ·
pub struct ImStr(/* private fields */);
Expand description

A UTF-8 encoded, implicitly nul-terminated string slice.

Implementations§

source§

impl ImStr

source

pub unsafe fn from_ptr_unchecked<'a>(ptr: *const c_char) -> &'a ImStr

Wraps a raw UTF-8 encoded C string

§Safety

It is up to the caller to guarantee the pointer is not null and it points to a null-terminated UTF-8 string valid for the duration of the arbitrary lifetime ’a.

source

pub unsafe fn from_utf8_with_nul_unchecked(bytes: &[u8]) -> &ImStr

Converts a slice of bytes to an imgui-rs string slice without checking for valid UTF-8 or null termination.

§Safety

It is up to the caller to guarantee the slice contains valid UTF-8 and a null terminator.

source

pub unsafe fn from_cstr_unchecked(value: &CStr) -> &ImStr

Converts a CStr reference to an imgui-rs string slice without checking for valid UTF-8.

§Safety

It is up to the caller to guarantee the CStr reference contains valid UTF-8.

source

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

Converts an imgui-rs string slice to a raw pointer

source

pub fn to_str(&self) -> &str

Converts an imgui-rs string slice to a normal string slice

source

pub fn is_empty(&self) -> bool

Returns true if the imgui-rs string slice is empty

Trait Implementations§

source§

impl AsRef<CStr> for ImStr

source§

fn as_ref(&self) -> &CStr

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

impl AsRef<ImStr> for ImStr

source§

fn as_ref(&self) -> &ImStr

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

impl AsRef<ImStr> for ImString

source§

fn as_ref(&self) -> &ImStr

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

impl AsRef<str> for ImStr

source§

fn as_ref(&self) -> &str

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

impl Borrow<ImStr> for ImString

source§

fn borrow(&self) -> &ImStr

Immutably borrows from an owned value. Read more
source§

impl Debug for ImStr

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> Default for &'a ImStr

source§

fn default() -> &'a ImStr

Returns the “default value” for a type. Read more
source§

impl Display for ImStr

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a ImStr> for Cow<'a, ImStr>

source§

fn from(s: &'a ImStr) -> Cow<'a, ImStr>

Converts to this type from the input type.
source§

impl Hash for ImStr

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
source§

impl Ord for ImStr

source§

fn cmp(&self, other: &ImStr) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl PartialEq for ImStr

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl PartialOrd for ImStr

source§

fn partial_cmp(&self, other: &ImStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl ToOwned for ImStr

§

type Owned = ImString

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> ImString

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for ImStr

source§

impl StructuralPartialEq for ImStr

Auto Trait Implementations§

§

impl Freeze for ImStr

§

impl RefUnwindSafe for ImStr

§

impl Send for ImStr

§

impl !Sized for ImStr

§

impl Sync for ImStr

§

impl Unpin for ImStr

§

impl UnwindSafe for ImStr

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§

default fn to_string(&self) -> String

Converts the given value to a String. Read more