def is_supported()

in azure_functions_worker/bindings/shared_memory_data_transfer/shared_memory_manager.py [0:0]


    def is_supported(self, datum: Datum) -> bool:
        """
        Whether the given Datum object can be transferred to the functions host
        using shared memory.
        This logic is kept consistent with the host's which can be found in
        SharedMemoryManager.cs
        """
        if datum.type == 'bytes':
            num_bytes = len(datum.value)
            if num_bytes >= consts.MIN_BYTES_FOR_SHARED_MEM_TRANSFER and \
                    num_bytes <= consts.MAX_BYTES_FOR_SHARED_MEM_TRANSFER:
                return True
        elif datum.type == 'string':
            num_bytes = len(datum.value) * consts.SIZE_OF_CHAR_BYTES
            if num_bytes >= consts.MIN_BYTES_FOR_SHARED_MEM_TRANSFER and \
                    num_bytes <= consts.MAX_BYTES_FOR_SHARED_MEM_TRANSFER:
                return True
        return False