Skip to main content

Field

Struct Field 

Source
pub struct Field {
Show 15 fields pub attributed_value: Option<ValueUnion>, pub change_message: Option<String>, pub currency_code: Option<String>, pub data_detector_types: Option<Vec<Value>>, pub date_style: Option<EStyle>, pub ignores_time_zone: Option<bool>, pub is_relative: Option<bool>, pub key: String, pub label: Option<String>, pub number_style: Option<NumberStyle>, pub semantics: Option<Semantics>, pub text_alignment: Option<TextAlignment>, pub time_style: Option<EStyle>, pub value: ValueUnion, pub row: Option<i32>,
}
Expand description

Keys that define an individual field.

Fields§

§attributed_value: Option<ValueUnion>§change_message: Option<String>

Format string for the alert text that is displayed when the pass is updated. The format string must contain the escape %@, which is replaced with the field’s new value. If you don’t specify a change message, the user isn’t notified when the field changes. Localizable.

§currency_code: Option<String>

Code of currency

§data_detector_types: Option<Vec<Value>>

Data detectors that are applied to the field’s value. Provide an empty array to use no data detectors. Data detectors are applied only to back fields.

§date_style: Option<EStyle>

Style of date to display.

§ignores_time_zone: Option<bool>

Always display the time and date in the given time zone, not in the user’s current time zone. The format for a date and time always requires a time zone, even if it will be ignored. For backward compatibility with iOS 6, provide an appropriate time zone, so that the information is displayed meaningfully even without ignoring time zones. This key does not affect how relevance is calculated. Available in iOS 7.0.

§is_relative: Option<bool>

If true, the label’s value is displayed as a relative date; otherwise, it is displayed as an absolute date. This key does not affect how relevance is calculated.

§key: String

The key must be unique within the scope of the entire pass.

§label: Option<String>

Label text for the field. Localizable.

§number_style: Option<NumberStyle>

Style of number to display. Number styles have the same meaning as the Cocoa number formatter styles with corresponding names. See https://developer.apple.com/documentation/foundation/nsnumberformatterstyle

§semantics: Option<Semantics>

Machine-readable metadata to allow the system to offer Wallet passes to users intelligently.

§text_alignment: Option<TextAlignment>

Alignment for the field’s contents. This key is not allowed for primary fields or back fields.

§time_style: Option<EStyle>

Style of time to display.

§value: ValueUnion

Value of the field

§row: Option<i32>

Row for auxiliary fields. Set to 1 to add an extra row for auxiliary fields.

Implementations§

Source§

impl Field

Source

pub fn new_string(key: &str, value: &str) -> Self

Create a new Instance with a String value

Source

pub fn new_f64(key: &str, value: f64) -> Self

Create a new Instance with a Double value

Source

pub fn attributed_value(&mut self, attributed_value: ValueUnion)

Source

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

Format string for the alert text that is displayed when the pass is updated. The format string must contain the escape %@, which is replaced with the field’s new value. If you don’t specify a change message, the user isn’t notified when the field changes. Localizable.

Source

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

Code of currency

Source

pub fn clear_data_detector_types(&mut self)

Data detectors that are applied to the field’s value. Provide an empty array to use no data detectors. Data detectors are applied only to back fields.

Source

pub fn add_data_detector_type(&mut self, data_detector_type: Value)

Data detectors that are applied to the field’s value. Provide an empty array to use no data detectors. Data detectors are applied only to back fields.

Source

pub fn date_style(&mut self, date_style: EStyle)

Style of date to display.

Source

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

Always display the time and date in the given time zone, not in the user’s current time zone. The format for a date and time always requires a time zone, even if it will be ignored. For backward compatibility with iOS 6, provide an appropriate time zone, so that the information is displayed meaningfully even without ignoring time zones. This key does not affect how relevance is calculated. Available in iOS 7.0.

Source

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

If true, the label’s value is displayed as a relative date; otherwise, it is displayed as an absolute date. This key does not affect how relevance is calculated.

Source

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

Label text for the field. Localizable.

Source

pub fn number_style(&mut self, number_style: NumberStyle)

Style of number to display. Number styles have the same meaning as the Cocoa number formatter styles with corresponding names. See https://developer.apple.com/documentation/foundation/nsnumberformatterstyle

Source

pub fn semantics(&mut self, semantics: Semantics)

Machine-readable metadata to allow the system to offer Wallet passes to users intelligently.

Source

pub fn text_alignment(&mut self, text_alignment: TextAlignment)

Alignment for the field’s contents. This key is not allowed for primary fields or back fields.

Source

pub fn time_style(&mut self, time_style: EStyle)

Style of time to display.

Source

pub fn row(&mut self, row: i32)

Add row information for auxiliary fields

Trait Implementations§

Source§

impl Clone for Field

Source§

fn clone(&self) -> Field

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 Field

Source§

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

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

impl<'de> Deserialize<'de> for Field

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Field

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Field

§

impl RefUnwindSafe for Field

§

impl Send for Field

§

impl Sync for Field

§

impl Unpin for Field

§

impl UnsafeUnpin for Field

§

impl UnwindSafe for Field

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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<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.