(struc, fieldname=None)
given a wasm struct instance, compute the size of the element.
    if a field name is provided, fetch the size of the given field.
    otherwise, fetch the size of the entire struct.
given a wasm struct instance, compute the size of the element.
    if a field name is provided, fetch the size of the given field.
    otherwise, fetch the size of the entire struct.
given a wasm struct instance compute the size of the element . if a field name is provided fetch the size of the given field . otherwise fetch the size of the entire struct .
def size_of(struc, fieldname=None):
    '''
    given a wasm struct instance, compute the size of the element.
    if a field name is provided, fetch the size of the given field.
    otherwise, fetch the size of the entire struct.
    '''
    if fieldname is not None:
        # size of the given field, by name
        dec_meta = struc.get_decoder_meta()
        return dec_meta['lengths'][fieldname]
    else:
        # size of the entire given struct
        return sum(struc.get_decoder_meta()['lengths'].values())
def size_of ( struc , fieldname = None ) : if fieldname is not None : # size of the given field, by name dec_meta = struc . get_decoder_meta ( ) return dec_meta [ 'lengths' ] [ fieldname ] else : # size of the entire given struct return sum ( struc . get_decoder_meta ( ) [ 'lengths' ] . values ( ) )