Struct cacao::foundation::NSString
source · [−]Expand description
A wrapper for NSString
.
We can make a few safety guarantees in this module as the UTF8 code on the Foundation side is fairly battle tested.
Fields
objc: Id<Object>
A reference to the backing NSString
.
Implementations
sourceimpl<'a> NSString<'a>
impl<'a> NSString<'a>
sourcepub fn no_copy(s: &'a str) -> Self
pub fn no_copy(s: &'a str) -> Self
Creates a new NSString
without copying the bytes for the passed-in string.
sourcepub fn retain(object: id) -> Self
pub fn retain(object: id) -> Self
In cases where we’re vended an NSString
by the system, this can be used to wrap and
retain it.
sourcepub fn from_retained(object: id) -> Self
pub fn from_retained(object: id) -> Self
In some cases, we want to wrap a system-provided NSString without retaining it.
Methods from Deref<Target = Object>
sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &T where
T: Encode,
pub unsafe fn get_ivar<T>(&self, name: &str) -> &T where
T: Encode,
Returns a reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T where
T: Encode,
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut T where
T: Encode,
Returns a mutable reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
Trait Implementations
sourceimpl From<NSString<'_>> for SessionRole
Available on crate feature uikit
only.
impl From<NSString<'_>> for SessionRole
uikit
only.sourceimpl From<NotificationName> for NSString<'_>
impl From<NotificationName> for NSString<'_>
sourcefn from(name: NotificationName) -> Self
fn from(name: NotificationName) -> Self
Converts to this type from the input type.
sourceimpl From<PasteboardName> for NSString<'_>
impl From<PasteboardName> for NSString<'_>
sourcefn from(name: PasteboardName) -> Self
fn from(name: PasteboardName) -> Self
Converts to this type from the input type.
sourceimpl From<PasteboardType> for NSString<'_>
impl From<PasteboardType> for NSString<'_>
sourcefn from(pboard_type: PasteboardType) -> Self
fn from(pboard_type: PasteboardType) -> Self
Converts to this type from the input type.
sourceimpl From<SessionRole> for NSString<'_>
Available on crate feature uikit
only.
impl From<SessionRole> for NSString<'_>
uikit
only.sourcefn from(role: SessionRole) -> Self
fn from(role: SessionRole) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<'a> RefUnwindSafe for NSString<'a>
impl<'a> Send for NSString<'a>
impl<'a> Sync for NSString<'a>
impl<'a> Unpin for NSString<'a>
impl<'a> UnwindSafe for NSString<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more