pub struct Baggage { /* private fields */ }Expand description
Baggage:跨进程键值对上下文。
遵循 W3C Baggage 规范,通过 baggage HTTP header 传播。
格式:key1=value1,key2=value2
Implementations§
Source§impl Baggage
impl Baggage
Sourcepub fn from_pairs(
pairs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> Self
pub fn from_pairs( pairs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> Self
从键值对列表创建
Sourcepub fn to_header(&self) -> String
pub fn to_header(&self) -> String
序列化为 W3C baggage header 值
格式:key1=value1,key2=value2
键值按字母序排列,保证输出确定性。
Sourcepub fn from_header(header: &str) -> Self
pub fn from_header(header: &str) -> Self
从 W3C baggage header 值解析
格式:key1=value1,key2=value2
解析时忽略空白条目和格式不正确的条目(无 =、空 key、空 value)。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Baggage
impl RefUnwindSafe for Baggage
impl Send for Baggage
impl Sync for Baggage
impl Unpin for Baggage
impl UnsafeUnpin for Baggage
impl UnwindSafe for Baggage
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