pub struct NSURLSessionConfiguration { /* private fields */ }NSURLSession only.Expand description
Implementations§
Source§impl NSURLSessionConfiguration
impl NSURLSessionConfiguration
pub fn defaultSessionConfiguration() -> Retained<NSURLSessionConfiguration>
pub fn ephemeralSessionConfiguration() -> Retained<NSURLSessionConfiguration>
pub fn backgroundSessionConfigurationWithIdentifier( identifier: &NSString, ) -> Retained<NSURLSessionConfiguration>
NSString only.pub fn identifier(&self) -> Option<Retained<NSString>>
NSString only.pub fn requestCachePolicy(&self) -> NSURLRequestCachePolicy
NSURLRequest only.Sourcepub fn setRequestCachePolicy(
&self,
request_cache_policy: NSURLRequestCachePolicy,
)
Available on crate feature NSURLRequest only.
pub fn setRequestCachePolicy( &self, request_cache_policy: NSURLRequestCachePolicy, )
NSURLRequest only.Setter for requestCachePolicy.
pub fn timeoutIntervalForRequest(&self) -> NSTimeInterval
NSDate only.Sourcepub fn setTimeoutIntervalForRequest(
&self,
timeout_interval_for_request: NSTimeInterval,
)
Available on crate feature NSDate only.
pub fn setTimeoutIntervalForRequest( &self, timeout_interval_for_request: NSTimeInterval, )
NSDate only.Setter for timeoutIntervalForRequest.
pub fn timeoutIntervalForResource(&self) -> NSTimeInterval
NSDate only.Sourcepub fn setTimeoutIntervalForResource(
&self,
timeout_interval_for_resource: NSTimeInterval,
)
Available on crate feature NSDate only.
pub fn setTimeoutIntervalForResource( &self, timeout_interval_for_resource: NSTimeInterval, )
NSDate only.Setter for timeoutIntervalForResource.
pub fn networkServiceType(&self) -> NSURLRequestNetworkServiceType
NSURLRequest only.Sourcepub fn setNetworkServiceType(
&self,
network_service_type: NSURLRequestNetworkServiceType,
)
Available on crate feature NSURLRequest only.
pub fn setNetworkServiceType( &self, network_service_type: NSURLRequestNetworkServiceType, )
NSURLRequest only.Setter for networkServiceType.
pub fn allowsCellularAccess(&self) -> bool
Sourcepub fn setAllowsCellularAccess(&self, allows_cellular_access: bool)
pub fn setAllowsCellularAccess(&self, allows_cellular_access: bool)
Setter for allowsCellularAccess.
pub fn allowsExpensiveNetworkAccess(&self) -> bool
Sourcepub fn setAllowsExpensiveNetworkAccess(
&self,
allows_expensive_network_access: bool,
)
pub fn setAllowsExpensiveNetworkAccess( &self, allows_expensive_network_access: bool, )
Setter for allowsExpensiveNetworkAccess.
pub fn allowsConstrainedNetworkAccess(&self) -> bool
Sourcepub fn setAllowsConstrainedNetworkAccess(
&self,
allows_constrained_network_access: bool,
)
pub fn setAllowsConstrainedNetworkAccess( &self, allows_constrained_network_access: bool, )
Setter for allowsConstrainedNetworkAccess.
pub fn requiresDNSSECValidation(&self) -> bool
Sourcepub fn setRequiresDNSSECValidation(&self, requires_dnssec_validation: bool)
pub fn setRequiresDNSSECValidation(&self, requires_dnssec_validation: bool)
Setter for requiresDNSSECValidation.
pub fn waitsForConnectivity(&self) -> bool
Sourcepub fn setWaitsForConnectivity(&self, waits_for_connectivity: bool)
pub fn setWaitsForConnectivity(&self, waits_for_connectivity: bool)
Setter for waitsForConnectivity.
pub fn isDiscretionary(&self) -> bool
Sourcepub fn setDiscretionary(&self, discretionary: bool)
pub fn setDiscretionary(&self, discretionary: bool)
Setter for isDiscretionary.
NSString only.Available on crate feature NSString only.
NSString only.Setter for sharedContainerIdentifier.
This is copied when set.
pub fn sessionSendsLaunchEvents(&self) -> bool
Sourcepub fn setSessionSendsLaunchEvents(&self, session_sends_launch_events: bool)
pub fn setSessionSendsLaunchEvents(&self, session_sends_launch_events: bool)
Setter for sessionSendsLaunchEvents.
pub 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.
This is copied when set.
§Safety
connection_proxy_dictionary generic should be of the correct type.
pub fn HTTPShouldUsePipelining(&self) -> bool
Sourcepub fn setHTTPShouldUsePipelining(&self, http_should_use_pipelining: bool)
👎Deprecated: Only supported in the classic loader, please adopt HTTP/2 and HTTP/3 instead
pub fn setHTTPShouldUsePipelining(&self, http_should_use_pipelining: bool)
Setter for HTTPShouldUsePipelining.
pub fn HTTPShouldSetCookies(&self) -> bool
Sourcepub fn setHTTPShouldSetCookies(&self, http_should_set_cookies: bool)
pub fn setHTTPShouldSetCookies(&self, http_should_set_cookies: bool)
Setter for HTTPShouldSetCookies.
pub fn HTTPCookieAcceptPolicy(&self) -> NSHTTPCookieAcceptPolicy
NSHTTPCookieStorage only.Sourcepub fn setHTTPCookieAcceptPolicy(
&self,
http_cookie_accept_policy: NSHTTPCookieAcceptPolicy,
)
Available on crate feature NSHTTPCookieStorage only.
pub fn setHTTPCookieAcceptPolicy( &self, http_cookie_accept_policy: NSHTTPCookieAcceptPolicy, )
NSHTTPCookieStorage only.Setter for HTTPCookieAcceptPolicy.
pub 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.
This is copied when set.
§Safety
http_additional_headers generic should be of the correct type.
pub fn HTTPMaximumConnectionsPerHost(&self) -> NSInteger
Sourcepub fn setHTTPMaximumConnectionsPerHost(
&self,
http_maximum_connections_per_host: NSInteger,
)
pub fn setHTTPMaximumConnectionsPerHost( &self, http_maximum_connections_per_host: NSInteger, )
Setter for HTTPMaximumConnectionsPerHost.
pub fn HTTPCookieStorage(&self) -> Option<Retained<NSHTTPCookieStorage>>
NSHTTPCookieStorage only.Sourcepub fn setHTTPCookieStorage(
&self,
http_cookie_storage: Option<&NSHTTPCookieStorage>,
)
Available on crate feature NSHTTPCookieStorage only.
pub fn setHTTPCookieStorage( &self, http_cookie_storage: Option<&NSHTTPCookieStorage>, )
NSHTTPCookieStorage only.Setter for HTTPCookieStorage.
pub fn URLCredentialStorage(&self) -> Option<Retained<NSURLCredentialStorage>>
NSURLCredentialStorage only.Sourcepub fn setURLCredentialStorage(
&self,
url_credential_storage: Option<&NSURLCredentialStorage>,
)
Available on crate feature NSURLCredentialStorage only.
pub fn setURLCredentialStorage( &self, url_credential_storage: Option<&NSURLCredentialStorage>, )
NSURLCredentialStorage only.Setter for URLCredentialStorage.
pub fn URLCache(&self) -> Option<Retained<NSURLCache>>
NSURLCache only.Sourcepub fn setURLCache(&self, url_cache: Option<&NSURLCache>)
Available on crate feature NSURLCache only.
pub fn setURLCache(&self, url_cache: Option<&NSURLCache>)
NSURLCache only.Setter for URLCache.
pub fn shouldUseExtendedBackgroundIdleMode(&self) -> bool
Sourcepub fn setShouldUseExtendedBackgroundIdleMode(
&self,
should_use_extended_background_idle_mode: bool,
)
👎Deprecated: Not supported
pub fn setShouldUseExtendedBackgroundIdleMode( &self, should_use_extended_background_idle_mode: bool, )
Setter for shouldUseExtendedBackgroundIdleMode.
pub 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.
This is copied when set.
§Safety
protocol_classes generic probably has further requirements.
pub fn multipathServiceType(&self) -> NSURLSessionMultipathServiceType
Sourcepub fn setMultipathServiceType(
&self,
multipath_service_type: NSURLSessionMultipathServiceType,
)
pub fn setMultipathServiceType( &self, multipath_service_type: NSURLSessionMultipathServiceType, )
Setter for multipathServiceType.
pub fn usesClassicLoadingMode(&self) -> bool
Sourcepub fn setUsesClassicLoadingMode(&self, uses_classic_loading_mode: bool)
pub fn setUsesClassicLoadingMode(&self, uses_classic_loading_mode: bool)
Setter for usesClassicLoadingMode.
pub fn enablesEarlyData(&self) -> bool
Sourcepub fn setEnablesEarlyData(&self, enables_early_data: bool)
pub fn setEnablesEarlyData(&self, enables_early_data: bool)
Setter for enablesEarlyData.
pub fn init(this: Allocated<Self>) -> Retained<Self>
pub fn new() -> Retained<Self>
Source§impl NSURLSessionConfiguration
NSURLSessionDeprecated.
impl NSURLSessionConfiguration
NSURLSessionDeprecated.
pub 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