in sdk/core/azure_core_amqp/src/fe2o3/value.rs [235:290]
fn from(value: fe2o3_amqp_types::primitives::Value) -> Self {
match value {
fe2o3_amqp_types::primitives::Value::Null => AmqpValue::Null,
fe2o3_amqp_types::primitives::Value::Bool(b) => AmqpValue::Boolean(b),
fe2o3_amqp_types::primitives::Value::Ubyte(b) => AmqpValue::UByte(b),
fe2o3_amqp_types::primitives::Value::Ushort(s) => AmqpValue::UShort(s),
fe2o3_amqp_types::primitives::Value::Uint(i) => AmqpValue::UInt(i),
fe2o3_amqp_types::primitives::Value::Ulong(l) => AmqpValue::ULong(l),
fe2o3_amqp_types::primitives::Value::Byte(b) => AmqpValue::Byte(b),
fe2o3_amqp_types::primitives::Value::Short(s) => AmqpValue::Short(s),
fe2o3_amqp_types::primitives::Value::Int(i) => AmqpValue::Int(i),
fe2o3_amqp_types::primitives::Value::Long(l) => AmqpValue::Long(l),
fe2o3_amqp_types::primitives::Value::Float(f) => AmqpValue::Float(f.into()),
fe2o3_amqp_types::primitives::Value::Double(d) => AmqpValue::Double(d.into()),
fe2o3_amqp_types::primitives::Value::Char(c) => AmqpValue::Char(c),
fe2o3_amqp_types::primitives::Value::Timestamp(t) => AmqpValue::TimeStamp(t.into()),
fe2o3_amqp_types::primitives::Value::Uuid(u) => AmqpValue::Uuid(u.into()),
fe2o3_amqp_types::primitives::Value::Binary(b) => {
AmqpValue::Binary(ByteBuf::into_vec(b))
}
fe2o3_amqp_types::primitives::Value::String(s) => AmqpValue::String(s),
fe2o3_amqp_types::primitives::Value::Symbol(s) => AmqpValue::Symbol(s.into()),
fe2o3_amqp_types::primitives::Value::List(l) => {
let l = l.into_iter().map(|v| v.into()).collect::<Vec<AmqpValue>>();
AmqpValue::List(AmqpList(l))
}
fe2o3_amqp_types::primitives::Value::Map(m) => {
let mut map: AmqpOrderedMap<AmqpValue, AmqpValue> = AmqpOrderedMap::new();
for (k, v) in m {
map.insert(k.into(), v.into());
}
AmqpValue::Map(map)
}
fe2o3_amqp_types::primitives::Value::Array(a) => {
let mut vec = Vec::new();
for i in a {
vec.push(i.into());
}
AmqpValue::Array(vec)
}
fe2o3_amqp_types::primitives::Value::Described(d) => {
let descriptor: serde_amqp::descriptor::Descriptor = d.descriptor;
let value: AmqpValue = d.value.into();
let descriptor = match descriptor {
serde_amqp::descriptor::Descriptor::Code(code) => AmqpDescriptor::Code(code),
serde_amqp::descriptor::Descriptor::Name(symbol) => {
AmqpDescriptor::Name(symbol.into())
}
};
AmqpValue::Described(Box::new(AmqpDescribed::new(descriptor, value)))
}
fe2o3_amqp_types::primitives::Value::Decimal128(_) => todo!(),
fe2o3_amqp_types::primitives::Value::Decimal32(_) => todo!(),
fe2o3_amqp_types::primitives::Value::Decimal64(_) => todo!(),
}
}