pub struct Inline {
pub value: Option<Value>,
pub raw: bool,
}Expand description
消息头中的载荷字段:JSON 载荷内联为 value,二进制载荷放在帧 body 中并以 raw: true 标记。
两个字段均为默认值时不会出现在序列化结果中;与 body 组合成 Payload 见 Inline::join。
Fields§
§value: Option<Value>内联的 JSON 载荷;缺省表示无载荷(null)。
raw: bool为 true 时载荷是帧 body 中的原始字节,此时 value 必须缺省。
Implementations§
Source§impl Inline
impl Inline
Sourcepub fn join(self, body: Vec<u8>) -> Result<Payload, ProtocolError>
pub fn join(self, body: Vec<u8>) -> Result<Payload, ProtocolError>
将载荷字段与帧 body 组合为 Payload,是 Payload::split 的逆操作。
§Errors
以下情况返回 ProtocolError::Malformed(转换为 Error 后错误码为 internal):
raw 为 true 却同时带有 value,或未设置 raw 而 body 非空。
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Inline
impl<'de> Deserialize<'de> for Inline
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Inline
Auto Trait Implementations§
impl Forget for Inline
impl Freeze for Inline
impl Move for Inline
impl RefUnwindSafe for Inline
impl Send for Inline
impl Sync for Inline
impl Unpin for Inline
impl UnsafeUnpin for Inline
impl UnwindSafe for Inline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more