Trait SwiftArg

Source
pub trait SwiftArg<'a> {
    type ArgType;

    // Required method
    unsafe fn as_arg(&'a self) -> Self::ArgType;
}
Expand description

Identifies a type as being a valid argument in a Swift function.

Required Associated Types§

Required Methods§

Source

unsafe fn as_arg(&'a self) -> Self::ArgType

Creates a swift-compatible version of the argument. For primitives this just returns self, but for SwiftObject types it wraps them in SwiftRef.

This function is called within the swift! macro.

§Safety

Creating a SwiftRef is inherently unsafe, but is reliable if using the swift! macro, so it is not advised to call this function manually.

Implementations on Foreign Types§

Source§

impl<'a> SwiftArg<'a> for *const c_void

Source§

type ArgType = *const c_void

Source§

unsafe fn as_arg(&'a self) -> Self::ArgType

Source§

impl<'a> SwiftArg<'a> for *const u8

Source§

type ArgType = *const u8

Source§

unsafe fn as_arg(&'a self) -> Self::ArgType

Source§

impl<'a> SwiftArg<'a> for *mut c_void

Source§

type ArgType = *mut c_void

Source§

unsafe fn as_arg(&'a self) -> Self::ArgType

Source§

impl<'a> SwiftArg<'a> for ()

Source§

type ArgType = ()

Source§

unsafe fn as_arg(&'a self) -> Self::ArgType

Source§

impl<'a, T: SwiftArg<'a>> SwiftArg<'a> for &T

Source§

type ArgType = <T as SwiftArg<'a>>::ArgType

Source§

unsafe fn as_arg(&'a self) -> Self::ArgType

Implementors§

Source§

impl<'a> SwiftArg<'a> for SRData

Source§

impl<'a> SwiftArg<'a> for SRString

Source§

impl<'a> SwiftArg<'a> for Bool

Source§

impl<'a> SwiftArg<'a> for Float32

Source§

impl<'a> SwiftArg<'a> for Float64

Source§

impl<'a> SwiftArg<'a> for Int8

Source§

impl<'a> SwiftArg<'a> for Int16

Source§

impl<'a> SwiftArg<'a> for Int32

Source§

impl<'a> SwiftArg<'a> for Int64

Source§

impl<'a> SwiftArg<'a> for Int

Source§

impl<'a> SwiftArg<'a> for UInt8

Source§

impl<'a> SwiftArg<'a> for UInt16

Source§

impl<'a> SwiftArg<'a> for UInt32

Source§

impl<'a> SwiftArg<'a> for UInt64

Source§

impl<'a> SwiftArg<'a> for UInt

Source§

impl<'a, T: 'a> SwiftArg<'a> for SRArray<T>

Source§

impl<'a, T: 'a> SwiftArg<'a> for SRObject<T>