Struct objc2_foundation::NSAttributedString
source · #[repr(C)]pub struct NSAttributedString { /* private fields */ }
NSAttributedString
only.Implementations§
source§impl NSAttributedString
impl NSAttributedString
sourcepub unsafe fn new_with_attributes(
string: &NSString,
attributes: &NSDictionary<NSAttributedStringKey, AnyObject>
) -> Retained<Self>
Available on crate features NSDictionary
and NSString
only.
pub unsafe fn new_with_attributes( string: &NSString, attributes: &NSDictionary<NSAttributedStringKey, AnyObject> ) -> Retained<Self>
NSDictionary
and NSString
only.Creates a new attributed string from the given string and attributes.
The attributes are associated with every UTF-16 code unit in the string.
§Safety
The attributes must be valid.
sourcepub fn from_nsstring(string: &NSString) -> Retained<Self>
Available on crate feature NSString
only.
pub fn from_nsstring(string: &NSString) -> Retained<Self>
NSString
only.Creates a new attributed string without any attributes.
source§impl NSAttributedString
impl NSAttributedString
pub fn string(&self) -> Retained<NSString>
NSString
only.pub unsafe fn attributesAtIndex_effectiveRange( &self, location: NSUInteger, range: NSRangePointer ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>
NSDictionary
and NSRange
and NSString
only.source§impl NSAttributedString
impl NSAttributedString
Methods declared on superclass NSObject
source§impl NSAttributedString
impl NSAttributedString
NSExtendedAttributedString
pub fn length(&self) -> NSUInteger
pub unsafe fn attribute_atIndex_effectiveRange( &self, attr_name: &NSAttributedStringKey, location: NSUInteger, range: NSRangePointer ) -> Option<Retained<AnyObject>>
NSRange
and NSString
only.pub unsafe fn attributedSubstringFromRange( &self, range: NSRange ) -> Retained<NSAttributedString>
NSRange
only.pub unsafe fn attributesAtIndex_longestEffectiveRange_inRange( &self, location: NSUInteger, range: NSRangePointer, range_limit: NSRange ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>
NSDictionary
and NSRange
and NSString
only.pub unsafe fn attribute_atIndex_longestEffectiveRange_inRange( &self, attr_name: &NSAttributedStringKey, location: NSUInteger, range: NSRangePointer, range_limit: NSRange ) -> Option<Retained<AnyObject>>
NSRange
and NSString
only.pub unsafe fn isEqualToAttributedString( &self, other: &NSAttributedString ) -> bool
pub fn initWithString(this: Allocated<Self>, str: &NSString) -> Retained<Self>
NSString
only.pub unsafe fn initWithString_attributes( this: Allocated<Self>, str: &NSString, attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>> ) -> Retained<Self>
NSDictionary
and NSString
only.pub fn initWithAttributedString( this: Allocated<Self>, attr_str: &NSAttributedString ) -> Retained<Self>
pub unsafe fn enumerateAttributesInRange_options_usingBlock( &self, enumeration_range: NSRange, opts: NSAttributedStringEnumerationOptions, block: &Block<dyn Fn(NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>, NSRange, NonNull<Bool>) + '_> )
NSDictionary
and NSRange
and NSString
and block2
only.pub unsafe fn enumerateAttribute_inRange_options_usingBlock( &self, attr_name: &NSAttributedStringKey, enumeration_range: NSRange, opts: NSAttributedStringEnumerationOptions, block: &Block<dyn Fn(*mut AnyObject, NSRange, NonNull<Bool>) + '_> )
NSRange
and NSString
and block2
only.source§impl NSAttributedString
impl NSAttributedString
NSAttributedStringCreateFromMarkdown
pub unsafe fn initWithContentsOfMarkdownFileAtURL_options_baseURL_error( this: Allocated<Self>, markdown_file: &NSURL, options: Option<&NSAttributedStringMarkdownParsingOptions>, base_url: Option<&NSURL> ) -> Result<Retained<Self>, Retained<NSError>>
NSError
and NSURL
only.pub unsafe fn initWithMarkdown_options_baseURL_error( this: Allocated<Self>, markdown: &NSData, options: Option<&NSAttributedStringMarkdownParsingOptions>, base_url: Option<&NSURL> ) -> Result<Retained<Self>, Retained<NSError>>
NSData
and NSError
and NSURL
only.pub unsafe fn initWithMarkdownString_options_baseURL_error( this: Allocated<Self>, markdown_string: &NSString, options: Option<&NSAttributedStringMarkdownParsingOptions>, base_url: Option<&NSURL> ) -> Result<Retained<Self>, Retained<NSError>>
NSError
and NSString
and NSURL
only.impl NSAttributedString
NSAttributedStringFormatting
source§impl NSAttributedString
impl NSAttributedString
NSMorphology
pub unsafe fn attributedStringByInflectingString( &self ) -> Retained<NSAttributedString>
Methods from Deref<Target = NSObject>§
sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load_mut
instead.
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
Ivar::load_mut
instead.Use Ivar::load_mut
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Trait Implementations§
source§impl AsMut<AnyObject> for NSAttributedString
impl AsMut<AnyObject> for NSAttributedString
source§impl AsMut<NSAttributedString> for NSAttributedString
impl AsMut<NSAttributedString> for NSAttributedString
source§impl AsMut<NSAttributedString> for NSMutableAttributedString
impl AsMut<NSAttributedString> for NSMutableAttributedString
source§fn as_mut(&mut self) -> &mut NSAttributedString
fn as_mut(&mut self) -> &mut NSAttributedString
source§impl AsMut<NSObject> for NSAttributedString
impl AsMut<NSObject> for NSAttributedString
source§impl AsRef<AnyObject> for NSAttributedString
impl AsRef<AnyObject> for NSAttributedString
source§impl AsRef<NSAttributedString> for NSAttributedString
impl AsRef<NSAttributedString> for NSAttributedString
source§impl AsRef<NSAttributedString> for NSMutableAttributedString
impl AsRef<NSAttributedString> for NSMutableAttributedString
source§fn as_ref(&self) -> &NSAttributedString
fn as_ref(&self) -> &NSAttributedString
source§impl AsRef<NSObject> for NSAttributedString
impl AsRef<NSObject> for NSAttributedString
source§impl Borrow<AnyObject> for NSAttributedString
impl Borrow<AnyObject> for NSAttributedString
source§impl Borrow<NSAttributedString> for NSMutableAttributedString
impl Borrow<NSAttributedString> for NSMutableAttributedString
source§fn borrow(&self) -> &NSAttributedString
fn borrow(&self) -> &NSAttributedString
source§impl Borrow<NSObject> for NSAttributedString
impl Borrow<NSObject> for NSAttributedString
source§impl BorrowMut<AnyObject> for NSAttributedString
impl BorrowMut<AnyObject> for NSAttributedString
source§fn borrow_mut(&mut self) -> &mut AnyObject
fn borrow_mut(&mut self) -> &mut AnyObject
source§impl BorrowMut<NSAttributedString> for NSMutableAttributedString
impl BorrowMut<NSAttributedString> for NSMutableAttributedString
source§fn borrow_mut(&mut self) -> &mut NSAttributedString
fn borrow_mut(&mut self) -> &mut NSAttributedString
source§impl BorrowMut<NSObject> for NSAttributedString
impl BorrowMut<NSObject> for NSAttributedString
source§fn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
source§impl ClassType for NSAttributedString
impl ClassType for NSAttributedString
§type Mutability = ImmutableWithMutableSubclass<NSMutableAttributedString>
type Mutability = ImmutableWithMutableSubclass<NSMutableAttributedString>
source§const NAME: &'static str = "NSAttributedString"
const NAME: &'static str = "NSAttributedString"
source§fn class() -> &'static AnyClass
fn class() -> &'static AnyClass
source§fn as_super_mut(&mut self) -> &mut Self::Super
fn as_super_mut(&mut self) -> &mut Self::Super
source§impl Debug for NSAttributedString
impl Debug for NSAttributedString
source§impl DefaultRetained for NSAttributedString
impl DefaultRetained for NSAttributedString
source§impl Deref for NSAttributedString
impl Deref for NSAttributedString
source§impl DerefMut for NSAttributedString
impl DerefMut for NSAttributedString
source§impl Hash for NSAttributedString
impl Hash for NSAttributedString
source§impl NSCoding for NSAttributedString
Available on crate feature NSObject
only.
impl NSCoding for NSAttributedString
NSObject
only.source§impl NSCopying for NSAttributedString
Available on crate feature NSObject
only.
impl NSCopying for NSAttributedString
NSObject
only.source§impl NSMutableCopying for NSAttributedString
Available on crate feature NSObject
only.
impl NSMutableCopying for NSAttributedString
NSObject
only.source§impl NSObjectProtocol for NSAttributedString
impl NSObjectProtocol for NSAttributedString
source§fn isEqual(&self, other: &AnyObject) -> bool
fn isEqual(&self, other: &AnyObject) -> bool
source§fn hash(&self) -> usize
fn hash(&self) -> usize
source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
source§fn isMemberOfClass(&self, cls: &AnyClass) -> bool
fn isMemberOfClass(&self, cls: &AnyClass) -> bool
source§fn respondsToSelector(&self, aSelector: Sel) -> bool
fn respondsToSelector(&self, aSelector: Sel) -> bool
source§fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
source§fn debugDescription(&self) -> Retained<NSObject>
fn debugDescription(&self) -> Retained<NSObject>
source§impl NSSecureCoding for NSAttributedString
Available on crate feature NSObject
only.
impl NSSecureCoding for NSAttributedString
NSObject
only.source§impl PartialEq for NSAttributedString
impl PartialEq for NSAttributedString
source§fn eq(&self, other: &NSAttributedString) -> bool
fn eq(&self, other: &NSAttributedString) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl RefEncode for NSAttributedString
impl RefEncode for NSAttributedString
source§const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
source§impl ToOwned for NSAttributedString
Available on crate feature NSObject
only.
impl ToOwned for NSAttributedString
NSObject
only.§type Owned = Retained<NSAttributedString>
type Owned = Retained<NSAttributedString>
source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
1.63.0 · source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
impl Eq for NSAttributedString
impl Message for NSAttributedString
impl RefUnwindSafe for NSAttributedString
impl Send for NSAttributedString
impl StructuralPartialEq for NSAttributedString
impl Sync for NSAttributedString
impl UnwindSafe for NSAttributedString
Auto Trait Implementations§
impl !Freeze for NSAttributedString
impl !Unpin for NSAttributedString
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CounterpartOrSelf for T
impl<T> CounterpartOrSelf for T
§type Immutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Immutable
type Immutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Immutable
Self
if the type has no
immutable counterpart. Read more§type Mutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Mutable
type Mutable = <<T as ClassType>::Mutability as MutabilityCounterpartOrSelf<T>>::Mutable
Self
if the type has no
mutable counterpart. Read more