pub struct Response {
pub id: u64,
pub control: u8,
pub body: ResponseBody,
}Fields§
§id: u64§control: u8§body: ResponseBodyImplementations§
Source§impl Response
impl Response
pub fn new(body: ResponseBody) -> Self
pub fn ack() -> Self
pub fn error(msg: impl Into<String>) -> Self
pub fn span(s: WireSpan) -> Self
pub fn cache_level(level: WireLevelFilter) -> Self
pub fn cache_chance(pct: f64) -> Self
pub fn server_info(version: impl Into<String>) -> Self
Sourcepub fn with_id(self, id: u64) -> Self
pub fn with_id(self, id: u64) -> Self
Set the message id and return self so the call chains. The
server must echo the request id on every response so the
client’s completion registry (keyed by id) can route the
response back to the right pending RPC. protosocket-rpc does
NOT auto-assign ids — both endpoints must do it manually, and
in particular an RPC at id=0 will clobber any other RPC at
id=0 on the same client connection.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
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
Source§impl Message for Response
impl Message for Response
Source§fn message_id(&self) -> u64
fn message_id(&self) -> u64
This is used to relate requests to responses. An RPC response has the same id as the request that generated it.
Source§fn control_code(&self) -> ProtosocketControlCode
fn control_code(&self) -> ProtosocketControlCode
Set the protosocket behavior of this message.
Source§fn set_message_id(&mut self, id: u64)
fn set_message_id(&mut self, id: u64)
This is used to relate requests to responses. An RPC response has the same id as the request that generated it.
When the message is sent, protosocket will set this value.
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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