Skip to main content

Pass

Struct Pass 

Source
pub struct Pass {
    pub template: Template,
    /* private fields */
}
Expand description

Represents an complete pass with reference to a directory with image and resource files

Fields§

§template: Template

Reference to the Template instance

Implementations§

Source§

impl Pass

Source

pub fn from_path<P: AsRef<Path>>(pass_path: P) -> Result<Self>

Parse a Pass instance from the given directory

Source

pub fn from_template<P: AsRef<Path>>(template: &Template, pass_path: P) -> Self

Create a Pass instance from the given Template and an reference to a directory with image and resource files

Source

pub fn export<T, P1: AsRef<Path>, P2: AsRef<Path>>( &self, certificate_path: P1, certificate_password: &str, wwdr_intermediate_certificate_path: P2, writer: T, ) -> Result<T>
where T: Write + Seek,

Sign, package and save this Pass to writer

Source

pub fn export_to_file<P1: AsRef<Path>, P2: AsRef<Path>, P3: AsRef<Path>>( &self, certificate_path: P1, certificate_password: &str, wwdr_intermediate_certificate_path: P2, output_path: P3, ) -> Result<()>

Sign, package and save this Pass to a file

Methods from Deref<Target = Template>§

Source

pub fn app_launch_url(&mut self, app_launch_url: &str)

A URL to be passed to the associated app when launching it. The app receives this URL in the application:didFinishLaunchingWithOptions: and application:openURL:options: methods of its app delegate.

Source

pub fn add_associated_store_identifiers( &mut self, associated_store_identifier: f64, )

A list of iTunes Store item identifiers for the associated apps. Only one item in the list is used—the first item identifier for an app compatible with the current device. If the app is not installed, the link opens the App Store and shows the app. If the app is already installed, the link launches the app.

Source

pub fn clear_associated_store_identifiers(&mut self)

A list of iTunes Store item identifiers for the associated apps. Only one item in the list is used—the first item identifier for an app compatible with the current device. If the app is not installed, the link opens the App Store and shows the app. If the app is already installed, the link launches the app.

Source

pub fn authentication_token(&mut self, authentication_token: &str)

The authentication token to use with the web service.

Source

pub fn background_color(&mut self, background_color: &str)

Background color of the pass, specified as an CSS-style RGB triple.

Source

pub fn barcode(&mut self, barcode: Barcode)

Information specific to the pass’s barcode. Deprecated in iOS 9.0 and later; use barcodes instead.

Source

pub fn add_barcodes(&mut self, barcode: Barcode)

Information specific to the pass’s barcode. The system uses the first valid barcode dictionary in the array. Additional dictionaries can be added as fallbacks. Available only in iOS 9.0 and later.

Source

pub fn clear_barcodes(&mut self)

Information specific to the pass’s barcode. The system uses the first valid barcode dictionary in the array. Additional dictionaries can be added as fallbacks. Available only in iOS 9.0 and later.

Source

pub fn add_beacon(&mut self, beacon: Beacon)

Beacons marking locations where the pass is relevant. Available in iOS 7.0.

Source

pub fn clear_beacons(&mut self)

Beacons marking locations where the pass is relevant. Available in iOS 7.0.

Source

pub fn boarding_pass(&mut self, boarding_pass: BoardingPass)

Information specific to a boarding pass.

Source

pub fn coupon(&mut self, coupon: Details)

Information specific to a coupon.

Source

pub fn description(&mut self, description: &str)

Brief description of the pass, used by the iOS accessibility technologies. Don’t try to include all of the data on the pass in its description, just include enough detail to distinguish passes of the same type. Localizable.

Source

pub fn event_ticket(&mut self, event_ticket: Details)

Information specific to an event ticket.

Source

pub fn expiration_date(&mut self, expiration_date: &str)

Date and time when the pass expires. Available in iOS 7.0.

Source

pub fn foreground_color(&mut self, foreground_color: &str)

Foreground color of the pass, specified as a CSS-style RGB triple

Source

pub fn format_version(&mut self, format_version: Value)

Version of the file format.

Source

pub fn generic(&mut self, generic: Details)

Information specific to a generic pass.

Source

pub fn grouping_identifier(&mut self, grouping_identifier: &str)

Identifier used to group related passes. If a grouping identifier is specified, passes with the same style, pass type identifier, and grouping identifier are displayed as a group. Otherwise, passes are grouped automatically. Use this to group passes that are tightly related, such as the boarding passes for different connections of the same trip. Available in iOS 7.0.

Source

pub fn label_color(&mut self, label_color: &str)

olor of the label text, specified as a CSS-style RGB triple. If omitted, the label color is determined automatically.

Source

pub fn add_location(&mut self, location: Location)

Locations where the pass is relevant. For example, the location of your store.

Source

pub fn clear_locations(&mut self)

Locations where the pass is relevant. For example, the location of your store.

Source

pub fn logo_text(&mut self, logo_text: &str)

Text displayed next to the logo on the pass. Localizable.

Source

pub fn max_distance(&mut self, max_distance: f64)

Maximum distance in meters from a relevant latitude and longitude that the pass is relevant. This number is compared to the pass’s default distance and the smaller value is used. Available in iOS 7.0.

Source

pub fn nfc(&mut self, nfc: Nfc)

Information used for Value Added Service Protocol transactions. Available in iOS 9.0.

Source

pub fn organization_name(&mut self, organization_name: &str)

Display name of the organization that originated and signed the pass. Localizable.

Source

pub fn pass_type_identifier(&mut self, pass_type_identifier: &str)

Pass type identifier, as issued by Apple. The value must correspond with your signing certificate.

Source

pub fn relevant_date(&mut self, relevant_date: &str)

Date and time when the pass becomes relevant. For example, the start time of a movie. Recommended for event tickets and boarding passes.

Source

pub fn serial_number(&mut self, serial_number: &str)

Serial number that uniquely identifies the pass. No two passes with the same pass type identifier may have the same serial number.

Source

pub fn store_card(&mut self, store_card: Details)

Information specific to a store card.

Source

pub fn suppress_strip_shine(&mut self, suppress_strip_shine: bool)

If true, the strip image is displayed without a shine effect. The default value prior to iOS 7.0 is false. In iOS 7.0, a shine effect is never applied, and this key is deprecated.

Source

pub fn team_identifier(&mut self, team_identifier: &str)

Team identifier of the organization that originated and signed the pass, as issued by Apple.

Source

pub fn add_user_info(&mut self, key: &str, value: Value)

Custom information for companion apps. This data is not displayed to the user. For example, a pass for a cafe could include information about the user’s favorite drink and sandwich in a machine-readable form for the companion app to read, making it easy to place an order for “the usual” from the app. Available in iOS 7.0.

Source

pub fn clear_user_info(&mut self)

Custom information for companion apps. This data is not displayed to the user. For example, a pass for a cafe could include information about the user’s favorite drink and sandwich in a machine-readable form for the companion app to read, making it easy to place an order for “the usual” from the app. Available in iOS 7.0.

Source

pub fn voided(&mut self, voided: bool)

Indicates that the pass is void—for example, a one time use coupon that has been redeemed. Available in iOS 7.0.

Source

pub fn web_service_url(&mut self, web_service_url: &str)

The URL of a web service that conforms to the API described in PassKit Web Service Reference. The web service must use the HTTPS protocol; the leading https:// is included in the value of this key. On devices configured for development, there is UI in Settings to allow HTTP web services.

Trait Implementations§

Source§

impl Clone for Pass

Source§

fn clone(&self) -> Pass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Pass

Source§

type Target = Template

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Pass

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl Freeze for Pass

§

impl RefUnwindSafe for Pass

§

impl Send for Pass

§

impl Sync for Pass

§

impl Unpin for Pass

§

impl UnsafeUnpin for Pass

§

impl UnwindSafe for Pass

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.