Item

Struct Item 

Source
pub struct Item<'a> {
Show 13 fields pub title: Cow<'a, str>, pub subtitle: Option<Cow<'a, str>>, pub icon: Option<Icon<'a>>, pub uid: Option<Cow<'a, str>>, pub arg: Option<Cow<'a, str>>, pub type_: ItemType, pub valid: bool, pub autocomplete: Option<Cow<'a, str>>, pub text_copy: Option<Cow<'a, str>>, pub text_large_type: Option<Cow<'a, str>>, pub quicklook_url: Option<Cow<'a, str>>, pub modifiers: HashMap<Modifier, ModifierData<'a>>, pub variables: HashMap<Cow<'a, str>, Cow<'a, str>>, /* private fields */
}
Expand description

Representation of a script filter item.

Fields§

§title: Cow<'a, str>

Title for the item.

§subtitle: Option<Cow<'a, str>>

Subtitle for the item.

The subtitle may be overridden by modifiers.

§icon: Option<Icon<'a>>

Icon for the item

§uid: Option<Cow<'a, str>>

Identifier for the results.

If given, must be unique among items, and is used for prioritizing feedback results based on usage. If blank, Alfred presents results in the order given and does not learn from them.

§arg: Option<Cow<'a, str>>

The value that is passed to the next portion of the workflow when this item is selected.

The arg may be overridden by modifiers.

§type_: ItemType

What type of result this is.

§valid: bool

Whether or not the result is valid.

When false, actioning the result will populate the search field with the autocomplete value instead.

The validity may be overridden by modifiers.

§autocomplete: Option<Cow<'a, str>>

Autocomplete data for the item.

This value is populated into the search field if the tab key is pressed. If valid = false, this value is populated if the item is actioned.

§text_copy: Option<Cow<'a, str>>

What text the user gets when copying the result.

This value is copied if the user presses ⌘C.

§text_large_type: Option<Cow<'a, str>>

What text the user gets when displaying large type.

This value is displayed if the user presses ⌘L.

§quicklook_url: Option<Cow<'a, str>>

A URL to use for Quick Look.

§modifiers: HashMap<Modifier, ModifierData<'a>>

Optional overrides of subtitle, arg, and valid by modifiers.

§variables: HashMap<Cow<'a, str>, Cow<'a, str>>

Variables to pass out of the script filter if this item is selected in Alfred’s results.

This property is only used with JSON output and only affects Alfred 3.4.1 or later.

Implementations§

Source§

impl<'a> Item<'a>

Source

pub fn to_json(&self) -> Value

Serializes the Item into its JSON representation.

Source§

impl<'a> Item<'a>

Source

pub fn write_xml(&self, w: &mut dyn Write, indent: u32) -> Result<()>

Writes the XML fragment representing the Item to the Write.

XMLWriter should be used instead if at all possible, in order to write the XML header/footer and maintain proper error discipline.

Source§

impl<'a> Item<'a>

Source

pub fn new<S: Into<Cow<'a, str>>>(title: S) -> Item<'a>

Returns a new Item with the given title.

Trait Implementations§

Source§

impl<'a> Clone for Item<'a>

Source§

fn clone(&self) -> Item<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Item<'a>

Source§

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

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

impl<'a> PartialEq for Item<'a>

Source§

fn eq(&self, other: &Item<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for Item<'a>

Source§

impl<'a> StructuralPartialEq for Item<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Item<'a>

§

impl<'a> RefUnwindSafe for Item<'a>

§

impl<'a> Send for Item<'a>

§

impl<'a> Sync for Item<'a>

§

impl<'a> Unpin for Item<'a>

§

impl<'a> UnwindSafe for Item<'a>

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