/// Converts a block to an *_ARRAY_VALUE block
Converts a block to an *_ARRAY_VALUE block
Converts a block to an * _ARRAY_VALUE block
pub fn become_array_value(
        &self,
        slots: usize,
        format: ArrayFormat,
        entry_type: BlockType,
        name_index: u32,
        parent_index: u32,
    ) -> Result<(), Error> {
        self.check_array_format(entry_type, &format)?;
        let order = self.order();
        let max_capacity = utils::array_capacity(order, entry_type)
            .ok_or(Error::InvalidArrayType(self.index()))?;
        if slots > max_capacity {
            return Err(Error::array_capacity_exceeded(slots, order, max_capacity));
        }
        self.write_value_header(BlockType::ArrayValue, name_index, parent_index)?;
        let mut payload = Payload(0);
        payload.set_array_entry_type(entry_type.to_u8().unwrap());
        payload.set_array_flags(format.to_u8().unwrap());
        payload.set_array_slots_count(slots.to_u8().unwrap());
        self.write_payload(payload);
        self.array_clear(0)?;
        Ok(())
    }
pub fn become_array_value ( & self , slots : usize , format : ArrayFormat , entry_type : BlockType , name_index : u32 , parent_index : u32 , ) -> Result < ( ) , Error > { self . check_array_format ( entry_type , & format ) ? ; let order = self . order ( ) ; let max_capacity = utils :: array_capacity ( order , entry_type ) . ok_or ( Error :: InvalidArrayType ( self . index ( ) ) ) ? ; if slots > max_capacity { return Err ( Error :: array_capacity_exceeded ( slots , order , max_capacity ) ) ; } self . write_value_header ( BlockType :: ArrayValue , name_index , parent_index ) ? ; let mut payload = Payload ( 0 ) ; payload . set_array_entry_type ( entry_type . to_u8 ( ) . unwrap ( ) ) ; payload . set_array_flags ( format . to_u8 ( ) . unwrap ( ) ) ; payload . set_array_slots_count ( slots . to_u8 ( ) . unwrap ( ) ) ; self . write_payload ( payload ) ; self . array_clear ( 0 ) ? ; Ok ( ( ) ) }
Converts a block to an *_ARRAY_VALUE block
Converts a block to an * _ARRAY_VALUE block
&self
slots
usize
format
ArrayFormat
entry_type
BlockType
name_index
u32
parent_index
u32