Struct alfred::ItemBuilder
[−]
[src]
pub struct ItemBuilder<'a> { /* fields omitted */ }
Helper for building Item
values.
Methods
impl<'a> ItemBuilder<'a>
[src]
fn new<S: Into<Cow<'a, str>>>(title: S) -> ItemBuilder<'a>
Returns a new ItemBuilder
with the given title.
fn into_item(self) -> Item<'a>
Returns the built Item
.
impl<'a> ItemBuilder<'a>
[src]
fn title<S: Into<Cow<'a, str>>>(self, title: S) -> ItemBuilder<'a>
Sets the title
to the given value.
fn subtitle<S: Into<Cow<'a, str>>>(self, subtitle: S) -> ItemBuilder<'a>
Sets the default subtitle
to the given value.
This sets the default subtitle, used when no modifier is pressed, or when no subtitle is provided for the pressed modifier.
fn subtitle_mod<S: Into<Cow<'a, str>>>(
self,
modifier: Modifier,
subtitle: S
) -> ItemBuilder<'a>
self,
modifier: Modifier,
subtitle: S
) -> ItemBuilder<'a>
Sets the subtitle
to the given value with the given modifier.
This sets the subtitle to use when the given modifier is pressed.
fn icon_path<S: Into<Cow<'a, str>>>(self, path: S) -> ItemBuilder<'a>
Sets the icon
to an image file on disk.
The path is interpreted relative to the workflow directory.
fn icon_file<S: Into<Cow<'a, str>>>(self, path: S) -> ItemBuilder<'a>
Sets the icon
to the icon for a given file on disk.
The path is interpreted relative to the workflow directory.
fn icon_filetype<S: Into<Cow<'a, str>>>(self, filetype: S) -> ItemBuilder<'a>
Sets the icon
to the icon for a given file type.
The type is a UTI, such as "public.jpeg".
fn icon_path_mod<S: Into<Cow<'a, str>>>(
self,
modifier: Modifier,
path: S
) -> ItemBuilder<'a>
self,
modifier: Modifier,
path: S
) -> ItemBuilder<'a>
Sets the icon
to an image file on disk for the given modifier.
The path is interpreted relative to the workflow directory.
This property is only used with JSON output. The legacy XML output does not include per-modifier icons.
This property is only used with Alfred 3.4.1 or later.
fn icon_file_mod<S: Into<Cow<'a, str>>>(
self,
modifier: Modifier,
path: S
) -> ItemBuilder<'a>
self,
modifier: Modifier,
path: S
) -> ItemBuilder<'a>
Sets the icon
to the icon for a given file on disk for the given modifier.
The path is interpreted relative to the workflow directory.
This property is only used with JSON output. The legacy XML output does not include per-modifier icons.
This property is only used with Alfred 3.4.1 or later.
fn icon_filetype_mod<S: Into<Cow<'a, str>>>(
self,
modifier: Modifier,
filetype: S
) -> ItemBuilder<'a>
self,
modifier: Modifier,
filetype: S
) -> ItemBuilder<'a>
Sets the icon
to the icon for a given file type for the given modifier.
The type is a UTI, such as "public.jpeg".
This property is only used with JSON output. The legacy XML output does not include per-modifier icons.
This property is only used with Alfred 3.4.1 or later.
fn uid<S: Into<Cow<'a, str>>>(self, uid: S) -> ItemBuilder<'a>
Sets the uid
to the given value.
fn arg<S: Into<Cow<'a, str>>>(self, arg: S) -> ItemBuilder<'a>
Sets the arg
to the given value.
fn arg_mod<S: Into<Cow<'a, str>>>(
self,
modifier: Modifier,
arg: S
) -> ItemBuilder<'a>
self,
modifier: Modifier,
arg: S
) -> ItemBuilder<'a>
Sets the arg
to the given value with the given modifier.
This sets the arg to use when the given modifier is pressed.
fn type_(self, type_: ItemType) -> ItemBuilder<'a>
Sets the type
to the given value.
fn valid(self, valid: bool) -> ItemBuilder<'a>
Sets valid
to the given value.
fn valid_mod(self, modifier: Modifier, valid: bool) -> ItemBuilder<'a>
Sets valid
to the given value with the given modifier.
This sets the validity to use when the given modifier is pressed.
fn modifier<S: Into<Cow<'a, str>>, S2: Into<Cow<'a, str>>>(
self,
modifier: Modifier,
subtitle: Option<S>,
arg: Option<S2>,
valid: bool,
icon: Option<Icon<'a>>
) -> ItemBuilder<'a>
self,
modifier: Modifier,
subtitle: Option<S>,
arg: Option<S2>,
valid: bool,
icon: Option<Icon<'a>>
) -> ItemBuilder<'a>
Sets the subtitle, arg, validity, and icon to use with the given modifier.
fn autocomplete<S: Into<Cow<'a, str>>>(self, autocomplete: S) -> ItemBuilder<'a>
Sets autocomplete
to the given value.
fn text_copy<S: Into<Cow<'a, str>>>(self, text: S) -> ItemBuilder<'a>
Sets text_copy
to the given value.
fn text_large_type<S: Into<Cow<'a, str>>>(self, text: S) -> ItemBuilder<'a>
Sets text_large_type
to the given value.
fn quicklook_url<S: Into<Cow<'a, str>>>(self, url: S) -> ItemBuilder<'a>
Sets quicklook_url
to the given value.
fn variable<K, V>(self, key: K, value: V) -> ItemBuilder<'a> where
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Inserts a key/value pair into the item variables.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn variables<I, K, V>(self, variables: I) -> ItemBuilder<'a> where
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Sets the item's variables to variables
.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn variable_mod<K, V>(
self,
modifier: Modifier,
key: K,
value: V
) -> ItemBuilder<'a> where
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
self,
modifier: Modifier,
key: K,
value: V
) -> ItemBuilder<'a> where
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Inserts a key/value pair into the variables for the given modifier.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn variables_mod<I, K, V>(
self,
modifier: Modifier,
variables: I
) -> ItemBuilder<'a> where
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
self,
modifier: Modifier,
variables: I
) -> ItemBuilder<'a> where
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Sets the variables to variables
for the given modifier.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
impl<'a> ItemBuilder<'a>
[src]
fn set_title<S: Into<Cow<'a, str>>>(&mut self, title: S)
Sets the title
to the given value.
fn set_subtitle<S: Into<Cow<'a, str>>>(&mut self, subtitle: S)
Sets the default subtitle
to the given value.
fn unset_subtitle(&mut self)
Unsets the default subtitle
.
fn set_subtitle_mod<S: Into<Cow<'a, str>>>(
&mut self,
modifier: Modifier,
subtitle: S
)
&mut self,
modifier: Modifier,
subtitle: S
)
Sets the subtitle
to the given value for the given modifier.
fn unset_subtitle_mod(&mut self, modifier: Modifier)
Unsets the subtitle
for the given modifier.
This unsets the subtitle that's used when the given modifier is pressed.
fn clear_subtitle(&mut self)
Clears the subtitle
for all modifiers.
This unsets both the default subtitle and the per-modifier subtitles.
fn set_icon_path<S: Into<Cow<'a, str>>>(&mut self, path: S)
Sets the icon
to an image file on disk.
The path is interpreted relative to the workflow directory.
fn set_icon_file<S: Into<Cow<'a, str>>>(&mut self, path: S)
Sets the icon
to the icon for a given file on disk.
The path is interpreted relative to the workflow directory.
fn set_icon_filetype<S: Into<Cow<'a, str>>>(&mut self, filetype: S)
Sets the icon
to the icon for a given file type.
The type is a UTI, such as "public.jpeg".
fn unset_icon(&mut self)
Unsets the icon
.
fn set_icon_path_mod<S: Into<Cow<'a, str>>>(
&mut self,
modifier: Modifier,
path: S
)
&mut self,
modifier: Modifier,
path: S
)
Sets icon
to an image file on disk for the given modifier.
The path is interpreted relative to the workflow directory.
This property is only used with JSON output. The legacy XML output does not include per-modifier icons.
This property is only used with Alfred 3.4.1 or later.
fn set_icon_file_mod<S: Into<Cow<'a, str>>>(
&mut self,
modifier: Modifier,
path: S
)
&mut self,
modifier: Modifier,
path: S
)
Sets icon
to the icon for a given file on disk for the given modifier.
The path is interpreted relative to the workflow directory.
This property is only used with JSON output. The legacy XML output does not include per-modifier icons.
This property is only used with Alfred 3.4.1 or later.
fn set_icon_filetype_mod<S: Into<Cow<'a, str>>>(
&mut self,
modifier: Modifier,
filetype: S
)
&mut self,
modifier: Modifier,
filetype: S
)
Sets icon
to the icon for a given file type for the given modifier.
The type is a UTI, such as "public.jpeg".
This property is only used with JSON output. The legacy XML output does not include per-modifier icons.
This property is only used with Alfred 3.4.1 or later.
fn unset_icon_mod(&mut self, modifier: Modifier)
Unsets icon
for the given modifier.
This unsets the result icon that's used when the given modifier is pressed.
fn clear_icon(&mut self)
Clears the icon
for all modifiers.
This unsets both the default icon and the per-modifier icons.
fn set_uid<S: Into<Cow<'a, str>>>(&mut self, uid: S)
Sets the uid
to the given value.
fn unset_uid(&mut self)
Unsets the uid
.
fn set_arg<S: Into<Cow<'a, str>>>(&mut self, arg: S)
Sets the arg
to the given value.
fn unset_arg(&mut self)
Unsets the arg
.
fn set_arg_mod<S: Into<Cow<'a, str>>>(&mut self, modifier: Modifier, arg: S)
Sets the arg
to the given value for the given modifier.
fn unset_arg_mod(&mut self, modifier: Modifier)
Unsets the arg
for the given modifier.
This unsets the arg that's used when the given modifier is pressed.
fn clear_arg(&mut self)
Clears the arg
for all modifiers.
This unsets both the default arg and the per-modifier args.
fn set_type(&mut self, type_: ItemType)
Sets the type
to the given value.
fn set_valid(&mut self, valid: bool)
Sets valid
to the given value.
fn set_valid_mod(&mut self, modifier: Modifier, valid: bool)
Sets valid
to the given value for the given modifier.
fn unset_valid_mod(&mut self, modifier: Modifier)
Unsets valid
for the given modifier.
This unsets the validity that's used when the given modifier is pressed.
fn clear_valid(&mut self)
Unsets valid
for all modifiers.
This resets valid
back to the default and clears all per-modifier validity.
fn set_autocomplete<S: Into<Cow<'a, str>>>(&mut self, autocomplete: S)
Sets autocomplete
to the given value.
fn unset_autocomplete(&mut self)
Unsets autocomplete
.
fn set_modifier<S: Into<Cow<'a, str>>, S2: Into<Cow<'a, str>>>(
&mut self,
modifier: Modifier,
subtitle: Option<S>,
arg: Option<S2>,
valid: bool,
icon: Option<Icon<'a>>
)
&mut self,
modifier: Modifier,
subtitle: Option<S>,
arg: Option<S2>,
valid: bool,
icon: Option<Icon<'a>>
)
Sets subtitle, arg, validity, and icon for the given modifier.
fn unset_modifier(&mut self, modifier: Modifier)
Unsets subtitle, arg, and validity for the given modifier.
fn set_text_copy<S: Into<Cow<'a, str>>>(&mut self, text: S)
Sets text_copy
to the given value.
fn unset_text_copy(&mut self)
Unsets text_copy
.
fn set_text_large_type<S: Into<Cow<'a, str>>>(&mut self, text: S)
Sets text_large_type
to the given value.
fn unset_text_large_type(&mut self)
Unsets text_large_type
.
fn set_quicklook_url<S: Into<Cow<'a, str>>>(&mut self, url: S)
Sets quicklook_url
to the given value.
fn unset_quicklook_url(&mut self)
Unsets quicklook_url
.
fn set_variable<K, V>(&mut self, key: K, value: V) where
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Inserts a key/value pair into the item variables.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn unset_variable<K: ?Sized>(&mut self, key: &K) where
Cow<'a, str>: Borrow<K>,
K: Hash + Eq,
Cow<'a, str>: Borrow<K>,
K: Hash + Eq,
Removes a key from the item variables.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn set_variables<I, K, V>(&mut self, variables: I) where
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Sets the item's variables to variables
.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn unset_variables(&mut self)
Removes all item variables.
This does not affect per-modifier variables.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn set_variable_mod<K, V>(&mut self, modifier: Modifier, key: K, value: V) where
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Inserts a key/value pair into the variables for the given modifier.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn unset_variable_mod<K: ?Sized>(&mut self, modifier: Modifier, key: &K) where
Cow<'a, str>: Borrow<K>,
K: Hash + Eq,
Cow<'a, str>: Borrow<K>,
K: Hash + Eq,
Removes a key from the variables for the given modifier.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn set_variables_mod<I, K, V>(&mut self, modifier: Modifier, variables: I) where
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
I: IntoIterator<Item = (K, V)>,
K: Into<Cow<'a, str>>,
V: Into<Cow<'a, str>>,
Sets the variables to variables
for the given modifier.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn unset_variables_mod(&mut self, modifier: Modifier)
Removes all variables for the given modifier.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
fn clear_variables(&mut self)
Removes all item variables and all per-modifier variables.
Item variables are only used with JSON output and only affect Alfred 3.4.1 or later.
Trait Implementations
impl<'a> Clone for ItemBuilder<'a>
[src]
fn clone(&self) -> ItemBuilder<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more