pub fn with_crate_item<I>(name: &str, iter: I) -> Self
    where
        I: IntoIterator,
        I::Item: IntoComponent,
    {
        let mut content = Vec::new();
        ComponentRef::Crate(name).write_component(&mut content);

        for c in iter {
            c.write_component(&mut content);
        }

        Self { content }
    }
/// Create a crated item with the given name.
///
/// # Examples
///
/// ```rust
/// use runestick::{Item, ComponentRef};
///
/// let item = Item::with_crate_item("std", &["option"]);
/// assert_eq!(item.as_crate(), Some("std"));
///
/// let mut it = item.iter();
/// assert_eq!(it.next(), Some(ComponentRef::Crate("std")));
/// assert_eq!(it.next(), Some(ComponentRef::Str("option")));
/// assert_eq!(it.next(), None);
/// ```
Create a crated item with the given name.
Create a crated item with the given name .
pub fn with_crate_item<I>(name: &str, iter: I) -> Self
    where
        I: IntoIterator,
        I::Item: IntoComponent,
    {
        let mut content = Vec::new();
        ComponentRef::Crate(name).write_component(&mut content);
        for c in iter {
            c.write_component(&mut content);
        }
        Self { content }
    }
pub fn with_crate_item < I > ( name : & str , iter : I ) -> Self where I : IntoIterator , I :: Item : IntoComponent , { let mut content = Vec :: new ( ) ; ComponentRef :: Crate ( name ) . write_component ( & mut content ) ; for c in iter { c . write_component ( & mut content ) ; } Self { content } }
Create a crated item with the given name.
Create a crated item with the given name .
name
&str
iter
I
name
&str
iter
I
examples
```rust
use runestick::{Item, ComponentRef}.

let item = Item::with_crate_item("std", &["option"]);
assert_eq!(item.as_crate(), Some("std")).

let mut it = item.iter();
assert_eq!(it.next(), Some(ComponentRef::Crate("std")));
assert_eq!(it.next(), Some(ComponentRef::Str("option")));
assert_eq!(it.next(), None);
```
` ` ` rust use runestick :: { Item ComponentRef } . let item = Item :: with_crate_item ( " std " & [ " option " ] ) ; assert_eq! ( item . as_crate () Some ( " std " )) . let mut it = item . iter () ; assert_eq! ( it . next () Some ( ComponentRef :: Crate ( " std " ))) ; assert_eq! ( it . next () Some ( ComponentRef :: Str ( " option " ))) ; assert_eq! ( it . next () None ) ; ` ` `