//! This file has been automatically generated by `objc2`'s `header-translator`. //! DO NOT EDIT use core::ptr::NonNull; use objc2::__framework_prelude::*; use crate::*; /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsjsonreadingoptions?language=objc) // NS_OPTIONS #[repr(transparent)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct NSJSONReadingOptions(pub NSUInteger); bitflags::bitflags! { impl NSJSONReadingOptions: NSUInteger { #[doc(alias = "NSJSONReadingMutableContainers")] const MutableContainers = 1<<0; #[doc(alias = "NSJSONReadingMutableLeaves")] const MutableLeaves = 1<<1; #[doc(alias = "NSJSONReadingFragmentsAllowed")] const FragmentsAllowed = 1<<2; #[doc(alias = "NSJSONReadingJSON5Allowed")] const JSON5Allowed = 1<<3; #[doc(alias = "NSJSONReadingTopLevelDictionaryAssumed")] const TopLevelDictionaryAssumed = 1<<4; #[doc(alias = "NSJSONReadingAllowFragments")] #[deprecated] const AllowFragments = NSJSONReadingOptions::FragmentsAllowed.0; } } unsafe impl Encode for NSJSONReadingOptions { const ENCODING: Encoding = NSUInteger::ENCODING; } unsafe impl RefEncode for NSJSONReadingOptions { const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); } /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsjsonwritingoptions?language=objc) // NS_OPTIONS #[repr(transparent)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct NSJSONWritingOptions(pub NSUInteger); bitflags::bitflags! { impl NSJSONWritingOptions: NSUInteger { #[doc(alias = "NSJSONWritingPrettyPrinted")] const PrettyPrinted = 1<<0; #[doc(alias = "NSJSONWritingSortedKeys")] const SortedKeys = 1<<1; #[doc(alias = "NSJSONWritingFragmentsAllowed")] const FragmentsAllowed = 1<<2; #[doc(alias = "NSJSONWritingWithoutEscapingSlashes")] const WithoutEscapingSlashes = 1<<3; } } unsafe impl Encode for NSJSONWritingOptions { const ENCODING: Encoding = NSUInteger::ENCODING; } unsafe impl RefEncode for NSJSONWritingOptions { const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING); } extern_class!( /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsjsonserialization?language=objc) #[unsafe(super(NSObject))] #[derive(Debug, PartialEq, Eq, Hash)] pub struct NSJSONSerialization; ); extern_conformance!( unsafe impl NSObjectProtocol for NSJSONSerialization {} ); impl NSJSONSerialization { extern_methods!( /// # Safety /// /// `obj` should be of the correct type. #[unsafe(method(isValidJSONObject:))] #[unsafe(method_family = none)] pub unsafe fn isValidJSONObject(obj: &AnyObject) -> bool; #[cfg(all(feature = "NSData", feature = "NSError"))] /// # Safety /// /// `obj` should be of the correct type. #[unsafe(method(dataWithJSONObject:options:error:_))] #[unsafe(method_family = none)] pub unsafe fn dataWithJSONObject_options_error( obj: &AnyObject, opt: NSJSONWritingOptions, ) -> Result, Retained>; #[cfg(all(feature = "NSData", feature = "NSError"))] #[unsafe(method(JSONObjectWithData:options:error:_))] #[unsafe(method_family = none)] pub fn JSONObjectWithData_options_error( data: &NSData, opt: NSJSONReadingOptions, ) -> Result, Retained>; #[cfg(all(feature = "NSError", feature = "NSStream"))] #[unsafe(method(JSONObjectWithStream:options:error:_))] #[unsafe(method_family = none)] pub fn JSONObjectWithStream_options_error( stream: &NSInputStream, opt: NSJSONReadingOptions, ) -> Result, Retained>; ); } /// Methods declared on superclass `NSObject`. impl NSJSONSerialization { extern_methods!( #[unsafe(method(init))] #[unsafe(method_family = init)] pub fn init(this: Allocated) -> Retained; #[unsafe(method(new))] #[unsafe(method_family = new)] pub fn new() -> Retained; ); } impl DefaultRetained for NSJSONSerialization { #[inline] fn default_retained() -> Retained { Self::new() } }