/// Creates an Alfred row item from feature data.
Creates an Alfred row item from feature data.
Creates an Alfred row item from feature data .
pub fn to_alfred_item(&self, base_url: &str) -> Item<'static> {
        let mut builder = ItemBuilder::new(self.title.clone());
        match self.version_number.as_deref() {
            Some(v) => builder.set_subtitle(format!("since v{}", v)),
            None => builder.set_subtitle("unstable"),
        };
        builder.set_arg(format!("{}/features/{}", base_url, &self.slug));
        builder.set_quicklook_url(format!("{}/features/{}", base_url, &self.slug));
        if self.items.is_empty() {
            // seems to prevent large type activation
            builder.set_text_large_type(" ".to_owned());
        } else {
            builder.set_text_large_type(self.items.join("\n"));
        }
        if let Some(ref doc_path) = self.doc_path {
            let doc_url = format!("https://doc.rust-lang.org/{}", doc_path);
            builder.set_quicklook_url(doc_url.clone());
            builder.set_modifier(
                Modifier::Option,
                Some("Press enter to see docs."),
                Some(doc_url),
                true,
                None,
            );
        } else {
            builder.set_modifier(
                Modifier::Option,
                Some("No docs available."),
                None::<String>,
                false,
                None,
            );
        }
        builder.into_item()
    }
pub fn to_alfred_item ( & self , base_url : & str ) -> Item < ' static > { let mut builder = ItemBuilder :: new ( self . title . clone ( ) ) ; match self . version_number . as_deref ( ) { Some ( v ) => builder . set_subtitle ( format ! ( " " v ) ) , None => builder . set_subtitle ( " " ) , } ; builder . set_arg ( format ! ( " " base_url self slug ) ) ; builder . set_quicklook_url ( format ! ( " " base_url self slug ) ) ; if self . items . is_empty ( ) { // seems to prevent large type activation builder . set_text_large_type ( " " . to_owned ( ) ) ; } else { builder . set_text_large_type ( self . items . join ( " \n " ) ) ; } if let Some ( ref doc_path ) = self . doc_path { let doc_url = format ! ( " " doc_path ) ; builder . set_quicklook_url ( doc_url . clone ( ) ) ; builder . set_modifier ( Modifier :: Option , Some ( " " ) , Some ( doc_url ) , true , None , ) ; } else { builder . set_modifier ( Modifier :: Option , Some ( " " ) , None :: < String > , false , None , ) ; } builder . into_item ( ) }
Creates an Alfred row item from feature data.
Creates an Alfred row item from feature data .
&self
base_url
&str