pub enum Reply {
Welcome {
protocol: u16,
},
Refused(String),
Met {
path: Path,
good_for: Option<Duration>,
},
Unreachable(String),
}Expand description
What the broker answers.
Variants§
Welcome
The session is open, and this is the vocabulary I speak.
Refused(String)
No session, and here is why. Belongs to the session and not to a rendezvous: after this there is no conversation.
Met
You two have been introduced. Go and talk; I am out of it.
Fields
good_for: Option<Duration>How long this rendezvous is good for, counting from when you read
it. None is nobody is taking this back, which is every broker
with no policy.
A duration and not an instant: an Instant does not serialize
and means nothing off its own process, and a wall clock was already
ruled out next door — two machines on a cluster disagree by minutes,
so an expiry stamped there and read here would be a lease that
expires in the past.
Unreachable(String)
That host cannot be reached, and here is why. Belongs to the rendezvous: the session survives it, and another host may well be fine.
Implementations§
Source§impl Reply
impl Reply
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Unreadable>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Unreadable>
And back from them.
Sourcepub fn to_greeting(spoken: u16) -> Self
pub fn to_greeting(spoken: u16) -> Self
The answer to a greeting: Reply::Welcome if that is a vocabulary we
speak, and a Reply::Refused naming both numbers if it is not.
Here and not in a broker because every broker owes the same answer, and
three of them writing this comparison separately is three chances to
write >= and accept a stranger.