pub fn as_crate(&self) -> Option<&str> {
        if let Some(ComponentRef::Crate(s)) = self.iter().next() {
            Some(s)
        } else {
            None
        }
    }
/// Get the crate corresponding to the item.
///
/// # Examples
///
/// ```rust
/// use runestick::Item;
///
/// let item = Item::with_crate("std");
/// assert_eq!(item.as_crate(), Some("std"));
///
/// let item = Item::with_item(&["local"]);
/// assert_eq!(item.as_crate(), None);
/// ```
Get the crate corresponding to the item.
Get the crate corresponding to the item .
pub fn as_crate(&self) -> Option<&str> {
        if let Some(ComponentRef::Crate(s)) = self.iter().next() {
            Some(s)
        } else {
            None
        }
    }
pub fn as_crate ( & self ) -> Option < & str > { if let Some ( ComponentRef :: Crate ( s ) ) = self . iter ( ) . next ( ) { Some ( s ) } else { None } }
Get the crate corresponding to the item.
Get the crate corresponding to the item .
&self
&self
examples
```rust
use runestick::Item.

let item = Item::with_crate("std");
assert_eq!(item.as_crate(), Some("std")).

let item = Item::with_item(&["local"]);
assert_eq!(item.as_crate(), None);
```
` ` ` rust use runestick :: Item . let item = Item :: with_crate ( " std " ) ; assert_eq! ( item . as_crate () Some ( " std " )) . let item = Item :: with_item ( & [ " local " ] ) ; assert_eq! ( item . as_crate () None ) ; ` ` `