pub struct NSString<'a> {
    pub objc: Id<Object>,
    /* private fields */
}
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

Creates a new NSString.

Creates a new NSString without copying the bytes for the passed-in string.

In cases where we’re vended an NSString by the system, this can be used to wrap and retain it.

In some cases, we want to wrap a system-provided NSString without retaining it.

Utility method for checking whether an NSObject is an NSString.

A utility method for taking an NSString and bridging it to a Rust &str.

A utility method for taking an NSString and getting an owned String from it.

Methods from Deref<Target = Object>

Returns the class of self.

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.

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.

Sets the value of 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

Formats the value using the given formatter. Read more

Derefs to the underlying Objective-C Object.

The resulting type after dereferencing.

Derefs to the underlying Objective-C Object.

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Consumes and returns the pointer to the underlying NSString instance.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.