pub fn insert<S, V>(&mut self, name: S, value: V) -> Result<()>
    where
        S: Into<String>,
        V: Into<Value>,
    {
        // The follow prevents `List`s with heterogeneous tags from being
        // inserted into the file.
        let nvalue = value.into();
        if let Value::List(ref vals) = nvalue {
            if !vals.is_empty() {
                let first_id = vals[0].id();
                for nbt in vals {
                    if nbt.id() != first_id {
                        return Err(Error::HeterogeneousList);
                    }
                }
            }
        }
        self.content.insert(name.into(), nvalue);
        Ok(())
    }
/// Insert an `Value` with a given name into this `Blob` object. This
/// method is just a thin wrapper around the underlying map method of
/// the same name.
///
/// This method will also return an error if a `Value::List` with
/// heterogeneous elements is passed in, because this is illegal in the NBT
/// file format.
Insert an `Value` with a given name into this `Blob` object. This
method is just a thin wrapper around the underlying map method of
the same name.

This method will also return an error if a `Value::List` with
heterogeneous elements is passed in, because this is illegal in the NBT
file format.
Insert an ` Value ` with a given name into this ` Blob ` object . This method is just a thin wrapper around the underlying map method of the same name . This method will also return an error if a ` Value :: List ` with heterogeneous elements is passed in because this is illegal in the NBT file format .
pub fn insert<S, V>(&mut self, name: S, value: V) -> Result<()>
    where
        S: Into<String>,
        V: Into<Value>,
    {
        // The follow prevents `List`s with heterogeneous tags from being
        // inserted into the file.
        let nvalue = value.into();
        if let Value::List(ref vals) = nvalue {
            if !vals.is_empty() {
                let first_id = vals[0].id();
                for nbt in vals {
                    if nbt.id() != first_id {
                        return Err(Error::HeterogeneousList);
                    }
                }
            }
        }
        self.content.insert(name.into(), nvalue);
        Ok(())
    }
pub fn insert < S , V > ( & mut self , name : S , value : V ) -> Result < ( ) > where S : Into < String > , V : Into < Value > , { // The follow prevents `List`s with heterogeneous tags from being // inserted into the file. let nvalue = value . into ( ) ; if let Value :: List ( ref vals ) = nvalue { if ! vals . is_empty ( ) { let first_id = vals [ 0 ] . id ( ) ; for nbt in vals { if nbt . id ( ) != first_id { return Err ( Error :: HeterogeneousList ) ; } } } } self . content . insert ( name . into ( ) , nvalue ) ; Ok ( ( ) ) }
Insert an `Value` with a given name into this `Blob` object.
Insert an ` Value ` with a given name into this ` Blob ` object .
&mut self
name
S
value
V