use core::fmt;
use core::panic::{RefUnwindSafe, UnwindSafe};
use objc2::rc::Retained;
use objc2::ClassType;
use crate::Foundation::*;
unsafe impl Sync for NSAttributedString {}
unsafe impl Send for NSAttributedString {}
impl UnwindSafe for NSAttributedString {}
impl RefUnwindSafe for NSAttributedString {}
impl NSAttributedString {
#[doc(alias = "initWithString:")]
#[cfg(feature = "NSDictionary")]
#[cfg(feature = "NSString")]
pub unsafe fn new_with_attributes(
string: &NSString,
attributes: &NSDictionary<NSAttributedStringKey, objc2::runtime::AnyObject>,
) -> Retained<Self> {
unsafe { Self::initWithString_attributes(Self::alloc(), string, Some(attributes)) }
}
#[doc(alias = "initWithString:")]
#[cfg(feature = "NSString")]
pub fn from_nsstring(string: &NSString) -> Retained<Self> {
Self::initWithString(Self::alloc(), string)
}
}
impl NSMutableAttributedString {
#[doc(alias = "initWithString:")]
#[cfg(feature = "NSString")]
pub fn from_nsstring(string: &NSString) -> Retained<Self> {
Self::initWithString(Self::alloc(), string)
}
#[doc(alias = "initWithAttributedString:")]
pub fn from_attributed_nsstring(attributed_string: &NSAttributedString) -> Retained<Self> {
Self::initWithAttributedString(Self::alloc(), attributed_string)
}
}
impl fmt::Debug for NSAttributedString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let obj: &NSObject = self;
fmt::Debug::fmt(obj, f)
}
}
impl fmt::Debug for NSMutableAttributedString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}