Struct objc2_foundation::NSURLSession
source · #[repr(C)]pub struct NSURLSession { /* private fields */ }
Available on crate feature
NSURLSession
only.Implementations§
source§impl NSURLSession
impl NSURLSession
pub unsafe fn sessionWithConfiguration( configuration: &NSURLSessionConfiguration ) -> Retained<NSURLSession>
pub unsafe fn sessionWithConfiguration_delegate_delegateQueue( configuration: &NSURLSessionConfiguration, delegate: Option<&ProtocolObject<dyn NSURLSessionDelegate>>, queue: Option<&NSOperationQueue> ) -> Retained<NSURLSession>
Available on crate feature
NSOperation
only.pub unsafe fn delegateQueue(&self) -> Retained<NSOperationQueue>
Available on crate feature
NSOperation
only.pub unsafe fn delegate( &self ) -> Option<Retained<ProtocolObject<dyn NSURLSessionDelegate>>>
pub unsafe fn configuration(&self) -> Retained<NSURLSessionConfiguration>
pub unsafe fn sessionDescription(&self) -> Option<Retained<NSString>>
Available on crate feature
NSString
only.pub unsafe fn setSessionDescription( &self, session_description: Option<&NSString> )
Available on crate feature
NSString
only.pub unsafe fn finishTasksAndInvalidate(&self)
pub unsafe fn invalidateAndCancel(&self)
pub unsafe fn resetWithCompletionHandler( &self, completion_handler: &Block<dyn Fn()> )
Available on crate feature
block2
only.pub unsafe fn flushWithCompletionHandler( &self, completion_handler: &Block<dyn Fn()> )
Available on crate feature
block2
only.pub unsafe fn getTasksWithCompletionHandler( &self, completion_handler: &Block<dyn Fn(NonNull<NSArray<NSURLSessionDataTask>>, NonNull<NSArray<NSURLSessionUploadTask>>, NonNull<NSArray<NSURLSessionDownloadTask>>)> )
Available on crate features
NSArray
and block2
only.pub unsafe fn getAllTasksWithCompletionHandler( &self, completion_handler: &Block<dyn Fn(NonNull<NSArray<NSURLSessionTask>>)> )
Available on crate features
NSArray
and block2
only.pub unsafe fn dataTaskWithRequest( &self, request: &NSURLRequest ) -> Retained<NSURLSessionDataTask>
Available on crate feature
NSURLRequest
only.pub unsafe fn dataTaskWithURL( &self, url: &NSURL ) -> Retained<NSURLSessionDataTask>
Available on crate feature
NSURL
only.pub unsafe fn uploadTaskWithRequest_fromFile( &self, request: &NSURLRequest, file_url: &NSURL ) -> Retained<NSURLSessionUploadTask>
Available on crate features
NSURL
and NSURLRequest
only.pub unsafe fn uploadTaskWithRequest_fromData( &self, request: &NSURLRequest, body_data: &NSData ) -> Retained<NSURLSessionUploadTask>
Available on crate features
NSData
and NSURLRequest
only.pub unsafe fn uploadTaskWithResumeData( &self, resume_data: &NSData ) -> Retained<NSURLSessionUploadTask>
Available on crate feature
NSData
only.pub unsafe fn uploadTaskWithStreamedRequest( &self, request: &NSURLRequest ) -> Retained<NSURLSessionUploadTask>
Available on crate feature
NSURLRequest
only.pub unsafe fn downloadTaskWithRequest( &self, request: &NSURLRequest ) -> Retained<NSURLSessionDownloadTask>
Available on crate feature
NSURLRequest
only.pub unsafe fn downloadTaskWithURL( &self, url: &NSURL ) -> Retained<NSURLSessionDownloadTask>
Available on crate feature
NSURL
only.pub unsafe fn downloadTaskWithResumeData( &self, resume_data: &NSData ) -> Retained<NSURLSessionDownloadTask>
Available on crate feature
NSData
only.pub unsafe fn streamTaskWithHostName_port( &self, hostname: &NSString, port: NSInteger ) -> Retained<NSURLSessionStreamTask>
Available on crate feature
NSString
only.pub unsafe fn streamTaskWithNetService( &self, service: &NSNetService ) -> Retained<NSURLSessionStreamTask>
👎Deprecated: Use nw_connection_t in Network framework instead
Available on crate feature
NSNetServices
only.pub unsafe fn webSocketTaskWithURL( &self, url: &NSURL ) -> Retained<NSURLSessionWebSocketTask>
Available on crate feature
NSURL
only.pub unsafe fn webSocketTaskWithURL_protocols( &self, url: &NSURL, protocols: &NSArray<NSString> ) -> Retained<NSURLSessionWebSocketTask>
Available on crate features
NSArray
and NSString
and NSURL
only.pub unsafe fn webSocketTaskWithRequest( &self, request: &NSURLRequest ) -> Retained<NSURLSessionWebSocketTask>
Available on crate feature
NSURLRequest
only.pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>
👎Deprecated: Please use +[NSURLSession sessionWithConfiguration:] or other class methods to create instances
pub unsafe fn new() -> Retained<Self>
👎Deprecated: Please use +[NSURLSession sessionWithConfiguration:] or other class methods to create instances
source§impl NSURLSession
impl NSURLSession
NSURLSessionAsynchronousConvenience
pub unsafe fn dataTaskWithRequest_completionHandler( &self, request: &NSURLRequest, completion_handler: &Block<dyn Fn(*mut NSData, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionDataTask>
Available on crate features
NSData
and NSError
and NSURLRequest
and NSURLResponse
and block2
only.pub unsafe fn dataTaskWithURL_completionHandler( &self, url: &NSURL, completion_handler: &Block<dyn Fn(*mut NSData, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionDataTask>
Available on crate features
NSData
and NSError
and NSURL
and NSURLResponse
and block2
only.pub unsafe fn uploadTaskWithRequest_fromFile_completionHandler( &self, request: &NSURLRequest, file_url: &NSURL, completion_handler: &Block<dyn Fn(*mut NSData, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionUploadTask>
Available on crate features
NSData
and NSError
and NSURL
and NSURLRequest
and NSURLResponse
and block2
only.pub unsafe fn uploadTaskWithRequest_fromData_completionHandler( &self, request: &NSURLRequest, body_data: Option<&NSData>, completion_handler: &Block<dyn Fn(*mut NSData, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionUploadTask>
Available on crate features
NSData
and NSError
and NSURLRequest
and NSURLResponse
and block2
only.pub unsafe fn uploadTaskWithResumeData_completionHandler( &self, resume_data: &NSData, completion_handler: &Block<dyn Fn(*mut NSData, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionUploadTask>
Available on crate features
NSData
and NSError
and NSURLResponse
and block2
only.pub unsafe fn downloadTaskWithRequest_completionHandler( &self, request: &NSURLRequest, completion_handler: &Block<dyn Fn(*mut NSURL, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionDownloadTask>
Available on crate features
NSError
and NSURL
and NSURLRequest
and NSURLResponse
and block2
only.pub unsafe fn downloadTaskWithURL_completionHandler( &self, url: &NSURL, completion_handler: &Block<dyn Fn(*mut NSURL, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionDownloadTask>
Available on crate features
NSError
and NSURL
and NSURLResponse
and block2
only.pub unsafe fn downloadTaskWithResumeData_completionHandler( &self, resume_data: &NSData, completion_handler: &Block<dyn Fn(*mut NSURL, *mut NSURLResponse, *mut NSError)> ) -> Retained<NSURLSessionDownloadTask>
Available on crate features
NSData
and NSError
and NSURL
and NSURLResponse
and block2
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<AnyObject> for NSURLSession
impl AsMut<AnyObject> for NSURLSession
source§impl AsMut<NSObject> for NSURLSession
impl AsMut<NSObject> for NSURLSession
source§impl AsMut<NSURLSession> for NSURLSession
impl AsMut<NSURLSession> for NSURLSession
source§impl AsRef<AnyObject> for NSURLSession
impl AsRef<AnyObject> for NSURLSession
source§impl AsRef<NSObject> for NSURLSession
impl AsRef<NSObject> for NSURLSession
source§impl AsRef<NSURLSession> for NSURLSession
impl AsRef<NSURLSession> for NSURLSession
source§impl Borrow<AnyObject> for NSURLSession
impl Borrow<AnyObject> for NSURLSession
source§impl Borrow<NSObject> for NSURLSession
impl Borrow<NSObject> for NSURLSession
source§impl BorrowMut<AnyObject> for NSURLSession
impl BorrowMut<AnyObject> for NSURLSession
source§fn borrow_mut(&mut self) -> &mut AnyObject
fn borrow_mut(&mut self) -> &mut AnyObject
Mutably borrows from an owned value. Read more
source§impl BorrowMut<NSObject> for NSURLSession
impl BorrowMut<NSObject> for NSURLSession
source§fn borrow_mut(&mut self) -> &mut NSObject
fn borrow_mut(&mut self) -> &mut NSObject
Mutably borrows from an owned value. Read more
source§impl ClassType for NSURLSession
impl ClassType for NSURLSession
§type Mutability = InteriorMutable
type Mutability = InteriorMutable
Whether the type is mutable or immutable. Read more
source§const NAME: &'static str = "NSURLSession"
const NAME: &'static str = "NSURLSession"
The name of the Objective-C class that this type represents. Read more
source§fn class() -> &'static AnyClass
fn class() -> &'static AnyClass
Get a reference to the Objective-C class that this type represents. Read more
source§fn as_super_mut(&mut self) -> &mut Self::Super
fn as_super_mut(&mut self) -> &mut Self::Super
Get a mutable reference to the superclass.
source§impl Debug for NSURLSession
impl Debug for NSURLSession
source§impl Deref for NSURLSession
impl Deref for NSURLSession
source§impl DerefMut for NSURLSession
impl DerefMut for NSURLSession
source§impl Hash for NSURLSession
impl Hash for NSURLSession
source§impl NSObjectProtocol for NSURLSession
impl NSObjectProtocol for NSURLSession
source§fn isEqual(&self, other: &AnyObject) -> bool
fn isEqual(&self, other: &AnyObject) -> bool
Check whether the object is equal to an arbitrary other object. Read more
source§fn hash(&self) -> usize
fn hash(&self) -> usize
An integer that can be used as a table address in a hash table
structure. Read more
source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Check if the object is an instance of the class, or one of its
subclasses. Read more
source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
Check if the object is an instance of the class type, or one of its
subclasses. Read more
source§fn isMemberOfClass(&self, cls: &AnyClass) -> bool
fn isMemberOfClass(&self, cls: &AnyClass) -> bool
Check if the object is an instance of a specific class, without
checking subclasses. Read more
source§fn respondsToSelector(&self, aSelector: Sel) -> bool
fn respondsToSelector(&self, aSelector: Sel) -> bool
Check whether the object implements or inherits a method with the
given selector. Read more
source§fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
Check whether the object conforms to a given protocol. Read more
source§fn debugDescription(&self) -> Retained<NSObject>
fn debugDescription(&self) -> Retained<NSObject>
A textual representation of the object to use when debugging. Read more
source§impl PartialEq for NSURLSession
impl PartialEq for NSURLSession
source§fn eq(&self, other: &NSURLSession) -> bool
fn eq(&self, other: &NSURLSession) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl RefEncode for NSURLSession
impl RefEncode for NSURLSession
source§const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
const ENCODING_REF: Encoding = <NSObject as ::objc2::RefEncode>::ENCODING_REF
The Objective-C type-encoding for a reference of this type. Read more
impl Eq for NSURLSession
impl Message for NSURLSession
impl Send for NSURLSession
impl StructuralPartialEq for NSURLSession
impl Sync for NSURLSession
Auto Trait Implementations§
impl !Freeze for NSURLSession
impl !RefUnwindSafe for NSURLSession
impl !Unpin for NSURLSession
impl !UnwindSafe for NSURLSession
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
Mutably borrows from an owned value. Read more
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
The immutable counterpart of the type, or
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
The mutable counterpart of the type, or
Self
if the type has no
mutable counterpart. Read more