fn from()

in sdk/core/azure_core_amqp/src/messaging.rs [645:676]


    fn from(header: AmqpMessageHeader) -> AmqpList {
        let mut list = vec![AmqpValue::Null; 5];

        // Serialize the current value, if it exists. Otherwise serialize a null
        // value if there are other values to serialize.

        if header.durable {
            list[0] = AmqpValue::Boolean(header.durable)
        };
        if header.priority != 4 {
            list[1] = AmqpValue::UByte(header.priority)
        };
        list[2] = header.time_to_live.map_or(AmqpValue::Null, |ttl| {
            AmqpValue::UInt(ttl.as_millis() as u32)
        });
        if header.first_acquirer {
            list[3] = AmqpValue::Boolean(header.first_acquirer)
        };
        if header.delivery_count != 0 {
            list[4] = AmqpValue::UInt(header.delivery_count)
        };

        let mut trailing_nulls = 0;
        for val in list.iter().rev() {
            if *val != AmqpValue::Null {
                break;
            }
            trailing_nulls += 1;
        }
        list.truncate(list.len() - trailing_nulls);
        AmqpList::from(list)
    }