sdk/rust: Add `Body::with_payload`
Add the `Body::with_payload` method, which can be used to change the type of the payload for a `Body`. This is useful when parsing the payload needs to be deferred until after the body is parsed.
This commit is contained in:
parent
4ea369d7a9
commit
0dbeeec3d4
|
@ -218,6 +218,21 @@ impl Header {
|
|||
}
|
||||
}
|
||||
|
||||
impl<P> Body<P> {
|
||||
/// Replace the payload of the body. Useful when parsing the payload needs to be delayed.
|
||||
pub fn with_payload<U>(self, p: U) -> Body<U> {
|
||||
Body {
|
||||
timestamp: self.timestamp,
|
||||
nonce: self.nonce,
|
||||
emitter_chain: self.emitter_chain,
|
||||
emitter_address: self.emitter_address,
|
||||
sequence: self.sequence,
|
||||
consistency_level: self.consistency_level,
|
||||
payload: p,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: Serialize> Body<P> {
|
||||
/// Body Digest Components.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue