#[repr(C)]pub struct NSURLSessionConfiguration { /* private fields */ }
NSURLSession
only.Expand description
Implementations§
Source§impl NSURLSessionConfiguration
impl NSURLSessionConfiguration
pub unsafe fn defaultSessionConfiguration() -> Retained<NSURLSessionConfiguration>
pub unsafe fn ephemeralSessionConfiguration() -> Retained<NSURLSessionConfiguration>
pub unsafe fn backgroundSessionConfigurationWithIdentifier( identifier: &NSString, ) -> Retained<NSURLSessionConfiguration>
NSString
only.pub unsafe fn identifier(&self) -> Option<Retained<NSString>>
NSString
only.pub unsafe fn requestCachePolicy(&self) -> NSURLRequestCachePolicy
NSURLRequest
only.Sourcepub unsafe fn setRequestCachePolicy(
&self,
request_cache_policy: NSURLRequestCachePolicy,
)
Available on crate feature NSURLRequest
only.
pub unsafe fn setRequestCachePolicy( &self, request_cache_policy: NSURLRequestCachePolicy, )
NSURLRequest
only.Setter for requestCachePolicy
.
pub unsafe fn timeoutIntervalForRequest(&self) -> NSTimeInterval
NSDate
only.Sourcepub unsafe fn setTimeoutIntervalForRequest(
&self,
timeout_interval_for_request: NSTimeInterval,
)
Available on crate feature NSDate
only.
pub unsafe fn setTimeoutIntervalForRequest( &self, timeout_interval_for_request: NSTimeInterval, )
NSDate
only.Setter for timeoutIntervalForRequest
.
pub unsafe fn timeoutIntervalForResource(&self) -> NSTimeInterval
NSDate
only.Sourcepub unsafe fn setTimeoutIntervalForResource(
&self,
timeout_interval_for_resource: NSTimeInterval,
)
Available on crate feature NSDate
only.
pub unsafe fn setTimeoutIntervalForResource( &self, timeout_interval_for_resource: NSTimeInterval, )
NSDate
only.Setter for timeoutIntervalForResource
.
pub unsafe fn networkServiceType(&self) -> NSURLRequestNetworkServiceType
NSURLRequest
only.Sourcepub unsafe fn setNetworkServiceType(
&self,
network_service_type: NSURLRequestNetworkServiceType,
)
Available on crate feature NSURLRequest
only.
pub unsafe fn setNetworkServiceType( &self, network_service_type: NSURLRequestNetworkServiceType, )
NSURLRequest
only.Setter for networkServiceType
.
pub unsafe fn allowsCellularAccess(&self) -> bool
Sourcepub unsafe fn setAllowsCellularAccess(&self, allows_cellular_access: bool)
pub unsafe fn setAllowsCellularAccess(&self, allows_cellular_access: bool)
Setter for allowsCellularAccess
.
pub unsafe fn allowsExpensiveNetworkAccess(&self) -> bool
Sourcepub unsafe fn setAllowsExpensiveNetworkAccess(
&self,
allows_expensive_network_access: bool,
)
pub unsafe fn setAllowsExpensiveNetworkAccess( &self, allows_expensive_network_access: bool, )
Setter for allowsExpensiveNetworkAccess
.
pub unsafe fn allowsConstrainedNetworkAccess(&self) -> bool
Sourcepub unsafe fn setAllowsConstrainedNetworkAccess(
&self,
allows_constrained_network_access: bool,
)
pub unsafe fn setAllowsConstrainedNetworkAccess( &self, allows_constrained_network_access: bool, )
Setter for allowsConstrainedNetworkAccess
.
pub unsafe fn requiresDNSSECValidation(&self) -> bool
Sourcepub unsafe fn setRequiresDNSSECValidation(
&self,
requires_dnssec_validation: bool,
)
pub unsafe fn setRequiresDNSSECValidation( &self, requires_dnssec_validation: bool, )
Setter for requiresDNSSECValidation
.
pub unsafe fn waitsForConnectivity(&self) -> bool
Sourcepub unsafe fn setWaitsForConnectivity(&self, waits_for_connectivity: bool)
pub unsafe fn setWaitsForConnectivity(&self, waits_for_connectivity: bool)
Setter for waitsForConnectivity
.
pub unsafe fn isDiscretionary(&self) -> bool
Sourcepub unsafe fn setDiscretionary(&self, discretionary: bool)
pub unsafe fn setDiscretionary(&self, discretionary: bool)
Setter for isDiscretionary
.
NSString
only.Available on crate feature NSString
only.
NSString
only.Setter for sharedContainerIdentifier
.
pub unsafe fn sessionSendsLaunchEvents(&self) -> bool
Sourcepub unsafe fn setSessionSendsLaunchEvents(
&self,
session_sends_launch_events: bool,
)
pub unsafe fn setSessionSendsLaunchEvents( &self, session_sends_launch_events: bool, )
Setter for sessionSendsLaunchEvents
.
pub unsafe fn connectionProxyDictionary(&self) -> Option<Retained<NSDictionary>>
NSDictionary
only.Sourcepub unsafe fn setConnectionProxyDictionary(
&self,
connection_proxy_dictionary: Option<&NSDictionary>,
)
Available on crate feature NSDictionary
only.
pub unsafe fn setConnectionProxyDictionary( &self, connection_proxy_dictionary: Option<&NSDictionary>, )
NSDictionary
only.Setter for connectionProxyDictionary
.
pub unsafe fn HTTPShouldUsePipelining(&self) -> bool
Sourcepub unsafe fn setHTTPShouldUsePipelining(
&self,
http_should_use_pipelining: bool,
)
👎Deprecated: Only supported in the classic loader, please adopt HTTP/2 and HTTP/3 instead
pub unsafe fn setHTTPShouldUsePipelining( &self, http_should_use_pipelining: bool, )
Setter for HTTPShouldUsePipelining
.
pub unsafe fn HTTPShouldSetCookies(&self) -> bool
Sourcepub unsafe fn setHTTPShouldSetCookies(&self, http_should_set_cookies: bool)
pub unsafe fn setHTTPShouldSetCookies(&self, http_should_set_cookies: bool)
Setter for HTTPShouldSetCookies
.
pub unsafe fn HTTPCookieAcceptPolicy(&self) -> NSHTTPCookieAcceptPolicy
NSHTTPCookieStorage
only.Sourcepub unsafe fn setHTTPCookieAcceptPolicy(
&self,
http_cookie_accept_policy: NSHTTPCookieAcceptPolicy,
)
Available on crate feature NSHTTPCookieStorage
only.
pub unsafe fn setHTTPCookieAcceptPolicy( &self, http_cookie_accept_policy: NSHTTPCookieAcceptPolicy, )
NSHTTPCookieStorage
only.Setter for HTTPCookieAcceptPolicy
.
pub unsafe fn HTTPAdditionalHeaders(&self) -> Option<Retained<NSDictionary>>
NSDictionary
only.Sourcepub unsafe fn setHTTPAdditionalHeaders(
&self,
http_additional_headers: Option<&NSDictionary>,
)
Available on crate feature NSDictionary
only.
pub unsafe fn setHTTPAdditionalHeaders( &self, http_additional_headers: Option<&NSDictionary>, )
NSDictionary
only.Setter for HTTPAdditionalHeaders
.
pub unsafe fn HTTPMaximumConnectionsPerHost(&self) -> NSInteger
Sourcepub unsafe fn setHTTPMaximumConnectionsPerHost(
&self,
http_maximum_connections_per_host: NSInteger,
)
pub unsafe fn setHTTPMaximumConnectionsPerHost( &self, http_maximum_connections_per_host: NSInteger, )
Setter for HTTPMaximumConnectionsPerHost
.
pub unsafe fn HTTPCookieStorage(&self) -> Option<Retained<NSHTTPCookieStorage>>
NSHTTPCookieStorage
only.Sourcepub unsafe fn setHTTPCookieStorage(
&self,
http_cookie_storage: Option<&NSHTTPCookieStorage>,
)
Available on crate feature NSHTTPCookieStorage
only.
pub unsafe fn setHTTPCookieStorage( &self, http_cookie_storage: Option<&NSHTTPCookieStorage>, )
NSHTTPCookieStorage
only.Setter for HTTPCookieStorage
.
pub unsafe fn URLCredentialStorage( &self, ) -> Option<Retained<NSURLCredentialStorage>>
NSURLCredentialStorage
only.Sourcepub unsafe fn setURLCredentialStorage(
&self,
url_credential_storage: Option<&NSURLCredentialStorage>,
)
Available on crate feature NSURLCredentialStorage
only.
pub unsafe fn setURLCredentialStorage( &self, url_credential_storage: Option<&NSURLCredentialStorage>, )
NSURLCredentialStorage
only.Setter for URLCredentialStorage
.
pub unsafe fn URLCache(&self) -> Option<Retained<NSURLCache>>
NSURLCache
only.Sourcepub unsafe fn setURLCache(&self, url_cache: Option<&NSURLCache>)
Available on crate feature NSURLCache
only.
pub unsafe fn setURLCache(&self, url_cache: Option<&NSURLCache>)
NSURLCache
only.Setter for URLCache
.
pub unsafe fn shouldUseExtendedBackgroundIdleMode(&self) -> bool
Sourcepub unsafe fn setShouldUseExtendedBackgroundIdleMode(
&self,
should_use_extended_background_idle_mode: bool,
)
👎Deprecated: Not supported
pub unsafe fn setShouldUseExtendedBackgroundIdleMode( &self, should_use_extended_background_idle_mode: bool, )
Setter for shouldUseExtendedBackgroundIdleMode
.
pub unsafe fn protocolClasses(&self) -> Option<Retained<NSArray<AnyClass>>>
NSArray
only.Sourcepub unsafe fn setProtocolClasses(
&self,
protocol_classes: Option<&NSArray<AnyClass>>,
)
Available on crate feature NSArray
only.
pub unsafe fn setProtocolClasses( &self, protocol_classes: Option<&NSArray<AnyClass>>, )
NSArray
only.Setter for protocolClasses
.
pub unsafe fn multipathServiceType(&self) -> NSURLSessionMultipathServiceType
Sourcepub unsafe fn setMultipathServiceType(
&self,
multipath_service_type: NSURLSessionMultipathServiceType,
)
pub unsafe fn setMultipathServiceType( &self, multipath_service_type: NSURLSessionMultipathServiceType, )
Setter for multipathServiceType
.
pub unsafe fn usesClassicLoadingMode(&self) -> bool
Sourcepub unsafe fn setUsesClassicLoadingMode(&self, uses_classic_loading_mode: bool)
pub unsafe fn setUsesClassicLoadingMode(&self, uses_classic_loading_mode: bool)
Setter for usesClassicLoadingMode
.
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>
pub unsafe fn new() -> Retained<Self>
Source§impl NSURLSessionConfiguration
NSURLSessionDeprecated.
impl NSURLSessionConfiguration
NSURLSessionDeprecated.
pub unsafe fn backgroundSessionConfiguration( identifier: &NSString, ) -> Retained<NSURLSessionConfiguration>
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.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init
/new
methods).
§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 fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T
.
This is the reference-variant. Use Retained::downcast
if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString
.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString
to a NSMutableString
,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass:
for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject
.
§Panics
This works internally by calling isKindOfClass:
. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject
and
NSProxy
implement this method.
§Examples
Cast an NSString
back and forth from NSObject
.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();
Try (and fail) to cast an NSObject
to an NSString
.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());
Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();
This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}
Trait Implementations§
Source§impl AsRef<AnyObject> for NSURLSessionConfiguration
impl AsRef<AnyObject> for NSURLSessionConfiguration
Source§impl AsRef<NSObject> for NSURLSessionConfiguration
impl AsRef<NSObject> for NSURLSessionConfiguration
Source§impl Borrow<AnyObject> for NSURLSessionConfiguration
impl Borrow<AnyObject> for NSURLSessionConfiguration
Source§impl Borrow<NSObject> for NSURLSessionConfiguration
impl Borrow<NSObject> for NSURLSessionConfiguration
Source§impl ClassType for NSURLSessionConfiguration
impl ClassType for NSURLSessionConfiguration
Source§const NAME: &'static str = "NSURLSessionConfiguration"
const NAME: &'static str = "NSURLSessionConfiguration"
Source§type ThreadKind = <<NSURLSessionConfiguration as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<NSURLSessionConfiguration as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for NSURLSessionConfiguration
Available on crate feature NSObject
only.
impl CopyingHelper for NSURLSessionConfiguration
NSObject
only.Source§type Result = NSURLSessionConfiguration
type Result = NSURLSessionConfiguration
Self
if the type has no
immutable counterpart. Read moreSource§impl Debug for NSURLSessionConfiguration
impl Debug for NSURLSessionConfiguration
Source§impl Deref for NSURLSessionConfiguration
impl Deref for NSURLSessionConfiguration
Source§impl Hash for NSURLSessionConfiguration
impl Hash for NSURLSessionConfiguration
Source§impl Message for NSURLSessionConfiguration
impl Message for NSURLSessionConfiguration
Source§impl NSCopying for NSURLSessionConfiguration
impl NSCopying for NSURLSessionConfiguration
Source§impl NSObjectProtocol for NSURLSessionConfiguration
impl NSObjectProtocol for NSURLSessionConfiguration
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&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
isKindOfClass
directly, or cast your objects with AnyObject::downcast_ref