pub enum Answer {
Ready,
Send,
Refused(String),
Done(Outcome),
Failed(String),
Saw(Fact),
}Expand description
What the worker answers.
Variants§
Ready
Ready to work.
Send
I do not have that artifact: send it to me.
Refused(String)
No, and here is why. It belongs to the session, not to a job: after this there is no conversation.
Done(Outcome)
Done, with what it produced.
Failed(String)
What you sent failed over there. Text on purpose: what is needed here is for whoever launched the run to read what happened.
Saw(Fact)
Something happened over there, and the work is not over.
The only non-terminal answer there is, and it costs no second connection because the client is already blocked reading this one. Last in the enum on purpose — the variant’s index is what goes on the wire.
Implementations§
Source§impl Answer
impl Answer
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, MessageError>
pub fn to_bytes(&self) -> Result<Vec<u8>, MessageError>
This message in bytes. Fails if the slice produced something over there that cannot come back.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, MessageError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, MessageError>
And back from them.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Answer
impl<'de> Deserialize<'de> for Answer
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
impl StructuralPartialEq for Answer
Auto Trait Implementations§
impl Freeze for Answer
impl !RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnsafeUnpin for Answer
impl !UnwindSafe for Answer
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