def _replace_embedded_type(self, name, newtype):
        '''
        Replace the embedded struct to a newly-created struct of another type (usually based on the
        original type). The attributes of the old struct is NOT preserved.
        
        :param name: either the original type, or the name of the original type. It is always the type
                     used in type definitions, even if it is already replaced once or more.
                     
        :param newtype: the new type to replace
        '''
        if hasattr(name, 'readablename'):
            name = name.readablename
        t,i = self._target._embedded_indices[name]
        t._seqs[i] = newtype.parser().new(self._target)
Replace the embedded struct to a newly-created struct of another type (usually based on the
        original type). The attributes of the old struct is NOT preserved.
        
        :param name: either the original type, or the name of the original type. It is always the type
                     used in type definitions, even if it is already replaced once or more.
                     
        :param newtype: the new type to replace