Type Alias libp2p_request_response::cbor::Behaviour
source · pub type Behaviour<Req, Resp> = Behaviour<Codec<Req, Resp>>;
Available on crate feature
cbor
only.Expand description
A request-response behaviour using cbor4ii::serde
for serializing and
deserializing the messages.
§Example
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct GreetRequest {
name: String,
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct GreetResponse {
message: String,
}
let behaviour = cbor::Behaviour::<GreetRequest, GreetResponse>::new(
[(StreamProtocol::new("/my-cbor-protocol"), ProtocolSupport::Full)],
request_response::Config::default()
);
Aliased Type§
struct Behaviour<Req, Resp> { /* private fields */ }