Struct objc2_foundation::NSMutableData
source · #[repr(C)]pub struct NSMutableData { /* private fields */ }
NSData
only.Implementations§
source§impl NSMutableData
impl NSMutableData
source§impl NSMutableData
impl NSMutableData
pub fn bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn extend_from_slice(&mut self, bytes: &[u8])
pub fn push(&mut self, byte: u8)
pub fn replace_range(&mut self, range: Range<usize>, bytes: &[u8])
NSRange
only.pub fn set_bytes(&mut self, bytes: &[u8])
NSRange
only.source§impl NSMutableData
impl NSMutableData
Methods declared on superclass NSData
NSDataCreation
pub unsafe fn data() -> Retained<Self>
pub unsafe fn dataWithBytes_length( bytes: *mut c_void, length: NSUInteger ) -> Retained<Self>
pub unsafe fn dataWithBytesNoCopy_length( bytes: NonNull<c_void>, length: NSUInteger ) -> Retained<Self>
pub unsafe fn dataWithBytesNoCopy_length_freeWhenDone( bytes: NonNull<c_void>, length: NSUInteger, b: bool ) -> Retained<Self>
pub unsafe fn dataWithContentsOfFile_options_error( path: &NSString, read_options_mask: NSDataReadingOptions ) -> Result<Retained<Self>, Retained<NSError>>
NSError
and NSString
only.pub unsafe fn dataWithContentsOfURL_options_error( url: &NSURL, read_options_mask: NSDataReadingOptions ) -> Result<Retained<Self>, Retained<NSError>>
NSError
and NSURL
only.pub unsafe fn dataWithContentsOfFile(path: &NSString) -> Option<Retained<Self>>
NSString
only.pub unsafe fn dataWithContentsOfURL(url: &NSURL) -> Option<Retained<Self>>
NSURL
only.pub unsafe fn initWithBytes_length( this: Allocated<Self>, bytes: *mut c_void, length: NSUInteger ) -> Retained<Self>
pub unsafe fn initWithBytesNoCopy_length( this: Allocated<Self>, bytes: NonNull<c_void>, length: NSUInteger ) -> Retained<Self>
pub unsafe fn initWithBytesNoCopy_length_freeWhenDone( this: Allocated<Self>, bytes: NonNull<c_void>, length: NSUInteger, b: bool ) -> Retained<Self>
pub unsafe fn initWithBytesNoCopy_length_deallocator( this: Allocated<Self>, bytes: NonNull<c_void>, length: NSUInteger, deallocator: Option<&Block<dyn Fn(NonNull<c_void>, NSUInteger)>> ) -> Retained<Self>
block2
only.pub unsafe fn initWithContentsOfFile_options_error( this: Allocated<Self>, path: &NSString, read_options_mask: NSDataReadingOptions ) -> Result<Retained<Self>, Retained<NSError>>
NSError
and NSString
only.pub unsafe fn initWithContentsOfURL_options_error( this: Allocated<Self>, url: &NSURL, read_options_mask: NSDataReadingOptions ) -> Result<Retained<Self>, Retained<NSError>>
NSError
and NSURL
only.pub unsafe fn initWithContentsOfFile( this: Allocated<Self>, path: &NSString ) -> Option<Retained<Self>>
NSString
only.pub unsafe fn initWithContentsOfURL( this: Allocated<Self>, url: &NSURL ) -> Option<Retained<Self>>
NSURL
only.pub unsafe fn initWithData( this: Allocated<Self>, data: &NSData ) -> Retained<Self>
pub fn dataWithData(data: &NSData) -> Retained<Self>
source§impl NSMutableData
impl NSMutableData
Methods declared on superclass NSData
NSDataBase64Encoding
pub unsafe fn initWithBase64EncodedString_options( this: Allocated<Self>, base64_string: &NSString, options: NSDataBase64DecodingOptions ) -> Option<Retained<Self>>
NSString
only.pub unsafe fn initWithBase64EncodedData_options( this: Allocated<Self>, base64_data: &NSData, options: NSDataBase64DecodingOptions ) -> Option<Retained<Self>>
source§impl NSMutableData
impl NSMutableData
Methods declared on superclass NSData
NSDeprecated
pub unsafe fn initWithContentsOfMappedFile( this: Allocated<Self>, path: &NSString ) -> Option<Retained<Self>>
NSString
only.pub unsafe fn initWithBase64Encoding( this: Allocated<Self>, base64_string: &NSString ) -> Option<Retained<Self>>
NSString
only.source§impl NSMutableData
impl NSMutableData
pub fn setLength(&mut self, length: NSUInteger)
source§impl NSMutableData
impl NSMutableData
Methods declared on superclass NSObject
source§impl NSMutableData
impl NSMutableData
NSExtendedMutableData
pub unsafe fn appendBytes_length( &mut self, bytes: NonNull<c_void>, length: NSUInteger )
pub unsafe fn appendData(&mut self, other: &NSData)
pub unsafe fn increaseLengthBy(&mut self, extra_length: NSUInteger)
pub unsafe fn replaceBytesInRange_withBytes( &mut self, range: NSRange, bytes: NonNull<c_void> )
NSRange
only.pub unsafe fn resetBytesInRange(&mut self, range: NSRange)
NSRange
only.pub unsafe fn setData(&mut self, data: &NSData)
pub unsafe fn replaceBytesInRange_withBytes_length( &mut self, range: NSRange, replacement_bytes: *mut c_void, replacement_length: NSUInteger )
NSRange
only.source§impl NSMutableData
impl NSMutableData
NSMutableDataCreation
pub fn dataWithCapacity(a_num_items: NSUInteger) -> Option<Retained<Self>>
pub unsafe fn dataWithLength(length: NSUInteger) -> Option<Retained<Self>>
pub fn initWithCapacity( this: Allocated<Self>, capacity: NSUInteger ) -> Option<Retained<Self>>
pub unsafe fn initWithLength( this: Allocated<Self>, length: NSUInteger ) -> Option<Retained<Self>>
source§impl NSMutableData
impl NSMutableData
NSMutableDataCompression
pub unsafe fn decompressUsingAlgorithm_error( &mut self, algorithm: NSDataCompressionAlgorithm ) -> Result<(), Retained<NSError>>
NSError
only.pub unsafe fn compressUsingAlgorithm_error( &mut self, algorithm: NSDataCompressionAlgorithm ) -> Result<(), Retained<NSError>>
NSError
only.Methods from Deref<Target = NSData>§
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn bytes(&self) -> &[u8] ⓘ
pub fn length(&self) -> NSUInteger
pub unsafe fn description(&self) -> Retained<NSString>
NSString
only.pub unsafe fn getBytes_length( &self, buffer: NonNull<c_void>, length: NSUInteger )
pub unsafe fn getBytes_range(&self, buffer: NonNull<c_void>, range: NSRange)
NSRange
only.pub unsafe fn isEqualToData(&self, other: &NSData) -> bool
pub unsafe fn subdataWithRange(&self, range: NSRange) -> Retained<NSData>
NSRange
only.pub unsafe fn writeToFile_atomically( &self, path: &NSString, use_auxiliary_file: bool ) -> bool
NSString
only.pub unsafe fn writeToURL_atomically( &self, url: &NSURL, atomically: bool ) -> bool
NSURL
only.pub unsafe fn writeToFile_options_error( &self, path: &NSString, write_options_mask: NSDataWritingOptions ) -> Result<(), Retained<NSError>>
NSError
and NSString
only.pub unsafe fn writeToURL_options_error( &self, url: &NSURL, write_options_mask: NSDataWritingOptions ) -> Result<(), Retained<NSError>>
NSError
and NSURL
only.pub unsafe fn rangeOfData_options_range( &self, data_to_find: &NSData, mask: NSDataSearchOptions, search_range: NSRange ) -> NSRange
NSRange
only.pub unsafe fn enumerateByteRangesUsingBlock( &self, block: &Block<dyn Fn(NonNull<c_void>, NSRange, NonNull<Bool>) + '_> )
NSRange
and block2
only.pub unsafe fn base64EncodedStringWithOptions( &self, options: NSDataBase64EncodingOptions ) -> Retained<NSString>
NSString
only.pub unsafe fn base64EncodedDataWithOptions( &self, options: NSDataBase64EncodingOptions ) -> Retained<NSData>
pub unsafe fn decompressedDataUsingAlgorithm_error( &self, algorithm: NSDataCompressionAlgorithm ) -> Result<Retained<Self>, Retained<NSError>>
NSError
only.pub unsafe fn compressedDataUsingAlgorithm_error( &self, algorithm: NSDataCompressionAlgorithm ) -> Result<Retained<Self>, Retained<NSError>>
NSError
only.pub unsafe fn getBytes(&self, buffer: NonNull<c_void>)
pub unsafe fn base64Encoding(&self) -> Retained<NSString>
NSString
only.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<[u8]> for NSMutableData
impl AsMut<[u8]> for NSMutableData
source§impl AsMut<AnyObject> for NSMutableData
impl AsMut<AnyObject> for NSMutableData
source§impl AsMut<NSData> for NSMutableData
impl AsMut<NSData> for NSMutableData
source§impl AsMut<NSMutableData> for NSMutableData
impl AsMut<NSMutableData> for NSMutableData
source§impl AsMut<NSMutableData> for NSPurgeableData
impl AsMut<NSMutableData> for NSPurgeableData
source§fn as_mut(&mut self) -> &mut NSMutableData ⓘ
fn as_mut(&mut self) -> &mut NSMutableData ⓘ
source§impl AsMut<NSObject> for NSMutableData
impl AsMut<NSObject> for NSMutableData
source§impl AsRef<[u8]> for NSMutableData
impl AsRef<[u8]> for NSMutableData
source§impl AsRef<AnyObject> for NSMutableData
impl AsRef<AnyObject> for NSMutableData
source§impl AsRef<NSData> for NSMutableData
impl AsRef<NSData> for NSMutableData
source§impl AsRef<NSMutableData> for NSMutableData
impl AsRef<NSMutableData> for NSMutableData
source§impl AsRef<NSMutableData> for NSPurgeableData
impl AsRef<NSMutableData> for NSPurgeableData
source§fn as_ref(&self) -> &NSMutableData ⓘ
fn as_ref(&self) -> &NSMutableData ⓘ
source§impl AsRef<NSObject> for NSMutableData
impl AsRef<NSObject> for NSMutableData
source§impl Borrow<AnyObject> for NSMutableData
impl Borrow<AnyObject> for NSMutableData
source§impl Borrow<NSData> for NSMutableData
impl Borrow<NSData> for NSMutableData
source§impl Borrow<NSMutableData> for NSPurgeableData
impl Borrow<NSMutableData> for NSPurgeableData
source§impl Borrow<NSObject> for NSMutableData
impl Borrow<NSObject> for NSMutableData
source§impl BorrowMut<AnyObject> for NSMutableData
impl BorrowMut<AnyObject> for NSMutableData
source§fn borrow_mut(&mut self) -> &mut AnyObject
fn borrow_mut(&mut self) -> &mut AnyObject
source§impl BorrowMut<NSData> for NSMutableData
impl BorrowMut<NSData> for NSMutableData
source§fn borrow_mut(&mut self) -> &mut NSData
fn borrow_mut(&mut self) -> &mut NSData
source§impl BorrowMut<NSMutableData> for NSPurgeableData
impl BorrowMut<NSMutableData> for NSPurgeableData
source§fn borrow_mut(&mut self) -> &mut NSMutableData ⓘ
fn borrow_mut(&mut self) -> &mut NSMutableData ⓘ
source§impl BorrowMut<NSObject> for NSMutableData
impl BorrowMut<NSObject> for NSMutableData
source§fn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
source§impl ClassType for NSMutableData
impl ClassType for NSMutableData
§type Mutability = MutableWithImmutableSuperclass<NSData>
type Mutability = MutableWithImmutableSuperclass<NSData>
source§const NAME: &'static str = "NSMutableData"
const NAME: &'static str = "NSMutableData"
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 NSMutableData
impl Debug for NSMutableData
source§impl DefaultRetained for NSMutableData
impl DefaultRetained for NSMutableData
source§impl Deref for NSMutableData
impl Deref for NSMutableData
source§impl DerefMut for NSMutableData
impl DerefMut for NSMutableData
source§impl<'a> Extend<&'a u8> for NSMutableData
impl<'a> Extend<&'a u8> for NSMutableData
source§fn extend<T: IntoIterator<Item = &'a u8>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'a u8>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<u8> for NSMutableData
impl Extend<u8> for NSMutableData
source§fn extend<T: IntoIterator<Item = u8>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = u8>>(&mut self, iter: T)
You should use extend_from_slice
whenever possible, it is more
performant.
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Hash for NSMutableData
impl Hash for NSMutableData
source§impl<I: SliceIndex<[u8]>> Index<I> for NSMutableData
impl<I: SliceIndex<[u8]>> Index<I> for NSMutableData
source§impl<I: SliceIndex<[u8]>> IndexMut<I> for NSMutableData
impl<I: SliceIndex<[u8]>> IndexMut<I> for NSMutableData
source§impl<'a> IntoIterator for &'a NSMutableData
impl<'a> IntoIterator for &'a NSMutableData
source§impl<'a> IntoIterator for &'a mut NSMutableData
impl<'a> IntoIterator for &'a mut NSMutableData
source§impl NSCoding for NSMutableData
Available on crate feature NSObject
only.
impl NSCoding for NSMutableData
NSObject
only.source§impl NSCopying for NSMutableData
Available on crate feature NSObject
only.
impl NSCopying for NSMutableData
NSObject
only.source§impl NSMutableCopying for NSMutableData
Available on crate feature NSObject
only.
impl NSMutableCopying for NSMutableData
NSObject
only.source§impl NSObjectProtocol for NSMutableData
impl NSObjectProtocol for NSMutableData
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 NSMutableData
Available on crate feature NSObject
only.
impl NSSecureCoding for NSMutableData
NSObject
only.source§impl PartialEq for NSMutableData
impl PartialEq for NSMutableData
source§fn eq(&self, other: &NSMutableData) -> bool
fn eq(&self, other: &NSMutableData) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl RefEncode for NSMutableData
impl RefEncode for NSMutableData
source§const ENCODING_REF: Encoding = <NSData as ::objc2::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <NSData as ::objc2::RefEncode>::ENCODING_REF
source§impl RetainedFromIterator<u8> for NSMutableData
Available on crate feature block2
only.
impl RetainedFromIterator<u8> for NSMutableData
block2
only.source§fn id_from_iter<I: IntoIterator<Item = u8>>(iter: I) -> Retained<Self>
fn id_from_iter<I: IntoIterator<Item = u8>>(iter: I) -> Retained<Self>
Retained
from an iterator. Read moresource§fn retained_from_iter<I>(iter: I) -> Retained<Self>where
I: IntoIterator<Item = T>,
fn retained_from_iter<I>(iter: I) -> Retained<Self>where
I: IntoIterator<Item = T>,
Retained
from an iterator.source§impl ToOwned for NSMutableData
Available on crate feature NSObject
only.
impl ToOwned for NSMutableData
NSObject
only.§type Owned = Retained<NSMutableData>
type Owned = Retained<NSMutableData>
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)
source§impl Write for NSMutableData
impl Write for NSMutableData
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)impl Eq for NSMutableData
impl Message for NSMutableData
impl StructuralPartialEq for NSMutableData
Auto Trait Implementations§
impl !Freeze for NSMutableData
impl RefUnwindSafe for NSMutableData
impl Send for NSMutableData
impl Sync for NSMutableData
impl !Unpin for NSMutableData
impl UnwindSafe for NSMutableData
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